Skip to content

Commit

Permalink
Rebase workflow on CMakeLists
Browse files Browse the repository at this point in the history
  • Loading branch information
howetuft committed Jan 5, 2025
1 parent 6ef5bd3 commit f582c31
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 33 deletions.
36 changes: 8 additions & 28 deletions .github/workflows/bundles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,39 +42,19 @@ jobs:
with:
blender-version: '4.2.4'

- run: blender --version

- name: Get BlendLuxCore version (according to blender_manifest.toml)
shell: python
run: |
import tomllib
import os
from pathlib import Path
root = Path("${{ github.workspace }}")
manifest_path = root / "blender_manifest.toml"
with open(manifest_path, "rb") as fp:
manifest = tomllib.load(fp)
version = manifest["version"]
# Version is stored in environment variable VERSION
env_file = os.getenv('GITHUB_ENV')
with open(env_file, "a") as myfile:
myfile.write(f"VERSION={version}")
- uses: lukka/get-cmake@latest

- name: Package bundle
shell: bash
run: |
echo "Packaging ${VERSION}"
blender --command extension build \
--source-dir "${{ github.workspace }}" \
--output-dir "${{ github.workspace }}"
unzip -q "BlendLuxCore-${VERSION}.zip" -d "${{ github.workspace }}/build"
build_dir="${{ github.workspace }}/build"
mkdir ${build_dir}
cmake -B ${build_dir} -S .
cmake --build ${build_dir}
unzip -q "${build_dir}/BlendLuxCore-*.zip" -d "${{ github.workspace }}/unzip"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: "BlendLuxCore-${{ env.VERSION }}"
path: "${{ github.workspace }}/build/*"

name: "BlendLuxCore"
path: "${{ github.workspace }}/unzip/*"
11 changes: 6 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# To build extension:
# cmake -B/path/to/my/build/folder -S/path/to/source/folder
# cd /path/to/my/build/folder && cmake --build .
# Get out of the tree, for instance in ..
# cmake -B blc-build -S BlendLuxCore && cmake --build blc-build

cmake_minimum_required(VERSION 3.25)

Expand All @@ -19,9 +19,9 @@ function(validate_blender_version result blender)
)
if (blender_output MATCHES "Blender ([0-9]+\.[0-9]+\.[0-9]+).*")
set(version ${CMAKE_MATCH_1})
message(STATUS "Blender version: ${version}")
message(STATUS "Found Blender - version ${version}")
if (${version} VERSION_LESS "4.2.0")
message(FATAL_ERROR "Bad Blender version - expected 4.2.0 or higher")
message(FATAL_ERROR "ERROR: Blender version is not suitable - expected 4.2.0 or higher")
set(${result} FALSE PARENT_SCOPE)
else()
message(STATUS "Blender version OK")
Expand All @@ -35,14 +35,15 @@ endfunction()


# Get BlendLuxCore version
find_package(Python 3.11 REQUIRED COMPONENTS Interpreter)
execute_process(
COMMAND python
${CMAKE_CURRENT_SOURCE_DIR}/cmake/blendluxcore_version.py
${CMAKE_CURRENT_SOURCE_DIR}/blender_manifest.toml
OUTPUT_VARIABLE BLC_VERSION
)

find_program(BLENDER blender NAMES blender.exe VALIDATOR validate_blender_version NO_CACHE)
find_program(BLENDER blender NAMES blender.exe VALIDATOR validate_blender_version NO_CACHE REQUIRED)

# Add BlendLuxCore target
add_custom_target(
Expand Down

0 comments on commit f582c31

Please sign in to comment.