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

[shaderc, spirv-tools] Fix cmake config, add usage, minor fixes #31912

Merged
merged 14 commits into from
Jun 14, 2023

Conversation

dg0yt
Copy link
Contributor

@dg0yt dg0yt commented Jun 9, 2023

Fixes #31510.
Fixes #28144.
No version update in this PR.

  • Changes comply with the maintainer guide
  • SHA512s are updated for each updated download
  • The "supports" clause reflects platforms that may be fixed by this new version
  • Any fixed CI baseline entries are removed from that file.
  • Any patches that are no longer applied are deleted from the port's directory.
  • The version database is fixed by rerunning ./vcpkg x-add-version --all and committing the result.
  • Only one version is added to each modified port's versions file.

@dg0yt dg0yt changed the title [shaderc] Fix cmake config, add usage, minor fixes [shaderc, spirv-tools] Fix cmake config, add usage, minor fixes Jun 9, 2023
ports/shaderc/usage Show resolved Hide resolved
ports/shaderc/portfile.cmake Show resolved Hide resolved
Comment on lines +9 to +15
+ set(sgcf_find_extra "")
+ if(NOT "${TARGET}" STREQUAL "SPIRV-Tools-opt")
+ set(sgcf_find_extra "find_dependency(SPIRV-Tools-opt)\n")
+ endif()
file(WRITE ${CMAKE_BINARY_DIR}/${TARGET}Config.cmake
"include(CMakeFindDependencyMacro)\n"
+ ${sgcf_find_extra}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

-DSPIRV_SKIP_TESTS=ON
-DSPIRV_SKIP_EXECUTABLES=${SKIP_EXECUTABLES}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This was overridden 3 lines later.

Comment on lines -83 to -86
if(VCPKG_LIBRARY_LINKAGE STREQUAL "static")
# lesspipe.sh is the only file there
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/bin" "${CURRENT_PACKAGES_DIR}/debug/bin")
endif()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This didn't only remove spirv-lesspipe.sh, but also the SPIRV-Tools-shared.dll installed in static builds, while leaving the import lib SPIRV-Tools-shared.lib untouched.

Comment on lines +29 to +32
+ if(NOT BUILD_SHARED_LIBS)
+ set_target_properties(${SPIRV_TOOLS}-shared PROPERTIES EXCLUDE_FROM_ALL 1)
+ list(REMOVE_ITEM SPIRV_TOOLS_TARGETS ${SPIRV_TOOLS}-shared)
+ endif()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the change to control the presence of SPIRV-Tools-shared DLL and import lib.

Comment on lines +4 to +8
# The static libary is always available.
# It offers full public symbol visibility.
target_link_libraries(main PRIVATE SPIRV-Tools-static)
# In triplets with dynamic library linkage, there is also a shared libary.
target_link_libraries(main PRIVATE SPIRV-Tools-shared)
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 tool libs need always a main lib with all symbols, but for distros, they recommend the shared lib with reduced symbol visibility.
I don't think there is better solution here without patching against upstream's will.
Cf. KhronosGroup/SPIRV-Tools#3909

@dg0yt dg0yt marked this pull request as ready for review June 9, 2023 20:20
@MonicaLiu0311 MonicaLiu0311 added the category:port-bug The issue is with a library, which is something the port should already support label Jun 12, 2023
@MonicaLiu0311
Copy link
Contributor

shaderc

The usage test passed (header files found):

shaderc provides CMake targets:

    find_package(unofficial-shaderc CONFIG REQUIRED)
    target_link_libraries(main PRIVATE unofficial::shaderc::shaderc)

spirv-tools

All features are tested successfully in the following triplet:

x86-windows
x64-windows
x64-windows-static

The usage test passed (header files found):

spirv-tools provides CMake targets:

    find_package(SPIRV-Tools CONFIG REQUIRED)
    # The static libary is always available.
    # It offers full public symbol visibility.
    target_link_libraries(main PRIVATE SPIRV-Tools-static)
    # In triplets with dynamic library linkage, there is also a shared libary.
    target_link_libraries(main PRIVATE SPIRV-Tools-shared)

🔴 post-build error:

-- Performing post-build validation
warning: The following EXEs were found in /bin or /debug/bin. EXEs are not valid distribution targets.

    E:\shaderc\packages\spirv-tools_x64-windows\bin\spirv-as.exe
    E:\shaderc\packages\spirv-tools_x64-windows\bin\spirv-cfg.exe
    E:\shaderc\packages\spirv-tools_x64-windows\bin\spirv-dis.exe
    E:\shaderc\packages\spirv-tools_x64-windows\bin\spirv-link.exe
    E:\shaderc\packages\spirv-tools_x64-windows\bin\spirv-lint.exe
    E:\shaderc\packages\spirv-tools_x64-windows\bin\spirv-opt.exe
    E:\shaderc\packages\spirv-tools_x64-windows\bin\spirv-reduce.exe
    E:\shaderc\packages\spirv-tools_x64-windows\bin\spirv-val.exe

error: Found 1 post-build check problem(s). To submit these ports to curated catalogs, please first correct the portfile: E:\shaderc\ports\spirv-tools\portfile.cmake

@dg0yt
Copy link
Contributor Author

dg0yt commented Jun 12, 2023

post-build error

Fixed, thanks.

@MonicaLiu0311 MonicaLiu0311 added the info:reviewed Pull Request changes follow basic guidelines label Jun 13, 2023
@vicroms vicroms merged commit 4cca179 into microsoft:master Jun 14, 2023
@dg0yt dg0yt deleted the shaderc branch June 14, 2023 05:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support info:reviewed Pull Request changes follow basic guidelines
Projects
None yet
3 participants