Skip to content

Commit

Permalink
Merge branch 'cherry-pick-e91695c5' into 'release-v0.6'
Browse files Browse the repository at this point in the history
Cherry-pick 'DOR-670-homebrew-dylibs' into 'release-v0.6'

See merge request machine-learning/dorado!968
  • Loading branch information
blawrence-ont committed Apr 23, 2024
2 parents 3e060db + c7cd5d8 commit 6c0e220
Show file tree
Hide file tree
Showing 5 changed files with 37 additions and 12 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -341,6 +341,7 @@ if(NOT DORADO_DISABLE_DORADO)
endif()

enable_warnings_as_errors(dorado)
check_linked_libs(dorado)

if (DORADO_ENABLE_PCH)
target_precompile_headers(dorado REUSE_FROM dorado_lib)
Expand Down
2 changes: 1 addition & 1 deletion DEV.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,5 @@ $ brew link autoconf@2.69

The following other packages need to be available as well
```bash
brew install openssl zstd hdf5
brew install openssl zstd
```
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -452,8 +452,6 @@ On macOS, the equivalent export would be (change path as appropriate):
$ export DYLD_LIBRARY_PATH=<PATH_TO_DORADO>/dorado-x.y.z-osx-arm64/lib:$DYLD_LIBRARY_PATH
```

This will let the Dorado binary pick up the shipped libraries and you will not need to manually install `libaec` and `zstd`.

### Improving the Speed of Duplex Basecalling

Duplex basecalling is an IO-intensive process and can perform poorly if using networked storage or HDD. This can generally be improved by splitting up POD5 files appropriately.
Expand Down
25 changes: 16 additions & 9 deletions cmake/HDF5.cmake
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
set(HDF_VER hdf5-1.12.1-3)
set(ZLIB_VER 1.2.12)

option(DYNAMIC_HDF "Link HDF as dynamic libs" OFF)

if((CMAKE_SYSTEM_NAME STREQUAL "Linux") AND (CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64"))
# download the pacakge for arm, we want to package this due to hdf5's dependencies

set(DYNAMIC_HDF ON)
set(HDF_VER hdf5-1.10.0-aarch64)
if(EXISTS ${DORADO_3RD_PARTY_DOWNLOAD}/${HDF_VER})
message(STATUS "Found ${HDF_VER}")
else()
download_and_extract(https://cdn.oxfordnanoportal.com/software/analysis/${HDF_VER}.zip ${HDF_VER})
endif()
download_and_extract(https://cdn.oxfordnanoportal.com/software/analysis/${HDF_VER}.zip ${HDF_VER})
list(PREPEND CMAKE_PREFIX_PATH ${DORADO_3RD_PARTY_DOWNLOAD}/${HDF_VER}/${HDF_VER})

elseif(WIN32)
set(HDF_VER hdf5-1.12.1-3)
set(ZLIB_VER 1.2.12)

# On windows, we need to build HDF5
set(HDF5_ZLIB_INSTALL_DIR ${CMAKE_BINARY_DIR}/zlib-${ZLIB_VER}/install)
if(EXISTS ${DORADO_3RD_PARTY_DOWNLOAD}/${HDF_VER} AND EXISTS ${HDF5_ZLIB_INSTALL_DIR})
Expand All @@ -42,9 +37,21 @@ elseif(WIN32)
list(APPEND CMAKE_PREFIX_PATH ${DORADO_3RD_PARTY_DOWNLOAD}/${HDF_VER}/${HDF_VER})

install(FILES ${HDF5_ZLIB_INSTALL_DIR}/bin/zlib.dll DESTINATION bin)

elseif (IOS)
# iOS doesn't make use of HDF5.
return()

elseif (APPLE)
set(HDF_VER 1.14.3)
if (CMAKE_SYSTEM_PROCESSOR STREQUAL "x86_64")
set(HDF_ARCH "x86_64")
else()
set(HDF_ARCH "armv8")
endif()
download_and_extract(https://cdn.oxfordnanoportal.com/software/analysis/hdf5-${HDF_VER}-${HDF_ARCH}.zip hdf5-${HDF_VER}-${HDF_ARCH})
list(PREPEND CMAKE_PREFIX_PATH ${DORADO_3RD_PARTY_DOWNLOAD}/hdf5-${HDF_VER}-${HDF_ARCH}/${HDF_VER}_${HDF_ARCH})

endif()

if(DYNAMIC_HDF)
Expand Down
19 changes: 19 additions & 0 deletions cmake/Warnings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,22 @@ function(disable_warnings TARGET_NAME)
)
endif()
endfunction()

function(check_linked_libs TARGET_NAME)
if (ECM_ENABLE_SANITIZERS)
# We don't ship these, so no need to check them.
return()
endif()

if (APPLE)
add_custom_command(
TARGET ${TARGET_NAME}
POST_BUILD
COMMAND echo "Checking linked libs..."
# We shouldn't be linking to anything from homebrew.
COMMAND sh -c "otool -L $<TARGET_FILE:${TARGET_NAME}> | grep -i /opt/homebrew ; test $? -eq 1"
COMMAND sh -c "otool -L $<TARGET_FILE:${TARGET_NAME}> | grep -i /usr/local/opt ; test $? -eq 1"
VERBATIM
)
endif()
endfunction()

0 comments on commit 6c0e220

Please sign in to comment.