Skip to content

Commit

Permalink
Remove hardcoded paths and other improvements, courtesy of Zack Galbr…
Browse files Browse the repository at this point in the history
…eath.
  • Loading branch information
ctrueden committed Feb 26, 2009
1 parent e9714c3 commit 77cc88a
Showing 1 changed file with 66 additions and 60 deletions.
126 changes: 66 additions & 60 deletions components/native/itk-plugin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,31 +31,37 @@ project(BioFormatsImageIO)

cmake_minimum_required(VERSION 2.4)
if(COMMAND cmake_policy)
cmake_policy(SET CMP0003 NEW)
cmake_policy(SET CMP0003 NEW)
endif(COMMAND cmake_policy)

find_package(ITK REQUIRED)
include(${ITK_USE_FILE})

if(NOT DEFINED BUILD_SHARED_LIBS)
option(BUILD_SHARED_LIBS "Build with shared libraries." ON)
option(BUILD_SHARED_LIBS "Build with shared libraries." ON)
endif(NOT DEFINED BUILD_SHARED_LIBS)

# --------------------------------------------------------------------------
# Include dirs

#TEMP:
set(JACE_DIR /home/curtis/svn/jace)
set(BF_JACE_DIR /home/curtis/svn/java/components/native/bf-cpp)
set(JACE_DIR NOTFOUND CACHE PATH "The path to toplevel directory of your Jace checkout")
if(NOT JACE_DIR)
message(FATAL_ERROR "Please set JACE_DIR to the toplevel directory of your Jace checkout")
endif()

set(BF_JACE_DIR ${PROJECT_SOURCE_DIR}/../bf-cpp)

find_package(JNI REQUIRED)

set(include_dirs
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${JNI_INCLUDE_DIRS}
#CTR
${JACE_DIR}/source/c++/include
${BF_JACE_DIR}/include
${BF_JACE_DIR}/proxies/include
)
${JACE_DIR}/source/c++/include
${BF_JACE_DIR}/include
${BF_JACE_DIR}/proxies/include
)

#if(EXISTS "${ITK_DIR}/CMakeCache.txt")
# set(include_dirs ${include_dirs} "${ITK_DIR}/Utilities/zlib")
Expand All @@ -68,44 +74,44 @@ include_directories(${include_dirs})
link_directories(${BF_JACE_DIR}/build)

configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/itkBioFormatsImageIOConfigure.h.in
${CMAKE_CURRENT_BINARY_DIR}/itkBioFormatsImageIOConfigure.h
)
${CMAKE_CURRENT_SOURCE_DIR}/itkBioFormatsImageIOConfigure.h.in
${CMAKE_CURRENT_BINARY_DIR}/itkBioFormatsImageIOConfigure.h
)

file(GLOB headers "${CMAKE_CURRENT_SOURCE_DIR}/*.h")
install(FILES
${headers}
"${CMAKE_CURRENT_BINARY_DIR}/itkBioFormatsImageIOConfigure.h"
DESTINATION include/${PROJECT_NAME} COMPONENT Development
)
${headers}
"${CMAKE_CURRENT_BINARY_DIR}/itkBioFormatsImageIOConfigure.h"
DESTINATION include/${PROJECT_NAME} COMPONENT Development
)

# --------------------------------------------------------------------------
# Sources

set(BioFormatsImageIO_SRCS
itkBioFormatsImageIO.cxx
itkBioFormatsImageIOFactory.cxx
)
itkBioFormatsImageIO.cxx
itkBioFormatsImageIOFactory.cxx
)

# --------------------------------------------------------------------------
# Build and install the library

set(lib_name BioFormatsIO)
add_library(${lib_name}
${BioFormatsImageIO_SRCS}
)
${BioFormatsImageIO_SRCS}
)

target_link_libraries(${lib_name}
ITKIO
ITKIO
#CTR
jace
bfjace
jace
bfjace
)

install(TARGETS ${lib_name}
RUNTIME DESTINATION bin COMPONENT RuntimeLibraries
LIBRARY DESTINATION lib/${PROJECT_NAME} COMPONENT RuntimeLibraries
ARCHIVE DESTINATION lib/${PROJECT_NAME} COMPONENT Development
RUNTIME DESTINATION bin COMPONENT RuntimeLibraries
LIBRARY DESTINATION lib/${PROJECT_NAME} COMPONENT RuntimeLibraries
ARCHIVE DESTINATION lib/${PROJECT_NAME} COMPONENT Development
)

# Shared library that when placed in ITK_AUTOLOAD_PATH, will add
Expand All @@ -115,49 +121,49 @@ install(TARGETS ${lib_name}
# factories (which improves the speed at which plugins run).

if(NOT DEFINED BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR)
set(BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR lib/ITKFactories)
set(BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR lib/ITKFactories)
endif(NOT DEFINED BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR)

add_library(BioFormatsIOPlugin SHARED
itkBioFormatsIOPlugin.cxx
)
itkBioFormatsIOPlugin.cxx
)
set_target_properties(BioFormatsIOPlugin
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}"
LIBRARY_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}"
ARCHIVE_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}"
)
PROPERTIES
RUNTIME_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}"
LIBRARY_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}"
ARCHIVE_OUTPUT_DIRECTORY
"${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}"
)
target_link_libraries(BioFormatsIOPlugin
${lib_name}
${lib_name}
#CTR
jace
bfjace
jace
bfjace
)

install(TARGETS BioFormatsIOPlugin
RUNTIME DESTINATION ${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR} COMPONENT RuntimeLibraries
LIBRARY DESTINATION ${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR} COMPONENT RuntimeLibraries
ARCHIVE DESTINATION lib/${PROJECT_NAME} COMPONENT Development
)
RUNTIME DESTINATION ${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR} COMPONENT RuntimeLibraries
LIBRARY DESTINATION ${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR} COMPONENT RuntimeLibraries
ARCHIVE DESTINATION lib/${PROJECT_NAME} COMPONENT Development
)

# make a copy named '.so' for compatibility with the expectations
# of the ITK Factory mechanism on macs

if(APPLE)
add_custom_command(
TARGET BioFormatsIOPlugin
DEPENDS "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.dylib"
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.dylib"
"${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.so"
VERBATIM
)
install(FILES
"${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.so"
DESTINATION ${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}
)
add_custom_command(
TARGET BioFormatsIOPlugin
DEPENDS "${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.dylib"
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy
"${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.dylib"
"${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.so"
VERBATIM
)
install(FILES
"${CMAKE_BINARY_DIR}/${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}/libBioFormatsIOPlugin.so"
DESTINATION ${BioFormatsImageIO_INSTALL_ITKFACTORIES_DIR}
)
endif(APPLE)

0 comments on commit 77cc88a

Please sign in to comment.