Skip to content
Closed
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
24 changes: 15 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ jobs:
cmake --build build --config Debug
- name: Produce install artifacts
run: |
cmake --install build --prefix install --config Debug
cmake --install build --prefix pkg --config Debug
- name: Run tests
run: |
ctest --output-on-failure -C Debug --test-dir build
Expand Down Expand Up @@ -64,7 +64,7 @@ jobs:
cmake --build build --config Release
- name: Produce install artifacts
run: |
cmake --install build --prefix install --config Release
cmake --install build --prefix pkg --config Release
- name: Run tests
run: |
ctest --output-on-failure -C Release --test-dir build
Expand Down Expand Up @@ -115,7 +115,7 @@ jobs:
cat build/.ninja_log
- name: Produce install artifacts
run: |
cmake --install build --prefix install --config Debug
cmake --install build --prefix pkg --config Debug
- name: Start Xvfb
run: |
Xvfb :99 -screen 0 1024x768x24 &
Expand Down Expand Up @@ -170,7 +170,7 @@ jobs:
cat build/.ninja_log
- name: Produce install artifacts
run: |
cmake --install build --prefix install --config Release
cmake --install build --prefix pkg --config Release
- name: Start Xvfb
run: |
Xvfb :99 -screen 0 1024x768x24 &
Expand Down Expand Up @@ -225,7 +225,7 @@ jobs:
cat build/.ninja_log
- name: Produce install artifacts
run: |
cmake --install build --prefix install --config Debug
cmake --install build --prefix pkg --config Debug
- name: Start Xvfb
run: |
Xvfb :99 -screen 0 1024x768x24 &
Expand Down Expand Up @@ -280,7 +280,7 @@ jobs:
cat build/.ninja_log
- name: Produce install artifacts
run: |
cmake --install build --prefix install --config Release
cmake --install build --prefix pkg --config Release
- name: Start Xvfb
run: |
Xvfb :99 -screen 0 1024x768x24 &
Expand Down Expand Up @@ -335,7 +335,10 @@ jobs:
cat build/.ninja_log
- name: Produce install artifacts
run: |
cmake --install build --prefix install --config Debug
cmake --install build --prefix pkg --config Debug
- name: Put files in app bundle
run: |
scripts/deploy_mac_bundle_presubmit.sh
- name: Run tests
run: |
ctest --output-on-failure -C Debug --test-dir build
Expand Down Expand Up @@ -389,7 +392,10 @@ jobs:
cat build/.ninja_log
- name: Produce install artifacts
run: |
cmake --install build --prefix install --config Release
cmake --install build --prefix pkg --config Release
- name: Put files in app bundle
run: |
scripts/deploy_mac_bundle_presubmit.sh
- name: Run tests
run: |
ctest --output-on-failure -C Release --test-dir build
Expand Down Expand Up @@ -452,4 +458,4 @@ jobs:
cat build_android/.ninja_log
- name: Produce install artifacts
run: |
cmake --install build_android --prefix install --config Debug
cmake --install build_android --prefix pkg --config Debug
26 changes: 19 additions & 7 deletions .github/workflows/presubmit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,9 @@ jobs:
- name: Build Dive host tools with VS 2022
run: |
cmake --build build --config Debug
- name: Produce install artifacts
run: |
cmake --install build --prefix pkg --config Debug
- name: Run tests
run: |
ctest --output-on-failure -C Debug --test-dir build
Expand Down Expand Up @@ -64,6 +67,9 @@ jobs:
- name: Build Dive host tools with VS 2022
run: |
cmake --build build --config Release
- name: Produce install artifacts
run: |
cmake --install build --prefix pkg --config Release
- name: Run tests
run: |
ctest --output-on-failure -C Release --test-dir build
Expand Down Expand Up @@ -119,7 +125,7 @@ jobs:
cat build/.ninja_log
- name: Produce install artifacts
run: |
cmake --install build --prefix install --config Debug
cmake --install build --prefix pkg --config Debug
- name: Start Xvfb
run: |
Xvfb :99 -screen 0 1024x768x24 &
Expand Down Expand Up @@ -174,7 +180,7 @@ jobs:
cat build/.ninja_log
- name: Produce install artifacts
run: |
cmake --install build --prefix install --config Release
cmake --install build --prefix pkg --config Release
- name: Start Xvfb
run: |
Xvfb :99 -screen 0 1024x768x24 &
Expand Down Expand Up @@ -229,7 +235,7 @@ jobs:
cat build/.ninja_log
- name: Produce install artifacts
run: |
cmake --install build --prefix install --config Debug
cmake --install build --prefix pkg --config Debug
- name: Start Xvfb
run: |
Xvfb :99 -screen 0 1024x768x24 &
Expand Down Expand Up @@ -284,7 +290,7 @@ jobs:
cat build/.ninja_log
- name: Produce install artifacts
run: |
cmake --install build --prefix install --config Release
cmake --install build --prefix pkg --config Release
- name: Start Xvfb
run: |
Xvfb :99 -screen 0 1024x768x24 &
Expand Down Expand Up @@ -351,7 +357,10 @@ jobs:
cat build/.ninja_log
- name: Produce install artifacts
run: |
cmake --install build --prefix install --config Debug
cmake --install build --prefix pkg --config Debug
- name: Put files in app bundle
run: |
scripts/deploy_mac_bundle_presubmit.sh
- name: Run tests
run: |
ctest --output-on-failure -C Debug --test-dir build
Expand Down Expand Up @@ -407,7 +416,10 @@ jobs:
cat build/.ninja_log
- name: Produce install artifacts
run: |
cmake --install build --prefix install --config Release
cmake --install build --prefix pkg --config Release
- name: Put files in app bundle
run: |
scripts/deploy_mac_bundle_presubmit.sh
- name: Run tests
run: |
ctest --output-on-failure -C Release --test-dir build
Expand Down Expand Up @@ -471,4 +483,4 @@ jobs:
cat build_android/.ninja_log
- name: Produce install artifacts
run: |
cmake --install build_android --prefix install --config Debug
cmake --install build_android --prefix pkg --config Debug
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@
/.cache/

# Build-related directories
# TODO: b/462767957 - Move build_android/ and pkg/ contents to under the unified build dir
build/
build_android/
third_party/freedreno/libs/
third_party/freedreno/obj
.gradle/
pkg/
# Amdvlk auto-generated files
*.pyc
g_*.h
g_*.cpp

.env

install/
gfxr_capture/
gfxr_capture_*/
**/.DS_Store
83 changes: 17 additions & 66 deletions BUILD.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ set DIVE_ROOT_PATH=C:\path\to\dive
You can specify the build type for release as well by replacing "Debug" with "Release" or "RelWithDebInfo" instead.
1. Install (the prefix must be coordinated with that of the [device resources](#dive-device-resources))
```sh
cmake --install build --prefix install --config Debug
cmake --install build --prefix pkg --config Debug
```

If you want to build a GFXR tool like `gfxrecon-convert`:
Expand Down Expand Up @@ -113,7 +113,7 @@ cmake --build build --target gfxrecon-convert
with `--config=<Debug/Release/RelWithDebInfo/MinSizeRel>` instead.
1. Install (the prefix must be coordinated with that of the [device resources](#dive-device-resources))
```bat
cmake --install build --prefix install --config Debug
cmake --install build --prefix pkg --config Debug
```

If you want to build a GFXR tool like `gfxrecon-convert`:
Expand All @@ -124,80 +124,31 @@ cmake --build build --target gfxrecon-convert

## Dive Device Resources

Warning: We only support "Debug" for the gradle build for GFXR portion, so it will be hardcoded and not depend on the build type chosen below.
Warning: We only support "Debug" for the gradle build for GFXR portion, so it will be hardcoded and not depend on the build type specified in the script.

Provide the appropriate `ANDROID_ABI` depending on your device.
Modify the script if necessary to provide the appropriate `ANDROID_ABI` depending on your device.

### Linux

1. Configure
```sh
cd $DIVE_ROOT_PATH

rm -rf build_android

cmake . -DCMAKE_TOOLCHAIN_FILE=${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake \
-G "Ninja Multi-Config" \
-Bbuild_android \
-DCMAKE_MAKE_PROGRAM="ninja" \
-DCMAKE_SYSTEM_NAME=Android \
-DANDROID_ABI=arm64-v8a \
-DANDROID_PLATFORM=android-26 \
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=NEVER \
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=NEVER
```
1. Build with one of the following methods:
* Build directly with ninja
```sh
ninja -C build_android -f build-Debug.ninja
```
* Build using cmake
```sh
cmake --build build_android --config=Debug
```
You can specify the build type for release as well by replacing "Debug" with "Release" or "RelWithDebInfo" instead.
1. Install (the prefix must be coordinated with that of the [host tools](#dive-host-tools))
```sh
cmake --install build_android --prefix install --config Debug
```
Running the script `scripts/build_android.sh` will build and install the device resources at `$DIVE_ROOT_PATH/pkg/device`.

### Windows

Run the following in the Visual Studio Developer Command Prompt for VS 2022 (or 2019)

1. Configure
```bat
cd %DIVE_ROOT_PATH%

rmdir /s build_android

cmake . -DCMAKE_TOOLCHAIN_FILE=%ANDROID_NDK_HOME%/build/cmake/android.toolchain.cmake ^
-G "Ninja Multi-Config" ^
-Bbuild_android ^
-DCMAKE_MAKE_PROGRAM="ninja" ^
-DCMAKE_SYSTEM_NAME=Android ^
-DANDROID_ABI=arm64-v8a ^
-DANDROID_PLATFORM=android-26 ^
-DCMAKE_FIND_ROOT_PATH_MODE_INCLUDE=NEVER ^
-DCMAKE_FIND_ROOT_PATH_MODE_LIBRARY=NEVER
```
1. Build with one of the following methods:
* Build directly with ninja
```bat
ninja -C build_android -f build-Debug.ninja
```
* Build using cmake
```bat
cmake --build build_android --config=Debug
```
1. Install (the prefix must be coordinated with that of the [host tools](#dive-host-tools))
```bat
cmake --install build_android --prefix install --config Debug
```
In the Visual Studio Developer Command Prompt for VS 2022 (or 2019), running the script `scripts\build_android.bat` will build and install the device resources at `$DIVE_ROOT_PATH\pkg\device`.

### Troubleshooting Tips
* Gradle build
* Open the gradle project at `third_party/gfxreconstruct/android` in Android Studio and try making recommended changes to the project and building from there.
* Delete GFXR build folders for a clean build
* `third_party/gfxreconstruct/android/layer/.cxx`
* `third_party/gfxreconstruct/android/layer/build`
* `third_party/gfxreconstruct/android/tools/replay/build`
* `third_party/gfxreconstruct/android/tools/replay/.cxx`
* `third_party/gfxreconstruct/android/tools/replay/build`

## App bundle (macOS)

After building the host tools and the device resources as outlined above and installing them, additional steps are required to make a self-contained macOS application bundle from the contents of the `pkg/` directory.

All external plugin folders must be placed under `$DIVE_ROOT_PATH/pkg/plugins` to be properly added to the bundle.

Running the script `scripts/deploy_mac_bundle.sh` will create the mac package and place it at `$DIVE_ROOT_PATH/pkg/dive.app`.
35 changes: 22 additions & 13 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP")
endif()
set(THIRDPARTY_DIRECTORY "${CMAKE_SOURCE_DIR}/third_party")
# TODO: b/462767957 - remove set(CMAKE_INSTALL_PREFIX ...) once we fix search path and mac build.
set(CMAKE_INSTALL_PREFIX "${CMAKE_SOURCE_DIR}/install")
option(DIVE_BUILD_WITH_CRASHPAD "Build Dive with CrashPad" ON)

# Add an option to allow users to easily toggle the runtime layer build
Expand All @@ -52,9 +50,18 @@ option(
option(DIVE_BUILD_WITH_SANITIZER "Build Dive with sanitizers" OFF)

# Placeholder value for DESTINATION to override cmake default.
# e.g. install(TARGETS target_name DESTINATION "${DIVE_INSTALL_DESTINATION}")
set(DIVE_INSTALL_DESTINATION ".")
set(DIVE_PLUGINS_INSTALL_DESTINATION "plugins")
# These are all relative to the install destination prefix which is recommended as "pkg/"
# e.g. install(TARGETS target_name DESTINATION "${DIVE_INSTALL_DEST_*}")
set(DIVE_INSTALL_DEST_HOST "host") # Should only be used as destination for host builds
set(DIVE_INSTALL_DEST_DEVICE "device") # Should only be used as destination for device builds
# Plugins folders
set(DIVE_PLUGINS_PARENT_DIR "plugins")
set(DIVE_INSTALL_DEST_SAMPLE_PLUGIN "dive_sample_plugin")
set(DIVE_PROFILING_PLUGIN_DIR "dive_profiling_plugin") # This is not built within Dive
# macOS bundle
set(DIVE_MACOS_BUNDLE_RESOURCES "Resources")
# License file
set(DIVE_LICENSE_FILE_NAME "NOTICE")

# Disable gtest for install
set(INSTALL_GTEST OFF)
Expand Down Expand Up @@ -108,7 +115,7 @@ if(ANDROID)
install(
FILES
${CMAKE_CURRENT_BINARY_DIR}/bin/$<CONFIG>/${DEVICE_RESOURCES_VERSION_FILENAME}
DESTINATION ${DIVE_INSTALL_DESTINATION}
DESTINATION ${DIVE_INSTALL_DEST_DEVICE}
)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "done")
Expand Down Expand Up @@ -182,7 +189,7 @@ else()
list(APPEND CMAKE_MESSAGE_INDENT " ")
# Currently hardcoding debug build, unknown reason
add_subdirectory(third_party/freedreno EXCLUDE_FROM_ALL)
install(TARGETS wrap DESTINATION "${DIVE_INSTALL_DESTINATION}")
install(TARGETS wrap DESTINATION "${DIVE_INSTALL_DEST_DEVICE}")
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "done")

Expand Down Expand Up @@ -282,18 +289,18 @@ if(ANDROID)
install(
FILES
${CMAKE_BINARY_DIR}/gfxr_layer/jni/${ANDROID_ABI}/libVkLayer_gfxreconstruct.so
DESTINATION "${DIVE_INSTALL_DESTINATION}"
DESTINATION "${DIVE_INSTALL_DEST_DEVICE}"
)
install(
FILES
${CMAKE_CURRENT_SOURCE_DIR}/third_party/gfxreconstruct/android/tools/replay/build/outputs/apk/debug/replay-debug.apk
DESTINATION "${DIVE_INSTALL_DESTINATION}"
DESTINATION "${DIVE_INSTALL_DEST_DEVICE}"
RENAME "gfxr-replay.apk"
)
install(
FILES
${CMAKE_CURRENT_SOURCE_DIR}/third_party/gfxreconstruct/android/scripts/gfxrecon.py
DESTINATION "${DIVE_INSTALL_DESTINATION}"
DESTINATION "${DIVE_INSTALL_DEST_DEVICE}"
)
list(POP_BACK CMAKE_MESSAGE_INDENT)
message(CHECK_PASS "done")
Expand All @@ -320,12 +327,14 @@ if(NOT ANDROID)

# MacOS has limited thread stack size, allocating large object in stack makes its stack overflow
# This has been fixed in https://github.com/google/dive/pull/541
if(APPLE)
if(CMAKE_HOST_APPLE)
set(DIVE_EXECUTABLE_PATH
${CMAKE_BINARY_DIR}/ui/$<CONFIG>/dive.app/Contents/MacOS/dive
${CMAKE_CURRENT_SOURCE_DIR}/pkg/dive.app/Contents/MacOS/dive
)
elseif(CMAKE_HOST_WIN32)
set(DIVE_EXECUTABLE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/pkg/host/dive.exe)
else()
set(DIVE_EXECUTABLE_PATH ${CMAKE_BINARY_DIR}/ui/dive)
set(DIVE_EXECUTABLE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/pkg/host/dive)
endif()
set(DIVE_TEST_TRACE_DIR ${PROJECT_SOURCE_DIR}/tests/gfxr_traces)
set(DIVE_TEST_TRACE
Expand Down
Loading
Loading