From 2438fcb2b8c616673d1a0898c6f9be1e39320784 Mon Sep 17 00:00:00 2001 From: Simon Kallweit Date: Tue, 20 Aug 2024 16:58:45 +0200 Subject: [PATCH 01/10] less chatty download progress --- setup-tools.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/setup-tools.py b/setup-tools.py index dfb4e367..e7bb65d6 100644 --- a/setup-tools.py +++ b/setup-tools.py @@ -54,12 +54,17 @@ def download_file(url: str, path: Path): Download a file from the given URL to the given path. """ + last_percent = -1 + def progress_hook(count, block_size, total_size): + nonlocal last_percent if total_size <= 0: return percent = int(count * block_size * 100 / total_size) - sys.stdout.write(f"\r{percent}%") - sys.stdout.flush() + if percent != last_percent: + sys.stdout.write(f"\r{percent}%") + sys.stdout.flush() + last_percent = percent try: urlretrieve(url, path, reporthook=progress_hook) From 8e17ceab4f5226ef12e0bd05b6b33d5b7e12a155 Mon Sep 17 00:00:00 2001 From: Simon Kallweit Date: Tue, 20 Aug 2024 16:59:25 +0200 Subject: [PATCH 02/10] fix version to 0.1.0 --- README.md | 2 +- docs/changelog.rst | 2 +- docs/index.rst | 2 +- vcpkg.json | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 060c9c1a..07bfc575 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ If you use sgl in a research project leading to a publication, please cite the p title = {Slang Graphics Library}, author = {Simon Kallweit and Chris Cummings}, note = {https://github.com/shader-slang/sgl}, - version = {0.0.1}, + version = {0.1.0}, year = 2024 } ``` diff --git a/docs/changelog.rst b/docs/changelog.rst index 53d3af77..89c47919 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -7,7 +7,7 @@ Changelog sgl uses a `semantic versioning `__ policy for its API. -Version 0.0.1 (TBA) +Version 0.1.0 (TBA) ---------------------------- * Initial release diff --git a/docs/index.rst b/docs/index.rst index b9ea2641..640813eb 100644 --- a/docs/index.rst +++ b/docs/index.rst @@ -28,7 +28,7 @@ If you use ``sgl`` in a research project leading to a publication, please cite t title = {Slang Graphics Library}, author = {Simon Kallweit and Chris Cummings}, note = {https://github.com/shader-slang/sgl}, - version = {0.0.1}, + version = {0.1.0}, year = 2024 } diff --git a/vcpkg.json b/vcpkg.json index e70e90f3..86cab373 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -1,6 +1,6 @@ { "name": "sgl", - "version-string": "0.0.1", + "version-string": "0.1.0", "dependencies": [ "doctest", "fmt", From 37c7cc249c3f33afc6c37a650f9c5e6be92723f6 Mon Sep 17 00:00:00 2001 From: Simon Kallweit Date: Tue, 20 Aug 2024 16:59:38 +0200 Subject: [PATCH 03/10] add missing includes --- src/sgl/core/platform_linux.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/sgl/core/platform_linux.cpp b/src/sgl/core/platform_linux.cpp index 91873870..92f7e7d4 100644 --- a/src/sgl/core/platform_linux.cpp +++ b/src/sgl/core/platform_linux.cpp @@ -14,6 +14,8 @@ #include #include #include +#include +#include #include #include From 8f427796d94fb604fc024874a81cbc9208dc545a Mon Sep 17 00:00:00 2001 From: Simon Kallweit Date: Tue, 20 Aug 2024 16:59:58 +0200 Subject: [PATCH 04/10] disable constexpr mutex constructor --- src/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a42c2e51..48a7f154 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -293,6 +293,7 @@ target_compile_definitions(sgl $<$:UNICODE> # force character map to unicode # MSVC C++ library. $<$:_USE_MATH_DEFINES> + $<$:_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR> # $<$:_SCL_SECURE_NO_WARNINGS> # $<$:_CRT_SECURE_NO_WARNINGS> # $<$:_SILENCE_CXX17_CODECVT_HEADER_DEPRECATION_WARNING> From 387e62874e9fe4e57214691f1d7dc7aefe1a31ca Mon Sep 17 00:00:00 2001 From: Simon Kallweit Date: Tue, 20 Aug 2024 17:00:18 +0200 Subject: [PATCH 05/10] switch to slang linux build for glibc 2.17 --- external/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index ce56cf98..71ce2fb2 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -40,7 +40,7 @@ set(SLANG_URL_BASE "https://github.com/shader-slang/slang/releases/download/v${S if(SGL_WINDOWS) set(SLANG_URL "${SLANG_URL_BASE}/slang-${SLANG_VERSION}-windows-x86_64.zip") elseif(SGL_LINUX) - set(SLANG_URL "${SLANG_URL_BASE}/slang-${SLANG_VERSION}-linux-x86_64.tar.gz") + set(SLANG_URL "${SLANG_URL_BASE}/slang-${SLANG_VERSION}-linux-x86_64-glibc-2.17.tar.gz") elseif(SGL_MACOS) if(CMAKE_APPLE_SILICON_PROCESSOR MATCHES "x86_64") set(SLANG_URL "${SLANG_URL_BASE}/slang-${SLANG_VERSION}-macos-x86_64.zip") @@ -78,7 +78,7 @@ elseif(SGL_LINUX) ) sgl_copy_binary(${SLANG_DIR}/lib/libslang.so .) sgl_copy_binary(${SLANG_DIR}/lib/libslang-glslang.so .) - sgl_copy_binary(${SLANG_DIR}/lib/libslang-llvm.so .) + # sgl_copy_binary(${SLANG_DIR}/lib/libslang-llvm.so .) elseif(SGL_MACOS) add_library(slang::slang SHARED IMPORTED GLOBAL) set_target_properties(slang::slang PROPERTIES From ffcd7698dbada5f0b7ad319e706a4c8e674c2d88 Mon Sep 17 00:00:00 2001 From: Simon Kallweit Date: Tue, 20 Aug 2024 17:00:49 +0200 Subject: [PATCH 06/10] fix setup.py --- setup.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index f52e52c5..d06fbcfb 100644 --- a/setup.py +++ b/setup.py @@ -78,6 +78,8 @@ def build_extension(self, ext: CMakeExtension) -> None: "-B", build_dir, "-DCMAKE_DEFAULT_BUILD_TYPE=Release", + f"-DPython_ROOT_DIR:PATH={sys.prefix}", + f"-DPython_FIND_REGISTRY:STRING=NEVER", f"-DCMAKE_INSTALL_PREFIX={extdir}", f"-DCMAKE_INSTALL_LIBDIR=sgl", f"-DCMAKE_INSTALL_BINDIR=sgl", @@ -106,14 +108,14 @@ def build_extension(self, ext: CMakeExtension) -> None: version = "{MAJOR}.{MINOR}.{PATCH}".format(**matches) print(f"version={version}") -long_description = """sgl.""" +long_description = """TBD""" setup( name="sgl", version=version, author="Simon Kallweit", author_email="skallweit@nvidia.com", - description="A research rendering framework", + description="Slang Graphics Library", url="https://github.com/shader-slang/sgl", license="Apache-2.0", long_description=long_description, @@ -121,5 +123,5 @@ def build_extension(self, ext: CMakeExtension) -> None: ext_modules=[CMakeExtension("sgl")], cmdclass={"build_ext": CMakeBuild}, zip_safe=False, - python_requires=">=3.8", + python_requires=">=3.9", ) From b3bda874a85371a2e8413bfc88b1027588a3f369 Mon Sep 17 00:00:00 2001 From: Simon Kallweit Date: Tue, 20 Aug 2024 17:01:12 +0200 Subject: [PATCH 07/10] require python 3.9 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b18f8fb2..e2dd6e91 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,7 +90,7 @@ message(STATUS "Platform: ${SGL_PLATFORM}") # Python # ----------------------------------------------------------------------------- -find_package(Python 3.8 COMPONENTS Interpreter Development.Module REQUIRED) +find_package(Python 3.9 COMPONENTS Interpreter Development.Module REQUIRED) # ----------------------------------------------------------------------------- # CUDA From c4320f0fec95f20262e0252857a5ee75d6d475f1 Mon Sep 17 00:00:00 2001 From: Simon Kallweit Date: Tue, 20 Aug 2024 17:01:43 +0200 Subject: [PATCH 08/10] remove toolset spec --- CMakePresets.json | 8 -------- 1 file changed, 8 deletions(-) diff --git a/CMakePresets.json b/CMakePresets.json index c4577d82..32bd3477 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -39,10 +39,6 @@ "architecture": { "value": "x64", "strategy": "set" - }, - "toolset": { - "value": "host=x86", - "strategy": "set" } }, { @@ -61,10 +57,6 @@ "value": "x64", "strategy": "external" }, - "toolset": { - "value": "host=x86,version=14.3", - "strategy": "external" - }, "cacheVariables": { "CMAKE_MAKE_PROGRAM": "${sourceDir}/tools/host/ninja/ninja.exe", "CMAKE_C_COMPILER": "cl", From abe4ee124d91a2ef610fd27e561b54aed849fe7f Mon Sep 17 00:00:00 2001 From: Simon Kallweit Date: Tue, 20 Aug 2024 17:02:57 +0200 Subject: [PATCH 09/10] update wheels workflow --- .github/workflows/wheels.yml | 60 ++++++++++++++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/.github/workflows/wheels.yml b/.github/workflows/wheels.yml index 9b38f53e..6b9188cc 100644 --- a/.github/workflows/wheels.yml +++ b/.github/workflows/wheels.yml @@ -7,8 +7,18 @@ on: required: true default: '0' +env: + CIBW_BUILD_VERBOSITY: 1 + CIBW_SKIP: "*-musllinux* pp*" + CIBW_MANYLINUX_X86_64_IMAGE: manylinux_2_28 + CIBW_ARCHS_WINDOWS: auto64 + CIBW_ARCHS_LINUX: auto64 + CIBW_TEST_COMMAND: "python -c \"import sgl\"" + # zip required for vcpkg, rest for glfw + CIBW_BEFORE_ALL_LINUX: yum install -y zip wayland-devel libxkbcommon-devel libXcursor-devel libXi-devel libXinerama-devel libXrandr-devel + jobs: - build_wheels: + wheels: runs-on: ${{ matrix.runs-on }} strategy: matrix: @@ -26,9 +36,55 @@ jobs: steps: - uses: actions/checkout@v4 + with: + submodules: recursive + lfs: true - # Used to host cibuildwheel + # Used to host cibuildwheel. - uses: actions/setup-python@v5 + with: + python-version: "3.10" + # Install cibuildwheel. - name: Install cibuildwheel run: python -m pip install cibuildwheel==2.20.0 + + # Setup MSVC. + - name: Setup MSVC + uses: ilammy/msvc-dev-cmd@v1 + with: + arch: x64 + + # Build wheels. + - name: Build wheels + env: + CIBW_BUILD: ${{ matrix.python }}-* + run: | + python -m cibuildwheel --output-dir wheelhouse + + # Copy wheels to artifact. + - name: Copy wheels to artifact + # Version v4 fails to copy files from same folder for multiple builds. + uses: actions/upload-artifact@v3 + with: + name: wheels + path: ./wheelhouse/*.whl + + + upload_pypi: + name: Upload wheels to PyPI + runs-on: ubuntu-latest + if: ${{ github.event.inputs.upload == '1'}} + needs: [wheels] + environment: pypi + + steps: + - uses: actions/download-artifact@v2 + with: + name: wheels + path: dist + + - uses: pypa/gh-action-pypi-publish@v1.5.1 + with: + user: __token__ + password: ${{ secrets.PYPI_TOKEN }} From 217fbd448918187eafa0689feca2293057369892 Mon Sep 17 00:00:00 2001 From: Simon Kallweit Date: Tue, 20 Aug 2024 17:04:03 +0200 Subject: [PATCH 10/10] rename pypi package to nv-sgl --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index d06fbcfb..cae4c35a 100644 --- a/setup.py +++ b/setup.py @@ -111,7 +111,7 @@ def build_extension(self, ext: CMakeExtension) -> None: long_description = """TBD""" setup( - name="sgl", + name="nv-sgl", version=version, author="Simon Kallweit", author_email="skallweit@nvidia.com",