include_guard() set(JPP_PDF_LIST "") foreach(y IN ITEMS 1 2 5 6 12 13) list(APPEND JPP_PDF_LIST I${y}p.dat) endforeach() foreach(x IN ITEMS 1 2 3 4 5 6 13 14 23 24 113) list(APPEND JPP_PDF_LIST J${x}p.dat) endforeach() # # Download PDFs from a known location # function(jpp_download_probability_density_functions) set(DATAARTIFACT http://sftp.km3net.de/data/latest/ CACHE STRING "where to download the PDFs from") set(DATADIR ${KM3NET_JPP_STAGE_DIR}/${CMAKE_INSTALL_DATADIR}) find_program(CURL_CMD curl) if(NOT CURL_CMD) find_program(WGET_CMD wget REQUIRED) foreach(pdfdat IN LISTS JPP_PDF_LIST) add_custom_command(OUTPUT ${DATADIR}/${pdfdat} COMMAND ${WGET_CMD} ${DATAARTIFACT}${pdfdat} --output-document ${DATADIR}/${pdfdat} --quiet VERBATIM) endforeach() else() foreach(pdfdat IN LISTS JPP_PDF_LIST) add_custom_command(OUTPUT ${DATADIR}/${pdfdat} COMMAND ${CURL_CMD} ${DATAARTIFACT}${pdfdat} --output ${DATADIR}/${pdfdat} --progress-bar --location VERBATIM) endforeach() endif() list(TRANSFORM JPP_PDF_LIST PREPEND ${DATADIR}/) add_custom_target(km3net-jpp-download-probability-density-functions DEPENDS ${JPP_PDF_LIST}) endfunction() # # generate PDFs # (this is a target that takes a _very_ long time to complete, on the order of 24 hours...) # function(jpp_generate_probability_density_functions) add_custom_command(OUTPUT ${JPP_PDF_LIST} COMMAND JPP_DIR=${KM3NET_JPP_STAGE_DIR} PATH=$ENV{PATH}:${KM3NET_JPP_STAGE_DIR}/bin ${KM3NET_JPP_STAGE_DIR}/${CMAKE_INSTALL_BINDIR}/JMakePDF.sh -W ${KM3NET_JPP_STAGE_DIR}/${CMAKE_INSTALL_DATADIR} -PMCcB DEPENDS km3net-jpp-exe-JPhysics-JMakePDF km3net-jpp-exe-JPhysics-JMakePDG km3net-jpp-exe-JPhysics-JMakeCDF km3net-jpp-exe-JPhysics-JMakeCDG km3net-jpp-exe-JPhysics-JMergePDF DEPENDS_EXPLICIT_ONLY) add_custom_target(km3net-jpp-generate-probability-density-functions DEPENDS ${JPP_PDF_LIST}) endfunction() # # download or generate PDFs # function(jpp_get_probability_density_functions) if(KM3NET_JPP_GENERATE_PROBABILITY_DENSITY_FUNCTIONS) jpp_generate_probability_density_functions() else() jpp_download_probability_density_functions() endif() endfunction()