98 lines
1.8 KiB
CMake
98 lines
1.8 KiB
CMake
cmake_minimum_required(VERSION 3.28)
|
|
project(valeri) # vli
|
|
|
|
set(CMAKE_CXX_STANDARD 23)
|
|
set(CMAKE_EXPORT_COMPILE_COMMANDS true)
|
|
|
|
message(STATUS "Build type: ${CMAKE_BUILD_TYPE}")
|
|
|
|
set (CMAKE_CXX_FLAGS "-fno-exceptions -static-libgcc -static-libstdc++ -Werror -Wall -Wunused-result -Wno-unused-function -Wno-unused-variable -fno-omit-frame-pointer -fsanitize=address -Wno-c99-designator")
|
|
|
|
add_library(vm_lib)
|
|
target_sources(vm_lib
|
|
PRIVATE
|
|
src/vm.cpp
|
|
src/common.cpp
|
|
src/arena.cpp
|
|
src/error.cpp
|
|
src/reader.cpp
|
|
src/writer.cpp
|
|
src/utf8.cpp
|
|
src/compiler.cpp
|
|
src/opcode.cpp
|
|
src/fio.cpp
|
|
src/stdlib.cpp
|
|
src/lineedit.cpp
|
|
src/serialize.cpp
|
|
|
|
PUBLIC
|
|
FILE_SET HEADERS
|
|
BASE_DIRS src
|
|
FILES
|
|
src/arena.hpp
|
|
src/common.hpp
|
|
src/error.hpp
|
|
src/pod.hpp
|
|
src/result.hpp
|
|
src/vm.hpp
|
|
src/sourcerange.hpp
|
|
src/reader.hpp
|
|
src/writer.hpp
|
|
src/utf8.hpp
|
|
src/compiler.hpp
|
|
src/opcode.hpp
|
|
src/fio.hpp
|
|
src/stdlib.hpp
|
|
src/lineedit.hpp
|
|
src/serialize.hpp
|
|
)
|
|
|
|
add_executable(valeri src/valeri.cpp)
|
|
target_link_libraries(valeri vm_lib)
|
|
|
|
install(TARGETS valeri)
|
|
|
|
# TESTING
|
|
|
|
enable_testing()
|
|
|
|
set(CPP_TESTS
|
|
dict
|
|
array
|
|
symbol
|
|
string
|
|
)
|
|
|
|
set(LISP_TESTS
|
|
numeric
|
|
logic
|
|
dict
|
|
function
|
|
collections
|
|
continuations
|
|
serialize
|
|
)
|
|
|
|
|
|
foreach(testname IN LISTS CPP_TESTS)
|
|
add_executable("test_${testname}")
|
|
target_sources("test_${testname}" PRIVATE test/${testname}.cpp
|
|
PUBLIC
|
|
FILE_SET HEADERS
|
|
BASE_DIRS test
|
|
FILES
|
|
test/test.hpp)
|
|
target_link_libraries("test_${testname}" vm_lib)
|
|
|
|
add_test(
|
|
NAME "test_${testname}"
|
|
COMMAND $<TARGET_FILE:test_${testname}>
|
|
)
|
|
endforeach()
|
|
|
|
foreach(testname IN LISTS LISP_TESTS)
|
|
add_test(
|
|
NAME "test_lisp_${testname}"
|
|
COMMAND sh -c "$<TARGET_FILE:valeri> '${CMAKE_CURRENT_SOURCE_DIR}/test/${testname}.vli'"
|
|
)
|
|
endforeach()
|