diff --git a/.azure/templates/build-test.yml b/.azure/templates/build-test.yml index 5dcb924c..06cdd939 100644 --- a/.azure/templates/build-test.yml +++ b/.azure/templates/build-test.yml @@ -27,27 +27,21 @@ steps: echo "###vso[task.setvariable variable=build_type;]Debug" name: setup - bash: | - echo "###vso[task.setvariable variable=pip_cache;]${HOME}/.cache/pip" - echo "###vso[task.setvariable variable=conan_cache;]${HOME}/.conan/data" echo "###vso[task.setvariable variable=PATH;]$(python3 -m site --user-base)/bin:${PATH}" echo "###vso[task.setvariable variable=build_tool_options;]-j 4" - sudo apt-get install -y clang clang-tools clang-tidy + sudo apt install -y clang clang-tools clang-tidy libboost-dev condition: eq(variables['Agent.OS'], 'Linux') name: setup_linux - bash: | - echo "###vso[task.setvariable variable=pip_cache;]${HOME}/Library/Caches/pip" - echo "###vso[task.setvariable variable=conan_cache;]${HOME}/.conan/data" echo "###vso[task.setvariable variable=PATH;]$(python3 -m site --user-base)/bin:${PATH}" echo "###vso[task.setvariable variable=build_tool_options;]-j 4" sudo /usr/libexec/ApplicationFirewall/socketfilterfw --setglobalstate off - brew install bison + brew install googletest condition: eq(variables['Agent.OS'], 'Darwin') name: setup_macos # Use PowerShell rather than Bash to ensure Windows-style paths - pwsh: | $python_bin = python -m site --user-base - Write-Host "###vso[task.setvariable variable=pip_cache;]${env:LOCALAPPDATA}\\pip\\Cache" - Write-Host "###vso[task.setvariable variable=conan_cache;]${env:USERPROFILE}\\.conan\\data" Write-Host "###vso[task.setvariable variable=PATH;]$python_bin\\bin;${env:PATH}" # Visual Studio is most likely used on Windows agents if (${env:GENERATOR} -match "2019" -and -not ${env:PLATFORM}) { @@ -61,29 +55,26 @@ steps: } } Write-Host "###vso[task.setvariable variable=build_tool_options;]-nologo -verbosity:minimal -maxcpucount:4 -p:CL_MPCount=4" - choco install winflexbison3 condition: eq(variables['Agent.OS'], 'Windows_NT') name: setup_windows - - task: Cache@2 - inputs: - key: pip | 2 | $(Agent.OS) - path: $(pip_cache) - name: cache_pip - - task: Cache@2 - inputs: - key: conan | 2 | $(Agent.OS) | $(arch) | $(build_type) - path: $(conan_cache) - name: cache_conan - - bash: | - set -e -x - pip install "conan==1.59.0" --user - conan profile new default --detect - name: install_conan + - pwsh: | + # boost-msvc-14.1 for VS 2017 + # boost-msvc-14.2 for VS 2019 + # boost-msvc-14.3 for VS 2022 + choco install -y boost-msvc-14.2 + condition: and(eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['legacy'], 'on')) + name: setup_windows_boost + # Google Test doesn't seem to be available in Chocolatey + # Google Test 1.12.1 is the latest one to support C++11 (only relevant if legacy=on) + # and "apt install googletest" doesn't seem to do the trick on Linux - bash: | - set -e -x - conan profile update settings.compiler.libcxx=libstdc++11 default - condition: eq(variables['Agent.OS'], 'Linux') - name: update_conan_cxx_library + git clone --depth 1 --branch release-1.12.1 https://github.com/google/googletest.git + mkdir googletest/build + cd googletest/build + cmake -DCMAKE_INSTALL_PREFIX=install -DBUILD_SHARED_LIBS=on .. + cmake --build . --config RelWithDebInfo --target install -- ${BUILD_TOOL_OPTIONS} + condition: or(eq(variables['Agent.OS'], 'Linux'), eq(variables['Agent.OS'], 'Windows_NT')) + name: setup_googletest - bash: | set -e -x sudo apt-get install libacl1-dev libncurses5-dev pkg-config @@ -109,7 +100,6 @@ steps: cyclonedds mkdir cyclonedds/build cd cyclonedds/build - conan install -b missing -s arch=${ARCH} -s build_type=${BUILD_TYPE} .. cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DCMAKE_INSTALL_PREFIX=install \ -DCMAKE_PREFIX_PATH="${BUILD_SOURCESDIRECTORY}/iceoryx/build/install" \ @@ -124,16 +114,15 @@ steps: set -e -x mkdir build cd build - conan install -b missing -s arch=${ARCH} -s build_type=${BUILD_TYPE} .. cmake -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ -DCMAKE_INSTALL_PREFIX=install \ - -DCMAKE_PREFIX_PATH="${BUILD_SOURCESDIRECTORY}/cyclonedds/build/install;${BUILD_SOURCESDIRECTORY}/iceoryx/build/install" \ + -DCMAKE_PREFIX_PATH="${BUILD_SOURCESDIRECTORY}/cyclonedds/build/install;${BUILD_SOURCESDIRECTORY}/iceoryx/build/install;${BUILD_SOURCESDIRECTORY}/googletest/build/install" \ -DANALYZER=${ANALYZER:-off} \ -DSANITIZER=${SANITIZER:-none} \ -DENABLE_SHM=${ICEORYX:-off} \ -DENABLE_COVERAGE=${COVERAGE:-off} \ -DENABLE_LEGACY=${LEGACY:-off} \ - -DBUILD_TESTING=on \ + -DBUILD_TESTING=${TESTING:-on} \ -DBUILD_EXAMPLES=${EXAMPLES:-on} \ -DWERROR=on \ ${GENERATOR:+-G} "${GENERATOR}" -A "${PLATFORM}" -T "${TOOLSET}" .. diff --git a/CMakeLists.txt b/CMakeLists.txt index 2be00c64..3e11e84b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,33 +15,6 @@ project(CycloneDDS-CXX VERSION 0.11.0 LANGUAGES C CXX) set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake/Modules") set(CMAKE_CXX_STANDARD 11) -# Conan -if(EXISTS "${CMAKE_BINARY_DIR}/conanbuildinfo.cmake" AND NOT CONAN_DEPENDENCIES) - include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) - if(APPLE) - # By default Conan strips all RPATHs (see conanbuildinfo.cmake), which - # causes tests to fail as the executables cannot find the library target. - # By setting KEEP_RPATHS, Conan does not set CMAKE_SKIP_RPATH and the - # resulting binaries still have the RPATH information. This is fine because - # CMake will strip the build RPATH information in the install step. - # - # NOTE: - # Conan's default approach is to use the "imports" feature, which copies - # all the dependencies into the bin directory. Of course, this doesn't work - # quite that well for libraries generated in this Project (see Conan - # documentation). - # - # See the links below for more information. - # https://github.com/conan-io/conan/issues/337 - # https://docs.conan.io/en/latest/howtos/manage_shared_libraries/rpaths.html - # https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/RPATH-handling - conan_basic_setup(KEEP_RPATHS) - else() - conan_basic_setup() - endif() - conan_define_targets() -endif() - # By default don't treat warnings as errors, else anyone building it with a # different compiler that just happens to generate a warning, as well as # anyone adding or modifying something and making a small mistake would run @@ -172,12 +145,14 @@ set(SANITIZER "" CACHE STRING "Sanitizers to enable on the build.") if(SANITIZER) string(REGEX REPLACE " " "" SANITIZER "${SANITIZER}") string(REGEX REPLACE "[,;]+" ";" SANITIZER "${SANITIZER}") - add_compile_options("-fno-sanitize-recover=all") foreach(san ${SANITIZER}) if(san STREQUAL "address") add_compile_options("-fno-omit-frame-pointer") add_link_options("-fno-omit-frame-pointer") endif() + if(san STREQUAL "undefined") + add_compile_options("-fno-sanitize-recover=all") + endif() if(san AND NOT san STREQUAL "none") message(STATUS "Enabling sanitizer: ${san}") add_compile_options("-fsanitize=${san}") diff --git a/README.md b/README.md index 8352d1cf..5a84a699 100644 --- a/README.md +++ b/README.md @@ -127,22 +127,10 @@ variable `BUILD_TESTING` to on when configuring, e.g.: $ cmake --build . $ ctest -Such a build requires the presence of [Google Test][7]. You can install this -yourself, or you can choose to instead rely on the [Conan][8] package manager -that the CI build infrastructure also uses. In that case, install Conan and do: - - $ conan install .. --build missing - -in the build directory prior to running `cmake`. This will automatically -download and/or build Google Test. - -For Windows, depending on the generator, you might also need to add switches -to select the architecture and build type, e.g., - - $ conan install -s arch=x86_64 -s build_type=Debug .. +Such a build requires the presence of [Google Test][7]. You need to install this +yourself. [7]: https://github.com/google/googletest -[8]: https://conan.io/ ## Documentation diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 052cdd9e..ad225b70 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -77,6 +77,14 @@ strategy: sanitizer: address,undefined cc: clang-12 cxx: clang++-12 + # C++11 requires boost, installing boost on Windows takes forever, so use Linux + # Google test requires C++14 at minimum, so we can't build tests ... + 'Ubuntu 22.04 LTS with CLang 12 (Debug, x86_64, C++11)': + image: ubuntu-22.04 + build_type: Debug + cc: clang-12 + cxx: clang++-12 + legacy: on 'Ubuntu 22.04 LTS with GCC 12 (Debug, x86_64, no type discovery)': image: ubuntu-22.04 sanitizer: address @@ -99,7 +107,6 @@ strategy: #'Windows 2019 with Visual Studio 2019 (Visual Studio 2017, Debug, x86)': # arch: x86 # image: windows-2019 - # conanfile: conanfile102.txt # generator: 'Visual Studio 16 2019' # toolkit: v141 'Windows 2019 with Visual Studio 2019 (Debug, x86_64)': @@ -110,11 +117,12 @@ strategy: image: windows-2019 build_type: Release generator: 'Visual Studio 16 2019' - 'Windows 2019 with Visual Studio 2019 (Release, x86_64, c++11)': - image: windows-2019 - build_type: Release - generator: 'Visual Studio 16 2019' - legacy: on + #C++11 needs boost, installing boost takes forever on Windows + #'Windows 2019 with Visual Studio 2019 (Release, x86_64, c++11)': + # image: windows-2019 + # build_type: Release + # generator: 'Visual Studio 16 2019' + # legacy: on pool: vmImage: $(image) diff --git a/conanfile.txt b/conanfile.txt deleted file mode 100644 index 87ea6f59..00000000 --- a/conanfile.txt +++ /dev/null @@ -1,9 +0,0 @@ -[requires] -gtest/1.12.1 -boost/1.81.0 - -[generators] -cmake - -[options] -gtest:shared=True