-
Notifications
You must be signed in to change notification settings - Fork 228
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update CMakeLists to use SuperBuild.
Better support to build with external library, such as OpenJPEG and yaml-cpp.
- Loading branch information
Showing
7 changed files
with
865 additions
and
757 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 |
---|---|---|
@@ -1,42 +1,9 @@ | ||
project(dcm2niix) | ||
cmake_minimum_required(VERSION 2.8) | ||
|
||
include(ucm.cmake) | ||
cmake_minimum_required(VERSION 2.8.11) | ||
|
||
# Option1: Choose whether to build the batch version | ||
option(BATCH_VERSION "Build dcm2niibatch for multiple conversions as well" OFF) | ||
message(${BATCH_VERSION}) | ||
|
||
# Option2: Choose whether to use static runtime | ||
option(USE_STATIC_RUNTIME "Use static runtime" ON) | ||
if(USE_STATIC_RUNTIME) | ||
ucm_set_runtime(STATIC) | ||
else() | ||
ucm_set_runtime(DYNAMIC) | ||
if(COMMAND CMAKE_POLICY) | ||
CMAKE_POLICY(SET CMP0003 NEW) | ||
endif() | ||
|
||
# Option3: Choose build type | ||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING | ||
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) | ||
|
||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin") | ||
|
||
# | ||
# Zlib | ||
# | ||
#find_package(ZLIB) | ||
|
||
# Predefined permission set to enforce proper permissions | ||
# during install even if files in the sources have different | ||
# settings | ||
set(FILE_PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ) | ||
|
||
## | ||
## Sub-projects | ||
## | ||
add_subdirectory(console) | ||
project(dcm2niix) | ||
|
||
option(BUILD_DOCS "Build documentation (manpages)" OFF) | ||
if (BUILD_DOCS) | ||
add_subdirectory(docs) | ||
endif () | ||
include(${CMAKE_SOURCE_DIR}/SuperBuild/SuperBuild.cmake) |
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,15 @@ | ||
set(OPENJPEG_TAG 151e322) # version openjepg-2.1 | ||
|
||
ExternalProject_Add(openjpeg | ||
GIT_REPOSITORY "${git_protocol}://github.com/ningfei/openjpeg.git" | ||
GIT_TAG "${OPENJPEG_TAG}" | ||
SOURCE_DIR openjpeg | ||
BINARY_DIR openjpeg-build | ||
CMAKE_ARGS | ||
-Wno-dev | ||
--no-warn-unused-cli | ||
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} | ||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} | ||
) | ||
|
||
set(OPENJPEG_DIR ${CMAKE_BINARY_DIR}/lib/openjpeg-2.1) |
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,15 @@ | ||
set(YAML-CPP_TAG 5c3cb09) # version yaml-cpp-0.5.3 | ||
|
||
ExternalProject_Add(yaml-cpp | ||
GIT_REPOSITORY "${git_protocol}://github.com/ningfei/yaml-cpp.git" | ||
GIT_TAG "${YAML-CPP_TAG}" | ||
SOURCE_DIR yaml-cpp | ||
BINARY_DIR yaml-cpp-build | ||
CMAKE_ARGS | ||
-Wno-dev | ||
--no-warn-unused-cli | ||
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} | ||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR} | ||
) | ||
|
||
set(YAML-CPP_DIR ${CMAKE_BINARY_DIR}/lib/cmake/yaml-cpp) |
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,95 @@ | ||
# Check if git exists | ||
find_package(Git) | ||
if(NOT GIT_FOUND) | ||
message(ERROR "Cannot find git. git is required for Superbuild") | ||
endif() | ||
|
||
# Use git protocol or not | ||
option(USE_GIT_PROTOCOL "If behind a firewall turn this off to use http instead." ON) | ||
if(USE_GIT_PROTOCOL) | ||
set(git_protocol "git") | ||
else() | ||
set(git_protocol "https") | ||
endif() | ||
|
||
# Basic CMake build settings | ||
set(CMAKE_BUILD_TYPE "Release" CACHE STRING | ||
"Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE) | ||
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) | ||
|
||
option(USE_STATIC_RUNTIME "Use static runtime" ON) | ||
|
||
option(USE_SYSTEM_ZLIB "Use the system zlib" OFF) | ||
option(USE_SYSTEM_TURBOJPEG "Use the system TurboJPEG" OFF) | ||
option(USE_JASPER "Compile with Jasper support" OFF) | ||
|
||
option(USE_OPENJPEG "Build with OpenJPEG support" OFF) | ||
option(BATCH_VERSION "Build dcm2niibatch for multiple conversions" OFF) | ||
|
||
include(ExternalProject) | ||
|
||
set(DEPENDENCIES) | ||
|
||
if(USE_OPENJPEG) | ||
message("-- Build with OpenJPEG: ${USE_OPENJPEG}") | ||
|
||
find_package(PkgConfig) | ||
if(PKG_CONFIG_FOUND) | ||
pkg_check_modules(OPENJPEG libopenjp2) | ||
endif() | ||
|
||
if(OPENJPEG_FOUND) | ||
set(OPENJPEG_DIR ${OPENJPEG_LIBDIR}/openjepg-2.1) | ||
message("-- Using the system OpenJPEG") | ||
else() | ||
include(${CMAKE_SOURCE_DIR}/SuperBuild/External-OPENJPEG.cmake) | ||
list(APPEND DEPENDENCIES openjpeg) | ||
message("-- Will build OpenJPEG from github") | ||
endif() | ||
endif() | ||
|
||
if(BATCH_VERSION) | ||
message("-- Build dcm2niibatch: ${BATCH_VERSION}") | ||
|
||
find_package(PkgConfig) | ||
if(PKG_CONFIG_FOUND) | ||
pkg_check_modules(YAML-CPP yaml-cpp) | ||
endif() | ||
|
||
if(YAML-CPP_FOUND) | ||
set(YAML-CPP_DIR ${YAML-CPP_LIBDIR}/cmake/yaml-cpp) | ||
message("-- Using the system yaml-cpp") | ||
else() | ||
include(${CMAKE_SOURCE_DIR}/SuperBuild/External-YAML-CPP.cmake) | ||
list(APPEND DEPENDENCIES yaml-cpp) | ||
message("-- Will build yaml-cpp from github") | ||
endif() | ||
endif() | ||
|
||
ExternalProject_Add(console | ||
DEPENDS ${DEPENDENCIES} | ||
DOWNLOAD_COMMAND "" | ||
SOURCE_DIR ${CMAKE_SOURCE_DIR}/console | ||
BINARY_DIR console-build | ||
CMAKE_ARGS | ||
-Wno-dev | ||
--no-warn-unused-cli | ||
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE} | ||
-DUSE_STATIC_RUNTIME:BOOL=${USE_STATIC_RUNTIME} | ||
-DUSE_SYSTEM_ZLIB:BOOL=${USE_SYSTEM_ZLIB} | ||
-DUSE_SYSTEM_TURBOJPEG:BOOL=${USE_SYSTEM_TURBOJPEG} | ||
-DUSE_SYSTEM_JASPER:BOOL=${USE_SYSTEM_JASPER} | ||
# OpenJPEG | ||
-DUSE_OPENJPEG:BOOL=${USE_OPENJPEG} | ||
-DOpenJPEG_DIR:PATH=${OPENJPEG_DIR} | ||
# yaml-cpp | ||
-DBATCH_VERSION:BOOL=${BATCH_VERSION} | ||
-DYAML-CPP_DIR:PATH=${YAML-CPP_DIR} | ||
-DCMAKE_INSTALL_PREFIX=${CMAKE_BINARY_DIR}/bin | ||
) | ||
|
||
option(BUILD_DOCS "Build documentation (manpages)" OFF) | ||
if(BUILD_DOCS) | ||
add_subdirectory(docs) | ||
endif() | ||
|
Oops, something went wrong.