From 1ab31b397ce15e847c868cbca31ec4c3897cccf4 Mon Sep 17 00:00:00 2001 From: blueloveTH Date: Mon, 5 Feb 2024 19:42:41 +0800 Subject: [PATCH] add `PK_NO_EXPORT_C_API` --- CMakeLists.txt | 5 +++++ src/pocketpy_c.cpp | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index e3a91186..a42c503f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,6 +43,11 @@ if(PK_ENABLE_OS) add_definitions(-DPK_ENABLE_OS=1) 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 # or if it is added as a dependency (through add_subdirectory for example). if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_CURRENT_SOURCE_DIR}") diff --git a/src/pocketpy_c.cpp b/src/pocketpy_c.cpp index d0a442fc..22982086 100644 --- a/src/pocketpy_c.cpp +++ b/src/pocketpy_c.cpp @@ -1,3 +1,5 @@ +#ifndef PK_NO_EXPORT_C_API + #include "pocketpy.h" #include "pocketpy_c.h" @@ -574,4 +576,6 @@ bool pkpy_repl_input(void* r, const char* line){ void pkpy_delete_repl(void* repl){ delete (REPL*)repl; -} \ No newline at end of file +} + +#endif // PK_NO_EXPORT_C_API \ No newline at end of file