Skip to content

Commit

Permalink
CI: Windows build with vcpkg
Browse files Browse the repository at this point in the history
  • Loading branch information
ohhmm committed Sep 28, 2024
1 parent 2705f07 commit d3fb732
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 5 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/vcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,21 @@ jobs:
ninja --version
clang --version
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
uses: microsoft/[email protected]

- name: Setup MSVC
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Install CMake and Ninja (Windows)
if: runner.os == 'Windows'
run: |
choco install cmake ninja
cmake --version
ninja --version
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
Expand Down
49 changes: 49 additions & 0 deletions .github/workflows/winvcpkg.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Vcpkg CI

on: [push]

jobs:
build:
strategy:
matrix:
os: [windows-latest]
runs-on: ${{ matrix.os }}

steps:
- uses: actions/checkout@v2

- name: Cache vcpkg
uses: actions/cache@v2
with:
path: |
${{github.workspace}}/vcpkg
!${{github.workspace}}/vcpkg/buildtrees
!${{github.workspace}}/vcpkg/packages
!${{github.workspace}}/vcpkg/downloads
key: ${{ runner.os }}-vcpkg-${{ hashFiles('**/vcpkg.json') }}
restore-keys: |
${{ runner.os }}-vcpkg-
- name: Install dependencies (Windows)
if: runner.os == 'Windows'
uses: microsoft/[email protected]

- name: Setup MSVC
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1

- name: Install CMake and Ninja (Windows)
if: runner.os == 'Windows'
run: |
choco install cmake ninja
cmake --version
ninja --version
- name: Setup vcpkg
uses: lukka/run-vcpkg@v11
with:
vcpkgGitCommitId: '3508985146f1b1d248c67ead13f8f54be5b4f5da'
vcpkgJsonGlob: '**/vcpkg.json'

- name: Configure CMake
run: cmake -B ${{github.workspace}}/build -G Ninja -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake || cmake -B ${{github.workspace}}/build -G Ninja -DCMAKE_TOOLCHAIN_FILE=${{github.workspace}}/vcpkg/scripts/buildsystems/vcpkg.cmake
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -58,14 +58,16 @@ if(CMAKE_BUILD_TYPE MATCHES [Dd][Ee][Bb][Uu][Gg])
if(MSVC)
add_compile_options($<$<CONFIG:Debug>:/constexpr:steps1000000000>)
add_link_options(/stack:1000000000)
else()
elseif(NOT OPENMIND_USE_VCPKG)
add_definitions(-DBOOST_ALL_DYN_LINK)
endif()
else()
set(_IS_DEBUG FALSE)
set(Boost_USE_STATIC_LIBS ON)
SET(BUILD_SHARED_LIBS OFF)
add_definitions(-DBOOST_ALL_STATIC_LINK)
if(NOT OPENMIND_USE_VCPKG)
add_definitions(-DBOOST_ALL_STATIC_LINK)
endif()
if(CMAKE_BUILD_TYPE MATCHES [Rr][Ee][Ll][Ee][Aa][Ss][Ee])
set(OPENMIND_PRIME_TABLE Bundled CACHE STRING "Table of predefined prime numbers")
option(OPENMIND_USE_CPACK "Build an installer" ON)
Expand Down Expand Up @@ -214,7 +216,7 @@ if(OPENMIND_PRIME_MINING)
endif()

set(OPENMIND_INCLUDE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
message("OPENMIND_INCLUDE_DIR ${OPENMIND_INCLUDE_DIR}")
message("OPENMIND_INCLUDE_DIR=${OPENMIND_INCLUDE_DIR}")

if(EXISTS ${CMAKE_BINARY_DIR}/conanbuildinfo.cmake)
option(OPENMIND_USE_CONAN "Use conan dependencies" ON)
Expand All @@ -237,8 +239,7 @@ if (NOT Boost_FOUND)
if (OPENMIND_USE_VCPKG)
unset(Boost_DIR CACHE)
unset(Boost_INCLUDE_DIR CACHE)
message("BOOST_USED_COMPONENTS=${BOOST_USED_COMPONENTS}")
find_package(Boost CONFIG REQUIRED COMPONENTS ${BOOST_USED_COMPONENTS})
find_package(Boost CONFIG COMPONENTS ${BOOST_USED_COMPONENTS} REQUIRED)
else()
find_package(Boost ${OPENMIND_PREFERRED_BOOST_VERSION}
CONFIG
Expand Down

0 comments on commit d3fb732

Please sign in to comment.