Skip to content

Commit

Permalink
Merge pull request #36 from TravisWheelerLab/addPIC
Browse files Browse the repository at this point in the history
Add compiler flags to cmake build
  • Loading branch information
Sawwave authored Feb 22, 2024
2 parents d7c46c6 + 984e7d9 commit 34069d1
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
20 changes: 19 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ project(
)

set(CMAKE_C_STANDARD 17)

set(CMAKE_POSITION_INDEPENDENT_CODE ON)

#add support for OpenMP
find_package(OpenMP REQUIRED)
Expand Down Expand Up @@ -116,6 +116,9 @@ target_compile_options(
-march=native
-Wall
-Wextra
-O3
-fPIC
-lgomp
${OpenMP_C_FLAGS}
)

Expand All @@ -126,6 +129,9 @@ target_compile_options(
-march=native
-Wall
-Wextra
-O3
-fPIC
-lgomp
${OpenMP_C_FLAGS}
)

Expand Down Expand Up @@ -154,6 +160,9 @@ install(
# Dependencies
# ------------

set(BUILD_SHARED_LIBS OFF CACHE BOOL "Build shared libraries" FORCE)
set(CMAKE_BUILD_TYPE "Release")

add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/lib/)

# Custom target for building submodules
Expand Down Expand Up @@ -211,6 +220,8 @@ add_custom_target(build_divsufsort
COMMENT "Building submodule"
)

set_target_properties(build_divsufsort PROPERTIES POSITION_INDEPENDENT_CODE ON)

# Custom command to move the divsufsort64.h file after the end of the build
add_custom_command(
TARGET awfmindex_static POST_BUILD # Add dependency on build_submodule
Expand All @@ -219,5 +230,12 @@ add_custom_command(
${CMAKE_CURRENT_BINARY_DIR}/build/
)

add_custom_command(
TARGET awfmindex_static POST_BUILD # Add dependency on build_submodule
COMMAND ${CMAKE_COMMAND} -E copy
${CMAKE_CURRENT_BINARY_DIR}/lib/libdivsufsort/lib/build/libdivsufsort64.a
${CMAKE_CURRENT_BINARY_DIR}/build/
)

# Add a dependency on build_submodule
add_dependencies(awfmindex_static build_divsufsort)
2 changes: 1 addition & 1 deletion lib/FastaVector

0 comments on commit 34069d1

Please sign in to comment.