[Bf-blender-cvs] [6bf5cc62e09] master: Build: limit Py_ENABLE_SHARED to modules using Python headers

Brecht Van Lommel noreply at git.blender.org
Sun Sep 18 15:52:24 CEST 2022


Commit: 6bf5cc62e0901175d98506216932ec6ffd4506a5
Author: Brecht Van Lommel
Date:   Sun Sep 18 10:37:28 2022 +0200
Branches: master
https://developer.blender.org/rB6bf5cc62e0901175d98506216932ec6ffd4506a5

Build: limit Py_ENABLE_SHARED to modules using Python headers

And remove Python flags from nodes, no longer needed.

===================================================================

M	CMakeLists.txt
M	source/blender/freestyle/CMakeLists.txt
M	source/blender/nodes/CMakeLists.txt
M	source/blender/nodes/geometry/CMakeLists.txt
M	source/blender/nodes/shader/CMakeLists.txt
M	source/blender/nodes/texture/CMakeLists.txt
M	source/blender/python/CMakeLists.txt

===================================================================

diff --git a/CMakeLists.txt b/CMakeLists.txt
index b6f9046a883..359968ca525 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1271,7 +1271,6 @@ endif()
 # Configure Python
 
 if(WITH_PYTHON_MODULE)
-  add_definitions(-DPy_ENABLE_SHARED)
   # Not currently supported due to different required Python link flags.
   if(WITH_GTESTS)
     message(STATUS "GTests not compatible with Python module, disabling WITH_GTESTS")
diff --git a/source/blender/freestyle/CMakeLists.txt b/source/blender/freestyle/CMakeLists.txt
index 40db98ebd74..8f9e493023c 100644
--- a/source/blender/freestyle/CMakeLists.txt
+++ b/source/blender/freestyle/CMakeLists.txt
@@ -561,6 +561,10 @@ set(INC_SYS
 
 add_definitions(-DWITH_FREESTYLE)
 
+if(WITH_PYTHON_MODULE)
+  add_definitions(-DPy_ENABLE_SHARED)
+endif()
+
 if(WITH_PYTHON_SAFETY)
   # For bpy_rna.h access.
   add_definitions(-DWITH_PYTHON_SAFETY)
diff --git a/source/blender/nodes/CMakeLists.txt b/source/blender/nodes/CMakeLists.txt
index e042458ca19..e9c0f2be368 100644
--- a/source/blender/nodes/CMakeLists.txt
+++ b/source/blender/nodes/CMakeLists.txt
@@ -102,20 +102,6 @@ if(WITH_BULLET)
   add_definitions(-DWITH_BULLET)
 endif()
 
-if(WITH_PYTHON)
-  list(APPEND INC
-    ../python
-  )
-  list(APPEND INC_SYS
-    ${PYTHON_INCLUDE_DIRS}
-  )
-  list(APPEND LIB
-    ${PYTHON_LINKFLAGS}
-    ${PYTHON_LIBRARIES}
-  )
-  add_definitions(-DWITH_PYTHON)
-endif()
-
 if(WITH_TBB)
   list(APPEND INC_SYS
     ${TBB_INCLUDE_DIRS}
diff --git a/source/blender/nodes/geometry/CMakeLists.txt b/source/blender/nodes/geometry/CMakeLists.txt
index cc3d00ea21f..8e71bc8bbb8 100644
--- a/source/blender/nodes/geometry/CMakeLists.txt
+++ b/source/blender/nodes/geometry/CMakeLists.txt
@@ -188,20 +188,6 @@ if(WITH_BULLET)
   add_definitions(-DWITH_BULLET)
 endif()
 
-if(WITH_PYTHON)
-  list(APPEND INC
-    ../../python
-  )
-  list(APPEND INC_SYS
-    ${PYTHON_INCLUDE_DIRS}
-  )
-  list(APPEND LIB
-    ${PYTHON_LINKFLAGS}
-    ${PYTHON_LIBRARIES}
-  )
-  add_definitions(-DWITH_PYTHON)
-endif()
-
 if(WITH_TBB)
   list(APPEND INC_SYS
     ${TBB_INCLUDE_DIRS}
diff --git a/source/blender/nodes/shader/CMakeLists.txt b/source/blender/nodes/shader/CMakeLists.txt
index e78bf55d840..e6f90449843 100644
--- a/source/blender/nodes/shader/CMakeLists.txt
+++ b/source/blender/nodes/shader/CMakeLists.txt
@@ -132,20 +132,6 @@ set(LIB
   bf_nodes
 )
 
-if(WITH_PYTHON)
-  list(APPEND INC
-    ../../python
-  )
-  list(APPEND INC_SYS
-    ${PYTHON_INCLUDE_DIRS}
-  )
-  list(APPEND LIB
-    ${PYTHON_LINKFLAGS}
-    ${PYTHON_LIBRARIES}
-  )
-  add_definitions(-DWITH_PYTHON)
-endif()
-
 if(WITH_FREESTYLE)
   add_definitions(-DWITH_FREESTYLE)
 endif()
diff --git a/source/blender/nodes/texture/CMakeLists.txt b/source/blender/nodes/texture/CMakeLists.txt
index 2ccdf4c0bc9..77db71d4b1a 100644
--- a/source/blender/nodes/texture/CMakeLists.txt
+++ b/source/blender/nodes/texture/CMakeLists.txt
@@ -57,21 +57,6 @@ set(LIB
   bf_nodes
 )
 
-if(WITH_PYTHON)
-  list(APPEND INC
-    ../../python
-  )
-  list(APPEND INC_SYS
-    ${PYTHON_INCLUDE_DIRS}
-  )
-  list(APPEND LIB
-    ${PYTHON_LINKFLAGS}
-    ${PYTHON_LIBRARIES}
-  )
-  add_definitions(-DWITH_PYTHON)
-endif()
-
-
 blender_add_lib(bf_nodes_texture "${SRC}" "${INC}" "${INC_SYS}" "${LIB}")
 
 # RNA_prototypes.h
diff --git a/source/blender/python/CMakeLists.txt b/source/blender/python/CMakeLists.txt
index 9f6ee359d67..f82499ba1d4 100644
--- a/source/blender/python/CMakeLists.txt
+++ b/source/blender/python/CMakeLists.txt
@@ -1,5 +1,9 @@
 # SPDX-License-Identifier: GPL-2.0-or-later
 
+if(WITH_PYTHON_MODULE)
+  add_definitions(-DPy_ENABLE_SHARED)
+endif()
+
 add_subdirectory(intern)
 add_subdirectory(generic)
 add_subdirectory(gpu)



More information about the Bf-blender-cvs mailing list