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

build as an installable package and use vcpkg manifest mode to build standalone #1026

Open
wants to merge 24 commits into
base: main
Choose a base branch
from

Conversation

timoore
Copy link
Contributor

@timoore timoore commented Dec 5, 2024

This PR has several moving parts:

  • Package files for cesium-native created on installation. Any hackery needed to create targets for external targets is moved to CMake Find modules that are installed with the package files.
  • A single vcpkg overlay port for asycplusplus
  • vcpkg.json and vcpkg-configuration.json
  • A CMakePresets.json file demonstrating how to do a manifest mode bulid.

I'm using this branch to build vsgCs using cesium-native as a vcpkg overlay port. That usage needs to be documented here too. Also, while I've tried to preserve the old behavior using exvcpkg, I haven't tested this yet with Cesium for Unreal and other integrations in the classic style of using cesium-native as a CMake subdirectory.

This is basically the addition of the vcpkg.json manifest and
vcpkg-configuration.json, which are both pretty minimal. In practice,
projects will probably copy those and add overlays.
Should be a no-op at this point, but will be required when we make
Cesium Native installable.
The intent is for public target sources to be compiled into consumers
of a target, but that is a no-op for header files. Including the
public headers, which have paths pointing inside the project, causes
an error when generating an export set.
This create the CMake files that create targets in an imported
package.
Add a find module for zlib-ng, which can be installed and included by
a config package. Other find modules may be necessary too.
VCPKG_MANIFEST_MODE isn't available before project() is called, so
define a new variable CESIUM_USE_EZVCPKG to control the early
loading of ezvcpkg.
Individual integrations can add their own overlay if they need it.
Also, try to make sure that vcpkg actually uses the desired triplet.
@azrogers
Copy link
Contributor

azrogers commented Dec 9, 2024

Looks like this causes the following issue in cesium-unreal:

  CMake Error at cesium-native/cmake_install.cmake:940 (file):
    file cannot create directory:
    C:/Dev/prs/cesium-native-1026/Plugins/cesium-unreal/extern/../Source/ThirdParty/lib/Windows-AMD64-$<IF:$<CONFIG:Debug>,Debug,Release>/cmake/cesium-native.
    Maybe need administrative privileges.
  Call Stack (most recent call first):
    cmake_install.cmake:37 (include)

Not sure why this would have broken here - the cesium-unreal/extern CMakeLists.txt is unchanged here and I don't see why the CONFIG generator expression would stop evaluating correctly here.

@timoore
Copy link
Contributor Author

timoore commented Dec 9, 2024

Thanks for being brave enough to test this with Cesium Unreal! What generator was used to build cesium-native?

@timoore
Copy link
Contributor Author

timoore commented Dec 10, 2024

The problem is in the new cesium-native/CMakeLists.txt, which defines exports to install. The install(EXPORT...) command doesn't support generator expressions in its destination argument... which makes a certain amount of sense, even if it's inconsistent. The export files won't be used in the Unreal build, but I'll change the command to use a more suitable variable.

In the Cesium for Unreal build, CMAKE_INSTALL_LIBDIR contains
a generator expression, which the install(EXPORT ...) command doesn't
process correctly. So, install the configuration files such as
"cesium-nativeTargets.cmake" in
${CMAKE_INSTALL_DATADIR}/cesium-native/cmake, which is a perfectly
fine location.

These files aren't used by the Cesium Unreal build anyway.
@timoore
Copy link
Contributor Author

timoore commented Jan 6, 2025

I've started to look at how to use this in cesium-unreal and have hit a bit of a sticking point with specifying the MSVC toolset version to build those parts of cesium-unreal/extern that wouldn't be vcpkg port overlays. Maybe this isn't a real issue, because I think the GitHub build action would work the same. It's really only a problem for developers who have multiple toolsets installed. It is possible to set the toolset version through CMakePresets.json, and on the command line, but otherwise it is really obscure. Do you think this is worth worrying about?

Just to be clear, this isn't a new problem that comes with vcpkg manifest mode.

@2xsaiko
Copy link

2xsaiko commented Jan 11, 2025

I've been trying to package this (Homebrew for now, later Gentoo) so I can use it as a dependency for vsgCs which I want to use in something I'm working on, however right now it seems pretty much impossible to do so without significantly changing the build files. This patchset looks like it could improve that, however with this it fails to even configure in the Homebrew build environment:

error: In manifest mode, vcpkg install does not support individual package arguments.

https://gist.github.com/2xsaiko/9d2bc0691529d2599e2d43d8cf7e8ec5

Strangely enough, this error doesn't occur when running it outside of the Homebrew package. Any ideas?

@timoore
Copy link
Contributor Author

timoore commented Jan 11, 2025

I've been trying to package this (Homebrew for now, later Gentoo) so I can use it as a dependency for vsgCs which I want to use in something I'm working on, however right now it seems pretty much impossible to do so without significantly changing the build files. This patchset looks like it could improve that, however with this it fails to even configure in the Homebrew build environment:

error: In manifest mode, vcpkg install does not support individual package arguments.

https://gist.github.com/2xsaiko/9d2bc0691529d2599e2d43d8cf7e8ec5

Strangely enough, this error doesn't occur when running it outside of the Homebrew package. Any ideas?

The vcpkg-build branch in vsgCs uses a commit to a personal copy of Cesium Native -- sucked in as a vcpkg port overlay -- that was the basis of this PR and is very close to it. I encourage you to give that a try.

In your build that is crashing, it looks like the ezvcpkg code is getting confused by the vcpkg.json mainifest file and is then going into manifset mode. This is interesting as I would like to keep ezvcpkg working for a while, but for experimenting with this PR you probably want to specify CESIUM_USE_EZVCPKG=OFF.

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

Successfully merging this pull request may close these issues.

3 participants