Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change meson target configs #81

Merged
merged 1 commit into from
Jul 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ on:

env:
TERM: dumb

ASAN_OPTIONS: halt_on_error=0
UBSAN_OPTIONS: print_stacktrace=1

permissions:
contents: read

Expand Down Expand Up @@ -75,7 +77,7 @@ jobs:
run: brew install meson ninja

- name: Build
run: ./dev build
run: ./dev testbuild

- name: Run
run: ./dev run
32 changes: 19 additions & 13 deletions dev
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,11 @@ function log {
echo $(color blue "[-- libcon4m --]" $@)
}

function meson_build {

function meson_init_target {
echo ${1} > .meson_last
rm deps/local 2>/dev/null
ln -s ${PWD}/deps/${OS}-${ARCH} ${PWD}/deps/local


if [[ ! -d ${1} ]]; then
if [[ -f ${1} ]]; then
rm -rf ${1}
Expand All @@ -47,6 +45,10 @@ function meson_build {
log meson setup ${@}
meson setup ${@}
fi
}

function meson_build {
meson_init_target ${@}
cd ${1}

log Compiling meson target ${1}
Expand Down Expand Up @@ -75,7 +77,6 @@ function meson_build {
}

function meson_hatrack {

if [[ ! -d ${1} ]]; then
if [[ -f ${1} ]]; then
rm -rf ${1}
Expand Down Expand Up @@ -111,7 +112,7 @@ function meson_hatrack {
}

function libcon4m_dev_usage {
echo "Usage: ./dev [build | run | release | debug | clean]"
echo "Usage: ./dev [build | run | release | debug | testbuild | clean]"
exit 1
}

Expand All @@ -121,13 +122,8 @@ function debug_it {
DEBUGGER=${DEBUGGER:-$(which lldb)}
cd debug
log "Running debugger:v${DEBUGGER}"
echo
echo $(color RED 'Recommended environment variables:')
echo $(color CYAN 'export ASAN_OPTIONS=halt_on_error=0')
echo $(color CYAN 'export UBSAN_OPTIONS=print_stacktrace=1;halt_on_error=0')
${DEBUGGER} ./c4test
cd ..

}

function libcon4m_run_tests {
Expand Down Expand Up @@ -162,7 +158,7 @@ function libcon4m_run_tests {
}

function libcon4m_dev_clean {
for item in build debug release; do
for item in build debug release cicd .meson_last; do
ee7 marked this conversation as resolved.
Show resolved Hide resolved
if [[ -d ${item} ]]; then
Copy link
Contributor

@ee7 ee7 Jul 6, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: .meson_last in the line above still looks strange to me.

Doesn't that always do nothing, because .meson.last is a file? Is the intention to read the contents of .meson.last, like TARGET elsewhere in this file?

log Cleaning ${item}
cd ${item}
Expand All @@ -183,10 +179,20 @@ case $1 in
;;
build) meson_build build --buildtype=plain
;;
debug) meson_build debug --buildtype=debug
meson configure debug -Duse_ubsan=true -Duse_asan=true -Duse_memcheck=true
debug) meson_init_target debug --buildtype=debug
meson configure debug -Duse_memcheck=true
meson_build debug
debug_it
;;
testbuild) meson_init_target cicd --buildtype=debug
meson configure cicd -Duse_memcheck=true
meson_build cicd
;;
sanitizers) meson_init_target sanitizers
meson configure sanitizers -Duse_ubsan=true -Duse_asan=true
meson build sanitizers
;;

release) meson_build release --buildtype=release
;;
run)
Expand Down
19 changes: 12 additions & 7 deletions meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,11 @@ endif

if (get_option('use_ubsan') == true)
c_args = c_args + ['-fsanitize=undefined',
'-fsanitize-recover=all'
]
'-fsanitize-recover=all'
]
link_args = link_args + ['-fsanitize=undefined',
'-fsanitize-recover=all'
]
Comment on lines 75 to +80
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: Indentation-wise, I was referring to the start of line 78, not the horizontal alignment of lines 79 and 80. But my understanding is the next minor meson release (1.5.0) will include a meson format command anyway.

endif

if (get_option('use_memcheck') == true)
Expand Down Expand Up @@ -230,11 +233,7 @@ libc4m = static_library('con4m',
dependencies : all_deps,
c_args : c4m_c_args,
link_args: link_args)
libhat = static_library('hatrack',
lib_src,
include_directories : incdir,
c_args : c_args,
link_args : link_args)


if get_option('build_con4m_dll') == true
library('con4m-dll',
Expand All @@ -253,6 +252,12 @@ executable('c4test', test_src,
link_with : libc4m)

if get_option('build_hatrack') == true
libhat = static_library('hatrack',
lib_src,
include_directories : incdir,
c_args : c_args,
link_args : link_args)

executable('hash', hash_test_src,
include_directories : incdir,
dependencies : all_deps,
Expand Down