From 823ac28c8d15c9a5e0110f53e93b8bd6468f0839 Mon Sep 17 00:00:00 2001 From: Erik Boasson Date: Thu, 7 Mar 2024 13:58:39 +0100 Subject: [PATCH] Add static build on Linux to CI Signed-off-by: Erik Boasson --- .azure/templates/build-test.yml | 23 +++++++++++++++++++++-- azure-pipelines.yml | 6 ++++++ 2 files changed, 27 insertions(+), 2 deletions(-) diff --git a/.azure/templates/build-test.yml b/.azure/templates/build-test.yml index 8e7b3a56c4..d82eeb8f75 100644 --- a/.azure/templates/build-test.yml +++ b/.azure/templates/build-test.yml @@ -90,12 +90,23 @@ steps: cd iceoryx/build [[ "${AGENT_OS}" == 'Darwin' ]] && BUILD_TOOL_OPTIONS="-j 4" cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ - -DCMAKE_BUILD_SHARED_LIBS=on \ + -DCMAKE_BUILD_SHARED_LIBS=${SHAREDLIBS:-on} \ -DCMAKE_INSTALL_PREFIX=install \ ${GENERATOR:+-G} "${GENERATOR}" -A "${PLATFORM}" -T "${TOOLSET}" ../iceoryx_meta cmake --build . --config ${BUILD_TYPE} --target install -- ${BUILD_TOOL_OPTIONS} condition: eq(variables['iceoryx'], 'on') name: install_iceoryx + - bash: | + set -e -x + mkdir build-sharedlibs + cd build-sharedlibs + cmake -DCMAKE_INSTALL_PREFIX=install \ + -DWERROR=on \ + ${GENERATOR:+-G} "${GENERATOR}" -A "${PLATFORM}" -T "${TOOLSET}" .. + ${SCAN_BUILD} cmake --build . --config ${BUILD_TYPE} --target install -- ${BUILD_TOOL_OPTIONS} + cmake --build . --config ${BUILD_TYPE} --target package -- ${BUILD_TOOL_OPTIONS} + condition: eq(variables['sharedlibs'], 'off') + name: nonstatic_build_script - bash: | set -e -x mkdir build @@ -106,9 +117,16 @@ steps: # Azure sometimes adds a spurious ' to BUILD_TOOL_OPTIONS BUILD_TOOL_OPTIONS="-j 4" fi + crosscompiling= + if [[ "${SHAREDLIBS:-on}" == "off" ]] ; then + prefix_path="${BUILD_SOURCESDIRECTORY}/build-sharedlibs/install:${prefix_path}" + crosscompiling="-DCMAKE_CROSSCOMPILING=1 -DCMAKE_SYSTEM_NAME=${AGENT_OS}" + fi cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DCMAKE_INSTALL_PREFIX=install \ -DCMAKE_PREFIX_PATH="${prefix_path//:/;}" \ + -DBUILD_SHARED_LIBS=${SHAREDLIBS:-on} \ + ${crosscompiling} \ -DANALYZER=${ANALYZER:-off} \ -DSANITIZER=${SANITIZER:-none} \ -DENABLE_SSL=${SSL:-on} \ @@ -125,7 +143,7 @@ steps: -DBUILD_IDLC_XTESTS=${IDLC_XTESTS:-on} \ -DBUILD_EXAMPLES=on \ -DWERROR=on \ - ${GENERATOR:+-G} "${GENERATOR}" -A "${PLATFORM}" -T "${TOOLSET}" .. + ${GENERATOR:+-G}${GENERATOR} -A "${PLATFORM}" -T "${TOOLSET}" .. ${SCAN_BUILD} cmake --build . --config ${BUILD_TYPE} --target install -- ${BUILD_TOOL_OPTIONS} cmake --build . --config ${BUILD_TYPE} --target package -- ${BUILD_TOOL_OPTIONS} name: script @@ -158,6 +176,7 @@ steps: ${GENERATOR:+-G} "${GENERATOR}" -A "${PLATFORM}" -T "${TOOLSET}" "${INSTALLPREFIX}/share/CycloneDDS/examples/helloworld" cmake --build . --config ${BUILD_TYPE} -- ${BUILD_TOOL_OPTIONS} ${SHELL} ../../scripts/sanity_helloworld.bash + condition: ne(variables['sharedlibs'], 'off') name: sanity_hello_world displayName: Sanity check Hello World - bash: | diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 4745acd6c5..f2b46f94ac 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -139,6 +139,12 @@ jobs: # generator: 'MinGW Makefiles' # cc: 'C:/msys64/mingw64/bin/gcc.exe' # cxx: 'C:/msys64/mingw64/bin/g++.exe' + 'Ubuntu 22.04 LTS with default GCC (Release, Iceoryx, Static, x86_64)': + image: ubuntu-22.04 + idlc_xtests: off + build_type: Release + sharedlibs: off + iceoryx: on steps: - template: /.azure/templates/build-test.yml