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

CXXCBC-639: Allow to build both static and shared libraries #707

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
26 changes: 15 additions & 11 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,14 @@ include(cmake/PreventInSourceBuilds.cmake)
include(cmake/StandardProjectSettings.cmake)

# 'library' to set the c++ standard / compile-time options requested
add_library(project_options INTERFACE)
add_library(project_options INTERFACE IMPORTED)
target_compile_features(project_options INTERFACE cxx_std_17)
if(MSVC)
target_compile_options(project_options INTERFACE /bigobj)
endif()

# 'library' to use the warnings specified in CompilerWarnings.cmake
add_library(project_warnings INTERFACE)
add_library(project_warnings INTERFACE IMPORTED)

include(cmake/BuildTracing.cmake)

Expand Down Expand Up @@ -72,8 +72,6 @@ find_package(Threads REQUIRED)

include(cmake/ThirdPartyDependencies.cmake)

include(cmake/OpenSSL.cmake)

include(cmake/VersionInfo.cmake)

include(cmake/RPath.cmake)
Expand Down Expand Up @@ -505,8 +503,11 @@ foreach(TARGET ${couchbase_cxx_client_LIBRARIES})
$<BUILD_INTERFACE:${PROJECT_BINARY_DIR}/generated_$<CONFIG>>)

target_include_directories(
${TARGET} SYSTEM PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third_party/cxx_function>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third_party/expected/include>)
${TARGET} SYSTEM
PRIVATE $<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third_party/cxx_function>
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/third_party/expected/include>
$<BUILD_INTERFACE:$<TARGET_PROPERTY:jsonsl,INTERFACE_INCLUDE_DIRECTORIES>>
$<BUILD_INTERFACE:$<TARGET_PROPERTY:asio,INTERFACE_INCLUDE_DIRECTORIES>>)

target_include_directories(${TARGET} PUBLIC $<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>)

Expand All @@ -517,13 +518,13 @@ foreach(TARGET ${couchbase_cxx_client_LIBRARIES})
project_warnings
spdlog::spdlog
Microsoft.GSL::GSL
asio
llhttp::llhttp
taocpp::json
snappy
jsonsl
couchbase_backtrace
hdr_histogram_static)
hdr_histogram_static
$<TARGET_OBJECTS:asio>
$<TARGET_OBJECTS:couchbase_backtrace>
$<TARGET_OBJECTS:jsonsl>)

if(WIN32)
target_link_libraries(${TARGET} PRIVATE iphlpapi)
Expand All @@ -542,7 +543,10 @@ foreach(TARGET ${couchbase_cxx_client_LIBRARIES})
if(MINGW)
target_link_libraries(${TARGET} PUBLIC ws2_32)
endif()
target_link_libraries(${TARGET} PRIVATE OpenSSL::SSL OpenSSL::Crypto)
target_link_libraries(${TARGET} PUBLIC $<TARGET_OBJECTS:ssl> $<TARGET_OBJECTS:crypto>)
target_include_directories(
${TARGET} SYSTEM PRIVATE $<BUILD_INTERFACE:$<TARGET_PROPERTY:ssl,INTERFACE_INCLUDE_DIRECTORIES>>
$<BUILD_INTERFACE:$<TARGET_PROPERTY:crypto,INTERFACE_INCLUDE_DIRECTORIES>>)
else()
if(TARGET PkgConfig::PKG_CONFIG_OPENSSL)
target_link_libraries(${TARGET} PUBLIC PkgConfig::PKG_CONFIG_OPENSSL)
Expand Down
55 changes: 0 additions & 55 deletions bin/build_boringssl

This file was deleted.

122 changes: 0 additions & 122 deletions bin/build_boringssl_win.bat

This file was deleted.

6 changes: 2 additions & 4 deletions cmake/APKBUILD.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ license="Apache-2.0"
depends=""
makedepends="
linux-headers
cmake
ninja
"
cmake ninja "
subpackages="${pkgname}-dev ${pkgname}-tools"
options="!check"

Expand All @@ -37,7 +35,7 @@ build() {
-DCOUCHBASE_CXX_CLIENT_BUILD_EXAMPLES=OFF \
-DCOUCHBASE_CXX_CLIENT_BUILD_TESTS=OFF \
-DCOUCHBASE_CXX_CLIENT_BUILD_TOOLS=ON \
-DCOUCHBASE_CXX_CLIENT_BUILD_STATIC=OFF \
-DCOUCHBASE_CXX_CLIENT_BUILD_STATIC=ON \
-DCOUCHBASE_CXX_CLIENT_BUILD_SHARED=ON
cmake --build apk-build
}
Expand Down
3 changes: 2 additions & 1 deletion cmake/OpenSSL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,9 @@ elseif(COUCHBASE_CXX_CLIENT_STATIC_BORINGSSL)
endif()
endif()
declare_system_library(ssl)
declare_system_library(crypto)
add_library(OpenSSL::SSL ALIAS ssl)
add_library(OpenSSL::Crypto ALIAS ssl)
add_library(OpenSSL::Crypto ALIAS crypto)
else()
option(COUCHBASE_CXX_CLIENT_STATIC_OPENSSL "Statically link OpenSSL library" FALSE)
if(COUCHBASE_CXX_CLIENT_STATIC_OPENSSL)
Expand Down
11 changes: 6 additions & 5 deletions cmake/Packaging.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -250,12 +250,13 @@ if(COUCHBASE_CXX_CLIENT_RPM_TARGETS)
list(
APPEND
COUCHBASE_CXX_CLIENT_SUPPORTED_ROOTS
"opensuse-leap-15.5-${CMAKE_SYSTEM_PROCESSOR}"
"rocky-9-${CMAKE_SYSTEM_PROCESSOR}"
"rocky-8-${CMAKE_SYSTEM_PROCESSOR}"
"amazonlinux-2023-${CMAKE_SYSTEM_PROCESSOR}"
# "opensuse-leap-15.5-${CMAKE_SYSTEM_PROCESSOR}"
# "rocky-9-${CMAKE_SYSTEM_PROCESSOR}"
# "rocky-8-${CMAKE_SYSTEM_PROCESSOR}"
# "amazonlinux-2023-${CMAKE_SYSTEM_PROCESSOR}"
"fedora-41-${CMAKE_SYSTEM_PROCESSOR}"
"fedora-40-${CMAKE_SYSTEM_PROCESSOR}")
# "fedora-40-${CMAKE_SYSTEM_PROCESSOR}"
)

message(STATUS "Supported build roots for RPM packages: ${COUCHBASE_CXX_CLIENT_SUPPORTED_ROOTS}")

Expand Down
Loading
Loading