diff --git a/.bazelrc b/.bazelrc new file mode 100644 index 00000000..64c8059f --- /dev/null +++ b/.bazelrc @@ -0,0 +1,15 @@ +build --action_env=CMAKE_PREFIX_PATH +build --action_env=CMAKE_LIBRARY_PATH +build --action_env=CMAKE_INCLUDE_PATH +build --action_env=NIX_CFLAGS_COMPILE +build --action_env=NIX_LDFLAGS +build --action_env=PKG_CONFIG_PATH +build --action_env=NIX_CC_WRAPPER_x86_64_unknown_linux_gnu_TARGET_HOST +# for Python +build --action_env=PYTHONPATH + +# get more ccache hits +build --action_env=CCACHE_NOHASHDIR=true +build --action_env=CCACHE_SLOPPINESS=file_macro,time_macros + +try-import %workspace%/user.bazelrc diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000..9ca07d91 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,77 @@ +on: [push, pull_request] + +env: + # Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.) + BUILD_TYPE: Release + +jobs: + build_upstream: + name: CentOS 7 upstream (Bazel) + runs-on: ubuntu-latest + container: 'quay.io/jdanek/cli-cpp_centos7_upstream' + steps: + - uses: actions/checkout@v2 + + - name: Prepare ccache timestamp + id: ccache_cache_timestamp + shell: cmake -P {0} + run: | + string(TIMESTAMP current_date "%Y-%m-%d-%H;%M;%S" UTC) + message("::set-output name=timestamp::${current_date}") + + - uses: actions/cache@v2 + with: + path: "/.cache" + key: bazel-${{ steps.ccache_cache_timestamp.outputs.timestamp }} + restore-keys: bazel + + - run: mkdir -p /.cache + - run: echo "build --disk_cache=/.cache" >> .bazelrc + shell: bash + + - run: bazelisk build //:cli-cpp --//:deps=upstream + + build_bazel: + name: CentOS 7 EPEL (Bazel) + runs-on: ubuntu-latest + container: 'quay.io/jdanek/cli-cpp_centos7_epel' + steps: + - uses: actions/checkout@v2 + + - run: bazelisk build //:cli-cpp --//:deps=rpms + + build_cmake: + name: ${{ matrix.container }} (CMake) + runs-on: ubuntu-latest + container: ${{ matrix.container }} + strategy: + fail-fast: false + matrix: + # checkout action node is broken on 'quay.io/jdanek/cli-cpp_centos6x_epel' + container: ['quay.io/jdanek/cli-cpp_centos7_epel', 'quay.io/jdanek/cli-cpp_fedora31_epel'] + steps: + - uses: actions/checkout@v2 + + - name: Create Build Environment + working-directory: ${{runner.workspace}} + run: cmake -E make_directory build + + - name: Configure CMake + shell: bash + working-directory: ${{runner.workspace}}/build + # Note the current convention is to use the -S and -B options here to specify source + # and build directories, but this is only available with CMake 3.13 and higher. + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE + + - name: Build + working-directory: ${{runner.workspace}}/build + shell: bash + # Execute the build. You can specify a specific target with "--target " + run: cmake --build . --config $BUILD_TYPE + + - name: Test + working-directory: ${{runner.workspace}}/build + shell: bash + # Execute tests defined by the CMake configuration. + # See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail + run: ctest -C $BUILD_TYPE diff --git a/BUILD.bazel b/BUILD.bazel new file mode 100644 index 00000000..e201145a --- /dev/null +++ b/BUILD.bazel @@ -0,0 +1,139 @@ +load("@rules_foreign_cc//tools/build_defs:cmake.bzl", "cmake_external") + +# TODO + +# configuration: source of packages either download github, local checkout (can modify source), or rpms (present in standard paths) +# ccache on or off +# smart setting of CCACHE_BASEDIR is needed +# lib64 + +#build ints +# python2 -m pip install --user setuptools +# sudo swupd bundle-add devpkg-nspr + +# switch to ninja + +cmake_external( + name = "qpid-proton", + cache_entries = { + "CMAKE_C_COMPILER_LAUNCHER": "ccache", + "CMAKE_CXX_COMPILER_LAUNCHER": "ccache", + "CMAKE_CXX_COMPILER": "g++", + + #"BUILD_BINDINGS": "OFF", + "BUILD_BINDINGS": "cpp", + "BUILD_TESTING": "OFF", + # these are optional by default, CMake would skip them if not found + "SASL_IMPL": "cyrus", + "SSL_IMPL": "openssl", + "PROACTOR": "epoll", + # normalize expectations (cmake_external expects ubuntu) + #"LIB_INSTALL_DIR": "lib", + #"LIB_SUFFIX": "", + }, + lib_source = "@qpid-proton//:all", + out_lib_dir = "lib64", + + make_commands = [ + "make -j8", + "make install" + ], + + shared_libraries = ["libqpid-proton-core.so", "libqpid-proton.so"], + #shared_libraries = ["libqpid-proton-core.so", "libqpid-proton.so", "libqpid-proton-cpp.so"], +) + + +cmake_external( + name = "qpid-cpp", + cache_entries = { + "CMAKE_C_COMPILER_LAUNCHER": "ccache", + "CMAKE_CXX_COMPILER_LAUNCHER": "ccache", + "CMAKE_CXX_COMPILER": "g++", + + "BUILD_AMQP": "ON", + "BUILD_SASL": "ON", + "BUILD_SSL": "ON", + # disable as much as we can + "BUILD_BINDING_PERL": "OFF", + "BUILD_BINDING_PYTHON": "OFF", + "BUILD_BINDING_DOTNET": "OFF", + "BUILD_BINDING_RUBY": "OFF", + "BUILD_TESTING": "OFF", + "BUILD_XML": "OFF", + "BUILD_DOCS": "OFF", + "BUILD_PROBES": "OFF", + "BUILD_LEGACYSTORE": "OFF", + "BUILD_LINEARSTORE": "OFF", + "BUILD_HA": "OFF", + "BUILD_RDMA": "OFF", + "BUILD_MSSQL": "OFF", + "BUILD_MSCLFS": "OFF", + "INSTALL_QMFGEN": "OFF", + + "EXT_BUILD_DEPS": "$EXT_BUILD_DEPS", + "Proton_DIR": "$EXT_BUILD_DEPS/qpid-proton/lib64/cmake/Proton", + }, + lib_source = "@qpid-cpp//:all", + make_commands = [ + "make -j8", + "make install" + ], + + out_lib_dir = "lib64", + shared_libraries = ["libqpidclient.so", "libqpidcommon.so", "libqpidtypes.so", "libqpidmessaging.so"], + + deps = [":qpid-proton"], +) + +#filegroup(name = "sources", srcs = glob(["othersrc/**"]), visibility = ["//visibility:public"]) +filegroup(name = "sources", srcs = glob(["CMakeLists.txt", "src/**", "dist/**", "*.cmake"]), visibility = ["//visibility:public"]) +#filegroup(name = "sources", srcs = glob(["**"], exclude=["bazel-*", "bazel-*/**", ".bazelrc"]), visibility = ["//visibility:public"]) + +cmake_external( + name = "cli-cpp", + cache_entries = { + "CMAKE_CXX_COMPILER": "g++", + + "EXT_BUILD_DEPS": "$EXT_BUILD_DEPS", + "Qpid_DIR": "$EXT_BUILD_DEPS/qpid-cpp/lib64/cmake/Qpid", + "Proton_DIR": "$EXT_BUILD_DEPS/qpid-proton/lib64/cmake/Proton", + "ProtonCpp_DIR": "$EXT_BUILD_DEPS/qpid-proton/lib64/cmake/ProtonCpp", + }, + lib_source = "sources", + + make_commands = [ + "make -j8", + "make install" + ], + + binaries = ["aac3_receiver"], + working_directory = "..", + + deps = select({ + ":deps_upstream": [":qpid-cpp", ":qpid-proton"], + ":deps_rpms": [], + }), +) + +# This file uses the above definitions to define two custom build settings. +load("//:build_settings.bzl", "string_flag") + +string_flag( + name = "deps", + build_setting_default = "upstream", +) + +config_setting( + name = "deps_upstream", + flag_values = { + "//:deps": "upstream" + } +) + +config_setting( + name = "deps_rpms", + flag_values = { + "//:deps": "rpms" + } +) diff --git a/BUILD.md b/BUILD.md new file mode 100644 index 00000000..94c553d8 --- /dev/null +++ b/BUILD.md @@ -0,0 +1,44 @@ +# Build instructions + +## Two ways to build + +This project can be built either with CMake, or with CMake executed by Bazel. + +### Bazel command line + +Bazel is used to also build the dependencies, qpid-cpp and qpid-proton. + + bazelisk build //:cli-cpp --//:deps=upstream + +You can tell Bazel not to build these dependencies, and they will be then picked by CMake from system location. + + bazelisk build //:cli-cpp --//:deps=rpms + +When building with ccache, add the following + + --sandbox_writable_path=$HOME/.ccache + +### CMake build + +If you want to use the dependencies built by Bazel in your CMake build, do this. + + mkdir ext_build_deps + ln -s `pwd`/bazel-bin/copy_*/*/lib64/cmake/*/*.cmake ext_build_deps/ + ln -s `pwd`/bazel-bin/copy_*/* ext_build_deps/ + cmake -DCMAKE_PREFIX_PATH=`pwd`/cmake_module_path -DEXT_BUILD_DEPS=`pwd`/cmake_module_path + +### Flags for libraries + +See `BUILD.bazel` for qpid-cpp and qpid-proton flags. +The idea is to build as little as possible. + +## Design considerations + +It makes sense to build cli-cpp with libs from RPM, libs from upstream, or local checkout. + +Further, it makes sense to mix and match tools such as ninja, make, ccache. + +Next, the Debug/Release build should be selected as needed. + +Bazel can provide caching of build actions, and it can be used both in CI or locally. + diff --git a/CMakeLists.txt b/CMakeLists.txt index 512e6c40..0a47b8c7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,16 +1,16 @@ PROJECT(dtests-cpp-contrib) # Ugly hack to avoid newer versions from complaining. Needs to be fixed -cmake_minimum_required(VERSION 2.4) +cmake_minimum_required(VERSION 2.8.12) INCLUDE (CheckIncludeFile) INCLUDE (CheckIncludeFileCXX) macro (FailIfNotSet VARIABLE name) - if (NOT ${VARIABLE}) + if (NOT ${VARIABLE}) set(MSG "** A required include file, " ${name} ", was not found on your system **") message(FATAL_ERROR ${MSG}) - endif (NOT ${VARIABLE}) + endif (NOT ${VARIABLE}) endmacro(FailIfNotSet) CHECK_INCLUDE_FILE_CXX(cstdio HAVE_CSTDIO) @@ -35,18 +35,22 @@ endif(CMAKE_SIZEOF_VOID_P EQUAL 8) if (WIN32) if (EXISTS "C:/Proton/qpid-proton-winsdk/2015") - set(BOOST_INCLUDE_DIR "C:/Boost2015" CACHE String "Boost include directory") - set(BOOST_LIBRARY_DIR "C:/Boost2015/lib64-msvc-14.0" CACHE String "Boost library directory") + set(Boost_INCLUDE_DIRS "C:/Boost2015" CACHE String "Boost include directory") + set(Boost_LIBRARY_DIRS "C:/Boost2015/lib64-msvc-14.0" CACHE String "Boost library directory") else() - set(BOOST_INCLUDE_DIR "C:/Boost" CACHE String "Boost include directory") - set(BOOST_LIBRARY_DIR "C:/Boost/lib64-msvc-12.0" CACHE String "Boost library directory") + set(Boost_INCLUDE_DIRS "C:/Boost" CACHE String "Boost include directory") + set(Boost_LIBRARY_DIRS "C:/Boost/lib64-msvc-12.0" CACHE String "Boost library directory") endif() set(PROTON_INCLUDE_DIR "C:/Proton/qpid-proton-winsdk/include" CACHE String "Proton include directory") set(PROTON_LIBRARY_DIR "C:/Proton/qpid-proton-winsdk/lib" CACHE String "Proton library directory") else (WIN32) - set(BOOST_INCLUDE_DIR "/usr/include" CACHE STRING "Boost include directory") - set(BOOST_LIBRARY_DIR "/usr/lib" CACHE STRING "Boost library directory") + include(FindBoost) + find_package(Boost + 1.41.0 # CentOS/RHEL 6 + REQUIRED + COMPONENTS filesystem regex system + ) endif (WIN32) set(ENABLE_QPID_PROTON ON CACHE BOOL "Enable qpid proton clients") @@ -73,30 +77,30 @@ if (NOT WIN32) set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) endif (NOT WIN32) -if (EXISTS "${BOOST_INCLUDE_DIR}") - include_directories(${BOOST_INCLUDE_DIR}) -else (EXISTS "${BOOST_INCLUDE_DIR}") - message(FATAL_ERROR "Boost ${BOOST_VERSION} headers were not found in ${BOOST_INCLUDE_DIR}") -endif (EXISTS "${BOOST_INCLUDE_DIR}") +if (EXISTS "${Boost_INCLUDE_DIRS}") + include_directories(${Boost_INCLUDE_DIRS}) +else (EXISTS "${Boost_INCLUDE_DIRS}") + message(FATAL_ERROR "Boost ${BOOST_VERSION} headers were not found in ${Boost_INCLUDE_DIRS}") +endif (EXISTS "${Boost_INCLUDE_DIRS}") -if (EXISTS "${BOOST_LIBRARY_DIR}") - link_directories(${BOOST_LIBRARY_DIR}) -else (EXISTS "${BOOST_LIBRARY_DIR}") - message(FATAL_ERROR "Boost ${BOOST_VERSION} libraries were not found in ${BOOST_LIBRARY_DIR}") -endif (EXISTS "${BOOST_LIBRARY_DIR}") +if (EXISTS "${Boost_LIBRARY_DIRS}") + link_directories(${Boost_LIBRARY_DIRS}) +else (EXISTS "${Boost_LIBRARY_DIRS}") + message(FATAL_ERROR "Boost ${BOOST_VERSION} libraries were not found in ${Boost_LIBRARY_DIRS}") +endif (EXISTS "${Boost_LIBRARY_DIRS}") if (WIN32) if (EXISTS "${PROTON_INCLUDE_DIR}") include_directories(${PROTON_INCLUDE_DIR}) - else (EXISTS "${PROTON_INCLUDE_DIR}") + else (EXISTS "${PROTON_INCLUDE_DIR}") message(FATAL_ERROR "Proton ${PROTON_VERSION} headers were not found in ${PROTON_INCLUDE_DIR}") - endif (EXISTS "${PROTON_INCLUDE_DIR}") + endif (EXISTS "${PROTON_INCLUDE_DIR}") if (EXISTS "${PROTON_LIBRARY_DIR}") link_directories(${PROTON_LIBRARY_DIR}) - else (EXISTS "${PROTON_LIBRARY_DIR}") + else (EXISTS "${PROTON_LIBRARY_DIR}") message(FATAL_ERROR "Proton ${PROTON_VERSION} libraries were not found in ${PROTON_LIBRARY_DIR}") - endif (EXISTS "${PROTON_LIBRARY_DIR}") + endif (EXISTS "${PROTON_LIBRARY_DIR}") endif (WIN32) enable_testing() @@ -161,9 +165,9 @@ if (BUILD_WITH_UNIT_TESTS) set (CTEST_BINARY_DIRECTORY ${CMAKE_BINARY_DIR}/target/tests/bin) endif (BUILD_WITH_UNIT_TESTS) -if (ENABLE_MODERN) - add_definitions(-DENABLE_MODERN) -else (ENABLE_MODERN) +if (ENABLE_MODERN) + add_definitions(-DENABLE_MODERN) +else (ENABLE_MODERN) if (ENABLE_QPID_PROTON) message(FATAL_ERROR "Modern code is a requirement for proton code") endif(ENABLE_QPID_PROTON) @@ -173,15 +177,15 @@ add_subdirectory(src/contrib) add_subdirectory(src/common) if (ENABLE_QPID_PROTON) - add_definitions(-DENABLE_QPID_PROTON) + add_definitions(-DENABLE_QPID_PROTON) add_subdirectory(src/api/qpid-proton) endif(ENABLE_QPID_PROTON) -if (ENABLE_QPID_MESSAGING) - add_definitions(-DENABLE_QPID_MESSAGING) +if (ENABLE_QPID_MESSAGING) + add_definitions(-DENABLE_QPID_MESSAGING) add_subdirectory(src/api/qpid) endif(ENABLE_QPID_MESSAGING) - + set(CPPCHECK_EXECUTABLE "/usr/bin/cppcheck" CACHE STRING "Path to cppcheck") set(CPPCHECK_FLAGS "--report-progress" "-v" "--enable=all" "--xml" CACHE STRING "Options for cppcheck") diff --git a/Dockerfile.centos6x_epel b/Dockerfile.centos6x_epel new file mode 100644 index 00000000..cabb877d --- /dev/null +++ b/Dockerfile.centos6x_epel @@ -0,0 +1,19 @@ +FROM library/centos:6 + +RUN yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-6.noarch.rpm \ +&& yum install -y \ + npm \ + \ + cmake \ + make \ + gcc \ + gcc-c++ \ + \ + boost-devel \ + \ + qpid-cpp-client-devel \ + \ + qpid-proton-cpp-devel \ + \ +&& yum clean all \ +&& rm -rf /var/cache/yum diff --git a/Dockerfile.centos7_epel b/Dockerfile.centos7_epel new file mode 100644 index 00000000..5bfea88d --- /dev/null +++ b/Dockerfile.centos7_epel @@ -0,0 +1,25 @@ +FROM library/centos:7 +# Fedora 31 and Centos 7 (epel 7) are latest versions that ship qpid-cpp + +RUN yum install -y dnf \ +&& dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ +&& dnf install -y \ + npm \ + \ + cmake \ + make \ + gcc \ + gcc-c++ \ + \ + boost-devel \ + \ + qpid-cpp-client-devel \ + \ + qpid-proton-cpp-devel \ + \ +&& yum clean all \ +&& dnf clean all \ +&& rm -rf /var/cache/yum \ +&& rm -rf /var/cache/dnf + +RUN npm install -g @bazel/bazelisk diff --git a/Dockerfile.centos7_upstream b/Dockerfile.centos7_upstream new file mode 100644 index 00000000..2ab3de75 --- /dev/null +++ b/Dockerfile.centos7_upstream @@ -0,0 +1,29 @@ +FROM library/centos:7 +# Fedora 31 and Centos 7 (epel 7) are latest versions that ship qpid-cpp + +RUN yum install -y dnf \ +&& dnf install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm \ +&& dnf install -y \ + npm \ + \ + cmake \ + make \ + gcc \ + gcc-c++ \ + \ + boost-devel \ + \ + ruby \ + nss-devel \ + libuuid-devel \ + python-setuptools \ + \ + cyrus-sasl-devel \ + openssl-devel \ + \ +&& yum clean all \ +&& dnf clean all \ +&& rm -rf /var/cache/yum \ +&& rm -rf /var/cache/dnf + +RUN npm install -g @bazel/bazelisk diff --git a/Dockerfile.fedora31_epel b/Dockerfile.fedora31_epel new file mode 100644 index 00000000..07764ce0 --- /dev/null +++ b/Dockerfile.fedora31_epel @@ -0,0 +1,21 @@ +FROM library/fedora:31 +# Fedora 31 and Centos 7 (epel 7) are latest versions that ship qpid-cpp + +RUN dnf install -y \ + npm \ + \ + cmake \ + make \ + gcc \ + gcc-c++ \ + \ + boost-devel \ + \ + qpid-cpp-client-devel \ + \ + qpid-proton-cpp-devel \ + \ +&& dnf clean all \ +&& rm -rf /var/cache/dnf + +RUN npm install -g @bazel/bazelisk diff --git a/README.md b/README.md index ba041551..509e8f86 100644 --- a/README.md +++ b/README.md @@ -47,8 +47,8 @@ Default: off Control where required boost libraries can be found. -* BOOST_INCLUDE_DIR: use to inform the Boost include directory. -* BOOST_LIBRARY_DIR: use to inform the Boost library directory. +* Boost_INCLUDE_DIRS: use to inform the Boost include directory. +* Boost_LIBRARY_DIRS: use to inform the Boost library directory. #### Unit tests @@ -119,8 +119,8 @@ cmake -DENABLE_QPID_PROTON=ON -DPROTON_DIR=/opt/devel/qpid-proton \ -DENABLE_MODERN=ON -DCMAKE_CXX_COMPILER=`which c++` \ -DCMAKE_VERBOSE_MAKEFILE=OFF -DBUILD_WITH_UNIT_TESTS=OFF \ -DQPID_WITH_GET_CONTENT_OBJECT=ON \ - -DBOOST_INCLUDE_DIR=/usr/include/boost141/ \ - -DBOOST_LIBRARY_DIR=/usr/lib/boost141/ . + -DBoost_INCLUDE_DIRS=/usr/include/boost141/ \ + -DBoost_LIBRARY_DIRS=/usr/lib/boost141/ . ``` RHEL 5.11 with QPID Proton and disabled unit tests @@ -130,8 +130,8 @@ cmake -DENABLE_QPID_PROTON=ON -DPROTON_DIR=/opt/devel/qpid-proton \ -DENABLE_MODERN=ON -DCMAKE_CXX_COMPILER=`which c++` ` -DCMAKE_VERBOSE_MAKEFILE=OFF -DBUILD_WITH_UNIT_TESTS=OFF ` -DQPID_WITH_GET_CONTENT_OBJECT=ON ` - -DBOOST_INCLUDE_DIR=/usr/include/boost141/ ` - -DBOOST_LIBRARY_DIR=/usr/lib/boost141/ -DENABLE_QPID_CLIENT=ON . + -DBoost_INCLUDE_DIRS=/usr/include/boost141/ ` + -DBoost_LIBRARY_DIRS=/usr/lib/boost141/ -DENABLE_QPID_CLIENT=ON . ``` diff --git a/WORKSPACE.bazel b/WORKSPACE.bazel new file mode 100644 index 00000000..d628622d --- /dev/null +++ b/WORKSPACE.bazel @@ -0,0 +1,53 @@ +workspace(name = "cli_cpp") + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +# Group the sources of the library so that CMake rule have access to it +all_content = """filegroup(name = "all", srcs = glob(["**"]), visibility = ["//visibility:public"])""" + +# Rule repository +http_archive( + name = "rules_foreign_cc", + strip_prefix = "rules_foreign_cc-master", + url = "https://github.com/bazelbuild/rules_foreign_cc/archive/master.zip", +) + +load("@rules_foreign_cc//:workspace_definitions.bzl", "rules_foreign_cc_dependencies") + +# Call this function from the WORKSPACE file to initialize rules_foreign_cc +# dependencies and let neccesary code generation happen +# (Code generation is needed to support different variants of the C++ Starlark API.). +# +# Args: +# native_tools_toolchains: pass the toolchains for toolchain types +# '@rules_foreign_cc//tools/build_defs:make_toolchain', +# '@rules_foreign_cc//tools/build_defs:cmake_toolchain' and +# '@rules_foreign_cc//tools/build_defs:ninja_toolchain' with the needed platform constraints. +# If you do not pass anything, registered default toolchains will be selected (see below). +# +# register_default_tools: if True, the make, cmake and ninja toolchains, calling corresponding +# preinstalled binaries by name (make, cmake, ninja) will be registered after +# 'native_tools_toolchains' without any platform constraints. +# The default is True. +#rules_foreign_cc_dependencies([ +# "//:my_make_toolchain", +# "//:my_cmake_toolchain", +# "//:my_ninja_toolchain", +#]) +rules_foreign_cc_dependencies() + +# Qpid upstream source code repositories + +http_archive( + name = "qpid-proton", + build_file_content = all_content, + strip_prefix = "qpid-proton-master", + url = "https://github.com/apache/qpid-proton/archive/master.zip", +) + +http_archive( + name = "qpid-cpp", + build_file_content = all_content, + strip_prefix = "qpid-cpp-master", + url = "https://github.com/apache/qpid-cpp/archive/master.zip", +) diff --git a/build_settings.bzl b/build_settings.bzl new file mode 100644 index 00000000..c5f71870 --- /dev/null +++ b/build_settings.bzl @@ -0,0 +1,25 @@ +# https://docs.google.com/document/d/1vc8v-kXjvgZOdQdnxPTaV0rrLxtP2XwnD2tAZlYJOqw + +# This file defines the build_flag and build_setting rules which can be used in +# BUILD files to declare specific settings. +BuildSettingInfo = provider(fields = ["name", "value"]) + +def _build_setting_impl(ctx): + # The rule implementation. We could do validation, type conversion, etc. if we + # want. But this example just dumps ctx.build_setting_value into a provider. + return [BuildSettingInfo(name = ctx.attr.name, value = ctx.build_setting_value )] + +string_flag = rule( + implementation = _build_setting_impl, + build_setting = config.string(flag=True) # Settable at the command line +) + +bool_setting = rule( + implementation = _build_setting_impl, + build_setting = config.bool() # Only settable by other rules +) + +label_flag = rule( + implementation = _build_setting_impl, + #build_setting = attr.label() +) diff --git a/src/api/qpid-proton/CMakeLists.txt b/src/api/qpid-proton/CMakeLists.txt index e9d71e2f..f684ea2b 100644 --- a/src/api/qpid-proton/CMakeLists.txt +++ b/src/api/qpid-proton/CMakeLists.txt @@ -1,7 +1,7 @@ PROJECT(dtests-proton-cpp) # Ugly hack to avoid newer versions from complaining. Needs to be fixed -cmake_minimum_required(VERSION 2.4) +cmake_minimum_required(VERSION 2.8.12) set(PROTON_DIR /usr CACHE String "QPID Proton base directory") diff --git a/src/api/qpid/CMakeLists.txt b/src/api/qpid/CMakeLists.txt index ee68c5e0..d3c47c8d 100644 --- a/src/api/qpid/CMakeLists.txt +++ b/src/api/qpid/CMakeLists.txt @@ -1,7 +1,7 @@ PROJECT(dtests-proton-cpp) # Ugly hack to avoid newer versions from complaining. Needs to be fixed -cmake_minimum_required(VERSION 2.4) +cmake_minimum_required(VERSION 2.8.12) INCLUDE (CheckIncludeFiles) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index 24f67dc1..2ceed631 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -1,7 +1,7 @@ PROJECT(dtests-cpp-common) # Ugly hack to avoid newer versions from complaining. Needs to be fixed -cmake_minimum_required(VERSION 2.4) +cmake_minimum_required(VERSION 2.8.12) # CHECK_INCLUDE_FILE(qpid/types/Exception.h HAVE_QPID_TYPES_EXCEPTION) # FailIfNotSet(HAVE_QPID_TYPES_EXCEPTION qpid/types/Exception.h) diff --git a/user.bazelrc b/user.bazelrc new file mode 100644 index 00000000..bc269948 --- /dev/null +++ b/user.bazelrc @@ -0,0 +1,2 @@ +# https://stackoverflow.com/questions/52370202/how-to-get-bazel-ccache-and-sandboxing-to-work-together-ccache-read-only-file +#build --sandbox_writable_path=$HOME/.ccache