Skip to content

Commit

Permalink
Merge pull request #641 from YaLTeR/meson-improvements
Browse files Browse the repository at this point in the history
Meson improvements
  • Loading branch information
wolfpld authored Oct 19, 2023
2 parents aae4d25 + ed486bf commit 7f5cfdf
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 30 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/gcc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
59 changes: 31 additions & 28 deletions meson.build
Original file line number Diff line number Diff line change
@@ -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')
Expand All @@ -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'
Expand Down Expand Up @@ -134,7 +138,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',
Expand Down Expand Up @@ -177,22 +180,22 @@ else
install : true)
endif

install_headers(includes)
install_headers(includes, subdir : 'tracy')
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' ]
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,
include_directories : tracy_public_include_dirs)

tracy_dep_dynamic = declare_dependency(
include_directories : tracy_public_include_dirs)

meson.override_dependency('tracy', tracy_dep)

0 comments on commit 7f5cfdf

Please sign in to comment.