IF(WIN32)
LIST(APPEND CMAKE_LIBRARY_PATH "${_python_dir}/libs" ABSOLUTE)
LIST(APPEND CMAKE_INCLUDE_PATH "${_python_dir}/include" ABSOLUTE)
+ SET(PYTHON_INCLUDE_DIR "${_python_dir}/include")
ENDIF()
# Override the EXACT and VERSION settings of the LibbatchPython module
# to force the next call to SALOME_FIND_PACKAGE() to find the exact matching
#
# !! Please read the generic detection procedure in libbatchMacros.cmake !!
#
-SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(SWIG SWIG_EXECUTABLE 2)
+IF(WIN32)
+ SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(SWIG SWIG_EXECUTABLE 1)
+ELSE()
+ SALOME_FIND_PACKAGE_AND_DETECT_CONFLICTS(SWIG SWIG_EXECUTABLE 2)
+ENDIF()
MARK_AS_ADVANCED(SWIG_EXECUTABLE SWIG_VERSION)
IF(WIN32)
SET(PTHREADS_INCLUDE_TO_FIND pthread.h)
FIND_PATH(PTHREAD_INCLUDE_DIR ${PTHREADS_INCLUDE_TO_FIND})
- # Default build type is assumed to be Release:
- IF(NOT CMAKE_BUILD_TYPE STREQUAL Debug)
- FIND_LIBRARY(PTHREAD_LIBRARY pthreadVC2)
- ELSE()
- FIND_LIBRARY(PTHREAD_LIBRARY pthreadVC2d)
- ENDIF()
+ FIND_LIBRARY(PTHREAD_LIBRARY pthreadVC2 pthreadVC2d)
ELSE(WIN32)
FIND_PATH(PTHREAD_INCLUDE_DIR pthread.h)
FIND_LIBRARY(PTHREAD_LIBRARY NAMES pthread)
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
SET(SWIG_SRC_FILE libBatch_Swig.i)
-SET(SWIG_LB_DPYS
+
+SET(SWIG_EXTAR_DEPS
libBatch_Swig_exception.i
libBatch_Swig_typemap.i
+ )
+SET(SWIG_LB_DPYS
../Core/Defines.hxx
../Core/Constants.hxx
../Core/Job.hxx
../Core/BatchManagerCatalog.hxx
../Core/FactBatchManager.hxx
)
-
-SET_SOURCE_FILES_PROPERTIES(${SWIG_SRC_FILE} PROPERTIES CPLUSPLUS ON
+IF(${CMAKE_VERSION} VERSION_LESS "3.8.0")
+ SET_SOURCE_FILES_PROPERTIES(${SWIG_SRC_FILE} PROPERTIES CPLUSPLUS ON
SWIG_FLAGS "-py3")
-# SWIG source file and module name differ - the following needs to be
-# set to avoid unnecessary rebuilds:
-SET_SOURCE_FILES_PROPERTIES(${SWIG_SRC_FILE} PROPERTIES SWIG_MODULE_NAME libbatch)
+ # SWIG source file and module name differ - the following needs to be
+ # set to avoid unnecessary rebuilds:
+ SET_SOURCE_FILES_PROPERTIES(${SWIG_SRC_FILE} PROPERTIES SWIG_MODULE_NAME libbatch)
-SET(SWIG_MODULE_libbatch_EXTRA_DEPS ${SWIG_LB_DPYS})
-SWIG_ADD_MODULE(libbatch python ${SWIG_SRC_FILE})
+ SET(SWIG_MODULE_libbatch_EXTRA_DEPS ${SWIG_EXTAR_DEPS} ${SWIG_LB_DPYS})
+ SWIG_ADD_MODULE(libbatch python ${SWIG_SRC_FILE})
+ELSE()
+ SET(CMAKE_SWIG_FLAGS "-py3")
+ SET_PROPERTY(SOURCE ${SWIG_SRC_FILE} PROPERTY CPLUSPLUS ON)
+ SET(SWIG_MODULE_libbatch_EXTRA_DEPS ${SWIG_EXTAR_DEPS})
+ SWIG_ADD_LIBRARY(libbatch LANGUAGE python SOURCES ${SWIG_LB_DPYS} ${SWIG_SRC_FILE})
+ENDIF()
SWIG_LINK_LIBRARIES(libbatch batch ${PYTHON_LIBRARIES})
-
INSTALL(TARGETS ${SWIG_MODULE_libbatch_REAL_NAME} DESTINATION ${LIBBATCH_PYTHONPATH})
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/libbatch.py
DESTINATION ${LIBBATCH_PYTHONPATH})