Skip to content

Commit

Permalink
Build a release for mac, windows and linux.
Browse files Browse the repository at this point in the history
  • Loading branch information
fire committed Dec 18, 2024
1 parent 82a0b33 commit 50feab2
Show file tree
Hide file tree
Showing 2 changed files with 162 additions and 12 deletions.
141 changes: 141 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
name: "Build fbx-udim-unpack"
on:
pull_request:
branches:
- master
push:
branches:
- master
tags:
- "v*"

concurrency:
group: ci-${{github.actor}}-${{github.head_ref || github.run_number}}-${{github.ref}}-build
cancel-in-progress: true

jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-2022, ubuntu-20.04, macos-14]
include:
- os: windows-2022
sdk_url: "https://github.com/V-Sekai/FBXSDK-Windows/archive/refs/tags/2020.2.zip"
sdk_license: "sdk/Windows/2020.2/License.rtf"
build_command: |
find sdk -type f -name '*.zst' -exec sh -c 'zstd -d "{}" -o "${0%.zst}"' {} \;
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DFBXSDK_ROOT=sdk
cmake --build build
run_command: ./build/Release/fbx-udim-unpack.exe --help
artifact_name: fbx-udim-unpack-windows-x86_64
artifact_path: build/Release/fbx-udim-unpack.exe
- os: ubuntu-20.04
sdk_url: "https://github.com/V-Sekai/FBXSDK-Linux/archive/refs/tags/2020.2.zip"
sdk_license: "sdk/Linux/2020.2/License.txt"
build_command: |
find sdk -type f -name '*.zst' -exec sh -c 'zstd -d "{}" -o "${0%.zst}"' {} \;
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DFBXSDK_ROOT=sdk
cmake --build build
run_command: ./build/fbx-udim-unpack --help
artifact_name: fbx-udim-unpack-linux-x86_64
artifact_path: build/fbx-udim-unpack
- os: macos-14
sdk_url: "https://github.com/V-Sekai/FBXSDK-Darwin/archive/refs/tags/2020.2.zip"
sdk_license: "sdk/Darwin/2020.2/License.rtf"
build_command: |
find sdk -type f -name '*.zst' -exec sh -c 'zstd -d "{}" -o "${0%.zst}"' {} \;
cmake -S . -B build -G Ninja -DCMAKE_BUILD_TYPE=Release -DFBXSDK_ROOT=sdk
cmake --build build
run_command: ./build/fbx-udim-unpack --help
artifact_name: fbx-udim-unpack-macos-x86_64
artifact_path: build/fbx-udim-unpack

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install Ninja
run: |
if [[ $RUNNER_OS == "Windows" ]]; then
choco install ninja
elif [[ $RUNNER_OS == "Linux" ]]; then
sudo apt-get install ninja-build
else
brew install ninja
fi
shell: bash

- name: Install 7z
run: |
if [[ $RUNNER_OS == "Windows" ]]; then
choco install 7zip
elif [[ $RUNNER_OS == "Linux" ]]; then
sudo apt-get install p7zip-full
else
brew install p7zip
fi
shell: bash

- name: Setup filter.lfs.required
run: |
git config --global filter.lfs.required false
shell: bash

- name: Setup filter.lfs.smudge
run: |
git config --global filter.lfs.smudge "git-lfs smudge --skip %f"
shell: bash

- name: Setup filter.lfs.process
run: |
git config --global filter.lfs.process "git-lfs filter-process --skip"
shell: bash

- name: Fetch sdk
run: |
curl -O -L "${{ matrix.sdk_url }}"
shell: bash

- name: Install 7z extract
run: |
7z x 2020.2.zip
shell: bash

- name: Extract and move SDK
run: |
mkdir -p sdk
7z x 2020.2.zip -osdk
mv sdk/*/* sdk/
shell: bash

- name: CMake configure and build
run: ${{ matrix.build_command }}
shell: bash

- name: Run fbx-udim-unpack help
run: ${{ matrix.run_command }}
shell: bash

- name: Prepare artifacts
run: |
export TARGET=${{ matrix.artifact_name }}
mkdir $TARGET
cp ${{ matrix.sdk_license }} $TARGET/FBX-SDK-License.txt
cp LICENSE $TARGET/fbx-udim-unpack-License.txt
cp ${{ matrix.artifact_path }} $TARGET/${{ matrix.artifact_name }}
7z a -r $TARGET.zip $TARGET
shell: bash

- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: ${{ matrix.artifact_name }}.zip

- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: ${{ matrix.artifact_name }}/*
33 changes: 21 additions & 12 deletions CMake/FindFBX.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
# FBXSDK_LIBS
# FBXSDK_LIBS_DEBUG
#
set(_fbxsdk_version "2020.1.1")
set(_fbxsdk_version "2020.2")
set(_fbxsdk_vstudio_version "vs2017")

message("Looking for FBX SDK version: ${_fbxsdk_version}")

if (APPLE)
set(_fbxsdk_approot "/Applications/Autodesk/FBX SDK")
set(_fbxsdk_approot "${CMAKE_SOURCE_DIR}/sdk")
set(_fbxsdk_libdir_debug "lib/clang/debug")
set(_fbxsdk_libdir_release "lib/clang/release")
set(_fbxsdk_libname_debug "libfbxsdk.a")
Expand All @@ -28,7 +28,7 @@ if (APPLE)
elseif (WIN32)
# the $ENV{PROGRAMFILES} variable doesn't really work since there's no
# 64-bit cmake version
set(_fbxsdk_approot "C:/Program Files/Autodesk/FBX/FBX SDK")
set(_fbxsdk_approot "${CMAKE_SOURCE_DIR}/sdk")
set(_fbxsdk_libdir_debug "lib/${_fbxsdk_vstudio_version}/x64/debug")
set(_fbxsdk_libdir_release "lib/${_fbxsdk_vstudio_version}/x64/release")
set(_fbxsdk_libname_debug "libfbxsdk-md.lib")
Expand All @@ -37,8 +37,18 @@ elseif (WIN32)
set(_xml2_libname_release "libxml2-md.lib")
set(_zlib_libname_debug "zlib-md.lib")
set(_zlib_libname_release "zlib-md.lib")
elseif (UNIX)
set(_fbxsdk_approot "${CMAKE_SOURCE_DIR}/sdk")
set(_fbxsdk_libdir_debug "lib/gcc/debug")
set(_fbxsdk_libdir_release "lib/gcc/release")
set(_fbxsdk_libname_debug "libfbxsdk.so")
set(_fbxsdk_libname_release "libfbxsdk.so")
set(_xml2_libname_debug "libxml2.so")
set(_xml2_libname_release "libxml2.so")
set(_zlib_libname_debug "libz.so")
set(_zlib_libname_release "libz.so")
else ()
message(FATAL_ERROR" FIXME: find FBX SDK on Linux")
message(FATAL_ERROR "FIXME: find FBX SDK on unknown platform")
endif()

# should point the the FBX SDK installation dir
Expand All @@ -47,34 +57,33 @@ message("_fbxsdk_root: ${_fbxsdk_root}")

# find header dir and libs
find_path(FBXSDK_INCLUDE_DIR "fbxsdk.h"
PATHS ${_fbxsdk_root}
PATHS ${_fbxsdk_root} "${CMAKE_SOURCE_DIR}/sdk/include"
PATH_SUFFIXES "include")
message("FBXSDK_INCLUDE_DIR: ${FBXSDK_INCLUDE_DIR}")
find_library(FBXSDK_LIBRARY ${_fbxsdk_libname_release}
PATHS ${_fbxsdk_root}
PATHS ${_fbxsdk_root} "${CMAKE_SOURCE_DIR}/sdk/lib"
PATH_SUFFIXES ${_fbxsdk_libdir_release})
message("FBXSDK_LIBRARY: ${FBXSDK_LIBRARY}")
find_library(FBXSDK_LIBRARY_DEBUG ${_fbxsdk_libname_debug}
PATHS ${_fbxsdk_root}
PATHS ${_fbxsdk_root} "${CMAKE_SOURCE_DIR}/sdk/lib"
PATH_SUFFIXES ${_fbxsdk_libdir_debug})
message("FBXSDK_LIBRARY_DEBUG: ${FBXSDK_LIBRARY_DEBUG}")


find_library(XML2_LIBRARY ${_xml2_libname_release}
PATHS ${_fbxsdk_root}
PATHS ${_fbxsdk_root} "${CMAKE_SOURCE_DIR}/sdk/lib"
PATH_SUFFIXES ${_fbxsdk_libdir_release})
message("XML2_LIBRARY: ${XML2_LIBRARY}")
find_library(XML2_LIBRARY_DEBUG ${_xml2_libname_debug}
PATHS ${_fbxsdk_root}
PATHS ${_fbxsdk_root} "${CMAKE_SOURCE_DIR}/sdk/lib"
PATH_SUFFIXES ${_fbxsdk_libdir_debug})
message("XML2_LIBRARY_DEBUG: ${XML2_LIBRARY_DEBUG}")

find_library(ZLIB_LIBRARY ${_zlib_libname_release}
PATHS ${_fbxsdk_root}
PATHS ${_fbxsdk_root} "${CMAKE_SOURCE_DIR}/sdk/lib"
PATH_SUFFIXES ${_fbxsdk_libdir_release})
message("ZIB_LIBRARY: ${ZLIB_LIBRARY}")
find_library(ZLIB_LIBRARY_DEBUG ${_zlib_libname_debug}
PATHS ${_fbxsdk_root}
PATHS ${_fbxsdk_root} "${CMAKE_SOURCE_DIR}/sdk/lib"
PATH_SUFFIXES ${_fbxsdk_libdir_debug})
message("ZLIB_LIBRARY_DEBUG: ${ZLIB_LIBRARY_DEBUG}")

Expand Down

0 comments on commit 50feab2

Please sign in to comment.