Commit 7c5e63c1 authored by nanahira's avatar nanahira

add sqlite3

parent d9579e2f
Pipeline #34162 failed with stages
in 2 minutes and 27 seconds
...@@ -15,9 +15,12 @@ lua: ...@@ -15,9 +15,12 @@ lua:
- wget -O - https://cdn02.moecube.com:444/ygopro-build-materials/lua-5.4.4.tar.gz | tar zfx - - wget -O - https://cdn02.moecube.com:444/ygopro-build-materials/lua-5.4.4.tar.gz | tar zfx -
- mv lua-5.4.4 lua - mv lua-5.4.4 lua
- cp premake/lua.lua lua/premake5.lua - cp premake/lua.lua lua/premake5.lua
- wget -O - https://cdn01.moecube.com/ygopro-build-materials/sqlite-autoconf-3360000.tar.gz | tar zfx -
- mv sqlite-autoconf-3360000 sqlite3
artifacts: artifacts:
paths: paths:
- lua - lua
- sqlite3
mat_windows: mat_windows:
stage: prepare stage: prepare
...@@ -56,12 +59,13 @@ mat_macos: ...@@ -56,12 +59,13 @@ mat_macos:
PREMAKE5_PATH: premake5 PREMAKE5_PATH: premake5
script: script:
- ln -sf premake/dll.lua . - ln -sf premake/dll.lua .
- $PREMAKE5_PATH gmake --file=dll.lua --os=$PREMAKE_OS - $PREMAKE5_PATH gmake --file=dll.lua --os=$PREMAKE_OS --sqlite3-dir=sqlite3
- cd build - cd build
- 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 $DIST_PATH/libocgcore.* dist/$BUILD_TYPE/
- cp $DIST_PATH/libsqlite3.* dist/$BUILD_TYPE/
artifacts: artifacts:
paths: paths:
- dist - dist
...@@ -97,7 +101,7 @@ build_wasm: ...@@ -97,7 +101,7 @@ build_wasm:
- vs - vs
before_script: before_script:
- copy premake\dll.lua dll.lua - copy premake\dll.lua dll.lua
- '.\premake5.exe vs2019 --file=dll.lua' - '.\premake5.exe vs2019 --file=dll.lua --sqlite3-dir=sqlite3'
- mkdir dist - mkdir dist
artifacts: artifacts:
paths: paths:
...@@ -109,6 +113,7 @@ build_windows_x32: ...@@ -109,6 +113,7 @@ build_windows_x32:
- cmd /c '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" build\ocgcoredll.sln /t:Build /p:Configuration=Release /p:Platform=Win32' - cmd /c '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" build\ocgcoredll.sln /t:Build /p:Configuration=Release /p:Platform=Win32'
- mkdir dist\x32 - mkdir dist\x32
- copy build\bin\x32\Release\ocgcore.dll dist\x32\ocgcore.dll - copy build\bin\x32\Release\ocgcore.dll dist\x32\ocgcore.dll
- copy build\bin\x32\Release\sqlite3.dll dist\x32\sqlite3.dll
build_windows_x64: build_windows_x64:
extends: .build_windows extends: .build_windows
...@@ -116,6 +121,7 @@ build_windows_x64: ...@@ -116,6 +121,7 @@ build_windows_x64:
- cmd /c '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" build\ocgcoredll.sln /t:Build /p:Configuration=Release /p:Platform=x64' - cmd /c '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" build\ocgcoredll.sln /t:Build /p:Configuration=Release /p:Platform=x64'
- mkdir dist\x64 - mkdir dist\x64
- copy build\bin\x64\Release\ocgcore.dll dist\x64\ocgcore.dll - copy build\bin\x64\Release\ocgcore.dll dist\x64\ocgcore.dll
- copy build\bin\x64\Release\sqlite3.dll dist\x64\sqlite3.dll
.build_macos_arch: .build_macos_arch:
extends: .build_unix extends: .build_unix
...@@ -148,6 +154,7 @@ build_macos: ...@@ -148,6 +154,7 @@ build_macos:
script: script:
- mkdir -p dist/macos - mkdir -p dist/macos
- lipo -create -output dist/macos/libocgcore.dylib dist/x64/libocgcore.dylib dist/arm64/libocgcore.dylib - lipo -create -output dist/macos/libocgcore.dylib dist/x64/libocgcore.dylib dist/arm64/libocgcore.dylib
- lipo -create -output dist/macos/libsqlite3.dylib dist/x64/libsqlite3.dylib dist/arm64/libsqlite3.dylib
- rm -rf dist/x64 dist/arm64 - rm -rf dist/x64 dist/arm64
artifacts: artifacts:
paths: paths:
......
newoption { trigger = "lua-dir", description = "", value = "PATH", default = "./lua" } newoption { trigger = "lua-dir", description = "", value = "PATH", default = "./lua" }
newoption { trigger = "wasm", description = "" } newoption { trigger = "wasm", description = "" }
newoption { trigger = "sqlite3-dir", description = "", value = "PATH" }
function GetParam(param) function GetParam(param)
return _OPTIONS[param] or os.getenv(string.upper(string.gsub(param,"-","_"))) return _OPTIONS[param] or os.getenv(string.upper(string.gsub(param,"-","_")))
...@@ -12,6 +13,8 @@ end ...@@ -12,6 +13,8 @@ end
WASM = GetParam("wasm") WASM = GetParam("wasm")
SQLITE3_DIR=GetParam("sqlite3-dir")
workspace "ocgcoredll" workspace "ocgcoredll"
location "build" location "build"
language "C++" language "C++"
...@@ -95,3 +98,35 @@ project "ocgcore" ...@@ -95,3 +98,35 @@ project "ocgcore"
filter "system:emscripten" filter "system:emscripten"
targetextension ".wasm" targetextension ".wasm"
linkoptions { "-s MODULARIZE=1", "-s EXPORT_NAME=\"createOcgcore\"", "--no-entry", "-s EXPORTED_FUNCTIONS=[\"_set_script_reader\",\"_set_card_reader\",\"_set_message_handler\",\"_create_duel\",\"_start_duel\",\"_end_duel\",\"_set_player_info\",\"_get_log_message\",\"_get_message\",\"_process\",\"_new_card\",\"_new_tag_card\",\"_query_card\",\"_query_field_count\",\"_query_field_card\",\"_query_field_info\",\"_set_responsei\",\"_set_responseb\",\"_preload_script\"]", "-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 EXPORTED_FUNCTIONS=[\"_set_script_reader\",\"_set_card_reader\",\"_set_message_handler\",\"_create_duel\",\"_start_duel\",\"_end_duel\",\"_set_player_info\",\"_get_log_message\",\"_get_message\",\"_process\",\"_new_card\",\"_new_tag_card\",\"_query_card\",\"_query_field_count\",\"_query_field_card\",\"_query_field_info\",\"_set_responsei\",\"_set_responseb\",\"_preload_script\"]", "-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" }
if not WASM and SQLITE3_DIR and os.isdir(SQLITE3_DIR) then
project "sqlite3"
kind "SharedLib"
language "C"
files {
SQLITE3_DIR .. "/sqlite3.c",
SQLITE3_DIR .. "/sqlite3.h"
}
-- 系统相关
filter "system:windows"
systemversion "latest"
defines { "SQLITE_API=__declspec(dllexport)" }
filter "system:linux or system:macosx"
pic "On"
defines { "SQLITE_API=__attribute__((visibility(\"default\")))" }
filter "system:linux"
linkoptions { "-static-libstdc++", "-static-libgcc" }
-- 配置项
filter "configurations:Debug"
symbols "On"
defines { "DEBUG" }
filter "configurations:Release"
optimize "On"
defines { "NDEBUG" }
end
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