Browse Source

add `PK_ENABLE_DLL`

blueloveTH 18 hours ago
parent
commit
005a2725a1
4 changed files with 17 additions and 6 deletions
  1. 7 1
      CMakeLists.txt
  2. 1 0
      CMakeOptions.txt
  3. 8 4
      include/pocketpy/config.h
  4. 1 1
      src/interpreter/dll.c

+ 7 - 1
CMakeLists.txt

@@ -61,6 +61,12 @@ else()
     add_definitions(-DPK_ENABLE_THREADS=0)
 endif()
 
+if(PK_ENABLE_DLL)
+    add_definitions(-DPK_ENABLE_DLL=1)
+else()
+    add_definitions(-DPK_ENABLE_DLL=0)
+endif()
+
 if(PK_ENABLE_DETERMINISM)
     add_definitions(-DPK_ENABLE_DETERMINISM=1)
 else()
@@ -154,7 +160,7 @@ if(PK_ENABLE_THREADS)
 endif()
 
 if(UNIX AND NOT APPLE)
-    if(PK_ENABLE_OS)
+    if(PK_ENABLE_OS AND PK_ENABLE_DLL)
         target_link_libraries(${PROJECT_NAME} dl)
     endif()
 elseif(WIN32)

+ 1 - 0
CMakeOptions.txt

@@ -8,6 +8,7 @@ endif()
 # system features
 option(PK_ENABLE_OS "" ON)
 option(PK_ENABLE_THREADS "" ON)
+option(PK_ENABLE_DLL "" ON)
 option(PK_ENABLE_DETERMINISM "" ON)
 option(PK_ENABLE_WATCHDOG "" OFF)
 option(PK_ENABLE_CUSTOM_SNAME "" OFF)

+ 8 - 4
include/pocketpy/config.h

@@ -1,18 +1,22 @@
 #pragma once
 // clang-format off
 
-#define PK_VERSION				"2.1.8"
+#define PK_VERSION				"2.1.9"
 #define PK_VERSION_MAJOR            2
 #define PK_VERSION_MINOR            1
-#define PK_VERSION_PATCH            8
+#define PK_VERSION_PATCH            9
 
 /*************** feature settings ***************/
 #ifndef PK_ENABLE_OS                // can be overridden by cmake
 #define PK_ENABLE_OS                1
 #endif
 
-#ifndef PK_ENABLE_THREADS           // can be overridden by cmake
-#define PK_ENABLE_THREADS           1
+#ifndef PK_ENABLE_THREADS           // must be enabled from cmake
+#define PK_ENABLE_THREADS           0
+#endif
+
+#ifndef PK_ENABLE_DLL               // must be enabled from cmake
+#define PK_ENABLE_DLL               0
 #endif
 
 #ifndef PK_ENABLE_DETERMINISM       // must be enabled from cmake

+ 1 - 1
src/interpreter/dll.c

@@ -1,6 +1,6 @@
 #include "pocketpy/pocketpy.h"
 
-#if PK_IS_DESKTOP_PLATFORM && PK_ENABLE_OS
+#if PK_IS_DESKTOP_PLATFORM && PK_ENABLE_OS && PK_ENABLE_DLL
 
 #ifdef _WIN32