diff --git a/CMakeLists.txt b/CMakeLists.txt index ad691d5a..d4c48f00 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,11 +11,9 @@ if(Protobuf_FOUND) message(STATUS "Found Protocol Buffers: ${Protobuf_VERSION}") endif() - FIND_PACKAGE(Boost COMPONENTS system filesystem program_options unit_test_framework iostreams date_time REQUIRED) include_directories(${Boost_INCLUDE_DIRS}) -# include("./vcpkg.cmake") find_package(PkgConfig REQUIRED) pkg_check_modules(JSONCPP jsoncpp) @@ -23,42 +21,34 @@ include(${TBB_DIR}/cmake/TBBBuild.cmake) tbb_build(TBB_ROOT ${TBB_DIR} CONFIG_DIR TBB_DIR MAKE_ARGS arch=arm64 tbb_cpf=1) find_package(TBB REQUIRED tbbmalloc tbbmalloc_proxy tbb_preview) -# FIND_PACKAGE(ZLIB COMPONENTS ZLIB REQUIRED) - -# minimap2 -add_custom_target(libminimap2.a - COMMAND make arm_neon=1 aarch64=1 libminimap2.a - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/minimap2_src/ -) -add_custom_target(clean-minimap - COMMAND make clean - WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/src/minimap2_src/ -) -file(GLOB PANMAT_SRCS "src/align_from_seeds.c" "src/main.cpp" "src/PangenomeMAT.cpp" "src/PangenomeMAT.hpp" "src/minimap2_src/libminimap2.a" "src/kseq.h") -file(GLOB TEST_SRCS "src/align_from_seeds.c" "src/PangenomeMAT.cpp" "src/PangenomeMAT.hpp" "src/minimap2_src/libminimap2.a" "src/kseq.h" "src/test/*.cpp") - +file(GLOB PANMAT_SRCS "src/main.cpp" "src/PangenomeMAT.cpp" "src/PangenomeMAT.hpp") +file(GLOB PANMAT_LIB_SRCS "src/PangenomeMAT.cpp" "src/PangenomeMAT.hpp") # targets add_executable(panmat-utils ${PANMAT_SRCS}) -add_executable(tests ${TEST_SRCS}) - protobuf_generate(LANGUAGE cpp TARGET panmat-utils PROTOS mutation_annotation_test_proto3_optional_new.proto) -protobuf_generate(LANGUAGE cpp - TARGET tests - PROTOS mutation_annotation_test_proto3_optional_new.proto) - -add_dependencies(panmat-utils libminimap2.a) -add_dependencies(tests libminimap2.a) - -set_directory_properties(PROPERTIES ADDITIONAL_MAKE_CLEAN_FILES ${CMAKE_BINARY_DIR}/clean-minimap) target_compile_options(panmat-utils PRIVATE -DTBB_SUPPRESS_DEPRECATED_MESSAGES) -target_compile_options(tests PRIVATE -DTBB_SUPPRESS_DEPRECATED_MESSAGES) +target_link_libraries(panmat-utils PRIVATE ${JSONCPP_LINK_LIBRARIES} ${spoa_DIR}/build/lib/libspoa.a stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} protobuf::libprotobuf z) +target_include_directories(panmat-utils PUBLIC "${PROJECT_BINARY_DIR}" ${spoa_DIR}/include) + -target_link_libraries(panmat-utils PRIVATE ${JSONCPP_LINK_LIBRARIES} ${spoa_DIR}/build/lib/libspoa.a stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} protobuf::libprotobuf ${CMAKE_SOURCE_DIR}/src/minimap2_src/libminimap2.a z) -target_link_libraries(tests PRIVATE ${JSONCPP_LINK_LIBRARIES} ${spoa_DIR}/build/lib/libspoa.a stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} protobuf::libprotobuf ${CMAKE_SOURCE_DIR}/src/minimap2_src/libminimap2.a z) -target_include_directories(panmat-utils PUBLIC "${PROJECT_BINARY_DIR}" ${spoa_DIR}/include) \ No newline at end of file +add_library(libpanmat SHARED ${PANMAT_LIB_SRCS}) +protobuf_generate(LANGUAGE cpp + TARGET libpanmat + PROTOS mutation_annotation_test_proto3_optional_new.proto) +target_link_libraries(libpanmat PRIVATE ${JSONCPP_LINK_LIBRARIES} ${spoa_DIR}/build/lib/libspoa.a stdc++ ${Boost_LIBRARIES} ${TBB_IMPORTED_TARGETS} protobuf::libprotobuf z) +target_include_directories(libpanmat PUBLIC "${PROJECT_BINARY_DIR}" ${spoa_DIR}/include) +set_target_properties(libpanmat PROPERTIES PUBLIC_HEADER src/PangenomeMAT.hpp) +export(TARGETS libpanmat FILE libpanmatConfig.cmake) + +configure_file(src/PangenomeMAT.hpp include/PangenomeMAT.hpp COPYONLY) +install(TARGETS libpanmat + ARCHIVE DESTINATION "lib" + LIBRARY DESTINATION "lib" + PUBLIC_HEADER DESTINATION "include" + )