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