add PK_NO_EXPORT_C_API

This commit is contained in:
blueloveTH 2024-02-05 19:42:41 +08:00
parent ecdfcb3852
commit 1ab31b397c
2 changed files with 10 additions and 1 deletions

View File

@ -43,6 +43,11 @@ if(PK_ENABLE_OS)
add_definitions(-DPK_ENABLE_OS=1) add_definitions(-DPK_ENABLE_OS=1)
endif() endif()
option(PK_NO_EXPORT_C_API "" OFF)
if(PK_NO_EXPORT_C_API)
add_definitions(-DPK_NO_EXPORT_C_API)
endif()
# PK_IS_MAIN determines whether the project is being used from root # PK_IS_MAIN determines whether the project is being used from root
# or if it is added as a dependency (through add_subdirectory for example). # or if it is added as a dependency (through add_subdirectory for example).
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}")

View File

@ -1,3 +1,5 @@
#ifndef PK_NO_EXPORT_C_API
#include "pocketpy.h" #include "pocketpy.h"
#include "pocketpy_c.h" #include "pocketpy_c.h"
@ -574,4 +576,6 @@ bool pkpy_repl_input(void* r, const char* line){
void pkpy_delete_repl(void* repl){ void pkpy_delete_repl(void* repl){
delete (REPL*)repl; delete (REPL*)repl;
} }
#endif // PK_NO_EXPORT_C_API