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

Update build to work with changes in CesiumGS/cesium-native#962 #1543

Merged
merged 3 commits into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion extern/vcpkg-overlays/triplets/x64-windows-unreal.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ set(VCPKG_TARGET_ARCHITECTURE x64)
set(VCPKG_CRT_LINKAGE dynamic)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_ENV_PASSTHROUGH "UNREAL_ENGINE_ROOT")
set(VCPKG_POLICY_ONLY_RELEASE_CRT enabled)

# Unreal Engine adds /Zp8 in 64-bit Windows builds to align structs to 8 bytes instead of the
# default of 16 bytes. There's this nice note in the documentation for that option:
Expand All @@ -15,9 +16,17 @@ set(VCPKG_ENV_PASSTHROUGH "UNREAL_ENGINE_ROOT")
# between compilation units using different versions of that flag. We compile cesium-native
# with this same option to avoid super-dodgy and hard to debug issues.
# https://github.com/EpicGames/UnrealEngine/blob/5.2.1-release/Engine/Source/Programs/UnrealBuildTool/Platform/Windows/VCToolChain.cs
set(VCPKG_CXX_FLAGS "/MD /Zp8")
set(VCPKG_CXX_FLAGS "/Zp8")
set(VCPKG_C_FLAGS "${VCPKG_CXX_FLAGS}")

# Use an unreasonable amount of force to replace /MDd (MultiThreadedDebugDLL) with /MD (MultiThreadedDLL)
# and ensure that `_DEBUG` is not defined, as required by Unreal Engine's use of the release runtime library.
# Only CMAKE_MSVC_RUNTIME_LIBRARY would be required if all our third-party libraries used CMake 3.15+, but alas.
set(VCPKG_CMAKE_CONFIGURE_OPTIONS "")
list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS "-DCMAKE_MSVC_RUNTIME_LIBRARY:STRING=MultiThreadedDLL")
list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS "-DCMAKE_CXX_FLAGS_DEBUG:STRING=/MD /Z7 /Ob0 /Od /RTC1")
list(APPEND VCPKG_CMAKE_CONFIGURE_OPTIONS "-DCMAKE_C_FLAGS_DEBUG:STRING=/MD /Z7 /Ob0 /Od /RTC1")

# When building official binaries on CI, use a very specific MSVC toolset version (which must be installed).
# When building locally, use the default.
if(DEFINED ENV{CI})
Expand Down