Skip to content

Commit

Permalink
[INFRA] Streamline libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
eseiler committed Aug 22, 2024
1 parent 91d11e5 commit 83fb59a
Show file tree
Hide file tree
Showing 5 changed files with 40 additions and 22 deletions.
26 changes: 16 additions & 10 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,32 @@

cmake_minimum_required (VERSION 3.18)

if (NOT TARGET chopper_shared)
add_library (chopper_shared STATIC configuration.cpp input_functor.cpp)

target_link_libraries (chopper_shared PUBLIC seqan3::seqan3)
target_link_libraries (chopper_shared PUBLIC sharg::sharg)
target_link_libraries (chopper_shared PUBLIC seqan::hibf)
target_include_directories (chopper_shared PUBLIC ../include)
target_compile_options (chopper_shared PUBLIC "-pedantic" "-Wall" "-Wextra")
if (TARGET chopper::interface)
return ()
endif ()

add_library (chopper_interface INTERFACE)
target_link_libraries (chopper_interface INTERFACE seqan::hibf sharg::sharg seqan3::seqan3)
target_include_directories (chopper_interface INTERFACE "${PROJECT_SOURCE_DIR}/include")
target_compile_options (chopper_interface INTERFACE "-pedantic" "-Wall" "-Wextra")
add_library (chopper::interface ALIAS chopper_interface)

add_library (chopper_shared STATIC configuration.cpp input_functor.cpp)
target_link_libraries (chopper_shared PUBLIC chopper_interface)
add_library (chopper::shared ALIAS chopper_shared)

add_library (chopper_lib STATIC chopper_layout.cpp set_up_parser.cpp)
target_link_libraries (chopper_lib PUBLIC chopper_layout chopper_sketch)
target_link_libraries (chopper_lib PUBLIC chopper::layout chopper::sketch)
add_library (chopper::chopper ALIAS chopper_lib)

add_executable (chopper chopper.cpp)
target_link_libraries (chopper PUBLIC chopper_lib)
target_link_libraries (chopper PUBLIC chopper::chopper)

add_subdirectory (layout)
add_subdirectory (sketch)
add_subdirectory (util)

if (CHOPPER_INSTALL)
include (GNUInstallDirs)
install (TARGETS chopper RUNTIME DESTINATION "${CMAKE_INSTALL_BINDIR}")
endif ()
14 changes: 8 additions & 6 deletions src/layout/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
cmake_minimum_required (VERSION 3.18)

if (NOT TARGET chopper_layout)
add_library (chopper_layout STATIC determine_best_number_of_technical_bins.cpp execute.cpp hibf_statistics.cpp
ibf_query_cost.cpp input.cpp output.cpp
)

target_link_libraries (chopper_layout PUBLIC chopper_shared)
if (TARGET chopper::layout)
return ()
endif ()

add_library (chopper_layout STATIC determine_best_number_of_technical_bins.cpp execute.cpp hibf_statistics.cpp
ibf_query_cost.cpp input.cpp output.cpp
)
target_link_libraries (chopper_layout PUBLIC chopper::shared)
add_library (chopper::layout ALIAS chopper_layout)
10 changes: 6 additions & 4 deletions src/sketch/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
cmake_minimum_required (VERSION 3.18)

if (NOT TARGET chopper_sketch)
add_library (chopper_sketch STATIC check_filenames.cpp output.cpp read_data_file.cpp)

target_link_libraries (chopper_sketch PUBLIC chopper_shared)
if (TARGET chopper::sketch)
return ()
endif ()

add_library (chopper_sketch STATIC check_filenames.cpp output.cpp read_data_file.cpp)
target_link_libraries (chopper_sketch PUBLIC chopper::shared)
add_library (chopper::sketch ALIAS chopper_sketch)
6 changes: 5 additions & 1 deletion src/util/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,11 @@

cmake_minimum_required (VERSION 3.18)

if (TARGET measure_hyperloglog)
return ()
endif ()

add_executable (measure_hyperloglog EXCLUDE_FROM_ALL measure_hyperloglog.cpp)
target_link_libraries (measure_hyperloglog PUBLIC chopper_lib)
target_link_libraries (measure_hyperloglog PUBLIC chopper::chopper)

add_subdirectory (display_layout)
6 changes: 5 additions & 1 deletion src/util/display_layout/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,9 @@

cmake_minimum_required (VERSION 3.18)

if (TARGET display_layout)
return ()
endif ()

add_executable (display_layout EXCLUDE_FROM_ALL display_layout.cpp general.cpp process_file.cpp sizes.cpp)
target_link_libraries (display_layout PUBLIC chopper_lib)
target_link_libraries (display_layout PUBLIC chopper::chopper)

0 comments on commit 83fb59a

Please sign in to comment.