Files
LuaCangjia_api/lib/CMakeLists.txt
2026-03-18 16:20:46 +08:00

47 lines
1.1 KiB
CMake
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# the minimum version of CMake.
cmake_minimum_required(VERSION 3.12)
set(CMAKE_CXX_STANDARD 17)
project(LuaPluginLib)
list(APPEND EXTRA_LIBS dl)
# 定义一个变量并赋值为当前模块cpp目录
set(NATIVERENDER_ROOT_PATH ${CMAKE_CURRENT_SOURCE_DIR})
# 添加头文件.h目录包括cppcpp/include告诉cmake去这里找到代码引入的头文件
include_directories(${NATIVERENDER_ROOT_PATH}
${NATIVERENDER_ROOT_PATH}/lua
${NATIVERENDER_ROOT_PATH}/json)
# 添加lua子目录
add_subdirectory(lua)
# 创建共享库使用标准的entry命名
add_library(runner SHARED
script_run.c
json/cJSON.c)
add_library(luarunner STATIC
lua_runner.cpp)
add_library(luacjapi SHARED
lua_cj_api.cpp)
target_link_libraries(luarunner
lua
m
)
target_link_libraries(luacjapi
luarunner
)
# 链接库
#target_link_libraries(runner
# lua # 链接到lua库
# m)
#add_executable(test test.c)
#target_link_libraries(test runner)
#add_executable(testcpp test.cpp)
#target_link_libraries(testcpp luarunner)
add_executable(test1 test1.c)
target_link_libraries(test1 luacjapi)