diff --git a/CMakeLists.txt b/CMakeLists.txt index fa5b7e2..4b4d05d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,16 +4,17 @@ project(lander C CXX) set(CMAKE_C_STANDARD 17) set(CMAKE_CXX_STANDARD 17) -include_directories(crow/include include) +include_directories(crow/include trie/include) add_subdirectory(crow) +add_subdirectory(trie) if(CMAKE_BUILD_TYPE MATCHES "^Test") enable_testing() - add_subdirectory(test) else() if(CMAKE_BUILD_TYPE STREQUAL Release) add_compile_options(-O3 -flto) endif() - add_executable(lander src/main.cpp src/trie/trie.c) + add_executable(lander src/main.cpp) + target_link_libraries(lander PUBLIC trie) endif() diff --git a/trie/CMakeLists.txt b/trie/CMakeLists.txt new file mode 100644 index 0000000..7b89570 --- /dev/null +++ b/trie/CMakeLists.txt @@ -0,0 +1,8 @@ +include_directories(include) + +if(CMAKE_BUILD_TYPE MATCHES "^Test") + enable_testing() + add_subdirectory(test) +endif() + +add_library(trie STATIC include/trie.h src/trie.c) diff --git a/include/trie.h b/trie/include/trie.h similarity index 100% rename from include/trie.h rename to trie/include/trie.h diff --git a/src/trie/trie.c b/trie/src/trie.c similarity index 100% rename from src/trie/trie.c rename to trie/src/trie.c diff --git a/src/trie/trie_node.c b/trie/src/trie_node.c similarity index 100% rename from src/trie/trie_node.c rename to trie/src/trie_node.c diff --git a/test/CMakeLists.txt b/trie/test/CMakeLists.txt similarity index 54% rename from test/CMakeLists.txt rename to trie/test/CMakeLists.txt index aa802f9..fdd8f31 100644 --- a/test/CMakeLists.txt +++ b/trie/test/CMakeLists.txt @@ -1,6 +1,6 @@ add_compile_options(-Wno-incompatible-pointer-types) -add_executable(test_trie test_trie.c ../src/trie/trie.c) +add_executable(test_trie test_trie.c ../src/trie.c) add_test(NAME test_trie COMMAND test_trie) -add_executable(test_trie_fuzzy test_trie_fuzzy.c ../src/trie/trie.c) +add_executable(test_trie_fuzzy test_trie_fuzzy.c ../src/trie.c) add_test(NAME test_trie_fuzzy COMMAND test_trie_fuzzy) diff --git a/test/fuzzy.h b/trie/test/fuzzy.h similarity index 100% rename from test/fuzzy.h rename to trie/test/fuzzy.h diff --git a/test/test.h b/trie/test/test.h similarity index 100% rename from test/test.h rename to trie/test/test.h diff --git a/test/test_trie.c b/trie/test/test_trie.c similarity index 100% rename from test/test_trie.c rename to trie/test/test_trie.c diff --git a/test/test_trie_fuzzy.c b/trie/test/test_trie_fuzzy.c similarity index 100% rename from test/test_trie_fuzzy.c rename to trie/test/test_trie_fuzzy.c