-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Consolidate the tests into the rest of the build structure
- Loading branch information
1 parent
bf2e7d3
commit 72046fa
Showing
3 changed files
with
16 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
|
||
add_library(cpp_earley STATIC grammar.cpp earley.cpp) | ||
add_library(cpp_earley_shared SHARED grammar.cpp earley.cpp) | ||
|
||
add_executable(${MAIN_TARGET} main.cpp) | ||
target_link_libraries(${MAIN_TARGET} PRIVATE cpp_earley) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,18 @@ | ||
cmake_minimum_required(VERSION 3.10) | ||
|
||
project(CppEarleyTest VERSION 1.0) | ||
|
||
set(CMAKE_CXX_STANDARD 11) | ||
|
||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fprofile-arcs -ftest-coverage") | ||
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -fprofile-arcs -ftest-coverage") | ||
|
||
option(debug "Print out the locations of different things relative to source directory" OFF) | ||
|
||
enable_testing() | ||
|
||
find_package(GTest REQUIRED) | ||
|
||
set(GRAMMAR_DIRECTORY "test_grammars") | ||
|
||
set(PROJECT_ROOT_DIRECTORY "${CMAKE_SOURCE_DIR}/../") | ||
set(TEST_DIRECTORY "${CMAKE_SOURCE_DIR}") | ||
set(TEST_GRAMMAR_DIRECTORY "${TEST_DIRECTORY}/${GRAMMAR_DIRECTORY}/") | ||
set(TEST_GRAMMAR_DIRECTORY "${CMAKE_SOURCE_DIR}/test/test_grammars/") | ||
|
||
if(${debug}) | ||
message("PROJECT_ROOT_DIRECTORY: ${PROJECT_ROOT_DIRECTORY}") | ||
message("TEST_DIRECTORY: ${TEST_DIRECTORY}") | ||
message("TEST_GRAMMAR_DIRECTORY: ${TEST_GRAMMAR_DIRECTORY}") | ||
endif() | ||
set(CPP_EARLEY cpp_earley) | ||
|
||
find_library(CPP_EARLEY cpp_earley | ||
HINTS ${PROJECT_ROOT_DIRECTORY} | ||
PATH_SUFFIXES /bin /bin/lib /build /build/lib) | ||
|
||
add_executable(app-test test.cpp) | ||
|
||
target_link_libraries(app-test ${CPP_EARLEY} ${GTEST_LIBRARIES} ${GTEST_MAIN_LIBRARIES} pthread) | ||
|
||
target_include_directories(app-test PUBLIC ${PROJECT_ROOT_DIRECTORY}/include ${PROJECT_ROOT_DIRECTORY}/src) | ||
target_include_directories(app-test PRIVATE ${CMAKE_SOURCE_DIR}/include ${CMAKE_SOURCE_DIR}/src) | ||
|
||
add_test(NAME app-test-test COMMAND app-test ${TEST_GRAMMAR_DIRECTORY}) | ||
|