Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
pistache
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
pistache
Commits
ba743da7
Unverified
Commit
ba743da7
authored
Apr 09, 2021
by
Kip
Committed by
GitHub
Apr 09, 2021
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #890 from Tachi107/meson-improvements-library-pkgconf
Meson improvements
parents
4674fd85
1b04c2dc
Changes
11
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
28 additions
and
163 deletions
+28
-163
.travis.yml
.travis.yml
+2
-1
CMakeModules/CheckAtomic.cmake
CMakeModules/CheckAtomic.cmake
+0
-78
README.md
README.md
+1
-1
debian/control
debian/control
+2
-1
debian/rules
debian/rules
+1
-0
examples/meson.build
examples/meson.build
+3
-1
include/pistache/meson.build
include/pistache/meson.build
+2
-0
libpistache.pc.in
libpistache.pc.in
+0
-12
meson.build
meson.build
+0
-52
src/meson.build
src/meson.build
+16
-16
tests/meson.build
tests/meson.build
+1
-1
No files found.
.travis.yml
View file @
ba743da7
...
@@ -269,9 +269,10 @@ before_script:
...
@@ -269,9 +269,10 @@ before_script:
-DPISTACHE_BUILD_EXAMPLES=true
-DPISTACHE_BUILD_EXAMPLES=true
-DPISTACHE_USE_SSL=false
-DPISTACHE_USE_SSL=false
# Meson release build
# Meson release build
, both libs
-
meson setup meson_build_release
-
meson setup meson_build_release
--buildtype=release
--buildtype=release
--default-library=both
-DPISTACHE_USE_SSL=true
-DPISTACHE_USE_SSL=true
# CMake debug build
# CMake debug build
...
...
CMakeModules/CheckAtomic.cmake
deleted
100644 → 0
View file @
4674fd85
# Source: https://github.com/llvm-mirror/llvm/blob/master/cmake/modules/CheckAtomic.cmake
# atomic builtins are required for threading support.
INCLUDE
(
CheckCXXSourceCompiles
)
INCLUDE
(
CheckLibraryExists
)
# Sometimes linking against libatomic is required for atomic ops, if
# the platform doesn't support lock-free atomics.
function
(
check_working_cxx_atomics varname
)
set
(
OLD_CMAKE_REQUIRED_FLAGS
${
CMAKE_REQUIRED_FLAGS
}
)
set
(
CMAKE_REQUIRED_FLAGS
"
${
CMAKE_REQUIRED_FLAGS
}
-std=c++11"
)
CHECK_CXX_SOURCE_COMPILES
(
"
#include <atomic>
std::atomic<int> x;
int main() {
return x;
}
"
${
varname
}
)
set
(
CMAKE_REQUIRED_FLAGS
${
OLD_CMAKE_REQUIRED_FLAGS
}
)
endfunction
(
check_working_cxx_atomics
)
function
(
check_working_cxx_atomics64 varname
)
set
(
OLD_CMAKE_REQUIRED_FLAGS
${
CMAKE_REQUIRED_FLAGS
}
)
set
(
CMAKE_REQUIRED_FLAGS
"-std=c++11
${
CMAKE_REQUIRED_FLAGS
}
"
)
CHECK_CXX_SOURCE_COMPILES
(
"
#include <atomic>
#include <cstdint>
std::atomic<uint64_t> x (0);
int main() {
uint64_t i = x.load(std::memory_order_relaxed);
return 0;
}
"
${
varname
}
)
set
(
CMAKE_REQUIRED_FLAGS
${
OLD_CMAKE_REQUIRED_FLAGS
}
)
endfunction
(
check_working_cxx_atomics64
)
# This isn't necessary on MSVC, so avoid command-line switch annoyance
# by only running on GCC-like hosts.
if
(
CMAKE_CXX_COMPILER_ID MATCHES
"Clang|GNU"
)
# First check if atomics work without the library.
check_working_cxx_atomics
(
HAVE_CXX_ATOMICS_WITHOUT_LIB
)
# If not, check if the library exists, and atomics work with it.
if
(
NOT HAVE_CXX_ATOMICS_WITHOUT_LIB
)
check_library_exists
(
atomic __atomic_fetch_add_4
""
HAVE_LIBATOMIC
)
if
(
HAVE_LIBATOMIC
)
list
(
APPEND CMAKE_REQUIRED_LIBRARIES
"atomic"
)
check_working_cxx_atomics
(
HAVE_CXX_ATOMICS_WITH_LIB
)
if
(
NOT HAVE_CXX_ATOMICS_WITH_LIB
)
message
(
FATAL_ERROR
"Host compiler must support std::atomic!"
)
endif
()
else
()
message
(
FATAL_ERROR
"Host compiler appears to require libatomic, but cannot find it."
)
endif
()
endif
()
endif
()
# Check for 64 bit atomic operations.
if
(
MSVC
)
set
(
HAVE_CXX_ATOMICS64_WITHOUT_LIB True
)
else
()
check_working_cxx_atomics64
(
HAVE_CXX_ATOMICS64_WITHOUT_LIB
)
endif
()
# If not, check if the library exists, and atomics work with it.
if
(
NOT HAVE_CXX_ATOMICS64_WITHOUT_LIB
)
check_library_exists
(
atomic __atomic_load_8
""
HAVE_CXX_LIBATOMICS64
)
if
(
HAVE_CXX_LIBATOMICS64
)
list
(
APPEND CMAKE_REQUIRED_LIBRARIES
"atomic"
)
check_working_cxx_atomics64
(
HAVE_CXX_ATOMICS64_WITH_LIB
)
if
(
NOT HAVE_CXX_ATOMICS64_WITH_LIB
)
message
(
FATAL_ERROR
"Host compiler must support 64-bit std::atomic!"
)
endif
()
else
()
message
(
FATAL_ERROR
"Host compiler appears to require libatomic for 64-bit operations, but cannot find it."
)
endif
()
endif
()
README.md
View file @
ba743da7
...
@@ -139,7 +139,7 @@ executable(
...
@@ -139,7 +139,7 @@ executable(
If you're using a Meson version older than 0.55.0 you'll have to use the "older" syntax for
`depependecy()`
:
If you're using a Meson version older than 0.55.0 you'll have to use the "older" syntax for
`depependecy()`
:
```
meson
```
meson
dependencies: dependency('pistache', fallback ['pistache', 'pistache_
static_
dep'])
dependencies: dependency('pistache', fallback ['pistache', 'pistache_dep'])
```
```
### CMake
### CMake
...
...
debian/control
View file @
ba743da7
...
@@ -28,7 +28,8 @@ Depends:
...
@@ -28,7 +28,8 @@ Depends:
${misc:Depends},
${misc:Depends},
pkg-config (>= 0.28),
pkg-config (>= 0.28),
libpistache0 (= ${binary:Version}),
libpistache0 (= ${binary:Version}),
libssl-dev
libssl-dev,
rapidjson-dev (>= 1.1.0)
Description: elegant C++ REST framework
Description: elegant C++ REST framework
Pistache is a C++ REST framework originally written by Mathieu Stefani at
Pistache is a C++ REST framework originally written by Mathieu Stefani at
Datacratic, since maintained by other volunteers. It is written in pure C++14
Datacratic, since maintained by other volunteers. It is written in pure C++14
...
...
debian/rules
View file @
ba743da7
...
@@ -44,6 +44,7 @@ SOURCE_DIR = $(abspath $(PACKAGE_DIR)/../)
...
@@ -44,6 +44,7 @@ SOURCE_DIR = $(abspath $(PACKAGE_DIR)/../)
# Configure source...
# Configure source...
override_dh_auto_configure:
override_dh_auto_configure:
dh_auto_configure -- \
dh_auto_configure -- \
--default-library=both \
-DPISTACHE_BUILD_EXAMPLES=true \
-DPISTACHE_BUILD_EXAMPLES=true \
-DPISTACHE_BUILD_TESTS=true \
-DPISTACHE_BUILD_TESTS=true \
-DPISTACHE_ENABLE_NETWORK_TESTS=false \
-DPISTACHE_ENABLE_NETWORK_TESTS=false \
...
...
examples/meson.build
View file @
ba743da7
...
@@ -8,6 +8,8 @@ pistache_example_files = [
...
@@ -8,6 +8,8 @@ pistache_example_files = [
'rest_description'
'rest_description'
]
]
threads_dep = dependency('threads')
foreach example_name : pistache_example_files
foreach example_name : pistache_example_files
executable('run'+example_name, example_name+'.cc', dependencies:
pistache_static_dep
)
executable('run'+example_name, example_name+'.cc', dependencies:
[pistache_dep, threads_dep]
)
endforeach
endforeach
include/pistache/meson.build
View file @
ba743da7
prefix = get_option('prefix')
configure_file(input: 'version.h.in', output: 'version.h', configuration: version_data_conf, install: get_option('PISTACHE_INSTALL'), install_dir: prefix/get_option('includedir')/'pistache')
configure_file(input: 'version.h.in', output: 'version.h', configuration: version_data_conf, install: get_option('PISTACHE_INSTALL'), install_dir: prefix/get_option('includedir')/'pistache')
install_headers([
install_headers([
...
...
libpistache.pc.in
deleted
100644 → 0
View file @
4674fd85
prefix=@prefix@
exec_prefix=@exec_prefix@
libdir=@libdir@
includedir=@includedir@
Name: libpistache
URL: http://pistache.io/
Description: An elegant C++ REST framework.
Version: @version@
Libs: -L'${libdir}/' @libs@
Libs.private: @libs_private@
Cflags: -I'${includedir}/'
meson.build
View file @
ba743da7
...
@@ -15,9 +15,6 @@ project(
...
@@ -15,9 +15,6 @@ project(
compiler = meson.get_compiler('cpp')
compiler = meson.get_compiler('cpp')
compiler_id = compiler.get_id()
compiler_id = compiler.get_id()
prefix = get_option('prefix')
pc_lib = '-lpistache'
pc_libs_private = ['-pthread']
# Wrapping arguments inside a call to get_supported_arguments so that only supported arguments get applied
# Wrapping arguments inside a call to get_supported_arguments so that only supported arguments get applied
# No need for -Wall -Wextra -Wpedantic, since warning_level is 3
# No need for -Wall -Wextra -Wpedantic, since warning_level is 3
...
@@ -28,49 +25,10 @@ if get_option('b_coverage')
...
@@ -28,49 +25,10 @@ if get_option('b_coverage')
add_project_arguments(compiler.get_supported_arguments(['-fstack-protector-all', '--param=ssp-buffer-size=4']), language: 'cpp')
add_project_arguments(compiler.get_supported_arguments(['-fstack-protector-all', '--param=ssp-buffer-size=4']), language: 'cpp')
endif
endif
##### BEGIN CheckAtomic.cmake
is_libatomic_needed = false
cxx_atomics_check_code = '''
#include <atomic>
std::atomic<int> x;
int main(){return x;}
'''
has_working_cxx_atomics = compiler.compiles(cxx_atomics_check_code, name: 'std::atomic')
if (compiler_id.contains('clang') or compiler_id.contains('gcc')) and not has_working_cxx_atomics
assert(compiler.has_function('__atomic_fetch_add_4', args: '-latomic'), 'Host compiler appears to require libatomic, but cannot find it.')
has_working_cxx_atomics = compiler.compiles(cxx_atomics_check_code, args: '-latomic', name: 'std::atomic with libatomic')
assert(has_working_cxx_atomics, 'Host compiler must support std::atomic!')
is_libatomic_needed = true
endif
cxx_atomics64_check_code = '''
#include <atomic>
#include <cstdint>
std::atomic<uint64_t> x(0);
int main() {
uint64_t i = x.load(std::memory_order_relaxed);
return 0;
}
'''
has_working_cxx_atomics64 = compiler.compiles(cxx_atomics64_check_code, name: 'std::atomic<uint64_t>')
if not has_working_cxx_atomics64
assert(compiler.has_function('__atomic_load_8', args: '-latomic'), 'Host compiler appears to require libatomic for 64-bit operations, but cannot find it.')
has_working_cxx_atomics = compiler.compiles(cxx_atomics_check_code, args: '-latomic', name: 'std::atomic<uint64_t> with libatomic')
assert(has_working_cxx_atomics, 'Host compiler must support 64-bit std::atomic')
is_libatomic_needed = true
endif
##### END CheckAtomic.cmake
if is_libatomic_needed
pc_libs_private += '-latomic'
endif
deps_libpistache = [dependency('threads'), dependency('RapidJSON', fallback: ['rapidjson', 'rapidjson_dep'])]
deps_libpistache = [dependency('threads'), dependency('RapidJSON', fallback: ['rapidjson', 'rapidjson_dep'])]
if get_option('PISTACHE_USE_SSL')
if get_option('PISTACHE_USE_SSL')
deps_libpistache += dependency('openssl')
deps_libpistache += dependency('openssl')
pc_libs_private += ['-lssl', '-lcrypto']
endif
endif
version_data_raw = ''
version_data_raw = ''
...
@@ -94,16 +52,6 @@ endforeach
...
@@ -94,16 +52,6 @@ endforeach
pistache_version_str = '.'.join([version_data_conf.get_unquoted('VERSION_MAJOR'), version_data_conf.get_unquoted('VERSION_MINOR'), version_data_conf.get_unquoted('VERSION_PATCH')])
pistache_version_str = '.'.join([version_data_conf.get_unquoted('VERSION_MAJOR'), version_data_conf.get_unquoted('VERSION_MINOR'), version_data_conf.get_unquoted('VERSION_PATCH')])
pistache_soversion_str = '.'.join([version_data_conf.get_unquoted('SONAME_VERSION_MAJOR'), version_data_conf.get_unquoted('SONAME_VERSION_MINOR')])
pistache_soversion_str = '.'.join([version_data_conf.get_unquoted('SONAME_VERSION_MAJOR'), version_data_conf.get_unquoted('SONAME_VERSION_MINOR')])
configure_file(input: 'libpistache.pc.in', output: 'libpistache.pc', install: get_option('PISTACHE_INSTALL'), install_dir: get_option('libdir')/'pkgconfig', configuration: {
'prefix': prefix,
'exec_prefix': prefix/get_option('bindir'),
'libdir': prefix/get_option('libdir'),
'libs': pc_lib,
'libs_private': ' '.join(pc_libs_private),
'includedir': prefix/get_option('includedir'),
'version': pistache_version_str+'-git'+version_data_conf.get_unquoted('VERSION_GIT_DATE')
})
incl_pistache = include_directories('include')
incl_pistache = include_directories('include')
subdir('include')
subdir('include')
...
...
src/meson.build
View file @
ba743da7
...
@@ -31,29 +31,29 @@ if get_option('PISTACHE_USE_SSL')
...
@@ -31,29 +31,29 @@ if get_option('PISTACHE_USE_SSL')
add_project_arguments('-DPISTACHE_USE_SSL', language: 'cpp')
add_project_arguments('-DPISTACHE_USE_SSL', language: 'cpp')
endif
endif
libpistache_static = static_library(
libpistache = library(
'pistache', pistache_common_src+pistache_server_src+pistache_client_src,
'pistache',
sources: pistache_common_src + pistache_server_src + pistache_client_src,
include_directories: incl_pistache,
include_directories: incl_pistache,
dependencies: deps_libpistache,
dependencies: deps_libpistache,
install: get_option('PISTACHE_INSTALL'),
install: get_option('PISTACHE_INSTALL'),
pic: get_option('b_staticpic')
)
libpistache_shared = shared_library(
'pistache', pistache_common_src+pistache_server_src+pistache_client_src,
version: pistache_version_str,
version: pistache_version_str,
soversion: pistache_soversion_str,
soversion: pistache_soversion_str,
include_directories: incl_pistache,
pic: get_option('b_staticpic')
dependencies: deps_libpistache,
install: get_option('PISTACHE_INSTALL')
)
)
pistache_static_dep = declare_dependency(link_with: libpistache_static, include_directories: incl_pistache)
pistache_dep = declare_dependency(link_with: libpistache, include_directories: incl_pistache)
pistache_shared_dep = declare_dependency(link_with: libpistache_shared, include_directories: incl_pistache)
if meson.version().version_compare('>=0.54.0')
if meson.version().version_compare('>=0.54.0')
if get_option('default_library') == 'static'
meson.override_dependency('pistache', pistache_dep)
meson.override_dependency('pistache', pistache_static_dep)
else
meson.override_dependency('pistache', pistache_shared_dep)
endif
endif
endif
pkg = import('pkgconfig')
pkg.generate(
libpistache,
name: 'Pistache',
description: 'An elegant C++ REST framework.',
url: 'http://pistache.io',
version: pistache_version_str+'-git'+version_data_conf.get_unquoted('VERSION_GIT_DATE'),
filebase: 'libpistache'
)
tests/meson.build
View file @
ba743da7
...
@@ -43,7 +43,7 @@ foreach test_name : pistache_test_files
...
@@ -43,7 +43,7 @@ foreach test_name : pistache_test_files
'run_'+test_name,
'run_'+test_name,
test_name+'.cc',
test_name+'.cc',
dependencies: [
dependencies: [
pistache_
shared_
dep,
pistache_dep,
gtest_main_dep,
gtest_main_dep,
curl_dep
curl_dep
]
]
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment