From: ndjinga Date: Wed, 30 Sep 2020 13:08:29 +0000 (+0200) Subject: Simplified the swig Makefiles X-Git-Tag: V9_6_0~39 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=fbcfb5cef044d3b42c43703ff206fae17a53ae9e;p=tools%2Fsolverlab.git Simplified the swig Makefiles --- diff --git a/CDMATH/swig/CMakeLists.txt b/CDMATH/swig/CMakeLists.txt index c153857..924fe3d 100755 --- a/CDMATH/swig/CMakeLists.txt +++ b/CDMATH/swig/CMakeLists.txt @@ -15,16 +15,16 @@ if (CDMATH_WITH_PETSC) ${LINEARSOLVER_DIR}/inc ) SET(_extra_lib_SWIG linearsolver ${PETSC_LIBRARIES} ${SLEPC_LIBRARIES}) - file(COPY cdmath_with_petsc.i DESTINATION ${CMAKE_BINARY_DIR}/swig) - file(RENAME ${CMAKE_BINARY_DIR}/swig/cdmath_with_petsc.i ${CMAKE_BINARY_DIR}/swig/cdmath.i) + file(COPY cdmath_with_petsc.i DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/cdmath_with_petsc.i ${CMAKE_CURRENT_BINARY_DIR}/cdmath.i) else (CDMATH_WITH_PETSC) - file(COPY cdmath_without_petsc.i DESTINATION ${CMAKE_BINARY_DIR}/swig) - file(RENAME ${CMAKE_BINARY_DIR}/swig/cdmath_without_petsc.i ${CMAKE_BINARY_DIR}/swig/cdmath.i) + file(COPY cdmath_without_petsc.i DESTINATION ${CMAKE_CURRENT_BINARY_DIR}) + file(RENAME ${CMAKE_CURRENT_BINARY_DIR}/cdmath_without_petsc.i ${CMAKE_CURRENT_BINARY_DIR}/cdmath.i) endif (CDMATH_WITH_PETSC) -SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/swig/cdmath.i PROPERTIES CPLUSPLUS ON) -SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/swig/cdmath.i PROPERTIES C OFF) -SET_SOURCE_FILES_PROPERTIES(${CMAKE_BINARY_DIR}/swig/cdmath.i PROPERTIES SWIG_DEFINITIONS "-shadow") +SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/cdmath.i PROPERTIES CPLUSPLUS ON) +SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/cdmath.i PROPERTIES C OFF) +SET_SOURCE_FILES_PROPERTIES(${CMAKE_CURRENT_BINARY_DIR}/cdmath.i PROPERTIES SWIG_DEFINITIONS "-shadow") #Trying to remove warnings due to cmake policies cmp0078 and cmp0086 IF (${CMAKE_VERSION} VERSION_GREATER "3.13.0") @@ -35,9 +35,9 @@ IF (${CMAKE_VERSION} VERSION_GREATER "3.13.0") ENDIF(${CMAKE_VERSION} VERSION_GREATER "3.13.0") IF (${CMAKE_VERSION} VERSION_LESS "3.8.0") - SWIG_ADD_MODULE(cdmath python ${CMAKE_BINARY_DIR}/swig/cdmath.i) + SWIG_ADD_MODULE(cdmath python ${CMAKE_CURRENT_BINARY_DIR}/cdmath.i) ELSE (${CMAKE_VERSION} VERSION_LESS "3.8.0") - SWIG_ADD_LIBRARY(cdmath TYPE SHARED LANGUAGE python SOURCES ${CMAKE_BINARY_DIR}/swig/cdmath.i) + SWIG_ADD_LIBRARY(cdmath TYPE SHARED LANGUAGE python SOURCES ${CMAKE_CURRENT_BINARY_DIR}/cdmath.i) ENDIF(${CMAKE_VERSION} VERSION_LESS "3.8.0") SWIG_LINK_LIBRARIES(cdmath ${Python_LIBRARIES} base mesh ${medloader} ${medcoupling} ${_extra_lib_SWIG}) diff --git a/CoreFlows/CMakeLists.txt b/CoreFlows/CMakeLists.txt index 9f3a45c..64e8fee 100755 --- a/CoreFlows/CMakeLists.txt +++ b/CoreFlows/CMakeLists.txt @@ -109,7 +109,7 @@ SET(MAIN_SOURCES # SET(_extra_lib_CoreFlows ${CDMATH_LIBRARIES} ${PETSC_LIBRARIES} ) # ADD_EXECUTABLE(CoreFlowsMainExe ${MAIN_SOURCES}) # SET_TARGET_PROPERTIES(CoreFlowsMainExe PROPERTIES COMPILE_FLAGS "") # -TARGET_LINK_LIBRARIES(CoreFlowsMainExe CoreFlows ${_extra_lib_CoreFlows}) # +TARGET_LINK_LIBRARIES(CoreFlowsMainExe CoreFlowsLibs ${_extra_lib_CoreFlows}) # INSTALL(TARGETS CoreFlowsMainExe DESTINATION bin) # # configure_file( diff --git a/CoreFlows/Models/src/CMakeLists.txt b/CoreFlows/Models/src/CMakeLists.txt index f07e759..ce2f420 100755 --- a/CoreFlows/Models/src/CMakeLists.txt +++ b/CoreFlows/Models/src/CMakeLists.txt @@ -20,7 +20,7 @@ SET(src_models_CXX utilitaire_algebre.cxx ) -ADD_LIBRARY(CoreFlows SHARED ${src_models_CXX}) -target_link_libraries(CoreFlows ${CDMATH_LIBRARIES} ${PETSC_LIBRARIES} ${SLEPC_LIBRARIES}) +ADD_LIBRARY(CoreFlowsLibs SHARED ${src_models_CXX}) +target_link_libraries(CoreFlowsLibs ${CDMATH_LIBRARIES} ${PETSC_LIBRARIES} ${SLEPC_LIBRARIES}) -INSTALL(TARGETS CoreFlows DESTINATION lib) +INSTALL(TARGETS CoreFlowsLibs DESTINATION lib) diff --git a/CoreFlows/examples/C/CMakeLists.txt b/CoreFlows/examples/C/CMakeLists.txt index 4d73610..d9a5aa4 100755 --- a/CoreFlows/examples/C/CMakeLists.txt +++ b/CoreFlows/examples/C/CMakeLists.txt @@ -7,7 +7,7 @@ INCLUDE_DIRECTORIES( ) -SET(_extra_lib_CoreFlows CoreFlows ${PETSC_LIBRARIES} ${CDMATH_LIBRARIES}) +SET(_extra_lib_CoreFlows CoreFlowsLibs ) if(CMAKE_COMPILER_IS_GNUCXX) diff --git a/CoreFlows/swig/CMakeLists.txt b/CoreFlows/swig/CMakeLists.txt index a722c8f..9302eca 100755 --- a/CoreFlows/swig/CMakeLists.txt +++ b/CoreFlows/swig/CMakeLists.txt @@ -13,9 +13,13 @@ INCLUDE_DIRECTORIES( SET(_extra_lib_SWIG ${CDMATH_LIBRARIES} ${PETSC_LIBRARIES} ${SLEPC_LIBRARIES}) +IF (${CMAKE_VERSION} VERSION_LESS "3.8.0") + SWIG_ADD_MODULE(CoreFlows python CoreFlows.i) +ELSE (${CMAKE_VERSION} VERSION_LESS "3.8.0") + SWIG_ADD_LIBRARY(CoreFlows TYPE SHARED LANGUAGE python SOURCES CoreFlows.i) +ENDIF(${CMAKE_VERSION} VERSION_LESS "3.8.0") -SWIG_ADD_MODULE(CoreFlows python CoreFlows.i) -SWIG_LINK_LIBRARIES(CoreFlows ${Python_LIBRARIES} ${_extra_lib_SWIG} CoreFlows ${PETSC_LIBRARIES} ${SLEPC_LIBRARIES}) +SWIG_LINK_LIBRARIES(CoreFlows ${Python_LIBRARIES} ${_extra_lib_SWIG} CoreFlowsLibs ${PETSC_LIBRARIES} ${SLEPC_LIBRARIES}) INSTALL(TARGETS _CoreFlows DESTINATION lib/coreflows) INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/CoreFlows.py DESTINATION bin/coreflows)