diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4347755..c58784d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -207,39 +207,42 @@ jobs: Add-Content "$env:GITHUB_ENV" 'EnforceProcessCountAcrossBuilds=true' - name: Configure preset - if: matrix.os != 'windows-2022' - shell: pwsh - run: cmake "--preset=ci-$("${{ matrix.os }}".split("-")[0])" - -D BUILD_SHARED_LIBS=${{ matrix.shared }} - - - name: Configure on windows - if: matrix.os == 'windows-2022' - shell: pwsh - run: cmake -G "Visual Studio 17 2022" -S . -B build -D CMAKE_BUILD_TYPE=Release - -D CMAKE_INSTALL_PREFIX=$(Get-Location)/stagedir -D BUILD_SHARED_LIBS=${{ matrix.shared }} - - - name: Setup PATH - if: matrix.os == 'windows-2022' && matrix.type == 'shared' - run: Add-Content "$env:GITHUB_PATH" "$(Get-Location)\build\Release" - - - name: Build - run: cmake --build build --config Release -j 2 - - - name: Install - run: cmake --install build --config Release --prefix stagedir - - - name: Test - working-directory: build - run: ctest --output-on-failure --no-tests=error -C Release -j 2 - - - name: TestInstalledVersion - if: matrix.os != 'windows-2022' + # if: matrix.os != 'windows-2022' + shell: bash run: | - cmake -B example/build -S example -G Ninja -D CMAKE_BUILD_TYPE=Release \ - -D "CMAKE_PREFIX_PATH=$PWD/stagedir;$PWD/conan" \ - # --toolchain "$PWD/conan/conan_toolchain.cmake" - ninja -C example/build - ninja -C example/build test + export hostSystemName=$("${{ matrix.os }}".split("-")[0]) + uname || echo ${hostSystemName} + perl -p -e "s//${hostSystemName}/g;" .CMakeUserPresets.json > CMakeUserPresets.json + cmake --workflow --preset=dev # XXX "--preset=ci-$("${{ matrix.os }}".split("-")[0])" + + # - name: Configure on windows + # if: matrix.os == 'windows-2022' + # shell: pwsh + # run: cmake -G "Visual Studio 17 2022" -S . -B build -D CMAKE_BUILD_TYPE=Release + # -D CMAKE_INSTALL_PREFIX=$(Get-Location)/stagedir -D BUILD_SHARED_LIBS=${{ matrix.shared }} + + # - name: Setup PATH + # if: matrix.os == 'windows-2022' && matrix.type == 'shared' + # run: Add-Content "$env:GITHUB_PATH" "$(Get-Location)\build\Release" + + # - name: Build + # run: cmake --build build --config Release -j 2 + + # - name: Install + # run: cmake --install build --config Release --prefix stagedir + + # - name: Test + # working-directory: build + # run: ctest --output-on-failure --no-tests=error -C Release -j 2 + + # - name: TestInstalledVersion + # if: matrix.os != 'windows-2022' + # run: | + # cmake -B example/build -S example -G Ninja -D CMAKE_BUILD_TYPE=Release \ + # -D "CMAKE_PREFIX_PATH=$PWD/stagedir;$PWD/conan" \ + # # --toolchain "$PWD/conan/conan_toolchain.cmake" + # ninja -C example/build + # ninja -C example/build test docs: # Deploy docs only when builds succeed diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..dcebc89 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "cmake/WindowsToolchain"] + path = cmake/WindowsToolchain + url = https://github.com/MarkSchofield/WindowsToolchain.git diff --git a/CMakeLists.txt b/CMakeLists.txt index 45fe7cf..e650c3c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,8 +17,6 @@ endif() set(CMAKE_CXX_VISIBILITY_PRESET hidden) set(CMAKE_VISIBILITY_INLINES_HIDDEN TRUE) -include(cmake/CPM.cmake) - if(PROJECT_IS_TOP_LEVEL) include(cmake/AddUninstallTarget.cmake) include(cmake/lint-targets.cmake) @@ -37,6 +35,7 @@ endmacro() ######################################################################### # cmake-format: off +# include(cmake/CPM.cmake) # instead of find_package(fmt REQUIRED) # cpmaddpackage( # NAME fmt @@ -59,8 +58,6 @@ target_sources(Algo FILES algo-interface.cppm ) -# TODO(CK): target_link_libraries(Algo PRIVATE fmt::fmt) -# target_link_libraries(Algo PRIVATE $) # CMake requires the language standard to be specified as compile feature # when a target provides C++23 modules and the target will be installed @@ -69,7 +66,6 @@ target_compile_features(Algo PUBLIC cxx_std_23) include(GenerateExportHeader) generate_export_header(Algo CUSTOM_CONTENT_FROM_VARIABLE - # XXX pragma_suppress_c4251 ) target_sources(Algo PUBLIC diff --git a/CMakePresets.json b/CMakePresets.json index f56cf1d..0fb82bf 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -42,8 +42,7 @@ "hidden": true, "cacheVariables": { "CMAKE_CONFIGURATION_TYPES": "RelWithDebInfo;Release;Debug", - "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/conan/conan_toolchain.cmake", - "CMAKE_POLICY_DEFAULT_CMP0091": "NEW" + "CMAKE_TOOLCHAIN_FILE": "${sourceDir}/conan/conan_toolchain.cmake" } }, { @@ -114,6 +113,7 @@ { "name": "ci-linux", "generator": "Ninja", + "description": "This build is only available on Linux", "hidden": true, "inherits": [ "flags-linux", @@ -126,6 +126,7 @@ { "name": "ci-darwin", "generator": "Ninja", + "description": "This build is only available on Darwin", "hidden": true, "inherits": [ "flags-darwin", @@ -140,11 +141,14 @@ "inherits": [ "ci-std" ], - "generator": "Visual Studio 17 2022", - "architecture": "x64", + "toolchainFile": "cmake/WindowsToolchain/Windows.MSVC.toolchain.cmake", + "generator": "Ninja Multi-Config", + "description": "This build is only available on Windows", "hidden": true, + "architecture": "x64", "cacheVariables": { - "CMAKE_BUILD_TYPE": "Release" + "CMAKE_BUILD_TYPE": "Release", + "CMAKE_SYSTEM_PROCESSOR": "AMD64" }, "condition": { "type": "equals", @@ -156,6 +160,7 @@ "name": "coverage-linux", "binaryDir": "${sourceDir}/build/coverage", "inherits": "ci-linux", + "description": "This build is only available on Linux", "hidden": true, "cacheVariables": { "ENABLE_COVERAGE": true, @@ -171,6 +176,7 @@ "name": "coverage-darwin", "binaryDir": "${sourceDir}/build/coverage", "inherits": "ci-darwin", + "description": "This build is only available on Darwin", "hidden": true, "cacheVariables": { "ENABLE_COVERAGE": true, @@ -199,6 +205,7 @@ "ci-linux", "dev-mode" ], + "description": "This build is only available on Linux", "cacheVariables": { "CMAKE_SKIP_INSTALL_RULES": true, "CMAKE_BUILD_TYPE": "Sanitize", diff --git a/cmake/WindowsToolchain b/cmake/WindowsToolchain new file mode 160000 index 0000000..b44662d --- /dev/null +++ b/cmake/WindowsToolchain @@ -0,0 +1 @@ +Subproject commit b44662d3e3fc1a4375e10a856ce098fc1507db1c