Commit 1b3fc7e1 authored by Nicolas Toussaint's avatar Nicolas Toussaint

(1) Re-initiating the BUILD_SHARED_LIBS on Mac; (2) Allowing shared libs to...

(1) Re-initiating the BUILD_SHARED_LIBS on Mac; (2) Allowing shared libs to compile with the right target_link_libs
parent 9f5cc3b2
......@@ -57,22 +57,28 @@ endif(BUILD_NR_SLICER_EXT)
option(USE_SSE "To enable SEE computation in some case" ON)
option(USE_DOUBLE "To force double precision instead of single precision" OFF)
find_package(OpenMP)
if(OPENMP_FOUND)
option(USE_OPENMP "To use openMP for multi-CPU processing" ON)
endif(OPENMP_FOUND)
option(USE_OPENMP "To use openMP for multi-CPU processing" ON)
if(NOT APPLE)
option(USE_CUDA "To enable CUDA for a GPU implementation of the code" OFF)
option(BUILD_SHARED_LIBS "Build the libraries as shared." OFF)
if(BUILD_SHARED_LIBS)
set(NIFTYREG_LIBRARY_TYPE SHARED)
else(BUILD_SHARED_LIBS)
set(NIFTYREG_LIBRARY_TYPE STATIC)
endif(BUILD_SHARED_LIBS)
else(NOT APPLE)
set(NIFTYREG_LIBRARY_TYPE STATIC)
endif(NOT APPLE)
if(USE_OPENMP)
find_package(OpenMP)
if (NOT OPENMP_FOUND)
set(USE_OPENMP OFF CACHE BOOL "To use openMP for multi-CPU processing" FORCE)
message(FATAL "OpenMP not found, forcing USE_OPENMP to OFF")
endif()
endif()
option(BUILD_SHARED_LIBS "Build the libraries as shared." OFF)
if(BUILD_SHARED_LIBS)
if(USE_CUDA)
set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build the libraries as shared." FORCE)
set(NIFTYREG_LIBRARY_TYPE STATIC)
else()
set(NIFTYREG_LIBRARY_TYPE SHARED)
endif()
else()
set(NIFTYREG_LIBRARY_TYPE STATIC)
endif()
#-----------------------------------------------------------------------------
......
......@@ -15,13 +15,14 @@ endforeach(NAME)
#-----------------------------------------------------------------------------
set(LIST _reg_tools)
foreach(NAME ${LIST})
add_library(${NAME} ${NIFTYREG_LIBRARY_TYPE} ${NAME}.h ${NAME}.cpp)
install(TARGETS ${NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(FILES ${NAME}.h DESTINATION include)
add_library(${NAME} ${NIFTYREG_LIBRARY_TYPE} ${NAME}.h ${NAME}.cpp)
target_link_libraries(${NAME} _reg_maths reg_nifti)
install(TARGETS ${NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(FILES ${NAME}.h DESTINATION include)
endforeach(NAME)
#-----------------------------------------------------------------------------
set(LIST _reg_globalTransformation)
......@@ -35,14 +36,14 @@ set(LIST ${LIST} _reg_dti)
set(LIST ${LIST} _reg_blockMatching)
set(LIST ${LIST} _reg_femTransformation)
foreach(NAME ${LIST})
add_library(${NAME} ${NIFTYREG_LIBRARY_TYPE} ${NAME}.h ${NAME}.cpp)
target_link_libraries(${NAME} _reg_tools _reg_maths)
install(TARGETS ${NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(FILES ${NAME}.h DESTINATION include)
add_library(${NAME} ${NIFTYREG_LIBRARY_TYPE} ${NAME}.h ${NAME}.cpp)
target_link_libraries(${NAME} _reg_tools _reg_maths _reg_globalTransformation)
install(TARGETS ${NAME}
RUNTIME DESTINATION bin
LIBRARY DESTINATION lib
ARCHIVE DESTINATION lib
)
install(FILES ${NAME}.h DESTINATION include)
endforeach(NAME)
install(FILES _reg_measure.h DESTINATION include)
#-----------------------------------------------------------------------------
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment