From 846210822f4e0ec9d2ea37ea18c75a407b4e31c8 Mon Sep 17 00:00:00 2001
From: Lars Bilke <lars.bilke@ufz.de>
Date: Wed, 4 Jan 2017 21:29:44 +0100
Subject: [PATCH] [CMake] Simplified packaging.

- Works on Mac
- Needs to be checked on Linux / Windows.
---
 Applications/CLI/CMakeLists.txt               |  3 ---
 Applications/DataExplorer/DataExplorer.cmake  | 21 ++-----------------
 CMakeLists.txt                                |  1 -
 ThirdParty/CMakeLists.txt                     |  6 +-----
 .../packaging/InstallXmlSchemaFiles.cmake     |  6 +-----
 5 files changed, 4 insertions(+), 33 deletions(-)

diff --git a/Applications/CLI/CMakeLists.txt b/Applications/CLI/CMakeLists.txt
index 2c7aafaac83..4f65bdb9446 100644
--- a/Applications/CLI/CMakeLists.txt
+++ b/Applications/CLI/CMakeLists.txt
@@ -33,6 +33,3 @@ cpack_add_component(ogs_cli
     DESCRIPTION "The command line interface for OpenGeoSys."
     GROUP Applications
 )
-
-include(packaging/InstallDependencies)
-InstallDependencies(ogs)
diff --git a/Applications/DataExplorer/DataExplorer.cmake b/Applications/DataExplorer/DataExplorer.cmake
index 4a8d7728ace..0fc092d5ac8 100644
--- a/Applications/DataExplorer/DataExplorer.cmake
+++ b/Applications/DataExplorer/DataExplorer.cmake
@@ -40,7 +40,7 @@ source_group("UI Files" FILES ${UIS})
 set(APP_ICON ${SOURCE_DIR_REL}/scripts/packaging/ogs-de-icon.icns)
 
 # Create the executable
-add_executable(DataExplorer MACOSX_BUNDLE
+add_executable(DataExplorer
     main.cpp
     ${SOURCES}
     ${UIS}
@@ -103,18 +103,7 @@ set_property(TARGET DataExplorer PROPERTY FOLDER "DataExplorer")
 ####################
 ### Installation ###
 ####################
-if(APPLE)
-    include(packaging/PackagingMacros)
-    ConfigureMacOSXBundle(DataExplorer ${APP_ICON})
-
-    install(TARGETS DataExplorer DESTINATION .)
-    set(CMAKE_INSTALL_SYSTEM_RUNTIME_DESTINATION .)
-    include(InstallRequiredSystemLibraries)
-    include(DeployQt4)
-    INSTALL_QT4_EXECUTABLE(DataExplorer.app "" "" "${CONAN_LIB_DIRS}" "" "" ogs_gui)
-else()
-    install(TARGETS DataExplorer RUNTIME DESTINATION bin COMPONENT ogs_gui)
-endif()
+install(TARGETS DataExplorer RUNTIME DESTINATION bin COMPONENT ogs_gui)
 
 cpack_add_component(ogs_gui
     DISPLAY_NAME "OGS Data Explorer"
@@ -123,9 +112,3 @@ cpack_add_component(ogs_gui
 )
 set(CPACK_PACKAGE_EXECUTABLES ${CPACK_PACKAGE_EXECUTABLES} "DataExplorer" "OGS Data Explorer" PARENT_SCOPE)
 set(CPACK_NSIS_MENU_LINKS ${CPACK_NSIS_MENU_LINKS} "bin/DataExplorer.exe" "Data Explorer" PARENT_SCOPE)
-if(APPLE)
-    return()
-endif()
-
-include(packaging/InstallDependencies)
-InstallDependencies(DataExplorer)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 65d3aac1c36..825e2ba6ca8 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -244,4 +244,3 @@ configure_file("${CMAKE_CURRENT_SOURCE_DIR}/BaseLib/BuildInfo.cpp.in"
     "${CMAKE_CURRENT_BINARY_DIR}/BaseLib/BuildInfo.cpp" @ONLY)
 
 include(scripts/cmake/MarkVariablesAdvanced.cmake)
-include(scripts/cmake/packaging/GetDependencies.cmake)
diff --git a/ThirdParty/CMakeLists.txt b/ThirdParty/CMakeLists.txt
index 9ce23dbd69d..57e0d5402a6 100644
--- a/ThirdParty/CMakeLists.txt
+++ b/ThirdParty/CMakeLists.txt
@@ -28,11 +28,7 @@ endif()
 # tetgen
 if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tetgen/CMakeLists.txt)
     add_subdirectory(tetgen)
-    if(APPLE AND OGS_BUILD_GUI)
-        install (PROGRAMS $<TARGET_FILE:tetgen> DESTINATION DataExplorer.app/Contents/MacOS COMPONENT ogs_extras)
-    else()
-        install (PROGRAMS $<TARGET_FILE:tetgen> DESTINATION bin COMPONENT ogs_extras)
-    endif()
+    install (PROGRAMS $<TARGET_FILE:tetgen> DESTINATION bin COMPONENT ogs_extras)
 endif()
 
 # vtkdiff
diff --git a/scripts/cmake/packaging/InstallXmlSchemaFiles.cmake b/scripts/cmake/packaging/InstallXmlSchemaFiles.cmake
index 3a5d8e072a1..0a5d8e6882e 100644
--- a/scripts/cmake/packaging/InstallXmlSchemaFiles.cmake
+++ b/scripts/cmake/packaging/InstallXmlSchemaFiles.cmake
@@ -1,8 +1,4 @@
 macro(InstallXmlSchemaFiles GLOB_EXPRESSION)
     file(GLOB XSD_FILES . ${GLOB_EXPRESSION})
-    if(APPLE AND OGS_BUILD_GUI)
-        install(FILES ${XSD_FILES} DESTINATION ${CMAKE_BINARY_DIR}/_CPack_Packages/Darwin/DragNDrop/${CPACK_PACKAGE_FILE_NAME}/ALL_IN_ONE/DataExplorer.app/Contents/MacOS COMPONENT ogs_gui)
-    else()
-        install(FILES ${XSD_FILES} DESTINATION bin COMPONENT ogs_cli)
-    endif()
+    install(FILES ${XSD_FILES} DESTINATION bin COMPONENT ogs_cli)
 endmacro()
-- 
GitLab