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

Use Vulkan-Headers to find current Vulkan Version #1272

Merged

Conversation

charles-lunarg
Copy link
Contributor

@charles-lunarg charles-lunarg commented Sep 22, 2023

The Vulkan-Headers CMakelists.txt has the necessary logic to decode the Vulkan API version from itself. This allows removal of FindVulkanVersion.cmake which duplicated that logic.

This is my first proper PR to gfxreconstruct, so do let me know if there are any procedures or things I should be aware of!

@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 48289.

@CLAassistant
Copy link

CLAassistant commented Sep 22, 2023

CLA assistant check
All committers have signed the CLA.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 3249 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 3249 failed.

add_library(vulkan_registry INTERFACE)
target_include_directories(vulkan_registry INTERFACE ${GFXRECON_SOURCE_DIR}/external/Vulkan-Headers/include)
target_compile_definitions(vulkan_registry INTERFACE VK_NO_PROTOTYPES VK_ENABLE_BETA_EXTENSIONS)
add_subdirectory(${GFXRECON_SOURCE_DIR}/external/Vulkan-Headers)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Execution failed for task ':layer:generateJsonModelRelease'.
> /home/runner/work/gfxreconstruct/gfxreconstruct/android/layer/CMakeLists.txt : C/C++ release|armeabi-v7a : CMake Error at /home/runner/work/gfxreconstruct/gfxreconstruct/android/framework/cmake-config/PlatformConfig.cmake:54 (add_subdirectory):
    add_subdirectory not given a binary directory but the given source
    directory
    "/home/runner/work/gfxreconstruct/gfxreconstruct/external/Vulkan-Headers"
    is not a subdirectory of
    "/home/runner/work/gfxreconstruct/gfxreconstruct/android/layer".  When
    specifying an out-of-tree source a binary directory must be explicitly
    specified.
  Call Stack (most recent call first):
    CMakeLists.txt:5 (include)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The android/layer/CMakeLists.txt includes several instances of add_subdirectory with explicit binary folders specified. I tried to model that in an effort to make things work. Not sure about it because the cmake code is run through include(cmake-config/PlatformConfig.cmake), and I'm unsure how relative paths work in that context.

Copy link
Contributor Author

@charles-lunarg charles-lunarg Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Execution failed for task ':layer:generateJsonModelRelease'.
> /home/runner/work/gfxreconstruct/gfxreconstruct/android/layer/CMakeLists.txt : C/C++ release|armeabi-v7a : CMake Error at /home/runner/work/gfxreconstruct/gfxreconstruct/external/Vulkan-Headers/CMakeLists.txt:8 (cmake_minimum_required):
    CMake 3.15...3.25 or higher is required.  You are running version 3.10.2

Did the actions runner change??? Seems I have an invalid cmake version now for who knows what reason.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OH I am being silly.
The Vulkan-Headers/CMakelists.txt requires CMake 3.15, but the android code is running using 3.10.2. Which means that either the CMake version in android is updated or the android code reverts to the old way (manually creating a library). The latter may be difficult if there is shared CMake code between android and the rest of the project.

Copy link
Contributor Author

@charles-lunarg charles-lunarg Sep 25, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking into it further, there are two issues. One is that the CMake minimum for android is 3.4 and the other is that the runner loads gfxreconstruct-dev-android which contains CMake 3.10.2. I misunderstood gfxreconstruct-dev-android, that is an output of the build not an input. The CMake version is likely coming from the android SDK being used, which makes sense (as ubuntu 22 ships cmake 3.16 iirc).

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The linux build in .github/workflows/ci_build.xml invokes - uses: lukka/get-cmake@latest under steps:. I wonder if we need that for the android build as well? @charles-lunarg you could try adding it as part of your PR, see what GH does.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that would work, but that would have to happen in conjunction with raising the minimum (that way we don't advertise a minimum lower than what we actually require).

I would like to raise the minimum to 3.16.3, which is what top level CMakeLists.txt require.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems that the - uses: lukka/get-cmake@latest is not able to change the CMake version used. According to the android docs I found, 3.10.2 is the newest version provided in the NDK. They do mention being able to use newer CMake versions, you just have to provide the binary yourself.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does that mean we need to specify the cmake binary to use in an environment variable or some such? @juan-lunarg any thoughts or should we just wait until we're finished transitioning our Android build process?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have reverted the android cmake changes - seems that the CMake version provided by the NDK is too old for the Vulkan-headers cmake code. And because it doesn't make use of the version information, it is fine to keep as is.

@bradgrantham-lunarg
Copy link
Contributor

This looks pretty good to me, but I'd like to see the Android Release/Debug GH actions build succeeding.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 49475.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 3251 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 3251 failed.

@charles-lunarg charles-lunarg force-pushed the add_subdirectory_vulkan_headers branch from ad45bcf to 1521b44 Compare September 25, 2023 19:33
@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 49595.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 3252 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 49650.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 3253 running.

The Vulkan-Headers CMakelists.txt has the necessary logic to decode the
Vulkan API version from itself. This allows removal of
FindVulkanVersion.cmake which duplicated that logic.

The Android build is left unchanged for the time being due to the NDK
provided CMake being older than the version required by Vulkan-Headers.
@charles-lunarg charles-lunarg force-pushed the add_subdirectory_vulkan_headers branch from 3c6c0a7 to 3484721 Compare September 25, 2023 22:11
@ci-tester-lunarg
Copy link

CI gfxreconstruct build queued with queue ID 49706.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 3255 running.

@ci-tester-lunarg
Copy link

CI gfxreconstruct build # 3255 passed.

@charles-lunarg charles-lunarg merged commit f3de76c into LunarG:dev Sep 26, 2023
@charles-lunarg charles-lunarg deleted the add_subdirectory_vulkan_headers branch September 26, 2023 19:00
bradgrantham-lunarg added a commit to bradgrantham-lunarg/gfxreconstruct that referenced this pull request Oct 5, 2023
@charles-lunarg charles-lunarg restored the add_subdirectory_vulkan_headers branch October 24, 2023 22:13
@charles-lunarg charles-lunarg deleted the add_subdirectory_vulkan_headers branch October 24, 2023 23:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants