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

FindFruit from Cmake after installing via vcpkg.json #163

Open
frederick-brier opened this issue Oct 7, 2024 · 5 comments
Open

FindFruit from Cmake after installing via vcpkg.json #163

frederick-brier opened this issue Oct 7, 2024 · 5 comments

Comments

@frederick-brier
Copy link

After installing Fruit via vcpkg.json, FindFruit() was not in the path. It was in the ./vcpkg/buildtrees/fruit/src/v3.7.1-b712e99c79.clean/cmake-modules/FindFruit.cmake. A file(GLOB_RECURSE...) found the file's path and I was able to add it to the CMAKE_MODULE_PATH and then call FindFruit(), but it would be nice FindFruit.cmake was automagically added to the path. Also the vcpkg include and libpath was not updated and had to be set manually. Is this a vcpkg port issue? Or something in Fruit's CMake support?

@poletti-marco
Copy link
Contributor

Hi, I suspect this is due to the vcpkg configuration, from my understanding it was written more as a way to use Fruit as a dependency of another project that uses vcpkg as opposed to a general way to install Fruit and then use it in various build systems (unless your project uses both cmake and vcpkg?).

https://github.com/google/fruit/wiki/install has other options to install Fruit that (unlike vcpkg) are officially supported.
If you do want to use vcpkg, the configuration lives in a separate repo with different maintainers, see https://github.com/google/fruit/wiki/install#with-vcpkg-on-windows-not-officially-supported.

If the other (non-vcpkg) options don't work well for you, can you explain your use case more in detail?
From the path you mention, it seems like this is on Linux, is this correct?

@tt4g
Copy link
Contributor

tt4g commented Oct 7, 2024

I think it is because vcpkg is customizing the CMake configuration when installing fruit.

If you look at ports/fruit/portfile.cmake, you will see that fruit is installed using a custom command provided by vcpkg.

From my little research, it seems that the vcpkg_cmake_configure() command replaces CMAKE_INSTALL_PREFIX with CURRENT_PACKAGES_DIR: https://github.com/microsoft/vcpkg/blob/7adc2e4d49e8d0efc07a369079faa6bc3dbb90f3/ports/vcpkg-cmake/vcpkg_cmake_configure.cmake#L236
If CURRENT_PACKAGES_DIR is different from the standard CMake path, then FindFruit.cmake will not find it.

@frederick-brier
Copy link
Author

For this product and its build environment, it is actually Windows. Since I do a lot of Linux development and PowerShell handles forward slashes, when acceptable, we use forward slashes. We are using vcpkg.json to pull in several Boost libraries, OpenCL, and several other libraries across 60+ repositories being built with GitHub Actions. I am introducing DI using Fruit and it seemed the easiest way to add it. Plus we are building arm64 in addition to x64. vcpkg triplets constructed with the processor as a variable is convenient. tt4g, you have pointed out the issue being the portfile.cmake. I will create a story in our backlog and see if I can fix it at some point. Thank you.

@tt4g
Copy link
Contributor

tt4g commented Oct 7, 2024

It seems that at least CMAKE_TOOLCHAIN_FILE needs to be set for CMake and vcpkg integration: https://learn.microsoft.com/en-us/vcpkg/users/buildsystems/cmake-integration#cmake_toolchain_file

@frederick-brier
Copy link
Author

We have a VcpkgSupport.cmake file (in a git submodule ) that sets the CMAKE_TOOLCHAIN_FILE value along with a number of other VCPKG_* variables that is included prior to the project() command. Please feel free to pelt me with any other suggestions. It is always possible I overlooked something :). Thank you for your help.

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