243 "# Package: %s" % self.
name,
249 subdirs = [n
for n
in sorted(self.
uses)
250 if not n.startswith(
"LCG_Interfaces/")
251 and n
not in ignored_packages
252 and n
not in data_packages]
257 missing_subdirs = set([s.rsplit(
'/')[-1]
for s
in subdirs]) - set(cache)
259 self.log.warning(
'Missing info cache for subdirs %s',
' '.join(sorted(missing_subdirs)))
266 inc_only =
lambda s: cache.get(s.rsplit(
'/')[-1], {}).
get(
'includes')
267 inc_dirs = filter(inc_only, subdirs)
273 for n
in sorted(self.
uses):
274 if n.startswith(
"LCG_Interfaces/"):
277 if n ==
"PythonLibs":
278 if self.
name not in needing_python:
281 linkopts = self.macros.get(n +
'_linkopts',
'')
282 components = [m.group(1)
or m.group(2)
283 for m
in re.finditer(
r'(?:\$\(%s_linkopts_([^)]*)\))|(?:-l(\w*))' % n,
287 components = [
'CoolKernel',
'CoolApplication']
289 components = [
'CoralBase',
'CoralKernel',
'RelationalAccess']
293 find_packages[n] = find_packages.get(n, []) + components
296 for n
in sorted(find_packages):
298 components = find_packages[n]
301 args.append(
'REQUIRED')
302 args.append(
'COMPONENTS')
303 args.extend(components)
304 data.append(
'find_package(%s)' %
' '.join(args))
308 if self.
name in no_pedantic:
309 data.append(
'string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")\n')
313 headers = [d
for d
in self.install_more_includes.values()
314 if os.path.isdir(os.path.join(self.
path, d))]
319 data.append(
"include(GaudiObjDesc)")
322 god_headers_dest =
None
324 godargs = [self.
god_headers[
"files"].replace(
"../",
"")]
326 godflags = self.macros.get(
'%sObj2Doth_GODflags' % self.
name,
"")
327 godflags = re.search(
r'-s\s*(\S+)', godflags)
329 god_headers_dest = os.path.normpath(
'Event/' + godflags.group(1))
330 if god_headers_dest ==
'src':
332 godargs.append(
'PRIVATE')
334 godargs.append(
'DESTINATION ' + god_headers_dest)
341 god_dict = [(
'--GOD--',
349 v = v.replace(
"$(%sROOT)/" % self.name.upper(),
"")
350 v = v.replace(
"../",
"")
352 imports = [i.strip(
'"').replace(
'-import=',
'')
for i
in d.get(
'imports',
'').strip().split()]
353 rflx_dict.append((d[
'dictionary'] +
'Dict',
354 [d[
'headerfiles'], d[
'selectionfile']],
359 global_imports = [
extName(name[15:])
360 for name
in self.
uses
361 if name.startswith(
'LCG_Interfaces/')
and self.
uses[name][1]]
362 if 'PythonLibs' in global_imports
and self.
name not in needing_python:
363 global_imports.remove(
'PythonLibs')
365 subdir_imports = [s.rsplit(
'/')[-1]
for s
in subdirs
if self.
uses[s][1]]
367 applications_names = set([a[0]
for a
in self.
applications])
370 isGODDict = isRflxDict = isComp = isApp = isLinker =
False
371 if name ==
'--GOD--':
379 elif name
in applications_names:
383 self.log.warning(
'library %s not declared as component or linker, assume linker', name)
388 cmd =
'gaudi_add_module'
390 cmd =
'god_build_dictionary'
392 cmd =
'gaudi_add_dictionary'
394 cmd =
'gaudi_add_executable'
396 cmd =
'gaudi_add_library'
399 self.log.warning(
"Missing sources for target %s", name)
404 args.append(
'PUBLIC_HEADERS ' +
' '.join(headers))
406 args.append(
'NO_PUBLIC_HEADERS')
409 args.append(
'HEADERS_DESTINATION ' + god_headers_dest)
411 for docname, _, docsources
in self.
documents:
412 if docname ==
'customdict':
413 args.append(
'EXTEND ' + docsources[0].replace(
'../',
''))
424 subdirsnames = [s.rsplit(
'/')[-1]
for s
in subdirs]
425 subdir_local_imports = [i
for i
in imports
if i
in subdirsnames]
426 ext_local_imports = [
extName(i)
for i
in imports
if i
not in subdir_local_imports]
429 links = global_imports + ext_local_imports
430 if links
or inc_dirs:
432 args.append(
'INCLUDE_DIRS ' +
' '.join(links + inc_dirs))
435 not_included = set(links).difference(find_packages, set([s.rsplit(
'/')[-1]
for s
in subdirs]))
437 self.log.warning(
'imports without use: %s',
', '.join(sorted(not_included)))
440 for s
in subdir_imports + subdir_local_imports:
442 links.extend(cache[s][
'libraries'])
444 links.extend(local_links)
450 args.append(
'LINK_LIBRARIES ' +
' '.join([l.strip(
'"')
for l
in links]))
456 local_links.append(name)
459 if name ==
'garbage' and self.
name ==
'FileStager':
460 data.append(
'# only for the applications\nfind_package(Boost COMPONENTS program_options)\n')
463 if not (isGODDict
or isRflxDict):
465 sources = [os.path.normpath(
'src/' + s)
for s
in sources]
467 sources = [s.replace(
'src/$(GAUDICONFROOT)',
'${CMAKE_SOURCE_DIR}/GaudiConf')
for s
in sources]
471 if group
in (
'tests',
'test'):
473 libdata = [
' ' + l
for l
in libdata.splitlines()]
475 libdata.insert(0,
'if(GAUDI_BUILD_TESTS)')
476 libdata.append(
'endif()')
477 libdata =
'\n'.join(libdata)
483 data.append(
"# gen_pyqt_* functions are provided by 'pygraphics'")
485 qrc_files = self.
PyQtResource[
"qrc_files"].replace(
"../",
"")
486 qrc_dest = self.
PyQtResource[
"outputdir"].replace(
"../python/",
"")
487 qrc_target = qrc_dest.replace(
'/',
'.') +
'.Resources'
488 data.append(
'gen_pyqt_resource(%s %s %s)' % (qrc_target, qrc_dest, qrc_files))
490 ui_files = self.
PyQtUIC[
"ui_files"].replace(
"../",
"")
491 ui_dest = self.
PyQtUIC[
"outputdir"].replace(
"../python/",
"")
492 ui_target = qrc_dest.replace(
'/',
'.') +
'.UI'
493 data.append(
'gen_pyqt_uic(%s %s %s)' % (ui_target, ui_dest, ui_files))
498 data.extend([
'# Merge the RELAX rootmaps',
499 'set(rootmapfile ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/relax.rootmap)',
501 [
'OUTPUT ${rootmapfile}',
502 'COMMAND ${merge_cmd} ${RELAX_ROOTMAPS} ${rootmapfile}',
503 'DEPENDS ${RELAX_ROOTMAPS}']),
504 'add_custom_target(RelaxRootmap ALL DEPENDS ${rootmapfile})',
505 '\n# Install the merged file',
506 'install(FILES ${rootmapfile} DESTINATION lib)\n'])
511 installs.append(
"gaudi_install_headers(%s)" % (
" ".join(headers)))
515 if (self.
name +
'ConfUserModules')
in self.
macros:
516 installs.append(
'set_property(DIRECTORY PROPERTY CONFIGURABLE_USER_MODULES %s)'
518 installs.append(
"gaudi_install_python_modules()")
520 installs.append(
"gaudi_install_scripts()")
522 data.extend(installs)
528 Convert environment variable values from CMT to CMake.
531 s = re.sub(
r'(?<!\\)\$',
'\\$', s)
533 s = re.sub(
r'\$\(([^()]*)\)',
r'${\1}', s)
535 v = re.compile(
r'\$\{(\w*)_root\}')
538 s = s[:m.start()] + (
'${%sROOT}' % m.group(1).upper()) + s[m.end():]
544 [
'SET %s %s' % (v, fixSetValue(self.
sets[v]))
545 for v
in sorted(self.
sets)]))
550 data.append(
"\ngaudi_add_test(QMTest QMTEST)")
552 return "\n".join(data) +
"\n"