diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1f5054e877d7a2bff25850b8b413ba177da73ed4..8914b7c912017e73d788d75cb6320a35aab3f4e7 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,4 @@ -image: "flowdalic/debian-testing-dev:1.17" +image: "flowdalic/debian-testing-dev:1.19" before_script: - ulimit -a @@ -97,6 +97,14 @@ clang-tidy: CC: clang CXX: clang++ +.libc++: + extends: + - .clang + variables: + EMPER_USE_BUNDLED_DEPS: "always" + EMPER_CPP_ARGS: "-stdlib=libc++" + EMPER_CPP_LINK_ARGS: "-stdlib=libc++" + .emper-ws-scheduling: variables: EMPER_DEFAULT_SCHEDULING_STRATEGY: "work_stealing" @@ -253,6 +261,17 @@ test-clang-debug: - test-clang - .debug-build +smoke-test-libc++: + stage: smoke-test + extends: + - .fast-variant-check + - .libc++ + +test-libc++: + extends: + - .test + - .libc++ + test-worker-no-sleep: extends: - .test diff --git a/Makefile b/Makefile index 07ee51e9b5f7834e6fef7ee15713a6307ee1e187..f96f4cdb8151107419fa8c2e8e71f1cb6a48a4c5 100644 --- a/Makefile +++ b/Makefile @@ -50,6 +50,15 @@ PHONY: sanitize-address sanitize-address: $(sanitizer) +libc++: + rm -f build + $(MAKE) build \ + CC=clang CXX=clang++ \ + EMPER_CPP_ARGS="-stdlib=libc++" \ + EMPER_CPP_LINK_ARGS="-stdlib=libc++" \ + EMPER_USE_BUNDLED_DEPS="always" \ + BUILDDIR="build-libc++" + .PHONY: fast-static-analysis fast-static-analysis: all check-format check-license doc diff --git a/emper/log/log.cpp b/emper/log/log.cpp index 14140f462bd3e46906a0a3ca132d8cc0d2a065b9..c35997315ced171bc9b24fd0b20429f907594ff5 100644 --- a/emper/log/log.cpp +++ b/emper/log/log.cpp @@ -21,12 +21,12 @@ using emper::io::GlobalIoContext; -//static const long NanosInAMinute = 60L * 1000 * 1000 * 1000; - namespace emper::log { -static void add_timestamp_to(UNUSED_ARG std::ostringstream& logMessage) { -#if 0 +static void add_timestamp_to(std::ostringstream& logMessage) { +#if defined __GLIBCXX__ + static const long NanosInAMinute = 60L * 1000 * 1000 * 1000; + auto now = std::chrono::high_resolution_clock::now(); auto now_time_t = std::chrono::high_resolution_clock::to_time_t(now); @@ -54,6 +54,8 @@ static void add_timestamp_to(UNUSED_ARG std::ostringstream& logMessage) { long remaining_nanos = time_since_epoch_long % NanosInAMinute; logMessage << remaining_nanos; +#else + logMessage << "UNKN_TIME"; #endif } diff --git a/meson.build b/meson.build index d1c278b97d5a69a03446374166869cf2d419a1ab..80b1df3f9eca4bb3c2a3f4836e65596350002cc6 100644 --- a/meson.build +++ b/meson.build @@ -10,9 +10,12 @@ project('EMPER', 'c', 'cpp', thread_dep = dependency('threads') +conf_data = configuration_data() +use_bundled_deps = get_option('use_bundled_deps') + liburing_version = '2.0' -uring_dep = dependency('liburing', version: liburing_version, required: false) -if not uring_dep.found() +uring_dep = dependency('liburing', version: liburing_version, required: use_bundled_deps == 'never') +if not uring_dep.found() or use_bundled_deps == 'always' message('liburing ' + liburing_version + ' not found in system, using liburing subproject') liburing_sp = subproject('liburing') uring_dep = liburing_sp.get_variable('uring').as_system() @@ -32,7 +35,6 @@ tools_dir = join_paths(meson.source_root(), 'tools') run_target('iwyu', command: join_paths(tools_dir, 'check-iwyu')) -conf_data = configuration_data() option_urcu = get_option('userspace_rcu') conf_data.set('EMPER_LIBURCU', option_urcu) if option_urcu diff --git a/meson_options.txt b/meson_options.txt index 3cced4d588766dbbefb40d9c2b94e7d68bd81f44..96b76c34be3435f7737a42e7b4523b7811d2f014 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,3 +1,10 @@ +option( + 'use_bundled_deps', + type: 'combo', + choices: ['automatic', 'always', 'never'], + description: 'Control when the bundled dependencies are used', + value: 'automatic', +) option( 'userspace_rcu', type: 'boolean', diff --git a/tests/meson.build b/tests/meson.build index 8204a0b7602990d0d968049febcfdb84f7ebaff4..c1d0d09a2aee9f1cb30a7367dad830a892b685fb 100644 --- a/tests/meson.build +++ b/tests/meson.build @@ -133,10 +133,10 @@ parallel_ok = (not io_uring_enabled) # Meson integration for GTest and GMock # See https://mesonbuild.com/Dependencies.html#gtest-and-gmock -gtest_dep = dependency('gtest', main: true, required: false) +gtest_dep = dependency('gtest', main: true, required: use_bundled_deps == 'never') # If gtest is not available on the system use the meson wrap provided # by WrapDB and build it ourself -if not gtest_dep.found() +if not gtest_dep.found() or use_bundled_deps == 'always' gtest_sp = subproject('gtest') gtest_dep = gtest_sp.get_variable('gtest_main_dep') endif