feat(demo): add a standalone project exercising compiled modules
A separate CMake project using the compiler as a subproject shows the real workflow: namespaced facades, require between compiled modules and dynamic access from C++.
This commit is contained in:
4 files changed
+141
No files matched your search
@@ -0,0 +1,19 @@
|
||||
cmake_minimum_required(VERSION 3.20)
|
||||
project(luacpp_demo LANGUAGES CXX)
|
||||
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
||||
|
||||
# Reuse the compiler from the repository root as a subproject.
|
||||
set(LUACPP_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
set(LUACPP_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
add_subdirectory("${CMAKE_CURRENT_SOURCE_DIR}/.." "${CMAKE_CURRENT_BINARY_DIR}/luacpp")
|
||||
include("${CMAKE_CURRENT_SOURCE_DIR}/../cmake/lua-package.cmake")
|
||||
|
||||
add_lua_package(demo_lua
|
||||
ROOT "${CMAKE_CURRENT_SOURCE_DIR}/lua"
|
||||
MODULES todo.lua report.lua
|
||||
NAMESPACE demo)
|
||||
|
||||
add_executable(luacpp_demo main.cpp)
|
||||
target_link_libraries(luacpp_demo PRIVATE demo_lua)
|
||||
Reference in new issue
Block a user