Skip to content
Snippets Groups Projects
Commit a0c17e60 authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony
Browse files

Update ctest doc tests for multi-config generators.

Refs #9639
parent a5544f6b
No related branches found
No related tags found
No related merge requests found
......@@ -30,28 +30,56 @@ macro ( SPHINX_ADD_TEST _testname_prefix _doctest_runner_script )
# that file.
# Property for the module directory
if ( MSVC )
if ( MSVC OR CMAKE_GENERATOR STREQUAL Xcode) # both have separate configs
set ( _multiconfig TRUE )
set ( _module_dir ${CMAKE_BINARY_DIR}/bin/Release )
set ( _module_dir_debug ${CMAKE_BINARY_DIR}/bin/Debug )
set ( _working_dir ${_module_dir} )
set ( _working_dir_debug ${_module_dir_debug} )
if ( MSVC )
set ( _debug_exe ${PYTHON_EXECUTABLE_DEBUG} )
set ( _release_exe ${PYTHON_EXECUTABLE} )
else()
set ( _debug_exe ${PYTHON_EXECUTABLE} )
set ( _release_exe ${PYTHON_EXECUTABLE} )
endif()
else()
set ( _module_dir ${CMAKE_BINARY_DIR}/bin )
set ( _working_dir ${_module_dir} )
set ( _debug_exe ${PYTHON_EXECUTABLE} )
set ( _release_exe ${PYTHON_EXECUTABLE} )
endif()
foreach ( part ${ARGN} )
set ( _fullpath ${SPHINX_SRC_DIR}/${part} )
get_filename_component( _filename ${part} NAME )
get_filename_component( _docname ${part} NAME_WE )
set ( _testname "${_testname_prefix}_${_docname}" )
add_test ( NAME ${_testname}
COMMAND ${PYTHON_EXECUTABLE} ${_doctest_runner_script} )
set_property ( TEST ${_testname} PROPERTY
ENVIRONMENT "SPHINX_SRC_FILE=${_fullpath}" )
set_property ( TEST ${_testname} PROPERTY
WORKING_DIRECTORY ${_working_dir} )
if ( _multiconfig )
# Debug builds need to call the debug executable
add_test ( NAME ${_testname}_Debug CONFIGURATIONS Debug
COMMAND ${_debug_exe} ${_doctest_runner_script} )
set_property ( TEST ${_testname}_Debug PROPERTY
ENVIRONMENT "SPHINX_SRC_FILE=${_fullpath};RUNTIME_CONFIG=Debug" )
set_property ( TEST ${_testname}_Debug PROPERTY
WORKING_DIRECTORY ${_working_dir} )
# Release
add_test ( NAME ${_testname} CONFIGURATIONS Release
COMMAND ${_release_exe} ${_doctest_runner_script} )
set_property ( TEST ${_testname} PROPERTY
ENVIRONMENT "SPHINX_SRC_FILE=${_fullpath};RUNTIME_CONFIG=Release" )
set_property ( TEST ${_testname} PROPERTY
WORKING_DIRECTORY ${_working_dir} )
else ()
add_test ( NAME ${_testname}
COMMAND ${_release_exe} ${_doctest_runner_script} )
set_property ( TEST ${_testname} PROPERTY
ENVIRONMENT "SPHINX_SRC_FILE=${_fullpath}" )
set_property ( TEST ${_testname} PROPERTY
WORKING_DIRECTORY ${_working_dir} )
endif()
endforeach ()
endmacro ()
......
......@@ -7,7 +7,11 @@ import sys
def main():
# Update path to find mantid
sys.path.insert(0, "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@")
package_dir = "@CMAKE_LIBRARY_OUTPUT_DIRECTORY@"
runtime_config = os.environ.get("RUNTIME_CONFIG", "") # for visual studio and xcode
if runtime_config != "":
package_dir = os.path.join(package_dir, runtime_config)
sys.path.insert(0, package_dir)
# Update environment with screenshots path
screenshots_dir = "@SCREENSHOTS_DIR@"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment