From 4e000f92ef26182aab1dbe95b51d3e7951d46ec7 Mon Sep 17 00:00:00 2001 From: Ilusha <63184036+IlyaShurupov@users.noreply.github.com> Date: Fri, 15 Mar 2024 11:21:01 +0300 Subject: [PATCH] Add Cmake targets --- .gitignore | 2 ++ CMakeLists.txt | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 CMakeLists.txt diff --git a/.gitignore b/.gitignore index d6d7bd7..1d8302e 100644 --- a/.gitignore +++ b/.gitignore @@ -8,6 +8,8 @@ /sweet/sweet_parser.sln /*.sln /.vscode/ +/.vs +/out debug release shipping diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..acaa51b --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,21 @@ +project(LALR) + +### ---------------------- Static Library --------------------- ### +file(GLOB SOURCES "./src/lalr/*.cpp") +file(GLOB HEADERS "./src/lalr/*.hpp") +add_library(${PROJECT_NAME} STATIC ${SOURCES} ${HEADERS}) +target_include_directories(${PROJECT_NAME} PUBLIC ./src/) + +### -------------------------- offline compiler -------------------------- ### +file(GLOB COMPILER_SOURCES "./src/lalr/lalrc/*.cpp") +add_executable(${PROJECT_NAME}Compiler ${COMPILER_SOURCES}) +target_link_libraries(${PROJECT_NAME}Compiler ${PROJECT_NAME}) + +### -------------------------- Tests -------------------------- ### +add_subdirectory(src/unittest-cpp) + +enable_testing() +file(GLOB TEST_SOURCES "./src/lalr/lalr_test/*.cpp") +add_executable(${PROJECT_NAME}Tests ${TEST_SOURCES}) +target_link_libraries(${PROJECT_NAME}Tests ${PROJECT_NAME} UnitTest++) +add_test(NAME ${PROJECT_NAME}Tests COMMAND ${PROJECT_NAME}Tests) \ No newline at end of file