Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COMP: Add JPEG & TIFF BUILDS, pass to DCMTK build #1

Closed
wants to merge 1 commit into from
Closed
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
2 changes: 0 additions & 2 deletions DWIConvert/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ project (DWIConvert)
#-----------------------------------------------------------------------------
enable_testing()

find_package(ITK 4 REQUIRED)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR} ${CMAKE_MODULE_PATH})

set(DWIConvertSupportLib_SRCS
Expand Down
12 changes: 12 additions & 0 deletions SuperBuild/EP_Autoconf_Utils.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#
# Building external projects via ExternalProject requires passing along some important CMkae variables into the autoconf configuration.
get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE)
if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED)
return()
endif()
set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1)

macro(AutoConf_FLAGS varname lang additional_flags)
string(TOUPPER CONF ${CMAKE_BUILD_TYPE})
set(${varname} "${CMAKE_${lang}_FLAGS} ${CMAKE_${lang}_FLAGS_${CONF}} ${additional_flags}")
endmacro()
20 changes: 14 additions & 6 deletions SuperBuild/External_DCMTK.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR})
endif()

# Set dependency list
set(${proj}_DEPENDENCIES "")
set(${proj}_DEPENDENCIES TIFF)

# Include dependent projects if any
SlicerMacroCheckExternalProjectDependency(${proj})
Expand All @@ -57,19 +57,27 @@ if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}
### --- Project specific additions here
set(${proj}_CMAKE_OPTIONS
-DDCMTK_WITH_DOXYGEN:BOOL=OFF
-DDCMTK_WITH_ZLIB:BOOL=OFF # see CTK github issue #25
-DDCMTK_WITH_ZLIB:BOOL=ON # see CTK github issue #25
-DDCMTK_WITH_OPENSSL:BOOL=OFF # see CTK github issue #25
-DDCMTK_WITH_PNG:BOOL=OFF # see CTK github issue #25
-DDCMTK_WITH_TIFF:BOOL=OFF # see CTK github issue #25
-DDCMTK_WITH_TIFF:BOOL=ON # see CTK github issue #25
-DDCMTK_WITH_XML:BOOL=OFF # see CTK github issue #25
-DDCMTK_WITH_ICONV:BOOL=OFF # see CTK github issue #178
-DDCMTK_FORCE_FPIC_ON_UNIX:BOOL=ON
-DDCMTK_OVERWRITE_WIN32_COMPILER_FLAGS:BOOL=OFF
-DDCMTK_WITH_WRAP:BOOL=OFF # CTK does not build on Mac with this option turned ON due to library dependencies missing
# -DTIFF_DIR:PATH=${TIFF_DIR}
-DTIFF_LIBRARY:FILEPATH=${TIFF_LIBRARY}
-DTIFF_INCLUDE_DIR:PATH=${TIFF_INCLUDE_DIR}
-DJPEG_LIBRARY:FILEPATH=${JPEG_LIBRARY}
-DJPEG_INCLUDE_DIR:PATH=${JPEG_INCLUDE_DIR}
)
### --- End Project specific additions
set(${proj}_REPOSITORY ${git_protocol}://github.com/commontk/DCMTK.git)
set(${proj}_GIT_TAG "d06e2b7d9bafb23df4e969482a68b50fc75aaaa9")
# set(${proj}_REPOSITORY ${git_protocol}://github.com/commontk/DCMTK.git)
# set(${proj}_GIT_TAG "d06e2b7d9bafb23df4e969482a68b50fc75aaaa9")
set(${proj}_REPOSITORY https://github.com/InsightSoftwareConsortium/DCMTK.git)
set(${proj}_GIT_TAG AddProperConfig)

ExternalProject_Add(${proj}
GIT_REPOSITORY ${${proj}_REPOSITORY}
GIT_TAG ${${proj}_GIT_TAG}
Expand All @@ -93,7 +101,7 @@ if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}
DEPENDS
${${proj}_DEPENDENCIES}
)
set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-install)
set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-install/lib/cmake/dcmtk)
else()
if(${USE_SYSTEM_${extProjName}})
find_package(${extProjName} REQUIRED)
Expand Down
4 changes: 2 additions & 2 deletions SuperBuild/External_DoubleConvert.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}
)
### --- End Project specific additions
set(${proj}_REPOSITORY ${git_protocol}://github.com/BRAINSia/double-conversion.git)
set(${proj}_GIT_TAG 9014759697ed334753a8334e09ec8c01f9c53830)
set(${proj}_GIT_TAG e5e143791e4815ac19b10570e010d83d55c2c25b)
ExternalProject_Add(${proj}
GIT_REPOSITORY ${${proj}_REPOSITORY}
GIT_TAG ${${proj}_GIT_TAG}
Expand All @@ -81,7 +81,7 @@ if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}
DEPENDS
${${proj}_DEPENDENCIES}
)
set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-install/lib/cmake/ITK-4.4)
set(${extProjName}_DIR ${CMAKE_BINARY_DIR}/${proj}-install/lib/cmake/double-conversion)
else()
if(${USE_SYSTEM_${extProjName}})
find_package(${extProjName} ${ITK_VERSION_MAJOR} REQUIRED)
Expand Down
22 changes: 19 additions & 3 deletions SuperBuild/External_ITKv4.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ endif()
# Set dependency list
set(${proj}_DEPENDENCIES "")
if(${PROJECT_NAME}_BUILD_DICOM_SUPPORT)
list(APPEND ${proj}_DEPENDENCIES DCMTK)
list(APPEND ${proj}_DEPENDENCIES DCMTK JPEG TIFF)
endif()

# Include dependent projects if any
Expand All @@ -57,6 +57,7 @@ if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}
set(${proj}_DCMTK_ARGS
-DITK_USE_SYSTEM_DCMTK:BOOL=ON
-DDCMTK_DIR:PATH=${DCMTK_DIR}
-DModule_ITKDCMTK:BOOL=ON
-DModule_ITKIODCMTK:BOOL=ON
)
endif()
Expand Down Expand Up @@ -104,6 +105,8 @@ if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}
set(git_protocol "git")
endif()

find_package(ZLIB REQUIRED)

set(${proj}_CMAKE_OPTIONS
-DBUILD_TESTING:BOOL=OFF
-DBUILD_EXAMPLES:BOOL=OFF
Expand All @@ -117,14 +120,27 @@ if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}
-DKWSYS_USE_MD5:BOOL=ON # Required by SlicerExecutionModel
-DITK_WRAPPING:BOOL=OFF #${BUILD_SHARED_LIBS} ## HACK: QUICK CHANGE
-DITK_USE_SYSTEM_DCMTK:BOOL=${${PROJECT_NAME}_BUILD_DICOM_SUPPORT}

-DITK_USE_SYSTEM_TIFF:BOOL=ON
-DTIFF_LIBRARY:FILEPATH=${TIFF_LIBRARY}
-DTIFF_INCLUDE_DIR:PATH=${TIFF_INCLUDE_DIR}

-DITK_USE_SYSTEM_JPEG:BOOL=ON
-DJPEG_LIBRARY:FILEPATH=${JPEG_LIBRARY}
-DJPEG_INCLUDE_DIR:PATH=${JPEG_INCLUDE_DIR}

-DITK_USE_SYSTEM_ZLIB:BOOL=ON
-DZLIB_INCLUDE_DIRS:STRING=${ZLIB_INCLUDE_DIRS}
-DZLIB_LIBRARIES:STRING=${ZLIB_LIBRARIES}
${${proj}_DCMTK_ARGS}
${${proj}_WRAP_ARGS}
${${proj}_FFTWF_ARGS}
${${proj}_FFTWD_ARGS}
)
### --- End Project specific additions
set(${proj}_REPOSITORY ${git_protocol}://itk.org/ITK.git)
set(${proj}_GIT_TAG 7533cafcee0ad15c1b0b3e492e3a5aacc37b4258) #2013-03-01 Provide const correct API

set(${proj}_REPOSITORY https://github.com/Chaircrusher/ITK.git)
set(${proj}_GIT_TAG DCMTK_NO_MODULE)
ExternalProject_Add(${proj}
GIT_REPOSITORY ${${proj}_REPOSITORY}
GIT_TAG ${${proj}_GIT_TAG}
Expand Down
94 changes: 94 additions & 0 deletions SuperBuild/External_JPEG.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# Make sure this file is included only once by creating globally unique varibles
# based on the name of this included file.
get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE)
if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED)
return()
endif()
set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1)

include(${CMAKE_CURRENT_LIST_DIR}/EP_Autoconf_Utils.cmake)

## External_${extProjName}.cmake files can be recurisvely included,
## and cmake variables are global, so when including sub projects it
## is important make the extProjName and proj variables
## appear to stay constant in one of these files.
## Store global variables before overwriting (then restore at end of this file.)
ProjectDependancyPush(CACHED_extProjName ${extProjName})
ProjectDependancyPush(CACHED_proj ${proj})

# Make sure that the ExtProjName/IntProjName variables are unique globally
# even if other External_${ExtProjName}.cmake files are sourced by
# SlicerMacroCheckExternalProjectDependency
set(extProjName JPEG) #The find_package known name
set(proj JPEG) #This local name
set(${extProjName}_REQUIRED_VERSION "") #If a required version is necessary, then set this, else leave blank

#if(${USE_SYSTEM_${extProjName}})
# unset(${extProjName}_DIR CACHE)
#endif()

# Sanity checks
if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR})
message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})")
endif()

# Set dependency list
set(${proj}_DEPENDENCIES "")

# Include dependent projects if any
SlicerMacroCheckExternalProjectDependency(${proj})

if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) )


set(${proj}_URL
"http://www.infai.org/jpeg/files?get=jpegsrc.v09a.tar.gz")
set(${proj}_MD5 "546c94c044a3f546927c955e31316dd5")

AutoConf_FLAGS(${proj}_CFLAGS C "")
AutoConf_FLAGS(${proj}_CXXFLAGS CXX "")

ExternalProject_Add(${proj}
URL ${${proj}_URL}
URL_MD5 ${${proj}_MD5}
SOURCE_DIR ${proj}
BINARY_DIR ${proj}-build
INSTALL_DIR ${proj}-install
${cmakeversion_external_update} "${cmakeversion_external_update_value}"
CMAKE_GENERATOR ${gen}
CONFIGURE_COMMAND <SOURCE_DIR>/configure --prefix=<INSTALL_DIR>
--enable-shared=No
--enable-static=Yes
CC=${CMAKE_C_COMPILER}
CXX=${CMAKE_CXX_COMPILER}
"CFLAGS=${${proj}_CFLAGS}"
"CXXFLAGS=${${proj}_CXXFLAGS}"
DEPENDS
${${proj}_DEPENDENCIES}
)
set(${extProjName}_DIR
${CMAKE_BINARY_DIR}/${proj}-install)
set(${extProjName}_INCLUDE_DIR
${CMAKE_BINARY_DIR}/${proj}-install/include)
set(${extProjName}_LIB_DIR
${CMAKE_BINARY_DIR}/${proj}-install/lib)
set(${extProjName}_LIBRARY
${${extProjName}_LIB_DIR}/libjpeg.a)

else()
if(${USE_SYSTEM_${extProjName}})
find_package(${extProjName} ${${extProjName}_REQUIRED_VERSION} REQUIRED)
if(NOT ${extProjName}_DIR)
message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR")
endif()
message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}")
endif()
# The project is provided using ${extProjName}_DIR, nevertheless since other
# project may depend on ${extProjName}, let's add an 'empty' one
SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}")
endif()

list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH)

ProjectDependancyPop(CACHED_extProjName extProjName)
ProjectDependancyPop(CACHED_proj proj)
107 changes: 107 additions & 0 deletions SuperBuild/External_OpenJPEG.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
# Make sure this file is included only once by creating globally unique varibles
# based on the name of this included file.
get_filename_component(CMAKE_CURRENT_LIST_FILENAME ${CMAKE_CURRENT_LIST_FILE} NAME_WE)
if(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED)
return()
endif()
set(${CMAKE_CURRENT_LIST_FILENAME}_FILE_INCLUDED 1)

## External_${extProjName}.cmake files can be recurisvely included,
## and cmake variables are global, so when including sub projects it
## is important make the extProjName and proj variables
## appear to stay constant in one of these files.
## Store global variables before overwriting (then restore at end of this file.)
ProjectDependancyPush(CACHED_extProjName ${extProjName})
ProjectDependancyPush(CACHED_proj ${proj})

# Make sure that the ExtProjName/IntProjName variables are unique globally
# even if other External_${ExtProjName}.cmake files are sourced by
# SlicerMacroCheckExternalProjectDependency
set(extProjName OpenJPEG) #The find_package known name
set(proj OpenJPEG) #This local name
set(${extProjName}_REQUIRED_VERSION "") #If a required version is necessary, then set this, else leave blank

#if(${USE_SYSTEM_${extProjName}})
# unset(${extProjName}_DIR CACHE)
#endif()

# Sanity checks
if(DEFINED ${extProjName}_DIR AND NOT EXISTS ${${extProjName}_DIR})
message(FATAL_ERROR "${extProjName}_DIR variable is defined but corresponds to non-existing directory (${${extProjName}_DIR})")
endif()

# Set dependency list
set(${proj}_DEPENDENCIES "")

# Include dependent projects if any
SlicerMacroCheckExternalProjectDependency(${proj})

if(NOT ( DEFINED "${extProjName}_DIR" OR ( DEFINED "${USE_SYSTEM_${extProjName}}" AND NOT "${USE_SYSTEM_${extProjName}}" ) ) )
#message(STATUS "${__indent}Adding project ${proj}")

# Set CMake OSX variable to pass down the external project
set(CMAKE_OSX_EXTERNAL_PROJECT_ARGS)
if(APPLE)
list(APPEND CMAKE_OSX_EXTERNAL_PROJECT_ARGS
-DCMAKE_OSX_ARCHITECTURES=${CMAKE_OSX_ARCHITECTURES}
-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT}
-DCMAKE_OSX_DEPLOYMENT_TARGET=${CMAKE_OSX_DEPLOYMENT_TARGET})
endif()

### --- Project specific additions here
set(${proj}_CMAKE_OPTIONS
-DCMAKE_INSTALL_PREFIX:PATH=${CMAKE_CURRENT_BINARY_DIR}/${proj}-install
-DBUILD_EXAMPLES:BOOL=OFF
-DBUILD_TESTING:BOOL=OFF
)

### --- End Project specific additions
if(NOT DEFINED git_protocol)
set(git_protocol "git")
endif()

set(${proj}_REPOSITORY "http://openjpeg.googlecode.com/svn/trunk")
set(${proj}_SVN_REVISION 2292) #2013-01-30 New Repository.
ExternalProject_Add(${proj}
SVN_REPOSITORY ${${proj}_REPOSITORY}
SVN_REVISION -r ${${proj}_SVN_REVISION}
SOURCE_DIR ${proj}
BINARY_DIR ${proj}-build
${cmakeversion_external_update} "${cmakeversion_external_update_value}"
CMAKE_GENERATOR ${gen}
CMAKE_ARGS
-Wno-dev
--no-warn-unused-cli
${CMAKE_OSX_EXTERNAL_PROJECT_ARGS}
${COMMON_EXTERNAL_PROJECT_ARGS}
${${proj}_CMAKE_OPTIONS}
## We really do want to install in order to limit # of include paths INSTALL_COMMAND ""
DEPENDS
${${proj}_DEPENDENCIES}
)
set(${extProjName}_DIR
${CMAKE_BINARY_DIR}/${proj}-install/openjpeg-2.0)
set(${extProjName}_INCLUDE_DIR
${CMAKE_BINARY_DIR}/${proj}-install/include/openjpeg-2.0)
set(${extProjName}_LIB_DIR
${CMAKE_BINARY_DIR}/${proj}-install/lib)
set(${extProjName}_LIBRARY
${${extProjName}_LIB_DIR}/libopenjp2.a)

else()
if(${USE_SYSTEM_${extProjName}})
find_package(${extProjName} ${${extProjName}_REQUIRED_VERSION} REQUIRED)
if(NOT ${extProjName}_DIR)
message(FATAL_ERROR "To use the system ${extProjName}, set ${extProjName}_DIR")
endif()
message("USING the system ${extProjName}, set ${extProjName}_DIR=${${extProjName}_DIR}")
endif()
# The project is provided using ${extProjName}_DIR, nevertheless since other
# project may depend on ${extProjName}, let's add an 'empty' one
SlicerMacroEmptyExternalProject(${proj} "${${proj}_DEPENDENCIES}")
endif()

list(APPEND ${CMAKE_PROJECT_NAME}_SUPERBUILD_EP_VARS ${extProjName}_DIR:PATH)

ProjectDependancyPop(CACHED_extProjName extProjName)
ProjectDependancyPop(CACHED_proj proj)
Loading