Skip to content

AZSLc Development Guide

galibzon edited this page Mar 24, 2022 · 8 revisions

CMake minimum version 3.20 is required.

On Windows

> cd D:\GIT\o3de-azslc

There's a convenient prepare_solution_win.bat file that will help with CMake configuration and VS2019 solution generation.

> .\prepare_solution_win.bat
...
...
-- Output libraries to D:/GIT/o3de-azslc/src/dist
-- Configuring done
-- Generating done
-- Build files have been written to: D:/GIT/o3de-azslc/build/win_x64
Press any key to continue . . .

In VS2019 open the solution located in build\win_x64\Azslc.sln.
From here you can work with VS2019, make changes to the code, etc.

On MacOS

$ cd ~/GIT/o3de-azslc

There's a convenient prepare_solution_darwin.sh file that will help with CMake configuration and XCode project generation. Additionally this script will build AZSLc for both Debug and Release configurations.

$ ./prepare_solution_darwin.sh
...
...
** BUILD SUCCEEDED **
~/GIT/o3de-azslc/build/Debug ~/GIT/o3de-azslc
Debug version:
AZSL Compiler 1.7.35 MacOS
~/GIT/o3de-azslc
Deploying Release and Debug binaries...
mkdir: bin: File exists
mkdir: bin/darwin: File exists
mkdir: bin/darwin/release: File exists
mkdir: bin/darwin/debug: File exists
Done!

After the build is complete, there will be an XCode project in:
build/Azslc.xcodeproj.

On Linux

$ cd ~/GIT/o3de-azslc

There's a convenient prepare_solution_linux.sh file that will help with CMake configuration. Additionally this script will build AZSLc for both Debug and Release configurations.

$ ./prepare_solution_linux.sh
...
[100%] Linking CXX executable azslc
[100%] Built target azslc
~/GIT/o3de-azslc/build/Release ~/GIT/o3de-azslc
Executing azslc in Release version:
AZSL Compiler 1.7.35 Unix
~/GIT/o3de-azslc
Deploying azslc Release binary...
azslc was deployed to bin/linux/release

Configuring for Debug build...
...
[100%] Linking CXX executable azslc
[100%] Built target azslc
~/GIT/o3de-azslc/build/Debug ~/GIT/o3de-azslc
Executing azslc in Debug version:
AZSL Compiler 1.7.35 Unix
~/GIT/o3de-azslc
Deploying azslc Debug binary...
azslc was deployed to bin/linux/debug

Common Things To Know For All Platforms (Windows, MacOS & Linux)

The src/CMakeLists.txt is setup so all the *.cpp & *.h files under the src/ directory will be added to the solution. If you need to add new files, simply add them inside the src/ directory and reconfigure by running the respective prepare_solution_<platform>.sh/.bat.

Running unit tests.

Unit testing is orchestrated with the python script tests/testapp.py. For convenience, on Windows, the batch file tests\launch_tests.bat is provided to run the full test suite for the Release build. When validating the Debug build, you should use test\launch_tests_debug.bat. Similar there's a tests/launch_tests.sh for MacOS and a tests/launch_tests_linux.sh for Linux that can be used to run the test suite on each platform.

If interested in adding a new test, follow this guide: Adding New Test Cases To AZSLc

Intellisense Support

Jeremy Ong shared an Intellisense configuration file for Visual Studio Code:
https://www.jeremyong.com/graphics/parsers/hlsl/azsl/2022/01/02/azsl-intellisense-prototype/