Files
IfcOpenShell/src/blenderbim/Makefile
T

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

317 lines
12 KiB
Makefile
Raw Normal View History

# BlenderBIM Add-on - OpenBIM Blender Add-on
2023-03-04 23:04:05 +11:00
# Copyright (C) 2020-2023 Dion Moult <dion@thinkmoult.com>
#
# This file is part of BlenderBIM Add-on.
#
# BlenderBIM Add-on is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# BlenderBIM Add-on is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with BlenderBIM Add-on. If not, see <http://www.gnu.org/licenses/>.
2024-06-11 14:11:40 +10:00
PYTHON:=python3.11
PIP:=pip3.11
PATCH:=patch
SED:=sed -i
ifeq ($(OS),Windows_NT)
HOSTOS:=win
else
UNAME_S:=$(shell uname -s)
ifeq ($(UNAME_S),Linux)
HOSTOS:=linux
endif
ifeq ($(UNAME_S),Darwin)
HOSTOS:=macos
PYTHON:=python3
PATCH:=patch -d
SED:=sed -i '' -e
endif
endif
2024-06-11 15:41:18 +10:00
IS_STABLE:=FALSE
VERSION:=$(shell cat ../../VERSION)
VERSION_MAJOR:=$(shell cat '../../VERSION' | cut -d '.' -f 1)
VERSION_MINOR:=$(shell cat '../../VERSION' | cut -d '.' -f 2)
VERSION_PATCH:=$(shell cat '../../VERSION' | cut -d '.' -f 3)
VERSION_DATE:=$(shell date '+%y%m%d')
2023-07-12 18:15:31 +05:00
LAST_COMMIT_HASH:=$(shell git rev-parse HEAD)
PYVERSION:=py310
PYPI_IMP:=cp
2021-03-06 09:36:31 +11:00
ifeq ($(PYVERSION), py39)
PYLIBDIR:=python3.9
PYNUMBER:=39
PYPI_VERSION:=3.9
endif
2022-03-14 16:43:10 +11:00
ifeq ($(PYVERSION), py310)
PYLIBDIR:=python3.10
PYNUMBER:=310
PYPI_VERSION:=3.10
2022-03-14 16:43:10 +11:00
endif
2024-01-03 00:22:50 +01:00
ifeq ($(PYVERSION), py311)
PYLIBDIR:=python3.11
PYNUMBER:=311
PYPI_VERSION:=3.11
endif
ifeq ($(PYVERSION), py312)
PYLIBDIR:=python3.12
PYNUMBER:=312
PYPI_VERSION:=3.12
endif
ifeq ($(PLATFORM), linux)
PYPI_PLATFORM:=--platform manylinux_2_17_x86_64
2024-07-17 22:46:44 +10:00
BLENDER_PLATFORM:=linux-x64
endif
ifeq ($(PLATFORM), macos)
2024-06-01 10:48:36 +10:00
PYPI_PLATFORM:=--platform macosx_10_10_x86_64
2024-07-17 22:46:44 +10:00
BLENDER_PLATFORM:=macos-x64
endif
ifeq ($(PLATFORM), macosm1)
PYPI_PLATFORM:=--platform macosx_11_0_arm64
2024-07-17 22:46:44 +10:00
BLENDER_PLATFORM:=macos-arm64
endif
ifeq ($(PLATFORM), win)
PYPI_PLATFORM:=--platform win_amd64
2024-07-17 22:46:44 +10:00
BLENDER_PLATFORM:=windows-x64
endif
2024-07-05 11:57:57 +05:00
# Current build commit hash.
2024-07-09 08:22:57 +10:00
OLD:=c18e4ea
2023-01-05 18:38:32 +11:00
.PHONY: bump
bump:
2024-07-05 11:57:57 +05:00
cd . && $(SED) -b "s/$(OLD)/$(NEW)/" Makefile
cd ../ifcopenshell-python/ && $(SED) -b "s/$(OLD)/$(NEW)/" Makefile
cd ../ifcopenshell-python/docs/ifcconvert/ && $(SED) -b "s/$(OLD)/$(NEW)/" installation.rst
2023-01-05 18:38:32 +11:00
2019-10-06 19:59:41 +11:00
.PHONY: dist
dist:
ifndef PLATFORM
$(error PLATFORM is not set)
endif
2024-07-19 00:26:07 +10:00
rm -rf build
mkdir -p build
mkdir -p dist
cp -r blenderbim build/
2024-07-17 22:46:44 +10:00
# To scope any build-time dependencies
2024-07-19 00:26:07 +10:00
cd build && $(PYTHON) -m venv env && . env/bin/activate && $(PIP) install build
cd build && . env/bin/activate && $(PIP) install wheel
2024-07-17 22:46:44 +10:00
2024-07-19 00:26:07 +10:00
mkdir -p build/wheels
2020-07-27 21:01:16 +10:00
# Provides IfcOpenShell Python functionality
2024-07-19 00:26:07 +10:00
cd ../ifcopenshell-python && make dist PLATFORM=$(PLATFORM)64 PYVERSION=$(PYVERSION) && cp dist/*.whl ../blenderbim/build/wheels/
cd ../bcf && make dist && cp dist/*.whl ../blenderbim/build/wheels/
cd ../ifcclash && make dist && cp dist/*.whl ../blenderbim/build/wheels/
cd ../ifcbimtester && make dist && cp dist/*.whl ../blenderbim/build/wheels/
cd ../ifctester && make dist && cp dist/*.whl ../blenderbim/build/wheels/
cd ../ifcfm && make dist && cp dist/*.whl ../blenderbim/build/wheels/
cd ../bsdd && make dist && cp dist/*.whl ../blenderbim/build/wheels/
cd ../ifcdiff && make dist && cp dist/*.whl ../blenderbim/build/wheels/
cd ../ifccsv && make dist && cp dist/*.whl ../blenderbim/build/wheels/
cd ../ifcpatch && make dist && cp dist/*.whl ../blenderbim/build/wheels/
cd ../ifc4d && make dist && cp dist/*.whl ../blenderbim/build/wheels/
cd ../ifc5d && make dist && cp dist/*.whl ../blenderbim/build/wheels/
cd ../ifccityjson && make dist && cp dist/*.whl ../blenderbim/build/wheels/
cd build && . env/bin/activate && $(PIP) download GitPython --dest=./wheels
# Provides audio playback for costing
2024-07-17 22:46:44 +10:00
# This is a REALLY IMPORTANT feature
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) wheel git+https://github.com/Andrej730/aud.git --wheel-dir=../wheels
# IfcOpenShell dependency - support for new typing features
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download typing_extensions --dest=./wheels
# Required by IfcCSV
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download pandas $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels
2024-03-06 17:11:21 +11:00
# Pandas ships with very heavy tests
2024-07-19 00:26:07 +10:00
# cd build/site-packages/pandas && rm -rf tests
cd build && . env/bin/activate && $(PIP) download openpyxl --dest=./wheels
2024-07-17 21:29:58 +10:00
# odfpy doesn't come with its own wheel, so whee'l (get it?) create it ourselves!
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) wheel odfpy --wheel-dir=./wheels
2023-03-01 21:39:15 +11:00
# Required by IFCCityJSON
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download cjio --dest=./wheels
2023-03-01 21:39:15 +11:00
# Provides express rule validation for ifcopenshell.validate
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download pytest --dest=./wheels
2023-06-01 21:08:27 -07:00
# Provides Brickschema functionality
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download "brickschema[persistence]==0.7.6a2" --dest=./wheels
# Required for SVG to DXF conversion
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download ezdxf --dest=./wheels
# Required by bcf
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download xsdata --dest=./wheels
cd build && . env/bin/activate && $(PIP) download xmlschema --dest=./wheels
cd build && . env/bin/activate && $(PIP) download elementpath --dest=./wheels
cd build && . env/bin/activate && $(PIP) download six --dest=./wheels
# Required by drawing module
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download lxml $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels
# Required by qto and drawing module
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download shapely $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels
# Required by the BIM type manager thumbnail generator
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download pillow $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels
# Provides mustache templating in construction docs and web UI data
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download pystache --dest=./wheels
# Provides SVG export in construction documentation
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download svgwrite --dest=./wheels
# Provides fuzzy date parsing for construction sequencing
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download python-dateutil --dest=./wheels
# Provides duration parsing for construction sequencing
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download isodate --dest=./wheels
# Provides networkx graph analysis for project dependency calculations
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download networkx --dest=./wheels
# Required by IFCDiff
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download deepdiff --dest=./wheels
# Required by IFCCSV and ifcopenshell.util.selector
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download lark --dest=./wheels
2024-06-01 12:03:41 +10:00
# Required by IFC4D
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download PyP6Xer --dest=./wheels
2024-07-09 22:03:04 +10:00
# Required by web module
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download python-socketio[asyncio_client] --dest=./wheels
cd build && . env/bin/activate && $(PIP) download aiohttp --dest=./wheels
2024-07-09 22:03:04 +10:00
# Required by light module
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download pytz --dest=./wheels
cd build && . env/bin/activate && $(PIP) download tzfpy $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels
# pyradiance is using different platform versions than defaults in our makefile.
2024-07-14 23:03:45 +10:00
ifeq ($(PLATFORM), linux)
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download pyradiance --platform manylinux_2_35_x86_64 --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels
2024-07-16 12:04:28 +05:00
else ifeq ($(PLATFORM), macos)
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download pyradiance --platform macosx_10_13_x86_64 --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels
2024-07-16 12:04:28 +05:00
else
2024-07-19 00:26:07 +10:00
cd build && . env/bin/activate && $(PIP) download pyradiance $(PYPI_PLATFORM) --python-version $(PYPI_VERSION) --implementation $(PYPI_IMP) --only-binary=:all: --dest=./wheels
2024-07-14 23:03:45 +10:00
endif
2021-03-01 10:57:48 +11:00
2024-07-17 22:46:44 +10:00
# Provides jsgantt-improved supports for web-based construction sequencing gantt charts
2024-07-19 00:26:07 +10:00
cd build/blenderbim/bim/data/gantt/ && wget https://raw.githubusercontent.com/jsGanttImproved/jsgantt-improved/master/dist/jsgantt.js
cd build/blenderbim/bim/data/gantt/ && wget https://raw.githubusercontent.com/jsGanttImproved/jsgantt-improved/master/dist/jsgantt.css
2024-07-17 22:46:44 +10:00
# Provides IFCJSON functionality
2024-07-19 00:26:07 +10:00
cd build && wget https://github.com/IFCJSON-Team/IFC2JSON_python/archive/master.zip
cd build && unzip master.zip && rm master.zip
2024-07-17 17:41:13 +05:00
# IFCJSON doesn't have pyproject.toml, so we use python command.
2024-07-19 00:56:16 +10:00
cd build && . env/bin/activate && cd IFC2JSON_python-master/file_converters && \
2024-07-17 17:41:13 +05:00
$(PYTHON) -c "from setuptools import setup; \
2024-07-17 16:14:03 +05:00
setup( \
name='ifcjson', \
version='0.0.0', \
author='Jan Brouwer', \
author_email='jan@brewsky.nl', \
2024-07-17 17:41:13 +05:00
packages=['ifcjson'], \
2024-07-17 16:14:03 +05:00
)" bdist_wheel
2024-07-19 00:26:07 +10:00
cp -r build/IFC2JSON_python-master/file_converters/dist/*.whl build/wheels/
# Brickschema requires pkg_resources which is provided by Blender.
2022-08-27 10:36:54 -04:00
# Provides Brickschema functionality
2021-11-04 18:02:50 +11:00
# For now lets bundle the latest nightly schema
2024-07-19 00:26:07 +10:00
cd build/blenderbim/bim/schema && wget https://github.com/BrickSchema/Brick/releases/download/nightly/Brick.ttl
2021-11-04 18:02:50 +11:00
# Required for hipped roof generation
2024-07-19 00:26:07 +10:00
cd build && wget https://github.com/prochitecture/bpypolyskel/archive/refs/heads/master.zip
cd build && unzip master.zip && rm master.zip
2024-07-19 00:56:16 +10:00
cd build && . env/bin/activate && cd bpypolyskel-master && \
2024-07-17 17:41:13 +05:00
$(PYTHON) -c "from setuptools import setup; \
2024-07-17 16:43:20 +05:00
setup( \
2024-07-17 17:41:13 +05:00
name='bpypolyskel', \
2024-07-17 16:43:20 +05:00
version='0.0.0', \
2024-07-17 17:41:13 +05:00
packages=['bpypolyskel'], \
2024-07-17 16:43:20 +05:00
)" bdist_wheel
2024-07-19 00:26:07 +10:00
cp -r build/bpypolyskel-master/dist/*.whl build/wheels/
# Required for Desktop icon and file association
2024-07-19 00:59:58 +10:00
cp -r blenderbim/libs/desktop build/blenderbim/libs/
# Generate translations module for BBIM build
2024-07-19 00:26:07 +10:00
git clone https://github.com/IfcOpenShell/blenderbim-translations.git build
$(PYTHON) scripts/bbim_translations.py -i "build" -o "build/blenderbim"
# Remove dependencies also bundled with Blender
2024-07-19 00:26:07 +10:00
rm -rf build/wheels/numpy*
2024-07-19 00:26:07 +10:00
cp pyproject.toml build/
2024-06-11 15:41:18 +10:00
ifeq ($(IS_STABLE), TRUE)
2024-07-19 00:26:07 +10:00
$(SED) "s/0.0.0/$(VERSION)/" build/blenderbim/blender_manifest.toml
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' build/pyproject.toml
2024-06-11 15:41:18 +10:00
else
2024-07-19 00:26:07 +10:00
$(SED) "s/0.0.0/$(VERSION)-alpha$(VERSION_DATE)/" build/blenderbim/blender_manifest.toml
$(SED) "s/8888888/$(LAST_COMMIT_HASH)/" build/blenderbim/__init__.py
$(SED) 's/version = "0.0.0"/version = "$(VERSION)-alpha$(VERSION_DATE)"/' build/pyproject.toml
2024-07-18 20:20:34 +10:00
endif
2024-07-19 00:26:07 +10:00
$(SED) "s/os-arch/$(BLENDER_PLATFORM)/" build/blenderbim/blender_manifest.toml
2024-07-18 20:20:34 +10:00
# Provides BlenderBIM Add-on functionality
2024-07-19 00:26:07 +10:00
$(SED) 's/version = "0.0.0"/version = "$(VERSION)"/' build/pyproject.toml
cd build && . env/bin/activate && $(PYTHON) -m build
cp build/dist/*.whl build/wheels/
mv build/wheels/*.whl build/blenderbim/wheels/
2024-07-19 00:26:07 +10:00
$(PYTHON) scripts/get_wheels.py build/blenderbim/wheels build/blenderbim/blender_manifest.toml
rm -rf build/blenderbim/bim/
rm -rf build/blenderbim/core/
rm -rf build/blenderbim/tool/
2024-07-18 20:20:34 +10:00
ifeq ($(IS_STABLE), TRUE)
2024-07-19 00:26:07 +10:00
cd build && zip -r blenderbim_$(PYVERSION)-$(VERSION)-$(BLENDER_PLATFORM).zip ./blenderbim
2024-07-18 20:20:34 +10:00
else
2024-07-19 00:26:07 +10:00
cd build && zip -r blenderbim_$(PYVERSION)-$(VERSION)-alpha$(VERSION_DATE)-$(BLENDER_PLATFORM).zip ./blenderbim
endif
2024-07-18 20:20:34 +10:00
2024-07-19 00:26:07 +10:00
mv build/blenderbim*.zip dist/
rm -rf build
2019-10-06 19:59:41 +11:00
.PHONY: test
test:
make test-core
make test-tool
make test-bim
.PHONY: test-core
test-core:
pytest -p no:pytest-blender test/core
.PHONY: test-bim
test-bim:
ifndef MODULE
pytest test/bim
else
pytest test/bim -m "$(MODULE)" ./ --maxfail=1
endif
.PHONY: test-tool
test-tool:
ifndef MODULE
pytest test/tool
else
pytest test/tool/test_$(MODULE).py
endif
.PHONY: qa
qa:
black .
pylint ./* --output-format=colorized --disable all --enable E --disable import-error
.PHONY: coverage
coverage:
coverage run --source blenderbim.core -m pytest -p no:pytest-blender test/core
coverage html
xdg-open htmlcov/index.html
.PHONY: license
license:
2022-01-07 14:22:34 +11:00
copyright-header --license GPL3 --copyright-holder "Dion Moult <dion@thinkmoult.com>" --copyright-year "2022" --copyright-software "BlenderBIM Add-on" --copyright-software-description "OpenBIM Blender Add-on" -a ./ -o ./
2019-10-06 19:59:41 +11:00
.PHONY: clean
clean:
rm -rf dist
rm -rf htmlcov
2021-09-23 12:29:28 +02:00
.PHONY: dev
dev:
blender -p setup_pytest.py