Salome HOME
[EDF30399] : Expose replay-dir parameter to define directory holding scenarii in...
[modules/yacs.git] / src / runtime_swig / CMakeLists.txt
index fd96ad4f627a938f595e8798d90bd2185646e148..90efb777f50b70b6b4f6c3ff39063d11ef56e433 100644 (file)
@@ -1,9 +1,9 @@
-# Copyright (C) 2012-2013  CEA/DEN, EDF R&D, OPEN CASCADE
+# Copyright (C) 2012-2024  CEA, 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
@@ -27,9 +27,11 @@ ENDIF(SALOME_YACS_USE_KERNEL)
 
 # additional include directories
 INCLUDE_DIRECTORIES(
+  ${CMAKE_CURRENT_SOURCE_DIR}
   ${SALOME_INCL_PATH}
   ${PTHREAD_INCLUDE_DIRS}
   ${OMNIORB_INCLUDE_DIR}
+  ${OMNIORBPY_INCLUDE_DIR}
   ${LIBXML2_INCLUDE_DIR}
   ${PYTHON_INCLUDE_DIRS}
   ${PROJECT_BINARY_DIR}/idl
@@ -40,9 +42,6 @@ INCLUDE_DIRECTORIES(
   ${PROJECT_SOURCE_DIR}/src/engine_swig
   ${PROJECT_SOURCE_DIR}/src/runtime
 )
-IF(WIN32)
-  ADD_DEFINITIONS(-DNOGDI)
-ENDIF(WIN32)
 
 # swig flags
 SET_SOURCE_FILES_PROPERTIES(SALOMERuntime.i PROPERTIES 
@@ -55,12 +54,16 @@ SET_PROPERTY(SOURCE SALOMERuntime.i PROPERTY
 ADD_DEFINITIONS(
   ${PYTHON_DEFINITIONS}
   ${OMNIORB_DEFINITIONS}
-  -DYACS_PTHREAD
   )
 
+ADD_LIBRARY(YACSRuntimePython ThreadLauncher.cxx)
+TARGET_LINK_LIBRARIES(YACSRuntimePython YACSRuntimeSALOME ${PYTHON_LIBRARIES} )
+INSTALL(TARGETS YACSRuntimePython EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS})
+
 # libraries to link to
 SET(_link_LIBRARIES
   YACSRuntimeSALOME
+  YACSRuntimePython
   ${PYTHON_LIBRARIES}
   ${OMNIORB_LIBRARIES}
   )
@@ -96,20 +99,25 @@ SET(SWIGINCLUDES
   ${PROJECT_SOURCE_DIR}/src/runtime/CORBAPorts.hxx
   ${PROJECT_SOURCE_DIR}/src/runtime/TypeConversions.hxx
   ${PROJECT_SOURCE_DIR}/src/runtime/SalomeOptimizerLoop.hxx
+  ${PROJECT_SOURCE_DIR}/src/runtime/VisitorSalomeSaveState.hxx
   )
-SWIG_ADD_MODULE(SALOMERuntime python SALOMERuntime.i)
-ADD_DEPENDENCIES(_SALOMERuntime 
-                  SALOMERuntime.i 
-                  ${PROJECT_SOURCE_DIR}/src/engine_swig/pilot.i 
-                  ${PROJECT_SOURCE_DIR}/src/engine_swig/engtypemaps.i 
-                  docruntime.i 
-                  ${SWIGINCLUDES})
+SET(SWIG_MODULE_SALOMERuntime_EXTRA_DEPS 
+    ${PROJECT_SOURCE_DIR}/src/engine_swig/pilot.i 
+    ${PROJECT_SOURCE_DIR}/src/engine_swig/engtypemaps.i  
+    ${SWIGINCLUDES})
+
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0") 
+  SWIG_ADD_MODULE(SALOMERuntime python SALOMERuntime.i)
+ELSE()
+  SWIG_ADD_LIBRARY(SALOMERuntime LANGUAGE python SOURCES SALOMERuntime.i)
+ENDIF()
 
 SWIG_LINK_LIBRARIES(SALOMERuntime ${_link_LIBRARIES})
+SWIG_CHECK_GENERATION(SALOMERuntime)
 IF(WIN32)
   SET_TARGET_PROPERTIES(_SALOMERuntime PROPERTIES DEBUG_OUTPUT_NAME _SALOMERuntime_d)
 ENDIF(WIN32)
 
 INSTALL(TARGETS ${SWIG_MODULE_SALOMERuntime_REAL_NAME} DESTINATION ${SALOME_INSTALL_PYTHON})
 
-SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}"  ${SALOME_INSTALL_PYTHON})
+SALOME_INSTALL_SCRIPTS("${_swig_SCRIPTS}"  ${SALOME_INSTALL_PYTHON} EXTRA_DPYS "${SWIG_MODULE_SALOMERuntime_REAL_NAME}")