source: branches/4.0.0/components/native/itk-plugin/CMakeLists.txt @ 4879

Revision 4879, 5.2 KB checked in by melissa, 11 years ago (diff)

Synced 4.0.0 branch to r4878 (including r4804).

Line 
1#
2# CMakeLists.txt
3#
4
5# OME Bio-Formats package for reading and converting biological file formats.
6# Copyright (C) 2005-@year@ UW-Madison LOCI and Glencoe Software, Inc.
7#
8# This program is free software; you can redistribute it and/or modify
9# it under the terms of the GNU General Public License as published by
10# the Free Software Foundation; either version 3 of the License, or
11# (at your option) any later version.
12#
13# This program is distributed in the hope that it will be useful,
14# but WITHOUT ANY WARRANTY; without even the implied warranty of
15# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16# GNU General Public License for more details.
17#
18# You should have received a copy of the GNU General Public License
19# along with this program; if not, write to the Free Software
20# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
21
22# Adapted from the Slicer3 project: http://www.slicer.org/
23# http://viewvc.slicer.org/viewcvs.cgi/trunk/Libs/MGHImageIO/
24#
25# See slicer-license.txt for Slicer3's licensing information.
26#
27# For more information about the ITK Plugin IO mechanism, see:
28# http://www.itk.org/Wiki/Plugin_IO_mechanisms
29
30project(BioFormatsImageIO)
31
32cmake_minimum_required(VERSION 2.4)
33if(COMMAND cmake_policy)
34 cmake_policy(SET CMP0003 NEW)
35endif(COMMAND cmake_policy)
36
37find_package(ITK REQUIRED)
38include(${ITK_USE_FILE})
39
40if(NOT DEFINED BUILD_SHARED_LIBS)
41 option(BUILD_SHARED_LIBS "Build with shared libraries." ON)
42endif(NOT DEFINED BUILD_SHARED_LIBS)
43
44# --------------------------------------------------------------------------
45# Include dirs
46
47set(JACE_DIR NOTFOUND CACHE PATH "The path to toplevel directory of your Jace checkout")
48if(NOT JACE_DIR)
49 message(FATAL_ERROR "Please set JACE_DIR to the toplevel directory of your Jace checkout")
50endif()
51
52set(BF_JACE_DIR ${PROJECT_SOURCE_DIR}/../bf-cpp)
53
54find_package(JNI REQUIRED)
55
56set(include_dirs
57 ${CMAKE_CURRENT_SOURCE_DIR}
58 ${CMAKE_CURRENT_BINARY_DIR}
59 ${JNI_INCLUDE_DIRS}
60#CTR
61 ${JACE_DIR}/source/c++/include
62 ${BF_JACE_DIR}/include
63 ${BF_JACE_DIR}/proxies/include
64 )
65
66#if(EXISTS "${ITK_DIR}/CMakeCache.txt")
67#  set(include_dirs ${include_dirs} "${ITK_DIR}/Utilities/zlib")
68#else(EXISTS "${ITK_DIR}/CMakeCache.txt")
69#endif(EXISTS "${ITK_DIR}/CMakeCache.txt")
70
71include_directories(${include_dirs})
72
73#CTR
74link_directories(${BF_JACE_DIR}/build)
75
76configure_file(
77 ${CMAKE_CURRENT_SOURCE_DIR}/itkBioFormatsImageIOConfigure.h.in
78 ${CMAKE_CURRENT_BINARY_DIR}/itkBioFormatsImageIOConfigure.h
79 )
80
81file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
82install(FILES
83 ${headers}
84 "${CMAKE_CURRENT_BINARY_DIR}/itkBioFormatsImageIOConfigure.h"
85 DESTINATION include/${PROJECT_NAME} COMPONENT Development
86 )
87
88# --------------------------------------------------------------------------
89# Sources
90
91set(BioFormatsImageIO_SRCS
92 itkBioFormatsImageIO.cxx
93 itkBioFormatsImageIOFactory.cxx
94 )
95
96# --------------------------------------------------------------------------
97# Build and install the library
98
99set(lib_name BioFormatsIO)
100add_library(${lib_name}
101 ${BioFormatsImageIO_SRCS}
102 )
103
104target_link_libraries(${lib_name}
105 ITKIO
106#CTR
107 jace
108 bfjace
109)
110
111install(TARGETS ${lib_name}
112 RUNTIME DESTINATION bin COMPONENT RuntimeLibraries
113 LIBRARY DESTINATION lib/${PROJECT_NAME} COMPONENT RuntimeLibraries
114 ARCHIVE DESTINATION lib/${PROJECT_NAME} COMPONENT Development
115)
116
117# Shared library that when placed in ITK_AUTOLOAD_PATH, will add
118# BioFormatsImageIO as an ImageIOFactory.  Need to have separate shared
119# library for each new format. Note that the plugin library is placed
120# in a special directory to speed up the searching for ImageIO
121# factories (which improves the speed at which plugins run).
122
123if(NOT DEFINED BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR)
124 set(BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR lib/ITKFactories)
125endif(NOT DEFINED BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR)
126
127add_library(BioFormatsIOPlugin SHARED
128 itkBioFormatsIOPlugin.cxx
129 )
130set_target_properties(BioFormatsIOPlugin
131 PROPERTIES
132 RUNTIME_OUTPUT_DIRECTORY
133 "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}"
134 LIBRARY_OUTPUT_DIRECTORY
135 "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}"
136 ARCHIVE_OUTPUT_DIRECTORY
137 "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}"
138 )
139target_link_libraries(BioFormatsIOPlugin
140 ${lib_name}
141#CTR
142 jace
143 bfjace
144)
145
146install(TARGETS BioFormatsIOPlugin
147 RUNTIME DESTINATION ${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR} COMPONENT RuntimeLibraries
148 LIBRARY DESTINATION ${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR} COMPONENT RuntimeLibraries
149 ARCHIVE DESTINATION lib/${PROJECT_NAME} COMPONENT Development
150 )
151
152# make a copy named '.so' for compatibility with the expectations
153# of the ITK Factory mechanism on macs
154
155if(APPLE)
156 add_custom_command(
157   TARGET BioFormatsIOPlugin
158   DEPENDS "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.dylib"
159   POST_BUILD
160   COMMAND ${CMAKE_COMMAND} -E copy
161   "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.dylib"
162   "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.so"
163   VERBATIM
164   )
165 install(FILES
166   "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.so"
167   DESTINATION ${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}
168   )
169endif(APPLE)
Note: See TracBrowser for help on using the repository browser.