Commit e31b8d6a authored by mercury233's avatar mercury233

Merge branch 'patch-premake-update' of https://github.com/Fluorohydride/ygopro

parents 16e41691 33b359a6
......@@ -3,11 +3,10 @@ set -x
set -o errexit
TARGET_YGOPRO_BINARY_PATH=./ygopro-platforms/ygopro-platform-$TARGET_PATFORM
export YGOPRO_LIBEVENT_STATIC_PATH=$PWD/libevent-stable
git submodule update --init
./premake5 gmake --cc=clang
./premake5 gmake --cc=clang --build-freetype --build-sqlite --event-include-dir=$PWD/libevent-stable/include --event-lib-dir=$PWD/libevent-stable/lib
cd build
make config=release -j4
cd ..
......
......@@ -140,13 +140,6 @@ exec_windows:
- mat_common
- mat_irrklang
- mat_windows
variables:
YGOPRO_BUILD_LUA: '1'
YGOPRO_BUILD_SQLITE: '1'
YGOPRO_BUILD_FREETYPE: '1'
YGOPRO_BUILD_IRRLICHT: '1'
IRRKLANG_PRO: '1'
USE_IRRKLANG: '1'
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
......@@ -155,8 +148,8 @@ exec_windows:
script:
- git submodule update --init
- bash -c 'cp -rf premake/* .'
- '.\premake5.exe vs2019'
- cmd /c '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" build\ygo.sln /m /p:Configuration=Release'
- '.\premake5.exe vs2019 --irrklang-pro'
- cmd /c '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\msbuild.exe" build\YGOPro.sln /m /p:Configuration=Release'
- copy bin\release\ygopro.exe .
artifacts:
paths:
......@@ -166,12 +159,6 @@ exec_linux:
stage: build
tags:
- linux
variables:
YGOPRO_BUILD_LUA: '1'
YGOPRO_BUILD_SQLITE: '1'
YGOPRO_BUILD_FREETYPE: '1'
YGOPRO_BUILD_IRRLICHT: '1'
USE_IRRKLANG: '1'
dependencies:
- mat_common
- mat_irrklang
......@@ -186,7 +173,7 @@ exec_linux:
- git submodule update --init
- mkdir lib
- cp -rf irrklang/bin/linux-gcc-64/libIrrKlang.so ./lib/
- env YGOPRO_LIBEVENT_STATIC_PATH=$PWD/libevent-stable ./premake5 gmake
- ./premake5 gmake --build-freetype --build-sqlite --build-irrlicht --event-include-dir=$PWD/libevent-stable/include --event-lib-dir=$PWD/libevent-stable/lib
- cd build
- make config=release -j$(nproc)
- cd ..
......@@ -207,10 +194,6 @@ exec_macos_platform_x86:
- mat_common
- mat_macos_platform_x86
variables:
YGOPRO_BUILD_LUA: '1'
YGOPRO_BUILD_SQLITE: '1'
YGOPRO_BUILD_FREETYPE: '1'
USE_IRRKLANG: '1'
TARGET_PATFORM: x86
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
......@@ -233,9 +216,6 @@ exec_macos_platform_m1:
- mat_common
- mat_macos_platform_m1
variables:
YGOPRO_BUILD_LUA: '1'
YGOPRO_BUILD_SQLITE: '1'
YGOPRO_BUILD_FREETYPE: '1'
TARGET_PATFORM: m1
YGOPRO_TARGET_ARM: '1'
cache:
......
include "lzma/."
include "spmemvfs/."
project "ygopro"
project "YGOPro"
kind "WindowedApp"
files { "**.cpp", "**.cc", "**.c", "**.h" }
excludes { "lzma/**", "spmemvfs/**" }
includedirs { "../ocgcore", "../irrlicht/include" }
links { "ocgcore", "clzma", "cspmemvfs", "Irrlicht", "sqlite3", "freetype", "event" }
files { "*.cpp", "*.h" }
includedirs { "../ocgcore" }
links { "ocgcore", "clzma", "cspmemvfs", LUA_LIB_NAME, "sqlite3", "irrlicht", "freetype", "event" }
if BUILD_EVENT then
includedirs { "../event/include" }
else
includedirs { EVENT_INCLUDE_DIR }
libdirs { EVENT_LIB_DIR }
end
if BUILD_IRRLICHT then
includedirs { "../irrlicht/include" }
else
includedirs { IRRLICHT_INCLUDE_DIR }
libdirs { IRRLICHT_LIB_DIR }
end
if BUILD_FREETYPE then
includedirs { "../freetype/include" }
else
includedirs { FREETYPE_INCLUDE_DIR }
libdirs { FREETYPE_LIB_DIR }
end
if BUILD_SQLITE then
includedirs { "../sqlite3" }
else
includedirs { SQLITE_INCLUDE_DIR }
libdirs { SQLITE_LIB_DIR }
end
if USE_IRRKLANG then
defines { "YGOPRO_USE_IRRKLANG" }
links { "ikpmp3" }
includedirs { "../irrklang/include" }
if IRRKLANG_PRO then
defines { "IRRKLANG_STATIC" }
includedirs { IRRKLANG_INCLUDE_DIR }
if not IRRKLANG_PRO then
libdirs { IRRKLANG_LIB_DIR }
end
end
configuration "windows"
files "ygopro.rc"
excludes "CGUIButton.cpp"
includedirs { "../freetype/include", "../event/include", "../sqlite3" }
links { "lua" }
filter "system:windows"
defines { "_IRR_WCHAR_FILESYSTEM" }
files "ygopro.rc"
libdirs { "$(DXSDK_DIR)Lib/x86" }
if USE_IRRKLANG then
links { "irrKlang" }
if not IRRKLANG_PRO then
libdirs { "../irrklang/lib/Win32-visualStudio" }
if IRRKLANG_PRO then
defines { "IRRKLANG_STATIC" }
links { "ikpmp3" }
filter { "not configurations:Debug" }
libdirs { IRRKLANG_PRO_RELEASE_LIB_DIR }
filter { "configurations:Debug" }
libdirs { IRRKLANG_PRO_DEBUG_LIB_DIR }
filter {}
end
end
links { "opengl32", "ws2_32", "winmm", "gdi32", "kernel32", "user32", "imm32" }
if IRRKLANG_PRO then
configuration { "windows", "not vs2017", "not vs2019" }
libdirs { "../irrklang/lib/Win32-visualStudio" }
configuration { "windows", "vs2017" }
libdirs { "../irrklang/lib/Win32-vs2017" }
configuration { "windows", "vs2019" }
libdirs { "../irrklang/lib/Win32-vs2019" }
end
configuration {"windows", "not vs*"}
includedirs { "/mingw/include/irrlicht", "/mingw/include/freetype2" }
configuration "not vs*"
filter "not action:vs*"
buildoptions { "-std=c++14", "-fno-rtti" }
configuration "not windows"
excludes { "COSOperator.*" }
links { "dl", "pthread" }
if LIBEVENT_ROOT then
includedirs { LIBEVENT_ROOT.."/include" }
libdirs { LIBEVENT_ROOT.."/lib/" }
end
links { "event_pthreads" }
if BUILD_SQLITE then
includedirs { "../sqlite3" }
end
if BUILD_FREETYPE then
includedirs {"../freetype/include" }
else
includedirs { "/usr/include/freetype2" }
end
configuration { "not windows", "not macosx" }
links "GL"
configuration "linux"
linkoptions { "-static-libstdc++", "-static-libgcc", "-Wl,-rpath=./lib/" }
if BUILD_LUA then
links { "lua" }
else
links { "lua5.3-c++" }
end
links { "X11", "Xxf86vm" }
if USE_IRRKLANG then
links { "IrrKlang" }
libdirs { "../irrklang/bin/linux-gcc-64" }
end
configuration "macosx"
links { "lua", "z" }
libdirs { "../irrlicht" }
filter "not system:windows"
links { "event_pthreads", "dl", "pthread", "X11" }
filter "system:macosx"
links { "z" }
defines { "GL_SILENCE_DEPRECATION" }
if MAC_ARM then
buildoptions { "--target=arm64-apple-macos12" }
linkoptions { "-arch arm64" }
end
if USE_IRRKLANG then
links { "irrklang" }
libdirs { "../irrklang/bin/macosx-gcc" }
end
filter "system:linux"
links { "GL", "Xxf86vm" }
if USE_IRRKLANG then
links { "IrrKlang" }
linkoptions{ IRRKLANG_LINK_RPATH }
end
solution "ygo"
-- default global settings
BUILD_LUA = true
BUILD_EVENT = os.istarget("windows")
BUILD_FREETYPE = os.istarget("windows")
BUILD_SQLITE = os.istarget("windows")
BUILD_IRRLICHT = not os.istarget("macosx")
USE_IRRKLANG = true
IRRKLANG_PRO = false
LUA_LIB_NAME = "lua"
-- read settings from command line
newoption { trigger = "build-lua", description = "" }
newoption { trigger = "no-build-lua", description = "" }
newoption { trigger = "lua-include-dir", description = "", value = "path" }
newoption { trigger = "lua-lib-dir", description = "", value = "path" }
newoption { trigger = "lua-lib-name", description = "", value = "name", default = "lua" }
newoption { trigger = "build-event", description = "" }
newoption { trigger = "no-build-event", description = "" }
newoption { trigger = "event-include-dir", description = "", value = "path" }
newoption { trigger = "event-lib-dir", description = "", value = "path" }
newoption { trigger = "build-freetype", description = "" }
newoption { trigger = "no-build-freetype", description = "" }
newoption { trigger = "freetype-include-dir", description = "", value = "path" }
newoption { trigger = "freetype-lib-dir", description = "", value = "path" }
newoption { trigger = "build-sqlite", description = "" }
newoption { trigger = "no-build-sqlite", description = "" }
newoption { trigger = "sqlite-include-dir", description = "", value = "path" }
newoption { trigger = "sqlite-lib-dir", description = "", value = "path" }
newoption { trigger = "build-irrlicht", description = "" }
newoption { trigger = "no-build-irrlicht", description = "" }
newoption { trigger = "irrlicht-include-dir", description = "", value = "path" }
newoption { trigger = "irrlicht-lib-dir", description = "", value = "path" }
newoption { trigger = "use-irrklang", description = "" }
newoption { trigger = "no-use-irrklang", description = "" }
newoption { trigger = "irrklang-include-dir", description = "", value = "path" }
newoption { trigger = "irrklang-lib-dir", description = "", value = "path" }
newoption { trigger = "irrklang-pro", description = "" }
newoption { trigger = "no-irrklang-pro", description = "" }
newoption { trigger = "irrklang-pro-release-lib-dir", description = "", value = "path" }
newoption { trigger = "irrklang-pro-debug-lib-dir", description = "", value = "path" }
newoption { trigger = "winxp-support", description = "" }
newoption { trigger = "mac-arm", description = "M1" }
if(_OPTIONS["build-lua"]) then
BUILD_LUA = true
elseif(_OPTIONS["no-build-lua"]) then
BUILD_LUA = false
end
if not BUILD_LUA then
-- at most times you need to change this if you change BUILD_LUA to false
-- make sure your lua lib is built with C++ and version >= 5.3
LUA_INCLUDE_DIR = _OPTIONS["lua-include-dir"] or "/usr/local/include/lua"
LUA_LIB_DIR = _OPTIONS["lua-lib-dir"] or "/usr/local/lib"
LUA_LIB_NAME = _OPTIONS["lua-lib-name"]
end
if(_OPTIONS["build-event"]) then
BUILD_EVENT = os.istarget("windows") -- only on windows for now
elseif(_OPTIONS["no-build-event"]) then
BUILD_EVENT = false
end
if not BUILD_EVENT then
EVENT_INCLUDE_DIR = _OPTIONS["event-include-dir"] or "/usr/local/include/event2"
EVENT_LIB_DIR = _OPTIONS["event-lib-dir"] or "/usr/local/lib"
end
if(_OPTIONS["build-freetype"]) then
BUILD_FREETYPE = true
elseif(_OPTIONS["no-build-freetype"]) then
BUILD_FREETYPE = false
end
if not BUILD_FREETYPE then
FREETYPE_INCLUDE_DIR = _OPTIONS["freetype-include-dir"] or "/usr/local/include/freetype2"
FREETYPE_LIB_DIR = _OPTIONS["freetype-lib-dir"] or "/usr/local/lib"
end
if(_OPTIONS["build-sqlite"]) then
BUILD_SQLITE = true
elseif(_OPTIONS["no-build-sqlite"]) then
BUILD_SQLITE = false
end
if not BUILD_SQLITE then
SQLITE_INCLUDE_DIR = _OPTIONS["sqlite-include-dir"] or "/usr/local/include"
SQLITE_LIB_DIR = _OPTIONS["sqlite-lib-dir"] or "/usr/local/lib"
end
if(_OPTIONS["build-irrlicht"]) then
BUILD_IRRLICHT = true
elseif(_OPTIONS["no-build-irrlicht"]) then
BUILD_IRRLICHT = false
end
if not BUILD_IRRLICHT then
IRRLICHT_INCLUDE_DIR = _OPTIONS["irrlicht-include-dir"] or "/usr/local/include/irrlicht"
IRRLICHT_LIB_DIR = _OPTIONS["irrlicht-lib-dir"] or "/usr/local/lib"
end
if(_OPTIONS["use-irrklang"]) then
USE_IRRKLANG = true
elseif(_OPTIONS["no-use-irrklang"]) then
USE_IRRKLANG = false
end
if USE_IRRKLANG then
IRRKLANG_INCLUDE_DIR = _OPTIONS["irrklang-include-dir"] or "../irrklang/include"
if os.istarget("windows") then
IRRKLANG_LIB_DIR = "../irrklang/lib/Win32-visualStudio"
elseif os.istarget("linux") then
IRRKLANG_LIB_DIR = "../irrklang/bin/linux-gcc-64"
IRRKLANG_LINK_RPATH = "-Wl,-rpath=./irrklang/bin/linux-gcc-64/"
elseif os.istarget("macosx") then
IRRKLANG_LIB_DIR = "../irrklang/bin/macosx-gcc"
end
IRRKLANG_LIB_DIR = _OPTIONS["irrklang-lib-dir"] or "../irrklang/lib/Win32-visualStudio"
end
if(_OPTIONS["irrklang-pro"]) and os.istarget("windows") then
IRRKLANG_PRO = true
elseif(_OPTIONS["no-irrklang-pro"]) then
IRRKLANG_PRO = false
end
if IRRKLANG_PRO then
-- irrklang pro can't use the pro lib to debug
IRRKLANG_PRO_RELEASE_LIB_DIR = _OPTIONS["irrklang-pro-release-lib-dir"] or "../irrklang/lib/Win32-vs2019"
IRRKLANG_PRO_DEBUG_LIB_DIR = _OPTIONS["irrklang-pro-debug-lib-dir"] or "../irrklang/lib/Win32-visualStudio-debug"
end
if(_OPTIONS["winxp-support"]) and os.istarget("windows") then
WINXP_SUPPORT = true
end
if(_OPTIONS["mac-arm"] or os.getenv("YGOPRO_TARGET_ARM")) and os.istarget("macosx") then
MAC_ARM = true
end
workspace "YGOPro"
location "build"
language "C++"
objdir "obj"
if os.getenv("YGOPRO_BUILD_LUA") then
BUILD_LUA=true
end
if os.getenv("YGOPRO_BUILD_SQLITE") then
BUILD_SQLITE=true
end
if os.getenv("YGOPRO_BUILD_FREETYPE") then
BUILD_FREETYPE=true
end
if os.getenv("YGOPRO_BUILD_IRRLICHT") then
BUILD_IRRLICHT=true
end
if os.getenv("YGOPRO_LIBEVENT_STATIC_PATH") then
LIBEVENT_ROOT=os.getenv("YGOPRO_LIBEVENT_STATIC_PATH")
end
if os.ishost("macosx") then
if os.getenv("YGOPRO_TARGET_ARM") then
MAC_ARM=true
end
end
if os.ishost("windows") then
BUILD_EVENT=true -- only on windows for now
end
if os.getenv("USE_IRRKLANG") and not os.getenv("NO_IRRKLANG") then
USE_IRRKLANG = true
if os.getenv("IRRKLANG_PRO") then
IRRKLANG_PRO = true
end
end
configurations { "Release", "Debug" }
if os.getenv("YGOPRO_LUA_SAFE") then
defines { "LUA_COMPAT_5_2", "YGOPRO_LUA_SAFE" }
else
defines { "LUA_COMPAT_5_2" }
end
configuration "windows"
defines { "WIN32", "_WIN32", "WINVER=0x0501" }
libdirs { "$(DXSDK_DIR)Lib/x86" }
filter "system:windows"
defines { "WIN32", "_WIN32" }
entrypoint "mainCRTStartup"
--toolset "v141_xp"
systemversion "latest"
startproject "ygopro"
if not os.getenv("YGOPRO_NO_XP_TOOLSET") then
configuration { "windows", "vs2015" }
toolset "v140_xp"
configuration { "windows", "vs2017" }
toolset "v141_xp"
configuration { "windows", "vs2019" }
toolset "v141_xp"
end
startproject "YGOPro"
if WINXP_SUPPORT then
defines { "WINVER=0x0501" }
toolset "v141_xp"
else
defines { "WINVER=0x0601" } -- WIN7
end
configuration "bsd"
includedirs { "/usr/local/include" }
filter "system:macosx"
libdirs { "/usr/local/lib" }
configuration "macosx"
defines { "GL_SILENCE_DEPRECATION" }
if not LIBEVENT_ROOT then
includedirs { "/usr/local/include/event2" }
libdirs { "/usr/local/lib" }
end
buildoptions { "-stdlib=libc++" }
if MAC_ARM then
buildoptions { "--target=arm64-apple-macos12" }
end
links { "OpenGL.framework", "Cocoa.framework", "IOKit.framework" }
configuration "linux"
filter "system:linux"
buildoptions { "-U_FORTIFY_SOURCE" }
configuration "Release"
filter "configurations:Release"
optimize "Speed"
targetdir "bin/release"
configuration "Debug"
filter "configurations:Debug"
symbols "On"
defines "_DEBUG"
targetdir "bin/debug"
configuration { "Release", "vs*" }
filter { "configurations:Release", "action:vs*" }
flags { "LinkTimeOptimization" }
staticruntime "On"
disablewarnings { "4244", "4267", "4838", "4577", "4819", "4018", "4996", "4477", "4091", "4828", "4800" }
configuration { "Release", "not vs*" }
filter { "configurations:Release", "not action:vs*" }
symbols "On"
defines "NDEBUG"
if not MAC_ARM then
buildoptions "-march=native"
end
configuration { "Debug", "vs*" }
filter { "configurations:Debug", "action:vs*" }
defines { "_ITERATOR_DEBUG_LEVEL=0" }
disablewarnings { "4819", "4828" }
configuration "vs*"
filter "action:vs*"
vectorextensions "SSE2"
buildoptions { "/utf-8" }
defines { "_CRT_SECURE_NO_WARNINGS" }
configuration "not vs*"
buildoptions { "-fno-strict-aliasing", "-Wno-format-security" }
filter "not action:vs*"
buildoptions { "-fno-strict-aliasing", "-Wno-multichar", "-Wno-format-security" }
configuration {"not vs*", "windows"}
buildoptions { "-static-libgcc" }
filter {}
include "ocgcore"
include "gframe"
......@@ -129,6 +220,6 @@ end
if BUILD_SQLITE then
include "sqlite3"
end
if USE_IRRKLANG then
if USE_IRRKLANG and IRRKLANG_PRO then
include "ikpmp3"
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