Skip to content

Commit

Permalink
BOOST_ALL_NO_LIB for OPENMIND_USE_VCPKG
Browse files Browse the repository at this point in the history
  • Loading branch information
ohhmm committed Sep 24, 2024
1 parent 5d4af05 commit 576cb6e
Show file tree
Hide file tree
Showing 5 changed files with 62 additions and 51 deletions.
45 changes: 34 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -186,13 +186,25 @@ set(_BOOST_USED_COMPONENTS
system
thread
CACHE STRING "Components" FORCE)

if(OPENMIND_USE_VCPKG)
set(_BOOST_USED_COMPONENTS ${_BOOST_USED_COMPONENTS}
boost
compute
multiprecision
CACHE STRING "Components" FORCE)
endif(OPENMIND_USE_VCPKG)
if(BUILD_TESTS OR OPENMIND_BUILD_TESTS OR _IS_DEBUG OR NOT CMAKE_BUILD_TYPE)
enable_testing()
set(_BOOST_USED_COMPONENTS ${_BOOST_USED_COMPONENTS}
unit_test_framework
test_exec_monitor
CACHE STRING "Components" FORCE)
if(OPENMIND_USE_VCPKG)
set(_BOOST_USED_COMPONENTS ${_BOOST_USED_COMPONENTS}
test
CACHE STRING "Components" FORCE)
else(OPENMIND_USE_VCPKG)
set(_BOOST_USED_COMPONENTS ${_BOOST_USED_COMPONENTS}
unit_test_framework
test_exec_monitor
CACHE STRING "Components" FORCE)
endif(OPENMIND_USE_VCPKG)
endif()
list(REMOVE_DUPLICATES _BOOST_USED_COMPONENTS)
set(BOOST_USED_COMPONENTS ${_BOOST_USED_COMPONENTS} CACHE STRING "Components" FORCE)
Expand Down Expand Up @@ -240,7 +252,10 @@ add_custom_target(prerequisites)
set_target_properties(prerequisites PROPERTIES FOLDER "util")


if(NOT Boost_FOUND AND NOT OPENMIND_USE_CONAN)
if(NOT Boost_FOUND
AND NOT OPENMIND_USE_CONAN
AND NOT OPENMIND_USE_VCPKG
)
message("Building Boost ${OPENMIND_PREFERRED_BOOST_VERSION}")
set(OM_BUILD_BOOST True)
else()
Expand Down Expand Up @@ -369,11 +384,19 @@ if(NOT MSVC OR Boost_VERSION VERSION_LESS 1.80.0)
set(BOOST_LINK_LIBS ${BOOST_LINK_LIBS}
Boost::thread)
endif()
set(BOOST_TEST_LINK_LIBS
${BOOST_LINK_LIBS}
Boost::test_exec_monitor
Boost::unit_test_framework
)
if(OPENMIND_USE_VCPKG)
set(BOOST_LINK_LIBS ${BOOST_LINK_LIBS}
Boost::headers
)
set(BOOST_TEST_LINK_LIBS ${BOOST_LINK_LIBS}
Boost::test
)
else()
set(BOOST_TEST_LINK_LIBS ${BOOST_LINK_LIBS}
Boost::test_exec_monitor
Boost::unit_test_framework
)
endif()

IF (Boost_FOUND)
message(STATUS "Boost found:")
Expand Down
2 changes: 1 addition & 1 deletion cmake/bins.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ function(apply_target_commons this_target)
$<$<CONFIG:RelWithDebInfo>:BOOST_ALL_STATIC_LINK>
$<$<CONFIG:MinSizeRel>:BOOST_ALL_STATIC_LINK>
)
if(OPENMIND_USE_CONAN)
if(OPENMIND_USE_CONAN OR OPENMIND_USE_VCPKG)
target_compile_definitions(${this_target} PUBLIC
BOOST_ALL_NO_LIB
)
Expand Down
5 changes: 3 additions & 2 deletions cmake/vcpkg.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ macro(find_vcpkg)
)
endif()
if (EXISTS ${VCPKG_EXECUTABLE})
message("VCPKG_EXECUTABLE=${VCPKG_EXECUTABLE}")
get_filename_component(VCPKG_ROOT ${VCPKG_EXECUTABLE} DIRECTORY)
set(VCPKG_ROOT "${VCPKG_ROOT}" CACHE PATH "Path to vcpkg installation" FORCE)
set(CMAKE_TOOLCHAIN_FILE "${VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake" CACHE STRING "Vcpkg toolchain file" FORCE)
Expand All @@ -18,8 +19,8 @@ macro(find_vcpkg)

if(EXISTS ${CMAKE_TOOLCHAIN_FILE})
set(VCPKG_FOUND TRUE CACHE BOOL "VCPKG toolchain file found ${CMAKE_TOOLCHAIN_FILE}" FORCE)
list(APPEND CMAKE_PROJECT_TOP_LEVEL_INCLUDES "${CMAKE_TOOLCHAIN_FILE}")
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_PROJECT_TOP_LEVEL_INCLUDES)
list(PREPEND CMAKE_PROJECT_TOP_LEVEL_INCLUDES "${CMAKE_TOOLCHAIN_FILE}")
list(PREPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES CMAKE_PROJECT_TOP_LEVEL_INCLUDES)
else()
set(VCPKG_FOUND FALSE CACHE BOOL "VCPKG not found" FORCE)
endif()
Expand Down
14 changes: 13 additions & 1 deletion omnn/rt/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,19 @@

set(DEPENDENCIES boost)
if(Boost_FOUND)
if(NOT MSVC OR OPENMIND_USE_CONAN)
if(OPENMIND_USE_VCPKG)
set(DEPENDENCIES ${DEPENDENCIES}
Boost::compute
Boost::headers
Boost::filesystem
Boost::multiprecision
)
if(OPENMIND_BUILD_TESTS)
set(DEPENDENCIES ${DEPENDENCIES}
Boost::test
)
endif()
elseif(NOT MSVC OR OPENMIND_USE_CONAN)
set(DEPENDENCIES ${DEPENDENCIES} Boost::filesystem)
if(OPENMIND_BUILD_TESTS)
set(DEPENDENCIES ${DEPENDENCIES}
Expand Down
47 changes: 11 additions & 36 deletions vcpkg.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,17 @@
"description": "OpenMind",
"dependencies": [
"boost",
{
"name": "boost-test",
"version>=": "1.85.0#1"
},
{
"name": "boost-chrono",
"version>=": "1.85.0#1"
},
{
"name": "boost-date-time",
"version>=": "1.85.0#1"
},
{
"name": "boost-filesystem",
"version>=": "1.85.0#1"
},
{
"name": "boost-iostreams",
"version>=": "1.85.0#1"
},
{
"name": "boost-locale",
"version>=": "1.85.0#1"
},
{
"name": "boost-serialization",
"version>=": "1.85.0#1"
},
{
"name": "boost-system",
"version>=": "1.85.0#1"
},
{
"name": "boost-thread",
"version>=": "1.85.0#1"
},
"boost-chrono",
"boost-compute",
"boost-date-time",
"boost-filesystem",
"boost-iostreams",
"boost-locale",
"boost-multiprecision",
"boost-serialization",
"boost-system",
"boost-test",
"boost-thread",
"leveldb",
{
"name": "vcpkg-cmake",
Expand Down

0 comments on commit 576cb6e

Please sign in to comment.