-
Notifications
You must be signed in to change notification settings - Fork 24
/
terrama2-fix-bundle.cmake.in
111 lines (94 loc) · 4.24 KB
/
terrama2-fix-bundle.cmake.in
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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
# Copyright (C) 2007 National Institute For Space Research (INPE) - Brazil.
#
# This file is part of TerraMA2 - a free and open source computational
# platform for analysis, monitoring, and alert of geo-environmental extremes.
#
# TerraMA2 is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License,
# or (at your option) any later version.
#
# TerraMA2 is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with TerraMA2. See LICENSE. If not, write to
# TerraMA2 Team at <[email protected]>.
#
#
# Description: FixBundle utility.
#
# Author: Gilberto Ribeiro de Queiroz
# Vinicius Campanha
#
include(BundleUtilities)
set(TERRAMA2_BUILD_AS_BUNDLE @TERRAMA2_BUILD_AS_BUNDLE@)
set(TERRAMA2_DESTINATION_RUNTIME @TERRAMA2_DESTINATION_RUNTIME@)
set(TERRAMA2_DESTINATION_LIBRARY @TERRAMA2_DESTINATION_LIBRARY@)
set(Qt5_DIR @Qt5_DIR@)
set(TERRAMA2_APPLICATION "")
if(WIN32)
file(GLOB_RECURSE TERRAMA2_LIBS ${CMAKE_INSTALL_PREFIX}/bin/*terra*@CMAKE_SHARED_LIBRARY_SUFFIX@)
set(TERRAMA2_APPLICATION "${CMAKE_INSTALL_PREFIX}/bin/terrama2_service.exe")
set(TERRAMA2_LIBRARIES ${TERRAMA2_LIBS})
set(TERRAMA2_DIRS "@_TEBIN@;@Qt5_DIR@/../../../bin;@CMAKE_PREFIX_PATH@")
elseif(APPLE AND TERRAMA2_BUILD_AS_BUNDLE)
set(BU_CHMOD_BUNDLE_ITEMS ON)
file(GLOB_RECURSE TERRALIB_PLGS ${CMAKE_INSTALL_PREFIX}/libterralib_mod*@CMAKE_SHARED_LIBRARY_SUFFIX@)
file(GLOB_RECURSE QT_PLUGINS "${TERRAMA2_APPLICATION}/Contents/qtplugins/*@CMAKE_SHARED_LIBRARY_SUFFIX@")
set(TERRAMA2_APPLICATION "${CMAKE_INSTALL_PREFIX}/terrama2_service.app")
set(TERRAMA2_LIBRARIES ${TERRALIB_PLGS} ${QT_PLUGINS} "${TERRAMA2_APPLICATION}/Contents/MacOS/terrama2_service")
set(TERRAMA2_DIRS "@terralib_DIR@/../..;@Qt5_DIR@/../..")
endif()
if(APPLE AND TERRAMA2_BUILD_AS_BUNDLE)
# Overload function
function(gp_item_default_embedded_path item default_embedded_path_var)
set (is_System FALSE)
set (is_QImageFormat FALSE)
set (is_QIconEngine FALSE)
set (is_QSQLDrivers FALSE)
set (is_QPlatforms FALSE)
set (is_Lib FALSE)
get_filename_component (resolved_file ${item} PATH)
if("${resolved_file}" STREQUAL "")
set (is_Lib TRUE)
elseif(resolved_file MATCHES "^(@rpath)")
set(is_Lib TRUE)
elseif(resolved_file MATCHES "^(/System/Library/|/usr/lib/|/usr/local|@loader_path)")
set(is_System TRUE)
elseif(resolved_file MATCHES "(imageformats)$")
set (is_QImageFormat TRUE)
elseif(resolved_file MATCHES "(iconengines)$")
set (is_QIconEngine TRUE)
elseif(resolved_file MATCHES "(sqldrivers)$")
set (is_QSQLDrivers TRUE)
elseif(resolved_file MATCHES "(platforms)$")
set (is_QPlatforms TRUE)
elseif(resolved_file MATCHES "(lib)$")
set (is_Lib TRUE)
endif()
if(item MATCHES "\\.dylib$")
if(is_System)
set(${default_embedded_path_var} "@executable_path/../lib" PARENT_SCOPE)
elseif(is_QImageFormat)
set(${default_embedded_path_var} "@executable_path/../qtplugins/imageformats" PARENT_SCOPE)
elseif(is_QIconEngine)
set(${default_embedded_path_var} "@executable_path/../qtplugins/iconengines" PARENT_SCOPE)
elseif(is_QSQLDrivers)
set(${default_embedded_path_var} "@executable_path/../qtplugins/sqldrivers" PARENT_SCOPE)
elseif(is_QPlatforms)
set(${default_embedded_path_var} "@executable_path/../qtplugins/platforms" PARENT_SCOPE)
elseif(is_Lib)
set(${default_embedded_path_var} "@executable_path/../lib" PARENT_SCOPE)
else()
set(${default_embedded_path_var} "${resolved_file}" PARENT_SCOPE)
endif()
elseif(item MATCHES "[^/]+\\.framework/")
set(${default_embedded_path_var} "@executable_path/../Frameworks" PARENT_SCOPE)
endif()
endfunction()
endif()
# Call fixup_bundle
fixup_bundle("${TERRAMA2_APPLICATION}" "${TERRAMA2_LIBRARIES}" "${TERRAMA2_DIRS}")