-# Copyright (C) 2009-2013 EDF R&D
+# Copyright (C) 2009-2019 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
# 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
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
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}
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)