-
Notifications
You must be signed in to change notification settings - Fork 669
build(deps): automatically pull in dependencies #5982
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -33,61 +33,9 @@ else() | |
| set(SPIRV_HEADER_DIR ${CMAKE_CURRENT_SOURCE_DIR}/spirv-headers) | ||
| endif() | ||
|
|
||
| if (IS_DIRECTORY ${SPIRV_HEADER_DIR}) | ||
| # TODO(dneto): We should not be modifying the parent scope. | ||
| set(SPIRV_HEADER_INCLUDE_DIR ${SPIRV_HEADER_DIR}/include PARENT_SCOPE) | ||
|
|
||
| # Add SPIRV-Headers as a sub-project if it isn't already defined. | ||
| # Do this so enclosing projects can use SPIRV-Headers_SOURCE_DIR to find | ||
| # headers to include. | ||
| if (NOT DEFINED SPIRV-Headers_SOURCE_DIR) | ||
| add_subdirectory(${SPIRV_HEADER_DIR}) | ||
| endif() | ||
| else() | ||
| message(FATAL_ERROR | ||
| "SPIRV-Headers was not found - please checkout a copy at external/spirv-headers.") | ||
| endif() | ||
|
|
||
|
Comment on lines
-36
to
-50
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. You cannot remove this. We cannot change the way it works for existing users. This would break many projects.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
I see, so the dependencies would need to be cloned to the same places?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Consider how spirv-tools is used in https://github.com/google/shaderc. This repo has two "submodule" that use spirv-headers: glslang, spirv-tools. Shaderc does not want to compile with two different versions of spriv-headers for these tools, so it will checkout its own version, and tell glslang and spirv-tools where to find it: In the SPIR-V tools cmake files, we have no way of knowing which version the parent project wants to use nor do we know where they have put it. A few other tools are the same way. If you want to use |
||
| if (NOT ${SPIRV_SKIP_TESTS}) | ||
| # Find gmock if we can. If it's not already configured, then try finding | ||
| # it in external/googletest. | ||
| if (TARGET gmock) | ||
| message(STATUS "Google Mock already configured") | ||
| else() | ||
| if (NOT GMOCK_DIR) | ||
| set(GMOCK_DIR ${CMAKE_CURRENT_SOURCE_DIR}/googletest) | ||
| endif() | ||
| if(EXISTS ${GMOCK_DIR}) | ||
| if(MSVC) | ||
| # Our tests use ::testing::Combine. Work around a compiler | ||
| # detection problem in googletest, where that template is | ||
| # accidentally disabled for VS 2017. | ||
| # See https://github.com/google/googletest/issues/1352 | ||
| add_definitions(-DGTEST_HAS_COMBINE=1) | ||
| endif() | ||
| if(WIN32) | ||
| option(gtest_force_shared_crt | ||
| "Use shared (DLL) run-time lib even when Google Test is built as static lib." | ||
| ON) | ||
| endif() | ||
| # gtest requires special defines for building as a shared | ||
| # library, simply always build as static. | ||
| push_variable(BUILD_SHARED_LIBS 0) | ||
| add_subdirectory(${GMOCK_DIR} ${CMAKE_CURRENT_BINARY_DIR}/googletest EXCLUDE_FROM_ALL) | ||
| pop_variable(BUILD_SHARED_LIBS) | ||
| endif() | ||
| endif() | ||
| if (TARGET gmock) | ||
| set(GTEST_TARGETS | ||
| gtest | ||
| gtest_main | ||
| gmock | ||
| gmock_main | ||
| ) | ||
| foreach(target ${GTEST_TARGETS}) | ||
| set_property(TARGET ${target} PROPERTY FOLDER GoogleTest) | ||
| endforeach() | ||
| endif() | ||
|
|
||
| # Find Effcee and RE2, for testing. | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should not unconditionally fetching the dependency. This should only happen if the directory does not already exist.
This will also create problem if SPIRV Headers get ahead of SPIR-V tools. This may not always compile. We use the DEPS file to keep track of a currently working version. We try to keep that as up-to-date as possible. You should try to get the commit hash from there.
With that said, I'm not sure if this is too useful since all people have to do to get the deps is call
python3 utils/git-sync-deps. See https://github.com/KhronosGroup/SPIRV-Tools?tab=readme-ov-file#getting-the-source. This creates a second way of doing the samething.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It does not do that.
There's a TODO to for me to lock it into the correct commit. I wasn't sure which one was the correct one. Just wanted to get initial reviews. The commit IDs can be set by the
GIT_TAGargument.It automates the process though to make the build more comfortable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, I don't know cmake too well. I guess it only fetches the content if the package could not be found.
I saw the TODO. I just want to make sure that you get the commit from the DEPS file. We do not want to keep track of the proper commit in multiple places.
Now I see why the fetching is use, if you are relying on
find_package.