]> SALOME platform Git repositories - tools/medcoupling.git/commitdiff
Salome HOME
CMake: Avoid linking to Python libs jsr/pylink 5/head
authorJulien Schueller <schueller@phimeca.com>
Wed, 10 Apr 2024 13:28:36 +0000 (15:28 +0200)
committerJulien Schueller <schueller@phimeca.com>
Fri, 18 Oct 2024 14:48:31 +0000 (16:48 +0200)
src/MEDCoupling_Swig/CMakeLists.txt
src/MEDLoader/Swig/CMakeLists.txt
src/MEDPartitioner_Swig/CMakeLists.txt
src/ParaMEDMEM_Swig/CMakeLists.txt
src/PyWrapping/CMakeLists.txt
src/RENUMBER_Swig/CMakeLists.txt

index cd8a4fefe92e8c399159e2e2ffec7a7ca7c2c5a9..273cb03fbfc57f568a2c5dbb9065e2769b29498d 100644 (file)
@@ -121,13 +121,12 @@ ELSE()
   SWIG_ADD_LIBRARY(${MEDCouling_target_name} LANGUAGE python SOURCES MEDCoupling.i)
 ENDIF()
 
+SWIG_LINK_LIBRARIES(${MEDCouling_target_name} ${PLATFORM_LIBS} medcouplingcpp)
 IF(WIN32 OR CYGWIN)
-  SWIG_LINK_LIBRARIES(${MEDCouling_target_name} ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medcouplingcpp)
-ELSE(WIN32 OR CYGWIN)
-  # ${PYTHON_LIBRARIES} not needed see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1
-  SWIG_LINK_LIBRARIES(${MEDCouling_target_name} ${PLATFORM_LIBS} medcouplingcpp)
-ENDIF(WIN32 OR CYGWIN)
-# ${PYTHON_LIBRARIES} not needed
+  # PYTHON_LIBRARIES only needed on win32 see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1
+  SWIG_LINK_LIBRARIES(${MEDCouling_target_name} ${PYTHON_LIBRARIES})
+ENDIF()
+
 SWIG_CHECK_GENERATION(${MEDCouling_target_name})
 SET_SOURCE_FILES_PROPERTIES(MEDCouplingRemapper.i PROPERTIES CPLUSPLUS ON)
 IF(WIN32)
@@ -155,12 +154,11 @@ ELSE()
   SWIG_ADD_LIBRARY(MEDCouplingRemapper LANGUAGE python SOURCES MEDCouplingRemapper.i)
 ENDIF()
 
+SWIG_LINK_LIBRARIES(MEDCouplingRemapper medcouplingremapper)
 IF(WIN32 OR CYGWIN)
-  SWIG_LINK_LIBRARIES(MEDCouplingRemapper ${PYTHON_LIBRARIES} medcouplingremapper)
-ELSE(WIN32 OR CYGWIN)
-  # ${PYTHON_LIBRARIES} not needed see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1
-  SWIG_LINK_LIBRARIES(MEDCouplingRemapper medcouplingremapper)
-ENDIF(WIN32 OR CYGWIN)
+  # PYTHON_LIBRARIES only needed on win32 see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1
+  SWIG_LINK_LIBRARIES(MEDCouplingRemapper ${PYTHON_LIBRARIES})
+ENDIF()
 
 IF(WIN32)
   SET_TARGET_PROPERTIES(_MEDCouplingRemapper PROPERTIES DEBUG_OUTPUT_NAME _MEDCouplingRemapper_d)
index bc13f294c01aff0e545ed3580483ea70574a4cd6..86029b1bc500c1de8082d33f3173866a05f4bd8b 100644 (file)
@@ -83,7 +83,12 @@ ELSE()
   SWIG_ADD_LIBRARY(MEDLoader LANGUAGE python SOURCES MEDLoader.i)
 ENDIF()
 
-SWIG_LINK_LIBRARIES(MEDLoader ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medloader medcouplingcpp )
+SWIG_LINK_LIBRARIES(MEDLoader ${PLATFORM_LIBS} medloader medcouplingcpp)
+IF (WIN32 OR CYGWIN)
+  # PYTHON_LIBRARIES only needed on win32 see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1
+  SWIG_LINK_LIBRARIES(MEDLoader ${PYTHON_LIBRARIES})
+ENDIF()
+
 SWIG_CHECK_GENERATION(MEDLoader)
 IF(WIN32)
   SET_TARGET_PROPERTIES(_MEDLoader PROPERTIES DEBUG_OUTPUT_NAME _MEDLoader_d)
index 2227bace23f521cdcc5d6446936ab50fcd75bd8a..f8fcc324d2bce2df9c2204a3d0f59513481e4a7a 100644 (file)
@@ -62,7 +62,11 @@ ELSE()
   SWIG_ADD_LIBRARY(MEDPartitioner LANGUAGE python SOURCES MEDPartitioner.i)
 ENDIF()
 
-SWIG_LINK_LIBRARIES(MEDPartitioner ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medpartitionercpp)
+SWIG_LINK_LIBRARIES(MEDPartitioner ${PLATFORM_LIBS} medpartitionercpp)
+IF (WIN32)
+  # PYTHON_LIBRARIES only needed on win32 see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1
+  SWIG_LINK_LIBRARIES(MEDPartitioner ${PYTHON_LIBRARIES})
+ENDIF()
 SWIG_CHECK_GENERATION(MEDPartitioner)
 
 IF(WIN32)
index e1fdb6f0795493624fcd5e9e86af8dc8eb7d4fc5..b26b45b42ec256f6cdeca29baa3bec8bb12b16e6 100644 (file)
@@ -64,7 +64,11 @@ ELSE()
   SWIG_ADD_LIBRARY(ParaMEDMEM LANGUAGE python SOURCES ParaMEDMEM.i)
 ENDIF()
 
-SWIG_LINK_LIBRARIES(ParaMEDMEM ${PYTHON_LIBRARIES} paramedmem)
+SWIG_LINK_LIBRARIES(ParaMEDMEM paramedmem)
+IF (WIN32)
+  # PYTHON_LIBRARIES only needed on win32 see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1
+  SWIG_LINK_LIBRARIES(ParaMEDMEM ${PYTHON_LIBRARIES})
+ENDIF ()
 SWIG_CHECK_GENERATION(ParaMEDMEM)
 
 #
index 9c8039d9a5c408d8c077eb511db70a4c58a04433..fc985763566fd30899e5295b452dcf77bacddb2e 100644 (file)
@@ -67,14 +67,14 @@ INCLUDE_DIRECTORIES(
   ${CMAKE_CURRENT_SOURCE_DIR}/../ShapeRecogn/Swig
   ${PROJECT_BINARY_DIR}/doc
   )
-  
-  IF(WIN32 OR CYGWIN)
-  SET(medcoupling_LIB_dependancies ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} medcouplingremapper medicoco)
-  ELSE(WIN32 OR CYGWIN)
-  # ${PYTHON_LIBRARIES} not needed see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1
+
+
   SET(medcoupling_LIB_dependancies ${PLATFORM_LIBS} medcouplingremapper medicoco)
-  ENDIF(WIN32 OR CYGWIN)
-  
+  IF(WIN32 OR CYGWIN)
+    # PYTHON_LIBRARIES only needed on win32 see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1
+    LIST(APPEND medcoupling_LIB_dependancies ${PYTHON_LIBRARIES})
+  ENDIF()
+
   IF(MEDCOUPLING_ENABLE_SHAPERECOGN)
     LIST(APPEND SWIG_MODULE_medcoupling_EXTRA_FLAGS -DWITH_SHAPE_RECOGN)
     LIST(APPEND medcoupling_LIB_dependancies shaperecogn)
index a927ed3654fd1a3009966a343def0fde256060e6..55314f6c8bf103cecdac83876e0fe31124be456a 100644 (file)
@@ -65,7 +65,11 @@ ELSE()
   SWIG_ADD_LIBRARY(MEDRenumber LANGUAGE python SOURCES MEDRenumber.i)
 ENDIF()
 
-SWIG_LINK_LIBRARIES(MEDRenumber ${PYTHON_LIBRARIES} ${PLATFORM_LIBS} renumbercpp)
+SWIG_LINK_LIBRARIES(MEDRenumber ${PLATFORM_LIBS} renumbercpp)
+IF (WIN32)
+  # PYTHON_LIBRARIES only needed on win32 see https://www.python.org/dev/peps/pep-0513/#libpythonx-y-so-1
+  SWIG_LINK_LIBRARIES(MEDRenumber ${PYTHON_LIBRARIES})
+ENDIF()
 SWIG_CHECK_GENERATION(MEDRenumber)
 
 IF(WIN32)