Skip to content

Commit

Permalink
Try to workaround macOS build failures
Browse files Browse the repository at this point in the history
  • Loading branch information
robomics committed Jul 30, 2023
1 parent dc434f4 commit 50155a5
Show file tree
Hide file tree
Showing 26 changed files with 850 additions and 11 deletions.
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,12 @@ project(
HOMEPAGE_URL https://github.com/paulsengroup/hictkpy
DESCRIPTION "High-performance C++ library to read and write .cool files.")

# include(cmake/FetchExternalDeps.cmake)
include(FetchContent)
FetchContent_Declare(
hictk
GIT_REPOSITORY "https://github.com/paulsengroup/hictk.git"
GIT_TAG "6e9d46efc3cd3a4efa06db9d05b9af9fe91df4fe"
GIT_TAG "1c2ec57446d1485e16958bc611016548329b6620"
SYSTEM)

set(BUILD_SHARED_LIBS ON)
Expand All @@ -37,6 +38,7 @@ set(HICTK_BUILD_BENCHMARKS OFF)
set(HICTK_BUILD_PYTHON_BINDINGS OFF)
set(HICTK_WITH_EIGEN OFF)
set(HICTK_BUILD_TOOLS OFF)
set(HICTK_INSTALL OFF)
FetchContent_MakeAvailable(hictk)

add_library(hictkpy_project_options INTERFACE)
Expand Down
105 changes: 105 additions & 0 deletions cmake/FetchExternalDeps.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
# Copyright (C) 2023 Roberto Rossini <[email protected]>
#
# SPDX-License-Identifier: MIT

include(FetchContent)

FetchContent_Declare(
FastFloat
URL ${CMAKE_CURRENT_SOURCE_DIR}/external/fast_float-v5.2.0.tar.xz
URL_HASH SHA256=4c46c081d2098d1d39f70a003e0ada92959b305c121addab60a92de1cfffaae2
EXCLUDE_FROM_ALL SYSTEM FIND_PACKAGE_ARGS)

FetchContent_Declare(
fmt
URL ${CMAKE_CURRENT_SOURCE_DIR}/external/fmt-v10.0.0.tar.xz
URL_HASH SHA256=8570604ab8bc1c4cf70c3eecd278c88be3acf941373374c4908ddf9e7ae84288
EXCLUDE_FROM_ALL
SYSTEM
FIND_PACKAGE_ARGS
NAMES
FMT)

FetchContent_Declare(
HDF5
URL ${CMAKE_CURRENT_SOURCE_DIR}/external/hdf5-v1.14.1.tar.xz
URL_HASH SHA256=61af1d1412160d2369c44b0ef7a5e92269f596de03d1c47f6d2680af29b0bbd6
EXCLUDE_FROM_ALL SYSTEM FIND_PACKAGE_ARGS)

FetchContent_Declare(
HighFive
URL ${CMAKE_CURRENT_SOURCE_DIR}/external/highfive-v2.7.1.tar.xz
URL_HASH SHA256=951596d3e85bbc8c6ea00cd73ee76e2af203dd29febdce827016378d2f0925e8
EXCLUDE_FROM_ALL SYSTEM FIND_PACKAGE_ARGS)

FetchContent_Declare(
libdeflate
URL ${CMAKE_CURRENT_SOURCE_DIR}/external/libdeflate-v1.18.tar.xz
URL_HASH SHA256=f1e1e2432f9329a5f53939527afb46c417c843520bd526be7f777ab270eb65a0
EXCLUDE_FROM_ALL SYSTEM FIND_PACKAGE_ARGS)

FetchContent_Declare(
phmap
URL ${CMAKE_CURRENT_SOURCE_DIR}/external/parallel-hashmap-v1.3.11.tar.xz
URL_HASH SHA256=f8f672e9fefdaa5fba555a77ff1037d9003401344dd651e71c98212e3eaad8cc
EXCLUDE_FROM_ALL SYSTEM FIND_PACKAGE_ARGS)

FetchContent_Declare(
spdlog
URL ${CMAKE_CURRENT_SOURCE_DIR}/external/spdlog-v1.12.0.tar.xz
URL_HASH SHA256=a37bb250032861c468716861f76aa97192a31107308aea8bf21cb0ad23e8693a
EXCLUDE_FROM_ALL SYSTEM FIND_PACKAGE_ARGS)

FetchContent_Declare(
zlib
URL ${CMAKE_CURRENT_SOURCE_DIR}/external/zlib-v1.2.13.tar.xz
URL_HASH SHA256=da09190636bdd21d1fbe90edb78c7ede68fdac4db7549f8d4521667d552db262
EXCLUDE_FROM_ALL
SYSTEM
FIND_PACKAGE_ARGS
NAMES
ZLIB)

# Setup libdeflate
set(LIBDEFLATE_BUILD_SHARED_LIB ${BUILD_SHARED_LIBS})
set(LIBDEFLATE_BUILD_STATIC_LIB NOT ${BUILD_SHARED_LIBS})
set(LIBDEFLATE_COMPRESSION_SUPPORT OFF)
set(LIBDEFLATE_BUILD_GZIP OFF)

# Setup HDF5
set(BUILD_STATIC_LIBS NOT ${BUILD_SHARED_LIBS})
set(ONLY_SHARED_LIBS ${BUILD_SHARED_LIBS})
set(HDF5_ENABLE_THREADSAFE OFF)
set(BUILD_TESTING OFF)
set(HDF5_BUILD_TOOLS OFF)
set(HDF5_BUILD_EXAMPLES OFF)
set(HDF5_BUILD_HL_LIB OFF)
set(HDF5_BUILD_FORTRAN OFF)
set(HDF5_BUILD_CPP_LIB OFF)
set(HDF5_ENABLE_Z_LIB_SUPPORT ON)

# Setup HighFive
set(HIGHFIVE_PARALLEL_HDF5 OFF)
set(HIGHFIVE_USE_BOOST OFF)
set(HIGHFIVE_USE_EIGEN OFF)
set(HIGHFIVE_USE_XTENSOR OFF)
set(HIGHFIVE_USE_OPENCV OFF)
set(HIGHFIVE_EXAMPLES OFF)
set(HIGHFIVE_UNIT_TESTS OFF)
set(HIGHFIVE_BUILD_DOCS OFF)
set(HIGHFIVE_USE_INSTALL_DEPS OFF)

# Setup phmap
set(PHMAP_INSTALL ON)

find_package(ZLIB REQUIRED)

FetchContent_MakeAvailable(
FastFloat
fmt
HDF5
HighFive
libdeflate
phmap
spdlog
zlib)
4 changes: 4 additions & 0 deletions conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,10 @@ spdlog/1.12.0
CMakeDeps

[options]
hdf5*:enable_cxx=False
hdf5*:hl=False
hdf5*:threadsafe=False
hdf5*:parallel=False
highfive*:with_boost=False
highfive*:with_eigen=False
highfive*:with_opencv=False
Expand Down
22 changes: 22 additions & 0 deletions devel/cibw/linux/cibw_setup_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/usr/bin/env bash

# Copyright (C) 2023 Roberto Rossini ([email protected])
# SPDX-License-Identifier: MIT

set -e
set -u

# readlink -f is not available on macos...
function readlink_py {
set -eu
python3 -c 'import os, sys; print(os.path.realpath(sys.argv[1]))' "$1"
}

install_prefix="$(readlink_py "${1-/usr/local}")"

conan install conanfile.txt \
-s build_type=Release \
-s compiler.cppstd=17 \
--output-folder "$install_prefix/share/cmake/" \
-o '*/*:shared=True' \
--build="missing"
26 changes: 26 additions & 0 deletions devel/cibw/linux/conanfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Copyright (C) 2023 Roberto Rossini <[email protected]>
#
# SPDX-License-Identifier: MIT

[requires]
fast_float/5.2.0
fmt/10.0.0
hdf5/1.14.0
highfive/2.7.1
libdeflate/1.18
parallel-hashmap/1.3.11
pybind11/2.10.4
spdlog/1.12.0

[generators]
CMakeDeps

[options]
hdf5*:enable_cxx=False
hdf5*:hl=False
hdf5*:threadsafe=False
hdf5*:parallel=False
highfive*:with_boost=False
highfive*:with_eigen=False
highfive*:with_opencv=False
highfive*:with_xtensor=False
141 changes: 141 additions & 0 deletions devel/cibw/macos/cibw_setup_deps.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
#!/usr/bin/env bash

# Copyright (C) 2023 Roberto Rossini ([email protected])
# SPDX-License-Identifier: MIT

set -e
set -u

# readlink -f is not available on macos...
function readlink_py {
set -eu
python3 -c 'import os, sys; print(os.path.realpath(sys.argv[1]))' "$1"
}

export MACOSX_DEPLOYMENT_TARGET='10.15'
CMAKE_BUILD_PARALLEL_LEVEL="$(python3 -c 'import multiprocessing; multiprocessing.cpu_count()')"
export CMAKE_BUILD_PARALLEL_LEVEL

install_prefix="$(readlink_py "${1-/usr/local}")"
wd="$(mktemp -d)"

conan install conanfile.txt \
-s build_type=Release \
-s compiler.cppstd=17 \
--output-folder "$install_prefix/share/cmake/" \
-o '*/*:shared=True' \
--build="missing"

# shellcheck disable=SC2064
trap "cd '$PWD'; rm -rf '$wd'" EXIT

data_dir="$(readlink_py ../../../external)"
cd "$wd"


# tar -xf "$data_dir/fast_float-v5.2.0.tar.xz"
# cmake -DCMAKE_BUILD_TYPE=Release \
# -DCMAKE_INSTALL_PREFIX="$install_prefix" \
# -S fast_float* \
# -B fast_float_build
# cmake --build fast_float_build
# cmake --install fast_float_build


tar -xf "$data_dir/fmt-v10.0.0.tar.xz"
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$install_prefix" \
-DFMT_TEST=OFF \
-DFMT_LIB_DIR="lib" \
-DFMT_INSTALL=ON \
-S fmt* \
-B fmt_build
cmake --build fmt_build
cmake --install fmt_build


tar -xf "$data_dir/spdlog-v1.12.0.tar.xz"
cmake -DCMAKE_BUILD_TYPE=Release \
-DSPDLOG_FMT_EXTERNAL_HO=ON \
-DSPDLOG_INSTALL=ON \
-DSPDLOG_BUILD_SHARED=OFF \
-DCMAKE_INSTALL_PREFIX="$install_prefix" \
-S spdlog* \
-B spdlog_build
cmake --build spdlog_build
cmake --install spdlog_build


tar -xf "$data_dir/zlib-v1.2.13.tar.xz"
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$install_prefix" \
-DSKIP_INSTALL_FILES=ON \
-S zlib* \
-B zlib_build
cmake --build zlib_build
cmake --install zlib_build


tar -xf "$data_dir/hdf5-v1.14.1.tar.xz"
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$install_prefix" \
-DBUILD_STATIC_LIBS=OFF \
-DONLY_SHARED_LIBS=ON \
-DHDF5_ENABLE_THREADSAFE=OFF \
-DBUILD_TESTING=OFF \
-DHDF5_BUILD_TOOLS=OFF \
-DHDF5_BUILD_EXAMPLES=OFF \
-DHDF5_BUILD_HL_LIB=OFF \
-DHDF5_BUILD_FORTRAN=OFF \
-DHDF5_BUILD_CPP_LIB=OFF \
-DHDF5_ENABLE_Z_LIB_SUPPORT=ON \
-DHDF5_ENABLE_SZIP_SUPPORT=OFF \
-DHDF5_PACKAGE_EXTLIBS=OFF \
-DZLIB_ROOT=staging \
-S hdf5* \
-B hdf5_build
cmake --build hdf5_build
cmake --install hdf5_build

tar -xf "$data_dir/highfive-v2.7.1.tar.xz"
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$install_prefix" \
-DHIGHFIVE_PARALLEL_HDF5=OFF \
-DHIGHFIVE_USE_BOOST=OFF \
-DHIGHFIVE_USE_EIGEN=OFF \
-DHIGHFIVE_USE_XTENSOR=OFF \
-DHIGHFIVE_USE_OPENCV=OFF \
-DHIGHFIVE_EXAMPLES=OFF \
-DHIGHFIVE_UNIT_TESTS=OFF \
-DHIGHFIVE_BUILD_DOCS=OFF \
-DHIGHFIVE_USE_INSTALL_DEPS=OFF \
-DHDF5_C_LIBRARIES="$install_prefix/lib/libhdf5.so" \
-DHDF5_NO_FIND_PACKAGE_CONFIG_FILE=ON \
-S HighFive* \
-B HighFive_build
cmake --build HighFive_build
cmake --install HighFive_build


tar -xf "$data_dir/libdeflate-v1.18.tar.xz"
cmake -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="$install_prefix" \
-DLIBDEFLATE_BUILD_STATIC_LIB=OFF \
-DLIBDEFLATE_BUILD_SHARED_LIB=ON \
-DLIBDEFLATE_BUILD_GZIP=OFF \
-S libdeflate* \
-B libdeflate_build
cmake --build libdeflate_build
cmake --install libdeflate_build


# tar -xf "$data_dir/parallel-hashmap-v1.3.11.tar.xz"
# cmake -DCMAKE_BUILD_TYPE=Release \
# -DCMAKE_INSTALL_PREFIX="$install_prefix" \
# -DPHMAP_INSTALL=ON \
# -DPHMAP_BUILD_TESTS=OFF \
# -DPHMAP_BUILD_EXAMPLES=OFF \
# -S parallel-hashmap* \
# -B parallel-hashmap_build
# cmake --build parallel-hashmap_build
# cmake --install parallel-hashmap_build
17 changes: 17 additions & 0 deletions devel/cibw/macos/conanfile.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Copyright (C) 2023 Roberto Rossini <[email protected]>
#
# SPDX-License-Identifier: MIT

[requires]
fast_float/5.2.0
parallel-hashmap/1.3.11
pybind11/2.10.4

[generators]
CMakeDeps

[options]
highfive*:with_boost=False
highfive*:with_eigen=False
highfive*:with_opencv=False
highfive*:with_xtensor=False
Binary file added external/fast_float-v5.2.0.tar.xz
Binary file not shown.
Binary file added external/fmt-v10.0.0.tar.xz
Binary file not shown.
Binary file added external/hdf5-v1.14.1.tar.xz
Binary file not shown.
Binary file added external/highfive-v2.7.1.tar.xz
Binary file not shown.
Binary file added external/libdeflate-v1.18.tar.xz
Binary file not shown.
27 changes: 27 additions & 0 deletions external/licenses/fast_float.LICENSE-MIT
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
MIT License

Copyright (c) 2021 The fast_float authors

Permission is hereby granted, free of charge, to any
person obtaining a copy of this software and associated
documentation files (the "Software"), to deal in the
Software without restriction, including without
limitation the rights to use, copy, modify, merge,
publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software
is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice
shall be included in all copies or substantial portions
of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED
TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT
SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
Loading

0 comments on commit 50155a5

Please sign in to comment.