Meta: Use dynamic vcpkg linkage for release builds

By using static linkage, we are opening ourselves up to ODR violations
that result in runtime crashes (rather than build-time link errors). For
example, we've seen this happen while trying to use Skia context in both
LibGfx and LibWeb.
This commit is contained in:
Timothy Flynn 2024-08-03 10:40:00 -04:00 committed by Andrew Kaster
parent 5681dbee64
commit d86693158a
Notes: github-actions[bot] 2024-11-06 17:40:07 +00:00
4 changed files with 14 additions and 4 deletions

View file

@ -20,7 +20,17 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${IN_BUILD_PREFIX}${CMAK
set(CMAKE_Swift_MODULE_DIRECTORY "${CMAKE_BINARY_DIR}/${IN_BUILD_PREFIX}swift")
set(CMAKE_SKIP_BUILD_RPATH FALSE)
if ("${VCPKG_INSTALLED_DIR}" STREQUAL "")
set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
else()
if (CMAKE_BUILD_TYPE MATCHES "Release|RelWithDebInfo")
set(CMAKE_BUILD_RPATH "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/lib")
else()
set(CMAKE_BUILD_RPATH "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/debug/lib")
endif()
endif()
# See slide 100 of the following ppt :^)
# https://crascit.com/wp-content/uploads/2019/09/Deep-CMake-For-Library-Authors-Craig-Scott-CppCon-2019.pdf
if (APPLE)

View file

@ -1,3 +1,3 @@
# Ideally, we would set VCPKG_BUILD_TYPE="debug", but that is currently not supported as a standalone build type.
# See: https://github.com/microsoft/vcpkg/issues/38224
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE dynamic)

View file

@ -1,2 +1,2 @@
set(VCPKG_BUILD_TYPE release)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE dynamic)

View file

@ -1,5 +1,5 @@
set(VCPKG_BUILD_TYPE release)
set(VCPKG_LIBRARY_LINKAGE static)
set(VCPKG_LIBRARY_LINKAGE dynamic)
set(VCPKG_C_FLAGS "")
set(VCPKG_CXX_FLAGS "-frtti")