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

feat!: replace vcpkg with CPM.cmake #189

Closed
wants to merge 9 commits into from
Closed
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
19 changes: 7 additions & 12 deletions .github/workflows/main_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ on:
workflow_dispatch:

env:
VCPKG_COMMIT_ID: 830f86fb309ad7167468a433a890b7415fbb90a5
GITHUB_WORKSPACE: ${{ github.workspace }}

jobs:
Expand All @@ -27,16 +26,12 @@ jobs:
- name: Get CMake
uses: lukka/get-cmake@latest

- name: Setup vcpkg
uses: lukka/[email protected]
- name: Setup MSVC prompt
uses: TheMrMilchmann/setup-msvc-dev@v3
with:
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }}
arch: x64
toolset: 14.37

- name: Run CMake
uses: lukka/[email protected]
with:
cmakeListsTxtPath: "${{ github.workspace }}/CommonLibSF/CMakeLists.txt"
configurePreset: build-release-${{ matrix.compiler }}-ninja
configurePresetCmdString: "[`-B`, `$[env.GITHUB_WORKSPACE]/build`, `-S`, `$[env.GITHUB_WORKSPACE]/CommonLibSF`, `--preset`, `$[env.CONFIGURE_PRESET_NAME]`]"
buildPreset: release-${{ matrix.compiler }}-ninja
buildPresetCmdString: "[`--build`, `$[env.GITHUB_WORKSPACE]/build`, `--preset`, `$[env.BUILD_PRESET_NAME]`]"
- name: Build
run: |
${{ github.workspace }}/build-${{ matrix.compiler }}.bat
6 changes: 0 additions & 6 deletions .github/workflows/update_pdb.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ concurrency:
cancel-in-progress: true

env:
VCPKG_COMMIT_ID: 830f86fb309ad7167468a433a890b7415fbb90a5
GITHUB_WORKSPACE: ${{ github.workspace }}

jobs:
Expand All @@ -24,11 +23,6 @@ jobs:
- name: Get CMake
uses: lukka/get-cmake@latest

- name: Setup vcpkg
uses: lukka/[email protected]
with:
vcpkgGitCommitId: ${{ env.VCPKG_COMMIT_ID }}

- name: Run CMake
uses: lukka/[email protected]
with:
Expand Down
13 changes: 9 additions & 4 deletions CommonLibSF/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
cmake_minimum_required(VERSION 3.26)
message("Using toolchain file ${CMAKE_TOOLCHAIN_FILE}.")

# singleton target across multiple projects
if(TARGET CommonLibSF)
Expand All @@ -26,13 +25,19 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)

include(GNUInstallDirs)

include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/CPM.cmake")

# out-of-source builds only
if(${PROJECT_SOURCE_DIR} STREQUAL ${PROJECT_BINARY_DIR})
message(FATAL_ERROR "In-source builds are not allowed.")
endif()

# dependencies
find_package(spdlog CONFIG REQUIRED)
CPMAddPackage(
GITHUB_REPOSITORY gabime/spdlog
VERSION 1.12.0
OPTIONS "SPDLOG_USE_STD_FORMAT ON"
)

# source files
execute_process(
Expand Down Expand Up @@ -125,7 +130,7 @@ target_link_libraries(
)

if(SFSE_SUPPORT_XBYAK)
find_package(xbyak CONFIG REQUIRED)
CPMAddPackage("gh:herumi/xbyak@6.73")

target_link_libraries(
${PROJECT_NAME}
Expand All @@ -141,7 +146,7 @@ target_precompile_headers(
)

install(
TARGETS ${PROJECT_NAME}
TARGETS ${PROJECT_NAME} spdlog
EXPORT ${PROJECT_NAME}-targets
)

Expand Down
17 changes: 0 additions & 17 deletions CommonLibSF/CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,6 @@
"CMAKE_MSVC_RUNTIME_LIBRARY": "MultiThreaded$<$<CONFIG:Debug>:Debug>DLL"
}
},
{
"name": "packaging-vcpkg",
"hidden": true,
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
"VCPKG_TARGET_TRIPLET": "x64-windows-static-md",
"VCPKG_HOST_TRIPLET": "x64-windows-static-md"
}
},
{
"name": "buildtype-debug-msvc",
"hidden": true,
Expand Down Expand Up @@ -106,7 +97,6 @@
"name": "build-debug-msvc-msvc",
"inherits": [
"common",
"packaging-vcpkg",
"buildtype-debug-msvc",
"generator-msvc",
"compiler-msvc"
Expand All @@ -116,7 +106,6 @@
"name": "build-debug-msvc-ninja",
"inherits": [
"common",
"packaging-vcpkg",
"buildtype-debug-msvc",
"generator-ninja",
"compiler-msvc"
Expand All @@ -127,7 +116,6 @@
"toolset": "ClangCL",
"inherits": [
"common",
"packaging-vcpkg",
"buildtype-debug-clang-cl",
"generator-msvc",
"compiler-clang-cl"
Expand All @@ -137,7 +125,6 @@
"name": "build-debug-clang-cl-ninja",
"inherits": [
"common",
"packaging-vcpkg",
"buildtype-debug-clang-cl",
"generator-ninja",
"compiler-clang-cl"
Expand All @@ -147,7 +134,6 @@
"name": "build-release-msvc-msvc",
"inherits": [
"common",
"packaging-vcpkg",
"buildtype-release-msvc",
"generator-msvc",
"compiler-msvc"
Expand All @@ -157,7 +143,6 @@
"name": "build-release-msvc-ninja",
"inherits": [
"common",
"packaging-vcpkg",
"buildtype-release-msvc",
"generator-ninja",
"compiler-msvc"
Expand All @@ -168,7 +153,6 @@
"toolset": "ClangCL",
"inherits": [
"common",
"packaging-vcpkg",
"buildtype-release-clang-cl",
"generator-msvc",
"compiler-clang-cl"
Expand All @@ -178,7 +162,6 @@
"name": "build-release-clang-cl-ninja",
"inherits": [
"common",
"packaging-vcpkg",
"buildtype-release-clang-cl",
"generator-ninja",
"compiler-clang-cl"
Expand Down
Loading