Unverified Commit 05ae26bf authored by Gigg, Martyn Anthony's avatar Gigg, Martyn Anthony Committed by GitHub
Browse files

Merge pull request #28374 from mantidproject/Make_python_targets_runnable_msvc

Make python targets runnable on MSVC IDE
parents 8d41a1db 728c361f
...@@ -113,6 +113,7 @@ if(MSVC) ...@@ -113,6 +113,7 @@ if(MSVC)
"The location of the pythonw executable. This suppresses the new terminal window on startup" "The location of the pythonw executable. This suppresses the new terminal window on startup"
FORCE FORCE
) )
set(THIRD_PARTY_BIN set(THIRD_PARTY_BIN
"${THIRD_PARTY_DIR}/bin;${THIRD_PARTY_DIR}/lib/qt4/bin;${THIRD_PARTY_DIR}/lib/qt5/bin;${MSVC_PYTHON_EXECUTABLE_DIR}" "${THIRD_PARTY_DIR}/bin;${THIRD_PARTY_DIR}/lib/qt4/bin;${THIRD_PARTY_DIR}/lib/qt5/bin;${MSVC_PYTHON_EXECUTABLE_DIR}"
) )
......
...@@ -128,18 +128,23 @@ else () ...@@ -128,18 +128,23 @@ else ()
set (PARAVIEW_PYTHON_PATHS "" ) set (PARAVIEW_PYTHON_PATHS "" )
endif () endif ()
set(MSVC_BIN_DIR ${PROJECT_BINARY_DIR}/bin/$<CONFIG>)
configure_file ( ${PACKAGING_DIR}/mantidpython.bat.in configure_file ( ${PACKAGING_DIR}/mantidpython.bat.in
${PROJECT_BINARY_DIR}/mantidpython.bat.in @ONLY ) ${PROJECT_BINARY_DIR}/mantidpython.bat.in @ONLY )
# place it in the appropriate directory # place it in the appropriate directory
file(GENERATE file(GENERATE
OUTPUT OUTPUT
${PROJECT_BINARY_DIR}/bin/$<$<CONFIG:Release>:Release>$<$<CONFIG:Debug>:Debug>/mantidpython.bat ${MSVC_BIN_DIR}/mantidpython.bat
INPUT INPUT
${PROJECT_BINARY_DIR}/mantidpython.bat.in ${PROJECT_BINARY_DIR}/mantidpython.bat.in
) )
# install version # install version
set ( MANTIDPYTHON_PREAMBLE "set PYTHONHOME=%_BIN_DIR%\nset PATH=%_BIN_DIR%;%_BIN_DIR%\\..\\plugins;%_BIN_DIR%\\..\\PVPlugins;%PATH%" ) set ( MANTIDPYTHON_PREAMBLE "set PYTHONHOME=%_BIN_DIR%\nset PATH=%_BIN_DIR%;%_BIN_DIR%\\..\\plugins;%_BIN_DIR%\\..\\PVPlugins;%PATH%" )
# Semi-colon gen exp prevents future generators converting to CMake lists
set ( MSVC_IDE_ENV "PYTHONPATH=${MSVC_BIN_DIR}$<SEMICOLON>PYTHONHOME=${MSVC_PYTHON_EXECUTABLE_DIR}" )
if (MAKE_VATES) if (MAKE_VATES)
set ( PV_LIBS "%_BIN_DIR%\\..\\lib\\paraview-${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}") set ( PV_LIBS "%_BIN_DIR%\\..\\lib\\paraview-${PARAVIEW_VERSION_MAJOR}.${PARAVIEW_VERSION_MINOR}")
set ( PARAVIEW_PYTHON_PATHS ";${PV_LIBS}\\site-packages;${PV_LIBS}\\site-packages\\vtk" ) set ( PARAVIEW_PYTHON_PATHS ";${PV_LIBS}\\site-packages;${PV_LIBS}\\site-packages\\vtk" )
...@@ -150,6 +155,17 @@ endif () ...@@ -150,6 +155,17 @@ endif ()
configure_file ( ${PACKAGING_DIR}/mantidpython.bat.in configure_file ( ${PACKAGING_DIR}/mantidpython.bat.in
${PROJECT_BINARY_DIR}/mantidpython.bat.install @ONLY ) ${PROJECT_BINARY_DIR}/mantidpython.bat.install @ONLY )
##########################################################################
# Custom targets to fix-up and run Python entry point code
##########################################################################
add_custom_target(SystemTests)
add_dependencies(SystemTests Framework StandardTestData SystemTestData)
set_target_properties(SystemTests PROPERTIES
VS_DEBUGGER_COMMAND "${PYTHON_EXECUTABLE}"
VS_DEBUGGER_COMMAND_ARGUMENTS "${CMAKE_SOURCE_DIR}/Testing/SystemTests/scripts/runSystemTests.py --executable \"${MSVC_BIN_DIR}/mantidpython.bat\" --exec-args \" --classic\""
VS_DEBUGGER_ENVIRONMENT "${MSVC_IDE_ENV}"
)
########################################################################### ###########################################################################
# (Fake) installation variables to keep windows sweet # (Fake) installation variables to keep windows sweet
########################################################################### ###########################################################################
......
...@@ -201,6 +201,22 @@ fixed when running CMake, e.g. ...@@ -201,6 +201,22 @@ fixed when running CMake, e.g.
cd build cd build
systemtest systemtest
Selecting Tests to Run From IDE
-------------------------------
System tests can be ran from the MSVC IDE using the ``SystemTests`` target,
which behaves in a similar way to unit test targets. One key advantage is
that it allows you to start Mantid in a debug environment rather than attach
to one midway through.
To select an individual test, or range of tests, go to the ``SystemTests``
properties, go to ```Command Arguments``` and append flags as appropriate.
For example, adding ``-R ISIS`` will run any tests which match the regular
expression ``ISIS``.
Selecting Tests To Run Selecting Tests To Run
---------------------- ----------------------
...@@ -217,6 +233,7 @@ e.g. ...@@ -217,6 +233,7 @@ e.g.
would run all of the tests whose name contains SNS. would run all of the tests whose name contains SNS.
Running the tests on multiple cores Running the tests on multiple cores
----------------------------------- -----------------------------------
......
...@@ -12,6 +12,12 @@ add_python_package(workbench ...@@ -12,6 +12,12 @@ add_python_package(workbench
INSTALL_BIN_DIR "${WORKBENCH_BIN_DIR}" INSTALL_BIN_DIR "${WORKBENCH_BIN_DIR}"
) )
set_target_properties(workbench PROPERTIES
VS_DEBUGGER_COMMAND $<$<BOOL:${WIN32}>:${PYTHON_EXECUTABLE}>
VS_DEBUGGER_COMMAND_ARGUMENTS $<$<BOOL:${WIN32}>:${MSVC_BIN_DIR}/workbench-script.pyw>
VS_DEBUGGER_ENVIRONMENT $<$<BOOL:${WIN32}>:${MSVC_IDE_ENV}>
)
set(_images_qrc_file ${CMAKE_CURRENT_LIST_DIR}/resources.qrc) set(_images_qrc_file ${CMAKE_CURRENT_LIST_DIR}/resources.qrc)
if (WIN32) if (WIN32)
......
Supports Markdown
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