From 8ae29c03298ed144245d278cd68b9982f092c2a1 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 15 Oct 2023 09:45:54 +0400 Subject: [PATCH 1/6] meson: Remove duplicate include --- meson.build | 1 - 1 file changed, 1 deletion(-) diff --git a/meson.build b/meson.build index b727d91e83..82cb189c86 100644 --- a/meson.build +++ b/meson.build @@ -134,7 +134,6 @@ common_includes = [ 'public/common/tracy_lz4.hpp', 'public/common/tracy_lz4hc.hpp', 'public/common/TracyAlign.hpp', - 'public/common/TracyAlign.hpp', 'public/common/TracyAlloc.hpp', 'public/common/TracyApi.h', 'public/common/TracyColor.hpp', From 6796c6fd91a8dade47b48d1381096402a3101599 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 15 Oct 2023 09:46:20 +0400 Subject: [PATCH 2/6] meson: Remove tracy_dep_dynamic Seems unused. --- meson.build | 3 --- 1 file changed, 3 deletions(-) diff --git a/meson.build b/meson.build index 82cb189c86..3aeee89131 100644 --- a/meson.build +++ b/meson.build @@ -191,7 +191,4 @@ tracy_dep = declare_dependency( link_with : tracy, include_directories : tracy_public_include_dirs) -tracy_dep_dynamic = declare_dependency( - include_directories : tracy_public_include_dirs) - meson.override_dependency('tracy', tracy_dep) From e93cf6d08a992f1ffadb71da76c1b9ad067a1c1b Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sun, 15 Oct 2023 09:46:43 +0400 Subject: [PATCH 3/6] meson: Propagate defines to dependents This way they don't have to set them manually. --- meson.build | 50 +++++++++++++++++++++++++++----------------------- 1 file changed, 27 insertions(+), 23 deletions(-) diff --git a/meson.build b/meson.build index 3aeee89131..564841d846 100644 --- a/meson.build +++ b/meson.build @@ -1,87 +1,89 @@ project('tracy', ['cpp'], version: '0.10.0') +tracy_compile_args = [] + if get_option('tracy_enable') - add_project_arguments('-DTRACY_ENABLE', language : 'cpp') + tracy_compile_args += ['-DTRACY_ENABLE'] endif if get_option('tracy_on_demand') - add_project_arguments('-DTRACY_ON_DEMAND', language : 'cpp') + tracy_compile_args += ['-DTRACY_ON_DEMAND'] endif if get_option('tracy_callstack') - add_project_arguments('-DTRACY_CALLSTACK', language : 'cpp') + tracy_compile_args += ['-DTRACY_CALLSTACK'] endif if get_option('tracy_no_callstack') - add_project_arguments('-DTRACY_NO_CALLSTACK', language : 'cpp') + tracy_compile_args += ['-DTRACY_NO_CALLSTACK'] endif if get_option('tracy_no_callstack_inlines') - add_project_arguments('-DTRACY_NO_CALLSTACK_INLINES', language : 'cpp') + tracy_compile_args += ['-DTRACY_NO_CALLSTACK_INLINES'] endif if get_option('tracy_only_localhost') - add_project_arguments('-DTRACY_ONLY_LOCALHOST', language : 'cpp') + tracy_compile_args += ['-DTRACY_ONLY_LOCALHOST'] endif if get_option('tracy_no_broadcast') - add_project_arguments('-DTRACY_NO_BROADCAST', language : 'cpp') + tracy_compile_args += ['-DTRACY_NO_BROADCAST'] endif if get_option('tracy_only_ipv4') - add_project_arguments('-DTRACY_ONLY_IPV4', language : 'cpp') + tracy_compile_args += ['-DTRACY_ONLY_IPV4'] endif if get_option('tracy_no_code_transfer') - add_project_arguments('-DTRACY_NO_CODE_TRANSFER', language : 'cpp') + tracy_compile_args += ['-DTRACY_NO_CODE_TRANSFER'] endif if get_option('tracy_no_context_switch') - add_project_arguments('-DTRACY_NO_CONTEXT_SWITCH', language : 'cpp') + tracy_compile_args += ['-DTRACY_NO_CONTEXT_SWITCH'] endif if get_option('tracy_no_exit') - add_project_arguments('-DTRACY_NO_EXIT', language : 'cpp') + tracy_compile_args += ['-DTRACY_NO_EXIT'] endif if get_option('tracy_no_sampling') - add_project_arguments('-DTRACY_NO_SAMPLING', language : 'cpp') + tracy_compile_args += ['-DTRACY_NO_SAMPLING'] endif if get_option('tracy_no_verify') - add_project_arguments('-DTRACY_NO_VERIFY', language : 'cpp') + tracy_compile_args += ['-DTRACY_NO_VERIFY'] endif if get_option('tracy_no_vsync_capture') - add_project_arguments('-DTRACY_NO_VSYNC_CAPTURE', language : 'cpp') + tracy_compile_args += ['-DTRACY_NO_VSYNC_CAPTURE'] endif if get_option('tracy_no_frame_image') - add_project_arguments('-DTRACY_NO_FRAME_IMAGE', language : 'cpp') + tracy_compile_args += ['-DTRACY_NO_FRAME_IMAGE'] endif if get_option('tracy_no_system_tracing') - add_project_arguments('-DTRACY_NO_SYSTEM_TRACING', language : 'cpp') + tracy_compile_args += ['-DTRACY_NO_SYSTEM_TRACING'] endif if get_option('tracy_patchable_nopsleds') - add_project_arguments('-DTRACY_PATCHABLE_NOPSLEDS', language : 'cpp') + tracy_compile_args += ['-DTRACY_PATCHABLE_NOPSLEDS'] endif if get_option('tracy_delayed_init') - add_project_arguments('-DTRACY_DELAYED_INIT', language : 'cpp') + tracy_compile_args += ['-DTRACY_DELAYED_INIT'] endif if get_option('tracy_manual_lifetime') - add_project_arguments('-DTRACY_MANUAL_LIFETIME', language : 'cpp') + tracy_compile_args += ['-DTRACY_MANUAL_LIFETIME'] endif if get_option('tracy_fibers') - add_project_arguments('-DTRACY_FIBERS', language : 'cpp') + tracy_compile_args += ['-DTRACY_FIBERS'] endif if get_option('tracy_timer_fallback') - add_project_arguments('-DTRACY_TIMER_FALLBACK', language : 'cpp') + tracy_compile_args += ['-DTRACY_TIMER_FALLBACK'] endif tracy_shared_libs = get_option('tracy_shared_libs') @@ -90,9 +92,11 @@ if tracy_shared_libs endif if get_option('tracy_no_crash_handler') - add_project_arguments('-DTRACY_NO_CRASH_HANDLER', language : 'cpp') + tracy_compile_args += ['-DTRACY_NO_CRASH_HANDLER'] endif +add_project_arguments(tracy_compile_args, language : 'cpp') + threads_dep = dependency('threads') if host_machine.system() == 'windows' @@ -180,7 +184,7 @@ install_headers(includes) install_headers(common_includes, subdir : 'common') install_headers(client_includes, subdir : 'client') -tracy_dep_compile_args = [] +tracy_dep_compile_args = tracy_compile_args if tracy_shared_libs tracy_dep_compile_args += [ '-DTRACY_IMPORTS' ] From 170a07c46bdf93b290304a5f0d58f15dbdcf36a1 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 14 Oct 2023 08:35:13 +0400 Subject: [PATCH 4/6] meson: Fix header install dir --- meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 564841d846..4224a3f98a 100644 --- a/meson.build +++ b/meson.build @@ -180,7 +180,7 @@ else install : true) endif -install_headers(includes) +install_headers(includes, subdir : 'tracy') install_headers(common_includes, subdir : 'common') install_headers(client_includes, subdir : 'client') From 7a2ce9399883ad3b3f5c33bea389bef8c5d35742 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Sat, 14 Oct 2023 08:35:24 +0400 Subject: [PATCH 5/6] meson: Generate pkgconfig file Lets multiple projects use the same Tracy library. --- meson.build | 3 +++ 1 file changed, 3 insertions(+) diff --git a/meson.build b/meson.build index 4224a3f98a..6b20da4b91 100644 --- a/meson.build +++ b/meson.build @@ -190,6 +190,9 @@ if tracy_shared_libs tracy_dep_compile_args += [ '-DTRACY_IMPORTS' ] endif +pkg = import('pkgconfig') +pkg.generate(tracy, extra_cflags: tracy_dep_compile_args) + tracy_dep = declare_dependency( compile_args : tracy_dep_compile_args, link_with : tracy, From ed486bf3c7254fdc892535e0522e47480673e9a6 Mon Sep 17 00:00:00 2001 From: Ivan Molodetskikh Date: Thu, 19 Oct 2023 13:52:17 +0400 Subject: [PATCH 6/6] CI: Add basic meson build test --- .github/workflows/gcc.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/gcc.yml b/.github/workflows/gcc.yml index f5fd7b78b4..d578a15574 100644 --- a/.github/workflows/gcc.yml +++ b/.github/workflows/gcc.yml @@ -19,10 +19,10 @@ jobs: - uses: actions/checkout@v2 - name: Install linux libraries if: ${{ matrix.os == 'ubuntu-22.04' }} - run: sudo apt-get update && sudo apt-get -y install libdbus-1-dev libcapstone-dev libtbb-dev libdebuginfod-dev libxkbcommon-dev libegl-dev libwayland-dev + run: sudo apt-get update && sudo apt-get -y install libdbus-1-dev libcapstone-dev libtbb-dev libdebuginfod-dev libxkbcommon-dev libegl-dev libwayland-dev meson - name: Install macos libraries if: ${{ matrix.os == 'macOS-latest' }} - run: brew install capstone tbb pkg-config glfw + run: brew install capstone tbb pkg-config glfw meson - name: Profiler GUI run: make -j`nproc` -C profiler/build/unix debug release - name: Update utility @@ -35,6 +35,8 @@ jobs: run: make -j`nproc` -C import-chrome/build/unix debug release - name: Library run: make -j`nproc` -C library/unix debug release + - name: Library (meson) + run: meson setup -Dprefix=$PWD/install build && meson compile -C build && meson install -C build - name: Test application run: | make -j`nproc` -C test