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

build(meson): automatically use poll or select as needed #2067

Merged
merged 1 commit into from
Feb 19, 2025
Merged
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
11 changes: 10 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,26 @@ project(
meson_version: '>=0.62.0'
)

cxx = meson.get_compiler('cpp')

# Check just in case downstream decides to edit the source
# and add a project version
version = meson.project_version()
if version == 'undefined'
cxx = meson.get_compiler('cpp')
version = cxx.get_define('CPPHTTPLIB_VERSION',
prefix: '#include <httplib.h>',
include_directories: include_directories('.')).strip('"')
assert(version != '', 'failed to get version from httplib.h')
endif

if cxx.has_function('poll', prefix: '#include <poll.h>')
# Use poll if present
add_project_arguments('-DCPPHTTPLIB_USE_POLL', language: 'cpp')
else if cxx.has_function('select', prefix: '#include <sys/select.h>')
# Use select otherwise
add_project_arguments('-DCPPHTTPLIB_USE_SELECT', language: 'cpp')
endif

deps = [dependency('threads')]
args = []

Expand Down
Loading