mirror of
https://github.com/pocketpy/pocketpy
synced 2025-10-20 19:40:18 +00:00
...
This commit is contained in:
parent
3e65101a0d
commit
5f0bf65da7
@ -32,17 +32,27 @@ else()
|
|||||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fexceptions -O2")
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti -fexceptions -O2")
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
option(PK_EXPORT_C_API "Build C API" OFF)
|
||||||
|
|
||||||
include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
|
include_directories(${CMAKE_CURRENT_LIST_DIR}/include)
|
||||||
|
|
||||||
|
if(PK_EXPORT_C_API)
|
||||||
|
message(STATUS "Exporting C API")
|
||||||
|
include_directories(${CMAKE_CURRENT_LIST_DIR}/c_bindings)
|
||||||
|
set(PK_LIB_CPP ${CMAKE_CURRENT_LIST_DIR}/c_bindings/pocketpy_c.cpp)
|
||||||
|
else()
|
||||||
|
set(PK_LIB_CPP ${CMAKE_CURRENT_LIST_DIR}/src2/lib.cpp)
|
||||||
|
endif()
|
||||||
|
|
||||||
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src POCKETPY_SRC)
|
aux_source_directory(${CMAKE_CURRENT_LIST_DIR}/src POCKETPY_SRC)
|
||||||
|
|
||||||
option(PK_BUILD_SHARED_LIB "Build shared library" OFF)
|
option(PK_BUILD_SHARED_LIB "Build shared library" OFF)
|
||||||
option(PK_BUILD_STATIC_LIB "Build static library" OFF)
|
option(PK_BUILD_STATIC_LIB "Build static library" OFF)
|
||||||
|
|
||||||
if(PK_BUILD_SHARED_LIB)
|
if(PK_BUILD_SHARED_LIB)
|
||||||
add_library(${PROJECT_NAME} SHARED ${POCKETPY_SRC} src2/lib.cpp)
|
add_library(${PROJECT_NAME} SHARED ${POCKETPY_SRC} ${PK_LIB_CPP})
|
||||||
elseif(PK_BUILD_STATIC_LIB)
|
elseif(PK_BUILD_STATIC_LIB)
|
||||||
add_library(${PROJECT_NAME} STATIC ${POCKETPY_SRC} src2/lib.cpp)
|
add_library(${PROJECT_NAME} STATIC ${POCKETPY_SRC} ${PK_LIB_CPP})
|
||||||
else()
|
else()
|
||||||
add_executable(${PROJECT_NAME} ${POCKETPY_SRC} src2/main.cpp)
|
add_executable(${PROJECT_NAME} ${POCKETPY_SRC} src2/main.cpp)
|
||||||
endif()
|
endif()
|
@ -7,7 +7,10 @@ extern "C" {
|
|||||||
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include "export.h"
|
|
||||||
|
#ifndef PK_EXPORT
|
||||||
|
#define PK_EXPORT
|
||||||
|
#endif
|
||||||
|
|
||||||
typedef struct pkpy_vm_handle pkpy_vm;
|
typedef struct pkpy_vm_handle pkpy_vm;
|
||||||
|
|
||||||
|
@ -12,6 +12,8 @@ true if it succeeded false if it did not.
|
|||||||
Special thanks for [@koltenpearson](https://github.com/koltenpearson) for bringing us the Lua Style API implementation.
|
Special thanks for [@koltenpearson](https://github.com/koltenpearson) for bringing us the Lua Style API implementation.
|
||||||
!!!
|
!!!
|
||||||
|
|
||||||
|
Set option `PK_EXPORT_C_API` to `ON` to enable the C API in cmake build process.
|
||||||
|
|
||||||
## Basic Functions
|
## Basic Functions
|
||||||
|
|
||||||
#### `pkpy_vm* pkpy_vm_create(bool use_stdio, bool enable_os)`
|
#### `pkpy_vm* pkpy_vm_create(bool use_stdio, bool enable_os)`
|
||||||
|
Loading…
x
Reference in New Issue
Block a user