Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add preliminary Windows support #20

Merged
merged 5 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 7 additions & 15 deletions .github/workflows/test.yml → .github/workflows/test-linux.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: linux
name: test-linux

on:
push:
Expand All @@ -10,25 +10,17 @@ permissions:
contents: read

jobs:
test:
test-linux:
runs-on: ubuntu-20.04
timeout-minutes: 300

strategy:
fail-fast: false
matrix:
name: [
"USD-23.05-py37",
"USD-20.11-py37",
]
usd: ["v23.11"]
python: ["3.7", "3.10"]

include:
- name: "USD-23.05-py37"
usd-tag: "v23.05"
python: "3.7"
- name: "USD-20.11-py37"
usd-tag: "v20.11"
python: "3.7"
name: "USD-${{ matrix.usd }}-py${{ matrix.python }}"

steps:
- uses: actions/checkout@v3
Expand All @@ -42,15 +34,15 @@ jobs:
run: |
sudo apt update
sudo apt install -y libgtest-dev ninja-build
pip install pytest
pip install pytest pytest-cmake
mkdir -p ${{github.workspace}}/build
mkdir -p ${{runner.temp}}/USD

- name: Install USD
working-directory: ${{runner.temp}}/USD
run: |
git clone https://github.com/PixarAnimationStudios/OpenUSD.git \
--depth 1 --branch ${{ matrix.usd-tag }} ./src
--depth 1 --branch ${{ matrix.usd }} ./src
python ./src/build_scripts/build_usd.py . \
--no-tests \
--no-examples \
Expand Down
91 changes: 91 additions & 0 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: test-windows

on:
push:
branches: [ main ]
pull_request:
branches: [ main, dev ]

permissions:
contents: read

jobs:
test-windows:
runs-on: windows-2022
timeout-minutes: 300

strategy:
fail-fast: false
matrix:
usd: ["v23.11"]
python: ["3.7", "3.10"]

name: "USD-${{ matrix.usd }}-py${{ matrix.python }}"

steps:
- uses: actions/checkout@v3

- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}

- name: Create Build Environment
run: |
vcpkg install --triplet=x64-windows gtest
pip install pytest pytest-cmake
cmake -E make_directory ${{runner.workspace}}/build
cmake -E make_directory ${{runner.temp}}/USD

- name: Install USD
working-directory: ${{runner.temp}}/USD
shell: cmd
run: |
call "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
set VCPKG_TARGET_TRIPLET=x64-windows
set CMAKE_TOOLCHAIN_FILE=%VCPKG_INSTALLATION_ROOT%/scripts/buildsystems/vcpkg.cmake
git clone https://github.com/PixarAnimationStudios/OpenUSD.git ^
--depth 1 --branch ${{ matrix.usd }} ./src
python ./src/build_scripts/build_usd.py . ^
--generator "Visual Studio 17 2022" ^
--no-tests ^
--no-examples ^
--no-tutorials ^
--no-tools ^
--no-docs ^
--no-imaging ^
--no-materialx ^
-v

- name: Configure
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
export PATH="${{runner.temp}}/USD/bin;${{runner.temp}}/USD/lib;${PATH}"
export PYTHONPATH="${{runner.temp}}/USD/lib/python;${PYTHONPATH}"
cmake \
-G "Visual Studio 17 2022" -A x64 \
-D "CMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT}/scripts/buildsystems/vcpkg.cmake" \
-D "VCPKG_TARGET_TRIPLET=x64-windows" \
-D "BUILD_DOCS=OFF" \
-D "CMAKE_INCLUDE_PATH=${{runner.temp}}/USD/include" \
-D "CMAKE_LIBRARY_PATH=${{runner.temp}}/USD/lib" \
'${{github.workspace}}'
cmake --build . --config Release

- name: Check for formatting errors
shell: bash
working-directory: ${{runner.workspace}}/build
run: |
cmake --build . --target format
git -C ${GITHUB_WORKSPACE} status --porcelain
if [ -n "$(git -C ${GITHUB_WORKSPACE} status --porcelain)" ]; \
then echo "Code formatting errors found."; \
exit 1; fi

- name: Run Test
shell: bash
working-directory: ${{runner.workspace}}/build
run: ctest -VV -C Release
env:
CTEST_OUTPUT_ON_FAILURE: True
38 changes: 26 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
cmake_minimum_required(VERSION 3.15)
if(WIN32)
cmake_minimum_required(VERSION 3.27)
else()
cmake_minimum_required(VERSION 3.20)
endif()

project(unf
VERSION 0.5.6
Expand All @@ -16,6 +20,27 @@ set(CMAKE_CXX_STANDARD "${cxx_std}" CACHE STRING "Default C++ standard")
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)

if (MSVC)
# Make sure WinDef.h does not define min and max macros which
# will conflict with std::min() and std::max().
add_compile_definitions("NOMINMAX")

# From OpenUSD/cmake/defaults/msvcdefaults.cmake
#
# The /Zc:inline option strips out the "arch_ctor_<name>" symbols used for
# library initialization by ARCH_CONSTRUCTOR starting in Visual Studio 2019,
# causing release builds to fail. Disable the option for this and later
# versions.
#
# For more details, see:
# https://developercommunity.visualstudio.com/content/problem/914943/zcinline-removes-extern-symbols-inside-anonymous-n.html
if (MSVC_VERSION GREATER_EQUAL 1920)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:inline-")
else()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /Zc:inline")
endif()
endif()

option(BUILD_TESTS "Build tests" ON)
option(BUILD_DOCS "Build documentation" ON)
option(BUILD_PYTHON_BINDINGS "Build Python Bindings" ON)
Expand Down Expand Up @@ -83,17 +108,6 @@ add_subdirectory(src)

if (BUILD_TESTS)
find_package(GTest 1.8.0 REQUIRED)

# For compatibility with module fetched from CMake < 3.20
if (NOT TARGET GTest::gtest)
set_target_properties(GTest::GTest PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(GTest::gtest ALIAS GTest::GTest)
endif()
if (NOT TARGET GTest::gtest_main)
set_target_properties(GTest::Main PROPERTIES IMPORTED_GLOBAL TRUE)
add_library(GTest::gtest_main ALIAS GTest::Main)
endif()

include(GoogleTest)

if(BUILD_PYTHON_BINDINGS)
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
# USD Notice Framework

[![CMake](https://img.shields.io/badge/CMake-3.15...3.26-blue.svg?logo=CMake&logoColor=blue)](https://cmake.org)
[![Tests](https://github.com/wdas/unf/actions/workflows/test.yml/badge.svg?branch=main)](https://github.com/wdas/unf/actions/workflows/test.yml)
[![CMake](https://img.shields.io/badge/CMake-3.20...3.29-blue.svg?logo=CMake&logoColor=blue)](https://cmake.org)
[![test-linux](https://github.com/wdas/unf/actions/workflows/test-linux.yml/badge.svg?branch=main)](https://github.com/wdas/unf/actions/workflows/test-linux.yml)
[![test-windows](https://github.com/wdas/unf/actions/workflows/test-windows.yml/badge.svg?branch=main)](https://github.com/wdas/unf/actions/workflows/test-windows.yml)
[![License](https://img.shields.io/badge/License-Modified%20Apache%202.0-yellow.svg)](https://github.com/wdas/unf/blob/main/LICENSE.txt)

The USD Notice Framework (UNF) is built over the native [Tf Notification System][1]
Expand Down
113 changes: 0 additions & 113 deletions cmake/modules/FindPytest.cmake

This file was deleted.

Loading
Loading