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

Including shaderc/CMakeLists.txt as suggested in README not working #1369

Open
lobneroO opened this issue Sep 8, 2023 · 4 comments
Open

Comments

@lobneroO
Copy link

lobneroO commented Sep 8, 2023

I want to use shaderc (including glslc) in my project, such that I can compile glsl shaders (including #include directives) in my code.

In the libshaderc/README.md it says:

If the external project uses CMake, then shaderc/CMakeLists.txt can be included into the external project's CMake configuration and shaderc can be used as a link target. This is the simplest way to use libshaderc in an external project.

So I went ahead and did this:

include(3rdparty/shaderc/CMakeLists.txt)
target_link_libraries(${PROJECT_NAME} PRIVATE
	shaderc_combined
)

But I get the following errors:

CMake Error at 3rdparty/shaderc/CMakeLists.txt:69 (include):
include could not find requested file:

cmake/setup_build.cmake

And because of this, other errors (e.g. Unknwon CMake command "find_host_package" follow).
It doesn't helpf, if I include these other cmake files in my own CMakeLists.txt either.

My project structure is

MyProj
|
|----- CMakeLists.txt
|
|----- 3rdparty/
|          |
|          | ----- shaderc/CMakeLists.txt
@dj2
Copy link
Contributor

dj2 commented Sep 18, 2023

Does it work better if you do add_subdirectory(3rdparty/shaderc) instead of include?

@AEspinosaDev
Copy link

I have the same error. I'm using add_subdirectory and I still get the same error

@lobneroO
Copy link
Author

Sorry, I had gone back to using the shaderc packaged with the VulkanSDK and adding my own shader includer class, I cannot say if the add_subdirectory would have fixed my issue.

@dj2
Copy link
Contributor

dj2 commented Oct 17, 2023

Are you changing CMAKE_MODULE_PATH? It looks like it's looking for a file in the local cmake folder and is unable to find it?

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

No branches or pull requests

3 participants