-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
54 lines (43 loc) · 1.72 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
cmake_minimum_required(VERSION 3.20.0)
option(GLOBAL_VCPKG "Use global Vcpkg" OFF)
if (GLOBAL_VCPKG)
set(CMAKE_TOOLCHAIN_FILE $ENV{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake)
else()
set(CMAKE_TOOLCHAIN_FILE ${CMAKE_SOURCE_DIR}/vcpkg/scripts/buildsystems/vcpkg.cmake)
endif()
option(CCACHE "Use ccache to speed up the compilation" ON)
if(CCACHE)
find_program(CCACHE_FOUND ccache)
if(CCACHE_FOUND)
set(PATH_TO_CCACHE ccache)
else()
message(WARNING "Ccache path not found, disabling ccache")
endif(CCACHE_FOUND)
set(CXX_COMPILER_LAUNCHER PATH_TO_CCACHE)
endif(CCACHE)
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
project(
lua-dialect-playground
VERSION 0.0.1
LANGUAGES CXX
)
find_package(fmt CONFIG REQUIRED)
find_package(Lua REQUIRED)
find_package(PkgConfig REQUIRED)
pkg_check_modules(LuaJIT REQUIRED IMPORTED_TARGET luajit)
set(LUAU_BUILD_CLI OFF)
set(LUAU_BUILD_TESTS OFF)
add_subdirectory(src/external/luau)
add_subdirectory(src/external/terra)
add_executable(luau-test src/luau/main.cpp)
target_compile_features(luau-test PRIVATE cxx_std_20)
set_target_properties(luau-test PROPERTIES CXX_EXTENSIONS OFF OUTPUT_NAME luau-test)
target_link_libraries(luau-test PRIVATE fmt::fmt Luau.Compiler Luau.VM)
add_executable(lua-test src/lua/main.cpp)
target_include_directories(lua-test PRIVATE ${LUA_INCLUDE_DIR})
target_link_libraries(lua-test PRIVATE fmt::fmt ${LUA_LIBRARIES})
add_executable(luajit-test src/luajit/main.cpp)
target_link_libraries(luajit-test PRIVATE fmt::fmt PkgConfig::LuaJIT)
add_executable(terra-test src/terra/main.cpp)
target_include_directories(terra-test PRIVATE ${PROJECT_BINARY_DIR}/src/external/terra/include/terra)
target_link_libraries(terra-test PRIVATE fmt::fmt TerraLibrary)