Salome HOME
Python3 porting for Examples.
[tools/yacsgen.git] / module_generator / hxx_tmpl.py
index 0756f314362f865adab808050c5735ac3d572de6..a5f5dfcca9a6f1ce0c0b6ab7b4fc25e9351bb8db 100644 (file)
@@ -1,4 +1,4 @@
-# Copyright (C) 2009-2014  EDF R&D
+# Copyright (C) 2009-2016  EDF R&D
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
@@ -20,7 +20,7 @@
 try:
   from string import Template
 except:
-  from compat import Template,set
+  from module_generator.compat import Template,set
 
 cxxCompo="""
 // this cxx file was generated by yacsgen
@@ -164,17 +164,6 @@ ${body}
 cxxService=Template(cxxService)
 
 
-compoMakefile="""
-
-dist_lib${component}Engine_la_SOURCES = \
-       ${component}_i.cxx
-
-lib${component}Engine_la_CXXFLAGS = -I$$(top_builddir)/idl  $$(SALOME_INCLUDES) ${includes}
-lib${component}Engine_la_LIBADD   = ${libs} -L$$(top_builddir)/idl -lSalomeIDL${module} $${SALOME_LIBS} $$(FLIBS)
-
-
-"""
-
 #, SALOME_MED::MED_Gen_Driver, SALOME::MultiCommClass
 interfaceidlhxx="""
   interface ${component}_Gen: ${inherited}
@@ -185,4 +174,75 @@ ${services}
 interfaceidlhxx=Template(interfaceidlhxx)
 
 
-compoMakefile=Template(compoMakefile)
+
+# Makefile
+
+# CMakeLists.txt in src/<component>
+# template parameters:
+#   module : module name
+#   component : component name
+#   componentlib : name of the target library
+#   includes : additional headers, separated by spaces or \n. can be empty
+#   libs : additional libraries
+#   find_libs : find_library commands
+#   target_properties : additional properties of the target
+cmake_src_compo_hxx = """
+# --- options ---
+# additional include directories
+INCLUDE_DIRECTORIES(
+  $${KERNEL_INCLUDE_DIRS}
+  $${OMNIORB_INCLUDE_DIR}
+  $${PROJECT_BINARY_DIR}
+  $${PROJECT_BINARY_DIR}/idl
+  ${includes}
+)
+
+# --- definitions ---
+ADD_DEFINITIONS(
+  $${OMNIORB_DEFINITIONS}
+)
+
+# find additional libraries
+${find_libs}
+
+# libraries to link to
+SET(_link_LIBRARIES
+  $${OMNIORB_LIBRARIES}
+  $${KERNEL_SalomeIDLKernel}
+  $${KERNEL_OpUtil}
+  $${KERNEL_SalomeContainer}
+  $${KERNEL_SalomeDSCContainer}
+  $${KERNEL_SalomeDSCSuperv}
+  $${KERNEL_SalomeDatastream}
+  $${KERNEL_SalomeDSCSupervBasic}
+  $${KERNEL_CalciumC}
+  SalomeIDL${module}
+  ${libs}
+)
+
+# --- headers ---
+
+# header files / no moc processing
+
+SET(${module}_HEADERS
+  ${component}_i.hxx
+)
+
+# --- sources ---
+
+# sources / static
+SET(${module}_SOURCES
+  ${component}_i.cxx
+)
+
+# --- rules ---
+
+ADD_LIBRARY(${componentlib} $${${module}_SOURCES})
+TARGET_LINK_LIBRARIES(${componentlib} $${_link_LIBRARIES} )
+${target_properties}
+
+INSTALL(TARGETS ${componentlib} EXPORT $${PROJECT_NAME}TargetGroup DESTINATION $${SALOME_INSTALL_LIBS})
+
+INSTALL(FILES $${${module}_HEADERS} DESTINATION $${SALOME_INSTALL_HEADERS})
+"""
+cmake_src_compo_hxx = Template(cmake_src_compo_hxx)