Commit bbc722b6 authored by nanahira's avatar nanahira

simplify wasm build

parent d2d3e31e
Pipeline #39712 passed with stages
in 3 minutes and 52 seconds
......@@ -56,7 +56,6 @@ mat_macos:
variables:
PREMAKE_OS: linux
BUILD_TYPE: x64
DIST_PATH: build/bin/x64/Release
PREMAKE5_PATH: premake5
script:
- ln -sf premake/dll.lua .
......@@ -65,8 +64,8 @@ mat_macos:
- make config=release_${BUILD_TYPE} -j$(nproc)
- cd ..
- mkdir -p dist/$BUILD_TYPE
- cp $DIST_PATH/libocgcore.* dist/$BUILD_TYPE/
- cp $DIST_PATH/libsqlite3.* dist/$BUILD_TYPE/ || true
- cp build/bin/$BUILD_TYPE/Release/libocgcore.* dist/$BUILD_TYPE/
- cp build/bin/$BUILD_TYPE/Release/libsqlite3.* dist/$BUILD_TYPE/ || true
artifacts:
paths:
- dist
......@@ -78,7 +77,6 @@ build_linux_x32:
extends: .build_unix
variables:
BUILD_TYPE: x32
DIST_PATH: build/bin/x32/Release
before_script:
- apt update; apt -y install gcc-multilib g++-multilib
......@@ -87,10 +85,6 @@ build_wasm:
variables:
PREMAKE_OS: emscripten
BUILD_TYPE: wasm
DIST_PATH: wasm
WASM: '1'
before_script:
- mkdir -p wasm
image: git-registry.moenext.com/mycard/docker-ygopro-builder:debian12
.build_windows:
......@@ -148,7 +142,6 @@ build_macos_m1:
- macos-m1
variables:
BUILD_TYPE: arm64
DIST_PATH: build/bin/arm64/Release
build_macos:
stage: combine
......
newoption { trigger = "lua-dir", description = "", value = "PATH", default = "./lua" }
newoption { trigger = "wasm", description = "" }
newoption { trigger = "sqlite3-dir", description = "", value = "PATH" }
function GetParam(param)
......@@ -11,8 +10,6 @@ if not os.isdir(LUA_DIR) then
LUA_DIR="../lua"
end
WASM = GetParam("wasm")
SQLITE3_DIR=GetParam("sqlite3-dir")
workspace "ocgcoredll"
......@@ -20,12 +17,7 @@ workspace "ocgcoredll"
language "C++"
cppdialect "C++14"
configurations { "Release", "Debug" }
if WASM then
toolset "emcc"
platforms { "wasm" }
else
platforms { "x64", "x32", "arm64" }
end
platforms { "x64", "x32", "arm64", "wasm" }
filter "platforms:x32"
architecture "x32"
......@@ -69,8 +61,9 @@ workspace "ocgcoredll"
pic "On"
linkoptions { "-static-libstdc++", "-static-libgcc" }
filter "system:emscripten"
defines { "LUA_USE_C89" }
filter "platforms:wasm"
toolset "emcc"
defines { "LUA_USE_C89", "LUA_USE_LONGJMP" }
pic "On"
filter {}
......@@ -86,9 +79,9 @@ project "ocgcore"
includedirs { LUA_DIR .. "/src" }
filter "system:emscripten"
filter "platforms:wasm"
targetextension ".wasm"
linkoptions { "-s MODULARIZE=1", "-s EXPORT_NAME=\"createOcgcore\"", "--no-entry", "-s ENVIRONMENT=web,node", "-s EXPORTED_RUNTIME_METHODS=[\"ccall\",\"cwrap\",\"addFunction\",\"removeFunction\"]", "-s ALLOW_TABLE_GROWTH=1", "-s ALLOW_MEMORY_GROWTH=1", "-o ../wasm/libocgcore.js" }
linkoptions { "-s MODULARIZE=1", "-s EXPORT_NAME=\"createOcgcore\"", "--no-entry", "-s ENVIRONMENT=web,node", "-s EXPORTED_RUNTIME_METHODS=[\"ccall\",\"cwrap\",\"addFunction\",\"removeFunction\"]", "-s EXPORTED_FUNCTIONS=[\"_malloc\",\"_free\"]", "-s ALLOW_TABLE_GROWTH=1", "-s ALLOW_MEMORY_GROWTH=1", "-o ../build/bin/wasm/Release/libocgcore.js" }
if not WASM and SQLITE3_DIR and os.isdir(SQLITE3_DIR) then
project "sqlite3"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment