Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
105 changes: 105 additions & 0 deletions .github/workflows/python-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
name: Build FastVoxel

on:
push:
branches: [ fixcmake, main, master ]
pull_request:
branches: [ fixcmake, main, master ]
workflow_dispatch:

jobs:
build-linux:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ['3.10']

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y swig cmake build-essential

- name: Install Python build dependencies
run: |
pip install "numpy<2.0" scikit-build setuptools wheel build

- name: Build and install FastVoxel
run: |
pip install . -v

- name: Test import (from different directory)
run: |
python -c "import fastvoxel; print('FastVoxel imported successfully')"
working-directory: demo

build-macos:
runs-on: macos-latest
strategy:
matrix:
python-version: ['3.10']

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install system dependencies
run: |
brew install swig cmake

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install "numpy<2.0" scikit-build setuptools wheel

- name: Build and install FastVoxel
run: |
pip install .

- name: Test import
run: |
python -c "import fastvoxel; print('FastVoxel imported successfully')"
working-directory: demo

build-windows:
runs-on: windows-latest
strategy:
matrix:
python-version: ['3.10']

steps:
- uses: actions/checkout@v4

- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Install SWIG
run: |
choco install swig -y

- name: Install Python dependencies
run: |
python -m pip install --upgrade pip
pip install "numpy<2.0" scikit-build setuptools wheel

- name: Build and install FastVoxel
run: |
pip install .

- name: Test import
run: |
python -c "import fastvoxel; print('FastVoxel imported successfully')"
working-directory: demo
43 changes: 7 additions & 36 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
CMAKE_MINIMUM_REQUIRED(VERSION 3.6.0)
CMAKE_MINIMUM_REQUIRED(VERSION 3.10.0)

# Maps to a solution file (fastvoxel.sln). The solution will
# have all targets (exe, lib, dll) as projects (.vcproj)
project (fastvoxel VERSION 1.0.1)
project (fastvoxel VERSION 1.0.2)

# Set compiler flags and options.
#############################################################
Expand Down Expand Up @@ -56,43 +56,14 @@ include( InstallRequiredSystemLibraries )
# require swig > v3
FIND_PACKAGE(SWIG REQUIRED)

include(UseSWIG)

INCLUDE(${SWIG_USE_FILE})

# Find package for building
FIND_PACKAGE(PythonLibs 3.8 REQUIRED)
# Find Python 3
find_package(Python3 COMPONENTS Interpreter Development.Module NumPy REQUIRED)
list(APPEND CMAKE_SWIG_FLAGS "-py3" "-DPY3")

#Find numpy include directory

find_package(PythonInterp)
set(__numpy_out 1)

if (PYTHON_EXECUTABLE)
# Find out the include path
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" -c
"from __future__ import print_function\ntry: import numpy; print(numpy.get_include(), end='')\nexcept:pass\n"
OUTPUT_VARIABLE __numpy_path)
# And the version
execute_process(
COMMAND "${PYTHON_EXECUTABLE}" -c
"from __future__ import print_function\ntry: import numpy; print(numpy.__version__, end='')\nexcept:pass\n"
OUTPUT_VARIABLE __numpy_version)
elseif(__numpy_out)
message(STATUS "Python executable not found.")
endif(PYTHON_EXECUTABLE)


find_path(PYTHON_NUMPY_INCLUDE_DIR numpy/arrayobject.h
HINTS "${__numpy_path}" "${PYTHON_INCLUDE_PATH}" NO_DEFAULT_PATH)

if(PYTHON_NUMPY_INCLUDE_DIR)
set(PYTHON_NUMPY_FOUND 1 CACHE INTERNAL "Python numpy found")
endif(PYTHON_NUMPY_INCLUDE_DIR)


INCLUDE_DIRECTORIES(${PYTHON_NUMPY_INCLUDE_DIR})

INCLUDE_DIRECTORIES(${PYTHON_INCLUDE_PATH})

INCLUDE_DIRECTORIES("${PROJECT_SOURCE_DIR}/src")
Expand All @@ -110,7 +81,7 @@ ENDIF ()



SWIG_LINK_LIBRARIES(fastvoxel ${PYTHON_LIBRARIES})
SWIG_LINK_LIBRARIES(fastvoxel Python3::NumPy)

# Creates a folder "libraries" and adds target project (lib_interface.vcproj) under it
set_property(TARGET ${SWIG_MODULE_fastvoxel_REAL_NAME} PROPERTY FOLDER "libraries")
Expand Down
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ requires = [
"scikit-build",
"cmake",
"swig",
"numpy<2.0",
"ninja; platform_system!='Windows'"
]
build-backend = "setuptools.build_meta"
Expand Down
Loading