From 0f1dae2388906feda20bb8004093b443e774d0f8 Mon Sep 17 00:00:00 2001 From: Syoyo Fujita Date: Fri, 5 Aug 2022 04:00:26 +0900 Subject: [PATCH] CI build script for MSVC. --- CMakeLists.txt | 10 ++++++---- README.md | 22 ++++++++++++++++++++++ ci-build-python-lib.bat | 3 +++ ci-build-vs2022.bat | 12 ++++++++++++ 4 files changed, 43 insertions(+), 4 deletions(-) create mode 100644 ci-build-vs2022.bat diff --git a/CMakeLists.txt b/CMakeLists.txt index 45e9cb10..fc6bc98e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -143,9 +143,11 @@ if(TINYUSDZ_WITH_PYTHON) # workaround: find_package() does not work well inside of nanobind(`Python3::Module` target won't defined), so call it here. # and use `FindPython3`, not `FindPython` - if (TINYUSDZ_PREFER_CUSTOM_PYTHON) - set(Python_FIND_FRAMEWORK NEVER) # Do not search framework python - set(Python_FIND_STRATEGY LOCATION) + if (TINYUSDZ_PREFER_LOCAL_PYTHON_INSTALLATION) + #message(STATUS "Local Python") + set(Python3_FIND_FRAMEWORK NEVER) # Do not search framework python + set(Python3_FIND_STRATEGY LOCATION) + set(Python3_FIND_REGISTRY NEVER) # Windows only else () set(Python_FIND_FRAMEWORK LAST) # Prefer Brew/Conda to Apple framework python endif () @@ -157,7 +159,7 @@ if(TINYUSDZ_WITH_PYTHON) ) #message(STATUS "Python include dirs: " ${Python_INCLUDE_DIRS}) - #message(STATUS "Python include dirs: " ${Python3_INCLUDE_DIRS}) + message(STATUS "Python include dirs: " ${Python3_INCLUDE_DIRS}) add_subdirectory(${PROJECT_SOURCE_DIR}/src/external/nanobind nanobind_build) endif() diff --git a/README.md b/README.md index 252b3a0a..c4b47a6e 100644 --- a/README.md +++ b/README.md @@ -246,6 +246,28 @@ mkdir -p ~/.config/blender/2.93/scripts/addons/modules See `tests/fuzzer/` +## CI build + +CI build script is a build script trying to build TinyUSDZ in self-contained manner as much as possible(including custom Python build) + +### Linux/macOS + +T.B.W. + +### Windows + +Build custom Python, + +``` +> ci-build-python-lib.bat +``` + +then build TinyUSDZ by linking with this local Python build. + +``` +> ci-build-vs2022.bat +``` + ## License TinyUSDZ is licensed under MIT license. diff --git a/ci-build-python-lib.bat b/ci-build-python-lib.bat index 77091ebd..9530726b 100644 --- a/ci-build-python-lib.bat +++ b/ci-build-python-lib.bat @@ -2,6 +2,9 @@ rem Build local Python lib rem Assume running this batch file at the toplevel directory of TinyUSDZ. git clone https://github.com/lighttransport/python-cmake-buildsystem ci/python-cmake-buildsystem +cd ci/python-cmake-buildsystem +git pull origin master +cd %~dp0 rmdir /s /q %~dp0/ci/buil_python diff --git a/ci-build-vs2022.bat b/ci-build-vs2022.bat new file mode 100644 index 00000000..9eb7111a --- /dev/null +++ b/ci-build-vs2022.bat @@ -0,0 +1,12 @@ +rem Assume Python is built with `ci-build-python-lib.bat` +rem + +rmdir /s /q build +mkdir build + +cmake -G "Visual Studio 17 2022" -A x64 ^ +-DTINYUSDZ_WITH_OPENSUBDIV=On ^ +-DTINYUSDZ_WITH_PYTHON=1 ^ +-DTINYUSDZ_PREFER_LOCAL_PYTHON_INSTALLATION=1 ^ +-DPython3_EXECUTABLE=%~dp0/ci/dist/python/Scripts/python.exe ^ +-Bbuild -S.