Add civetweb dependency
This commit is contained in:
parent
7d1011405a
commit
1c50d59491
7 changed files with 135 additions and 0 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -8,3 +8,4 @@ subprojects/SQLiteCpp/
|
|||
subprojects/simdjson
|
||||
subprojects/restc-cpp
|
||||
subprojects/lest
|
||||
subprojects/civetweb
|
||||
|
|
|
@ -4,3 +4,4 @@ option('tests', type: 'feature', value: 'enabled')
|
|||
option('with_sqlite', type: 'feature', value: 'auto')
|
||||
option('rest_lib', type: 'combo', choices: ['nap', 'restc-cpp'], value: 'nap')
|
||||
option('with_lzma', type: 'feature', value: 'enabled')
|
||||
option('with_webserver', type: 'feature', value: 'disabled')
|
||||
|
|
|
@ -15,6 +15,22 @@ curlcpp_dep = dependency('curlcpp', version: '>=1.4',
|
|||
],
|
||||
)
|
||||
|
||||
civetweb_dep = dependency('civetweb', version: '>=1.12',
|
||||
required: get_option('with_webserver'),
|
||||
fallback: ['civetweb', 'civetweb_dep'],
|
||||
default_options: [
|
||||
'civetweb_cxx=enabled',
|
||||
'civetweb_ssl_dynamic_loading=disabled',
|
||||
'civetweb_ssl=auto',
|
||||
'civetweb_serve_files=false',
|
||||
'civetweb_serve_filesystems=false',
|
||||
'civetweb_enable_ipv6=true',
|
||||
'civetweb_enable_server_executable=false',
|
||||
'civetweb_enable_cgi=false',
|
||||
'civetweb_enable_caching=true',
|
||||
],
|
||||
)
|
||||
|
||||
lzma_dep = dependency('liblzma', required: get_option('with_lzma'), version: '>=5.2.5')
|
||||
|
||||
simdjson_dep = dependency('simdjson', version: '>=0.5.0',
|
||||
|
@ -90,6 +106,7 @@ lib_deps = [
|
|||
curlcpp_dep,
|
||||
simdjson_dep,
|
||||
lzma_dep,
|
||||
civetweb_dep,
|
||||
] + backend_libs
|
||||
|
||||
if get_option('rest_lib') == 'nap'
|
||||
|
|
7
subprojects/civetweb.wrap
Normal file
7
subprojects/civetweb.wrap
Normal file
|
@ -0,0 +1,7 @@
|
|||
[wrap-git]
|
||||
url = https://github.com/civetweb/civetweb.git
|
||||
revision = 4b440a339979852d5a51fb11a822952712231c23
|
||||
patch_directory = civetweb
|
||||
|
||||
[provide]
|
||||
dependency_names = civetweb-1.12
|
37
subprojects/packagefiles/civetweb/meson.build
Normal file
37
subprojects/packagefiles/civetweb/meson.build
Normal file
|
@ -0,0 +1,37 @@
|
|||
project('civetweb', 'c',
|
||||
version: '1.12',
|
||||
meson_version: '>=0.49.2',
|
||||
default_options: ['buildtype=release', 'c_std=c11', 'cpp_std=c++17', 'b_ndebug=if-release'],
|
||||
license: 'MIT',
|
||||
)
|
||||
|
||||
has_cpp = add_languages('cpp', required: get_option('civetweb_cxx'))
|
||||
|
||||
compiler_opts = []
|
||||
if get_option('civetweb_enable_ipv6')
|
||||
compiler_opts += ['-DUSE_IPV6']
|
||||
endif
|
||||
if get_option('civetweb_serve_files')
|
||||
compiler_opts += ['-DUSE_SERVER_STATS']
|
||||
endif
|
||||
if not get_option('civetweb_serve_files')
|
||||
compiler_opts += ['-DNO_FILES']
|
||||
endif
|
||||
if get_option('civetweb_ssl_openssl_api') == '1.0'
|
||||
compiler_opts += ['-DOPENSSL_API_1_1']
|
||||
elif get_option('civetweb_ssl_openssl_api') == '1.1'
|
||||
compiler_opts += ['-DOPENSSL_API_1_1']
|
||||
endif
|
||||
compiler_opts += ['-DUSE_STACK_SIZE=' + get_option('civetweb_thread_stack_size').to_string()]
|
||||
if not get_option('civetweb_serve_filesystems')
|
||||
compiler_opts += ['-DNO_FILESYSTEMS']
|
||||
endif
|
||||
if not get_option('civetweb_enable_cgi')
|
||||
compiler_opts += ['-DNO_CGI']
|
||||
endif
|
||||
if not get_option('civetweb_enable_caching')
|
||||
compiler_opts += ['-DNO_CACHING']
|
||||
endif
|
||||
|
||||
public_incl = include_directories('include')
|
||||
subdir('src')
|
15
subprojects/packagefiles/civetweb/meson_options.txt
Normal file
15
subprojects/packagefiles/civetweb/meson_options.txt
Normal file
|
@ -0,0 +1,15 @@
|
|||
option('civetweb_cxx', type: 'feature', value: 'disabled', description: 'Enables the C++ wrapper library')
|
||||
option('civetweb_lua', type: 'feature', value: 'disabled', description: 'Enable Lua CGIs')
|
||||
option('civetweb_ssl', type: 'feature', value: 'enabled', description: 'Enables the secure socket layer')
|
||||
option('civetweb_ssl_dynamic_loading', type: 'feature', value: 'auto', description: 'Dynamically loads the SSL library rather than linking it')
|
||||
option('civetweb_serve_files', type: 'boolean', value: 'true', description: 'Configures the server to serve static files')
|
||||
option('civetweb_serve_filesystems', type: 'boolean', value: 'true')
|
||||
option('civetweb_enable_ipv6', type: 'boolean', value: 'false', description: 'Enables the IP version 6 support')
|
||||
option('civetweb_enable_websockets', type: 'boolean', value: 'false', description: 'Enable websockets connections')
|
||||
option('civetweb_enable_server_stats', type: 'boolean', value: 'false', description: 'Enable server statistics')
|
||||
option('civetweb_enable_server_executable', type: 'boolean', value: 'true', description: 'Enable building of the server executable')
|
||||
option('civetweb_ssl_openssl_api', type: 'combo', choices: ['1.0', '1.1'], value: '1.1', description: 'Version of the OpenSSL API to use')
|
||||
option('civetweb_thread_stack_size', type: 'integer', value: 102400, description: 'The stack size in bytes for each thread created')
|
||||
option('civetweb_install_executable', type: 'boolean', value: 'false', description: 'Enable installing CivetWeb executable')
|
||||
option('civetweb_enable_cgi', type: 'boolean', value: 'true', description: 'Enables CGI, so theserver will execute CGI scripts')
|
||||
option('civetweb_enable_caching', type: 'boolean', value: 'true', description: 'Enables caching, timegm is used')
|
57
subprojects/packagefiles/civetweb/src/meson.build
Normal file
57
subprojects/packagefiles/civetweb/src/meson.build
Normal file
|
@ -0,0 +1,57 @@
|
|||
dl_dep = meson.get_compiler('c').find_library('dl', required: get_option('civetweb_ssl_dynamic_loading'))
|
||||
threads_dep = dependency('threads')
|
||||
openssl_dep = dependency('openssl', required: get_option('civetweb_ssl'))
|
||||
lua_dep = dependency('lua', required: get_option('civetweb_lua'))
|
||||
|
||||
if not openssl_dep.found()
|
||||
compiler_opts += ['-DNO_SSL']
|
||||
endif
|
||||
if not dl_dep.found()
|
||||
compiler_opts += ['-DNO_SSL_DL']
|
||||
endif
|
||||
if lua_dep.found()
|
||||
compiler_opts += ['-DUSE_LUA']
|
||||
endif
|
||||
|
||||
civetweb_lib = library('civetweb-c-library',
|
||||
'civetweb.c',
|
||||
install: true,
|
||||
c_args: compiler_opts,
|
||||
include_directories: public_incl,
|
||||
dependencies: [
|
||||
dl_dep,
|
||||
threads_dep,
|
||||
openssl_dep,
|
||||
lua_dep,
|
||||
],
|
||||
)
|
||||
|
||||
link_with_libs = [civetweb_lib]
|
||||
|
||||
if has_cpp
|
||||
civetwebpp_lib = library('civetweb-cpp',
|
||||
'CivetServer.cpp',
|
||||
cpp_args: compiler_opts + ['-DCIVETWEB_CXX_DLL_EXPORTS'],
|
||||
include_directories: public_incl,
|
||||
link_with: civetweb_lib,
|
||||
)
|
||||
link_with_libs += [civetwebpp_lib]
|
||||
endif
|
||||
|
||||
civetweb_dep = declare_dependency(
|
||||
link_with: link_with_libs,
|
||||
include_directories: public_incl,
|
||||
compile_args: compiler_opts,
|
||||
)
|
||||
|
||||
if get_option('civetweb_enable_server_executable')
|
||||
executable('civetweb-c-executable',
|
||||
'main.c',
|
||||
include_directories: public_incl,
|
||||
install: get_option('civetweb_install_executable'),
|
||||
compile_args: compiler_opts,
|
||||
dependencies: [
|
||||
civetweb_dep,
|
||||
]
|
||||
)
|
||||
endif
|
Loading…
Reference in a new issue