Skip to content
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
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).

## [Unreleased]

### Added
* Allow use of installed cereal and jrl-cmakemodules via cmake

## [0.6.6] - 2024-06-15

### Fixed
Expand Down
74 changes: 49 additions & 25 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,37 @@ set(PROJECT_CUSTOM_HEADER_EXTENSION "hpp")
set(PROJECT_USE_CMAKE_EXPORT TRUE)
set(PROJECT_USE_KEYWORD_LINK_LIBRARIES TRUE)

# Check if the submodule cmake have been initialized
set(JRL_CMAKE_MODULES "${CMAKE_CURRENT_LIST_DIR}/cmake-module")
if(EXISTS "${JRL_CMAKE_MODULES}/base.cmake")
message(STATUS "JRL cmakemodules found in 'cmake/' git submodule")
else()
find_package(jrl-cmakemodules QUIET CONFIG)
if(jrl-cmakemodules_FOUND)
get_property(
JRL_CMAKE_MODULES
TARGET jrl-cmakemodules::jrl-cmakemodules
PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
message(STATUS "JRL cmakemodules found on system at ${JRL_CMAKE_MODULES}")
elseif(${CMAKE_VERSION} VERSION_LESS "3.14.0")
message(
FATAL_ERROR
"\nCan't find jrl-cmakemodules. Please either:\n"
" - use git submodule: 'git submodule update --init'\n"
" - or install https://github.com/jrl-umi3218/jrl-cmakemodules\n"
" - or upgrade your CMake version to >= 3.14 to allow automatic fetching\n"
)
else()
message(STATUS "JRL cmakemodules not found. Let's fetch it.")
include(FetchContent)
FetchContent_Declare(
"jrl-cmakemodules"
GIT_REPOSITORY "https://github.com/jrl-umi3218/jrl-cmakemodules.git")
FetchContent_MakeAvailable("jrl-cmakemodules")
FetchContent_GetProperties("jrl-cmakemodules" SOURCE_DIR JRL_CMAKE_MODULES)
endif()
endif()

# Disable -Werror on Unix for now.
set(CXX_DISABLE_WERROR True)
set(CMAKE_VERBOSE_MAKEFILE True)
Expand All @@ -24,14 +55,6 @@ if(POLICY CMP0068)
cmake_policy(SET CMP0068 NEW)
endif(POLICY CMP0068)

# Check if the submodule cmake have been initialized
if(NOT EXISTS "${CMAKE_CURRENT_LIST_DIR}/cmake-module/base.cmake")
message(
FATAL_ERROR
"\nPlease run the following command first:\ngit submodule update --init\n"
)
endif()

# ----------------------------------------------------
# --- OPTIONS ---------------------------------------
# Need to be set before including base.cmake
Expand All @@ -42,19 +65,18 @@ option(INSTALL_DOCUMENTATION "Install the documentation" OFF)
set(DOXYGEN_USE_MATHJAX YES)
set(DOXYGEN_USE_TEMPLATE_CSS YES)

include(${CMAKE_CURRENT_LIST_DIR}/cmake-module/base.cmake)
include(${JRL_CMAKE_MODULES}/base.cmake)
compute_project_args(PROJECT_ARGS LANGUAGES CXX)
project(${PROJECT_NAME} ${PROJECT_ARGS})

include(${CMAKE_CURRENT_LIST_DIR}/cmake-module/ide.cmake)
include(${CMAKE_CURRENT_LIST_DIR}/cmake-module/apple.cmake)
include(${JRL_CMAKE_MODULES}/ide.cmake)
include(${JRL_CMAKE_MODULES}/apple.cmake)

if(NOT ${CMAKE_VERSION} VERSION_GREATER "3.26.0" OR WIN32)
set(CMAKE_MODULE_PATH
${CMAKE_CURRENT_LIST_DIR}/cmake-module/find-external/OpenMP
${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH ${JRL_CMAKE_MODULES}/find-external/OpenMP
${CMAKE_MODULE_PATH})
endif()
include(${CMAKE_CURRENT_LIST_DIR}/cmake-module/julia.cmake)
include(${JRL_CMAKE_MODULES}/julia.cmake)
include(CMakeDependentOption)

# If needed, set CMake policy for APPLE systems
Expand Down Expand Up @@ -85,9 +107,8 @@ if(BUILD_WITH_OPENMP_SUPPORT)
separate_arguments(OpenMP_CXX_FLAGS UNIX_COMMAND "${OpenMP_CXX_FLAGS}")
endif(BUILD_WITH_OPENMP_SUPPORT)

set(CMAKE_MODULE_PATH
"${CMAKE_CURRENT_LIST_DIR}/cmake-module/find-external/Julia"
${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH "${JRL_CMAKE_MODULES}/find-external/Julia"
${CMAKE_MODULE_PATH})
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake-external"
${CMAKE_MODULE_PATH})

Expand Down Expand Up @@ -163,13 +184,16 @@ endif()

if(BUILD_TESTING OR BUILD_PYTHON_INTERFACE)
# Download cereal for pything bindings and unittests
set(cereal_dir ${PROJECT_SOURCE_DIR}/external/cereal)
set(cereal ${cereal_dir}/README.md)
find_package(Git REQUIRED)
if(NOT EXISTS ${cereal})
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init ${cereal_dir}
WORKING_DIRECTORY ${cereal_dir} COMMAND_ERROR_IS_FATAL ANY)
find_package(cereal QUIET CONFIG)
if(NOT cereal_FOUND)
set(cereal_dir ${PROJECT_SOURCE_DIR}/external/cereal)
set(cereal ${cereal_dir}/README.md)
find_package(Git REQUIRED)
if(NOT EXISTS ${cereal})
execute_process(
COMMAND ${GIT_EXECUTABLE} submodule update --init ${cereal_dir}
WORKING_DIRECTORY ${cereal_dir} COMMAND_ERROR_IS_FATAL ANY)
endif()
endif()
endif()

Expand Down
13 changes: 9 additions & 4 deletions bindings/python/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ if(UNIX)
set(PYTHON_COMPONENTS Development.Module)
endif()

include(../../cmake-module/python.cmake)
include(../../cmake-module/python-helpers.cmake)
include(${JRL_CMAKE_MODULES}/python.cmake)
include(${JRL_CMAKE_MODULES}/python-helpers.cmake)

findpython(REQUIRED Development.Module)

Expand Down Expand Up @@ -91,8 +91,13 @@ function(CREATE_PYTHON_TARGET target_name COMPILE_OPTIONS dependencies)
list_filter("${PYWRAP_HEADERS}" "expose-parallel" PYWRAP_HEADERS)
endif(BUILD_WITH_OPENMP_SUPPORT)

target_include_directories(
${target_name} SYSTEM PRIVATE ${PROJECT_SOURCE_DIR}/external/cereal/include)
if(cereal_FOUND)
target_link_libraries(${target_name} SYSTEM PRIVATE cereal)
else()
target_include_directories(
${target_name} SYSTEM
PRIVATE ${PROJECT_SOURCE_DIR}/external/cereal/include)
endif()
set_target_properties(
${target_name}
PROPERTIES OUTPUT_NAME ${target_name}
Expand Down
9 changes: 0 additions & 9 deletions doc/rankupdate/rankupdate.aux

This file was deleted.

68 changes: 0 additions & 68 deletions doc/rankupdate/rankupdate.fdb_latexmk

This file was deleted.

Loading