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

CI: Windows vcpkg buildfix workarounds #322

Merged
merged 1 commit into from
Sep 28, 2024
Merged
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
5 changes: 4 additions & 1 deletion .github/workflows/winvcpkg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ jobs:
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
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 -DOPENMIND_BUILD_TESTS=NO

- name: Build
run: cmake --build ${{github.workspace}}/build
38 changes: 20 additions & 18 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,25 @@ else()
endif()
endif()

list(APPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/"
"${CMAKE_BINARY_DIR}/lib/cmake"
"${CMAKE_SOURCE_DIR}/cmake"
)
if(OPENMIND_USE_CONAN)
list(PREPEND CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}"
)
list(APPEND CMAKE_PREFIX_PATH ${CMAKE_MODULE_PATH})
endif()

include(bins)

message("address_model: ${address_model}")


if(CMAKE_BUILD_TYPE MATCHES [Dd][Ee][Bb][Uu][Gg])
set(CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR} CACHE PATH "hint for find_package")
set(_IS_DEBUG TRUE)
Expand All @@ -77,26 +96,8 @@ else()
endif()
endif()
endif()

set(OPENMIND_PRIME_TABLE_OPTIONS Boost Bundled)

set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/"
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules/"
"${CMAKE_BINARY_DIR}/lib/cmake"
"${CMAKE_SOURCE_DIR}/cmake"
)
if(OPENMIND_USE_CONAN)
set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_SOURCE_DIR}"
"${CMAKE_CURRENT_BINARY_DIR}"
${CMAKE_MODULE_PATH}
)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${CMAKE_MODULE_PATH})
endif()
include(bins)
message("address_model: ${address_model}")

if(BUILD_TESTS OR OPENMIND_BUILD_TESTS OR _IS_DEBUG OR NOT CMAKE_BUILD_TYPE)
set(initTestsEnabled ON)
else()
Expand Down Expand Up @@ -192,6 +193,7 @@ if(OPENMIND_USE_VCPKG)
set(_BOOST_USED_COMPONENTS ${_BOOST_USED_COMPONENTS}
compute
multiprecision
uuid
CACHE STRING "Components" FORCE)
endif(OPENMIND_USE_VCPKG)
if(BUILD_TESTS OR OPENMIND_BUILD_TESTS OR _IS_DEBUG OR NOT CMAKE_BUILD_TYPE)
Expand Down
12 changes: 8 additions & 4 deletions cmake/bins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -143,11 +143,15 @@ function(apply_target_commons this_target)
MSVC_CONSTEXPR=constexpr
NO_MSVC_CONSTEXPR=
MSVC
$<$<CONFIG:DEBUG>:BOOST_ALL_STATIC_LINK>
$<$<CONFIG:Release>:BOOST_ALL_STATIC_LINK>
$<$<CONFIG:RelWithDebInfo>:BOOST_ALL_STATIC_LINK>
$<$<CONFIG:MinSizeRel>:BOOST_ALL_STATIC_LINK>
)
if(NOT OPENMIND_USE_VCPKG)
target_compile_definitions(${this_target} PUBLIC
$<$<CONFIG:DEBUG>:BOOST_ALL_STATIC_LINK>
$<$<CONFIG:Release>:BOOST_ALL_STATIC_LINK>
$<$<CONFIG:RelWithDebInfo>:BOOST_ALL_STATIC_LINK>
$<$<CONFIG:MinSizeRel>:BOOST_ALL_STATIC_LINK>
)
endif()
if(OPENMIND_USE_CONAN OR OPENMIND_USE_VCPKG)
target_compile_definitions(${this_target} PUBLIC
BOOST_ALL_NO_LIB
Expand Down
10 changes: 7 additions & 3 deletions omnn/math/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ if(OPENMIND_MATH_USE_LEVELDB_CACHE OR OPENMIND_MATH_USE_FOUNDATIONDB_CACHE)
option(OPENMIND_MATH_CACHE_VOLATILE "Clean cache each start (for debugging purposes)" ${OPENMIND_STORAGE_VOLATILE})
endif(OPENMIND_MATH_USE_LEVELDB_CACHE OR OPENMIND_MATH_USE_FOUNDATIONDB_CACHE)

lib(storage)

add_library(OpenMind::math ALIAS math)
set(DEPENDENCIES storage)
if(WIN32 AND OPENMIND_USE_VCPKG)
list(APPEND DEPENDENCIES bcrypt) # workaround boost-uuid vcpkg bug
endif()
lib(${DEPENDENCIES})

if(OPENMIND_MATH_USE_LEVELDB_CACHE OR OPENMIND_MATH_USE_FOUNDATIONDB_CACHE)
if(OPENMIND_MATH_USE_LEVELDB_CACHE)
Expand All @@ -25,3 +27,5 @@ if(OPENMIND_MATH_USE_LEVELDB_CACHE OR OPENMIND_MATH_USE_FOUNDATIONDB_CACHE)
target_compile_definitions(${this_target} PUBLIC ALLOW_CACHE_UPGRADE)
endif()
endif()

#add_library(OpenMind::math ALIAS math)
1 change: 1 addition & 0 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"boost-system",
"boost-test",
"boost-thread",
"boost-uuid",
"leveldb",
{
"name": "vcpkg-cmake",
Expand Down
Loading