]> git.lyx.org Git - lyx.git/blob - development/cmake/Install.cmake
- German EmbeddedObjects.lyx: tiny beautification by Hartmut
[lyx.git] / development / cmake / Install.cmake
1 # TODO: set correct path
2 #set(CMAKE_INSTALL_PREFIX ${CMAKE_INSTALL_PREFIX})
3
4 # the macro scans the directories "_parent_src_dir/_dir/dir_item" for *._type files 
5 # and installs the files in CMAKE_INSTALL_PREFIX/dir_item
6 # dir_item is on item of the remaining arguments
7 macro(lyx_install _parent_src_dir _dir _file_type)
8         foreach(_current_dir ${ARGN})
9                 file(GLOB files_list ${_parent_src_dir}/${_dir}/${_current_dir}/*.${_file_type})
10                 list(REMOVE_ITEM files_list "${_parent_src_dir}/${_dir}/${_current_dir}/.svn")
11                 install(FILES ${files_list} DESTINATION ${_dir}/${_current_dir})
12                 #message(STATUS "install ${_dir}/${_current_dir}: ${files_list} ")
13                 #message(STATUS "install at ${CMAKE_INSTALL_PREFIX}/${_dir}/${_current_dir}")
14         endforeach(_current_dir)         
15 endmacro(lyx_install)
16
17
18 lyx_install(${TOP_SRC_DIR}/lib bind         bind   . de fi pt sv)
19 lyx_install(${TOP_SRC_DIR}/lib commands     def    .)
20 lyx_install(${TOP_SRC_DIR}/lib doc          lyx    . cs da de es eu fr he hu it nl nb pl pt ro ru sk sl sv)
21 lyx_install(${TOP_SRC_DIR}/lib doc          *      clipart)
22 lyx_install(${TOP_SRC_DIR}/lib doc/es       *      clipart)
23 lyx_install(${TOP_SRC_DIR}/lib examples     *      . ca cs da de es eu fr he hu it nl pl pt ro ru sl)
24 lyx_install(${TOP_SRC_DIR}/lib fonts        *      .)
25 lyx_install(${TOP_SRC_DIR}/lib images       *      . math commands)
26 lyx_install(${TOP_SRC_DIR}/lib kbd          *      .)
27 lyx_install(${TOP_SRC_DIR}/lib layouts      *      .)
28 lyx_install(${TOP_SRC_DIR}/lib lyx2lyx      *      .)
29 lyx_install(${TOP_SRC_DIR}/lib scripts      *      .)
30 lyx_install(${TOP_SRC_DIR}/lib templates    *      .)
31 lyx_install(${TOP_SRC_DIR}/lib tex          *      .)
32 lyx_install(${TOP_SRC_DIR}/lib ui           *      .)
33
34
35
36
37
38 #  
39 #  cmake doku  and  scon code
40 #
41 #    remove later.
42 #
43 #  INSTALL: Specify rules to run at install time.
44 #  This command generates installation rules for a project. Rules specified by calls to this 
45 #  command within a source directory are executed in order during installation. The order across 
46 #  directories is not defined.
47 #  There are multiple signatures for this command. Some of them define installation properties 
48 #  for files and targets. Properties common to multiple signatures are covered here but they are 
49 #  valid only for signatures that specify them. DESTINATION arguments specify the directory 
50 #  on disk to which a file will be installed. If a full path (with a leading slash or drive letter) is 
51 #  given it is used directly. If a relative path is given it is interpreted relative to the value of 
52 #  CMAKE_INSTALL_PREFIX. PERMISSIONS arguments specify permissions for installed 
53 #  files. Valid permissions are OWNER_READ, OWNER_WRITE, OWNER_EXECUTE, 
54 #  GROUP_READ, GROUP_WRITE, GROUP_EXECUTE, WORLD_READ, 
55 #  WORLD_WRITE, WORLD_EXECUTE, SETUID, and SETGID. Permissions that do not 
56 #  make sense on certain platforms are ignored on those platforms. The CONFIGURATIONS 
57 #  argument specifies a list of build configurations for which the install rule applies (Debug, 
58 #  Release, etc.). The COMPONENT argument specifies an installation component name with 
59 #  which the install rule is associated, such as "runtime" or "development". During component-
60 #  specific installation only install rules associated with the given component name will be 
61 #  executed. During a full installation all components are installed. The RENAME argument 
62 #  specifies a name for an installed file that may be different from the original file. Renaming is 
63 #  allowed only when a single file is installed by the command. 
64 #  The TARGETS signature:
65 #    INSTALL(TARGETS targets... [[ARCHIVE|LIBRARY|RUNTIME] 
66 #                                [DESTINATION <dir>] 
67 #                                [PERMISSIONS permissions...] 
68 #                                [CONFIGURATIONS [Debug|Release|...]] 
69 #                                [COMPONENT <component>] 
70 #                               ] [...])
71 #  The TARGETS form specifies rules for installing targets from a project. There are three kinds 
72 #  of target files that may be installed: archive, library, and runtime. Executables are always 
73 #  treated as runtime targets. Static libraries are always treated as archive targets. Module 
74 #  libraries are always treated as library targets. For non-DLL platforms shared libraries are 
75 #  treated as library targets. For DLL platforms the DLL part of a shared library is treated as a 
76 #  runtime target and the corresponding import library is treated as an archive target. All 
77 #  Windows-based systems including Cygwin are DLL platforms. The ARCHIVE, LIBRARY, 
78 #  and RUNTIME arguments change the type of target to which the subsequent properties apply. 
79 #  If none is given the installation properties apply to all target types. If only one is given then 
80 #  only targets of that type will be installed (which can be used to install just a DLL or just an 
81 #  import library).
82 #  One or more groups of properties may be specified in a single call to the TARGETS form of 
83 #  this command. A target may be installed more than once to different locations. Consider 
84 #  hypothetical targets "myExe", "mySharedLib", and "myStaticLib". The code
85 #      INSTALL(TARGETS myExe mySharedLib myStaticLib 
86 #              RUNTIME DESTINATION bin 
87 #              LIBRARY DESTINATION lib 
88 #              ARCHIVE DESTINATION lib/static) 
89 #      INSTALL(TARGETS mySharedLib DESTINATION /some/full/path)
90 #  will install myExe to <prefix>/bin and myStaticLib to <prefix>/lib/static. On non-DLL 
91 #  platforms mySharedLib will be installed to <prefix>/lib and /some/full/path. On DLL 
92 #  platforms the mySharedLib DLL will be installed to <prefix>/bin and /some/full/path and its 
93 #  import library will be installed to <prefix>/lib/static and /some/full/path. On non-DLL 
94 #  platforms mySharedLib will be installed to <prefix>/lib and /some/full/path.
95 #  The FILES signature:
96 #    INSTALL(FILES files... DESTINATION <dir> 
97 #            [PERMISSIONS permissions...] 
98 #            [CONFIGURATIONS [Debug|Release|...]] 
99 #            [COMPONENT <component>] 
100 #            [RENAME <name>])
101 #  The FILES form specifies rules for installing files for a project. File names given as relative 
102 #  paths are interpreted with respect to the current source directory. Files installed by this form 
103 #  are by default given permissions OWNER_WRITE, OWNER_READ, GROUP_READ, and 
104 #  WORLD_READ if no PERMISSIONS argument is given.
105 #  The PROGRAMS signature:
106 #    INSTALL(PROGRAMS files... DESTINATION <dir> 
107 #            [PERMISSIONS permissions...] 
108 #            [CONFIGURATIONS [Debug|Release|...]] 
109 #            [COMPONENT <component>] 
110 #            [RENAME <name>])
111 #  The PROGRAMS form is identical to the FILES form except that the default permissions for 
112 #  the installed file also include OWNER_EXECUTE, GROUP_EXECUTE, and 
113 #  WORLD_EXECUTE. This form is intended to install programs that are not targets, such as 
114 #  shell scripts. Use the TARGETS form to install targets built within the project.
115 #  The SCRIPT and CODE signature:
116 #    INSTALL([[SCRIPT <file>] [CODE <code>]] [...])
117 #  The SCRIPT form will invoke the given CMake script files during installation. If the script 
118 #  file name is a relative path it will be interpreted with respect to the current source directory. 
119 #  The CODE form will invoke the given CMake code during installation. Code is specified as a 
120 #  single argument inside a double-quoted string. For example, the code
121 #    INSTALL(CODE "MESSAGE(\"Sample install message.\")")
122 #  will print a message during installation.
123 #  NOTE: This command supercedes the INSTALL_TARGETS command and the target 
124 #  properties PRE_INSTALL_SCRIPT and POST_INSTALL_SCRIPT. It also replaces the 
125 #  FILES forms of the INSTALL_FILES and INSTALL_PROGRAMS commands. The 
126 #  processing order of these install rules relative to those generated by INSTALL_TARGETS, 
127 #  INSTALL_FILES, and INSTALL_PROGRAMS commands is not defined.
128 #  
129 #  
130 #  
131 #  
132 #  
133 #  
134 #  
135 #  
136 #  if build_install:
137 #      #
138 #      # this part is a bit messy right now. Since scons will provide
139 #      # --DESTDIR option soon, at least the dest_dir handling can be 
140 #      # removed later.
141 #      #
142 #      # how to join dest_dir and prefix
143 #      def joinPaths(path1, path2):
144 #          ''' join path1 and path2, do not use os.path.join because
145 #              under window, c:\destdir\d:\program is invalid '''
146 #          if path1 == '':
147 #              return os.path.normpath(path2)
148 #          # separate drive letter
149 #          (drive, path) = os.path.splitdrive(os.path.normpath(path2))
150 #          # ignore drive letter, so c:\destdir + c:\program = c:\destdir\program
151 #          return os.path.join(os.path.normpath(path1), path[1:])
152 #      #
153 #      # install to dest_dir/prefix
154 #      dest_dir = env.get('DESTDIR', '')
155 #      dest_prefix_dir = joinPaths(dest_dir, env.Dir(prefix).abspath)
156 #      # create the directory if needed
157 #      if not os.path.isdir(dest_prefix_dir):
158 #          try:
159 #              os.makedirs(dest_prefix_dir)
160 #          except:
161 #              pass
162 #          if not os.path.isdir(dest_prefix_dir):
163 #              print 'Can not create directory', dest_prefix_dir
164 #              Exit(3)
165 #      #
166 #      if env.has_key('exec_prefix'):
167 #          bin_dest_dir = joinPaths(dest_dir, Dir(env['exec_prefix']).abspath)
168 #      else:
169 #          bin_dest_dir = os.path.join(dest_prefix_dir, 'bin')
170 #      if add_suffix:
171 #          share_dest_dir = os.path.join(dest_prefix_dir, share_dir + program_suffix)
172 #      else:
173 #          share_dest_dir = os.path.join(dest_prefix_dir, share_dir)
174 #      man_dest_dir = os.path.join(dest_prefix_dir, man_dir)
175 #      locale_dest_dir = os.path.join(dest_prefix_dir, locale_dir)
176 #      env['LYX2LYX_DEST'] = os.path.join(share_dest_dir, 'lyx2lyx')
177 #      #
178 #      import glob
179 #      #
180 #      # install executables (lyxclient may be None)
181 #      #
182 #      if add_suffix:
183 #          version_suffix = program_suffix
184 #      else:
185 #          version_suffix = ''
186 #      #
187 #      # install lyx, if in release mode, try to strip the binary
188 #      if env.has_key('STRIP') and env['STRIP'] is not None and mode != 'debug':
189 #          # create a builder to strip and install
190 #          env['BUILDERS']['StripInstallAs'] = Builder(action='$STRIP $SOURCE -o $TARGET')
191 #  
192 #      # install executables
193 #      for (name, obj) in (('lyx', lyx), ('tex2lyx', tex2lyx), ('client', client)):
194 #          if obj is None:
195 #              continue
196 #          target_name = os.path.split(str(obj[0]))[1].replace(name, '%s%s' % (name, version_suffix))
197 #          target = os.path.join(bin_dest_dir, target_name)
198 #          if env['BUILDERS'].has_key('StripInstallAs'):
199 #              env.StripInstallAs(target, obj)
200 #          else:
201 #              env.InstallAs(target, obj)
202 #          Alias('install', target)
203 #  
204 #      # share/lyx
205 #      dirs = []
206 #      for (dir,files) in [
207 #              ('.', lib_files),  
208 #              ('bind', lib_bind_files),
209 #              ('bind/de', lib_bind_de_files),
210 #              ('bind/fi', lib_bind_fi_files),
211 #              ('bind/pt', lib_bind_pt_files),
212 #              ('bind/sv', lib_bind_sv_files),
213 #              ('doc', lib_doc_files),
214 #              ('doc/clipart', lib_doc_clipart_files),
215 #              ('doc/cs', lib_doc_cs_files),
216 #              ('doc/da', lib_doc_da_files),
217 #              ('doc/de', lib_doc_de_files),
218 #              ('doc/es', lib_doc_es_files),
219 #              ('doc/es/clipart', lib_doc_es_clipart_files),
220 #              ('doc/eu', lib_doc_eu_files),
221 #              ('doc/fr', lib_doc_fr_files),
222 #              ('doc/he', lib_doc_he_files),
223 #              ('doc/hu', lib_doc_hu_files),
224 #              ('doc/it', lib_doc_it_files),
225 #              ('doc/nl', lib_doc_nl_files),
226 #              ('doc/nb', lib_doc_nb_files),
227 #              ('doc/pl', lib_doc_pl_files),
228 #              ('doc/pt', lib_doc_pt_files),
229 #              ('doc/ro', lib_doc_ro_files),
230 #              ('doc/ru', lib_doc_ru_files),
231 #              ('doc/sk', lib_doc_sk_files),
232 #              ('doc/sl', lib_doc_sl_files),
233 #              ('doc/sv', lib_doc_sv_files),
234 #              ('examples', lib_examples_files),
235 #              ('examples/ca', lib_examples_ca_files),
236 #              ('examples/cs', lib_examples_cs_files),
237 #              ('examples/da', lib_examples_da_files),
238 #              ('examples/de', lib_examples_de_files),
239 #              ('examples/es', lib_examples_es_files),
240 #              ('examples/eu', lib_examples_eu_files),
241 #              ('examples/fr', lib_examples_fr_files),
242 #              ('examples/he', lib_examples_he_files),
243 #              ('examples/hu', lib_examples_hu_files),
244 #              ('examples/it', lib_examples_it_files),
245 #              ('examples/nl', lib_examples_nl_files),
246 #              ('examples/pl', lib_examples_pl_files),
247 #              ('examples/pt', lib_examples_pt_files),
248 #              ('examples/ru', lib_examples_ru_files),
249 #              ('examples/sl', lib_examples_sl_files),
250 #              ('examples/ro', lib_examples_ro_files),
251 #              ('fonts', lib_fonts_files),
252 #              ('images', lib_images_files),
253 #              ('images/math', lib_images_math_files),
254 #              ('kbd', lib_kbd_files),
255 #              ('layouts', lib_layouts_files),
256 #              ('lyx2lyx', lib_lyx2lyx_files),
257 #              ('scripts', lib_scripts_files),
258 #              ('templates', lib_templates_files),
259 #              ('tex', lib_tex_files),
260 #              ('ui', lib_ui_files)]:
261 #          dirs.append(env.Install(os.path.join(share_dest_dir, dir),
262 #              [env.subst('$TOP_SRCDIR/lib/%s/%s' % (dir, file)) for file in files]))
263 #      Alias('install', dirs)
264 #  
265 #      # subst and install lyx2lyx_version.py which is not in scons_manifest.py
266 #      env.Depends(share_dest_dir + '/lyx2lyx/lyx2lyx_version.py', '$BUILDDIR/common/config.h')
267 #      env.substFile(share_dest_dir + '/lyx2lyx/lyx2lyx_version.py',
268 #          '$TOP_SRCDIR/lib/lyx2lyx/lyx2lyx_version.py.in')
269 #      Alias('install', share_dest_dir + '/lyx2lyx/lyx2lyx_version.py')
270 #      sys.path.append(share_dest_dir + '/lyx2lyx')
271 #      
272 #      # generate TOC files for each doc
273 #      languages = depend.all_documents(env.Dir('$TOP_SRCDIR/lib/doc').abspath)
274 #      tocs = []
275 #      for lang in languages.keys():
276 #          if os.path.isdir(os.path.join(env.Dir('$TOP_SRCDIR/lib/doc').abspath, lang)):
277 #              toc = env.installTOC(os.path.join(share_dest_dir, 'doc', lang, 'TOC.lyx'),
278 #                  languages[lang])
279 #              tocs.append(toc)
280 #              # doc_toc.build_toc needs a installed version of lyx2lyx to execute
281 #              env.Depends(toc, share_dest_dir + '/lyx2lyx/lyx2lyx_version.py')
282 #          else:
283 #              # this is for English
284 #              toc = env.installTOC(os.path.join(share_dest_dir, 'doc', 'TOC.lyx'),
285 #                  languages[lang])
286 #              tocs.append(toc)
287 #              env.Depends(toc, share_dest_dir + '/lyx2lyx/lyx2lyx_version.py')
288 #      Alias('install', tocs)
289 #      
290 #      if platform_name == 'cygwin':
291 #          # cygwin packaging requires a file /usr/share/doc/Cygwin/foot-vendor-suffix.README
292 #          Cygwin_README = os.path.join(dest_prefix_dir, 'share', 'doc', 'Cygwin', 
293 #              '%s-%s.README' % (package, package_cygwin_version))
294 #          env.InstallAs(Cygwin_README,
295 #              os.path.join(env.subst('$TOP_SRCDIR'), 'README.cygwin'))
296 #          Alias('install', Cygwin_README)
297 #          # also a directory /usr/share/doc/lyx for README etc
298 #          Cygwin_Doc = os.path.join(dest_prefix_dir, 'share', 'doc', package)
299 #          env.Install(Cygwin_Doc, [os.path.join(env.subst('$TOP_SRCDIR'), x) for x in \
300 #              ['INSTALL', 'README', 'README.Cygwin', 'RELEASE-NOTES', 'COPYING', 'ANNOUNCE']])
301 #          Alias('install', Cygwin_Doc)
302 #          # cygwin fonts also need to be installed
303 #          Cygwin_fonts = os.path.join(share_dest_dir, 'fonts')
304 #          env.Install(Cygwin_fonts, 
305 #              [env.subst('$TOP_SRCDIR/development/Win32/packaging/bakoma/%s' % file) \
306 #                    for file in win32_bakoma_fonts])
307 #          Alias('install', Cygwin_fonts)
308 #          # we also need a post installation script
309 #          tmp_script = utils.installCygwinPostinstallScript('/tmp')
310 #          postinstall_path = os.path.join(dest_dir, 'etc', 'postinstall')
311 #          env.Install(postinstall_path, tmp_script)
312 #          Alias('install', postinstall_path)
313 #  
314 #  
315 #      # man
316 #      env.InstallAs(os.path.join(man_dest_dir, 'lyx' + version_suffix + '.1'),
317 #          env.subst('$TOP_SRCDIR/lyx.man'))
318 #      env.InstallAs(os.path.join(man_dest_dir, 'tex2lyx' + version_suffix + '.1'),
319 #          env.subst('$TOP_SRCDIR/src/tex2lyx/tex2lyx.man'))
320 #      env.InstallAs(os.path.join(man_dest_dir, 'lyxclient' + version_suffix + '.1'),
321 #          env.subst('$TOP_SRCDIR/src/client/lyxclient.man'))
322 #      Alias('install', [os.path.join(man_dest_dir, x + version_suffix + '.1') for
323 #          x in ['lyx', 'tex2lyx', 'lyxclient']])
324 #      # locale files?
325 #      # ru.gmo ==> ru/LC_MESSAGES/lyxSUFFIX.mo
326 #      for gmo in gmo_files:
327 #          lan = os.path.split(str(gmo))[1].split('.')[0]
328 #          dest_file = os.path.join(locale_dest_dir, lan, 'LC_MESSAGES', 'lyx' + program_suffix + '.mo')
329 #          env.InstallAs(dest_file, gmo)
330 #          Alias('install', dest_file)
331 #  
332
333