Salome HOME
updated copyright message
[tools/yacsgen.git] / module_generator / hxx_para_tmpl.py
index e8f60e21e0c40e0e08b316e9322411a823b42084..f5676b0b9f9b12ae0722c2779283f57d816c0eda 100644 (file)
@@ -1,9 +1,9 @@
-# Copyright (C) 2009-2012  EDF R&D
+# Copyright (C) 2009-2023  EDF
 #
 # This library is free software; you can redistribute it and/or
 # modify it under the terms of the GNU Lesser General Public
 # License as published by the Free Software Foundation; either
-# version 2.1 of the License.
+# version 2.1 of the License, or (at your option) any later version.
 #
 # This library is distributed in the hope that it will be useful,
 # but WITHOUT ANY WARRANTY; without even the implied warranty of
@@ -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
@@ -131,7 +131,7 @@ class ${component};  // forward declaration
 
 class ${component}_i: ${inheritedclass}
   public POA_${module}_ORB::${component}_Gen,
-  public ParaMEDMEM::ParaMEDMEMComponent_i
+  public MEDCoupling::ParaMEDMEMComponent_i
 {
 
 public:
@@ -190,16 +190,88 @@ ${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) $$(MPI_INCLUDES) ${includes}
-lib${component}Engine_la_LIBADD   = ${libs} -L$$(top_builddir)/idl -lSalomeIDL${module} $${SALOME_LIBS} -lSalomeMPIContainer -lparamedmemcompo $$(FLIBS)
-
-
+#compoMakefile="""
+#
+#dist_lib${component}Engine_la_SOURCES = \
+#      ${component}_i.cxx
+#
+#lib${component}Engine_la_CXXFLAGS = -I$$(top_builddir)/idl  $$(SALOME_INCLUDES) $$(MPI_INCLUDES) ${includes}
+#lib${component}Engine_la_LIBADD   = ${libs} -L$$(top_builddir)/idl -lSalomeIDL${module} $${SALOME_LIBS} -lSalomeMPIContainer -lparamedmemcompo $$(FLIBS)
+#
+#
+#"""
+#
+#compoMakefile=Template(compoMakefile)
+
+
+# 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_hxxpara = """
+# --- options ---
+# additional include directories
+INCLUDE_DIRECTORIES(
+  $${KERNEL_INCLUDE_DIRS}
+  $${OMNIORB_INCLUDE_DIR}
+  $${PROJECT_BINARY_DIR}
+  $${PROJECT_BINARY_DIR}/idl
+  $${MEDCOUPLING_INCLUDE_DIRS}
+  ${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_SalomeMPIContainer}
+  $${MED_paramedmemcompo}
+  $${MED_paramedcouplingcorba}
+  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_hxxpara = Template(cmake_src_compo_hxxpara)
 
 #, SALOME_MED::MED_Gen_Driver, SALOME::MultiCommClass
 interfaceidlhxx="""
@@ -210,5 +282,3 @@ ${services}
 """
 interfaceidlhxx=Template(interfaceidlhxx)
 
-
-compoMakefile=Template(compoMakefile)