diff --git a/qt/CMakeLists.txt b/qt/CMakeLists.txt index 5f341c81f5f58fc648215fa1c4179c1ec0079743..82b42ecd9bc51ed36905e6e998ee0f6a6d408e27 100644 --- a/qt/CMakeLists.txt +++ b/qt/CMakeLists.txt @@ -4,16 +4,24 @@ find_package ( QScintillaQt4 REQUIRED ) include ( QtTargetFunctions ) # Function to create links to python packages in the source tree +# If the EXECUTABLE option is provided then it additional build rules are +# defined to ensure startup scripts are regenerated appropriately function ( add_python_package pkg_name ) # Create a setup.py file set ( _setup_py ${CMAKE_CURRENT_SOURCE_DIR}/setup.py ) set ( _egg_link_dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR} ) set ( _egg_link ${_egg_link_dir}/${pkg_name}.egg-link ) - set ( _startup_script ${_egg_link_dir}/${pkg_name} ) - if ( WIN32 ) - set ( _startup_script ${_startup_script}.exe ) + if ( ARGV0 EQUAL "EXECUTABLE" ) + if ( WIN32 ) + set ( _startup_script ${_egg_link_dir}/${pkg_name}-script.pyw ) + set ( _startup_exe ${_egg_link_dir}/${pkg_name}.exe ) + else () + set ( _startup_script ) + set ( _startup_exe ${_egg_link_dir}/${pkg_name} ) + endif () endif () - add_custom_command ( OUTPUT ${_egg_link} ${_startup_script} + set ( _outputs "${_egg_link} ${_startup_script} ${_startup_exe}" ) + add_custom_command ( OUTPUT ${_outputs} COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${_egg_link_dir} ${PYTHON_EXECUTABLE} ${_setup_py} develop --install-dir ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR} @@ -22,7 +30,7 @@ function ( add_python_package pkg_name ) DEPENDS ${_setup_py} ) add_custom_target ( ${pkg_name} ALL - DEPENDS ${_egg_link_dir}/${pkg_name} ${_egg_link} + DEPENDS ${_outputs} ) endfunction () diff --git a/qt/applications/workbench/CMakeLists.txt b/qt/applications/workbench/CMakeLists.txt index 741841ff493b8c3cca6b9f02b7e1cd5c03034073..c6414f123903ba2e20521dac1ed7af6887e9ddc0 100644 --- a/qt/applications/workbench/CMakeLists.txt +++ b/qt/applications/workbench/CMakeLists.txt @@ -1,5 +1,5 @@ # Creates egg link to binary output directory -add_python_package ( workbench ) +add_python_package ( workbench EXECUTABLE ) add_dependencies ( workbench mantidqt ) # ctest targets