-
Notifications
You must be signed in to change notification settings - Fork 14
/
CMakeLists.txt
executable file
·110 lines (104 loc) · 3.83 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# NB: For now, we use the bioformats_package.jar bundle, because it is convenient,
# and provides support for all supported file formats, including those
# provided by the GPLed Bio-Formats library. ITK communicates with Java via
# pipes, which is generally accepted as "indirect" enough to avoid legal
# complications with linking to GPLed code.
#
# However, in the future, if this is deemed unacceptable, we need only
# change the list of JARs below to include only BSD-licensed SCIFIO JARs
# (including all their dependencies, of course). The downside is that
# Bio-Formats-specific file formats, including all proprietary microscopy
# formats, will no longer work "out of the box" -- the user will instead
# need to manually add the GPLed Bio-Formats JARs into the mix first.
#
# JRE is not downloaded for OS X. The cleanest way to have a JRE installed
# is to let the OS X take care of it. Once the tests are run or if you call
# scifio-imageio in your code, the OS will :
# - ask you to install JAVA through the system update on OS 10.7 and 10.8
# - ask you to download JAVA from Java's website and install it by yourself
# for OS 10.9.
#
set( SCIFIOJars
http://downloads.openmicroscopy.org/bio-formats/5.0.4/artifacts/bioformats_package.jar
http://maven.imagej.net/service/local/repositories/releases/content/io/scif/scifio-itk-bridge/1.2.0/scifio-itk-bridge-1.2.0.jar
)
set( SCIFIOJarNames
bioformats_package.jar
scifio-itk-bridge.jar
)
set( jarsDownloadDirectory jars )
set( JAR_BUILD_TREE_LOCATION
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${jarsDownloadDirectory}/
)
set( JAR_INSTALL_TREE_LOCATION
${CMAKE_INSTALL_PREFIX}/${SCIFIO_INSTALL_LIBRARY_DIR}/${jarsDownloadDirectory}
)
# Java Runtime Environment
set( jreTarballDownloadDirectory "${CMAKE_CURRENT_BINARY_DIR}" )
set( JRE_BUILD_TREE_LOCATION
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/jre
)
set( JRE_INSTALL_TREE_LOCATION
${CMAKE_INSTALL_PREFIX}/${SCIFIO_INSTALL_LIBRARY_DIR}/jre
)
set( jreTarballMD5 "" )
if( WIN32 )
if( "${CMAKE_SIZEOF_VOID_P}" EQUAL 8 )
# win64
set( jreTarballMD5 "5be3a27fc46997785ee70e0e0f140135" )
else()
# win32
set( jreTarballMD5 "a0f445bbe2f44e52a56f99e0e9d33c1a" )
endif()
elseif( "${CMAKE_SYSTEM_NAME}" MATCHES "Linux" )
if( "${CMAKE_SIZEOF_VOID_P}" EQUAL 8 )
# linux-amd64
set( jreTarballMD5 "4c75412942f7d36c5e8b8fb38ba975bc" )
else()
# linux
set( jreTarballMD5 "777bd36ea81ca1b732ef8115a347fd66" )
endif()
endif()
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/itkSCIFIOImageIO.cxx.in
${CMAKE_CURRENT_BINARY_DIR}/itkSCIFIOImageIO.cxx
)
set(SCIFIO_SRC
itkSCIFIOImageIOFactory.cxx
${CMAKE_CURRENT_BINARY_DIR}/itkSCIFIOImageIO.cxx
)
add_library(SCIFIO ${SCIFIO_SRC})
target_link_libraries(SCIFIO ${ITKIOImageBase_LIBRARIES})
itk_module_target(SCIFIO)
# Download the SCIFIO Java libraries.
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/DownloadSCIFIO.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/DownloadSCIFIO.cmake
@ONLY
)
add_custom_command(TARGET SCIFIO
POST_BUILD
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/DownloadSCIFIO.cmake
WORKING_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
COMMENT "Downloading SCIFIO libraries..."
)
install( DIRECTORY ${JAR_BUILD_TREE_LOCATION}
DESTINATION ${JAR_INSTALL_TREE_LOCATION}
COMPONENT RuntimeLibraries
FILES_MATCHING PATTERN "*.jar"
)
# Download JRE except for OS X
IF (NOT APPLE)
configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/DownloadJRE.cmake.in
${CMAKE_CURRENT_BINARY_DIR}/DownloadJRE.cmake
@ONLY
)
add_custom_command(TARGET SCIFIO
POST_BUILD
COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/DownloadJRE.cmake
WORKING_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}
COMMENT "Downloading JRE libraries..."
)
install( DIRECTORY ${JRE_BUILD_TREE_LOCATION}
DESTINATION ${JRE_INSTALL_TREE_LOCATION}
COMPONENT RuntimeLibraries
)
endif()