Skip to content

Commit

Permalink
[activemq-cpp] support linux (#19789)
Browse files Browse the repository at this point in the history
@PhoebeHui

> * I think we need a discussion about unofficial being in the namespace

I still want to discuss this
  • Loading branch information
mheyman authored Oct 11, 2021
1 parent 6ff166c commit 4ce045c
Show file tree
Hide file tree
Showing 7 changed files with 470 additions and 76 deletions.
319 changes: 319 additions & 0 deletions ports/activemq-cpp/activemq-cppConfig.cmake

Large diffs are not rendered by default.

36 changes: 36 additions & 0 deletions ports/activemq-cpp/fix-crt-linkage-dyn.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
diff --git a/vs2010-build/activemq-cpp.vcxproj b/vs2010-build/activemq-cpp.vcxproj
index 54b4822..6b35511 100644
--- a/vs2010-build/activemq-cpp.vcxproj
+++ b/vs2010-build/activemq-cpp.vcxproj
@@ -2578,6 +2578,7 @@
<BasicRuntimeChecks>Default</BasicRuntimeChecks>
<FunctionLevelLinking>true</FunctionLevelLinking>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
@@ -2687,6 +2688,7 @@
<FunctionLevelLinking>true</FunctionLevelLinking>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>
@@ -2794,6 +2796,7 @@
<AdditionalIncludeDirectories>../src/main;$(APR_DIST)\$(PlatformName)\include;$(OPENSSL_DIST)\$(PlatformName)\include;$(PLATFORM_SDK)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>
@@ -2906,6 +2909,7 @@
<AdditionalIncludeDirectories>../src/main;$(APR_DIST)\$(PlatformName)\include;$(OPENSSL_DIST)\$(PlatformName)\include;$(PLATFORM_SDK)\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
<CreateHotpatchableImage>false</CreateHotpatchableImage>
<RuntimeTypeInfo>true</RuntimeTypeInfo>
+ <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
<PrecompiledHeaderFile>
</PrecompiledHeaderFile>
<PrecompiledHeaderOutputFile>
177 changes: 106 additions & 71 deletions ports/activemq-cpp/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vcpkg_fail_port_install( ON_TARGET "uwp" "linux" "osx")
vcpkg_fail_port_install( ON_TARGET "uwp" "osx")

set(VERSION 3.9.5)

Expand All @@ -8,92 +8,127 @@ vcpkg_download_distfile(ARCHIVE
SHA512 83692d3dfd5ecf557fc88d204a03bf169ce6180bcff27be41b09409b8f7793368ffbeed42d98ef6374c6b6b477d9beb8a4a9ac584df9e56725ec59ceceaa6ae2
)

vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
PATCHES
FunctionLevelLinkingOn.diff
fix-crt-linkage.patch
)
if (VCPKG_CMAKE_SYSTEM_NAME STREQUAL "Linux")
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
)

set(ACTIVEMQCPP_MSVC_PROJ ${SOURCE_PATH}/vs2010-build/activemq-cpp.vcxproj)
vcpkg_configure_make(
SOURCE_PATH "${SOURCE_PATH}"
AUTOCONFIG
OPTIONS
"--with-openssl=${CURRENT_INSTALLED_DIR}"
"--with-apr=${CURRENT_INSTALLED_DIR}/tools/apr"
)

string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" ACTIVEMQCPP_SHARED_LIB)
vcpkg_install_make()
file(RENAME "${CURRENT_PACKAGES_DIR}/include/activemq-cpp-${VERSION}/activemq" "${CURRENT_PACKAGES_DIR}/include/activemq")
file(RENAME "${CURRENT_PACKAGES_DIR}/include/activemq-cpp-${VERSION}/cms" "${CURRENT_PACKAGES_DIR}/include/cms")
file(RENAME "${CURRENT_PACKAGES_DIR}/include/activemq-cpp-${VERSION}/decaf" "${CURRENT_PACKAGES_DIR}/include/decaf")
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/include/activemq-cpp-${VERSION}")

if (ACTIVEMQCPP_SHARED_LIB)
set(RELEASE_CONF "ReleaseDLL")
set(DEBUG_CONF "DebugDLL")

set(ACTIVEMQCPP_LIB_PREFFIX )
set(ACTIVEMQCPP_LIB_SUFFIX d)
vcpkg_replace_string(${ACTIVEMQCPP_MSVC_PROJ} ";apr-1.lib" ";libapr-1.lib")
vcpkg_copy_pdbs()
else()
set(RELEASE_CONF "Release")
set(DEBUG_CONF "Debug")

set(ACTIVEMQCPP_LIB_PREFFIX lib)
set(ACTIVEMQCPP_LIB_SUFFIX )
vcpkg_replace_string(${ACTIVEMQCPP_MSVC_PROJ} ";libapr-1.lib" ";apr-1.lib")
endif()
set(PATCHES FunctionLevelLinkingOn.diff)
if(VCPKG_CRT_LINKAGE STREQUAL "static")
list(APPEND PATCHES fix-crt-linkage.patch)
else()
list(APPEND PATCHES fix-crt-linkage-dyn.patch)
endif()

if (VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
set(BUILD_ARCH "Win32")
set(OUTPUT_DIR "Win32")
elseif (VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
set(BUILD_ARCH "x64")
set(OUTPUT_DIR "Win64")
else()
message(FATAL_ERROR "Unsupported architecture: ${VCPKG_TARGET_ARCHITECTURE}")
endif()
vcpkg_extract_source_archive_ex(
OUT_SOURCE_PATH SOURCE_PATH
ARCHIVE ${ARCHIVE}
PATCHES ${PATCHES}
)

vcpkg_build_msbuild(
PROJECT_PATH ${ACTIVEMQCPP_MSVC_PROJ}
RELEASE_CONFIGURATION ${RELEASE_CONF}
DEBUG_CONFIGURATION ${DEBUG_CONF}
PLATFORM ${BUILD_ARCH}
USE_VCPKG_INTEGRATION
)
set(ACTIVEMQCPP_MSVC_PROJ "${SOURCE_PATH}/vs2010-build/activemq-cpp.vcxproj")

vcpkg_copy_pdbs()
string(COMPARE EQUAL "${VCPKG_LIBRARY_LINKAGE}" "dynamic" ACTIVEMQCPP_SHARED_LIB)

if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(COPY
${SOURCE_PATH}/vs2010-build/${BUILD_ARCH}/${RELEASE_CONF}/${ACTIVEMQCPP_LIB_PREFFIX}activemq-cpp.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/lib
)

if (ACTIVEMQCPP_SHARED_LIB)
file(COPY
${SOURCE_PATH}/vs2010-build/${BUILD_ARCH}/${RELEASE_CONF}/activemq-cpp.dll
DESTINATION ${CURRENT_PACKAGES_DIR}/bin
)
file(COPY
${SOURCE_PATH}/vs2010-build/${BUILD_ARCH}/${RELEASE_CONF}/activemq-cpp.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/bin
)
set(RELEASE_CONF "ReleaseDLL")
set(DEBUG_CONF "DebugDLL")

set(ACTIVEMQCPP_LIB_PREFFIX )
set(ACTIVEMQCPP_LIB_SUFFIX d)
vcpkg_replace_string("${ACTIVEMQCPP_MSVC_PROJ}" ";apr-1.lib" ";libapr-1.lib")
else()
set(RELEASE_CONF "Release")
set(DEBUG_CONF "Debug")

set(ACTIVEMQCPP_LIB_PREFFIX lib)
set(ACTIVEMQCPP_LIB_SUFFIX )
vcpkg_replace_string("${ACTIVEMQCPP_MSVC_PROJ}" ";libapr-1.lib" ";apr-1.lib")
endif()
endif()

if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(COPY
${SOURCE_PATH}/vs2010-build/${BUILD_ARCH}/${DEBUG_CONF}/${ACTIVEMQCPP_LIB_PREFFIX}activemq-cpp${ACTIVEMQCPP_LIB_SUFFIX}.lib
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/lib
if (VCPKG_TARGET_ARCHITECTURE MATCHES "x86")
set(BUILD_ARCH "Win32")
elseif (VCPKG_TARGET_ARCHITECTURE MATCHES "x64")
set(BUILD_ARCH "x64")
else()
message(FATAL_ERROR "Unsupported architecture: ${VCPKG_TARGET_ARCHITECTURE}")
endif()

string(REPLACE "/" "\\" WIN_SOURCE_PATH "${SOURCE_PATH}")
vcpkg_replace_string("${ACTIVEMQCPP_MSVC_PROJ}" "ClCompile Include=\"..\\src" "ClCompile Include=\"${WIN_SOURCE_PATH}\\src")
vcpkg_replace_string("${ACTIVEMQCPP_MSVC_PROJ}" "ClInclude Include=\"..\\src" "ClInclude Include=\"${WIN_SOURCE_PATH}\\src")
vcpkg_replace_string("${ACTIVEMQCPP_MSVC_PROJ}" "../src/main" "${WIN_SOURCE_PATH}\\src\\main")
vcpkg_install_msbuild(
SOURCE_PATH "${SOURCE_PATH}/vs2010-build"
PROJECT_SUBPATH "activemq-cpp.vcxproj"
RELEASE_CONFIGURATION ${RELEASE_CONF}
DEBUG_CONFIGURATION ${DEBUG_CONF}
PLATFORM ${BUILD_ARCH}
USE_VCPKG_INTEGRATION
ALLOW_ROOT_INCLUDES
SKIP_CLEAN
)

if (ACTIVEMQCPP_SHARED_LIB)

vcpkg_copy_pdbs()

if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "release")
file(COPY
${SOURCE_PATH}/vs2010-build/${BUILD_ARCH}/${DEBUG_CONF}/activemq-cpp${ACTIVEMQCPP_LIB_SUFFIX}.dll
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vs2010-build/${BUILD_ARCH}/${RELEASE_CONF}/${ACTIVEMQCPP_LIB_PREFFIX}activemq-cpp.lib"
DESTINATION "${CURRENT_PACKAGES_DIR}/lib"
)

if (ACTIVEMQCPP_SHARED_LIB)
file(COPY
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vs2010-build/${BUILD_ARCH}/${RELEASE_CONF}/activemq-cpp.dll"
DESTINATION "${CURRENT_PACKAGES_DIR}/bin"
)
file(COPY
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vs2010-build/${BUILD_ARCH}/${RELEASE_CONF}/activemq-cpp.pdb"
DESTINATION "${CURRENT_PACKAGES_DIR}/bin"
)
endif()
endif()

if (NOT VCPKG_BUILD_TYPE OR VCPKG_BUILD_TYPE STREQUAL "debug")
file(COPY
${SOURCE_PATH}/vs2010-build/${BUILD_ARCH}/${DEBUG_CONF}/activemq-cpp${ACTIVEMQCPP_LIB_SUFFIX}.pdb
DESTINATION ${CURRENT_PACKAGES_DIR}/debug/bin
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/vs2010-build/${BUILD_ARCH}/${DEBUG_CONF}/${ACTIVEMQCPP_LIB_PREFFIX}activemq-cpp${ACTIVEMQCPP_LIB_SUFFIX}.lib"
DESTINATION "${CURRENT_PACKAGES_DIR}/debug/lib"
)

if (ACTIVEMQCPP_SHARED_LIB)
file(COPY
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/vs2010-build/${BUILD_ARCH}/${DEBUG_CONF}/activemq-cpp${ACTIVEMQCPP_LIB_SUFFIX}.dll"
DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin"
)
file(COPY
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-dbg/vs2010-build/${BUILD_ARCH}/${DEBUG_CONF}/activemq-cpp${ACTIVEMQCPP_LIB_SUFFIX}.pdb"
DESTINATION "${CURRENT_PACKAGES_DIR}/debug/bin"
)
endif()
endif()
endif()

file(COPY ${SOURCE_PATH}/src/main/activemq DESTINATION ${CURRENT_PACKAGES_DIR}/include FILES_MATCHING PATTERN *.h)
file(COPY ${SOURCE_PATH}/src/main/cms DESTINATION ${CURRENT_PACKAGES_DIR}/include FILES_MATCHING PATTERN *.h)
file(COPY ${SOURCE_PATH}/src/main/decaf DESTINATION ${CURRENT_PACKAGES_DIR}/include FILES_MATCHING PATTERN *.h)
file(COPY "${SOURCE_PATH}/src/main/activemq" DESTINATION "${CURRENT_PACKAGES_DIR}/include" FILES_MATCHING PATTERN *.h)
file(COPY "${SOURCE_PATH}/src/main/cms" DESTINATION "${CURRENT_PACKAGES_DIR}/include" FILES_MATCHING PATTERN *.h)
file(COPY "${SOURCE_PATH}/src/main/decaf" DESTINATION "${CURRENT_PACKAGES_DIR}/include" FILES_MATCHING PATTERN *.h)
vcpkg_clean_msbuild()
endif()

file(INSTALL ${SOURCE_PATH}/LICENSE.txt DESTINATION ${CURRENT_PACKAGES_DIR}/share/${PORT} RENAME copyright)
file(INSTALL "${CURRENT_PORT_DIR}/activemq-cppConfig.cmake" DESTINATION "${CURRENT_PACKAGES_DIR}/share/activemq-cpp")
file(INSTALL "${SOURCE_PATH}/LICENSE.txt" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}" RENAME copyright)
6 changes: 3 additions & 3 deletions ports/activemq-cpp/vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
{
"name": "activemq-cpp",
"version-string": "3.9.5",
"port-version": 4,
"version-semver": "3.9.5",
"port-version": 5,
"description": "Apache ActiveMQ is the most popular and powerful open source messaging and Integration Patterns server.",
"supports": "!(uwp | linux | osx)",
"supports": "!(uwp | osx)",
"dependencies": [
"apr"
]
Expand Down
1 change: 0 additions & 1 deletion scripts/ci.baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1697,7 +1697,6 @@ lapack-reference:arm-uwp=skip

# failures for x64-windows-static-md
ace:x64-windows-static-md=fail
activemq-cpp:x64-windows-static-md=fail
akali:x64-windows-static-md=fail
chromium-base:x64-windows-static-md=fail
clockutils:x64-windows-static-md=fail
Expand Down
5 changes: 5 additions & 0 deletions versions/a-/activemq-cpp.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
{
"versions": [
{
"git-tree": "bce9f87e7df6f4e8a9c3121018ffc032e3d2603e",
"version-semver": "3.9.5",
"port-version": 5
},
{
"git-tree": "13f5f938c4d12bf4a62061f9891f77e7fc03fc23",
"version-string": "3.9.5",
Expand Down
2 changes: 1 addition & 1 deletion versions/baseline.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
},
"activemq-cpp": {
"baseline": "3.9.5",
"port-version": 4
"port-version": 5
},
"ade": {
"baseline": "0.1.1f",
Expand Down

3 comments on commit 4ce045c

@mheyman
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TL;DR: I can see valid arguments for changing or leaving unofficial::.

I just did a non-exhaustive (10 minute) search for things that using unofficial:: may conflict with and found nothing. So, I don't think unofficial:: would cause current issues or would likely cause future issues. The closest I found were two different libraries where it seems somebody ported/extended and turned the name from foo to unofficial-foo. In those cases I didn't see any evidence of CMake so no use of unofficial::.

Having said that, I'm leery of using generic-ish namespace names. I have been painfully bit in the past with things like two different C++ libraries using "matrix" as their namespace. So, I'm actually for picking a non generic-ish namespace for vcpkg ports that come with their own CMake targets.

I know changing target names can break builds. I have a much higher level of acceptance of build breaks than most of my coworkers ;-) so I recognize I'm not the best one to make a call on changes such as this. Of course a period of deprecation of the unofficial:: CMake target could occur to soften the blow (and may be necessary to allow changes to work their way through various vcpkg ports that depend on the changed port).

@dg0yt
Copy link
Contributor

@dg0yt dg0yt commented on 4ce045c Oct 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would prefer another name, too. But maybe this should be made a separate, new discussion?

@PhoebeHui
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See #20660

Please sign in to comment.