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

ENH: Restore ELASTIX_BUILD_EXECUTABLE CMake option #922

Merged
merged 1 commit into from
Jun 23, 2023
Merged
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
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ cmake_policy(SET CMP0042 NEW) # "MACOSX_RPATH is enabled by default."
#---------------------------------------------------------------------
include(CTest)

#---------------------------------------------------------------------
# Allow specifying whether or not the executables are built.
option( ELASTIX_BUILD_EXECUTABLE "Build elastix and transformix as executable? (The libraries are always built as well anyway.)" ON )

# The following may make smaller and quicker loading libraries,
# that hides unnecessary symbols. Available from CMake 3.0.0.
#set(CMAKE_C_VISIBILITY_PRESET hidden)
Expand Down
65 changes: 35 additions & 30 deletions Core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -179,20 +179,23 @@ endif()

#---------------------------------------------------------------------
# Create the elastix executable and library.
add_executable(elastix_exe
Main/elastix.cxx
Main/elastix.h
Main/elxMainExeUtilities.cxx
Main/elxMainExeUtilities.h
Kernel/elxMainBase.cxx
Kernel/elxMainBase.h
Kernel/elxElastixMain.cxx
Kernel/elxElastixMain.h
${InstallFilesForExecutables}
)
set_target_properties(elastix_exe PROPERTIES OUTPUT_NAME elastix)
target_compile_definitions(elastix_exe PRIVATE ELX_CMAKE_VERSION="${CMAKE_VERSION}")
target_link_libraries(elastix_exe ${ELASTIX_TARGET_LINK_LIBRARIES})

if(ELASTIX_BUILD_EXECUTABLE)
add_executable(elastix_exe
Main/elastix.cxx
Main/elastix.h
Main/elxMainExeUtilities.cxx
Main/elxMainExeUtilities.h
Kernel/elxMainBase.cxx
Kernel/elxMainBase.h
Kernel/elxElastixMain.cxx
Kernel/elxElastixMain.h
${InstallFilesForExecutables}
)
set_target_properties(elastix_exe PROPERTIES OUTPUT_NAME elastix)
target_compile_definitions(elastix_exe PRIVATE ELX_CMAKE_VERSION="${CMAKE_VERSION}")
target_link_libraries(elastix_exe ${ELASTIX_TARGET_LINK_LIBRARIES})
endif()

# The library type (STATIC or SHARED) is determined by the parameter
# BUILD_SHARED_LIBS.
Expand All @@ -216,20 +219,22 @@ target_link_libraries(elastix_lib ${ELASTIX_TARGET_LINK_LIBRARIES})
#---------------------------------------------------------------------
# Create the transformix executable.

add_executable(transformix_exe
Main/transformix.cxx
Main/elastix.h
Main/elxMainExeUtilities.cxx
Main/elxMainExeUtilities.h
Kernel/elxMainBase.cxx
Kernel/elxMainBase.h
Kernel/elxTransformixMain.cxx
Kernel/elxTransformixMain.h
${InstallFilesForExecutables}
)
set_target_properties(transformix_exe PROPERTIES OUTPUT_NAME transformix)
target_compile_definitions(transformix_exe PRIVATE ELX_CMAKE_VERSION="${CMAKE_VERSION}")
target_link_libraries(transformix_exe ${ELASTIX_TARGET_LINK_LIBRARIES})
if(ELASTIX_BUILD_EXECUTABLE)
add_executable(transformix_exe
Main/transformix.cxx
Main/elastix.h
Main/elxMainExeUtilities.cxx
Main/elxMainExeUtilities.h
Kernel/elxMainBase.cxx
Kernel/elxMainBase.h
Kernel/elxTransformixMain.cxx
Kernel/elxTransformixMain.h
${InstallFilesForExecutables}
)
set_target_properties(transformix_exe PROPERTIES OUTPUT_NAME transformix)
target_compile_definitions(transformix_exe PRIVATE ELX_CMAKE_VERSION="${CMAKE_VERSION}")
target_link_libraries(transformix_exe ${ELASTIX_TARGET_LINK_LIBRARIES})
endif()

# The library type (STATIC or SHARED) is determined by the parameter
# BUILD_SHARED_LIBS.
Expand All @@ -254,13 +259,13 @@ set(ELASTIX_LIBRARIES elastix_lib transformix_lib PARENT_SCOPE)
#---------------------------------------------------------------------
# Define the install directory for elastix and transformix.

if(NOT WIN32)
if(ELASTIX_BUILD_EXECUTABLE AND NOT WIN32)
# Tell the executables where to find the required .so files.
set_target_properties(elastix_exe transformix_exe
PROPERTIES INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/lib:${ITK_DIR}")
endif()

if(NOT ELASTIX_NO_INSTALL_EXECUTABLES)
if(ELASTIX_BUILD_EXECUTABLE AND NOT ELASTIX_NO_INSTALL_EXECUTABLES)
install(TARGETS elastix_exe transformix_exe
ARCHIVE DESTINATION ${ELASTIX_ARCHIVE_DIR}
LIBRARY DESTINATION ${ELASTIX_LIBRARY_DIR}
Expand Down
1 change: 1 addition & 0 deletions ElastixConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ endif()


# Set some variables that the user might want to use
set( ELASTIX_BUILD_EXECUTABLE @ELASTIX_BUILD_EXECUTABLE@ )
set( ELASTIX_USE_OPENMP @ELASTIX_USE_OPENMP@ )
set( ELASTIX_USE_OPENCL @ELASTIX_USE_OPENCL@ )
set( ELASTIX_USE_MEVISDICOMTIFF @ELASTIX_USE_MEVISDICOMTIFF@ )
Expand Down
Loading