1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79
|
cmake_minimum_required( VERSION 3.17.0 )
# This will install McStas or McXtrace mc/mxrun
project(perl-cluster-tools C)
# Choose between McStas or McXtrace
option(BUILD_MCSTAS "Choose the McStas flavor" off)
option(BUILD_MCXTRACE "Choose the McXtrace flavor (trumps BUILD_MCSTAS)" Off)
# Set module path
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH}" "${CMAKE_SOURCE_DIR}/cmake/Modules/")
# Set McCode values (from mkdist or defaults)
include(MCUtil)
if (${BUILD_MCXTRACE})
set(FLAVOR "mcxtrace")
elseif(${BUILD_MCSTAS})
set(FLAVOR "mcstas")
else()
message(FATAL_ERROR "No flavor specified!\n"
"Please use either -DBUILD_MCSTAS=1 or -DBUILD_MCXTRACE=1")
endif()
message("Enabling ${FLAVOR} flavor")
setupMCCODE("${FLAVOR}")
# Select prefix
set(P "${MCCODE_PREFIX}")
# CPack configuration
set(CPACK_PACKAGE_NAME "${FLAVOR}-clustertools")
set(CPACK_RESOURCE_FilE_LICENSE "${PROJECT_SOURCE_DIR}/../../COPYING")
set(CPACK_PACKAGE_CONTACT "pkwi@fysik.dtu.dk")
set(CPACK_PACKAGE_VERSION "${MCCODE_MAJOR}.${MCCODE_MINOR}.${MCCODE_PATCH}")
set(CPACK_PACKAGE_VERSION_MAJOR "${MCCODE_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${MCCODE_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${MCCODE_PATCH}")
# NSIS
set(NSIS_NAME "Cluster scripting tools (slurm, pbs), ${MCCODE_STRING}")
set(CPACK_NSIS_PACKAGE_NAME "${NSIS_NAME}")
set(CPACK_NSIS_DISPLAY_NAME "${NSIS_NAME}")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${NSIS_NAME}")
# Debian
set(CPACK_DEBIAN_PACKAGE_DEPENDS "${FLAVOR}, perl, libfile-which-perl")
set(CPACK_DEBIAN_PACKAGE_REPLACES "${FLAVOR}-clustertools-3.5.1")
# RPM
set(CPACK_RPM_PACKAGE_REQUIRES
"${FLAVOR}-${MCCODE_VERSION}, perl"
)
include(CPack)
set(WORK "${PROJECT_BINARY_DIR}/work")
# Configure scripts
configure_file("${CMAKE_SOURCE_DIR}/mcsub_pbs.in" "${WORK}/${FLAVOR}_mcsub_pbs" @ONLY)
configure_file("${CMAKE_SOURCE_DIR}/mcsub_slurm.in" "${WORK}/${FLAVOR}_mcsub_slurm" @ONLY)
if(WINDOWS)
foreach(NAME "mcsub_pbs" "mcsub_slurm")
install(
FILES "${WORK}/${NAME}"
DESTINATION "${bin}/${NAME}.pl"
)
endforeach()
else()
foreach(NAME "${FLAVOR}_mcsub_pbs" "${FLAVOR}_mcsub_slurm")
install(
FILES "${WORK}/${NAME}"
DESTINATION "${DEST_BINDIR}"
)
endforeach()
endif()
|