Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

COMP: Fortify SimpleITK building on Linux.

git-svn-id: http://svn.slicer.org/Slicer4/trunk@19640 3bd1e089-480b-0410-8dfb-8563597acbee
  • Loading branch information...
commit ea4080fb51c42de77e55782e7ac1be3983a0d383 1 parent 1a37dad
hjohnson authored
View
11 SuperBuild.cmake
@@ -45,6 +45,17 @@ set(ep_base "${CMAKE_BINARY_DIR}")
set(ep_common_c_flags "${CMAKE_C_FLAGS_INIT} ${ADDITIONAL_C_FLAGS}")
set(ep_common_cxx_flags "${CMAKE_CXX_FLAGS_INIT} ${ADDITIONAL_CXX_FLAGS}")
+## On linux SimpleITK requires that ITK be built with -fPIC to allow static libraries to be used.
+if(Slicer_USE_SimpleITK)
+ if ( UNIX AND NOT APPLE )
+ if ( NOT ${ep_common_cxx_flags} MATCHES "-fPIC")
+ set(ep_common_cxx_flags "${CMAKE_CXX_FLAGS_INIT} ${ADDITIONAL_CXX_FLAGS} -fPIC")
+ message ( WARNING "SimpleITK wrapping requires CMAKE_CXX_FLAGS (or equivalent) to include -fPIC and ITK built with this flag" )
+ message ( WARNING "USING CXX_FLAGS = ${ep_common_cxx_flags}")
+ endif()
+ endif()
+endif()
+
set(ep_common_compiler_args
-DCMAKE_CXX_COMPILER:FILEPATH=${CMAKE_CXX_COMPILER}
-DCMAKE_CXX_FLAGS:STRING=${ep_common_cxx_flags}
View
9 SuperBuild/External_SimpleITK.cmake
@@ -43,12 +43,6 @@ configure_file(SuperBuild/SimpleITK_install_step.cmake.in
set(SimpleITK_INSTALL_COMMAND ${CMAKE_COMMAND} -P ${CMAKE_CURRENT_BINARY_DIR}/SimpleITK_install_step.cmake)
-if ( UNIX AND NOT APPLE )
- if ( NOT ${CMAKE_CXX_FLAGS} MATCHES "-fPIC")
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
- message ( WARNING "SimpleITK wrapping requires CMAKE_CXX_FLAGS (or equivalent) to include -fPIC and ITK built with this flag" )
- endif()
-endif()
ExternalProject_add(SimpleITK
SOURCE_DIR SimpleITK
@@ -59,7 +53,7 @@ ExternalProject_add(SimpleITK
GIT_TAG 4f3e84946cfa3fa36d90b410e3ea09e2aba5107e
UPDATE_COMMAND ""
CMAKE_ARGS
- ${ep_common_args}
+ ${ep_common_compiler_args}
# SimpleITK does not work with shared libs turned on
-DBUILD_SHARED_LIBS:BOOL=OFF
-DCMAKE_BUILD_TYPE:STRING=Release
@@ -77,7 +71,6 @@ ExternalProject_add(SimpleITK
-DWRAP_R:BOOL=OFF
${SIMPLEITK_PYTHON_ARGS}
-DSWIG_EXECUTABLE:PATH=${SWIG_EXECUTABLE}
- -DCMAKE_CXX_FLAGS:STRING=${CMAKE_CXX_FLAGS}
#
INSTALL_COMMAND ${SimpleITK_INSTALL_COMMAND}
#
View
14 SuperBuild/SimpleITK_install_step.cmake.in
@@ -1,11 +1,15 @@
## This file performs the necessary steps to install SimpleITK into the python environment of Slicer.
-execute_process(
- COMMAND @slicer_PYTHON_EXECUTABLE@ -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
- OUTPUT_VARIABLE PYTHON_SITE_PACKAGES_DIR
- OUTPUT_STRIP_TRAILING_WHITESPACE
-)
+## This is finding the wrong path on linux that has python 2.6 installed
+## execute_process(
+## COMMAND @slicer_PYTHON_EXECUTABLE@ -c "from distutils.sysconfig import get_python_lib; print get_python_lib()"
+## OUTPUT_VARIABLE PYTHON_SITE_PACKAGES_DIR
+## OUTPUT_STRIP_TRAILING_WHITESPACE
+## )
+## Hardcode the path
+set ( PYTHON_SITE_PACKAGES_DIR ${CMAKE_CURRENT_BINARY_DIR}/python-build/lib/python2.6/site-packages)
+message(INFO "Installing SimpleITK python package for @slicer_PYTHON_EXECUTABLE@ in ${PYTHON_SITE_PACKAGES_DIR}")
set(SimpleITK_SITE_PACKAGE_DIR ${PYTHON_SITE_PACKAGES_DIR})
make_directory( ${SimpleITK_SITE_PACKAGE_DIR} )
Please sign in to comment.
Something went wrong with that request. Please try again.