Skip to content

Commit

Permalink
Merge pull request #1867 from isuruf/cereal
Browse files Browse the repository at this point in the history
Install vendored cereal headers
  • Loading branch information
isuruf committed Dec 1, 2021
2 parents 4b841d1 + f7ac8b6 commit 36ac51d
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 3 deletions.
9 changes: 7 additions & 2 deletions CMakeLists.txt
Expand Up @@ -313,12 +313,14 @@ if (WITH_MPC)
set(PKGS ${PKGS} "MPC")
endif()

set(WITH_SYSTEM_CEREAL no CACHE BOOL "Build with system cereal instead of vendored files")
if (WITH_SYSTEM_CEREAL)
find_package(CEREAL REQUIRED)
include_directories(SYSTEM ${CEREAL_INCLUDE_DIRS})
set(PKGS ${PKGS} "CEREAL")
else()
include_directories(SYSTEM ${CMAKE_CURRENT_SOURCE_DIR}/symengine/utilities/cereal/include)
set(CEREAL_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/symengine/utilities/cereal/include")
endif()
include_directories(SYSTEM ${CEREAL_INCLUDE_DIRS})

# PTHREAD
set(WITH_PTHREAD no
Expand Down Expand Up @@ -615,6 +617,9 @@ if (TARGET teuchos)
set(CONF_INCLUDE_DIRS ${CONF_INCLUDE_DIRS}
${PROJECT_SOURCE_DIR}/symengine/utilities/teuchos ${PROJECT_BINARY_DIR}/symengine/utilities/teuchos)
endif()
if (NOT WITH_SYSTEM_CEREAL)
set(CONF_INCLUDE_DIRS ${CONF_INCLUDE_DIRS} ${PROJECT_SOURCE_DIR}/symengine/utilities/cereal/include)
endif()
set(SYMENGINE_BUILD_TREE yes)
configure_file(cmake/SymEngineConfig.cmake.in
"${PROJECT_BINARY_DIR}/SymEngineConfig.cmake" @ONLY)
Expand Down
7 changes: 6 additions & 1 deletion cmake/SymEngineConfig.cmake.in
Expand Up @@ -54,13 +54,18 @@ if(SYMENGINE_BUILD_TREE)
set(SYMENGINE_INSTALL_CMAKE_DIR "${SYMENGINE_CMAKE_DIR}")
set(SYMENGINE_INCLUDE_DIRS @CONF_INCLUDE_DIRS@ ${SYMENGINE_CMAKE_DIR})
if (TARGET teuchos)
set(SYMENGINE_INCLUDE_DIRS ${SYMENGINE_INCLUDE_DIRS} ${SYMENGINE_CMAKE_DIR}/symengine/teuchos)
set(SYMENGINE_INCLUDE_DIRS ${SYMENGINE_INCLUDE_DIRS} ${SYMENGINE_CMAKE_DIR}/symengine/utilities/teuchos)
endif()
else()
set(SYMENGINE_INSTALL_CMAKE_DIR "@CMAKE_INSTALL_PREFIX@/@INSTALL_CMAKE_DIR@")
set(SYMENGINE_INCLUDE_DIRS "${SYMENGINE_CMAKE_DIR}/@DEF_INSTALL_CMAKE_DIR_REL@/include")
if (NOT @WITH_SYSTEM_CEREAL@)
set(SYMENGINE_INCLUDE_DIRS ${SYMENGINE_INCLUDE_DIRS}
"${SYMENGINE_CMAKE_DIR}/@DEF_INSTALL_CMAKE_DIR_REL@/include/symengine/utilities/cereal/include")
endif()
endif()


@SYMENGINE_PKG_FINDS@

set(SYMENGINE_LLVM_COMPONENTS @SYMENGINE_LLVM_COMPONENTS@)
Expand Down
6 changes: 6 additions & 0 deletions symengine/CMakeLists.txt
Expand Up @@ -224,8 +224,14 @@ set(HEADERS
assumptions.h
refine.h
simplify.h
utilities/stream_fmt.h
)

if (NOT WITH_SYSTEM_CEREAL)
file(GLOB_RECURSE CEREAL_HEADERS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} "utilities/cereal/include/*")
set(HEADERS ${HEADERS} ${CEREAL_HEADERS})
endif()

include(GNUInstallDirs)

# Configure SymEngine using our CMake options:
Expand Down

0 comments on commit 36ac51d

Please sign in to comment.