248 "# Package: %s" % self.
name,
254 subdirs = [n
for n
in sorted(self.
uses)
255 if not n.startswith(
"LCG_Interfaces/")
256 and n
not in ignored_packages
257 and n
not in data_packages]
262 missing_subdirs = set([s.rsplit(
'/')[-1]
for s
in subdirs]) - set(cache)
264 self.log.warning(
'Missing info cache for subdirs %s',
' '.join(sorted(missing_subdirs)))
271 inc_only =
lambda s: cache.get(s.rsplit(
'/')[-1], {}).
get(
'includes')
272 inc_dirs = filter(inc_only, subdirs)
278 for n
in sorted(self.
uses):
279 if n.startswith(
"LCG_Interfaces/"):
282 if n ==
"PythonLibs":
283 if self.
name not in needing_python:
286 linkopts = self.macros.get(n +
'_linkopts',
'')
287 components = [m.group(1)
or m.group(2)
288 for m
in re.finditer(
r'(?:\$\(%s_linkopts_([^)]*)\))|(?:-l(\w*))' % n,
292 components = [
'CoolKernel',
'CoolApplication']
294 components = [
'CoralBase',
'CoralKernel',
'RelationalAccess']
298 find_packages[n] = find_packages.get(n, []) + components
301 for n
in sorted(find_packages):
303 components = find_packages[n]
306 args.append(
'REQUIRED')
307 args.append(
'COMPONENTS')
308 args.extend(components)
309 data.append(
'find_package(%s)' %
' '.join(args))
313 if self.
name in no_pedantic:
314 data.append(
'string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")\n')
318 headers = [d
for d
in self.install_more_includes.values()
319 if os.path.isdir(os.path.join(self.
path, d))]
324 data.append(
"include(GaudiObjDesc)")
327 god_headers_dest =
None
329 godargs = [self.
god_headers[
"files"].replace(
"../",
"")]
331 godflags = self.macros.get(
'%sObj2Doth_GODflags' % self.
name,
"")
332 godflags = re.search(
r'-s\s*(\S+)', godflags)
334 god_headers_dest = os.path.normpath(
'Event/' + godflags.group(1))
335 if god_headers_dest ==
'src':
337 godargs.append(
'PRIVATE')
339 godargs.append(
'DESTINATION ' + god_headers_dest)
346 god_dict = [(
'--GOD--',
354 v = v.replace(
"$(%sROOT)/" % self.name.upper(),
"")
355 v = v.replace(
"../",
"")
357 imports = [i.strip(
'"').replace(
'-import=',
'')
for i
in d.get(
'imports',
'').strip().split()]
358 rflx_dict.append((d[
'dictionary'] +
'Dict',
359 [d[
'headerfiles'], d[
'selectionfile']],
364 global_imports = [
extName(name[15:])
365 for name
in self.
uses
366 if name.startswith(
'LCG_Interfaces/')
and self.
uses[name][1]]
367 if 'PythonLibs' in global_imports
and self.
name not in needing_python:
368 global_imports.remove(
'PythonLibs')
370 subdir_imports = [s.rsplit(
'/')[-1]
for s
in subdirs
if self.
uses[s][1]]
372 applications_names = set([a[0]
for a
in self.
applications])
375 isGODDict = isRflxDict = isComp = isApp = isLinker =
False
376 if name ==
'--GOD--':
384 elif name
in applications_names:
388 self.log.warning(
'library %s not declared as component or linker, assume linker', name)
393 cmd =
'gaudi_add_module'
395 cmd =
'god_build_dictionary'
397 cmd =
'gaudi_add_dictionary'
399 cmd =
'gaudi_add_executable'
401 cmd =
'gaudi_add_library'
404 self.log.warning(
"Missing sources for target %s", name)
409 args.append(
'PUBLIC_HEADERS ' +
' '.join(headers))
411 args.append(
'NO_PUBLIC_HEADERS')
414 args.append(
'HEADERS_DESTINATION ' + god_headers_dest)
416 for docname, _, docsources
in self.
documents:
417 if docname ==
'customdict':
418 args.append(
'EXTEND ' + docsources[0].replace(
'../',
''))
429 subdirsnames = [s.rsplit(
'/')[-1]
for s
in subdirs]
430 subdir_local_imports = [i
for i
in imports
if i
in subdirsnames]
431 ext_local_imports = [
extName(i)
for i
in imports
if i
not in subdir_local_imports]
434 links = global_imports + ext_local_imports
435 if links
or inc_dirs:
437 args.append(
'INCLUDE_DIRS ' +
' '.join(links + inc_dirs))
440 not_included = set(links).difference(find_packages, set([s.rsplit(
'/')[-1]
for s
in subdirs]))
442 self.log.warning(
'imports without use: %s',
', '.join(sorted(not_included)))
445 for s
in subdir_imports + subdir_local_imports:
447 links.extend(cache[s][
'libraries'])
449 links.extend(local_links)
455 args.append(
'LINK_LIBRARIES ' +
' '.join([l.strip(
'"')
for l
in links]))
461 local_links.append(name)
464 if name ==
'garbage' and self.
name ==
'FileStager':
465 data.append(
'# only for the applications\nfind_package(Boost COMPONENTS program_options)\n')
468 if not (isGODDict
or isRflxDict):
470 sources = [os.path.normpath(
'src/' + s)
for s
in sources]
472 sources = [s.replace(
'src/$(GAUDICONFROOT)',
'${CMAKE_SOURCE_DIR}/GaudiConf')
for s
in sources]
476 if group
in (
'tests',
'test'):
478 libdata = [
' ' + l
for l
in libdata.splitlines()]
480 libdata.insert(0,
'if(GAUDI_BUILD_TESTS)')
481 libdata.append(
'endif()')
482 libdata =
'\n'.join(libdata)
488 data.append(
"# gen_pyqt_* functions are provided by 'pygraphics'")
490 qrc_files = self.
PyQtResource[
"qrc_files"].replace(
"../",
"")
491 qrc_dest = self.
PyQtResource[
"outputdir"].replace(
"../python/",
"")
492 qrc_target = qrc_dest.replace(
'/',
'.') +
'.Resources'
493 data.append(
'gen_pyqt_resource(%s %s %s)' % (qrc_target, qrc_dest, qrc_files))
495 ui_files = self.
PyQtUIC[
"ui_files"].replace(
"../",
"")
496 ui_dest = self.
PyQtUIC[
"outputdir"].replace(
"../python/",
"")
497 ui_target = qrc_dest.replace(
'/',
'.') +
'.UI'
498 data.append(
'gen_pyqt_uic(%s %s %s)' % (ui_target, ui_dest, ui_files))
503 data.extend([
'# Merge the RELAX rootmaps',
504 'set(rootmapfile ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/relax.rootmap)',
506 [
'OUTPUT ${rootmapfile}',
507 'COMMAND ${merge_cmd} ${RELAX_ROOTMAPS} ${rootmapfile}',
508 'DEPENDS ${RELAX_ROOTMAPS}']),
509 'add_custom_target(RelaxRootmap ALL DEPENDS ${rootmapfile})',
510 '\n# Install the merged file',
511 'install(FILES ${rootmapfile} DESTINATION lib)\n'])
516 installs.append(
"gaudi_install_headers(%s)" % (
" ".join(headers)))
520 if (self.
name +
'ConfUserModules')
in self.
macros:
521 installs.append(
'set_property(DIRECTORY PROPERTY CONFIGURABLE_USER_MODULES %s)'
523 installs.append(
"gaudi_install_python_modules()")
525 installs.append(
"gaudi_install_scripts()")
527 data.extend(installs)
531 data.extend([
'gaudi_alias({0}\n {1})'.
format(name,
' '.join(alias))
532 for name, alias
in self.aliases.iteritems()])
538 Convert environment variable values from CMT to CMake.
541 s = re.sub(
r'(?<!\\)\$',
'\\$', s)
543 s = re.sub(
r'\$\(([^()]*)\)',
r'${\1}', s)
545 v = re.compile(
r'\$\{(\w*)_root\}')
548 s = s[:m.start()] + (
'${%sROOT}' % m.group(1).upper()) + s[m.end():]
554 [
'SET %s %s' % (v, fixSetValue(self.
sets[v]))
555 for v
in sorted(self.
sets)]))
560 data.append(
"\ngaudi_add_test(QMTest QMTEST)")
562 return "\n".join(data) +
"\n"