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

Add conan support #146

Closed
AndreyMlashkin opened this issue May 25, 2021 · 5 comments
Closed

Add conan support #146

AndreyMlashkin opened this issue May 25, 2021 · 5 comments

Comments

@AndreyMlashkin
Copy link

AndreyMlashkin commented May 25, 2021

Conan is a Package and Dependency Manager. It is a convenient tool to manage multiple dependencies.
It would be great to have a possibility to use DiligentEngine as a conan recipe.
conan-io/conan-center-index#1533

@TheMostDiligent
Copy link
Contributor

@AndreyMlashkin FYI, I've made a set of changes to make dependencies more flexible, take a look at #40.
This does not change the default build system, but allows all third-party libraries to be defined outside of Diligent.

@TheMostDiligent
Copy link
Contributor

TheMostDiligent commented Apr 1, 2022

Ideally, there will be no need to use patches as CMake should be able to pick up any existing third-party libs and use them instead of submodules.

I am almost sure that everything can now be achieved by just defining aliases where necessary in the top-level CMake, e.g (assuming that non-namespace targets are not defined - I don't know if they actually are).

find_package(glslang REQUIRED CONFIG)
add_library(glslang ALIAS glslang::glslang)
add_library(OGLCompiler ALIAS glslang::OGLCompiler)


add_subdirectory(source_subfolder)

@AndreyMlashkin
Copy link
Author

@TheMostDiligent, in v2.5.2 it works really good for all libraries but glslang, there we have

CMake Error at source_subfolder/ThirdParty/CMakeLists.txt:68 (add_subdirectory):

@AndreyMlashkin
Copy link
Author

AndreyMlashkin commented Apr 4, 2022

-    if (NOT ${DILIGENT_NO_GLSLANG} AND (NOT TARGET glslang))
+    if (NOT ${DILIGENT_NO_GLSLANG} AND (NOT TARGET glslang::glslang))

This fixes my problem

@TheMostDiligent
Copy link
Contributor

TheMostDiligent commented Apr 4, 2022

glslang's CMake file does not add namespace unless the targets are installed, so TARGET glslang::glslang will not work for the default build.
My suggestion is to add backwards aliases before including Diligent source:

find_package(glslang REQUIRED CONFIG)
add_library(glslang ALIAS glslang::glslang)
add_library(OGLCompiler ALIAS glslang::OGLCompiler)
# And similar for other required targets

add_subdirectory(source_subfolder)

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

2 participants