-
Notifications
You must be signed in to change notification settings - Fork 3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Vendor and link C++ dependencies (#9581)
Summary: Since HHVM OSS currently only builds with libc++, we need to build all C++ dependencies from source against libc++, since their system library equivalents are built against libstdc++ on most distros and therefore ABI incompatible. Add listfiles to conditionally build gflags and glog from source accordingly if the corresponding CLANG_FORCE_LIBCPP build option is set, and update existing listfiles to correctly forward compiler options so that vendored projects are also built against libc++ if the superproject is doing so. As we're here, update the fmtlib version used by the project, as v8 is too old to build with. Pull Request resolved: #9581 Reviewed By: Wilfred Differential Revision: D68245981 fbshipit-source-id: 4cd4cc0f5ec286171b2bd239fadb48af96a7a161
- Loading branch information
1 parent
13de035
commit 91448a6
Showing
10 changed files
with
156 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
if (NOT CLANG_FORCE_LIBCPP) | ||
find_package(gflags CONFIG) | ||
|
||
if (TARGET gflags::gflags) | ||
message(STATUS "Using system gflags") | ||
|
||
add_library(gflags INTERFACE) | ||
add_dependencies(gflags gflags::gflags) | ||
target_link_libraries(gflags INTERFACE gflags::gflags) | ||
|
||
get_target_property(GFLAGS_INCLUDE_DIR gflags::gflags INTERFACE_INCLUDE_DIRECTORIES) | ||
|
||
target_include_directories(gflags INTERFACE ${GFLAGS_INCLUDE_DIR}) | ||
|
||
return() | ||
endif() | ||
endif() | ||
|
||
message(STATUS "Using third-party bundled gflags") | ||
include(ExternalProject) | ||
include(HPHPFunctions) | ||
|
||
SET_HHVM_THIRD_PARTY_SOURCE_ARGS( | ||
GFLAGS_SOURCE_ARGS | ||
SOURCE_URL | ||
"https://github.com/gflags/gflags/archive/refs/tags/v2.2.2.tar.gz" | ||
SOURCE_HASH | ||
"SHA256=34af2f15cf7367513b352bdcd2493ab14ce43692d2dcd9dfc499492966c64dcf" | ||
) | ||
|
||
set(INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/gflags-prefix") | ||
ExternalProject_add( | ||
bundled_gflags | ||
${GFLAGS_SOURCE_ARGS} | ||
CMAKE_ARGS | ||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} | ||
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> | ||
-DCMAKE_INSTALL_INCLUDEDIR=include | ||
-DCMAKE_INSTALL_LIBDIR=lib | ||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} | ||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} | ||
-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} | ||
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} | ||
) | ||
|
||
ExternalProject_get_property(bundled_gflags INSTALL_DIR) | ||
|
||
add_library(gflags INTERFACE) | ||
add_dependencies(gflags bundled_gflags) | ||
target_include_directories(gflags INTERFACE "${INSTALL_DIR}/include") | ||
target_link_libraries(gflags INTERFACE | ||
"${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}gflags$<$<CONFIG:Debug>:_debug>${CMAKE_STATIC_LIBRARY_SUFFIX}" | ||
) | ||
|
||
set(gflags_DIR "${INSTALL_DIR}/lib/cmake/gflags" PARENT_SCOPE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
if(CLANG_FORCE_LIBCPP) | ||
include(ExternalProject) | ||
include(HPHPFunctions) | ||
|
||
SET_HHVM_THIRD_PARTY_SOURCE_ARGS( | ||
GLOG_SOURCE_ARGS | ||
SOURCE_URL | ||
"https://github.com/google/glog/archive/refs/tags/v0.5.0.zip" | ||
SOURCE_HASH | ||
"SHA512=46669f603279edc05e98153247897c8a7b50ebc9e800132cc8c3eef531687691e616b5210ed9a1dfbb5170ea354b76fb9244b383a8d309bacbfcf2810ec07546" | ||
) | ||
|
||
set(INSTALL_DIR "${CMAKE_CURRENT_BINARY_DIR}/glog-prefix") | ||
ExternalProject_add( | ||
bundled_glog | ||
${GLOG_SOURCE_ARGS} | ||
CMAKE_ARGS | ||
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} | ||
-DCMAKE_INSTALL_PREFIX=<INSTALL_DIR> | ||
-DCMAKE_INSTALL_INCLUDEDIR=include | ||
-DCMAKE_INSTALL_LIBDIR=lib | ||
-DCMAKE_C_COMPILER=${CMAKE_C_COMPILER} | ||
-DCMAKE_CXX_COMPILER=${CMAKE_CXX_COMPILER} | ||
-DCMAKE_OSX_SYSROOT=${CMAKE_OSX_SYSROOT} | ||
-DCMAKE_CXX_FLAGS=${CMAKE_CXX_FLAGS} | ||
|
||
-DBUILD_SHARED_LIBS=Off | ||
-DBUILD_EXAMPLES=Off | ||
-DBUILD_TESTING=Off | ||
|
||
-Dgflags_DIR=${gflags_DIR} | ||
) | ||
ExternalProject_get_property(bundled_glog INSTALL_DIR) | ||
|
||
add_dependencies(bundled_glog gflags) | ||
|
||
add_library(glog INTERFACE) | ||
add_dependencies(glog bundled_glog) | ||
target_include_directories(glog INTERFACE "${INSTALL_DIR}/include") | ||
target_link_libraries(glog INTERFACE | ||
"${INSTALL_DIR}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}glog$<$<CONFIG:Debug>:d>${CMAKE_STATIC_LIBRARY_SUFFIX}" | ||
gflags | ||
) | ||
|
||
set(GLOG_INSTALL_DIR "${INSTALL_DIR}" PARENT_SCOPE) | ||
else() | ||
# google-glog | ||
find_package(Glog REQUIRED) | ||
if (GLOG_STATIC) | ||
add_definitions("-DGOOGLE_GLOG_DLL_DECL=") | ||
endif() | ||
include_directories(${GLOG_INCLUDE_DIR}) | ||
|
||
add_library(glog INTERFACE) | ||
add_dependencies(glog glog::glog) | ||
target_link_libraries(glog INTERFACE ${GLOG_LIBRARIES}) | ||
target_include_directories(glog INTERFACE ${GLOG_INCLUDE_DIRS}) | ||
endif() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters