Skip to content

Commit

Permalink
biology/kallisto: Clean up build
Browse files Browse the repository at this point in the history
Silence warnings due to detected compiler standards
Enable BAM support in cmake
Patch out remaining aggressive optimizations
  • Loading branch information
Jason W. Bacon authored and Jason W. Bacon committed Jul 24, 2023
1 parent 20a8f66 commit ddc8126
Show file tree
Hide file tree
Showing 4 changed files with 69 additions and 11 deletions.
8 changes: 5 additions & 3 deletions biology/kallisto/Makefile
@@ -1,7 +1,7 @@
PORTNAME= kallisto
DISTVERSIONPREFIX= v
DISTVERSION= 0.50.0
PORTREVISION= 1
PORTREVISION= 2
PORTEPOCH= 1
CATEGORIES= biology

Expand All @@ -12,8 +12,8 @@ WWW= https://pachterlab.github.io/kallisto/about.html
LICENSE= BSD2CLAUSE
LICENSE_FILE= ${WRKSRC}/license.txt

# Requires a 64-bit processor
ONLY_FOR_ARCHS= aarch64 amd64 powerpc64 powerpc64le riscv64
ONLY_FOR_ARCHS_REASON= Requires a 64-bit processor

LIB_DEPENDS= libhdf5.so:science/hdf5 \
libsz.so:science/libaec \
Expand All @@ -32,7 +32,9 @@ EXAMPLES_PLIST_FILES= bin/kallisto-test
# hdf5 is being phased out and is no longer built in by default, but is still
# required for Sleuth (requires kallisto bootstrap estimates) and other
# downstream tools. Remove this after Sleuth et al catch up.
CMAKE_ARGS+= -DUSE_HDF5:BOOL=ON
CMAKE_ARGS+= -DUSE_HDF5:BOOL=ON -DUSE_BAM:BOOL=ON
# WIP: Remove before committing
CMAKE_ARGS+= -DCMAKE_VERBOSE_MAKEFILE:BOOL=ON
MAKE_JOBS_UNSAFE= yes
LDFLAGS+= -lhts -lz

Expand Down
27 changes: 26 additions & 1 deletion biology/kallisto/files/patch-CMakeLists.txt
@@ -1,6 +1,31 @@
--- CMakeLists.txt.orig 2023-06-27 10:45:00 UTC
+++ CMakeLists.txt
@@ -56,42 +56,16 @@ ENDIF(LINK MATCHES static)
@@ -33,10 +33,11 @@ if(${CMAKE_VERSION} VERSION_LESS 3.1)
# remove this block once CMake >=3.1 has fixated in the ecosystem
add_compile_options(-std=c++11)
else()
+ # Use c++11 to silence warnings
include(CheckCXXCompilerFlag)
- check_cxx_compiler_flag(-std=c++17 COMPILER_SUPPORTS_CXX17)
+ check_cxx_compiler_flag(-std=c++11 COMPILER_SUPPORTS_CXX17)
if(COMPILER_SUPPORTS_CXX17)
- set(CMAKE_CXX_STANDARD 17)
+ set(CMAKE_CXX_STANDARD 11)
else()
set(CMAKE_CXX_STANDARD 11)
endif()
@@ -44,9 +45,7 @@ else()
set(CMAKE_CXX_EXTENSIONS OFF)
endif()

-#add_compile_options(-Wall -Wno-unused-function)
-add_compile_options(-Wno-subobject-linkage) # Suppress bifrost warning
-set(PROJECT_BIFROST_CMAKE_CXX_FLAGS "-Wno-subobject-linkage -Wno-return-type") # Suppress bifrost warning
+set(PROJECT_BIFROST_CMAKE_CXX_FLAGS "-Wno-return-type") # Suppress bifrost warning

if(LINK MATCHES static)
message("static build")
@@ -56,42 +55,16 @@ ENDIF(LINK MATCHES static)


include(ExternalProject)
Expand Down
33 changes: 31 additions & 2 deletions biology/kallisto/files/patch-ext_bifrost_CMakeLists.txt
@@ -1,6 +1,26 @@
--- ext/bifrost/CMakeLists.txt.orig 2023-07-14 14:27:24 UTC
--- ext/bifrost/CMakeLists.txt.orig 2023-06-27 10:45:00 UTC
+++ ext/bifrost/CMakeLists.txt
@@ -30,8 +30,6 @@ if(COMPILATION_ARCH MATCHES "OFF")
@@ -7,18 +7,12 @@ find_package(Threads REQUIRED)
# To enable a larger default k-mer size, replace MAX_KMER_SIZE with a larger multiple of 32: actual maximum k-mer size will be MAX_KMER_SIZE-1.
SET(MAX_KMER_SIZE "32" CACHE STRING "MAX_KMER_SIZE")
SET(MAX_GMER_SIZE "${MAX_KMER_SIZE}" CACHE STRING "MAX_GMER_SIZE")
-# Enable architecture optimizations
-SET(COMPILATION_ARCH "native" CACHE STRING "COMPILATION_ARCH")
-# Enable AVX2 instructions
-SET(ENABLE_AVX2 "ON" CACHE STRING "ENABLE_AVX2")
+SET(CMAKE_VERBOSE_MAKEFILE "ON")

# Set some default compile flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

-set_property(SOURCE BlockedBloomFilter.cpp APPEND_STRING PROPERTY COMPILE_FLAGS " -funroll-loops")
-
-
#check if we are on arm64 and apple, if so, disable AVX2
if(APPLE AND CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
message("Disabling AVX2 instructions on arm64")
@@ -30,8 +24,6 @@ if(COMPILATION_ARCH MATCHES "OFF")
message("Disabling native architecture compilation (including AVX2)")
else(COMPILATION_ARCH MATCHES "OFF")
message("Compilation architecture: ${COMPILATION_ARCH}")
Expand All @@ -9,3 +29,12 @@
endif(COMPILATION_ARCH MATCHES "OFF")

if(ENABLE_AVX2 MATCHES "OFF")
@@ -56,7 +48,7 @@ else(CMAKE_BUILD_TYPE MATCHES Debug)
set(CMAKE_EXE_LINKER_FLAGS "-pg")
else(CMAKE_BUILD_TYPE MATCHES Profile)
message("Build type: Release")
- add_compile_options(-O3)
+ add_compile_options(-O2)
endif(CMAKE_BUILD_TYPE MATCHES Profile)
endif(CMAKE_BUILD_TYPE MATCHES Debug)

12 changes: 7 additions & 5 deletions biology/kallisto/files/patch-src_CMakeLists.txt
@@ -1,17 +1,19 @@
--- src/CMakeLists.txt.orig 2023-07-06 14:07:38 UTC
--- src/CMakeLists.txt.orig 2023-06-27 10:45:00 UTC
+++ src/CMakeLists.txt
@@ -3,10 +3,6 @@ file(GLOB headers *.h *.hpp)
@@ -3,12 +3,6 @@ file(GLOB headers *.h *.hpp)

list(REMOVE_ITEM sources main.cpp)

-if (USE_BAM)
-include_directories(../ext/htslib)
-endif(USE_BAM)
-
add_compile_options(-Wno-subobject-linkage) # Suppress bifrost warning
-add_compile_options(-Wno-subobject-linkage) # Suppress bifrost warning
-
add_library(kallisto_core ${sources} ${headers})
@@ -17,7 +13,7 @@ add_executable(kallisto main.cpp)
target_include_directories(kallisto_core PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

@@ -17,7 +11,7 @@ add_executable(kallisto main.cpp)
find_package( Threads REQUIRED )
ExternalProject_Get_Property(bifrost install_dir)
if (USE_BAM)
Expand Down

0 comments on commit ddc8126

Please sign in to comment.