Commit 14e743ce authored by nanahira's avatar nanahira

Merge branch 'patch-build-all' of https://github.com/mercury233/ygopro into develop

parents 1f4aad3e 2d86d0c3
...@@ -4,25 +4,12 @@ set -o errexit ...@@ -4,25 +4,12 @@ set -o errexit
TARGET_PLATFORM=$(arch) TARGET_PLATFORM=$(arch)
TARGET_YGOPRO_BINARY_PATH=./ygopro-platforms/ygopro-platform-$TARGET_PLATFORM TARGET_YGOPRO_BINARY_PATH=./ygopro-platforms/ygopro-platform-$TARGET_PLATFORM
export EVENT_INCLUDE_DIR=$PWD/libevent-stable/include
export EVENT_LIB_DIR=$PWD/libevent-stable/lib ./.ci/configure-audio.sh
export OPUS_INCLUDE_DIR=$PWD/miniaudio/external-built/include/opus
export OPUS_LIB_DIR=$PWD/miniaudio/external-built/lib rm -rf sqlite3/VERSION sqlite3/version
export OPUSFILE_INCLUDE_DIR=$PWD/miniaudio/external-built/include/opus
export OPUSFILE_LIB_DIR=$PWD/miniaudio/external-built/lib ./premake5 gmake --cc=clang
export VORBIS_INCLUDE_DIR=$PWD/miniaudio/external-built/include
export VORBIS_LIB_DIR=$PWD/miniaudio/external-built/lib
export OGG_INCLUDE_DIR=$PWD/miniaudio/external-built/include
export OGG_LIB_DIR=$PWD/miniaudio/external-built/lib
export ACLOCAL=aclocal
export AUTOMAKE=automake
./.ci/libevent-prebuild.sh
./.ci/build-opus.sh
rm -rf sqlite3/VERSION
./premake5 gmake --cc=clang --build-freetype --build-sqlite
cd build cd build
make config=release -j$(sysctl -n hw.ncpu) make config=release -j$(sysctl -n hw.ncpu)
......
This diff is collapsed.
...@@ -16,6 +16,7 @@ project "YGOPro" ...@@ -16,6 +16,7 @@ project "YGOPro"
else else
includedirs { EVENT_INCLUDE_DIR } includedirs { EVENT_INCLUDE_DIR }
libdirs { EVENT_LIB_DIR } libdirs { EVENT_LIB_DIR }
links { "event_pthreads" }
end end
if BUILD_IRRLICHT then if BUILD_IRRLICHT then
...@@ -83,15 +84,17 @@ project "YGOPro" ...@@ -83,15 +84,17 @@ project "YGOPro"
end end
end end
filter "not system:windows" filter "not system:windows"
links { "event_pthreads", "dl", "pthread" } links { "dl", "pthread" }
filter "system:macosx" filter "system:macosx"
openmp "Off" openmp "Off"
links { "z" } links { "z" }
defines { "GL_SILENCE_DEPRECATION" } defines { "GL_SILENCE_DEPRECATION" }
if MAC_ARM then if MAC_ARM then
buildoptions { "--target=arm64-apple-macos12" }
linkoptions { "-arch arm64" } linkoptions { "-arch arm64" }
end end
if MAC_INTEL then
linkoptions { "-arch x86_64" }
end
if USE_AUDIO and AUDIO_LIB == "irrklang" then if USE_AUDIO and AUDIO_LIB == "irrklang" then
links { "irrklang" } links { "irrklang" }
end end
......
...@@ -17,3 +17,9 @@ project "event" ...@@ -17,3 +17,9 @@ project "event"
"xcopy /E /Y $(ProjectDir)..\\event\\WIN32-Code\\nmake $(ProjectDir)..\\event\\include" } "xcopy /E /Y $(ProjectDir)..\\event\\WIN32-Code\\nmake $(ProjectDir)..\\event\\include" }
files { "win32select.c", "evthread_win32.c", "buffer_iocp.c", "event_iocp.c", "bufferevent_async.c" } files { "win32select.c", "evthread_win32.c", "buffer_iocp.c", "event_iocp.c", "bufferevent_async.c" }
defines { "UINT32_MAX=0xffffffffui32" } -- quirk of libevent 2.1.2 defines { "UINT32_MAX=0xffffffffui32" } -- quirk of libevent 2.1.2
filter "system:linux"
files { "evthread_pthread.c", "epoll.c", "epoll_sub.c", "poll.c", "select.c" }
filter "system:macosx"
files { "evthread_pthread.c", "kqueue.c", "poll.c", "select.c" }
...@@ -33,12 +33,6 @@ project "miniaudio" ...@@ -33,12 +33,6 @@ project "miniaudio"
"external/opus/celt/rate.c", "external/opus/celt/rate.c",
"external/opus/celt/vq.c", "external/opus/celt/vq.c",
"external/opus/celt/x86/pitch_avx.c",
"external/opus/celt/x86/pitch_sse.c",
"external/opus/celt/x86/vq_sse2.c",
"external/opus/celt/x86/x86_celt_map.c",
"external/opus/celt/x86/x86cpu.c",
"external/opus/silk/bwexpander.c", "external/opus/silk/bwexpander.c",
"external/opus/silk/bwexpander_32.c", "external/opus/silk/bwexpander_32.c",
"external/opus/silk/CNG.c", "external/opus/silk/CNG.c",
...@@ -118,10 +112,25 @@ project "miniaudio" ...@@ -118,10 +112,25 @@ project "miniaudio"
"external/vorbis/include", "external/vorbis/include",
} }
defines { defines {
"OPUS_BUILD", "USE_ALLOCA", "HAVE_LRINTF", "OP_HAVE_LRINTF", "OPUS_BUILD",
"OPUS_X86_PRESUME_SSE", "OPUS_X86_PRESUME_SSE2", "USE_ALLOCA",
"OPUS_HAVE_RTCD", "OPUS_X86_MAY_HAVE_SSE", "OPUS_X86_MAY_HAVE_SSE4_1", "OPUS_X86_MAY_HAVE_AVX2", "HAVE_LRINTF",
"OP_HAVE_LRINTF",
} }
if not TARGET_MAC_ARM then
files {
"external/opus/celt/x86/pitch_avx.c",
"external/opus/celt/x86/pitch_sse.c",
"external/opus/celt/x86/vq_sse2.c",
"external/opus/celt/x86/x86_celt_map.c",
"external/opus/celt/x86/x86cpu.c",
}
defines {
"OPUS_HAVE_RTCD", "CPU_INFO_BY_ASM",
"OPUS_X86_PRESUME_SSE", "OPUS_X86_PRESUME_SSE2",
"OPUS_X86_MAY_HAVE_SSE", "OPUS_X86_MAY_HAVE_SSE4_1", "OPUS_X86_MAY_HAVE_AVX2",
}
end
else else
includedirs { OPUS_INCLUDE_DIR, OPUSFILE_INCLUDE_DIR, VORBIS_INCLUDE_DIR, OGG_INCLUDE_DIR } includedirs { OPUS_INCLUDE_DIR, OPUSFILE_INCLUDE_DIR, VORBIS_INCLUDE_DIR, OGG_INCLUDE_DIR }
end end
......
-- default global settings -- Supported systems: Windows, Linux, MacOS
-- Global settings
-- Default: Build Lua, Irrlicht from source on all systems.
-- Don't build event, freetype, sqlite, opus, vorbis on Linux or MacOS, use apt or homebrew,
-- but build them on Windows, due to the lack of package manager on Windows.
BUILD_LUA = true BUILD_LUA = true
LUA_LIB_NAME = "lua" LUA_LIB_NAME = "lua" -- change this if you don't build Lua
BUILD_EVENT = os.istarget("windows") BUILD_EVENT = os.istarget("windows")
BUILD_FREETYPE = os.istarget("windows") BUILD_FREETYPE = os.istarget("windows")
BUILD_SQLITE = os.istarget("windows") BUILD_SQLITE = os.istarget("windows")
BUILD_IRRLICHT = true BUILD_IRRLICHT = true -- modified Irrlicht is required, can't use the official one
USE_DXSDK = true USE_DXSDK = true
USE_AUDIO = true USE_AUDIO = true
AUDIO_LIB = "miniaudio" AUDIO_LIB = "miniaudio" -- can be "miniaudio" or "irrklang"
-- BUILD_MINIAUDIO is always true
MINIAUDIO_SUPPORT_OPUS_VORBIS = true MINIAUDIO_SUPPORT_OPUS_VORBIS = true
MINIAUDIO_BUILD_OPUS_VORBIS = os.istarget("windows") MINIAUDIO_BUILD_OPUS_VORBIS = os.istarget("windows")
-- BUILD_IRRKLANG is impossible because irrKlang is not open source
IRRKLANG_PRO = false IRRKLANG_PRO = false
IRRKLANG_PRO_BUILD_IKPMP3 = false IRRKLANG_PRO_BUILD_IKPMP3 = false
-- read settings from command line or environment variables -- Read settings from command line or environment variables
newoption { trigger = "build-lua", category = "YGOPro - lua", description = "" } newoption { trigger = "build-lua", category = "YGOPro - lua", description = "" }
newoption { trigger = "no-build-lua", category = "YGOPro - lua", description = "" } newoption { trigger = "no-build-lua", category = "YGOPro - lua", description = "" }
...@@ -73,7 +81,8 @@ newoption { trigger = "irrklang-pro-debug-lib-dir", category = "YGOPro - irrklan ...@@ -73,7 +81,8 @@ newoption { trigger = "irrklang-pro-debug-lib-dir", category = "YGOPro - irrklan
newoption { trigger = 'build-ikpmp3', category = "YGOPro - irrklang - ikpmp3", description = "" } newoption { trigger = 'build-ikpmp3', category = "YGOPro - irrklang - ikpmp3", description = "" }
newoption { trigger = "winxp-support", category = "YGOPro", description = "" } newoption { trigger = "winxp-support", category = "YGOPro", description = "" }
newoption { trigger = "mac-arm", category = "YGOPro", description = "Cross compile for Apple Silicon" } newoption { trigger = "mac-arm", category = "YGOPro", description = "Compile for Apple Silicon Mac" }
newoption { trigger = "mac-intel", category = "YGOPro", description = "Compile for Intel Mac" }
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,"-","_")))
...@@ -93,15 +102,15 @@ elseif GetParam("no-build-lua") then ...@@ -93,15 +102,15 @@ elseif GetParam("no-build-lua") then
BUILD_LUA = false BUILD_LUA = false
end end
if not BUILD_LUA then if not BUILD_LUA then
-- at most times you need to change this if you change BUILD_LUA to false -- at most times you need to change those if you change BUILD_LUA to false
-- make sure your lua lib is built with C++ and version >= 5.3 -- make sure your lua lib is built with C++ and version >= 5.3
LUA_LIB_NAME = GetParam("lua-lib-name") LUA_LIB_NAME = GetParam("lua-lib-name") or LUA_LIB_NAME
LUA_INCLUDE_DIR = GetParam("lua-include-dir") or os.findheader("lua.h") LUA_INCLUDE_DIR = GetParam("lua-include-dir") or os.findheader("lua.h")
LUA_LIB_DIR = GetParam("lua-lib-dir") or os.findlib(LUA_LIB_NAME) LUA_LIB_DIR = GetParam("lua-lib-dir") or os.findlib(LUA_LIB_NAME)
end end
if GetParam("build-event") then if GetParam("build-event") then
BUILD_EVENT = os.istarget("windows") -- only on windows for now BUILD_EVENT = true
elseif GetParam("no-build-event") then elseif GetParam("no-build-event") then
BUILD_EVENT = false BUILD_EVENT = false
end end
...@@ -224,12 +233,26 @@ end ...@@ -224,12 +233,26 @@ end
if GetParam("winxp-support") and os.istarget("windows") then if GetParam("winxp-support") and os.istarget("windows") then
WINXP_SUPPORT = true WINXP_SUPPORT = true
end end
if os.istarget("macosx") then if os.istarget("macosx") then
MAC_ARM = false
if GetParam("mac-arm") then if GetParam("mac-arm") then
MAC_ARM = true MAC_ARM = true
end end
ON_MAC_ARM = MAC_ARM or os.outputof("arch") == "arm64" if GetParam("mac-intel") then
MAC_INTEL = true
end
if MAC_ARM then
TARGET_MAC_ARM = true
elseif not MAC_INTEL then
-- automatic target arm64, need extra detect
local uname = os.outputof("uname -m")
local proctranslated = os.outputof("sysctl sysctl.proc_translated")
if uname:find("arm") or proctranslated then
print("Detected Apple Silicon Mac")
TARGET_MAC_ARM = true
end
end
end end
workspace "YGOPro" workspace "YGOPro"
...@@ -259,7 +282,13 @@ workspace "YGOPro" ...@@ -259,7 +282,13 @@ workspace "YGOPro"
filter "system:macosx" filter "system:macosx"
libdirs { "/usr/local/lib" } libdirs { "/usr/local/lib" }
if MAC_ARM then if MAC_ARM then
buildoptions { "--target=arm64-apple-macos12" } buildoptions { "-arch arm64" }
end
if MAC_INTEL then
buildoptions { "-arch x86_64", "-mavx", "-mfma" }
end
if MAC_ARM and MAC_INTEL then
architecture "universal"
end end
links { "OpenGL.framework", "Cocoa.framework", "IOKit.framework" } links { "OpenGL.framework", "Cocoa.framework", "IOKit.framework" }
...@@ -299,9 +328,6 @@ workspace "YGOPro" ...@@ -299,9 +328,6 @@ workspace "YGOPro"
filter { "configurations:Release", "not action:vs*" } filter { "configurations:Release", "not action:vs*" }
symbols "On" symbols "On"
defines "NDEBUG" defines "NDEBUG"
if not MAC_ARM then
buildoptions "-march=native"
end
filter { "configurations:Debug", "action:vs*" } filter { "configurations:Debug", "action:vs*" }
disablewarnings { "6011", "6031", "6054", "6262" } disablewarnings { "6011", "6031", "6054", "6262" }
...@@ -317,6 +343,9 @@ workspace "YGOPro" ...@@ -317,6 +343,9 @@ workspace "YGOPro"
filter "not action:vs*" filter "not action:vs*"
buildoptions { "-fno-strict-aliasing", "-Wno-multichar", "-Wno-format-security" } buildoptions { "-fno-strict-aliasing", "-Wno-multichar", "-Wno-format-security" }
if not MAC_ARM and not MAC_INTEL then
buildoptions "-march=native"
end
filter {} filter {}
......
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