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: ...@@ -56,7 +56,6 @@ mat_macos:
variables: variables:
PREMAKE_OS: linux PREMAKE_OS: linux
BUILD_TYPE: x64 BUILD_TYPE: x64
DIST_PATH: build/bin/x64/Release
PREMAKE5_PATH: premake5 PREMAKE5_PATH: premake5
script: script:
- ln -sf premake/dll.lua . - ln -sf premake/dll.lua .
...@@ -65,8 +64,8 @@ mat_macos: ...@@ -65,8 +64,8 @@ mat_macos:
- make config=release_${BUILD_TYPE} -j$(nproc) - make config=release_${BUILD_TYPE} -j$(nproc)
- cd .. - cd ..
- mkdir -p dist/$BUILD_TYPE - mkdir -p dist/$BUILD_TYPE
- cp $DIST_PATH/libocgcore.* dist/$BUILD_TYPE/ - cp build/bin/$BUILD_TYPE/Release/libocgcore.* dist/$BUILD_TYPE/
- cp $DIST_PATH/libsqlite3.* dist/$BUILD_TYPE/ || true - cp build/bin/$BUILD_TYPE/Release/libsqlite3.* dist/$BUILD_TYPE/ || true
artifacts: artifacts:
paths: paths:
- dist - dist
...@@ -78,7 +77,6 @@ build_linux_x32: ...@@ -78,7 +77,6 @@ build_linux_x32:
extends: .build_unix extends: .build_unix
variables: variables:
BUILD_TYPE: x32 BUILD_TYPE: x32
DIST_PATH: build/bin/x32/Release
before_script: before_script:
- apt update; apt -y install gcc-multilib g++-multilib - apt update; apt -y install gcc-multilib g++-multilib
...@@ -87,10 +85,6 @@ build_wasm: ...@@ -87,10 +85,6 @@ build_wasm:
variables: variables:
PREMAKE_OS: emscripten PREMAKE_OS: emscripten
BUILD_TYPE: wasm BUILD_TYPE: wasm
DIST_PATH: wasm
WASM: '1'
before_script:
- mkdir -p wasm
image: git-registry.moenext.com/mycard/docker-ygopro-builder:debian12 image: git-registry.moenext.com/mycard/docker-ygopro-builder:debian12
.build_windows: .build_windows:
...@@ -148,7 +142,6 @@ build_macos_m1: ...@@ -148,7 +142,6 @@ build_macos_m1:
- macos-m1 - macos-m1
variables: variables:
BUILD_TYPE: arm64 BUILD_TYPE: arm64
DIST_PATH: build/bin/arm64/Release
build_macos: build_macos:
stage: combine stage: combine
......
newoption { trigger = "lua-dir", description = "", value = "PATH", default = "./lua" } newoption { trigger = "lua-dir", description = "", value = "PATH", default = "./lua" }
newoption { trigger = "wasm", description = "" }
newoption { trigger = "sqlite3-dir", description = "", value = "PATH" } newoption { trigger = "sqlite3-dir", description = "", value = "PATH" }
function GetParam(param) function GetParam(param)
...@@ -11,8 +10,6 @@ if not os.isdir(LUA_DIR) then ...@@ -11,8 +10,6 @@ if not os.isdir(LUA_DIR) then
LUA_DIR="../lua" LUA_DIR="../lua"
end end
WASM = GetParam("wasm")
SQLITE3_DIR=GetParam("sqlite3-dir") SQLITE3_DIR=GetParam("sqlite3-dir")
workspace "ocgcoredll" workspace "ocgcoredll"
...@@ -20,12 +17,7 @@ workspace "ocgcoredll" ...@@ -20,12 +17,7 @@ workspace "ocgcoredll"
language "C++" language "C++"
cppdialect "C++14" cppdialect "C++14"
configurations { "Release", "Debug" } configurations { "Release", "Debug" }
if WASM then platforms { "x64", "x32", "arm64", "wasm" }
toolset "emcc"
platforms { "wasm" }
else
platforms { "x64", "x32", "arm64" }
end
filter "platforms:x32" filter "platforms:x32"
architecture "x32" architecture "x32"
...@@ -69,8 +61,9 @@ workspace "ocgcoredll" ...@@ -69,8 +61,9 @@ workspace "ocgcoredll"
pic "On" pic "On"
linkoptions { "-static-libstdc++", "-static-libgcc" } linkoptions { "-static-libstdc++", "-static-libgcc" }
filter "system:emscripten" filter "platforms:wasm"
defines { "LUA_USE_C89" } toolset "emcc"
defines { "LUA_USE_C89", "LUA_USE_LONGJMP" }
pic "On" pic "On"
filter {} filter {}
...@@ -86,9 +79,9 @@ project "ocgcore" ...@@ -86,9 +79,9 @@ project "ocgcore"
includedirs { LUA_DIR .. "/src" } includedirs { LUA_DIR .. "/src" }
filter "system:emscripten" filter "platforms:wasm"
targetextension ".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 if not WASM and SQLITE3_DIR and os.isdir(SQLITE3_DIR) then
project "sqlite3" 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