-
Notifications
You must be signed in to change notification settings - Fork 16
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add cmakepresets and improve build script
- Loading branch information
1 parent
4d48bc7
commit df60517
Showing
2 changed files
with
91 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,6 @@ env: | |
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) | ||
BUILD_TYPE: Release | ||
PROJECT_NAME: Caprica | ||
CMAKE_ARGS: "-DCHAMPOLLION_USE_STATIC_RUNTIME:BOOL=TRUE -DENABLE_STATIC_RUNTIME:BOOL=TRUE -DCMAKE_INSTALL_PREFIX:STRING=build/extern -DVCPKG_TARGET_TRIPLET:STRING=x64-windows-static -DCMAKE_TOOLCHAIN_FILE:STRING=C:/vcpkg/scripts/buildsystems/vcpkg.cmake" | ||
|
||
jobs: | ||
build: | ||
|
@@ -23,40 +22,24 @@ jobs: | |
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Setup vcpkg | ||
working-directory: c:/ | ||
run: | | ||
git clone https://github.com/microsoft/vcpkg.git | ||
cd vcpkg | ||
bootstrap-vcpkg.bat | ||
vcpkg.exe integrate install | ||
- uses: lukka/get-cmake@latest | ||
|
||
- name: Cache vcpkg packages | ||
uses: actions/cache@v3 | ||
with: | ||
path: ${{github.workspace}}/build/vcpkg_installed | ||
key: ${{ runner.os }}-vcpkg-${{ hashFiles('${{github.workspace}}/vcpkg.json') }} | ||
restore-keys: | | ||
${{ runner.os }}-vcpkg-${{ hashFiles('${{github.workspace}}/vcpkg.json') }} | ||
${{ runner.os }}-vcpkg- | ||
- name: Configure CMake | ||
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. | ||
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type | ||
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DCAPRICA_USE_STATIC_RUNTIME:BOOL=TRUE -DENABLE_STATIC_RUNTIME:BOOL=TRUE -DCMAKE_INSTALL_PREFIX:STRING=build/extern -DVCPKG_TARGET_TRIPLET:STRING=x64-windows-static -DCMAKE_TOOLCHAIN_FILE:STRING=C:/vcpkg/scripts/buildsystems/vcpkg.cmake | ||
- name: Setup vcpkg (without building packages) | ||
uses: lukka/run-vcpkg@v11 | ||
|
||
- name: Build | ||
# Build your program with the given configuration | ||
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} | ||
- name: Run CMake in accordance with CMakePreset.json and run vcpkg | ||
uses: lukka/run-cmake@v10 | ||
with: | ||
buildPreset: "release-msvc" | ||
buildPresetAdditionalArgs: "['--config Release']" | ||
|
||
- name: Upload a Build Artifact | ||
uses: actions/[email protected] | ||
with: | ||
# Artifact name | ||
name: ${{ env.PROJECT_NAME }} | ||
# A file, directory or wildcard pattern that describes what to upload | ||
path: build/Caprica/Release/Caprica.exe | ||
path: build/extern/Caprica/Caprica.exe | ||
# The desired behavior if no files are found using the provided path. | ||
retention-days: 90 | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
{ | ||
"version": 8, | ||
"cmakeMinimumRequired": { | ||
"major": 3, | ||
"minor": 21, | ||
"patch": 0 | ||
}, | ||
"configurePresets": [ | ||
{ | ||
"name": "base", | ||
"hidden": true, | ||
"cacheVariables": { | ||
"CAPRICA_USE_STATIC_RUNTIME": { | ||
"type": "BOOL", | ||
"value": "TRUE" | ||
}, | ||
"ENABLE_STATIC_RUNTIME": { | ||
"type": "BOOL", | ||
"value": "TRUE" | ||
}, | ||
"CMAKE_CXX_FLAGS": "$env{CPP_COMPILER}" | ||
} | ||
}, | ||
{ | ||
"name": "vcpkg", | ||
"hidden": true, | ||
"cacheVariables": { | ||
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake", | ||
"VCPKG_TARGET_TRIPLET": "x64-windows-static" | ||
} | ||
}, | ||
{ | ||
"name": "x64", | ||
"hidden": true, | ||
"architecture": { | ||
"value": "x64", | ||
"strategy": "external" | ||
} | ||
}, | ||
{ | ||
"name": "msvc", | ||
"hidden": true, | ||
"environment": { | ||
"CPP_COMPILER": "/permissive- /Zc:preprocessor /EHsc $penv{CXXFLAGS}" | ||
}, | ||
"vendor": { | ||
"microsoft.com/VisualStudioSettings/CMake/1.0": { | ||
"intelliSenseMode": "windows-msvc-x64", | ||
"enableMicrosoftCodeAnalysis": true, | ||
"enableClangTidyCodeAnalysis": true | ||
} | ||
} | ||
}, | ||
{ | ||
"name": "build-release-msvc", | ||
"inherits": [ | ||
"base", | ||
"vcpkg", | ||
"x64", | ||
"msvc" | ||
], | ||
"displayName": "Release", | ||
"description": "Optimized release Build.", | ||
"generator": "Ninja", | ||
"binaryDir": "${sourceDir}/build/extern", | ||
"cacheVariables": { | ||
"CMAKE_BUILD_TYPE": { | ||
"type": "STRING", | ||
"value": "RelWithDebInfo" | ||
} | ||
} | ||
} | ||
], | ||
"buildPresets": [ | ||
{ | ||
"name": "release-msvc", | ||
"displayName": "Release (MSVC)", | ||
"configurePreset": "build-release-msvc", | ||
"description": "Optimized release Build." | ||
} | ||
] | ||
} |