Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add cmake presets #452

Merged
merged 1 commit into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
90 changes: 23 additions & 67 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,38 +99,27 @@ jobs:
- name: Cache cmake build
uses: actions/cache@v4
with:
path: build
key: ios-cmake-v4
path: out
key: ios-cmake-v5

- name: Configure
run: |
cmake \
-B build \
-D CMAKE_TOOLCHAIN_FILE=cmake/toolchain/ios.toolchain.cmake \
-D ENABLE_BITCODE=0 \
-D PLATFORM=OS64 \
-G Xcode \
-D CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY='' \
# EOL
cmake --preset ios

- name: Build
run: |
cmake \
--build build \
--config RelWithDebInfo \
-j $(sysctl -n hw.physicalcpu) \
# EOL
cmake --build --preset ios-debug

- name: Pack
run: |
cd build
cpack -C RelWithDebInfo
cd out/build/ios
cpack -C Debug

- name: Upload
uses: actions/upload-artifact@v4
with:
name: fallout2-ce.ipa
path: build/fallout2-ce.ipa
path: out/build/ios/fallout2-ce.ipa
retention-days: 7

linux:
Expand Down Expand Up @@ -166,40 +155,22 @@ jobs:
- name: Cache cmake build
uses: actions/cache@v4
with:
path: build
key: linux-${{ matrix.arch }}-cmake-v3
path: out
key: linux-${{ matrix.arch }}-cmake-v2

- name: Configure (x86)
if: matrix.arch == 'x86'
run: |
cmake \
-B build \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D CMAKE_TOOLCHAIN_FILE=cmake/toolchain/Linux32.cmake \
-D FALLOUT_VENDORED=OFF \
# EOL

- name: Configure (x64)
if: matrix.arch == 'x64'
- name: Configure
run: |
cmake \
-B build \
-D CMAKE_BUILD_TYPE=RelWithDebInfo \
-D FALLOUT_VENDORED=OFF \
# EOL
cmake --preset linux-${{ matrix.arch }}-debug

- name: Build
run: |
cmake \
--build build \
-j $(nproc) \
# EOL
cmake --build --preset linux-${{ matrix.arch }}-debug

- name: Upload
uses: actions/upload-artifact@v4
with:
name: fallout2-ce-linux-${{ matrix.arch }}
path: build/fallout2-ce
path: out/build/linux-${{ matrix.arch }}-debug/fallout2-ce
retention-days: 7

macos:
Expand All @@ -214,35 +185,27 @@ jobs:
- name: Cache cmake build
uses: actions/cache@v4
with:
path: build
path: out
key: macos-cmake-v6

- name: Configure
run: |
cmake \
-B build \
-G Xcode \
-D CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY='' \
# EOL
cmake --preset macos

- name: Build
run: |
cmake \
--build build \
--config RelWithDebInfo \
-j $(sysctl -n hw.physicalcpu) \
# EOL
cmake --build --preset macos-debug

- name: Pack
run: |
cd build
cpack -C RelWithDebInfo
cd out/build/macos
cpack -C Debug

- name: Upload
uses: actions/upload-artifact@v4
with:
name: fallout2-ce-macos.dmg
path: build/Fallout II Community Edition.dmg
path: out/build/macos/Fallout II Community Edition.dmg
retention-days: 7

windows:
Expand All @@ -266,27 +229,20 @@ jobs:
- name: Cache cmake build
uses: actions/cache@v4
with:
path: build
path: out
key: windows-${{ matrix.arch }}-cmake-v2

- name: Configure
run: |
cmake \
-B build \
-G "Visual Studio 16 2019" \
-A ${{ matrix.generator-platform }} \
# EOL
cmake --preset windows-${{ matrix.arch }}

- name: Build
run: |
cmake \
--build build \
--config RelWithDebInfo \
# EOL
cmake --build --preset windows-${{ matrix.arch }}-debug

- name: Upload
uses: actions/upload-artifact@v4
with:
name: fallout2-ce-windows-${{ matrix.arch }}
path: build/RelWithDebInfo/fallout2-ce.exe
path: out/build/windows-${{ matrix.arch }}/Debug/fallout2-ce.exe
retention-days: 7
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -391,3 +391,4 @@ FodyWeavers.xsd
# CMake
/out
/build
CMakeUserPresets.json
196 changes: 196 additions & 0 deletions CMakePresets.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,196 @@
{
"version": 6,
"cmakeMinimumRequired": {
"major": 3,
"minor": 19,
"patch": 0
},
"configurePresets": [
{
"name": "base",
"hidden": true,
"binaryDir": "${sourceDir}/out/build/${presetName}"
},
{
"name": "windows-base",
"hidden": true,
"inherits": [
"base"
],
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Windows"
}
},
{
"name": "windows-x86",
"inherits": [
"windows-base"
],
"generator": "Visual Studio 16 2019",
"architecture": "Win32"
},
{
"name": "windows-x64",
"inherits": [
"windows-base"
],
"generator": "Visual Studio 16 2019",
"architecture": "x64"
},
{
"name": "linux-base",
"hidden": true,
"inherits": [
"base"
],
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Linux"
},
"cacheVariables": {
"FALLOUT_VENDORED": "OFF"
}
},
{
"name": "linux-x86-base",
"hidden": true,
"inherits": [
"linux-base"
],
"cacheVariables": {
"CMAKE_C_FLAGS": "-m32",
"CMAKE_CXX_FLAGS": "-m32",
"CMAKE_SYSTEM_NAME": "Linux",
"CMAKE_SYSTEM_PROCESSOR": "i386"
}
},
{
"name": "linux-x86-debug",
"inherits": [
"linux-x86-base"
],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "linux-x86-release",
"inherits": [
"linux-x86-base"
],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "linux-x64-debug",
"inherits": [
"linux-base"
],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "Debug"
}
},
{
"name": "linux-x64-release",
"inherits": [
"linux-base"
],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo"
}
},
{
"name": "darwin-base",
"hidden": true,
"inherits": [
"base"
],
"generator": "Xcode",
"cacheVariables": {
"CMAKE_XCODE_ATTRIBUTE_CODE_SIGN_IDENTITY": ""
},
"condition": {
"type": "equals",
"lhs": "${hostSystemName}",
"rhs": "Darwin"
}
},
{
"name": "macos",
"inherits": [
"darwin-base"
]
},
{
"name": "ios",
"inherits": [
"darwin-base"
],
"cacheVariables": {
"CMAKE_SYSTEM_NAME": "iOS"
}
}
],
"buildPresets": [
{
"name": "windows-x86-debug",
"configurePreset": "windows-x86",
"configuration": "Debug"
},
{
"name": "windows-x86-release",
"configurePreset": "windows-x86",
"configuration": "Release"
},
{
"name": "windows-x64-debug",
"configurePreset": "windows-x64",
"configuration": "Debug"
},
{
"name": "windows-x64-release",
"configurePreset": "windows-x64",
"configuration": "Release"
},
{
"name": "linux-x86-debug",
"configurePreset": "linux-x86-debug"
},
{
"name": "linux-x86-release",
"configurePreset": "linux-x86-release"
},
{
"name": "linux-x64-debug",
"configurePreset": "linux-x64-debug"
},
{
"name": "linux-x64-release",
"configurePreset": "linux-x64-release"
},
{
"name": "macos-debug",
"configurePreset": "macos",
"configuration": "Debug"
},
{
"name": "macos-release",
"configurePreset": "macos",
"configuration": "RelWithDebInfo"
},
{
"name": "ios-debug",
"configurePreset": "ios",
"configuration": "Debug"
},
{
"name": "ios-release",
"configurePreset": "ios",
"configuration": "RelWithDebInfo"
}
]
}
Loading