Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Cmake targets #55

Merged
merged 1 commit into from
Jul 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
/sweet/sweet_parser.sln
/*.sln
/.vscode/
/.vs
/out
debug
release
shipping
Expand Down
21 changes: 21 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Loading