qpid-proton git commit: PROTON-1683: [c,cpp] create static libraries
Repository: qpid-proton Updated Branches: refs/heads/master 8cc69bdc8 -> a04a964de PROTON-1683: [c,cpp] create static libraries `cmake -DBUILD_STATIC_LIBS=YES` builds static as well as shared C and C++ libraries. Requires static C or C++ runtime libraries to be available, they are optional on some platforms. E.g. on fedora 28: `sudo dnf install libstdc++-static` Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/a04a964d Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/a04a964d Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/a04a964d Branch: refs/heads/master Commit: a04a964de3925027ed63454fb8475e7a9a5b1ff5 Parents: 8cc69bd Author: Alan Conway Authored: Tue May 29 11:51:09 2018 -0400 Committer: Alan Conway Committed: Tue May 29 13:45:31 2018 -0400 -- CMakeLists.txt| 9 ++--- c/CMakeLists.txt | 24 ++-- cpp/CMakeLists.txt| 3 +++ cpp/include/proton/container.hpp | 11 --- cpp/include/proton/work_queue.hpp | 19 +-- 5 files changed, 32 insertions(+), 34 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a04a964d/CMakeLists.txt -- diff --git a/CMakeLists.txt b/CMakeLists.txt index a0fca0d..a6d463f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,9 @@ if (CMAKE_CXX_COMPILER) option(BUILD_WITH_CXX "Compile Proton using C++" ${DEFAULT_BUILD_WITH_CXX}) endif() +# Bulid static C and C++ libraries in addition to shared libraries. +option(BUILD_STATIC_LIBS "Build static libraries as well as shared libraries" OFF) + if (CMAKE_CONFIGURATION_TYPES) # There is no single "build type"... message(STATUS "Build types are ${CMAKE_CONFIGURATION_TYPES}") @@ -331,13 +334,13 @@ endif() # To kick-start a build with just a few bindings enabled by default, e.g. ruby and go: # -# cmake -DBUILD_BINDINGS=ruby;go +# cmake -DBUILD_BINDINGS="ruby;go" # # This is only used when CMakeCache.txt is first created, after that set the normal # BUILD_XXX variables to enable/disable bindings. # if (NOT DEFINED BUILD_BINDINGS) - set(BUILD_BINDINGS "${BINDINGS}") +set(BUILD_BINDINGS "${BINDINGS}") endif() foreach(BINDING ${BINDINGS}) @@ -348,7 +351,7 @@ foreach(BINDING ${BINDINGS}) endif() option(BUILD_${UBINDING} "Build ${BINDING} language binding" ${DEFAULT_${UBINDING}}) if (BUILD_${UBINDING}) -add_subdirectory(${BINDING}) + add_subdirectory(${BINDING}) endif () endforeach(BINDING) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a04a964d/c/CMakeLists.txt -- diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index 40b5037..5fd98ee 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -538,17 +538,18 @@ if (BUILD_WITH_CXX) ) endif (BUILD_WITH_CXX) -add_library ( - qpid-proton-core SHARED +set(qpid-proton-core-src ${qpid-proton-core} ${qpid-proton-layers} ${qpid-proton-platform} ${qpid-proton-include} ${qpid-proton-include-generated} ) -add_dependencies(qpid-proton-core generated_c_files) - +add_library (qpid-proton-core SHARED ${qpid-proton-core-src}) target_link_libraries (qpid-proton-core ${UUID_LIB} ${SSL_LIB} ${SASL_LIB} ${TIME_LIB} ${PLATFORM_LIBS}) +if (BUILD_STATIC_LIBS) + add_library (qpid-proton-core-static STATIC ${qpid-proton-core-src}) +endif(BUILD_STATIC_LIBS) set_target_properties ( qpid-proton-core @@ -558,8 +559,7 @@ set_target_properties ( LINK_FLAGS "${CATCH_UNDEFINED} ${LTO}" ) -add_library( - qpid-proton SHARED +set(qpid-proton-src # Proton Core ${qpid-proton-core} ${qpid-proton-layers} @@ -573,7 +573,10 @@ add_library( ${qpid-proton-platform-io} ${qpid-proton-include-extra} ) -add_dependencies(qpid-proton generated_c_files) +add_library(qpid-proton SHARED ${qpid-proton-src}) +if (BUILD_STATIC_LIBS) + add_library(qpid-proton-static STATIC ${qpid-proton-src}) +endif(BUILD_STATIC_LIBS) if (MSVC) # Add a phony dependency for Windows builds to serialize creation @@ -599,10 +602,8 @@ if (MSVC) endif(MSVC) if (qpid-proton-proactor) - # Bizarre CMake variable setting set(HAS_PROACTOR True) - add_library ( -qpid-proton-proactor SHARED ${qpid-proton-proactor}) + add_library (qpid-proton-proactor SHARED ${qpid-proton-proactor}) target_link_libraries (qpid-proton-proactor LINK_PUBLIC qpid-proton-core) target_link_libraries (qpid-proton-proactor LINK_PRIVATE ${PLATFORM_LIBS} ${PROACTOR_LIBS}) list(APPEND LIB_TARGETS qpid-proton-proactor) @@ -613,6 +614,9 @@ if (qpid-proton-proactor) SOVERSION "${PN_LIB_PROACTOR_MAJOR_VERSION}" LINK_FLAGS "
[10/41] qpid-proton git commit: PROTON-1683: [c, cpp] create static libraries
PROTON-1683: [c,cpp] create static libraries `cmake -DBUILD_STATIC_LIBS=YES` builds static as well as shared C and C++ libraries. Requires static C or C++ runtime libraries to be available, they are optional on some platforms. E.g. on fedora 28: `sudo dnf install libstdc++-static` Project: http://git-wip-us.apache.org/repos/asf/qpid-proton/repo Commit: http://git-wip-us.apache.org/repos/asf/qpid-proton/commit/a04a964d Tree: http://git-wip-us.apache.org/repos/asf/qpid-proton/tree/a04a964d Diff: http://git-wip-us.apache.org/repos/asf/qpid-proton/diff/a04a964d Branch: refs/heads/go1 Commit: a04a964de3925027ed63454fb8475e7a9a5b1ff5 Parents: 8cc69bd Author: Alan Conway Authored: Tue May 29 11:51:09 2018 -0400 Committer: Alan Conway Committed: Tue May 29 13:45:31 2018 -0400 -- CMakeLists.txt| 9 ++--- c/CMakeLists.txt | 24 ++-- cpp/CMakeLists.txt| 3 +++ cpp/include/proton/container.hpp | 11 --- cpp/include/proton/work_queue.hpp | 19 +-- 5 files changed, 32 insertions(+), 34 deletions(-) -- http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a04a964d/CMakeLists.txt -- diff --git a/CMakeLists.txt b/CMakeLists.txt index a0fca0d..a6d463f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -77,6 +77,9 @@ if (CMAKE_CXX_COMPILER) option(BUILD_WITH_CXX "Compile Proton using C++" ${DEFAULT_BUILD_WITH_CXX}) endif() +# Bulid static C and C++ libraries in addition to shared libraries. +option(BUILD_STATIC_LIBS "Build static libraries as well as shared libraries" OFF) + if (CMAKE_CONFIGURATION_TYPES) # There is no single "build type"... message(STATUS "Build types are ${CMAKE_CONFIGURATION_TYPES}") @@ -331,13 +334,13 @@ endif() # To kick-start a build with just a few bindings enabled by default, e.g. ruby and go: # -# cmake -DBUILD_BINDINGS=ruby;go +# cmake -DBUILD_BINDINGS="ruby;go" # # This is only used when CMakeCache.txt is first created, after that set the normal # BUILD_XXX variables to enable/disable bindings. # if (NOT DEFINED BUILD_BINDINGS) - set(BUILD_BINDINGS "${BINDINGS}") +set(BUILD_BINDINGS "${BINDINGS}") endif() foreach(BINDING ${BINDINGS}) @@ -348,7 +351,7 @@ foreach(BINDING ${BINDINGS}) endif() option(BUILD_${UBINDING} "Build ${BINDING} language binding" ${DEFAULT_${UBINDING}}) if (BUILD_${UBINDING}) -add_subdirectory(${BINDING}) + add_subdirectory(${BINDING}) endif () endforeach(BINDING) http://git-wip-us.apache.org/repos/asf/qpid-proton/blob/a04a964d/c/CMakeLists.txt -- diff --git a/c/CMakeLists.txt b/c/CMakeLists.txt index 40b5037..5fd98ee 100644 --- a/c/CMakeLists.txt +++ b/c/CMakeLists.txt @@ -538,17 +538,18 @@ if (BUILD_WITH_CXX) ) endif (BUILD_WITH_CXX) -add_library ( - qpid-proton-core SHARED +set(qpid-proton-core-src ${qpid-proton-core} ${qpid-proton-layers} ${qpid-proton-platform} ${qpid-proton-include} ${qpid-proton-include-generated} ) -add_dependencies(qpid-proton-core generated_c_files) - +add_library (qpid-proton-core SHARED ${qpid-proton-core-src}) target_link_libraries (qpid-proton-core ${UUID_LIB} ${SSL_LIB} ${SASL_LIB} ${TIME_LIB} ${PLATFORM_LIBS}) +if (BUILD_STATIC_LIBS) + add_library (qpid-proton-core-static STATIC ${qpid-proton-core-src}) +endif(BUILD_STATIC_LIBS) set_target_properties ( qpid-proton-core @@ -558,8 +559,7 @@ set_target_properties ( LINK_FLAGS "${CATCH_UNDEFINED} ${LTO}" ) -add_library( - qpid-proton SHARED +set(qpid-proton-src # Proton Core ${qpid-proton-core} ${qpid-proton-layers} @@ -573,7 +573,10 @@ add_library( ${qpid-proton-platform-io} ${qpid-proton-include-extra} ) -add_dependencies(qpid-proton generated_c_files) +add_library(qpid-proton SHARED ${qpid-proton-src}) +if (BUILD_STATIC_LIBS) + add_library(qpid-proton-static STATIC ${qpid-proton-src}) +endif(BUILD_STATIC_LIBS) if (MSVC) # Add a phony dependency for Windows builds to serialize creation @@ -599,10 +602,8 @@ if (MSVC) endif(MSVC) if (qpid-proton-proactor) - # Bizarre CMake variable setting set(HAS_PROACTOR True) - add_library ( -qpid-proton-proactor SHARED ${qpid-proton-proactor}) + add_library (qpid-proton-proactor SHARED ${qpid-proton-proactor}) target_link_libraries (qpid-proton-proactor LINK_PUBLIC qpid-proton-core) target_link_libraries (qpid-proton-proactor LINK_PRIVATE ${PLATFORM_LIBS} ${PROACTOR_LIBS}) list(APPEND LIB_TARGETS qpid-proton-proactor) @@ -613,6 +614,9 @@ if (qpid-proton-proactor) SOVERSION "${PN_LIB_PROACTOR_MAJOR_VERSION}" LINK_FLAGS "${CATCH_UNDEFINED} ${LTO}" ) + if (BUILD_STATIC_LIBS) +add_library (qpid-proton-