~benomrane-b/avogadro/avogadro

« back to all changes in this revision

Viewing changes to avogadro/src/mac/CompleteBundle.cmake.in

  • Committer: benomrane_b at yahoo
  • Date: 2014-07-02 17:22:21 UTC
  • Revision ID: benomrane_b@yahoo.fr-20140702172221-vf3hdle85h6szhhf
Release version 1.1.1 2013-12-11

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#-- Need this for link line stuff?
 
2
if(COMMAND cmake_policy)
 
3
  cmake_policy(SET CMP0009 NEW)
 
4
endif(COMMAND cmake_policy)
 
5
 
 
6
set(OSX_App "Avogadro.app")
 
7
 
 
8
# gp_item_default_embedded_path item default_embedded_path_var
 
9
#
 
10
# Return the path that others should refer to the item by when the item
 
11
# is embedded inside a bundle.
 
12
#
 
13
# Override on a per-project basis by providing a project-specific
 
14
# gp_item_default_embedded_path_override function.
 
15
#
 
16
function(gp_item_default_embedded_path_override item default_embedded_path_var)
 
17
  #
 
18
  # The assumption here is that all executables in the bundle will be
 
19
  # in same-level-directories inside the bundle. The parent directory
 
20
  # of an executable inside the bundle should be MacOS or a sibling of
 
21
  # MacOS and all embedded paths returned from here will begin with
 
22
  # "@loader_path/../" and will work from all executables in all
 
23
  # such same-level-directories inside the bundle.
 
24
  #
 
25
 
 
26
  # By default, embed things right next to the main bundle executable:
 
27
  #
 
28
  set(install_name_prefix "@executable_path")
 
29
  # -------------------------------------------------------------------
 
30
  # If your application uses plugins then you should consider using the following
 
31
  #  instead but will limit your deployment to OS X 10.4. There is also a patch
 
32
  #  needed for CMake that as of Sept 30, 2008 has NOT been applied to CMake.
 
33
  #  set (install_name_prefix "@loader_path")
 
34
 
 
35
  set(path "${install_name_prefix}/../MacOS")
 
36
 
 
37
  set(overridden 0)
 
38
 
 
39
  # Embed .dylibs in the Libraries Directory
 
40
  #
 
41
  if(item MATCHES "\\.dylib$")
 
42
    # Don't override the Qt plugins
 
43
    if(NOT item MATCHES "libq[a-zA-Z0-9]*\\.dylib$|libphonon_qt7.dylib$")
 
44
      set(path "${install_name_prefix}/../lib")
 
45
      set(overridden 1)
 
46
    endif(NOT item MATCHES "libq[a-zA-Z0-9]*\\.dylib$|libphonon_qt7.dylib$")
 
47
    # Now for the various Qt plugins - I think this is very hackish...
 
48
    if(item MATCHES "plugins/accessible/[a-zA-Z]*\\.dylib$")
 
49
      set(path "${install_name_prefix}/../plugins/accessible")
 
50
      set(overridden 1)
 
51
    endif(item MATCHES "plugins/accessible/[a-zA-Z]*\\.dylib$")
 
52
    if(item MATCHES "plugins/bearer/[a-zA-Z]*\\.dylib$")
 
53
      set(path "${install_name_prefix}/../plugins/bearer")
 
54
      set(overridden 1)
 
55
    endif(item MATCHES "plugins/bearer/[a-zA-Z]*\\.dylib$")
 
56
    if(item MATCHES "plugins/designer/[a-zA-Z]*\\.dylib$")
 
57
      set(path "${install_name_prefix}/../plugins/designer")
 
58
      set(overridden 1)
 
59
    endif(item MATCHES "plugins/designer/[a-zA-Z]*\\.dylib$")
 
60
    if(item MATCHES "plugins/codecs/[a-zA-Z]*\\.dylib$")
 
61
      set(path "${install_name_prefix}/../plugins/codecs")
 
62
      set(overridden 1)
 
63
    endif(item MATCHES "plugins/codecs/[a-zA-Z]*\\.dylib$")
 
64
    if(item MATCHES "plugins/graphicssystems/[a-zA-Z]*\\.dylib$")
 
65
      set(path "${install_name_prefix}/../plugins/graphicssystems")
 
66
      set(overridden 1)
 
67
    endif(item MATCHES "plugins/graphicssystems/[a-zA-Z]*\\.dylib$")
 
68
    if(item MATCHES "plugins/iconengines/[a-zA-Z]*\\.dylib$")
 
69
      set(path "${install_name_prefix}/../plugins/iconengines")
 
70
      set(overridden 1)
 
71
    endif(item MATCHES "plugins/iconengines/[a-zA-Z]*\\.dylib$")
 
72
    if(item MATCHES "plugins/imageformats/[a-zA-Z]*\\.dylib$")
 
73
      set(path "${install_name_prefix}/../plugins/imageformats")
 
74
      set(overridden 1)
 
75
    endif(item MATCHES "plugins/imageformats/[a-zA-Z]*\\.dylib$")
 
76
    if(item MATCHES "plugins/mediaservices/[a-zA-Z]*\\.dylib$")
 
77
      set(path "${install_name_prefix}/../plugins/mediaservices")
 
78
      set(overridden 1)
 
79
    endif(item MATCHES "plugins/mediaservices/[a-zA-Z]*\\.dylib$")
 
80
    if(item MATCHES "plugins/phonon_backend/[a-zA-Z]*\\.dylib$")
 
81
      set(path "${install_name_prefix}/../plugins/phonon_backend")
 
82
      set(overridden 1)
 
83
    endif(item MATCHES "plugins/phonon_backend/[a-zA-Z]*\\.dylib$")
 
84
    if(item MATCHES "plugins/script/[a-zA-Z]*\\.dylib$")
 
85
      set(path "${install_name_prefix}/../plugins/script")
 
86
      set(overridden 1)
 
87
    endif(item MATCHES "plugins/script/[a-zA-Z]*\\.dylib$")
 
88
    if(item MATCHES "plugins/sqldrivers/[a-zA-Z]*\\.dylib$")
 
89
      set(path "${install_name_prefix}/../plugins/sqldrivers")
 
90
      set(overridden 1)
 
91
    endif(item MATCHES "plugins/sqldrivers/[a-zA-Z]*\\.dylib$")
 
92
  endif(item MATCHES "\\.dylib$")
 
93
 
 
94
  # Embed .so plugin files in their directories
 
95
  #
 
96
  if(item MATCHES "tool\\.so$")
 
97
    set(path "${install_name_prefix}/../lib/avogadro/tools")
 
98
    set(overridden 1)
 
99
  endif(item MATCHES "tool\\.so$")
 
100
  if(item MATCHES "engine\\.so$")
 
101
    set(path "${install_name_prefix}/../lib/avogadro/engines")
 
102
    set(overridden 1)
 
103
  endif(item MATCHES "engine\\.so$")
 
104
  if(item MATCHES "extension\\.so$")
 
105
    set(path "${install_name_prefix}/../lib/avogadro/extensions")
 
106
    set(overridden 1)
 
107
  endif(item MATCHES "extension\\.so$")
 
108
  if(item MATCHES "color\\.so$")
 
109
    set(path "${install_name_prefix}/../lib/avogadro/colors")
 
110
    set(overridden 1)
 
111
  endif(item MATCHES "color\\.so$")
 
112
 
 
113
  if(item MATCHES "format\\.so$")
 
114
    set(path "${install_name_prefix}/../lib/openbabel")
 
115
    set(overridden 1)
 
116
  endif(item MATCHES "format\\.so$")
 
117
  if(item MATCHES "Interface\\.so$")
 
118
    set(path "${install_name_prefix}/../lib/openbabel")
 
119
    set(overridden 1)
 
120
  endif(item MATCHES "Interface\\.so$")
 
121
  if(item MATCHES "chemdrawcdx.so$|chemdrawct.so$|molreport.so$|pubchem.so")
 
122
    set(path "${install_name_prefix}/../lib/openbabel")
 
123
    set(overridden 1)
 
124
  endif(item MATCHES "chemdrawcdx.so$|chemdrawct.so$|molreport.so$|pubchem.so")
 
125
 
 
126
  # Embed frameworks in the embedded "Frameworks" directory (sibling of MacOS):
 
127
  #
 
128
  if(NOT overridden)
 
129
    if(item MATCHES "[^/]+\\.framework/")
 
130
      set(path "${install_name_prefix}/../Frameworks")
 
131
      set(overridden 1)
 
132
    endif(item MATCHES "[^/]+\\.framework/")
 
133
  endif(NOT overridden)
 
134
 
 
135
  message(STATUS "Item: ${item}, new path ${path}")
 
136
  set(${default_embedded_path_var} "${path}" PARENT_SCOPE)
 
137
endfunction(gp_item_default_embedded_path_override)
 
138
 
 
139
# -- Copy the App bundle to the installation location first
 
140
EXECUTE_PROCESS(COMMAND "@OSX_MAKE_STANDALONE_BUNDLE_BASH_SCRIPT@")
 
141
 
 
142
file(GLOB_RECURSE pluginList "$ENV{DESTDIR}/Applications/${OSX_App}/Contents/lib/avogadro/*.so")
 
143
 
 
144
file(GLOB obList "$ENV{DESTDIR}/Applications/${OSX_App}/Contents/lib/openbabel/*")
 
145
file(GLOB_RECURSE qtPluginList "$ENV{DESTDIR}/Applications/${OSX_App}/Contents/plugins/*.dylib")
 
146
 
 
147
message(STATUS "PluginList: ${qtPluginList}")
 
148
 
 
149
# -- Run the BundleUtilities cmake code
 
150
include(BundleUtilities)
 
151
fixup_bundle("$ENV{DESTDIR}/Applications/${OSX_App}"
 
152
  "${pluginList};${obList};${qtPluginList}"
 
153
  "@LIB_INSTALL_DIR@;@LIB_INSTALL_DIR@/avogadro/tools;@LIB_INSTALL_DIR@/avogadro/engines;@LIB_INSTALL_DIR@/avogadro/colors;@LIB_INSTALL_DIR@/avogadro/extensions;$ENV{DESTDIR}/Applications/${OSX_App}/Contents/plugins/accessible;$ENV{DESTDIR}/Applications/${OSX_App}/Contents/plugins/designer;$ENV{DESTDIR}/Applications/${OSX_App}/Contents/plugins/iconengines;$ENV{DESTDIR}/Applications/${OSX_App}/Contents/plugins/phonon_backend;$ENV{DESTDIR}/Applications/${OSX_App}/Contents/plugins/sqldrivers;$ENV{DESTDIR}/Applications/${OSX_App}/Contents/plugins/codecs;$ENV{DESTDIR}/Applications/${OSX_App}/Contents/plugins/graphicssystems;$ENV{DESTDIR}/Applications/${OSX_App}/Contents/plugins/imageformats;$ENV{DESTDIR}/Applications/${OSX_App}/Contents/plugins/script")