Skip to content

Commit 08d8016

Browse files
authored
Merge pull request #4 from Purpurax/master
Spacer Ordering
2 parents a457bb9 + 6d306a3 commit 08d8016

19 files changed

Lines changed: 5351 additions & 41 deletions

.gitmodules

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
[submodule "libs/cft"]
2+
path = libs/cft
3+
url = https://github.com/c4v4/cft
4+
[submodule "libs/googletest"]
5+
path = libs/googletest
6+
url = https://github.com/google/googletest.git
7+
[submodule "libs/kseqpp"]
8+
path = libs/kseqpp
9+
url = https://github.com/cartoonist/kseqpp.git
110
[submodule "libs/megahit"]
211
path = libs/megahit
312
url = https://github.com/voutcn/megahit.git

CMakeLists.txt

Lines changed: 91 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@ FetchContent_MakeAvailable(phmap)
3535

3636
find_package(OpenMP REQUIRED)
3737
find_package(Threads REQUIRED)
38+
find_package(BZip2 REQUIRED)
3839

3940
# Options
4041
option(COVERAGE "Generate coverage report" ON)
@@ -51,11 +52,25 @@ endif()
5152

5253
# Include directories
5354
include_directories(include)
55+
include_directories(tests)
56+
57+
add_subdirectory(libs/cft)
58+
include_directories(libs/cft/src)
59+
60+
add_subdirectory(libs/googletest)
61+
include_directories(libs/googletest/googletest/include)
62+
63+
add_subdirectory(libs/kseqpp)
64+
include_directories(libs/kseqpp/include)
65+
5466
include_directories(libs/megahit/src)
67+
5568
add_subdirectory(libs/rapidfuzz-cpp)
5669
include_directories(libs/rapidfuzz-cpp)
5770
include_directories(${phmap_SOURCE_DIR})
71+
5872
include_directories(libs/spoa)
73+
include_directories(libs/spoa/include)
5974

6075
# Configure spoa options (disable exe and tests to build only the library)
6176
set(spoa_build_exe OFF CACHE BOOL "Disable spoa executable build" FORCE)
@@ -66,9 +81,21 @@ set(spoa_use_simde OFF CACHE BOOL "Disable SIMDe for simplicity" FORCE) # Optio
6681
# Add spoa subdirectory (builds the library)
6782
add_subdirectory(libs/spoa)
6883

84+
# Include fmt
85+
include(FetchContent)
86+
FetchContent_Declare(
87+
fmt
88+
GIT_REPOSITORY https://github.com/fmtlib/fmt.git
89+
GIT_TAG 10.2.1
90+
)
91+
FetchContent_MakeAvailable(fmt)
92+
6993
# Source files
7094
file(GLOB_RECURSE MAIN_SOURCE "src/*.cpp")
95+
file(GLOB_RECURSE SOURCES_WITHOUT_MAIN "src/*.cpp")
96+
list(REMOVE_ITEM SOURCES_WITHOUT_MAIN "${CMAKE_SOURCE_DIR}/src/main.cpp")
7197
file(GLOB_RECURSE INCLUDES "include/*.h")
98+
file(GLOB_RECURSE TESTS_SOURCE "tests/*.cpp")
7299
list(APPEND MAIN_SOURCE src/isolate_protospacers.cpp)
73100
file(GLOB_RECURSE ASMBL_SOURCE "libs/megahit/src/assembly/*.cpp")
74101
file(GLOB_RECURSE LCASM_SOURCE "libs/megahit/src/localasm/*.cpp")
@@ -97,6 +124,21 @@ if (STATIC_BUILD)
97124
set(CMAKE_FIND_LIBRARY_SUFFIXES ".a")
98125
endif (STATIC_BUILD)
99126

127+
# Testing
128+
enable_testing()
129+
set(TEST_IMPL_SOURCES
130+
${SOURCES_WITHOUT_MAIN}
131+
${ASMBL_SOURCE}
132+
${IDBA_SOURCE}
133+
${SDBG_SOURCE}
134+
${LCASM_SOURCE}
135+
${SEQ_SOURCE}
136+
${CX1_SOURCE}
137+
${TOOLKIT_SOURCE}
138+
${PROGRESSBAR_SOURCE}
139+
${SOME_OTHERS}
140+
)
141+
100142
# Compiler and linker flags
101143
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g")
102144
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
@@ -111,8 +153,17 @@ set(CMAKE_CXX_FLAGS_RELEASE "-O3 -DNDEBUG")
111153
set(CMAKE_CXX_FLAGS_DEBUG "-g -ggdb -O1 -D_LIBCPP_DEBUG -D_GLIBCXX_DEBUG")
112154

113155
# Add executable
114-
add_executable(mcaat ${MAIN_SOURCE} ${ASMBL_SOURCE} ${IDBA_SOURCE} ${SDBG_SOURCE} ${LCASM_SOURCE}
115-
${SEQ_SOURCE} ${CX1_SOURCE} ${TOOLKIT_SOURCE} ${OTHER_SOURCE} ${SOME_OTHERS})
156+
add_executable(mcaat
157+
${MAIN_SOURCE}
158+
${ASMBL_SOURCE}
159+
${IDBA_SOURCE}
160+
${SDBG_SOURCE}
161+
${LCASM_SOURCE}
162+
${SEQ_SOURCE}
163+
${CX1_SOURCE}
164+
${TOOLKIT_SOURCE}
165+
${SOME_OTHERS}
166+
)
116167

117168
# Static build linker flags
118169
if (STATIC_BUILD)
@@ -121,18 +172,17 @@ if (STATIC_BUILD)
121172
endif (STATIC_BUILD)
122173

123174
# Link libraries
124-
target_link_libraries(mcaat PRIVATE ${ZLIB_LIBRARIES} rapidfuzz::rapidfuzz spoa::spoa)
175+
target_link_libraries(mcaat PRIVATE ${ZLIB_LIBRARIES} rapidfuzz::rapidfuzz spoa::spoa fmt::fmt)
125176

126177

127178
# Threading configuration
128179
if(THREADS_HAVE_PTHREAD_ARG)
129180
target_compile_options(mcaat PUBLIC "-pthread")
130181
endif()
131182
if(CMAKE_THREAD_LIBS_INIT)
132-
target_link_libraries(mcaat PRIVATE "${CMAKE_THREAD_LIBS_INIT}")
183+
target_link_libraries(mcaat "${CMAKE_THREAD_LIBS_INIT}")
133184
endif()
134185

135-
# Development features
136186
if(DEBUG)
137187
include(FetchContent)
138188
FetchContent_Declare(
@@ -143,4 +193,39 @@ if(DEBUG)
143193
FetchContent_MakeAvailable(json)
144194
target_link_libraries(mcaat PRIVATE nlohmann_json::nlohmann_json)
145195
target_compile_definitions(mcaat PRIVATE DEBUG)
146-
endif()
196+
endif()
197+
198+
# Doxygen Documenation for cpp configurations
199+
find_package(Doxygen)
200+
if (DOXYGEN_FOUND)
201+
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/include/Doxyfile)
202+
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/include/Doxyfile)
203+
204+
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} COPYONLY)
205+
206+
add_custom_target(doc
207+
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
208+
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
209+
COMMENT "Generating API documentation with Doxygen"
210+
VERBATIM
211+
)
212+
else()
213+
message(STATUS "Doxygen not found, 'doc' target will not be available.")
214+
endif()
215+
216+
# Testing
217+
# if (UNIT_TESTS)
218+
add_executable(runTests ${TESTS_SOURCE} ${TEST_IMPL_SOURCES})
219+
220+
target_link_libraries(runTests
221+
gtest
222+
gtest_main
223+
${ZLIB_LIBRARIES}
224+
pthread
225+
fmt::fmt
226+
spoa::spoa
227+
)
228+
229+
include(GoogleTest)
230+
gtest_discover_tests(runTests)
231+
# endif()

0 commit comments

Comments
 (0)