Explorar o código

Meta: Support fully static distribution release builds

This adds the vcpkg triplets and CMake preset to perform release
builds for distribution. These builds are fully static, and currently
intended to be used for the `js` ESVU release.

In the future, linking everything statically into the final binary is
probably not what we will do for released Ladybird builds. Instead, we
may have a "libladybird.so", which is then linked into the binary. But
this should be fine for `js` for now.
Timothy Flynn hai 7 meses
pai
achega
0447d05d52

+ 1 - 1
AK/CMakeLists.txt

@@ -62,7 +62,7 @@ swizzle_target_properties_for_swift(simdutf::simdutf)
 target_link_libraries(AK PRIVATE simdutf::simdutf)
 target_link_libraries(AK PRIVATE simdutf::simdutf)
 
 
 # FIXME: Make this generic for all imported shared library dependencies and apply globally
 # FIXME: Make this generic for all imported shared library dependencies and apply globally
-if (NOT CMAKE_SKIP_INSTALL_RULES AND NOT "${VCPKG_INSTALLED_DIR}" STREQUAL "")
+if (BUILD_SHARED_LIBS AND NOT CMAKE_SKIP_INSTALL_RULES AND NOT "${VCPKG_INSTALLED_DIR}" STREQUAL "")
     install(IMPORTED_RUNTIME_ARTIFACTS simdutf::simdutf
     install(IMPORTED_RUNTIME_ARTIFACTS simdutf::simdutf
             LIBRARY COMPONENT Lagom_Runtime NAMELINK_COMPONENT Lagom_Development
             LIBRARY COMPONENT Lagom_Runtime NAMELINK_COMPONENT Lagom_Development
             FRAMEWORK COMPONENT Lagom_Runtime
             FRAMEWORK COMPONENT Lagom_Runtime

+ 21 - 0
CMakePresets.json

@@ -87,6 +87,18 @@
       "generator": "Visual Studio 17 2022",
       "generator": "Visual Studio 17 2022",
       "toolset": "ClangCL"
       "toolset": "ClangCL"
     },
     },
+    {
+      "name": "Distribution",
+      "inherits": "default",
+      "displayName": "Distribution Config",
+      "description": "Distribution build with static libraries using Ninja generator",
+      "binaryDir": "${fileDir}/Build/distribution",
+      "cacheVariables": {
+        "BUILD_SHARED_LIBS": "OFF",
+        "CMAKE_BUILD_TYPE": "Release",
+        "VCPKG_OVERLAY_TRIPLETS": "${fileDir}/Meta/CMake/vcpkg/distribution-triplets"
+      }
+    },
     {
     {
       "name": "Debug",
       "name": "Debug",
       "inherits": "default",
       "inherits": "default",
@@ -126,6 +138,15 @@
       ],
       ],
       "displayName": "Non-Sanitizer CI Config"
       "displayName": "Non-Sanitizer CI Config"
     },
     },
+    {
+      "name": "Distribution_CI",
+      "inherits": [
+        "vcpkg_ci",
+        "Distribution"
+      ],
+      "displayName": "Distribution CI Config",
+      "description": "Distribution build with GitHub Actions cache"
+    },
     {
     {
       "name": "Sanitizer_CI",
       "name": "Sanitizer_CI",
       "inherits": [
       "inherits": [

+ 2 - 0
Meta/CMake/vcpkg/distribution-triplets/arm64-linux.cmake

@@ -0,0 +1,2 @@
+include (${CMAKE_CURRENT_LIST_DIR}/../base-triplets/arm64-linux.cmake)
+include (${CMAKE_CURRENT_LIST_DIR}/distribution.cmake)

+ 2 - 0
Meta/CMake/vcpkg/distribution-triplets/arm64-osx.cmake

@@ -0,0 +1,2 @@
+include (${CMAKE_CURRENT_LIST_DIR}/../base-triplets/arm64-osx.cmake)
+include (${CMAKE_CURRENT_LIST_DIR}/distribution.cmake)

+ 2 - 0
Meta/CMake/vcpkg/distribution-triplets/distribution.cmake

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

+ 2 - 0
Meta/CMake/vcpkg/distribution-triplets/x64-linux.cmake

@@ -0,0 +1,2 @@
+include (${CMAKE_CURRENT_LIST_DIR}/../base-triplets/x64-linux.cmake)
+include (${CMAKE_CURRENT_LIST_DIR}/distribution.cmake)

+ 2 - 0
Meta/CMake/vcpkg/distribution-triplets/x64-osx.cmake

@@ -0,0 +1,2 @@
+include (${CMAKE_CURRENT_LIST_DIR}/../base-triplets/x64-osx.cmake)
+include (${CMAKE_CURRENT_LIST_DIR}/distribution.cmake)