247 "# Package: %s" % self.
name,
253 subdirs = [n
for n
in sorted(self.
uses)
254 if not n.startswith(
"LCG_Interfaces/")
255 and n
not in ignored_packages
256 and n
not in data_packages]
261 missing_subdirs = set([s.rsplit(
'/')[-1]
for s
in subdirs]) - set(cache)
263 self.log.warning(
'Missing info cache for subdirs %s',
' '.join(sorted(missing_subdirs)))
270 inc_only =
lambda s: cache.get(s.rsplit(
'/')[-1], {}).
get(
'includes')
271 inc_dirs = filter(inc_only, subdirs)
277 for n
in sorted(self.
uses):
278 if n.startswith(
"LCG_Interfaces/"):
281 if n ==
"PythonLibs":
282 if self.
name not in needing_python:
285 linkopts = self.macros.get(n +
'_linkopts',
'')
286 components = [m.group(1)
or m.group(2)
287 for m
in re.finditer(
r'(?:\$\(%s_linkopts_([^)]*)\))|(?:-l(\w*))' % n,
291 components = [
'CoolKernel',
'CoolApplication']
293 components = [
'CoralBase',
'CoralKernel',
'RelationalAccess']
297 find_packages[n] = find_packages.get(n, []) + components
300 for n
in sorted(find_packages):
302 components = find_packages[n]
305 args.append(
'REQUIRED')
306 args.append(
'COMPONENTS')
307 args.extend(components)
308 data.append(
'find_package(%s)' %
' '.join(args))
312 if self.
name in no_pedantic:
313 data.append(
'string(REPLACE "-pedantic" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")\n')
317 headers = [d
for d
in self.install_more_includes.values()
318 if os.path.isdir(os.path.join(self.
path, d))]
323 data.append(
"include(GaudiObjDesc)")
326 god_headers_dest =
None
328 godargs = [self.
god_headers[
"files"].replace(
"../",
"")]
330 godflags = self.macros.get(
'%sObj2Doth_GODflags' % self.
name,
"")
331 godflags = re.search(
r'-s\s*(\S+)', godflags)
333 god_headers_dest = os.path.normpath(
'Event/' + godflags.group(1))
334 if god_headers_dest ==
'src':
336 godargs.append(
'PRIVATE')
338 godargs.append(
'DESTINATION ' + god_headers_dest)
345 god_dict = [(
'--GOD--',
353 v = v.replace(
"$(%sROOT)/" % self.name.upper(),
"")
354 v = v.replace(
"../",
"")
356 imports = [i.strip(
'"').replace(
'-import=',
'')
for i
in d.get(
'imports',
'').strip().split()]
357 rflx_dict.append((d[
'dictionary'] +
'Dict',
358 [d[
'headerfiles'], d[
'selectionfile']],
363 global_imports = [
extName(name[15:])
364 for name
in self.
uses
365 if name.startswith(
'LCG_Interfaces/')
and self.
uses[name][1]]
366 if 'PythonLibs' in global_imports
and self.
name not in needing_python:
367 global_imports.remove(
'PythonLibs')
369 subdir_imports = [s.rsplit(
'/')[-1]
for s
in subdirs
if self.
uses[s][1]]
371 applications_names = set([a[0]
for a
in self.
applications])
374 isGODDict = isRflxDict = isComp = isApp = isLinker =
False
375 if name ==
'--GOD--':
383 elif name
in applications_names:
387 self.log.warning(
'library %s not declared as component or linker, assume linker', name)
392 cmd =
'gaudi_add_module'
394 cmd =
'god_build_dictionary'
396 cmd =
'gaudi_add_dictionary'
398 cmd =
'gaudi_add_executable'
400 cmd =
'gaudi_add_library'
403 self.log.warning(
"Missing sources for target %s", name)
408 args.append(
'PUBLIC_HEADERS ' +
' '.join(headers))
410 args.append(
'NO_PUBLIC_HEADERS')
413 args.append(
'HEADERS_DESTINATION ' + god_headers_dest)
415 for docname, _, docsources
in self.
documents:
416 if docname ==
'customdict':
417 args.append(
'EXTEND ' + docsources[0].replace(
'../',
''))
428 subdirsnames = [s.rsplit(
'/')[-1]
for s
in subdirs]
429 subdir_local_imports = [i
for i
in imports
if i
in subdirsnames]
430 ext_local_imports = [
extName(i)
for i
in imports
if i
not in subdir_local_imports]
433 links = global_imports + ext_local_imports
434 if links
or inc_dirs:
436 args.append(
'INCLUDE_DIRS ' +
' '.join(links + inc_dirs))
439 not_included = set(links).difference(find_packages, set([s.rsplit(
'/')[-1]
for s
in subdirs]))
441 self.log.warning(
'imports without use: %s',
', '.join(sorted(not_included)))
444 for s
in subdir_imports + subdir_local_imports:
446 links.extend(cache[s][
'libraries'])
448 links.extend(local_links)
454 args.append(
'LINK_LIBRARIES ' +
' '.join([l.strip(
'"')
for l
in links]))
460 local_links.append(name)
463 if name ==
'garbage' and self.
name ==
'FileStager':
464 data.append(
'# only for the applications\nfind_package(Boost COMPONENTS program_options)\n')
467 if not (isGODDict
or isRflxDict):
469 sources = [os.path.normpath(
'src/' + s)
for s
in sources]
471 sources = [s.replace(
'src/$(GAUDICONFROOT)',
'${CMAKE_SOURCE_DIR}/GaudiConf')
for s
in sources]
475 if group
in (
'tests',
'test'):
477 libdata = [
' ' + l
for l
in libdata.splitlines()]
479 libdata.insert(0,
'if(GAUDI_BUILD_TESTS)')
480 libdata.append(
'endif()')
481 libdata =
'\n'.join(libdata)
487 data.append(
"# gen_pyqt_* functions are provided by 'pygraphics'")
489 qrc_files = self.
PyQtResource[
"qrc_files"].replace(
"../",
"")
490 qrc_dest = self.
PyQtResource[
"outputdir"].replace(
"../python/",
"")
491 qrc_target = qrc_dest.replace(
'/',
'.') +
'.Resources'
492 data.append(
'gen_pyqt_resource(%s %s %s)' % (qrc_target, qrc_dest, qrc_files))
494 ui_files = self.
PyQtUIC[
"ui_files"].replace(
"../",
"")
495 ui_dest = self.
PyQtUIC[
"outputdir"].replace(
"../python/",
"")
496 ui_target = qrc_dest.replace(
'/',
'.') +
'.UI'
497 data.append(
'gen_pyqt_uic(%s %s %s)' % (ui_target, ui_dest, ui_files))
502 data.extend([
'# Merge the RELAX rootmaps',
503 'set(rootmapfile ${CMAKE_LIBRARY_OUTPUT_DIRECTORY}/relax.rootmap)',
505 [
'OUTPUT ${rootmapfile}',
506 'COMMAND ${merge_cmd} ${RELAX_ROOTMAPS} ${rootmapfile}',
507 'DEPENDS ${RELAX_ROOTMAPS}']),
508 'add_custom_target(RelaxRootmap ALL DEPENDS ${rootmapfile})',
509 '\n# Install the merged file',
510 'install(FILES ${rootmapfile} DESTINATION lib)\n'])
515 installs.append(
"gaudi_install_headers(%s)" % (
" ".join(headers)))
519 if (self.
name +
'ConfUserModules')
in self.
macros:
520 installs.append(
'set_property(DIRECTORY PROPERTY CONFIGURABLE_USER_MODULES %s)'
522 installs.append(
"gaudi_install_python_modules()")
524 installs.append(
"gaudi_install_scripts()")
526 data.extend(installs)
530 data.extend([
'gaudi_alias({0}\n {1})'.
format(name,
' '.join(alias))
531 for name, alias
in self.aliases.iteritems()])
537 Convert environment variable values from CMT to CMake.
540 s = re.sub(
r'(?<!\\)\$',
'\\$', s)
542 s = re.sub(
r'\$\(([^()]*)\)',
r'${\1}', s)
544 v = re.compile(
r'\$\{(\w*)_root\}')
547 s = s[:m.start()] + (
'${%sROOT}' % m.group(1).upper()) + s[m.end():]
553 [
'SET %s %s' % (v, fixSetValue(self.
sets[v]))
554 for v
in sorted(self.
sets)]))
559 data.append(
"\ngaudi_add_test(QMTest QMTEST)")
561 return "\n".join(data) +
"\n"