Commit 61335d8a authored by nanahira's avatar nanahira

m1mac

parent 1c180c65
#!/bin/bash
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
cd build
make config=release -j4
cd ..
mkdir ygopro-platforms
mv bin/release/ygopro.app $TARGET_YGOPRO_BINARY_PATH
install_name_tool -change /usr/local/lib/libirrklang.dylib @executable_path/../Frameworks/libirrklang.dylib $TARGET_YGOPRO_BINARY_PATH
strip $TARGET_YGOPRO_BINARY_PATH
#!/bin/bash
set -x
set -o errexit
# PROCESSOR_COUNT=4
wget -O - https://cdn01.moecube.com/ygopro-build-materials/libevent-2.0.22-stable.tar.gz | tar zfx -
cd libevent-2.0.22-stable
./configure --prefix=$PWD/libevent-stable --disable-openssl --enable-static=yes --enable-shared=no
make -j$PROCESSOR_COUNT
make install
cd ..
mv libevent-2.0.22-stable/libevent-stable .
rm -rf libevent-2.0.22-stable
stages: stages:
- prepare - prepare
- build - build
- sign - combine
- pack - pack
- deploy - deploy
- notify
variables: variables:
GIT_DEPTH: "1" GIT_DEPTH: "1"
USE_IRRKLANG: "1"
mat_common: mat_common:
stage: prepare stage: prepare
...@@ -56,19 +53,46 @@ mat_linux: ...@@ -56,19 +53,46 @@ mat_linux:
- apt update; apt -y install git wget tar - apt update; apt -y install git wget tar
- git clone --depth=1 https://code.mycard.moe/mycard/irrlicht irrlicht_linux - git clone --depth=1 https://code.mycard.moe/mycard/irrlicht irrlicht_linux
- wget -O - https://cdn01.moecube.com/ygopro-build-materials/premake-5.0.0-alpha14-linux.tar.gz | tar zfx - - wget -O - https://cdn01.moecube.com/ygopro-build-materials/premake-5.0.0-alpha14-linux.tar.gz | tar zfx -
- wget -O - https://cdn01.moecube.com/ygopro-build-materials/libevent-2.0.22-stable.tar.gz | tar zfx - - env PROCESSOR_COUNT=$(nproc) ./.ci/libevent-prebuild.sh
- cd libevent-2.0.22-stable
- ./configure --prefix=$PWD/libevent-stable --disable-openssl
- make -j$(nproc)
- make install
- cd ..
- mv libevent-2.0.22-stable/libevent-stable .
artifacts: artifacts:
paths: paths:
- premake5 - premake5
- irrlicht_linux - irrlicht_linux
- libevent-stable - libevent-stable
mat_macos_platform_x86:
stage: prepare
tags:
- macos
variables:
PROCESSOR_COUNT: '4'
script: ./.ci/libevent-prebuild.sh
artifacts:
paths:
- libevent-stable
mat_macos_platform_m1:
stage: prepare
tags:
- linux
script:
- wget -O - https://cdn01.moecube.com/ygopro-build-materials/libevent-m1mac.tar.gz | tar zfx -
artifacts:
paths:
- libevent-stable
mat_macos_irrklang_patched:
stage: build
tags:
- linux
dependencies: []
script:
- wget -O - https://cdn01.moecube.com/ygopro-build-materials/libirrklang-patched-dylib.tar.gz | tar zfx -
artifacts:
paths:
- libirrklang-patched.dylib
mat_macos: mat_macos:
stage: prepare stage: prepare
tags: tags:
...@@ -121,7 +145,9 @@ exec_windows: ...@@ -121,7 +145,9 @@ exec_windows:
- mat_windows - mat_windows
variables: variables:
irrklang_pro: '1' irrklang_pro: '1'
USE_IRRKLANG: "1"
cache: cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths: paths:
- bin/ - bin/
- obj/ - obj/
...@@ -142,13 +168,13 @@ exec_linux: ...@@ -142,13 +168,13 @@ exec_linux:
- linux - linux
variables: variables:
YGOPRO_BUILD_ALL: '1' YGOPRO_BUILD_ALL: '1'
YGOPRO_LINUX_ALL_STATIC: '1' USE_IRRKLANG: "1"
YGOPRO_LINUX_ALL_STATIC_LIB_PATH: '/usr/lib/x86_64-linux-gnu/'
dependencies: dependencies:
- mat_common - mat_common
- mat_irrklang - mat_irrklang
- mat_linux - mat_linux
cache: cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths: paths:
- bin/ - bin/
- obj/ - obj/
...@@ -157,7 +183,7 @@ exec_linux: ...@@ -157,7 +183,7 @@ exec_linux:
- git submodule update --init - git submodule update --init
- mkdir lib - mkdir lib
- cp -rf irrklang/bin/linux-gcc-64/libIrrKlang.so ./lib/ - cp -rf irrklang/bin/linux-gcc-64/libIrrKlang.so ./lib/
- YGOPRO_LINUX_ALL_STATIC_LIBEVENT_PATH=$PWD/libevent-stable ./premake5 gmake - env YGOPRO_LIBEVENT_STATIC_PATH=$PWD/libevent-stable ./premake5 gmake
- cd build - cd build
- make config=release -j$(nproc) - make config=release -j$(nproc)
- cd .. - cd ..
...@@ -168,7 +194,7 @@ exec_linux: ...@@ -168,7 +194,7 @@ exec_linux:
- ygopro - ygopro
- lib - lib
exec_macos: exec_macos_platform_x86:
stage: build stage: build
tags: tags:
- macos - macos
...@@ -176,26 +202,59 @@ exec_macos: ...@@ -176,26 +202,59 @@ exec_macos:
- mat_irrklang - mat_irrklang
- mat_macos - mat_macos
- mat_common - mat_common
- mat_macos_platform_x86
variables:
USE_IRRKLANG: "1"
TARGET_PATFORM: x86
cache: cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths: paths:
- bin/ - bin/
- obj/ - obj/
script: script:
- git submodule update --init - ./.ci/exec-macos-platform.sh
- brew install libevent dylibbundler - install_name_tool -change /usr/local/lib/libirrklang.dylib @executable_path/../Frameworks/libirrklang.dylib ./ygopro-platforms/ygopro-platform-$TARGET_PATFORM
- sudo cp -rf irrklang/bin/macosx-gcc/libirrklang.dylib /usr/local/lib/ artifacts:
#- sudo cp -rf irrklang/include /usr/local/include/irrklang paths:
- ./premake5 gmake --cc=clang - ygopro-platforms
- cd build
- make config=release -j4 exec_macos_platform_m1:
- cd .. stage: build
tags:
- macos
dependencies:
- mat_macos
- mat_common
- mat_macos_platform_m1
variables:
TARGET_PATFORM: m1
YGOPRO_TARGET_ARM: '1'
cache:
key: "$CI_JOB_NAME-$CI_COMMIT_REF_SLUG"
paths:
- bin/
- obj/
script: ./.ci/exec-macos-platform.sh
artifacts:
paths:
- ygopro-platforms
exec_macos:
stage: combine
tags:
- macos
dependencies:
- exec_macos_platform_x86
- exec_macos_platform_m1
- mat_macos_irrklang_patched
script:
- mkdir -p ygopro.app/Contents/MacOS ygopro.app/Contents/Frameworks; - mkdir -p ygopro.app/Contents/MacOS ygopro.app/Contents/Frameworks;
- mv bin/release/ygopro.app ygopro.app/Contents/MacOS/ygopro; - lipo -create -output ygopro.app/Contents/MacOS/ygopro ygopro-platforms/ygopro-platform-x86 ygopro-platforms/ygopro-platform-m1;
# do some special things for irrklang # do some special things for irrklang
- mv ./libirrklang-patched.dylib ygopro.app/Contents/Frameworks/libirrklang.dylib - mv ./libirrklang-patched.dylib ygopro.app/Contents/Frameworks/libirrklang.dylib
- install_name_tool -change /usr/local/lib/libirrklang.dylib @executable_path/../Frameworks/libirrklang.dylib ygopro.app/Contents/MacOS/ygopro #- install_name_tool -change /usr/local/lib/libirrklang.dylib @executable_path/../Frameworks/libirrklang.dylib ygopro.app/Contents/MacOS/ygopro
- dylibbundler -x ygopro.app/Contents/MacOS/ygopro -b -d ygopro.app/Contents/Frameworks/ -p @executable_path/../Frameworks/ -cd -i @executable_path/../Frameworks; #- dylibbundler -x ygopro.app/Contents/MacOS/ygopro -b -d ygopro.app/Contents/Frameworks/ -p @executable_path/../Frameworks/ -cd -i @executable_path/../Frameworks;
- strip ygopro.app/Contents/MacOS/ygopro; #- strip ygopro.app/Contents/MacOS/ygopro;
- mkdir ygopro.app/Contents/Resources; - mkdir ygopro.app/Contents/Resources;
- mv premake/gframe/ygopro.icns ygopro.app/Contents/Resources/Icon.icns; - mv premake/gframe/ygopro.icns ygopro.app/Contents/Resources/Icon.icns;
- defaults write "$PWD/ygopro.app/Contents/Info.plist" "CFBundleIconFile" "Icon.icns"; - defaults write "$PWD/ygopro.app/Contents/Info.plist" "CFBundleIconFile" "Icon.icns";
......
...@@ -7,10 +7,7 @@ project "ygopro" ...@@ -7,10 +7,7 @@ project "ygopro"
files { "**.cpp", "**.cc", "**.c", "**.h" } files { "**.cpp", "**.cc", "**.c", "**.h" }
excludes { "lzma/**", "spmemvfs/**" } excludes { "lzma/**", "spmemvfs/**" }
includedirs { "../ocgcore" } includedirs { "../ocgcore" }
links { "ocgcore", "clzma", "cspmemvfs", "Irrlicht", "sqlite3", "freetype" } links { "ocgcore", "clzma", "cspmemvfs", "Irrlicht", "sqlite3", "freetype", "event" }
if not LINUX_ALL_STATIC then
links { "event" }
end
if USE_IRRKLANG then if USE_IRRKLANG then
defines { "YGOPRO_USE_IRRKLANG" } defines { "YGOPRO_USE_IRRKLANG" }
links { "ikpmp3" } links { "ikpmp3" }
...@@ -20,10 +17,6 @@ project "ygopro" ...@@ -20,10 +17,6 @@ project "ygopro"
end end
end end
configuration "not linux"
if LINUX_ALL_STATIC then
links { "event" }
end
configuration "windows" configuration "windows"
files "ygopro.rc" files "ygopro.rc"
excludes "CGUIButton.cpp" excludes "CGUIButton.cpp"
...@@ -51,9 +44,11 @@ project "ygopro" ...@@ -51,9 +44,11 @@ project "ygopro"
configuration "not windows" configuration "not windows"
excludes { "COSOperator.*" } excludes { "COSOperator.*" }
links { "dl", "pthread" } links { "dl", "pthread" }
if not LINUX_ALL_STATIC then if LIBEVENT_ROOT then
links { "event_pthreads" } includedirs { LIBEVENT_ROOT.."/include" }
libdirs { LIBEVENT_ROOT.."/lib/" }
end end
links { "event_pthreads" }
if BUILD_SQLITE then if BUILD_SQLITE then
includedirs { "../sqlite3" } includedirs { "../sqlite3" }
end end
...@@ -73,14 +68,6 @@ project "ygopro" ...@@ -73,14 +68,6 @@ project "ygopro"
links { "lua5.3-c++" } links { "lua5.3-c++" }
end end
links { "X11", "Xxf86vm" } links { "X11", "Xxf86vm" }
if LINUX_ALL_STATIC then
local libeventRootPrefix=LIB_ROOT
if LIBEVENT_ROOT then
includedirs { LIBEVENT_ROOT.."/include" }
libeventRootPrefix=LIBEVENT_ROOT.."/lib/"
end
linkoptions { libeventRootPrefix.."libevent.a", libeventRootPrefix.."libevent_pthreads.a" }
end
if USE_IRRKLANG then if USE_IRRKLANG then
links { "IrrKlang" } links { "IrrKlang" }
libdirs { "../irrklang/bin/linux-gcc-64" } libdirs { "../irrklang/bin/linux-gcc-64" }
...@@ -89,6 +76,10 @@ project "ygopro" ...@@ -89,6 +76,10 @@ project "ygopro"
links { "lua" } links { "lua" }
includedirs { "../irrlicht/include" } includedirs { "../irrlicht/include" }
libdirs { "../irrlicht" } libdirs { "../irrlicht" }
if MAC_ARM then
buildoptions { "--target=arm64-apple-macos11" }
linkoptions { "-arch arm64" }
end
if USE_IRRKLANG then if USE_IRRKLANG then
links { "irrklang" } links { "irrklang" }
libdirs { "../irrklang/bin/macosx-gcc" } libdirs { "../irrklang/bin/macosx-gcc" }
......
...@@ -2,12 +2,6 @@ solution "ygo" ...@@ -2,12 +2,6 @@ solution "ygo"
location "build" location "build"
language "C++" language "C++"
objdir "obj" objdir "obj"
if os.ishost("windows") or os.getenv("USE_IRRKLANG") then
USE_IRRKLANG = true
if os.getenv("irrklang_pro") then
IRRKLANG_PRO = true
end
end
if not os.ishost("windows") then if not os.ishost("windows") then
if os.getenv("YGOPRO_BUILD_LUA") then if os.getenv("YGOPRO_BUILD_LUA") then
BUILD_LUA=true BUILD_LUA=true
...@@ -21,27 +15,42 @@ solution "ygo" ...@@ -21,27 +15,42 @@ solution "ygo"
if os.getenv("YGOPRO_BUILD_ALL") or os.ishost("macosx") then if os.getenv("YGOPRO_BUILD_ALL") or os.ishost("macosx") then
BUILD_ALL=true BUILD_ALL=true
end end
if os.ishost("linux") and os.getenv("YGOPRO_LINUX_ALL_STATIC") then if os.getenv("YGOPRO_LIBEVENT_STATIC_PATH") then
BUILD_ALL=true LIBEVENT_ROOT=os.getenv("YGOPRO_LIBEVENT_STATIC_PATH")
LINUX_ALL_STATIC=true
LIB_ROOT=os.getenv("YGOPRO_LINUX_ALL_STATIC_LIB_PATH") or "/usr/lib/x86_64-linux-gnu/"
LIBEVENT_ROOT=os.getenv("YGOPRO_LINUX_ALL_STATIC_LIBEVENT_PATH")
end end
if BUILD_ALL then if BUILD_ALL then
BUILD_LUA=true BUILD_LUA=true
BUILD_SQLITE=true BUILD_SQLITE=true
BUILD_FREETYPE=true BUILD_FREETYPE=true
end end
if os.ishost("macosx") then
if os.getenv("YGOPRO_TARGET_ARM") then
MAC_ARM=true
end
end
end
if (os.ishost("windows") or 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 end
configurations { "Release", "Debug" } 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" configuration "windows"
defines { "WIN32", "_WIN32", "WINVER=0x0501" } defines { "WIN32", "_WIN32", "WINVER=0x0501" }
libdirs { "$(DXSDK_DIR)Lib/x86" } libdirs { "$(DXSDK_DIR)Lib/x86" }
entrypoint "mainCRTStartup" entrypoint "mainCRTStartup"
--toolset "v141_xp"
systemversion "latest" systemversion "latest"
startproject "ygopro" startproject "ygopro"
if not os.getenv("YGOPRO_NO_XP_TOOLSET") then
configuration { "windows", "vs2015" } configuration { "windows", "vs2015" }
toolset "v140_xp" toolset "v140_xp"
...@@ -50,6 +59,7 @@ solution "ygo" ...@@ -50,6 +59,7 @@ solution "ygo"
configuration { "windows", "vs2019" } configuration { "windows", "vs2019" }
toolset "v141_xp" toolset "v141_xp"
end
configuration "bsd" configuration "bsd"
defines { "LUA_USE_POSIX" } defines { "LUA_USE_POSIX" }
...@@ -58,13 +68,19 @@ solution "ygo" ...@@ -58,13 +68,19 @@ solution "ygo"
configuration "macosx" configuration "macosx"
defines { "LUA_USE_MACOSX", "DBL_MAX_10_EXP=+308", "DBL_MANT_DIG=53", "GL_SILENCE_DEPRECATION" } defines { "LUA_USE_MACOSX", "DBL_MAX_10_EXP=+308", "DBL_MANT_DIG=53", "GL_SILENCE_DEPRECATION" }
includedirs { "/usr/local/include/event2", } if not LIBEVENT_ROOT then
libdirs { "/usr/local/lib" } includedirs { "/usr/local/include/event2" }
libdirs { "/usr/local/lib" }
end
buildoptions { "-stdlib=libc++" } buildoptions { "-stdlib=libc++" }
if MAC_ARM then
buildoptions { "--target=arm64-apple-macos11" }
end
links { "OpenGL.framework", "Cocoa.framework", "IOKit.framework" } links { "OpenGL.framework", "Cocoa.framework", "IOKit.framework" }
configuration "linux" configuration "linux"
defines { "LUA_USE_LINUX" } defines { "LUA_USE_LINUX" }
buildoptions { "-U_FORTIFY_SOURCE" }
configuration "Release" configuration "Release"
optimize "Speed" optimize "Speed"
...@@ -76,14 +92,16 @@ solution "ygo" ...@@ -76,14 +92,16 @@ solution "ygo"
targetdir "bin/debug" targetdir "bin/debug"
configuration { "Release", "vs*" } configuration { "Release", "vs*" }
flags { "StaticRuntime", "LinkTimeOptimization" } flags { "LinkTimeOptimization" }
--staticruntime "On" staticruntime "On"
disablewarnings { "4244", "4267", "4838", "4577", "4819", "4018", "4996", "4477", "4091", "4828", "4800" } disablewarnings { "4244", "4267", "4838", "4577", "4819", "4018", "4996", "4477", "4091", "4828", "4800" }
configuration { "Release", "not vs*" } configuration { "Release", "not vs*" }
symbols "On" symbols "On"
defines "NDEBUG" defines "NDEBUG"
buildoptions "-march=native" if not MAC_ARM then
buildoptions "-march=native"
end
configuration { "Debug", "vs*" } configuration { "Debug", "vs*" }
defines { "_ITERATOR_DEBUG_LEVEL=0" } defines { "_ITERATOR_DEBUG_LEVEL=0" }
...@@ -91,10 +109,11 @@ solution "ygo" ...@@ -91,10 +109,11 @@ solution "ygo"
configuration "vs*" configuration "vs*"
vectorextensions "SSE2" vectorextensions "SSE2"
buildoptions { "/utf-8" }
defines { "_CRT_SECURE_NO_WARNINGS" } defines { "_CRT_SECURE_NO_WARNINGS" }
configuration "not vs*" configuration "not vs*"
buildoptions { "-fno-strict-aliasing", "-Wno-multichar" } buildoptions { "-fno-strict-aliasing", "-Wno-format-security" }
configuration {"not vs*", "windows"} configuration {"not vs*", "windows"}
buildoptions { "-static-libgcc" } buildoptions { "-static-libgcc" }
......
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