Skip to content

Commit

Permalink
Make it possible to choose using host-provided capnproto
Browse files Browse the repository at this point in the history
Now that we use capnproto in Surelog directly, provide the
option (previously, we were using whatever the UHDM submodule
leaked into our cmakefile).
  • Loading branch information
hzeller committed Aug 8, 2023
1 parent ca435b4 commit d4c6216
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ option(
option(
SURELOG_USE_HOST_UHDM
"Use UHDM library from host instead of third_party" OFF)
option(SURELOG_USE_HOST_CAPNP
"Use capnproto from host system, not UHDM (if OFF, requires SURELOG_USE_HOST_UHDM=OFF)"
OFF)
option(
SURELOG_USE_HOST_GTEST
"Use googletest library from host instead of third_party" OFF)
Expand Down Expand Up @@ -101,12 +104,13 @@ else()
set(ANTLR_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/third_party/antlr4/runtime/Cpp/runtime/src)
endif()

set(UHDM_BUILD_TESTS OFF CACHE BOOL "Skip UHDM tests")
if(SURELOG_USE_HOST_UHDM)
find_package(UHDM REQUIRED)
find_package(CapnProto)
set(UHDM_LIBRARY uhdm::uhdm)
else()
set(UHDM_USE_HOST_CAPNP ${SURELOG_USE_HOST_CAPNP})
set(UHDM_BUILD_TESTS OFF CACHE BOOL "Skip UHDM tests")
add_subdirectory(third_party/UHDM)
set(UHDM_LIBRARY uhdm)
get_target_property(UHDM_INCLUDE_DIRS uhdm INCLUDE_DIRECTORIES)
Expand All @@ -119,6 +123,13 @@ else()
set(GTEST_INCLUDE_DIRS third_party/googletest/googletest/include third_party/googletest/googlemock/include)
endif()

if(SURELOG_USE_HOST_CAPNP)
find_package(CapnProto)
else()
# rely on UHDM_USE_HOST_CAPNP to have set up variables correctly
# Requires SURELOG_USE_HOST_UHDM=Off
endif()

# NOTE: Set the global output directories after the subprojects have had their go at it
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/bin)
Expand Down

0 comments on commit d4c6216

Please sign in to comment.