Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change seqan3 for FM-index from sdsl-lite #14

Merged
merged 12 commits into from
Oct 3, 2022
Merged
79 changes: 55 additions & 24 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,22 +1,24 @@
cmake_minimum_required(VERSION 3.4)
project(unitig_query)
cmake_minimum_required(VERSION 3.9) # CMP0069 NEW
set(TARGET_NAME unitig_query)
project("${TARGET_NAME}")
add_compile_definitions(PYTHON_EXT)

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fconcepts")

# find pthreads
set(THREADS_PREFER_PTHREAD_FLAG ON)
find_package(Threads REQUIRED)

# check for conda environment
IF( DEFINED ENV{CONDA_PREFIX} )
# set conda directory
SET(CONDA_DIR "$ENV{CONDA_PREFIX}")
# find Seqan3 packages
find_path(SEQAN3_CLONE_DIR name bin PATHS ${CONDA_DIR} NO_DEFAULT_PATH)
find_path(SEQAN3_INCLUDE_DIR name seqan PATHS ${SEQAN3_CLONE_DIR}/include NO_DEFAULT_PATH)
find_path(SEQAN3_SUBMODULES_DIR name submodules PATHS ${SEQAN3_INCLUDE_DIR}/seqan3 NO_DEFAULT_PATH)
if(ENV{UC_INSTALL} EQUAL "conda")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DFS_EXP -fconcepts")
endif()

IF(CMAKE_COMPILER_IS_GNUCC OR "$ENV{SKETCHLIB_INSTALL}" STREQUAL "conda")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fopenmp")
ENDIF()

# gcc debug flags
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0")

# Vendored libraries
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/vendor)

#Find include dirs for z and bifrost
FIND_PATH(z_INCLUDE_DIR NAMES zlib.h HINTS ${CONDA_DIR}/include)
Expand All @@ -27,19 +29,48 @@ FIND_LIBRARY(z_LIBRARY NAMES z HINTS ${CONDA_DIR}/lib REQUIRED)
FIND_LIBRARY(bifrost_LIBRARY NAMES bifrost HINTS ${CONDA_DIR}/lib REQUIRED)

# Set package found as true
FIND_PACKAGE_HANDLE_STANDARD_ARGS(z DEFAULT_MSG z_INCLUDE_DIR z_LIBRARY)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(bifrost DEFAULT_MSG bifrost_INCLUDE_DIR bifrost_LIBRARY)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(z DEFAULT_MSG z_INCLUDE_DIR z_LIBRARY)
find_package_handle_standard_args(bifrost DEFAULT_MSG bifrost_INCLUDE_DIR bifrost_LIBRARY)

# Set dirs if multiple include/libraries found
SET( z_INCLUDE_DIRS ${z_INCLUDE_DIR} )
SET( z_LIBRARIES ${z_LIBRARY} )
SET( bifrost_INCLUDE_DIRS ${z_INCLUDE_DIR} )
SET( bifrost_INCLUDE_DIRS ${bifrost_INCLUDE_DIR} )
SET( bifrost_LIBRARIES ${bifrost_LIBRARY} )

# find SeqAn3 packages
find_package(SeqAn3 REQUIRED HINTS ${CONDA_DIR}/share/cmake/seqan3)
include_directories(${bifrost_INCLUDE_DIR})
include_directories(${z_INCLUDE_DIR})

add_library("${TARGET_NAME}" MODULE)
execute_process(COMMAND pybind11-config --cmakedir OUTPUT_STRIP_TRAILING_WHITESPACE OUTPUT_VARIABLE pybind11_DIR)
find_package(pybind11 2.6 CONFIG REQUIRED)

target_sources("${TARGET_NAME}" PRIVATE src/map_strings.cpp src/map_bindings.cpp src/bifrost.cpp)

set_target_properties("${TARGET_NAME}" PROPERTIES
CXX_VISIBILITY_PRESET "hidden"
PREFIX "${PYTHON_MODULE_PREFIX}"
SUFFIX "${PYTHON_MODULE_EXTENSION}"
)

find_package(pybind11 REQUIRED)
pybind11_add_module(unitig_query src/map_strings.cpp src/map_bindings.cpp src/bifrost.cpp)
include(CheckIPOSupported)
check_ipo_supported(RESULT result)
if(result)
set_target_properties("${TARGET_NAME}" PROPERTIES
INTERPROCEDURAL_OPTIMIZATION ON)
endif()

target_link_libraries(unitig_query PRIVATE seqan3::seqan3 ${bifrost_LIBRARIES} ${z_LIBRARIES} Threads::Threads)
target_link_libraries("${TARGET_NAME}" PRIVATE pybind11::module ${bifrost_LIBRARIES} ${z_LIBRARIES})
if(DEFINED ENV{CONDA_PREFIX} AND (NOT APPLE OR CMAKE_COMPILER_IS_GNUCC OR ENV{UC_INSTALL} EQUAL "conda"))
target_link_libraries("${TARGET_NAME}" PRIVATE gomp)
else()
find_package(OpenMP)
if(OpenMP_CXX_FOUND)
target_link_libraries("${TARGET_NAME}" PRIVATE OpenMP::OpenMP_CXX)
endif()
endif()
if(ENV{UC_INSTALL} EQUAL "conda")
else()
target_link_libraries("${TARGET_NAME}" PRIVATE stdc++fs)
endif()
1 change: 1 addition & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ steps:
# pushd src && make && make install && popd
- script: |
source activate unitig_caller_env
export UC_INSTALL=conda
python -m pip install --no-deps --ignore-installed .
cd test && python run_test.py
displayName: 'Install and run_test.py'
4 changes: 1 addition & 3 deletions environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ channels:
- conda-forge
- bioconda
- defaults
- r
dependencies:
- python
- pip
Expand All @@ -12,5 +11,4 @@ dependencies:
- zlib
- bzip2
- bifrost >=1.0.6
- seqan3 >=3.1.0
- pthread-stubs
- libgomp
Loading