add PK_ENABLE_DLL

This commit is contained in:
blueloveTH 2026-03-24 11:02:34 +08:00
parent d03b067666
commit 005a2725a1
4 changed files with 17 additions and 6 deletions

View File

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

View File

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

View File

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

View File

@ -1,6 +1,6 @@
#include "pocketpy/pocketpy.h" #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 #ifdef _WIN32