Skip to content
Snippets Groups Projects
Commit 0cd9bde0 authored by Dan Nixon's avatar Dan Nixon
Browse files

Renamed copy_python_files_to_dir cmake function

Refs #10015
parent 4702dc90
No related branches found
No related tags found
No related merge requests found
...@@ -61,29 +61,29 @@ endfunction( SET_TARGET_OUTPUT_DIRECTORY ) ...@@ -61,29 +61,29 @@ endfunction( SET_TARGET_OUTPUT_DIRECTORY )
####################################################################### #######################################################################
# #
# NAME: COPY_PYTHON_FILES_TO_DIR # NAME: COPY_FILES_TO_DIR
# Adds a set of custom commands for each python file to copy # Adds a set of custom commands for each file to copy
# the given file to the destination directory # the given file to the destination directory
# - PY_FILES :: A list of python files to copy. Note you will have # - FILES :: A list of files to copy. Note you will have
# to quote an expanded list # to quote an expanded list
# - SRC_DIR :: The src directory of the files to be copied # - SRC_DIR :: The src directory of the files to be copied
# - DEST_DIR :: The final directory for the copied files # - DEST_DIR :: The final directory for the copied files
# - INSTALLED_FILES :: An output variable containing the list of copied # - INSTALLED_FILES :: An output variable containing the list of copied
# files including their full paths # files including their full paths
function( COPY_PYTHON_FILES_TO_DIR PY_FILES SRC_DIR DEST_DIR INSTALLED_FILES ) function( COPY_FILES_TO_DIR FILES SRC_DIR DEST_DIR INSTALLED_FILES )
set ( COPIED_FILES ${${INSTALLED_FILES}} ) set ( COPIED_FILES ${${INSTALLED_FILES}} )
foreach ( PYFILE ${PY_FILES} ) foreach ( _FILE ${FILES} )
get_filename_component( _basefilename ${PYFILE} NAME_WE ) get_filename_component( _basefilename ${_FILE} NAME_WE )
set( _py_src ${SRC_DIR}/${PYFILE} ) set( _src ${SRC_DIR}/${_FILE} )
set( _py_bin ${DEST_DIR}/${PYFILE} ) set( _bin ${DEST_DIR}/${_FILE} )
add_custom_command ( OUTPUT ${_py_bin} add_custom_command ( OUTPUT ${_bin}
DEPENDS ${_py_src} DEPENDS ${_src}
COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different
${_py_src} ${_py_bin} ) ${_src} ${_bin} )
set ( COPIED_FILES ${COPIED_FILES} ${_py_bin} ) set ( COPIED_FILES ${COPIED_FILES} ${_bin} )
endforeach ( PYFILE ) endforeach ( _FILE )
set ( ${INSTALLED_FILES} ${COPIED_FILES} PARENT_SCOPE ) set ( ${INSTALLED_FILES} ${COPIED_FILES} PARENT_SCOPE )
endfunction( COPY_PYTHON_FILES_TO_DIR ) endfunction( COPY_FILES_TO_DIR )
####################################################################### #######################################################################
......
...@@ -17,15 +17,15 @@ set ( PY_FILES ...@@ -17,15 +17,15 @@ set ( PY_FILES
simpleapi.py simpleapi.py
) )
copy_python_files_to_dir ( "${PY_FILES}" ${CMAKE_CURRENT_SOURCE_DIR} ${OUTPUT_DIR} copy_files_to_dir ( "${PY_FILES}" ${CMAKE_CURRENT_SOURCE_DIR} ${OUTPUT_DIR}
PYTHON_PKGROOT_INSTALL_FILES ) PYTHON_PKGROOT_INSTALL_FILES )
# Generate the version module # Generate the version module
set ( VERSION_PY pyversion ) set ( VERSION_PY pyversion )
# Build version # Build version
configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/${VERSION_PY}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${VERSION_PY}.py ) configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/${VERSION_PY}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${VERSION_PY}.py )
# Copy py to build directory, taking care of multi-config (MSVC) builds # Copy py to build directory, taking care of multi-config (MSVC) builds
copy_python_files_to_dir ( ${VERSION_PY}.py ${CMAKE_CURRENT_BINARY_DIR} ${OUTPUT_DIR} copy_files_to_dir ( ${VERSION_PY}.py ${CMAKE_CURRENT_BINARY_DIR} ${OUTPUT_DIR}
PYTHON_PKGROOT_INSTALL_FILES ) PYTHON_PKGROOT_INSTALL_FILES )
# Package version # Package version
configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/${VERSION_PY}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${VERSION_PY}.install.py ) configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/${VERSION_PY}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${VERSION_PY}.install.py )
......
...@@ -114,8 +114,8 @@ if(CMAKE_GENERATOR STREQUAL Xcode) ...@@ -114,8 +114,8 @@ if(CMAKE_GENERATOR STREQUAL Xcode)
set ( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PYTHON_PKG_ROOT}/api ) set ( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PYTHON_PKG_ROOT}/api )
endif() endif()
copy_python_files_to_dir ( "${PY_FILES}" ${CMAKE_CURRENT_SOURCE_DIR} ${OUTPUT_DIR} copy_files_to_dir ( "${PY_FILES}" ${CMAKE_CURRENT_SOURCE_DIR} ${OUTPUT_DIR}
PYTHON_INSTALL_FILES ) PYTHON_INSTALL_FILES )
############################################################################################# #############################################################################################
# Create the target for this directory # Create the target for this directory
......
...@@ -53,8 +53,8 @@ if(CMAKE_GENERATOR STREQUAL Xcode) ...@@ -53,8 +53,8 @@ if(CMAKE_GENERATOR STREQUAL Xcode)
set ( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PYTHON_PKG_ROOT}/geometry ) set ( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PYTHON_PKG_ROOT}/geometry )
endif() endif()
copy_python_files_to_dir ( "${PY_FILES}" ${CMAKE_CURRENT_SOURCE_DIR} ${OUTPUT_DIR} copy_files_to_dir ( "${PY_FILES}" ${CMAKE_CURRENT_SOURCE_DIR} ${OUTPUT_DIR}
PYTHON_INSTALL_FILES ) PYTHON_INSTALL_FILES )
############################################################################################# #############################################################################################
# Create the target for this directory # Create the target for this directory
......
...@@ -124,8 +124,8 @@ if(CMAKE_GENERATOR STREQUAL Xcode) ...@@ -124,8 +124,8 @@ if(CMAKE_GENERATOR STREQUAL Xcode)
set ( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PYTHON_PKG_ROOT}/kernel ) set ( CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PYTHON_PKG_ROOT}/kernel )
endif() endif()
copy_python_files_to_dir ( "${PY_FILES}" ${CMAKE_CURRENT_SOURCE_DIR} ${OUTPUT_DIR} copy_files_to_dir ( "${PY_FILES}" ${CMAKE_CURRENT_SOURCE_DIR} ${OUTPUT_DIR}
PYTHON_INSTALL_FILES ) PYTHON_INSTALL_FILES )
############################################################################################# #############################################################################################
# Generate the packagesetup module for the build & install package # Generate the packagesetup module for the build & install package
...@@ -139,8 +139,8 @@ endif() ...@@ -139,8 +139,8 @@ endif()
# Build version # Build version
configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/${PACKAGESETUP_PY}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGESETUP_PY}.py ) configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/${PACKAGESETUP_PY}.py.in ${CMAKE_CURRENT_BINARY_DIR}/${PACKAGESETUP_PY}.py )
# Copy py to build directory, taking care of multi-config (MSVC) builds # Copy py to build directory, taking care of multi-config (MSVC) builds
copy_python_files_to_dir ( ${PACKAGESETUP_PY}.py ${CMAKE_CURRENT_BINARY_DIR} ${OUTPUT_DIR} copy_files_to_dir ( ${PACKAGESETUP_PY}.py ${CMAKE_CURRENT_BINARY_DIR} ${OUTPUT_DIR}
PYTHON_INSTALL_FILES ) PYTHON_INSTALL_FILES )
# Package version # Package version
if ( WIN32 OR APPLE ) if ( WIN32 OR APPLE )
......
...@@ -9,8 +9,8 @@ set ( PY_FILES ...@@ -9,8 +9,8 @@ set ( PY_FILES
# Copy python files to output directory # Copy python files to output directory
set ( OUTPUT_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/testhelpers ) set ( OUTPUT_DIR ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/testhelpers )
copy_python_files_to_dir ( "${PY_FILES}" ${CMAKE_CURRENT_SOURCE_DIR} ${OUTPUT_DIR} copy_files_to_dir ( "${PY_FILES}" ${CMAKE_CURRENT_SOURCE_DIR} ${OUTPUT_DIR}
PYTHON_INSTALL_FILES ) PYTHON_INSTALL_FILES )
############################################################################################# #############################################################################################
# Create the targets for this directory # Create the targets for this directory
......
...@@ -821,45 +821,46 @@ endif () ...@@ -821,45 +821,46 @@ endif ()
# Config reset scripts # Config reset scripts
########################################################################### ###########################################################################
if( WIN32 ) if ( WIN32 )
file( COPY set ( CONFIG_RESET_SCRIPT reset_settings.bat )
${CMAKE_CURRENT_SOURCE_DIR}/reset_settings.bat
DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR} )
else () else ()
file( COPY set ( CONFIG_RESET_SCRIPT reset_settings.sh )
${CMAKE_CURRENT_SOURCE_DIR}/reset_settings.sh
DESTINATION ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR} )
endif () endif ()
copy_files_to_dir ( "${CONFIG_RESET_SCRIPT}"
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}
CONFIG_RESET_SCRIPT_FILE )
########################################################################### ###########################################################################
# Required Python config files # Required Python config files
########################################################################### ###########################################################################
# Top-level python scripts # Top-level python scripts
set( PY_FILES mantidplotrc.py mantidplot.py qt_settings_editor.py ) set( PY_FILES mantidplotrc.py mantidplot.py qt_settings_editor.py )
copy_python_files_to_dir ( "${PY_FILES}" copy_files_to_dir ( "${PY_FILES}"
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR} ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}
PYTHON_INSTALL_FILES ) PYTHON_INSTALL_FILES )
# mantidplot.py package # mantidplot.py package
set( MTDPLOTPY_FILES set( MTDPLOTPY_FILES
__init__.py __init__.py
proxies.py proxies.py
) )
copy_python_files_to_dir ( "${MTDPLOTPY_FILES}" copy_files_to_dir ( "${MTDPLOTPY_FILES}"
${CMAKE_CURRENT_SOURCE_DIR}/mantidplotpy ${CMAKE_CURRENT_SOURCE_DIR}/mantidplotpy
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/mantidplotpy ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/mantidplotpy
MTDPLOT_INSTALL_FILES ) MTDPLOT_INSTALL_FILES )
# IPython scripts # IPython scripts
set( IPY_FILES set( IPY_FILES
__init__.py __init__.py
mantid_ipython_widget.py mantid_ipython_widget.py
) )
copy_python_files_to_dir ( "${IPY_FILES}" copy_files_to_dir ( "${IPY_FILES}"
${CMAKE_CURRENT_SOURCE_DIR}/ipython_widget ${CMAKE_CURRENT_SOURCE_DIR}/ipython_widget
${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/ipython_widget ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/${CMAKE_CFG_INTDIR}/ipython_widget
IPYTHON_INSTALL_FILES ) IPYTHON_INSTALL_FILES )
########################################################################### ###########################################################################
# MantidPlot executable # MantidPlot executable
...@@ -868,7 +869,7 @@ copy_python_files_to_dir ( "${IPY_FILES}" ...@@ -868,7 +869,7 @@ copy_python_files_to_dir ( "${IPY_FILES}"
add_executable ( MantidPlot ${WIN_CONSOLE} MACOSX_BUNDLE ${ALL_SRC} src/main.cpp add_executable ( MantidPlot ${WIN_CONSOLE} MACOSX_BUNDLE ${ALL_SRC} src/main.cpp
${INC_FILES} ${QTIPLOT_C_SRC} ${UI_HDRS} ${INC_FILES} ${QTIPLOT_C_SRC} ${UI_HDRS}
${RES_FILES} ${MANTID_RC_FILE} ${RES_FILES} ${MANTID_RC_FILE}
${PYTHON_INSTALL_FILES} ${MTDPLOT_INSTALL_FILES} ${IPYTHON_INSTALL_FILES} ${PYTHON_INSTALL_FILES} ${MTDPLOT_INSTALL_FILES} ${IPYTHON_INSTALL_FILES} ${CONFIG_RESET_SCRIPT_FILE}
) )
# Library dependencies # Library dependencies
...@@ -1005,6 +1006,7 @@ endforeach() ...@@ -1005,6 +1006,7 @@ endforeach()
foreach(PY_FILE ${IPY_FILES} ) foreach(PY_FILE ${IPY_FILES} )
install ( FILES ipython_widget/${PY_FILE} DESTINATION ${BIN_DIR}/ipython_widget ) install ( FILES ipython_widget/${PY_FILE} DESTINATION ${BIN_DIR}/ipython_widget )
endforeach() endforeach()
install ( FILES ${CONFIG_RESET_SCRIPT} DESTINATION ${BIN_DIR} )
if ( APPLE ) if ( APPLE )
configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/FixBundle.cmake.in configure_file ( ${CMAKE_CURRENT_SOURCE_DIR}/FixBundle.cmake.in
...@@ -1015,8 +1017,3 @@ if ( APPLE ) ...@@ -1015,8 +1017,3 @@ if ( APPLE )
install ( SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake ) install ( SCRIPT ${CMAKE_CURRENT_BINARY_DIR}/FixBundle.cmake )
endif () endif ()
if( WIN32 )
install( PROGRAMS reset_settings.bat DESTINATION ${BIN_DIR} )
else ()
install( PROGRAMS reset_settings.sh DESTINATION ${BIN_DIR} )
endif ()
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