Skip to content
Snippets Groups Projects
Commit dd0e77fc authored by Lars Bilke's avatar Lars Bilke
Browse files

New CMake option OGS_DOWNLOAD_ADDITIONAL_CONTENT.

- New function CMake DownloadAdditionalFilesForPackaging
  (scripts/packaging/PackagingMacros.cmake)

This is used for adding additional tools (OGSFileConverter) or documentation
(e.g. the user manual pdf) to the redistributable package.
parent 3c32663c
No related branches found
No related tags found
No related merge requests found
......@@ -23,11 +23,7 @@ INCLUDE(Tests.cmake)
####################
### Installation ###
####################
IF(APPLE AND OGS_BUILD_GUI)
INSTALL (TARGETS ogs RUNTIME DESTINATION . COMPONENT ogs_cli)
ELSE()
INSTALL (TARGETS ogs RUNTIME DESTINATION bin COMPONENT ogs_cli)
ENDIF()
INSTALL (TARGETS ogs RUNTIME DESTINATION bin COMPONENT ogs_cli)
set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "ogs" "OGS Simulator")
cpack_add_component(ogs_cli
......
......@@ -92,9 +92,7 @@ ENDIF (OGS_CMAKE_DEBUG)
OPTION(OGS_COVERAGE "Enables code coverage measurements with gcov/lcov." OFF)
# Packaging
IF(WIN32)
OPTION(OGS_PACKAGING_NSIS "Do you want to package with NSIS?")
ENDIF()
OPTION(OGS_DOWNLOAD_ADDITIONAL_CONTENT "Should addional content such as manuals be downloaded and packaged?" OFF)
INCLUDE(scripts/cmake/packaging/Pack.cmake)
######################
......
INCLUDE(packaging/PackagingMacros)
#### Packaging setup ####
SET(CPACK_PACKAGE_DESCRIPTION_SUMMARY "OGS-6 THM/C Simulator")
SET(CPACK_PACKAGE_VENDOR "OpenGeoSys Community (http://www.opengeosys.org)")
......@@ -28,19 +30,32 @@ IF(APPLE)
INCLUDE (packaging/PackagingMac)
ENDIF()
# Additional binaries, i.e. OGS-5 file converter
# Can be given as a list, paths must be relative to CMAKE_BINARY_DIR!
IF(OGS_PACKAGE_ADDITIONAL_BINARIES)
FOREACH(ADDITIONAL_BINARY ${OGS_PACKAGE_ADDITIONAL_BINARIES})
GET_FILENAME_COMPONENT(ADDITIONAL_BINARY_NAME ${ADDITIONAL_BINARY} NAME)
MESSAGE(STATUS "Packaging additional binary: ${ADDITIONAL_BINARY_NAME}")
IF(APPLE AND OGS_BUILD_GUI)
SET(INSTALL_LOCATION DataExplorer.app/Contents/MacOS)
ELSE()
SET(INSTALL_LOCATION bin)
ENDIF()
INSTALL (PROGRAMS ${CMAKE_BINARY_DIR}/${ADDITIONAL_BINARY} DESTINATION ${INSTALL_LOCATION} COMPONENT ogs_extras)
ENDFOREACH()
# Download additional content
IF(OGS_DOWNLOAD_ADDITIONAL_CONTENT)
DownloadAdditionalFilesForPackaging(
URLS http://docs.opengeosys.org/assets/releases/head/docs/DataExplorer-Manual.pdf
http://docs.opengeosys.org/assets/releases/head/docs/User_Manual.pdf
http://docs.opengeosys.org/assets/releases/head/docs/Theory_Manual.pdf
DESTINATION docs
PACKAGE_GROUP ogs_docs
)
IF(WIN32)
DownloadAdditionalFilesForPackaging(
URLS http://docs.opengeosys.org/assets/releases/head/win/OGSFileConverter.exe
DESTINATION bin
EXECUTABLE TRUE
PACKAGE_GROUP ogs_converter
)
ENDIF()
IF(APPLE)
DownloadAdditionalFilesForPackaging(
URLS http://docs.opengeosys.org/assets/releases/head/mac/OGSFileConverter
DESTINATION bin
EXECUTABLE TRUE
PACKAGE_GROUP ogs_converter
)
ENDIF()
ENDIF()
INCLUDE (CPack)
......@@ -63,3 +78,9 @@ cpack_add_component(ogs_extras
DESCRIPTION "Miscellaneous tools."
GROUP Utilities
)
cpack_add_component(ogs_docs
DISPLAY_NAME "OpenGeosys documentation"
DESCRIPTION "PDF documentation."
GROUP Utilities
)
......@@ -17,3 +17,48 @@ macro(ConfigureMacOSXBundle TARGET_NAME ICON_FILE_PATH)
SET_SOURCE_FILES_PROPERTIES(${ICON_FILE_PATH} PROPERTIES
MACOSX_PACKAGE_LOCATION Resources)
endmacro()
#
# DownloadAdditionalFilesForPackaging
# -------
#
# Downloads files (into build/AdditionalContent) and packages them. Order of arguments can be arbitrary.
#
# AddTest(
# URLS <multiple URLs>
# DESTINATION <install directory>
# PACKAGE_GROUP <name of the package to add these files to> # optional, defaults to ogs_extras
# EXECUTABLE <TRUE or FALSE, are these files executables?> # optional, defaults to FALSE
# )
function(DownloadAdditionalFilesForPackaging)
# parse args
set(options NONE)
set(oneValueArgs DESTINATION EXECUTABLE PACKAGE_GROUP)
set(multiValueArgs URLS)
cmake_parse_arguments(DownloadAdditionalFilesForPackaging
"${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
# set defaults
if(NOT DownloadAdditionalFilesForPackaging_EXECUTABLE)
set(DownloadAdditionalFilesForPackaging_EXECUTABLE FALSE)
endif()
if(NOT DownloadAdditionalFilesForPackaging_PACKAGE_GROUP)
set(DownloadAdditionalFilesForPackaging_PACKAGE_GROUP ogs_extras)
endif()
foreach(URL ${DownloadAdditionalFilesForPackaging_URLS})
get_filename_component(FILE_NAME ${URL} NAME)
get_filename_component(FILE_EXTENSION ${URL} EXT)
set(FILE_PATH ${CMAKE_BINARY_DIR}/AdditionalContent/${FILE_NAME})
if(NOT EXISTS ${FILE_PATH})
file(DOWNLOAD ${URL} ${FILE_PATH} SHOW_PROGRESS)
endif()
if(EXE)
install(PROGRAMS ${FILE_PATH} DESTINATION ${DownloadAdditionalFilesForPackaging_DESTINATION} COMPONENT ${DownloadAdditionalFilesForPackaging_PACKAGE_GROUP})
else()
install(FILES ${FILE_PATH} DESTINATION ${DownloadAdditionalFilesForPackaging_DESTINATION} COMPONENT ${DownloadAdditionalFilesForPackaging_PACKAGE_GROUP})
endif()
endforeach()
endfunction()
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