Add cmake presets (#452)

This commit is contained in:
Alexander Batalov
2025-02-09 15:00:12 +03:00
committed by GitHub
parent 4df9ee557d
commit 593f80144c
6 changed files with 220 additions and 1135 deletions

View File

@@ -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:
@@ -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'
- name: Configure
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'
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:
@@ -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:
@@ -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
.gitignore vendored
View File

@@ -391,3 +391,4 @@ FodyWeavers.xsd
# CMake
/out
/build
CMakeUserPresets.json

196
CMakePresets.json Normal file
View File

@@ -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"
}
]
}

View File

@@ -1,50 +0,0 @@
{
"configurations": [
{
"name": "x86-Debug",
"generator": "Visual Studio 16 2019",
"configurationType": "Debug",
"inheritEnvironments": [ "msvc_x86" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
},
{
"name": "x86-Release",
"generator": "Visual Studio 16 2019",
"configurationType": "Release",
"inheritEnvironments": [ "msvc_x86" ],
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": ""
},
{
"name": "x64-Debug",
"generator": "Visual Studio 16 2019 Win64",
"configurationType": "Debug",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": []
},
{
"name": "x64-Release",
"generator": "Visual Studio 16 2019 Win64",
"configurationType": "Release",
"buildRoot": "${projectDir}\\out\\build\\${name}",
"installRoot": "${projectDir}\\out\\install\\${name}",
"cmakeCommandArgs": "",
"buildCommandArgs": "",
"ctestCommandArgs": "",
"inheritEnvironments": [ "msvc_x64_x64" ],
"variables": []
}
]
}

View File

@@ -1,4 +0,0 @@
set( CMAKE_SYSTEM_NAME "Linux" )
set( CMAKE_SYSTEM_PROCESSOR "i386" )
set( CMAKE_C_FLAGS "-m32" )
set( CMAKE_CXX_FLAGS "-m32" )

File diff suppressed because it is too large Load Diff