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