-
Notifications
You must be signed in to change notification settings - Fork 180
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Provide option to specify local dependencies folder
- Developers can now specify an optional local folder containing that points to the sources of eigen, json for modern c++ and half. This can be useful in offline environments without network access. - Dependency handling code is moved into a separate CMake module. - Half is directly fetched from sourceforge.net - FetchContent now downloads source repos in PROJECT_SOURCE_DIR/_deps to avoid downloading repos again for separate build directories.
- Loading branch information
Showing
6 changed files
with
83 additions
and
4,887 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,4 @@ build/ | |
CMakeLists.txt.user | ||
testing/data/tmp* | ||
testing/data/*-tmp-* | ||
_deps/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
include(FetchContent) | ||
|
||
set(FETCHCONTENT_BASE_DIR ${PROJECT_SOURCE_DIR}/_deps) | ||
|
||
message(STATUS "${MRTRIX_DEPENDENCIES_DIR}") | ||
if(NOT ${MRTRIX_DEPENDENCIES_DIR} STREQUAL "") | ||
message(STATUS "Using local dependencies at ${MRTRIX_DEPENDENCIES_DIR}") | ||
set(MRTRIX_LOCAL_DEPENDENCIES ON) | ||
else() | ||
set(MRTRIX_LOCAL_DEPENDENCIES OFF) | ||
endif() | ||
|
||
# Eigen | ||
if(MRTRIX_LOCAL_DEPENDENCIES) | ||
FetchContent_Declare( | ||
eigen3 | ||
SOURCE_DIR ${MRTRIX_DEPENDENCIES_DIR}/eigen | ||
UPDATE_DISCONNECTED ON | ||
) | ||
else() | ||
FetchContent_Declare( | ||
eigen3 | ||
GIT_REPOSITORY https://gitlab.com/libeigen/eigen.git | ||
GIT_TAG 3.4.0 | ||
PATCH_COMMAND git apply --ignore-space-change --ignore-whitespace ${PROJECT_SOURCE_DIR}/thirdparty/eigen.patch | ||
UPDATE_DISCONNECTED ON | ||
) | ||
endif() | ||
FetchContent_MakeAvailable(eigen3) | ||
|
||
|
||
# Json for Modern C++ | ||
if(MRTRIX_LOCAL_DEPENDENCIES) | ||
FetchContent_Declare( | ||
json | ||
SOURCE_DIR ${MRTRIX_DEPENDENCIES_DIR}/json | ||
UPDATE_DISCONNECTED ON | ||
) | ||
else() | ||
FetchContent_Declare(json | ||
DOWNLOAD_EXTRACT_TIMESTAMP ON | ||
URL https://github.com/nlohmann/json/releases/download/v3.11.3/json.tar.xz | ||
) | ||
endif() | ||
FetchContent_MakeAvailable(json) | ||
|
||
|
||
# Half-precision floating-point library | ||
if(MRTRIX_LOCAL_DEPENDENCIES) | ||
FetchContent_Declare( | ||
half | ||
SOURCE_DIR ${MRTRIX_DEPENDENCIES_DIR}/half | ||
UPDATE_DISCONNECTED ON | ||
) | ||
else() | ||
FetchContent_Declare( | ||
half | ||
DOWNLOAD_EXTRACT_TIMESTAMP ON | ||
URL "https://sourceforge.net/projects/half/files/half/2.1.0/half-2.1.0.zip/download" | ||
) | ||
endif() | ||
|
||
FetchContent_MakeAvailable(half) | ||
|
||
add_library(half INTERFACE) | ||
add_library(half::half ALIAS half) | ||
target_include_directories(half INTERFACE "${half_SOURCE_DIR}/include") | ||
|
||
|
||
# Nifti headers | ||
add_library(nifti INTERFACE) | ||
add_library(nifti::nifti ALIAS nifti) | ||
target_include_directories(nifti INTERFACE "${PROJECT_SOURCE_DIR}/thirdparty/nifti") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.