build: update the meson build configuration
This commit is contained in:
parent
f86989bc67
commit
f4438831a6
@ -38,11 +38,9 @@ target_link_libraries(cruft ${NC_CXX_STDCXXFS})
|
|||||||
# Setup a directory to hold built sources we may need to export to clients.
|
# Setup a directory to hold built sources we may need to export to clients.
|
||||||
set (PREFIX "cruft/util")
|
set (PREFIX "cruft/util")
|
||||||
file (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}")
|
file (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}")
|
||||||
target_include_directories(
|
target_include_directories(cruft PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}")
|
||||||
cruft
|
target_include_directories(cruft PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/prefix/")
|
||||||
PUBLIC
|
target_include_directories(cruft INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/prefix/")
|
||||||
"${CMAKE_CURRENT_BINARY_DIR}/prefix/"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
# Preemptively define an identity panic macro so that TCL doens't fuck us over
|
# Preemptively define an identity panic macro so that TCL doens't fuck us over
|
||||||
@ -579,6 +577,7 @@ foreach (tool cpuid poisson macro scratch)
|
|||||||
set_target_properties (util_${tool} PROPERTIES OUTPUT_NAME ${tool})
|
set_target_properties (util_${tool} PROPERTIES OUTPUT_NAME ${tool})
|
||||||
target_link_libraries (util_${tool} cruft)
|
target_link_libraries (util_${tool} cruft)
|
||||||
target_include_directories(util_${tool} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(util_${tool} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
target_include_directories(util_${tool} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}")
|
||||||
endforeach ()
|
endforeach ()
|
||||||
|
|
||||||
|
|
||||||
@ -715,6 +714,7 @@ if (TESTS)
|
|||||||
add_executable(util_${name} test/${t}.cpp)
|
add_executable(util_${name} test/${t}.cpp)
|
||||||
target_link_libraries(util_${name} PRIVATE cruft)
|
target_link_libraries(util_${name} PRIVATE cruft)
|
||||||
target_include_directories(util_${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
target_include_directories(util_${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
||||||
|
target_include_directories(util_${name} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}")
|
||||||
add_test(NAME util_${name} COMMAND util_${name})
|
add_test(NAME util_${name} COMMAND util_${name})
|
||||||
set_tests_properties(util_${name} PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -")
|
set_tests_properties(util_${name} PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -")
|
||||||
add_dependencies(util_test util_${name})
|
add_dependencies(util_test util_${name})
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
#include "../maths.hpp"
|
#include "../maths.hpp"
|
||||||
#include "../types/bits.hpp"
|
#include "../types/bits.hpp"
|
||||||
|
|
||||||
#include <cruft/util/preprocessor.hpp>
|
#include "preprocessor.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
@ -13,7 +13,7 @@
|
|||||||
|
|
||||||
#include "../platform.hpp"
|
#include "../platform.hpp"
|
||||||
|
|
||||||
#include <cruft/util/preprocessor.hpp>
|
#include "preprocessor.hpp"
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <type_traits>
|
#include <type_traits>
|
||||||
|
@ -8,7 +8,7 @@
|
|||||||
|
|
||||||
#include "./validate.hpp"
|
#include "./validate.hpp"
|
||||||
|
|
||||||
#include <cruft/util/preprocessor.hpp>
|
#include "preprocessor.hpp"
|
||||||
|
|
||||||
#include <cmath>
|
#include <cmath>
|
||||||
|
|
||||||
|
@ -11,7 +11,7 @@
|
|||||||
#include "std.hpp"
|
#include "std.hpp"
|
||||||
#include "variadic.hpp"
|
#include "variadic.hpp"
|
||||||
|
|
||||||
#include <cruft/util/preprocessor.hpp>
|
#include "preprocessor.hpp"
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <array>
|
#include <array>
|
||||||
|
2
log.hpp
2
log.hpp
@ -11,7 +11,7 @@
|
|||||||
|
|
||||||
#include "format.hpp"
|
#include "format.hpp"
|
||||||
|
|
||||||
#include <cruft/util/preprocessor.hpp>
|
#include "preprocessor.hpp"
|
||||||
|
|
||||||
#include <iosfwd>
|
#include <iosfwd>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
@ -7,18 +7,3 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#include "deleter.hpp"
|
#include "deleter.hpp"
|
||||||
|
|
||||||
using cruft::memory::owner_deleter;
|
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// This instantiation isn't required but it allows us to catch compilation
|
|
||||||
// errors early within this library rather than at a call site in another
|
|
||||||
// library.
|
|
||||||
|
|
||||||
class owner {
|
|
||||||
void dealloc (void*);
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
template class cruft::memory::owner_deleter<void,owner,&owner::dealloc>;
|
|
||||||
|
584
meson.build
584
meson.build
@ -3,7 +3,11 @@ project('cruft', 'cpp')
|
|||||||
pymod = import('python')
|
pymod = import('python')
|
||||||
python = pymod.find_installation('python3')
|
python = pymod.find_installation('python3')
|
||||||
|
|
||||||
ragel = generator(find_program('ragel'), output: '@BASENAME@.cpp', arguments: [ '@INPUT@', '-o@OUTPUT@', '-G2' ])
|
ragel = generator(
|
||||||
|
find_program('ragel'),
|
||||||
|
output: '@BASENAME@.cpp',
|
||||||
|
arguments: [ '@INPUT@', '-o@OUTPUT@', '-G2' ]
|
||||||
|
)
|
||||||
|
|
||||||
if host_machine.endian() == 'big'
|
if host_machine.endian() == 'big'
|
||||||
add_project_arguments('-DWORDS_BIGENDIAN')
|
add_project_arguments('-DWORDS_BIGENDIAN')
|
||||||
@ -21,24 +25,16 @@ sources = [
|
|||||||
ragel.process('time/parse8601.cpp.rl'),
|
ragel.process('time/parse8601.cpp.rl'),
|
||||||
]
|
]
|
||||||
|
|
||||||
dependencies = []
|
dependencies = [
|
||||||
|
dependency('threads')
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
### Setup a directory to hold built sources we may need to export to clients.
|
|
||||||
##set (PREFIX "cruft/util")
|
|
||||||
##file (MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}")
|
|
||||||
##target_include_directories(
|
|
||||||
## cruft
|
|
||||||
## PUBLIC
|
|
||||||
## "${CMAKE_CURRENT_BINARY_DIR}/prefix/"
|
|
||||||
##)
|
|
||||||
##
|
|
||||||
##
|
|
||||||
### Preemptively define an identity panic macro so that TCL doens't fuck us over
|
### Preemptively define an identity panic macro so that TCL doens't fuck us over
|
||||||
### by renaming a commonly used symbol.
|
### by renaming a commonly used symbol.
|
||||||
##target_compile_definitions(cruft PUBLIC "-Dpanic=panic")
|
add_project_arguments('-Dpanic=panic', language: 'cpp')
|
||||||
##
|
|
||||||
##
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
cpp = meson.get_compiler('cpp')
|
cpp = meson.get_compiler('cpp')
|
||||||
execinfo = cpp.find_library('execinfo', required: false) # sym:backtrace
|
execinfo = cpp.find_library('execinfo', required: false) # sym:backtrace
|
||||||
@ -55,30 +51,14 @@ else
|
|||||||
endif
|
endif
|
||||||
|
|
||||||
|
|
||||||
####-----------------------------------------------------------------------------
|
sources += custom_target(
|
||||||
#### We shouldn't be building into the source directory, but I can't stand trying
|
|
||||||
#### to coax CMake into behaving here any longer. Feel free to fix it.
|
|
||||||
##add_custom_command (
|
|
||||||
##OUTPUT
|
|
||||||
## "${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}/preprocessor.hpp"
|
|
||||||
##COMMENT
|
|
||||||
## "[preprocessor.py] preprocessor.hpp"
|
|
||||||
##COMMAND
|
|
||||||
## "${PYTHON_EXECUTABLE}"
|
|
||||||
## "${CMAKE_CURRENT_SOURCE_DIR}/preprocessor.py"
|
|
||||||
## "${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}/preprocessor.hpp"
|
|
||||||
## 320
|
|
||||||
##DEPENDS
|
|
||||||
## "${CMAKE_CURRENT_SOURCE_DIR}/preprocessor.py"
|
|
||||||
##)
|
|
||||||
|
|
||||||
preprocessor_hpp = custom_target(
|
|
||||||
'preprocessor.hpp',
|
'preprocessor.hpp',
|
||||||
output: 'preprocessor.hpp',
|
output: 'preprocessor.hpp',
|
||||||
input: 'preprocessor.py',
|
input: 'preprocessor.py',
|
||||||
command: [python, '@INPUT@', '@OUTPUT@', '320'],
|
command: [python, '@INPUT@', '@OUTPUT@', '480'],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
### Platform wrappers
|
### Platform wrappers
|
||||||
systems = {
|
systems = {
|
||||||
@ -133,30 +113,29 @@ endif
|
|||||||
|
|
||||||
|
|
||||||
####-----------------------------------------------------------------------------
|
####-----------------------------------------------------------------------------
|
||||||
##if (WIN32)
|
if host_machine.system() == 'windows'
|
||||||
## list (
|
sources += [
|
||||||
## APPEND UTIL_FILES
|
'debug_win32.cpp',
|
||||||
## debug_win32.cpp
|
'exe_win32.cpp',
|
||||||
## exe_win32.cpp
|
'io_win32.cpp',
|
||||||
## io_win32.cpp
|
'io_win32.hpp',
|
||||||
## io_win32.hpp
|
'thread/event_win32.cpp',
|
||||||
## thread/event_win32.cpp
|
'library_win32.cpp',
|
||||||
## library_win32.cpp
|
'library_win32.hpp',
|
||||||
## library_win32.hpp
|
'time_win32.cpp',
|
||||||
## time_win32.cpp
|
'win32/windows.hpp',
|
||||||
## win32/windows.hpp
|
'win32/except.cpp',
|
||||||
## win32/except.cpp
|
'win32/except.hpp',
|
||||||
## win32/except.hpp
|
'win32/file.cpp',
|
||||||
## win32/file.cpp
|
'win32/file.hpp',
|
||||||
## win32/file.hpp
|
'win32/handle.cpp',
|
||||||
## win32/handle.cpp
|
'win32/handle.hpp',
|
||||||
## win32/handle.hpp
|
'win32/registry.cpp',
|
||||||
## win32/registry.cpp
|
'win32/registry.hpp',
|
||||||
## win32/registry.hpp
|
]
|
||||||
## )
|
|
||||||
##
|
dependencies += cpp.find_library('ws2_32')
|
||||||
## target_link_libraries (cruft ws2_32)
|
endif
|
||||||
##endif ()
|
|
||||||
|
|
||||||
|
|
||||||
sources += [
|
sources += [
|
||||||
@ -175,27 +154,50 @@ if host_machine.system() == 'linux'
|
|||||||
'thread/flag_futex.cpp',
|
'thread/flag_futex.cpp',
|
||||||
'thread/flag_futex.hpp',
|
'thread/flag_futex.hpp',
|
||||||
]
|
]
|
||||||
|
elif host_name.system() == 'windows'
|
||||||
|
sources += [
|
||||||
|
'thread/event_std.cpp',
|
||||||
|
'thread/event_std.hpp',
|
||||||
|
'thread/semaphore_win32.hpp',
|
||||||
|
'thread/semaphore_win32.cpp',
|
||||||
|
'thread/flag_std.cpp',
|
||||||
|
'thread/flag_std.hpp',
|
||||||
|
]
|
||||||
else
|
else
|
||||||
error('Unknown platform for threading')
|
error('Unknown platform for threading')
|
||||||
endif
|
endif
|
||||||
|
|
||||||
##elseif (WIN32)
|
|
||||||
## list (APPEND UTIL_FILES
|
if host_machine.cpu_family() == 'x86_64'
|
||||||
## thread/event_std.cpp
|
sources += [
|
||||||
## thread/event_std.hpp
|
'cpuid/x86.cpp',
|
||||||
## thread/semaphore_win32.hpp
|
'cpuid/x86.cpp',
|
||||||
## thread/semaphore_win32.cpp
|
]
|
||||||
## thread/flag_std.cpp
|
else
|
||||||
## thread/flag_std.hpp
|
warning('Unknown architecture @0@. Defaulting to null cpuid'.format(host_machine.cpu_family()))
|
||||||
## )
|
sources += [
|
||||||
##else ()
|
'cpuid/none.cpp',
|
||||||
## list (APPEND UTIL_FILES
|
'cpuid/none.hpp',
|
||||||
## thread/flag_std.cpp
|
]
|
||||||
## thread/flag_std.hpp
|
endif
|
||||||
## )
|
|
||||||
##endif ()
|
|
||||||
##
|
|
||||||
##
|
if host_machine.system() == 'linux'
|
||||||
|
sources += [
|
||||||
|
'rand/system_linux.cpp',
|
||||||
|
'rand/system_linux.hpp',
|
||||||
|
]
|
||||||
|
elif host_machine.system() == 'windows'
|
||||||
|
sources += [
|
||||||
|
'rand/system_win32.cpp',
|
||||||
|
'rand/system_win32.hpp',
|
||||||
|
]
|
||||||
|
else
|
||||||
|
error('Unsupported system for rand')
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
### Common files
|
### Common files
|
||||||
sources += [
|
sources += [
|
||||||
@ -231,6 +233,7 @@ sources += [
|
|||||||
'array/sarray.hpp',
|
'array/sarray.hpp',
|
||||||
'array/parray.cpp',
|
'array/parray.cpp',
|
||||||
'array/parray.hpp',
|
'array/parray.hpp',
|
||||||
|
'array/varray.hpp',
|
||||||
'ascii.hpp',
|
'ascii.hpp',
|
||||||
'backtrace.hpp',
|
'backtrace.hpp',
|
||||||
'bezier.cpp',
|
'bezier.cpp',
|
||||||
@ -248,9 +251,10 @@ sources += [
|
|||||||
'cmdopt.hpp',
|
'cmdopt.hpp',
|
||||||
'colour.cpp',
|
'colour.cpp',
|
||||||
'colour.hpp',
|
'colour.hpp',
|
||||||
|
'coord.hpp',
|
||||||
'coord/fwd.hpp',
|
'coord/fwd.hpp',
|
||||||
'coord/base.hpp',
|
'coord/base.hpp',
|
||||||
'coord.hpp',
|
'coord/comparator.hpp',
|
||||||
'coord/init.hpp',
|
'coord/init.hpp',
|
||||||
'coord/iostream.hpp',
|
'coord/iostream.hpp',
|
||||||
'coord/ops.hpp',
|
'coord/ops.hpp',
|
||||||
@ -260,10 +264,18 @@ sources += [
|
|||||||
'cpp.hpp',
|
'cpp.hpp',
|
||||||
'cpuid.cpp',
|
'cpuid.cpp',
|
||||||
'cpuid.hpp',
|
'cpuid.hpp',
|
||||||
'cpuid_x86.cpp',
|
'debug/assert.cpp',
|
||||||
'cpuid_x86.hpp',
|
'debug/assert.hpp',
|
||||||
'debug.cpp',
|
'debug/compiler.cpp',
|
||||||
'debug.hpp',
|
'debug/compiler.hpp',
|
||||||
|
'debug/debugger.cpp',
|
||||||
|
'debug/debugger.hpp',
|
||||||
|
'debug/panic.cpp',
|
||||||
|
'debug/panic.hpp',
|
||||||
|
'debug/system.cpp',
|
||||||
|
'debug/system.hpp',
|
||||||
|
'debug/validate.cpp',
|
||||||
|
'debug/validate.hpp',
|
||||||
'encode/number.hpp',
|
'encode/number.hpp',
|
||||||
'encode/base.cpp',
|
'encode/base.cpp',
|
||||||
'encode/base.hpp',
|
'encode/base.hpp',
|
||||||
@ -272,6 +284,7 @@ sources += [
|
|||||||
'except.cpp',
|
'except.cpp',
|
||||||
'except.hpp',
|
'except.hpp',
|
||||||
'exe.hpp',
|
'exe.hpp',
|
||||||
|
'expected.hpp',
|
||||||
'extent.cpp',
|
'extent.cpp',
|
||||||
'extent.hpp',
|
'extent.hpp',
|
||||||
'fixed.cpp',
|
'fixed.cpp',
|
||||||
@ -316,6 +329,7 @@ sources += [
|
|||||||
'hash/fwd.hpp',
|
'hash/fwd.hpp',
|
||||||
'hash/adler.cpp',
|
'hash/adler.cpp',
|
||||||
'hash/adler.hpp',
|
'hash/adler.hpp',
|
||||||
|
'hash/buzhash.hpp',
|
||||||
'hash/bsdsum.cpp',
|
'hash/bsdsum.cpp',
|
||||||
'hash/bsdsum.hpp',
|
'hash/bsdsum.hpp',
|
||||||
'hash/crc.cpp',
|
'hash/crc.cpp',
|
||||||
@ -337,6 +351,8 @@ sources += [
|
|||||||
'hash/murmur/murmur3.hpp',
|
'hash/murmur/murmur3.hpp',
|
||||||
'hash/siphash.cpp',
|
'hash/siphash.cpp',
|
||||||
'hash/siphash.hpp',
|
'hash/siphash.hpp',
|
||||||
|
'hash/table.cpp',
|
||||||
|
'hash/table.hpp',
|
||||||
'hash/wang.hpp',
|
'hash/wang.hpp',
|
||||||
'hash/xxhash.cpp',
|
'hash/xxhash.cpp',
|
||||||
'hash/xxhash.hpp',
|
'hash/xxhash.hpp',
|
||||||
@ -344,7 +360,18 @@ sources += [
|
|||||||
'introspection.hpp',
|
'introspection.hpp',
|
||||||
'io.cpp',
|
'io.cpp',
|
||||||
'io.hpp',
|
'io.hpp',
|
||||||
'iterator.hpp',
|
'iterator/constant.hpp',
|
||||||
|
'iterator/counting.hpp',
|
||||||
|
'iterator/dereference.hpp',
|
||||||
|
'iterator/discard.hpp',
|
||||||
|
'iterator/indices.hpp',
|
||||||
|
'iterator/infix.hpp',
|
||||||
|
'iterator/iota.hpp',
|
||||||
|
'iterator/numeric.hpp',
|
||||||
|
'iterator/referencing.hpp',
|
||||||
|
'iterator/transform.hpp',
|
||||||
|
'iterator/unequal.hpp',
|
||||||
|
'iterator/zip.hpp',
|
||||||
'job/fwd.hpp',
|
'job/fwd.hpp',
|
||||||
'job/dispatch.hpp',
|
'job/dispatch.hpp',
|
||||||
'job/queue.cpp',
|
'job/queue.cpp',
|
||||||
@ -353,6 +380,8 @@ sources += [
|
|||||||
'library.hpp',
|
'library.hpp',
|
||||||
'log.cpp',
|
'log.cpp',
|
||||||
'log.hpp',
|
'log.hpp',
|
||||||
|
'map/fixed.cpp',
|
||||||
|
'map/fixed.hpp',
|
||||||
'maths.cpp',
|
'maths.cpp',
|
||||||
'maths.hpp',
|
'maths.hpp',
|
||||||
'maths/fast.hpp',
|
'maths/fast.hpp',
|
||||||
@ -363,11 +392,19 @@ sources += [
|
|||||||
'matrix.hpp',
|
'matrix.hpp',
|
||||||
'memory/deleter.cpp',
|
'memory/deleter.cpp',
|
||||||
'memory/deleter.hpp',
|
'memory/deleter.hpp',
|
||||||
'nocopy.hpp',
|
|
||||||
'parallel/queue.cpp',
|
'parallel/queue.cpp',
|
||||||
'parallel/queue.hpp',
|
'parallel/queue.hpp',
|
||||||
'parse.cpp',
|
'parallel/stack.cpp',
|
||||||
'parse.hpp',
|
'parallel/stack.hpp',
|
||||||
|
'parse/fwd.hpp',
|
||||||
|
'parse/enum.cpp',
|
||||||
|
'parse/enum.hpp',
|
||||||
|
'parse/time.cpp',
|
||||||
|
'parse/time.hpp',
|
||||||
|
'parse/value.cpp',
|
||||||
|
'parse/value.hpp',
|
||||||
|
'parse/si.cpp',
|
||||||
|
'parse/si.hpp',
|
||||||
'platform.hpp',
|
'platform.hpp',
|
||||||
'point.cpp',
|
'point.cpp',
|
||||||
'point.hpp',
|
'point.hpp',
|
||||||
@ -376,8 +413,6 @@ sources += [
|
|||||||
'polynomial.hpp',
|
'polynomial.hpp',
|
||||||
'pool.cpp',
|
'pool.cpp',
|
||||||
'pool.hpp',
|
'pool.hpp',
|
||||||
#'"${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}/preprocessor.hpp"',
|
|
||||||
preprocessor_hpp,
|
|
||||||
'quaternion.cpp',
|
'quaternion.cpp',
|
||||||
'quaternion.hpp',
|
'quaternion.hpp',
|
||||||
'rand/lcg.cpp',
|
'rand/lcg.cpp',
|
||||||
@ -386,6 +421,11 @@ sources += [
|
|||||||
'rand/xorshift.hpp',
|
'rand/xorshift.hpp',
|
||||||
'rand/mwc64x.cpp',
|
'rand/mwc64x.cpp',
|
||||||
'rand/mwc64x.hpp',
|
'rand/mwc64x.hpp',
|
||||||
|
'rand/pcg.cpp',
|
||||||
|
'rand/pcg.hpp',
|
||||||
|
'rand/rdrand.cpp',
|
||||||
|
'rand/rdrand.hpp',
|
||||||
|
'rand/system.hpp',
|
||||||
'random.cpp',
|
'random.cpp',
|
||||||
'random.hpp',
|
'random.hpp',
|
||||||
'range.cpp',
|
'range.cpp',
|
||||||
@ -394,12 +434,12 @@ sources += [
|
|||||||
'rational.hpp',
|
'rational.hpp',
|
||||||
'region.cpp',
|
'region.cpp',
|
||||||
'region.hpp',
|
'region.hpp',
|
||||||
|
'registrar.cpp',
|
||||||
|
'registrar.hpp',
|
||||||
'roots/bisection.hpp',
|
'roots/bisection.hpp',
|
||||||
'scoped.hpp',
|
'scoped.hpp',
|
||||||
'si.cpp',
|
|
||||||
'signal.cpp',
|
'signal.cpp',
|
||||||
'signal.hpp',
|
'signal.hpp',
|
||||||
'si.hpp',
|
|
||||||
'singleton.hpp',
|
'singleton.hpp',
|
||||||
'stats.cpp',
|
'stats.cpp',
|
||||||
'stats.hpp',
|
'stats.hpp',
|
||||||
@ -437,6 +477,7 @@ sources += [
|
|||||||
'types/comparator.hpp',
|
'types/comparator.hpp',
|
||||||
'types/description.cpp',
|
'types/description.cpp',
|
||||||
'types/description.hpp',
|
'types/description.hpp',
|
||||||
|
'types/dispatch.hpp',
|
||||||
'types/string.cpp',
|
'types/string.cpp',
|
||||||
'types/string.hpp',
|
'types/string.hpp',
|
||||||
'types/tagged.hpp',
|
'types/tagged.hpp',
|
||||||
@ -454,179 +495,185 @@ sources += [
|
|||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
libcruft = library('cruft', sources)
|
if get_option('simd')
|
||||||
|
sources += [
|
||||||
|
'coord/simd.cpp',
|
||||||
|
'coord/simd.hpp',
|
||||||
|
'coord/simd_sse.hpp',
|
||||||
|
'coord/simd_neon.hpp',
|
||||||
|
]
|
||||||
|
endif
|
||||||
|
|
||||||
|
|
||||||
##
|
|
||||||
##option (SIMD "enable simd support" OFF)
|
|
||||||
##
|
|
||||||
##if (SIM)
|
|
||||||
## list (APPEND UTIL_FILES
|
|
||||||
## "coord/simd.cpp"
|
|
||||||
## "coord/simd.hpp"
|
|
||||||
## "coord/simd_sse.hpp"
|
|
||||||
## "coord/simd_neon.hpp"
|
|
||||||
## )
|
|
||||||
##endif ()
|
|
||||||
##
|
|
||||||
|
|
||||||
|
|
||||||
##
|
|
||||||
##
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
##target_sources(cruft PRIVATE ${UTIL_FILES})
|
rt = cpp.find_library('rt', required: false)
|
||||||
##add_library(cruft-util ALIAS cruft)
|
if not cpp.has_function('shm_open', dependencies: [rt])
|
||||||
##target_include_directories(cruft PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
|
error('Cannot find shm library')
|
||||||
##
|
endif
|
||||||
##
|
dependencies += rt
|
||||||
##search_libs (SHM_LIBS shm_open rt)
|
|
||||||
##search_libs (DL_LIBS dlopen dl)
|
dl = cpp.find_library('dl', required: false)
|
||||||
##search_libs (CLOCK_LIBS clock_gettime rt c)
|
if not cpp.has_function('dlopen', dependencies: dl)
|
||||||
##search_libs (MATH_LIBS cos m)
|
error ('Cannot find dl library')
|
||||||
##
|
endif
|
||||||
##target_link_libraries(cruft ${SHM_LIBS})
|
dependencies += dl
|
||||||
##target_link_libraries(cruft ${DL_LIBS})
|
|
||||||
##target_link_libraries(cruft ${CLOCK_LIBS})
|
if not cpp.has_function('clock_gettime', dependencies: rt)
|
||||||
##target_link_libraries(cruft ${MATH_LIBS})
|
error('Cannot find clock_gettime library')
|
||||||
##
|
endif
|
||||||
### HACK: -ldl isn't getting discovered correctly so we add it unconditionally
|
|
||||||
### for the time being.
|
m = cpp.find_library('m', required: false)
|
||||||
##if (NOT WIN32)
|
if not cpp.has_function('cos', dependencies: m)
|
||||||
## target_link_libraries(cruft dl)
|
error('Cannot find maths library')
|
||||||
##endif ()
|
endif
|
||||||
##
|
dependencies += m
|
||||||
##
|
|
||||||
|
|
||||||
|
libcruft = library('cruft', sources, dependencies: dependencies)
|
||||||
|
|
||||||
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
##foreach (tool cpuid poisson macro scratch)
|
foreach tool: ['cpuid', 'poisson', 'macro', 'scratch']
|
||||||
## add_executable (util_${tool} tools/${tool}.cpp)
|
executable(tool, 'tools/@0@.cpp'.format(tool), link_with: libcruft)
|
||||||
## set_target_properties (util_${tool} PROPERTIES OUTPUT_NAME ${tool})
|
endforeach
|
||||||
## target_link_libraries (util_${tool} cruft)
|
|
||||||
## target_include_directories(util_${tool} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
|
||||||
##endforeach ()
|
|
||||||
##
|
|
||||||
##
|
|
||||||
#################################################################################
|
#################################################################################
|
||||||
##option (TESTS "enable unit testing" ON)
|
tests = [
|
||||||
##
|
'ascii',
|
||||||
##if (TESTS)
|
'algo/search',
|
||||||
## include(CTest)
|
'algo/sort',
|
||||||
## enable_testing()
|
'alloc/aligned/foreign',
|
||||||
##
|
'alloc/aligned/direct',
|
||||||
## list (
|
'alloc/easy',
|
||||||
## APPEND TEST_BIN
|
'alloc/linear',
|
||||||
## ascii
|
'alloc/stack',
|
||||||
## algo/search
|
'affine',
|
||||||
## algo/sort
|
'array/darray',
|
||||||
## alloc/aligned/foreign
|
'array/sarray',
|
||||||
## alloc/aligned/direct
|
'array/parray',
|
||||||
## alloc/easy
|
'backtrace',
|
||||||
## alloc/linear
|
'bezier',
|
||||||
## alloc/stack
|
'bitwise',
|
||||||
## affine
|
'buffer/simple',
|
||||||
## array/darray
|
'cmdopt',
|
||||||
## array/sarray
|
'colour',
|
||||||
## array/parray
|
'comparator',
|
||||||
## backtrace
|
'coord',
|
||||||
## bezier
|
'encode/number',
|
||||||
## bitwise
|
'encode/base',
|
||||||
## buffer/simple
|
'endian',
|
||||||
## cmdopt
|
'exe',
|
||||||
## colour
|
'expected',
|
||||||
## comparator
|
'extent',
|
||||||
## coord
|
'fixed',
|
||||||
## encode/number
|
'float',
|
||||||
## encode/base
|
'format',
|
||||||
## endian
|
'geom/aabb',
|
||||||
## exe
|
'geom/ellipse',
|
||||||
## extent
|
'geom/frustum',
|
||||||
## fixed
|
'geom/line',
|
||||||
## float
|
'geom/plane',
|
||||||
## format
|
'geom/ray',
|
||||||
## geom/aabb
|
'geom/segment',
|
||||||
## geom/ellipse
|
'geom/sphere',
|
||||||
## geom/frustum
|
'hash/buzhash',
|
||||||
## geom/line
|
'hash/checksum',
|
||||||
## geom/plane
|
'hash/crc',
|
||||||
## geom/ray
|
'hash/fasthash',
|
||||||
## geom/segment
|
'hash/fnv1a',
|
||||||
## geom/sphere
|
'hash/murmur',
|
||||||
## hash/checksum
|
'hash/siphash',
|
||||||
## hash/crc
|
'hash/table',
|
||||||
## hash/fasthash
|
'hash/xxhash',
|
||||||
## hash/fnv1a
|
'hton',
|
||||||
## hash/murmur
|
'io',
|
||||||
## hash/siphash
|
'introspection',
|
||||||
## hash/xxhash
|
'iterator',
|
||||||
## hton
|
'job/dispatch',
|
||||||
## io
|
'job/queue',
|
||||||
## introspection
|
'kmeans',
|
||||||
## iterator
|
'map/fixed',
|
||||||
## job/queue
|
'maths',
|
||||||
## kmeans
|
'maths/fast',
|
||||||
## maths
|
'matrix',
|
||||||
## maths/fast
|
'memory/deleter',
|
||||||
## matrix
|
'parallel/queue',
|
||||||
## memory/deleter
|
'parallel/stack',
|
||||||
## parallel/queue
|
'parse/enum',
|
||||||
## parse
|
'parse/value',
|
||||||
## point
|
'parse/time',
|
||||||
## polynomial
|
'parse/si',
|
||||||
## pool
|
'point',
|
||||||
## preprocessor
|
'polynomial',
|
||||||
## quaternion
|
'pool',
|
||||||
## rand/buckets
|
'preprocessor',
|
||||||
## random
|
'quaternion',
|
||||||
## range
|
'rand/buckets',
|
||||||
## rational
|
'random',
|
||||||
## region
|
'range',
|
||||||
## roots/bisection
|
'rational',
|
||||||
## signal
|
'region',
|
||||||
## singleton
|
'registrar',
|
||||||
## stream
|
'roots/bisection',
|
||||||
## string
|
'scoped',
|
||||||
## stringid
|
'signal',
|
||||||
## strongdef
|
'singleton',
|
||||||
## thread/event
|
'stream',
|
||||||
## thread/flag
|
'string',
|
||||||
## thread/monitor
|
'stringid',
|
||||||
## thread/semaphore
|
'strongdef',
|
||||||
## thread/spinlock
|
'thread/event',
|
||||||
## thread/ticketlock
|
'thread/flag',
|
||||||
## time/8601
|
'thread/monitor',
|
||||||
## traits
|
'thread/semaphore',
|
||||||
## tuple/index
|
'thread/spinlock',
|
||||||
## tuple/value
|
'thread/ticketlock',
|
||||||
## tuple/type
|
'time/8601',
|
||||||
## typeidx
|
'traits',
|
||||||
## types/tagged
|
'tuple/index',
|
||||||
## uri
|
'tuple/value',
|
||||||
## utf8
|
'tuple/type',
|
||||||
## vector
|
'typeidx',
|
||||||
## version
|
'types/description',
|
||||||
## view
|
'types/tagged',
|
||||||
## )
|
'uri',
|
||||||
##
|
'utf8',
|
||||||
## if (NOT WIN32)
|
'vector',
|
||||||
## list (APPEND TEST_BIN
|
'version',
|
||||||
## buffer/circular
|
'view',
|
||||||
## buffer/paged
|
]
|
||||||
## )
|
|
||||||
## endif ()
|
|
||||||
##
|
if host_machine.system() != 'windows'
|
||||||
## if (SIMD)
|
tests += [
|
||||||
## list (APPEND TEST_BIN
|
'buffer/circular',
|
||||||
## coord/simd
|
'buffer/paged',
|
||||||
## )
|
]
|
||||||
## endif()
|
endif
|
||||||
##
|
|
||||||
## foreach(t ${TEST_BIN})
|
|
||||||
## string(REPLACE "/" "_" name "test/${t}")
|
if get_option('simd')
|
||||||
## add_executable(util_${name} test/${t}.cpp)
|
tests += [
|
||||||
## target_link_libraries(util_${name} PRIVATE cruft)
|
'coord/simd'
|
||||||
## target_include_directories(util_${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
]
|
||||||
## add_test(NAME util_${name} COMMAND util_${name})
|
endif
|
||||||
## set_tests_properties(util_${name} PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -")
|
|
||||||
## endforeach(t)
|
|
||||||
|
foreach t: tests
|
||||||
|
test(
|
||||||
|
t.underscorify(),
|
||||||
|
executable(
|
||||||
|
'test_@0@'.format(t.underscorify()),
|
||||||
|
'test/@0@.cpp'.format(t),
|
||||||
|
link_with: libcruft,
|
||||||
|
dependencies: dependencies
|
||||||
|
),
|
||||||
|
protocol: 'tap'
|
||||||
|
)
|
||||||
|
endforeach
|
||||||
|
|
||||||
|
|
||||||
##
|
##
|
||||||
## configure_file (test/cpp.py.in util_test_cpp.py @ONLY)
|
## configure_file (test/cpp.py.in util_test_cpp.py @ONLY)
|
||||||
## add_test (NAME util_test_cpp COMMAND ${PYTHON_EXECUTABLE} util_test_cpp.py)
|
## add_test (NAME util_test_cpp COMMAND ${PYTHON_EXECUTABLE} util_test_cpp.py)
|
||||||
@ -636,5 +683,26 @@ libcruft = library('cruft', sources)
|
|||||||
##
|
##
|
||||||
##
|
##
|
||||||
#################################################################################
|
#################################################################################
|
||||||
##configure_file(libcruft.pc.in libcruft.pc)
|
cmake_config = configuration_data()
|
||||||
##configure_file(Doxyfile.in Doxyfile)
|
|
||||||
|
pkg = import('pkgconfig')
|
||||||
|
|
||||||
|
pkg.generate(
|
||||||
|
libraries: dependencies,
|
||||||
|
version: meson.project_version(),
|
||||||
|
name: meson.project_name(),
|
||||||
|
filebase: 'cruft',
|
||||||
|
description: 'A simple utility library for C++'
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
configure_file(
|
||||||
|
input: 'Doxyfile.in',
|
||||||
|
output: 'Doxyfile',
|
||||||
|
configuration: {
|
||||||
|
'CMAKE_PROJECT_NAME': meson.project_name(),
|
||||||
|
'CMAKE_PROJECT_VERSION': meson.project_version(),
|
||||||
|
'CMAKE_CURRENT_SOURCE_DIR': meson.current_source_dir(),
|
||||||
|
'CMAKE_CURRENT_BINARY_DIR': meson.current_build_dir(),
|
||||||
|
}
|
||||||
|
)
|
||||||
|
1
meson_options.txt
Normal file
1
meson_options.txt
Normal file
@ -0,0 +1 @@
|
|||||||
|
option('simd', type: 'boolean', value: false)
|
@ -12,7 +12,7 @@
|
|||||||
|
|
||||||
#include "../std.hpp"
|
#include "../std.hpp"
|
||||||
|
|
||||||
#include <cruft/util/preprocessor.hpp>
|
#include "preprocessor.hpp"
|
||||||
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
|
@ -9,7 +9,8 @@
|
|||||||
#include "value.hpp"
|
#include "value.hpp"
|
||||||
|
|
||||||
#include "../cast.hpp"
|
#include "../cast.hpp"
|
||||||
#include <cruft/util/preprocessor.hpp>
|
|
||||||
|
#include "preprocessor.hpp"
|
||||||
|
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
#include <stdexcept>
|
#include <stdexcept>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
#include "tap.hpp"
|
#include "tap.hpp"
|
||||||
|
|
||||||
#include <cruft/util/preprocessor.hpp>
|
#include "preprocessor.hpp"
|
||||||
|
|
||||||
|
|
||||||
#define PLUS(X,Y) ((X)+(Y))
|
#define PLUS(X,Y) ((X)+(Y))
|
||||||
|
Loading…
Reference in New Issue
Block a user