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