Skip to content

Commit

Permalink
Merge pull request #7 from sameeul/update_workflow
Browse files Browse the repository at this point in the history
Update build process
  • Loading branch information
sameeul authored Jun 12, 2024
2 parents bc42abd + f906f23 commit ebf37f3
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 21 deletions.
12 changes: 5 additions & 7 deletions .github/workflows/publish_pypi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ jobs:
steps:
- uses: actions/checkout@v3
name: Check out
with:
submodules: recursive

- uses: ilammy/msvc-dev-cmd@v1
name: Add MSVS Path
Expand Down Expand Up @@ -64,18 +62,18 @@ jobs:
make &&
make install &&
cd .. &&
yum -y install maven java &&
bash ci-utils/install_prereq_linux.sh &&
mkdir -p /tmp/bfiocpp_bld &&
cp -r local_install /tmp/bfiocpp_bld
CIBW_BEFORE_ALL_WINDOWS: ci-utils\install_prereq_win.bat &&
xcopy /E /I /y local_install C:\TEMP\bfiocpp_bld\local_install
CIBW_ENVIRONMENT_MACOS: REPAIR_LIBRARY_PATH="/tmp/bfiocpp_bld/local_install/lib:/tmp/bfiocpp_bld/local_install/lib64" ON_GITHUB="TRUE" BFIO_CPP_DEP_DIR="/tmp/bfiocpp_bld/local_install"
CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH="/tmp/bfiocpp_bld/local_install/lib:/tmp/bfiocpp_bld/local_install/lib64:$LD_LIBRARY_PATH" ON_GITHUB="TRUE" BFIO_CPP_DEP_DIR="/tmp/bfiocpp_bld/local_install"
CIBW_ENVIRONMENT_MACOS: REPAIR_LIBRARY_PATH="/tmp/bfiocpp_bld/local_install/lib:/tmp/bfiocpp_bld/local_install/lib64" ON_GITHUB="TRUE" BFIOCPP_DEP_DIR="/tmp/bfiocpp_bld/local_install"
CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH="/tmp/bfiocpp_bld/local_install/lib:/tmp/bfiocpp_bld/local_install/lib64:$LD_LIBRARY_PATH" ON_GITHUB="TRUE" BFIOCPP_DEP_DIR="/tmp/bfiocpp_bld/local_install"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-listdeps {wheel} && DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
CIBW_ENVIRONMENT_WINDOWS: PATH="$TEMP\\bfiocpp\\bin;$PATH" ON_GITHUB="TRUE" BFIO_CPP_DEP_DIR="C:\\TEMP\\bfiocpp_bld\\local_install" CMAKE_ARGS="-DCMAKE_GENERATOR=Ninja"
CIBW_ENVIRONMENT_WINDOWS: PATH="$TEMP\\bfiocpp\\bin;$PATH" ON_GITHUB="TRUE" BFIOCPP_DEP_DIR="C:\\TEMP\\bfiocpp_bld\\local_install" CMAKE_ARGS="-DCMAKE_GENERATOR=Ninja"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}"
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_BEFORE_TEST_LINUX: yum -y install maven java
CIBW_TEST_REQUIRES: bfio requests numpy ome_zarr
CIBW_TEST_COMMAND: python -W default -m unittest discover -s {project}/tests -v

Expand Down Expand Up @@ -127,7 +125,7 @@ jobs:
mkdir -p /tmp/bfiocpp_bld &&
cp -r local_install /tmp/bfiocpp_bld

CIBW_ENVIRONMENT_MACOS: REPAIR_LIBRARY_PATH="/tmp/bfiocpp_bld/local_install/lib:/tmp/bfiocpp_bld/local_install/lib64" ON_GITHUB="TRUE" BFIO_CPP_DEP_DIR="/tmp/bfiocpp_bld/local_install" CMAKE_ARGS="-DTENSORSTORE_USE_SYSTEM_JPEG=ON"
CIBW_ENVIRONMENT_MACOS: REPAIR_LIBRARY_PATH="/tmp/bfiocpp_bld/local_install/lib:/tmp/bfiocpp_bld/local_install/lib64" ON_GITHUB="TRUE" BFIOCPP_DEP_DIR="/tmp/bfiocpp_bld/local_install" CMAKE_ARGS="-DTENSORSTORE_USE_SYSTEM_JPEG=ON"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-listdeps {wheel} && DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_TEST_REQUIRES: bfio requests numpy ome_zarr
Expand Down
20 changes: 14 additions & 6 deletions .github/workflows/wheel_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -60,21 +60,29 @@ jobs:
make &&
make install &&
cd .. &&
yum -y install maven java &&
bash ci-utils/install_prereq_linux.sh &&
mkdir -p /tmp/bfiocpp_bld &&
cp -r local_install /tmp/bfiocpp_bld
CIBW_BEFORE_ALL_WINDOWS: ci-utils\install_prereq_win.bat &&
xcopy /E /I /y local_install C:\TEMP\bfiocpp_bld\local_install
CIBW_ENVIRONMENT_MACOS: REPAIR_LIBRARY_PATH="/tmp/bfiocpp_bld/local_install/lib:/tmp/bfiocpp_bld/local_install/lib64" ON_GITHUB="TRUE" BFIO_CPP_DEP_DIR="/tmp/bfiocpp_bld/local_install"
CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH="/tmp/bfiocpp_bld/local_install/lib:/tmp/bfiocpp_bld/local_install/lib64:$LD_LIBRARY_PATH" ON_GITHUB="TRUE" BFIO_CPP_DEP_DIR="/tmp/bfiocpp_bld/local_install"
CIBW_ENVIRONMENT_MACOS: REPAIR_LIBRARY_PATH="/tmp/bfiocpp_bld/local_install/lib:/tmp/bfiocpp_bld/local_install/lib64" ON_GITHUB="TRUE" BFIOCPP_DEP_DIR="/tmp/bfiocpp_bld/local_install"
CIBW_ENVIRONMENT_LINUX: LD_LIBRARY_PATH="/tmp/bfiocpp_bld/local_install/lib:/tmp/bfiocpp_bld/local_install/lib64:$LD_LIBRARY_PATH" ON_GITHUB="TRUE" BFIOCPP_DEP_DIR="/tmp/bfiocpp_bld/local_install"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-listdeps {wheel} && DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
CIBW_ENVIRONMENT_WINDOWS: PATH="$TEMP\\bfiocpp\\bin;$PATH" ON_GITHUB="TRUE" BFIO_CPP_DEP_DIR="C:\\TEMP\\bfiocpp_bld\\local_install" CMAKE_ARGS="-DCMAKE_GENERATOR=Ninja"
CIBW_ENVIRONMENT_WINDOWS: PATH="$TEMP\\bfiocpp\\bin;$PATH" ON_GITHUB="TRUE" BFIOCPP_DEP_DIR="C:\\TEMP\\bfiocpp_bld\\local_install" CMAKE_ARGS="-DCMAKE_GENERATOR=Ninja"
CIBW_REPAIR_WHEEL_COMMAND_WINDOWS: "delvewheel repair -w {dest_dir} {wheel}"
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_BEFORE_TEST_LINUX: yum -y install maven java
CIBW_TEST_REQUIRES: bfio requests numpy ome_zarr
CIBW_TEST_COMMAND: python -W default -m unittest discover -s {project}/tests -v

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: bfiocpp-wheels
path: dist/*.whl
retention-days: 1


build_wheels_apple_arm64:
name: Build wheels on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
Expand Down Expand Up @@ -113,7 +121,7 @@ jobs:
mkdir -p /tmp/bfiocpp_bld &&
cp -r local_install /tmp/bfiocpp_bld

CIBW_ENVIRONMENT_MACOS: REPAIR_LIBRARY_PATH="/tmp/bfiocpp_bld/local_install/lib:/tmp/bfiocpp_bld/local_install/lib64" ON_GITHUB="TRUE" BFIO_CPP_DEP_DIR="/tmp/bfiocpp_bld/local_install" CMAKE_ARGS="-DTENSORSTORE_USE_SYSTEM_JPEG=ON"
CIBW_ENVIRONMENT_MACOS: REPAIR_LIBRARY_PATH="/tmp/bfiocpp_bld/local_install/lib:/tmp/bfiocpp_bld/local_install/lib64" ON_GITHUB="TRUE" BFIOCPP_DEP_DIR="/tmp/bfiocpp_bld/local_install" CMAKE_ARGS="-DTENSORSTORE_USE_SYSTEM_JPEG=ON"
CIBW_REPAIR_WHEEL_COMMAND_MACOS: DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-listdeps {wheel} && DYLD_LIBRARY_PATH=$REPAIR_LIBRARY_PATH delocate-wheel --require-archs {delocate_archs} -w {dest_dir} {wheel}
CIBW_ARCHS: ${{ matrix.cibw_archs }}
CIBW_TEST_REQUIRES: bfio requests numpy ome_zarr
Expand All @@ -122,6 +130,6 @@ jobs:
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: bfiocpp-wheels
name: bfiocpp-wheels-arm64
path: dist/*.whl
retention-days: 1
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@ set(CMAKE_CXX_STANDARD_REQUIRED ON)

include(GNUInstallDirs)
# this is a workaround for GitHub Action for wheelbuiling
if(DEFINED ENV{BFIO_CPP_DEP_DIR})
set(CMAKE_PREFIX_PATH $ENV{BFIO_CPP_DEP_DIR})
link_directories($ENV{BFIO_CPP_DEP_DIR}/${CMAKE_INSTALL_LIBDIR})
if(DEFINED ENV{BFIOCPP_DEP_DIR})
set(CMAKE_PREFIX_PATH $ENV{BFIOCPP_DEP_DIR})
link_directories($ENV{BFIOCPP_DEP_DIR}/${CMAKE_INSTALL_LIBDIR})
endif()
message(STATUS "CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH}")
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Release)
endif()
endif()

set(CMAKE_CXX_FLAGS_RELEASE "-O2")
set(SOURCE
Expand Down
5 changes: 1 addition & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,17 +51,14 @@ def build_extension(self, ext):

cfg = "Debug" if self.debug else "Release"
build_args = ["--config", cfg]
cmake_args += ["-DCMAKE_BUILD_TYPE=" + cfg]

if platform.system() == "Windows":
print("-----------------Windows...")
cmake_args += [
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY_{}={}".format(cfg.upper(), extdir)
]
# if sys.maxsize > 2**32:
# cmake_args += ["-A", "x64"]
# build_args += ["--", "/m"]
else:
cmake_args += ["-DCMAKE_BUILD_TYPE=" + cfg]
build_args += ["--", "-j4"]

env = os.environ.copy()
Expand Down

0 comments on commit ebf37f3

Please sign in to comment.