Skip to content

Commit

Permalink
Release v22.12 (#57)
Browse files Browse the repository at this point in the history
* Added libXt as a pre-required library on Linux

MaterialX (MaterialXRenderHw) requires libXt to build. Ubuntu 20.04 may have it installed with system installation. To be safe, I added it in the doc so users can build MaterialX without the missing libXt error.

* OGSMOD-2637: Fixed deployHdAurora of building and running usdview

* OGSMOD-2642: Improved error message on missing Windows SDK

* Fix typo in README.md

* Fix CMake error message

* Disable failed cases that cause CI/CD errors (#53)

* Disable failed cases

* Minor fixes in documentation

* Fix typos

* OGSMOD-2658: Refactored the externals to install to individual prefix location

Each and every external library will be installed to its own installation
path. This allows an easy override with <pkg>_ROOT for users to use their
own external libraries.

NOTE: this commit breaks the Aurora build

* OGSMOD-2679: Upgraded Aurora build scripts to support multi-config build in Visual Studio

- Updated cmake files to work with the new externals layout
- An externals config file is auto-generated by installExternals.py for easy
  configuration with 'cmake -S . -B Build'.
- Created patches for OpenImageIO and USD to support multi-config build.
- Created customized find modules of USD, TBB and OpenSubdiv to support
  multi-config build.

* OGSMOD-2679: Updated findNRD/NRI to support multi-config build

* OGSMOD-2679: Improved of the build scripts and the end message of the external script

* OGSMOD-2680: Fixed the Linux build with changes of the multi-config support

- Fixed the cmake files to build on Linux
- Preset the patch file to always have LF line-ending to fix the patching
  errors.
- Updated the default externals config

* OGSMOD-2681: Updated README.md to sync with the changes of the Aurora build scripts

* Windows pipeline for Aurora Build/Test in CI/CD (#55)

* Windows pipeline for Aurora Build/Test in CI/CD

* Move build instructions to a separate file

* Removed RelWithDebInfo from the build variants of installExternals.py

* Added error checking on missing the externals config file

Existing users who ran installExternals.py do not have the externals
config file. The old externals installation is not compatible to the
current build scripts. This error reminds users to re-run the install
script.

Co-authored-by: Andy Shiue <andy.shiue@autodesk.com>
Co-authored-by: Mauricio Vives <mauricio.vives@autodesk.com>
Co-authored-by: Liwei Zhan <liwei.zhan@autodesk.com>
Co-authored-by: Andy Shiue <andy.shiue@moiggi.com>
  • Loading branch information
5 people authored and GitHub Enterprise committed Dec 22, 2022
1 parent 1c66fb5 commit acf5513
Show file tree
Hide file tree
Showing 42 changed files with 1,691 additions and 661 deletions.
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@
###############################################################################
* text=auto

# Declare files that will always have LF line endings on checkout.
*.patch text eol=lf

###############################################################################
# Track large files with Git LFS.
###############################################################################
Expand Down
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Ignore build directories.
Build/
_build/
Externals/
_externals/

# Ignore script generated files
Scripts/cmake/externalsConfig.cmake


# Ignore IDE cache folders
.vs/
Expand Down
14 changes: 12 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
cmake_minimum_required(VERSION 3.21)
cmake_minimum_required(VERSION 3.24)
# 3.24 is required to have Vulkan::shaderc_combined


# Forbid the in-source build
if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
Expand Down Expand Up @@ -54,7 +56,15 @@ else()
add_compile_options(-Wall -Wextra -Wpedantic -Werror -Wno-unknown-pragmas -Wno-gnu-zero-variadic-macro-arguments)
endif()

include(externals)
include(externalsConfig OPTIONAL RESULT_VARIABLE EXTERNALS_CONFIG)
if (NOT EXTERNALS_CONFIG AND DEFINED EXTERNALS_ROOT)
include(externalsDefaultConfig RESULT_VARIABLE EXTERNALS_CONFIG)
endif()
if (EXTERNALS_CONFIG)
message(STATUS "Load externals config file: ${EXTERNALS_CONFIG}")
else()
message(FATAL_ERROR "Failed to load externals config file. If you have run `installExternals.py` from an early release, please re-run the script to generate the externals and the config file. Run `python Scripts/installExternals.py -h` to learn more options.")
endif()

#Setup the backend flags used by Aurora libray and tests.
if(WIN32)
Expand Down
73 changes: 73 additions & 0 deletions Doc/Build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
# Building
Aurora includes a script that retrieves and builds dependencies ("externals") from source. This script is based on the [USD build script](https://github.com/PixarAnimationStudios/USD/tree/release/build_scripts). CMake is used to build Aurora directly, or to create an IDE project which can then be used to build and debug Aurora.

1. **Download or clone** the contents of this repository to a location of your choice. Cloning with Git is not strictly necessary as Aurora does not currently use submodules. We refer to this location as *AURORA_DIR*.

2. **Start a command line** with access to your C++ compiler tools. When using Visual Studio, the "x64 Native Tools Command Prompt for VS 2019" shortcut will provide the proper environment. The CMake and Python executables must also be available, through the PATH environment variable.

3. **Installing externals:** Run *[Scripts/installExternals.py](Scripts/installExternals.py)* with Python in *AURORA_DIR* to build and install externals.

- You can run the install script with the desired location for storing and compiling externals as the only argument. We will refer to this location as *EXTERNALS_ROOT*.
```
python Scripts/installExternals.py {EXTERNALS_ROOT}
```

- The script will retrieve the source code for all dependencies using available release packages, or clone with Git as needed. The script will also compile all of the dependencies. If you want more feedback on the script execution, you can run the script with the `-v` option for verbose output.

- The entire process takes about 30 minutes to run, and consumes about 10 GB of disk space in *EXTERNALS_ROOT*. While USD is being compiled, the script will use most of the CPU cores, and your computer may be sluggish for a few minutes.

- Use the `--build-variant` option to choose the build configuration of externals. It can be `Debug`, `Release` (default), or `All`.

- Use the `-h` option with the script to see available options.

4. **Generating projects:** Run CMake in *AURORA_DIR* to generate build projects, e.g. a Visual Studio solution.

- You may specify the externals installation directory (*EXTERNALS_ROOT*, above) as a CMake path variable called `EXTERNALS_ROOT`. If no `EXTERNALS_ROOT` is specified, the `EXTERNALS_ROOT` built by the latest run of *installExternals.py* will be used automatically. If you are using cmake-gui, you should specify this variable before generating.

- You must specify a build directory, and we refer to this location as *AURORA_BUILD_DIR*. The recommended build directory is *{AURORA_DIR}/Build*, which is filtered by [.gitignore](.gitignore) so it won't appear as local changes for Git.

- You can use CMake on the command line or the GUI (cmake-gui). The CMake command to generate projects is as follows:

```
cmake -S . -B {AURORA_BUILD_DIR} -D CMAKE_BUILD_TYPE={CONFIGURATION} -D EXTERNALS_ROOT={EXTERNALS_ROOT}
```

- The *CONFIGURATION* value can be one of `Debug` or `Release` (default).

- On Windows, `CMAKE_BUILD_TYPE` is ignored during the cmake configuration. You are required to specify the build configuration with `--config {CONFIGURATION}` during the cmake build.

- You can optionally specify the desired graphics API backend as described below, e.g. `-D ENABLE_HGI_BACKEND=ON`.

- On Windows, you may need to specify the toolchain and architecture with `-G "Visual Studio 16 2019" -A x64`.

5. **Building:** You can load the *Aurora.sln* Visual Studio solution file from the Aurora build directory, and build Aurora using the build configuration used with the *installExternals.py* script (see below), or use CMake.

- The CMake command to build Aurora is as follows:

```
cmake --build {AURORA_BUILD_DIR} --config {CONFIGURATION} -v
```
- `--config {CONFIGURATION}` is only required on Windows.
- The build for a single build configuration (e.g. Debug or Release) takes about a minute and consumes about 500 MB of disk space.

## Graphics API Support

As noted in the system requirements, Aurora can use either the [DirectX Raytracing](https://microsoft.github.io/DirectX-Specs/d3d/Raytracing.html) API (Windows only) or the [Vulkan Ray Tracing](https://www.khronos.org/blog/ray-tracing-in-vulkan) API (on Windows or Linux). These are referred to as "backends" in the build process.

On Windows, you can set a flag in the CMake configuration to enable the desired backend(s):

- `-D ENABLE_DIRECTX_BACKEND=[ON/OFF]` for DirectX (default is ON).
- `-D ENABLE_HGI_BACKEND=[ON/OFF]` for Vulkan (default is OFF).

On Linux, `ENABLE_HGI_BACKEND` is `ON` and `ENABLE_DIRECTX_BACKEND` is `OFF` and cannot be changed.

Vulkan support is provided through USD Hydra's "HGI" interface, using a prototype extension for Vulkan ray tracing available in [this branch of the Autodesk fork of USD](https://github.com/autodesk-forks/USD/tree/adsk/feature/hgiraytracing). For this reason, USD is required when compiling Aurora with the Vulkan backend on Windows or Linux. USD is built as part of the build process described above, to support both the HdAurora render delegate and Vulkan.


## Changing Configurations

By default, Aurora will be built with the *Release* build configuration, i.e. for application deployment and best performance. To change to another configuration, see the information below.

- **For the externals** installed with the *installExternals.py* script, you can specify the desired configuration with the `--build-variant` option, and specify `Debug`, `Release` (default), or `All`. You can have both `Debug` and `Release` configurations built with `All` option. Additional configurations will take longer to install and will consume more disk space.
- **For Aurora itself**, on Linux, you can specify the desired configuration with the `CMAKE_BUILD_TYPE` variable when running CMake project generation. On Windows, this variable is ignored.
- On Windows, it is necessary for Aurora *and* the externals be built with the same configuration. Since Visual Studio allows multiple configurations in a project, you must select the appropriate configuration in the Visual Studio interface, or you will get linker errors. `--build-variant All` is recommended to support both `Debug` and `Release` build configurations.
19 changes: 9 additions & 10 deletions Doc/HdAurora.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,28 +8,27 @@ To learn more about Hydra, see [this presentation](https://graphics.pixar.com/us

## usdview

The easiest way to run HdAurora is using the **usdview** tool, part of the USD toolset that is used for viewing USD files.
The easiest way to run HdAurora is using the **usdview** tool, which is part of the USD toolset that is used for viewing USD files.

<img src="USDView.JPG" style="zoom: 50%;" />

Once **HdAurora** has been deployed to your USD folder you can select hdAurora in **usdview** using the renderer menu with the **Aurora** option:
Once **HdAurora** has been deployed to your USD folder you can select HdAurora in **usdview** using the renderer menu with the **Aurora** option:
<img src="RendererMenu.jpg" width="50%;" />

## Deploying hdAurora
## Deploying HdAurora

The provided Python script [deployHdAurora.py](../Scripts/deployHdAurora.py) can be used to deploy **HdAurora** to a USD installation (and create a new USD installation if one does not exist.)
The provided Python script [deployHdAurora.py](../Scripts/deployHdAurora.py) can be used to deploy **HdAurora** to a USD installation. This can also create a new USD installation if one does not exist, using the `--build` option.

Run the following command to create a new USD installation located at *../USD* relative to the Aurora repository root and deploy **HdAurora** to it. Creating a new USD installation requires a command prompt with compiler tools, such as "x64 Native Tools Command Prompt for VS 2019", and should be run from the root of the Aurora repository (this will take up to an hour to complete):
Run the following command to create a new USD installation located at *..\USD* relative to the Aurora repository root and deploy **HdAurora** to it. Creating a new USD installation requires a command prompt with compiler tools, such as "x64 Native Tools Command Prompt for VS 2019", and should be run from the root of the Aurora repository. This will take about 30 minutes to complete and will require 10 GB of disk space.

```
python Scripts/deployHdAurora.py ../USD --externals_folder=../AuroraExternals --config=Release --build
python Scripts\deployHdAurora.py ..\USD --externals_folder=..\AuroraExternals --config=Release --build
```

You can then run **usdview** from the bin subfolder within that installed USD folder, replacing *AssetFolder* with the folder the [Autodesk Telescope USD model](https://drive.google.com/file/d/1RM09qDOGcRinLJTbXCsiRfQrHmKA-1aN/view?usp=share_link) was unzipped into.
You can then run **usdview** from the *bin* subdirectory within that installed USD directory. The example command below loads the [Autodesk Telescope USD model](https://drive.google.com/file/d/1RM09qDOGcRinLJTbXCsiRfQrHmKA-1aN/view?usp=share_link); simply extract the ZIP file into a directory, referred to as *ASSET_DIR* below.

```
cd ../USD/bin
python usdview AssetFolder/AutodeskTelescope/AutodeskTelescope.usda--renderer=hdAurora
cd ..\USD\bin
python usdview {ASSET_DIR}\AutodeskTelescope.usda --renderer=Aurora
```


108 changes: 108 additions & 0 deletions Jenkinsfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
#!/usr/bin/env groovy
@Library('PSL@master') _

///////////////////////////////////////////////////
// Global constants
COMMONSHELL = new ors.utils.CommonShell(steps, env)

node('forgeogs-win2019-gpu') {
try {
stage ("Checkout Windows") {
checkoutGit()
}
stage ("Build Windows") {
windowsBuild()
}
stage ('Test Windows') {
windowsTest()
}
}
finally {
// Clear the repo
deleteDir()
}
}

///////////////////////////////////////////////////
// Checkout Functions

def checkoutGit() {
String branch = scm.branches[0].toString()
withGit {
COMMONSHELL.shell """
git clone -b ${branch} --recurse-submodules https://git.autodesk.com/GFX/Aurora .
git lfs pull
"""
}
}

///////////////////////////////////////////////////
// Build functions

def windowsBuild() {
def EXTERNALS_DIR="c:\\jenkins\\workspace\\AuroraExternals"
bat """
:: Set up EXTERNALS_DIR
if not exist ${EXTERNALS_DIR} call mkdir ${EXTERNALS_DIR}
:: Set up nasm
if not exist ${EXTERNALS_DIR}\\nasm-2.15.05-win64.zip call curl -o ${EXTERNALS_DIR}\\nasm-2.15.05-win64.zip https://www.nasm.us/pub/nasm/releasebuilds/2.15.05/win64/nasm-2.15.05-win64.zip
if not exist ${EXTERNALS_DIR}\\nasm-2.15.05 call 7z x -y -aoa ${EXTERNALS_DIR}\\nasm-2.15.05-win64.zip -o${EXTERNALS_DIR}
call set PATH=${EXTERNALS_DIR}\\nasm-2.15.05;%PATH%
:: Set up Vulkan SDK
:: We need to install Vulkan SDK silently. For more details please refer to https://vulkan.lunarg.com/doc/view/latest/windows/getting_started.html
if not exist ${EXTERNALS_DIR}\\VulkanSDK-1.3.231.1-Installer.exe call curl -o ${EXTERNALS_DIR}\\VulkanSDK-1.3.231.1-Installer.exe https://sdk.lunarg.com/sdk/download/1.3.231.1/windows/VulkanSDK-1.3.231.1-Installer.exe
if not exist "C:\\VulkanSDK\\1.3.231.1\\bin" call ${EXTERNALS_DIR}\\VulkanSDK-1.3.231.1-Installer.exe --accept-licenses --default-answer --confirm-command install
call set PATH=C:\\VulkanSDK\\1.3.231.1\\bin;%PATH%
call set VK_SDK_PATH=C:\\VulkanSDK\\1.3.231.1
call set VULKAN_SDK=C:\\VulkanSDK\\1.3.231.1
:: Set up Visual Studio 2019 Environment
call C:\\"Program Files (x86)"\\"Microsoft Visual Studio"\\2019\\Enterprise\\VC\\Auxiliary\\Build\\vcvars64.bat
:: insatll externals
python -u Scripts\\installExternals.py ${EXTERNALS_DIR}
:: build Aurora
echo Configure CMake project
if exist Build\\CMakeCache.txt del /f Build\\CMakeCache.txt
:: Windows SDK version 10.0.22000.194 or later is required in https://git.autodesk.com/GFX/Aurora#windows.
:: We'd disable DX BACKEND as installing the windows sdk maybe have some bad effects on other jobs.
cmake -S . -B Build -D CMAKE_BUILD_TYPE=Release -D EXTERNALS_DIR=${EXTERNALS_DIR} -DENABLE_DIRECTX_BACKEND=OFF
cmake --build Build --config Release
if not errorlevel 0 (
echo ERROR: Failed to build the project for Release binaries, see console output for details
exit /b %errorlevel%
)
"""
}

///////////////////////////////////////////////////
// Test functions

def windowsTest() {
bat """
:: Start unit test
echo Starting OGS modernization unit test for Release
setlocal EnableDelayedExpansion
pushd Build\\bin\\Release
set exit_code=0
for %%i in (.\\*Tests.exe) do (
set exe=%%i
set exe_name=!exe:~2,-4!
!exe!
if not errorlevel 0 (
echo ERROR: Test !exe_name! exited with non-zero exit code, see console output for details
set exit_code=1
)
)
popd
:: Break further execution when test fails
if %exit_code% equ 1 goto end
echo Done All tests for Release
:end
exit /b %exit_code%
"""
}
Loading

0 comments on commit acf5513

Please sign in to comment.