Skip to content

Commit

Permalink
STYLE: Only set paths necessary for current build
Browse files Browse the repository at this point in the history
Limit the PYTHONPATH and LD_LIBRARY_PATH settings
for the build configuration choosen.

The previous listing of all possible candidate directories
made debugging tedious.
  • Loading branch information
hjmjohnson committed Nov 22, 2020
1 parent 305a09e commit c82803a
Showing 1 changed file with 29 additions and 15 deletions.
44 changes: 29 additions & 15 deletions CMake/ITKModuleTest.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -189,21 +189,35 @@ function(itk_python_add_test)
set(itk_wrap_python_binary_dir "${ITK_BINARY_DIR}/Wrapping/Generators/Python")
endif()

itk_add_test(NAME ${PYTHON_ADD_TEST_NAME}
COMMAND itkTestDriver
--add-before-env PYTHONPATH "${itk_wrap_python_binary_dir}/$<CONFIG>"
--add-before-env PYTHONPATH "${itk_wrap_python_binary_dir}/$<CONFIG>/itk"
--add-before-env PYTHONPATH "${itk_wrap_python_binary_dir}"
--add-before-env PYTHONPATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$<CONFIG>"
--add-before-env PYTHONPATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
--add-before-libpath "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}"
--add-before-libpath "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>"
--add-before-libpath "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
${PYTHON_ADD_TEST_TEST_DRIVER_ARGS}
${command}
${PYTHON_ADD_TEST_COMMAND}
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}"
)
if(CMAKE_CONFIGURATION_TYPES)
itk_add_test(NAME ${PYTHON_ADD_TEST_NAME}
COMMAND itkTestDriver
--add-before-env PYTHONPATH "${itk_wrap_python_binary_dir}/$<CONFIG>" # parent directory of the itk package
--add-before-env PYTHONPATH "${itk_wrap_python_binary_dir}/$<CONFIG>/itk" # directory of the itk package ( contains __init__.py)
--add-before-env PYTHONPATH "${itk_wrap_python_binary_dir}/$<CONFIG>/itk/conf" # directory of the itkConfig module
--add-before-env PYTHONPATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$<CONFIG>" # directory of shared libraries + swig artifacts
--add-before-libpath "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/$<CONFIG>" # itk non-wrapping shared libs
--add-before-libpath "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/$<CONFIG>" # ???
${PYTHON_ADD_TEST_TEST_DRIVER_ARGS}
${command}
${PYTHON_ADD_TEST_COMMAND}
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}"
)
else()
itk_add_test(NAME ${PYTHON_ADD_TEST_NAME}
COMMAND itkTestDriver
--add-before-env PYTHONPATH "${itk_wrap_python_binary_dir}" # parent directory of the itk package
--add-before-env PYTHONPATH "${itk_wrap_python_binary_dir}/itk" # directory of the itk package ( contains __init__.py)
--add-before-env PYTHONPATH "${itk_wrap_python_binary_dir}/itk/conf" # directory of the itkConfig module
--add-before-env PYTHONPATH "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" # directory of shared libraries + swig artifacts
--add-before-libpath "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" # itk non-wrapping shared libs
--add-before-libpath "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" # ???
${PYTHON_ADD_TEST_TEST_DRIVER_ARGS}
${command}
${PYTHON_ADD_TEST_COMMAND}
WORKING_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}"
)
endif()
set_property(TEST ${PYTHON_ADD_TEST_NAME} APPEND PROPERTY LABELS Python)
endfunction()

Expand Down

0 comments on commit c82803a

Please sign in to comment.