Skip to content

Commit

Permalink
Merge pull request #98 from egorodet/develop
Browse files Browse the repository at this point in the history
Version 0.6.4: Hot-Fixes

- **Samples** apps:
  - Attempted replacement of `PerlinNoise` with `FastNoise2` library, but reverted it back because of no ARM support for M1 Macs (see [FastNoise2 issue](Auburn/FastNoise2#93))
- **Graphics** libraries:
  - Fixed runtime errors in GPU profiling builds with `METHANE_GPU_PROFILING_ENABLED=ON`:
    - DirectX GPU timestamps re-calibration issue leading to GPU ranges shifting was fixed.
    - Fixed command list execution waiting threads synchronisation in Profiling builds in Typography tutorial.
  - Fixed resources retaining in command lists. Retained resources were incorrectly cleared on `CommandList::Reset()`, while they should be cleared on `CommandList::Commit()`.
  - Fixed DirectX descriptor heaps allocations after `Context::Reset()` by always using deferred heap allocation in all cases. Deferred heap initialisation flag was removed, since it became unconditionally deferred.
  - Fixed sporadic hang in `CommandQueueTrackingBase::WaitForExecution()`
  - Fixed sporadic crash on destruction of `CommandQueueTrackingBase` with proper shutdown procedure called from destructor of derived class.
  - Fixed Vulkan build and some initialisation errors on MacOS.
- **Tests**:
  - All unit tests were updated to support breaking changes in Catch v3.
  - `Point<T,size>` wrapper class was extended with workarounds of MacOS & ARM specific bugs in HLSL++ integer vector comparison and division operators (see [1](redorav/hlslpp#60) and [2](redorav/hlslpp#61)).
  - Logging of `Point`, `Rect` and `RectSize` values was added in `DataTypes` unit tests.
- **External** libraries:
  - External dependencies management via Git submodules was replaced with [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake) package manager. No submodules anymore - it greatly simplifies external library updates!
    - All externally dependent repositories are downloaded to CPM cache directory during CMake configuration stage, to `Build/Output/ExternalsCache` by default (it can be changed with CMake option `CPM_SOURCE_CACHE`).
    - When CMake project is configured under CLion, external repositories are downloaded to individual build directories of each configuration to workaround [parallel cache update collision issue of the CPM.cmake](cpm-cmake/CPM.cmake#293).
  - New `README.md` description of the external dependencies was added in `Externals` directory.
  - Almost all libraries were updated to latest version, except SPIRV-Cross and DirectX Shader Compiler pre-built binary tools.
- **Build** infrastructure:
  - Root `CMakeLists.txt` was simplified by moving all compiler configuration options to `CMake/MethaneBuildOptions.cmake`.
  - Use caching of Externals CPM package sources in Azure Pipelines and GitHub Workflows to speedup builds.
  - MacOS builders were switched from v10.15 to v11.
  • Loading branch information
egorodet authored Jul 19, 2022
2 parents af6c708 + c532754 commit d95ef69
Show file tree
Hide file tree
Showing 141 changed files with 1,230 additions and 569 deletions.
2 changes: 2 additions & 0 deletions .github/codeql/codeql-config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,9 @@ queries:
paths:
- Apps
- Modules

paths-ignore:
- Build/Output
- Externals
- Tests
- CMake
Expand Down
37 changes: 34 additions & 3 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,18 @@ on:
- '.github/**/codeql-*.yml'
- 'Apps/**'
- 'Modules/**'
- 'Externals/**'
- 'Tests/**'
- 'CMakeLists.txt'
pull_request:
branches: [ master ]
paths:
- '.github/**/codeql-*.yml'
- 'Apps/**'
- 'Modules/**'
- 'Externals/**'
- 'Tests/**'
- 'CMakeLists.txt'
schedule:
- cron: '20 23 * * 3'

Expand Down Expand Up @@ -51,17 +55,24 @@ jobs:

- name: Checkout repository
uses: actions/checkout@v2
with:
submodules: 'recursive'

# Windows CodeQL analysis is DISABLED (see reason description next to Analysis step below)
# NOTE: CodeQL is temporary DISABLED on Windows (see reason description next to Analysis step below)
- name: Initialize CodeQL
if: ${{ matrix.os != 'windows-2019' }}
uses: github/codeql-action/init@v2
with:
languages: cpp
config-file: ./.github/codeql/codeql-config.yml

- name: Initialize Externals Cache
id: cache-externals
uses: actions/cache@v3
env:
cache-name: cache-externals
with:
path: Build/Output/ExternalsCache
key: ExternalsCache-${{ matrix.config_preset }}-${{ hashFiles('Externals/*.cmake') }}

- name: CMake Configure Preset ${{ matrix.config_preset }}
run: cmake --preset ${{ matrix.config_preset }} -DMETHANE_CODE_COVERAGE_ENABLED:BOOL=OFF -DMETHANE_TESTS_BUILD_ENABLED:BOOL=OFF -DMETHANE_SHADERS_VALIDATION_ENABLED:BOOL=OFF

Expand All @@ -72,3 +83,23 @@ jobs:
- name: Perform CodeQL Analysis
if: ${{ matrix.os != 'windows-2019' }}
uses: github/codeql-action/analyze@v2
with:
upload: false
output: results

- name: Filter CodeQL Results
if: ${{ matrix.os != 'windows-2019' }}
uses: MethanePowered/FilterSarif@master
with:
patterns: |
-Build/Output/**
-Externals/**
-Tests/**
input: results/cpp.sarif
output: results/cpp-filtered.sarif

- name: Upload Filtered CodeQL Results
if: ${{ matrix.os != 'windows-2019' }}
uses: github/codeql-action/upload-sarif@v2
with:
sarif_file: results/cpp-filtered.sarif
3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

17 changes: 9 additions & 8 deletions .idea/cmake.xml

Large diffs are not rendered by default.

18 changes: 0 additions & 18 deletions .idea/vcs.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

90 changes: 47 additions & 43 deletions Build/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,21 @@
- [First time initialization](#first-time-initialization)
- [Update sources to latest revision](#update-sources-to-latest-revision)
- [Building from Sources](#building-from-sources)
- [Windows Build with Visual Studio](#-windows-build-with-visual-studio)
- [MacOS Build with XCode](#-macos-build-with-xcode)
- [Linux Build with Unix Makefiles](#-linux-build-with-unix-makefiles)
- [Windows Build with Visual Studio](#windows-build-with-visual-studio)
- [Linux Build with Unix Makefiles](#linux-build-with-unix-makefiles)
- [MacOS Build with XCode](#macos-build-with-xcode)
- [CMake Generator](#cmake-generator)
- [CMake Options](#cmake-options)
- [CMake Presets](#cMake-presets)

## Prerequisites

- **Common**
- Git (required to pull sub-modules)
- CMake 3.18 or later
- **Windows**
- Windows 10 RS5 (build 1809) or later
- Visual Studio 2019/22 with MSVC v142 or later
- Windows 10 SDK latest
- Windows 10 SDK (latest)
- **MacOS**
- MacOS 10.15 "Catalina" or later
- XCode 11 or later with command-line tools
Expand All @@ -34,33 +33,36 @@

## Fetch Sources

**IMPORTANT!**
- <ins>Do not download source code via Zip archive</ins>, since it does not include content of
[Externals](https://github.com/egorodet/MethaneExternals/tree/master) submodules.
Use `git clone` command as described below.
- Consider using <ins>short path for repository location on Windows</ins> (for example `c:\Git`),
which may be required to resolve problem with support of paths longer than 260 symbols in some Microsoft build tools.
### Notes
- Since v0.6 Methane Kit does not use Git submodules anymore and switches to [CPM.cmake](https://github.com/cpm-cmake/CPM.cmake)
to fetch dependent repositories during CMake configuration stage, so it should be both possible to acquire sources
with `git clone` command or to download as ZIP-archive using `Code > Download ZIP` button.
- All [External](/Externals) dependencies are fetched to the `Build/Output/ExternalsCache/...` directory,
which can be changed by adding `-DCPM_SOURCE_CACHE=<cache_path>` to the CMake configuration command.
- Consider using <ins>short path for repository location on Windows</ins> (for example `c:\Git\`),
which may be required to resolve problem with support of paths longer than 260 symbols for some of Microsoft build tools.

#### First time initialization
### First time initialization

```console
git clone --recurse-submodules https://github.com/egorodet/MethaneKit.git
git clone https://github.com/egorodet/MethaneKit.git
cd MethaneKit
```

#### Update sources to latest revision
### Update sources to latest revision

```console
cd MethaneKit
git pull && git submodule update --init --recursive
git pull
```

## Building from Sources

### <img src="https://github.com/egorodet/MethaneKit/blob/master/Docs/Images/Platforms/Windows.png" width=24 valign="middle"> Windows Build with Visual Studio
### Windows Build with Visual Studio

Start Command Prompt, go to `MethaneKit` root directory (don't forget to pull dependent submodules as [described above](#fetch-sources))
and either start auxiliary build script [Build/Windows/Build.bat](/Build/Windows/Build.bat) or build with CMake command line
<img src="https://github.com/egorodet/MethaneKit/blob/master/Docs/Images/Platforms/Windows.png" width=24 valign="middle">
Start Command Prompt, go to `MethaneKit` root directory and either start auxiliary build script
[Build/Windows/Build.bat](/Build/Windows/Build.bat) or build with CMake command line
to generate Visual Studio 2019/22 solution:

```console
Expand All @@ -70,18 +72,40 @@ cmake --build %OUTPUT_DIR%\Build --config Release --target install
```

Alternatively root [CMakeLists.txt](/CMakeLists.txt) can be opened directly in Visual Studio or
[any other IDE with native CMake support](#development-environments) and [built using CMake presets](#cmake-presets).
[any other IDE with native CMake support](/README.md#development-environments) and [built using CMake presets](#cmake-presets).

[Methane Graphics Core](/Modules/Graphics/Core) is built using **DirectX 12** graphics API by default on Windows.
Vulkan graphics API can be used instead by adding cmake generator option `-DMETHANE_GFX_VULKAN_ENABLED:BOOL=ON` or
by running `Build/Windows/Build.bat --vulkan`.

Run built applications from the installation directory `Build\Output\VisualStudio\Win64-DX\Install\Apps`

### <img src="https://github.com/egorodet/MethaneKit/blob/master/Docs/Images/Platforms/MacOS.png" width=24 valign="middle"> MacOS Build with XCode
### Linux Build with Unix Makefiles

Start Terminal, go to `MethaneKit` root directory (don't forget to pull dependent submodules as [described above](#fetch-sources))
and either start auxiliary build script [Build/Unix/Build.sh](/Build/Unix/Build.sh) or build with CMake command line:
<img src="https://github.com/egorodet/MethaneKit/blob/master/Docs/Images/Platforms/Ubuntu.png" valign="middle">
Start Terminal, go to `MethaneKit` root directory and either start auxiliary build script
[Build/Unix/Build.sh](/Build/Unix/Build.sh) or build with CMake command line to generate Unix Makefiles:

```console
OUTPUT_DIR=Build/Output/Linux
cmake -S . -B $OUTPUT_DIR/Build -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$(pwd)/$OUTPUT_DIR/Install"
cmake --build $OUTPUT_DIR/Build --config Release --target install --parallel 8
```

[Methane Graphics Core](/Modules/Graphics/Core) is built using **Vulkan** graphics API on Linux.

Alternatively root [CMakeLists.txt](/CMakeLists.txt) can be opened directly in
[any IDE with native CMake support](/README.md#development-environments) and [built using CMake presets](#cmake-presets).

Run built applications from the installation directory `Build/Output/Linux/Install/Apps`.
Note that in Ubuntu Linux even GUI applications should be started from "Terminal" app,
because of `noexec` permission set on user's home directory by security reasons.

### MacOS Build with XCode

<img src="https://github.com/egorodet/MethaneKit/blob/master/Docs/Images/Platforms/MacOS.png" width=24 valign="middle">
Start Terminal, go to `MethaneKit` root directory and either start auxiliary build script
[Build/Unix/Build.sh](/Build/Unix/Build.sh) or build with CMake command line to generate XCode workspace:

```console
OUTPUT_DIR=Build/Output/XCode
Expand All @@ -94,7 +118,7 @@ using CMake generator command line option `-DCMAKE_OSX_ARCHITECTURES="arm64;x86_
This option should be omitted with earlier versions of Clang on macOS.

Alternatively root [CMakeLists.txt](/CMakeLists.txt) can be opened directly in Visual Studio or
[any other IDE with native CMake support](#development-environments) and [built using CMake presets](#cmake-presets).
[any other IDE with native CMake support](/README.md#development-environments) and [built using CMake presets](#cmake-presets).

[Methane Graphics Core](/Modules/Graphics/Core) is built using **Metal** graphics API on MacOS by default.
Vulkan graphics API can be used instead by adding cmake generator option `-DMETHANE_GFX_VULKAN_ENABLED:BOOL=ON` or
Expand All @@ -103,26 +127,6 @@ on top of Metal, which is not currently supporting all extensions required by Me

Run built applications from the installation directory `Build/Output/XCode/Install/Apps`.

### <img src="https://github.com/egorodet/MethaneKit/blob/master/Docs/Images/Platforms/Ubuntu.png" width=24 valign="middle"> Linux Build with Unix Makefiles

Start Terminal, go to `MethaneKit` root directory (don't forget to pull dependent submodules as [described above](#fetch-sources))
and either start auxiliary build script [Build/Unix/Build.sh](/Build/Unix/Build.sh) or build with CMake command line:

```console
OUTPUT_DIR=Build/Output/Linux
cmake -S . -B $OUTPUT_DIR/Build -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="$(pwd)/$OUTPUT_DIR/Install"
cmake --build $OUTPUT_DIR/Build --config Release --target install --parallel 8
```

[Methane Graphics Core](/Modules/Graphics/Core) is built using **Vulkan** graphics API on Linux.

Alternatively root [CMakeLists.txt](/CMakeLists.txt) can be opened directly in
[any IDE with native CMake support](#development-environments) and [built using CMake presets](#cmake-presets).

Run built applications from the installation directory `Build/Output/Linux/Install/Apps`.
Note that in Ubuntu Linux even GUI applications should be started from "Terminal" app,
because of `noexec` permission set on user's home directory by security reasons.

## CMake Generator

### CMake Options
Expand Down
6 changes: 6 additions & 0 deletions Build/Unix/AzureBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ steps:
inputs:
cmakeArgs: '--version'

- task: Cache@2
displayName: 'Initialize Externals Cache'
inputs:
key: 'ExternalsCache | $(cmake.ConfigurePreset) | Externals/*.cmake'
path: '$(cmake.ExternalsCacheDir)'

- task: CMake@1
displayName: 'Generate with configuration preset $(cmake.ConfigurePreset)'
inputs:
Expand Down
8 changes: 7 additions & 1 deletion Build/Unix/AzureSonarScan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,17 @@ steps:
displayName: 'Download and unpack Sonar Build-Wrapper'
- task: Cache@2
displayName: 'Sonar Scanner Cache'
displayName: 'Initialize Sonar Scanner Cache'
inputs:
key: 'SonarCache | $(sonar.ProjectKey) | $(Build.SourceBranchName) | $(cmake.ConfigurePreset) | "$(sonar.ScannerVersion)"'
path: $(sonar.CacheDir)

- task: Cache@2
displayName: 'Initialize Externals Cache'
inputs:
key: 'ExternalsCache | $(cmake.ConfigurePreset) | Externals/*.cmake'
path: '$(cmake.ExternalsCacheDir)'

- task: SonarCloudPrepare@1
displayName: 'Prepare Sonar Cloud Scanner'
inputs:
Expand Down
6 changes: 6 additions & 0 deletions Build/Windows/AzureBuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ steps:
inputs:
cmakeArgs: '--version'

- task: Cache@2
displayName: 'Initialize Externals Cache'
inputs:
key: 'ExternalsCache | $(cmake.ConfigurePreset) | Externals/*.cmake'
path: '$(cmake.ExternalsCacheDir)'

- task: CMake@1
displayName: 'Generate with configuration preset $(cmake.ConfigurePreset)'
inputs:
Expand Down
37 changes: 29 additions & 8 deletions Build/Windows/AzureSonarScan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,18 @@ steps:
workingDirectory: $(buildDir)
displayName: 'Download and unpack Sonar Build-Wrapper'
- powershell: |
Expand-Archive -Path 'OpenCppCoverage.zip' -DestinationPath '.'
workingDirectory: Externals\Tools
displayName: 'Unpack OpenCppCoverage tool'
- task: Cache@2
displayName: 'Sonar Scanner Cache'
displayName: 'Initialize Sonar Scanner Cache'
inputs:
key: 'SonarCache | $(sonar.ProjectKey) | $(Build.SourceBranchName) | $(cmake.ConfigurePreset) | "$(sonar.ScannerVersion)"'
path: $(sonar.CacheDir)

- task: Cache@2
displayName: 'Initialize Externals Cache'
inputs:
key: 'ExternalsCache | $(cmake.ConfigurePreset) | Externals/*.cmake'
path: '$(cmake.ExternalsCacheDir)'

- task: SonarCloudPrepare@1
displayName: 'Prepare Sonar Cloud Scanner'
inputs:
Expand All @@ -52,16 +53,36 @@ steps:
workingDirectory: $(Build.SourcesDirectory)
displayName: 'Build under Sonar Build-Wrapper with $(cmake.BuildPreset)'
- powershell: |
Invoke-WebRequest -Uri '$(coverage.OpenCppCoverageUrl)' -OutFile 'OpenCppCoverage.zip'
Expand-Archive -Path 'OpenCppCoverage.zip' -DestinationPath 'OpenCppCoverage'
if (-not(Test-Path -Path 'OpenCppCoverage\OpenCppCoverage.exe' -PathType Leaf)) {
Get-ChildItem 'OpenCppCoverage'
throw 'OpenCppCoverage\OpenCppCoverage.exe executable was not found in unpacked content!'
}
workingDirectory: '$(installDir)\Tests'
displayName: 'Download and unpack OpenCppCoverage tool'
- script: |
setlocal enabledelayedexpansion
set open_cpp_coverage_exe="OpenCppCoverage\OpenCppCoverage.exe"
if not exist "%open_cpp_coverage_exe%" (
echo File path "%open_cpp_coverage_exe%" does not exist!
exit 101
)
echo Running unit-tests in directory "%cd%"
mkdir Results
mkdir Coverage
set /A result_error_level=0
for /r "." %%a in (*Test.exe) do (
"$(Build.SourcesDirectory)\Externals\Tools\OpenCppCoverage\OpenCppCoverage.exe" --sources "$(Build.SourcesDirectory)\Modules" --export_type=cobertura:Coverage\%%~na.xml -- "%%~fa" -r sonarqube -o "Results\%%~na.xml"
echo "%open_cpp_coverage_exe%" --sources "$(Build.SourcesDirectory)\Modules" --export_type=cobertura:Coverage\%%~na.xml -- "%%~fa" -r sonarqube -o "Results\%%~na.xml"
"%open_cpp_coverage_exe%" --sources "$(Build.SourcesDirectory)\Modules" --export_type=cobertura:Coverage\%%~na.xml -- "%%~fa" -r sonarqube -o "Results\%%~na.xml"
echo - %%~na - completed with !errorlevel! exit status
if not !errorlevel!==0 (
set /A result_error_level=!errorlevel!
)
)
exit 0
exit !result_error_level!
workingDirectory: '$(installDir)\Tests'
failOnStderr: false
displayName: 'Collect code coverage from all unit-tests in install directory'
Expand Down
Loading

0 comments on commit d95ef69

Please sign in to comment.