2020-05-12 05:58:12 +08:00
|
|
|
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
|
|
|
|
|
|
|
vcpkg_from_git(
|
|
|
|
OUT_SOURCE_PATH SOURCE_PATH
|
|
|
|
URL https://chromium.googlesource.com/crashpad/crashpad
|
2024-05-09 02:42:54 +08:00
|
|
|
REF 7e0af1d4d45b526f01677e74a56f4a951b70517d
|
2024-07-10 01:34:01 +08:00
|
|
|
PATCHES
|
|
|
|
fix-linux.patch
|
2020-05-12 05:58:12 +08:00
|
|
|
)
|
|
|
|
|
2022-04-26 06:39:10 +08:00
|
|
|
vcpkg_find_acquire_program(PYTHON3)
|
|
|
|
vcpkg_replace_string("${SOURCE_PATH}/.gn" "script_executable = \"python3\"" "script_executable = \"${PYTHON3}\"")
|
|
|
|
|
2020-05-12 05:58:12 +08:00
|
|
|
function(checkout_in_path PATH URL REF)
|
|
|
|
if(EXISTS "${PATH}")
|
|
|
|
return()
|
|
|
|
endif()
|
2022-01-26 02:31:15 +08:00
|
|
|
|
2020-05-12 05:58:12 +08:00
|
|
|
vcpkg_from_git(
|
|
|
|
OUT_SOURCE_PATH DEP_SOURCE_PATH
|
|
|
|
URL "${URL}"
|
|
|
|
REF "${REF}"
|
|
|
|
)
|
|
|
|
file(RENAME "${DEP_SOURCE_PATH}" "${PATH}")
|
|
|
|
file(REMOVE_RECURSE "${DEP_SOURCE_PATH}")
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
# mini_chromium contains the toolchains and build configuration
|
|
|
|
checkout_in_path(
|
|
|
|
"${SOURCE_PATH}/third_party/mini_chromium/mini_chromium"
|
|
|
|
"https://chromium.googlesource.com/chromium/mini_chromium"
|
2024-05-09 02:42:54 +08:00
|
|
|
"dce72d97d1c2e9beb5e206c6a05a702269794ca3"
|
2020-05-12 05:58:12 +08:00
|
|
|
)
|
2024-07-10 01:34:01 +08:00
|
|
|
vcpkg_apply_patches(
|
|
|
|
SOURCE_PATH "${SOURCE_PATH}/third_party/mini_chromium/mini_chromium"
|
|
|
|
PATCHES
|
|
|
|
"fix-std-20.patch"
|
|
|
|
)
|
2020-05-12 05:58:12 +08:00
|
|
|
|
2023-04-21 06:57:39 +08:00
|
|
|
if(VCPKG_TARGET_IS_LINUX)
|
|
|
|
# fetch lss
|
|
|
|
checkout_in_path(
|
|
|
|
"${SOURCE_PATH}/third_party/lss/lss"
|
|
|
|
https://chromium.googlesource.com/linux-syscall-support
|
|
|
|
9719c1e1e676814c456b55f5f070eabad6709d31
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2020-05-12 05:58:12 +08:00
|
|
|
function(replace_gn_dependency INPUT_FILE OUTPUT_FILE LIBRARY_NAMES)
|
|
|
|
unset(_LIBRARY_DEB CACHE)
|
|
|
|
find_library(_LIBRARY_DEB NAMES ${LIBRARY_NAMES}
|
|
|
|
PATHS "${CURRENT_INSTALLED_DIR}/debug/lib"
|
|
|
|
NO_DEFAULT_PATH)
|
|
|
|
|
|
|
|
if(_LIBRARY_DEB MATCHES "-NOTFOUND")
|
|
|
|
message(FATAL_ERROR "Could not find debug library with names: ${LIBRARY_NAMES}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
unset(_LIBRARY_REL CACHE)
|
|
|
|
find_library(_LIBRARY_REL NAMES ${LIBRARY_NAMES}
|
|
|
|
PATHS "${CURRENT_INSTALLED_DIR}/lib"
|
|
|
|
NO_DEFAULT_PATH)
|
|
|
|
|
|
|
|
if(_LIBRARY_REL MATCHES "-NOTFOUND")
|
|
|
|
message(FATAL_ERROR "Could not find library with names: ${LIBRARY_NAMES}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set(_INCLUDE_DIR "${CURRENT_INSTALLED_DIR}/include")
|
|
|
|
|
|
|
|
file(REMOVE "${OUTPUT_FILE}")
|
|
|
|
configure_file("${INPUT_FILE}" "${OUTPUT_FILE}" @ONLY)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
replace_gn_dependency(
|
|
|
|
"${CMAKE_CURRENT_LIST_DIR}/zlib.gn"
|
|
|
|
"${SOURCE_PATH}/third_party/zlib/BUILD.gn"
|
|
|
|
"z;zlib;zlibd"
|
|
|
|
)
|
|
|
|
|
|
|
|
set(OPTIONS_DBG "is_debug=true")
|
|
|
|
set(OPTIONS_REL "")
|
|
|
|
|
|
|
|
if(CMAKE_HOST_WIN32)
|
|
|
|
# Load toolchains
|
2022-07-26 05:00:13 +08:00
|
|
|
vcpkg_cmake_get_vars(cmake_vars_file)
|
|
|
|
include("${cmake_vars_file}")
|
2020-05-12 05:58:12 +08:00
|
|
|
|
|
|
|
set(OPTIONS_DBG "${OPTIONS_DBG} \
|
2022-07-26 05:00:13 +08:00
|
|
|
extra_cflags_c=\"${VCPKG_COMBINED_C_FLAGS_DEBUG}\" \
|
|
|
|
extra_cflags_cc=\"${VCPKG_COMBINED_CXX_FLAGS_DEBUG}\" \
|
|
|
|
extra_ldflags=\"${VCPKG_COMBINED_SHARED_LINKER_FLAGS_DEBUG}\" \
|
|
|
|
extra_arflags=\"${VCPKG_COMBINED_STATIC_LINKER_FLAGS_DEBUG}\"")
|
2020-05-12 05:58:12 +08:00
|
|
|
|
|
|
|
set(OPTIONS_REL "${OPTIONS_REL} \
|
2022-07-26 05:00:13 +08:00
|
|
|
extra_cflags_c=\"${VCPKG_COMBINED_C_FLAGS_RELEASE}\" \
|
|
|
|
extra_cflags_cc=\"${VCPKG_COMBINED_CXX_FLAGS_RELEASE}\" \
|
|
|
|
extra_ldflags=\"${VCPKG_COMBINED_SHARED_LINKER_FLAGS_RELEASE}\" \
|
|
|
|
extra_arflags=\"${VCPKG_COMBINED_STATIC_LINKER_FLAGS_RELEASE}\"")
|
2020-05-12 05:58:12 +08:00
|
|
|
|
|
|
|
set(DISABLE_WHOLE_PROGRAM_OPTIMIZATION "\
|
|
|
|
extra_cflags=\"/GL-\" \
|
|
|
|
extra_ldflags=\"/LTCG:OFF\" \
|
|
|
|
extra_arflags=\"/LTCG:OFF\"")
|
|
|
|
|
|
|
|
set(OPTIONS_DBG "${OPTIONS_DBG} ${DISABLE_WHOLE_PROGRAM_OPTIMIZATION}")
|
|
|
|
set(OPTIONS_REL "${OPTIONS_REL} ${DISABLE_WHOLE_PROGRAM_OPTIMIZATION}")
|
|
|
|
endif()
|
|
|
|
|
2023-01-27 10:53:54 +08:00
|
|
|
vcpkg_gn_configure(
|
2020-05-12 05:58:12 +08:00
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2023-01-27 10:53:54 +08:00
|
|
|
OPTIONS " target_cpu=\"${VCPKG_TARGET_ARCHITECTURE}\" "
|
2020-05-12 05:58:12 +08:00
|
|
|
OPTIONS_DEBUG "${OPTIONS_DBG}"
|
|
|
|
OPTIONS_RELEASE "${OPTIONS_REL}"
|
|
|
|
)
|
|
|
|
|
2023-01-27 10:53:54 +08:00
|
|
|
vcpkg_gn_install(
|
2020-05-12 05:58:12 +08:00
|
|
|
SOURCE_PATH "${SOURCE_PATH}"
|
2022-12-01 01:39:12 +08:00
|
|
|
TARGETS client client:common util third_party/mini_chromium/mini_chromium/base handler:crashpad_handler
|
2020-05-12 05:58:12 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
message(STATUS "Installing headers...")
|
|
|
|
set(PACKAGES_INCLUDE_DIR "${CURRENT_PACKAGES_DIR}/include/${PORT}")
|
|
|
|
function(install_headers DIR)
|
|
|
|
file(COPY "${DIR}" DESTINATION "${PACKAGES_INCLUDE_DIR}" FILES_MATCHING PATTERN "*.h")
|
|
|
|
endfunction()
|
|
|
|
install_headers("${SOURCE_PATH}/client")
|
|
|
|
install_headers("${SOURCE_PATH}/util")
|
|
|
|
install_headers("${SOURCE_PATH}/third_party/mini_chromium/mini_chromium/base")
|
|
|
|
install_headers("${SOURCE_PATH}/third_party/mini_chromium/mini_chromium/build")
|
|
|
|
|
2022-09-01 04:56:12 +08:00
|
|
|
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/gen/build/chromeos_buildflags.h" DESTINATION "${CURRENT_PACKAGES_DIR}/include/${PORT}/build")
|
|
|
|
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/gen/build/chromeos_buildflags.h.flags" DESTINATION "${CURRENT_PACKAGES_DIR}/include/${PORT}/build")
|
2022-09-07 05:54:31 +08:00
|
|
|
if(VCPKG_TARGET_IS_OSX)
|
|
|
|
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/obj/util/libmig_output.a" DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib")
|
|
|
|
file(COPY "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/obj/util/libmig_output.a" DESTINATION "${CURRENT_PACKAGES_DIR}/lib")
|
|
|
|
endif()
|
2022-09-01 04:56:12 +08:00
|
|
|
|
2023-02-11 03:32:20 +08:00
|
|
|
vcpkg_copy_tools(
|
|
|
|
TOOL_NAMES crashpad_handler
|
|
|
|
SEARCH_DIR "${CURRENT_PACKAGES_DIR}/tools")
|
|
|
|
|
2020-05-12 05:58:12 +08:00
|
|
|
# remove empty directories
|
2022-01-26 02:31:15 +08:00
|
|
|
file(REMOVE_RECURSE
|
|
|
|
"${PACKAGES_INCLUDE_DIR}/util/net/testdata"
|
2020-05-12 05:58:12 +08:00
|
|
|
"${PACKAGES_INCLUDE_DIR}/build/ios")
|
|
|
|
|
|
|
|
configure_file("${CMAKE_CURRENT_LIST_DIR}/crashpadConfig.cmake.in"
|
|
|
|
"${CURRENT_PACKAGES_DIR}/share/${PORT}/crashpadConfig.cmake" @ONLY)
|
|
|
|
|
2022-06-08 04:57:51 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/${PORT}/build/config")
|
2022-04-26 06:39:10 +08:00
|
|
|
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/${PORT}/util/mach/__pycache__")
|
|
|
|
|
2020-05-12 05:58:12 +08:00
|
|
|
vcpkg_copy_pdbs()
|
2023-02-11 03:32:20 +08:00
|
|
|
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|