2017-01-23 15:09:07 +11:00
|
|
|
cmake_minimum_required(VERSION 3.7.0)
|
2018-06-20 12:50:27 +10:00
|
|
|
project(util-cruft LANGUAGES CXX C)
|
2018-06-20 12:23:15 +10:00
|
|
|
|
|
|
|
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_LIST_DIR}/cmake")
|
|
|
|
include(nc)
|
2017-01-17 19:20:30 +11:00
|
|
|
|
|
|
|
include(CheckFunctionExists)
|
|
|
|
include(CheckCXXCompilerFlag)
|
|
|
|
|
|
|
|
include (search_libs)
|
|
|
|
|
2017-09-12 14:17:30 +10:00
|
|
|
find_package (PythonInterp 3 REQUIRED)
|
|
|
|
find_package (RAGEL 6.9 REQUIRED)
|
2017-01-17 19:20:30 +11:00
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
include (TestBigEndian)
|
|
|
|
TEST_BIG_ENDIAN(ENDIANNESS)
|
|
|
|
if (ENDIANNESS)
|
|
|
|
add_definitions(-DWORDS_BIGENDIAN)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
2017-12-20 12:45:05 +11:00
|
|
|
RAGEL_TARGET(uri uri.cpp.rl ${CMAKE_CURRENT_BINARY_DIR}/uri.cpp COMPILE_FLAGS -G2)
|
2017-01-17 21:31:12 +11:00
|
|
|
RAGEL_TARGET(version version.cpp.rl ${CMAKE_CURRENT_BINARY_DIR}/version.cpp)
|
2018-01-09 16:28:25 +11:00
|
|
|
RAGEL_TARGET(format.cpp format.cpp.rl ${CMAKE_CURRENT_BINARY_DIR}/format.cpp)
|
2018-01-01 15:47:41 +11:00
|
|
|
RAGEL_TARGET(parse8601 time/parse8601.cpp.rl ${CMAKE_CURRENT_BINARY_DIR}/time/parse8601.cpp)
|
2019-03-19 16:00:44 +11:00
|
|
|
|
2017-01-17 21:31:12 +11:00
|
|
|
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
|
2017-01-17 19:20:30 +11:00
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
2018-08-13 14:50:48 +10:00
|
|
|
add_library(cruft)
|
2017-01-17 19:20:30 +11:00
|
|
|
|
2019-01-02 13:44:31 +11:00
|
|
|
target_link_libraries(cruft ${NC_CXX_STDCXXFS})
|
|
|
|
|
2018-10-30 21:41:15 +11:00
|
|
|
|
|
|
|
# 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/"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2018-08-24 17:31:34 +10:00
|
|
|
# Preemptively define an identity panic macro so that TCL doens't fuck us over
|
|
|
|
# by renaming a commonly used symbol.
|
|
|
|
target_compile_definitions(cruft PUBLIC "-Dpanic=panic")
|
|
|
|
|
2017-01-17 19:20:30 +11:00
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
search_libs (BACKTRACE_LIB backtrace execinfo)
|
|
|
|
search_libs (DBGHELP_LIB SymFromAddr dbghelp)
|
2017-02-01 13:46:33 +11:00
|
|
|
check_function_exists (RtlCaptureStackBackTrace HAVE_CAPTURESTACKBACKTRACE)
|
2017-01-17 19:20:30 +11:00
|
|
|
|
|
|
|
|
|
|
|
##-----------------------------------------------------------------------------
|
2017-02-01 13:46:33 +11:00
|
|
|
if (BACKTRACE_LIB_FOUND)
|
|
|
|
list (APPEND UTIL_FILES backtrace_execinfo.cpp)
|
|
|
|
elseif (HAVE_CAPTURESTACKBACKTRACE)
|
|
|
|
list (APPEND UTIL_FILES backtrace_stackwalk.cpp)
|
2018-08-13 14:50:48 +10:00
|
|
|
target_link_libraries(cruft DbgHelp)
|
2017-02-01 13:46:33 +11:00
|
|
|
else ()
|
|
|
|
list (APPEND UTIL_FILES backtrace_null.cpp)
|
2017-01-17 19:20:30 +11:00
|
|
|
endif ()
|
|
|
|
|
2017-02-01 13:46:33 +11:00
|
|
|
|
2017-01-17 19:20:30 +11:00
|
|
|
###############################################################################
|
|
|
|
# Platform wrappers
|
|
|
|
if (LINUX)
|
|
|
|
list (APPEND UTIL_FILES exe_linux.cpp)
|
|
|
|
elseif (FREEBSD)
|
|
|
|
list (APPEND UTIL_FILES exe_freebsd.cpp)
|
2017-01-23 15:09:53 +11:00
|
|
|
elseif (WIN32)
|
|
|
|
list (APPEND UTIL_FILES exe_win32.cpp)
|
2017-01-17 19:20:30 +11:00
|
|
|
else ()
|
|
|
|
message (FATAL_ERROR "unhandled platform")
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
# platform wrappers
|
|
|
|
list (
|
|
|
|
APPEND UTIL_FILES
|
|
|
|
posix/dir.cpp
|
|
|
|
posix/dir.hpp
|
2017-12-18 15:46:52 +11:00
|
|
|
posix/except.cpp
|
|
|
|
posix/except.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
posix/fd.cpp
|
|
|
|
posix/fd.hpp
|
2019-04-26 12:11:42 +10:00
|
|
|
posix/ostream.cpp
|
|
|
|
posix/ostream.hpp
|
2019-04-26 12:11:25 +10:00
|
|
|
posix/util.cpp
|
|
|
|
posix/util.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
)
|
|
|
|
|
2017-01-23 21:48:44 +11:00
|
|
|
|
2018-03-14 14:52:02 +11:00
|
|
|
##-----------------------------------------------------------------------------
|
|
|
|
if (LINUX)
|
|
|
|
list (APPEND UTIL_FILES
|
2018-08-16 12:10:05 +10:00
|
|
|
thread/event_futex.cpp
|
|
|
|
thread/flag_futex.cpp
|
2018-03-14 14:52:02 +11:00
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
|
|
|
##-----------------------------------------------------------------------------
|
2018-08-13 14:50:48 +10:00
|
|
|
if (NOT WIN32)
|
2017-01-17 19:20:30 +11:00
|
|
|
list (
|
|
|
|
APPEND UTIL_FILES
|
2018-12-19 20:22:18 +11:00
|
|
|
buffer/circular.cpp
|
|
|
|
buffer/circular.hpp
|
|
|
|
buffer/paged.cpp
|
|
|
|
buffer/paged.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
memory/system.cpp
|
|
|
|
memory/system.hpp
|
|
|
|
debug_posix.cpp
|
|
|
|
io_posix.cpp
|
|
|
|
io_posix.hpp
|
|
|
|
library_posix.hpp
|
|
|
|
library_posix.cpp
|
|
|
|
posix/fwd.hpp
|
2019-02-02 19:09:35 +11:00
|
|
|
posix/interface.hpp
|
|
|
|
posix/interface.cpp
|
2017-01-17 19:20:30 +11:00
|
|
|
posix/map.cpp
|
|
|
|
posix/map.hpp
|
2018-08-13 14:50:48 +10:00
|
|
|
posix/socket.cpp
|
|
|
|
posix/socket.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
time_posix.cpp
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
|
|
|
##-----------------------------------------------------------------------------
|
2018-08-13 14:50:48 +10:00
|
|
|
if (WIN32)
|
2017-01-17 19:20:30 +11:00
|
|
|
list (
|
|
|
|
APPEND UTIL_FILES
|
|
|
|
debug_win32.cpp
|
|
|
|
exe_win32.cpp
|
|
|
|
io_win32.cpp
|
|
|
|
io_win32.hpp
|
2018-03-23 14:10:20 +11:00
|
|
|
thread/event_win32.cpp
|
2017-01-17 19:20:30 +11:00
|
|
|
library_win32.cpp
|
2018-03-14 15:22:45 +11:00
|
|
|
library_win32.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
time_win32.cpp
|
2018-08-27 14:16:27 +10:00
|
|
|
win32/windows.hpp
|
2017-12-18 15:46:52 +11:00
|
|
|
win32/except.cpp
|
|
|
|
win32/except.hpp
|
2019-01-04 17:11:41 +11:00
|
|
|
win32/file.cpp
|
|
|
|
win32/file.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
win32/handle.cpp
|
|
|
|
win32/handle.hpp
|
|
|
|
win32/registry.cpp
|
2018-03-14 15:22:45 +11:00
|
|
|
win32/registry.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
)
|
2018-08-13 14:50:48 +10:00
|
|
|
|
|
|
|
target_link_libraries (cruft ws2_32)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
|
|
|
list (APPEND UTIL_FILES
|
|
|
|
thread/event.hpp
|
|
|
|
thread/flag.hpp
|
2019-02-02 14:55:13 +11:00
|
|
|
thread/primitive.hpp
|
|
|
|
thread/semaphore.hpp
|
2018-08-13 14:50:48 +10:00
|
|
|
)
|
|
|
|
|
|
|
|
if (LINUX)
|
|
|
|
list (APPEND UTIL_FILES
|
|
|
|
thread/event_futex.cpp
|
|
|
|
thread/event_futex.hpp
|
|
|
|
thread/semaphore_linux.hpp
|
|
|
|
thread/semaphore_linux.cpp
|
|
|
|
thread/flag_futex.cpp
|
|
|
|
thread/flag_futex.hpp
|
|
|
|
)
|
|
|
|
elseif (WIN32)
|
|
|
|
list (APPEND UTIL_FILES
|
|
|
|
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 ()
|
|
|
|
list (APPEND UTIL_FILES
|
|
|
|
thread/flag_std.cpp
|
|
|
|
thread/flag_std.hpp
|
|
|
|
)
|
2017-01-17 19:20:30 +11:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
2019-02-02 15:49:50 +11:00
|
|
|
if (host_cpu STREQUAL "x86_64")
|
|
|
|
list (APPEND UTIL_FILES
|
2019-02-02 16:37:46 +11:00
|
|
|
cpuid/x86.cpp
|
|
|
|
cpuid/x86.hpp
|
2019-02-02 15:49:50 +11:00
|
|
|
)
|
|
|
|
else ()
|
2019-02-02 16:40:37 +11:00
|
|
|
message (WARNING "Unknown architecture ${host_cpu}. Defaulting to null implementation")
|
|
|
|
list (APPEND UTIL_FILES
|
|
|
|
cpuid/none.cpp
|
|
|
|
cpuid/none.hpp
|
|
|
|
)
|
2019-02-02 15:49:50 +11:00
|
|
|
endif ()
|
|
|
|
|
|
|
|
|
2017-01-17 19:20:30 +11:00
|
|
|
###############################################################################
|
|
|
|
# Common files
|
|
|
|
list (
|
|
|
|
APPEND UTIL_FILES
|
|
|
|
adapter.hpp
|
|
|
|
adapter.cpp
|
2018-11-14 10:21:51 +11:00
|
|
|
algo/search.hpp
|
2017-05-18 18:24:48 +10:00
|
|
|
algo/sort.cpp
|
|
|
|
algo/sort.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
alloc/fwd.hpp
|
2018-12-19 17:55:24 +11:00
|
|
|
alloc/affix.cpp
|
|
|
|
alloc/affix.hpp
|
|
|
|
alloc/aligned/direct.hpp
|
|
|
|
alloc/aligned/foreign.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
alloc/allocator.cpp
|
|
|
|
alloc/allocator.hpp
|
2018-12-19 17:16:57 +11:00
|
|
|
alloc/easy.hpp
|
2018-12-19 17:55:24 +11:00
|
|
|
alloc/fallback.cpp
|
|
|
|
alloc/fallback.hpp
|
|
|
|
alloc/linear.cpp
|
|
|
|
alloc/linear.hpp
|
|
|
|
alloc/malloc.cpp
|
|
|
|
alloc/malloc.hpp
|
|
|
|
alloc/null.cpp
|
|
|
|
alloc/null.hpp
|
|
|
|
alloc/stack.cpp
|
|
|
|
alloc/stack.hpp
|
2018-12-19 17:16:57 +11:00
|
|
|
alloc/std.hpp
|
|
|
|
alloc/traits.hpp
|
2018-12-19 17:55:24 +11:00
|
|
|
alloc/traits.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
annotation.hpp
|
2018-11-05 21:31:30 +11:00
|
|
|
array/darray.hpp
|
2018-12-17 12:35:45 +11:00
|
|
|
array/sarray.cpp
|
|
|
|
array/sarray.hpp
|
|
|
|
array/parray.cpp
|
|
|
|
array/parray.hpp
|
2019-01-31 13:45:40 +11:00
|
|
|
array/varray.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
ascii.hpp
|
|
|
|
backtrace.hpp
|
|
|
|
bezier.cpp
|
|
|
|
bezier1.cpp
|
|
|
|
bezier2.cpp
|
|
|
|
bezier3.cpp
|
|
|
|
bezier.hpp
|
|
|
|
bitwise.cpp
|
|
|
|
bitwise.hpp
|
2018-12-19 20:22:18 +11:00
|
|
|
buffer/simple.cpp
|
|
|
|
buffer/simple.hpp
|
|
|
|
buffer/traits.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
cast.hpp
|
|
|
|
cmdopt.cpp
|
|
|
|
cmdopt.hpp
|
|
|
|
colour.cpp
|
|
|
|
colour.hpp
|
2019-03-08 09:37:02 +11:00
|
|
|
coord.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
coord/fwd.hpp
|
|
|
|
coord/base.hpp
|
2019-03-08 09:37:02 +11:00
|
|
|
coord/comparator.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
coord/init.hpp
|
|
|
|
coord/iostream.hpp
|
|
|
|
coord/ops.hpp
|
|
|
|
coord/store.hpp
|
2017-11-22 17:03:00 +11:00
|
|
|
coord/traits.hpp
|
2018-04-01 14:49:10 +10:00
|
|
|
cpp.cpp
|
|
|
|
cpp.hpp
|
2018-03-18 17:29:44 +11:00
|
|
|
cpuid.cpp
|
|
|
|
cpuid.hpp
|
2019-05-17 12:26:08 +10:00
|
|
|
debug/assert.cpp
|
|
|
|
debug/assert.hpp
|
|
|
|
debug/compiler.cpp
|
|
|
|
debug/compiler.hpp
|
|
|
|
debug/debugger.cpp
|
|
|
|
debug/debugger.hpp
|
2019-05-17 10:48:29 +10:00
|
|
|
debug/panic.cpp
|
|
|
|
debug/panic.hpp
|
2019-05-17 12:26:08 +10:00
|
|
|
debug/system.cpp
|
|
|
|
debug/system.hpp
|
|
|
|
debug/validate.cpp
|
|
|
|
debug/validate.hpp
|
2018-12-16 16:24:45 +11:00
|
|
|
encode/number.hpp
|
2017-12-22 12:37:04 +11:00
|
|
|
encode/base.cpp
|
|
|
|
encode/base.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
endian.cpp
|
|
|
|
endian.hpp
|
2018-12-03 15:29:21 +11:00
|
|
|
except.cpp
|
|
|
|
except.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
exe.hpp
|
2019-02-07 17:12:59 +11:00
|
|
|
expected.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
extent.cpp
|
|
|
|
extent.hpp
|
|
|
|
fixed.cpp
|
|
|
|
fixed.hpp
|
|
|
|
float.cpp
|
|
|
|
float.hpp
|
2018-01-09 16:28:25 +11:00
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/format.cpp
|
2017-01-17 19:20:30 +11:00
|
|
|
format.hpp
|
|
|
|
fourcc.cpp
|
|
|
|
fourcc.hpp
|
2018-04-27 16:32:58 +10:00
|
|
|
functor.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
geom/fwd.hpp
|
|
|
|
geom/aabb.cpp
|
|
|
|
geom/aabb.hpp
|
|
|
|
geom/cylinder.cpp
|
|
|
|
geom/cylinder.hpp
|
|
|
|
geom/ellipse.cpp
|
|
|
|
geom/ellipse.hpp
|
2018-03-13 22:37:40 +11:00
|
|
|
geom/frustum.cpp
|
|
|
|
geom/frustum.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
geom/iostream.cpp
|
|
|
|
geom/iostream.hpp
|
2018-04-20 15:04:54 +10:00
|
|
|
geom/line.hpp
|
|
|
|
geom/line.cpp
|
2018-11-26 14:08:50 +11:00
|
|
|
geom/ops.cpp
|
2017-01-17 19:20:30 +11:00
|
|
|
geom/ops.hpp
|
|
|
|
geom/plane.cpp
|
|
|
|
geom/plane.hpp
|
|
|
|
geom/ray.cpp
|
|
|
|
geom/ray.hpp
|
|
|
|
geom/rect.cpp
|
|
|
|
geom/rect.hpp
|
2018-11-26 14:08:50 +11:00
|
|
|
geom/sample/fwd.hpp
|
|
|
|
geom/sample/surface.hpp
|
|
|
|
geom/sample/volume.hpp
|
2018-04-20 15:07:16 +10:00
|
|
|
geom/segment.cpp
|
|
|
|
geom/segment.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
geom/sphere.cpp
|
|
|
|
geom/sphere.hpp
|
|
|
|
geom/tri.cpp
|
|
|
|
geom/tri.hpp
|
|
|
|
hash.hpp
|
|
|
|
hash/fwd.hpp
|
|
|
|
hash/adler.cpp
|
|
|
|
hash/adler.hpp
|
2019-04-22 13:59:48 +10:00
|
|
|
hash/buzhash.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
hash/bsdsum.cpp
|
|
|
|
hash/bsdsum.hpp
|
|
|
|
hash/crc.cpp
|
|
|
|
hash/crc.hpp
|
|
|
|
hash/fasthash.cpp
|
|
|
|
hash/fasthash.hpp
|
|
|
|
hash/fletcher.cpp
|
|
|
|
hash/fletcher.hpp
|
|
|
|
hash/fnv1a.cpp
|
|
|
|
hash/fnv1a.hpp
|
|
|
|
hash/murmur/common.cpp
|
|
|
|
hash/murmur/common.hpp
|
|
|
|
hash/murmur.hpp
|
|
|
|
hash/murmur/murmur1.cpp
|
|
|
|
hash/murmur/murmur1.hpp
|
|
|
|
hash/murmur/murmur2.cpp
|
|
|
|
hash/murmur/murmur2.hpp
|
|
|
|
hash/murmur/murmur3.cpp
|
|
|
|
hash/murmur/murmur3.hpp
|
2018-01-19 11:31:12 +11:00
|
|
|
hash/siphash.cpp
|
|
|
|
hash/siphash.hpp
|
2019-04-22 09:51:04 +10:00
|
|
|
hash/table.cpp
|
|
|
|
hash/table.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
hash/wang.hpp
|
|
|
|
hash/xxhash.cpp
|
|
|
|
hash/xxhash.hpp
|
|
|
|
introspection.cpp
|
|
|
|
introspection.hpp
|
|
|
|
io.cpp
|
|
|
|
io.hpp
|
2019-03-18 16:18:27 +11:00
|
|
|
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
|
2018-03-20 15:01:23 +11:00
|
|
|
job/fwd.hpp
|
2018-03-23 16:59:09 +11:00
|
|
|
job/dispatch.hpp
|
2017-07-03 17:05:01 +10:00
|
|
|
job/queue.cpp
|
|
|
|
job/queue.hpp
|
2018-04-18 21:48:24 +10:00
|
|
|
kmeans.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
library.hpp
|
|
|
|
log.cpp
|
|
|
|
log.hpp
|
2019-03-28 14:27:34 +11:00
|
|
|
map/fixed.cpp
|
|
|
|
map/fixed.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
maths.cpp
|
|
|
|
maths.hpp
|
2018-03-20 13:33:07 +11:00
|
|
|
maths/fast.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
matrix.cpp
|
|
|
|
matrix2.cpp
|
|
|
|
matrix3.cpp
|
|
|
|
matrix4.cpp
|
|
|
|
matrix.hpp
|
|
|
|
memory/deleter.cpp
|
|
|
|
memory/deleter.hpp
|
2018-03-22 13:05:51 +11:00
|
|
|
parallel/queue.cpp
|
|
|
|
parallel/queue.hpp
|
2019-05-23 15:21:07 +10:00
|
|
|
parallel/stack.cpp
|
|
|
|
parallel/stack.hpp
|
2019-03-19 16:02:07 +11:00
|
|
|
parse/time.cpp
|
|
|
|
parse/time.hpp
|
2019-03-19 12:38:22 +11:00
|
|
|
parse/value.cpp
|
|
|
|
parse/value.hpp
|
|
|
|
parse/si.cpp
|
|
|
|
parse/si.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
platform.hpp
|
|
|
|
point.cpp
|
|
|
|
point.hpp
|
|
|
|
pointer.hpp
|
|
|
|
polynomial.cpp
|
|
|
|
polynomial.hpp
|
|
|
|
pool.cpp
|
|
|
|
pool.hpp
|
2018-10-30 21:41:15 +11:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}/preprocessor.hpp"
|
2017-01-17 19:20:30 +11:00
|
|
|
quaternion.cpp
|
|
|
|
quaternion.hpp
|
|
|
|
rand/lcg.cpp
|
|
|
|
rand/lcg.hpp
|
|
|
|
rand/xorshift.cpp
|
|
|
|
rand/xorshift.hpp
|
|
|
|
rand/mwc64x.cpp
|
|
|
|
rand/mwc64x.hpp
|
2019-02-21 20:53:58 +11:00
|
|
|
rand/pcg.cpp
|
|
|
|
rand/pcg.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
random.cpp
|
|
|
|
random.hpp
|
|
|
|
range.cpp
|
|
|
|
range.hpp
|
|
|
|
rational.cpp
|
|
|
|
rational.hpp
|
|
|
|
region.cpp
|
|
|
|
region.hpp
|
2019-04-16 11:02:26 +10:00
|
|
|
registrar.cpp
|
|
|
|
registrar.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
roots/bisection.hpp
|
2018-06-12 14:50:54 +10:00
|
|
|
scoped.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
signal.cpp
|
|
|
|
signal.hpp
|
2018-03-22 15:06:48 +11:00
|
|
|
singleton.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
stats.cpp
|
|
|
|
stats.hpp
|
2018-06-03 15:25:17 +10:00
|
|
|
std.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
stream.cpp
|
|
|
|
stream.hpp
|
|
|
|
string.cpp
|
|
|
|
string.hpp
|
|
|
|
stringid.cpp
|
|
|
|
stringid.hpp
|
|
|
|
strongdef.cpp
|
|
|
|
strongdef.hpp
|
|
|
|
tap.cpp
|
|
|
|
tap.hpp
|
|
|
|
term.cpp
|
|
|
|
term.hpp
|
2018-03-23 14:10:20 +11:00
|
|
|
thread/event.hpp
|
|
|
|
thread/flag.hpp
|
|
|
|
thread/monitor.cpp
|
|
|
|
thread/monitor.hpp
|
|
|
|
thread/ticketlock.cpp
|
|
|
|
thread/ticketlock.hpp
|
|
|
|
thread/spinlock.cpp
|
|
|
|
thread/spinlock.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
time.cpp
|
|
|
|
time.hpp
|
2018-01-01 15:47:41 +11:00
|
|
|
time/parse.hpp
|
|
|
|
time/parse8601.cpp
|
2018-04-05 15:18:30 +10:00
|
|
|
tuple/index.hpp
|
2018-03-15 23:48:21 +11:00
|
|
|
tuple/type.hpp
|
|
|
|
tuple/value.hpp
|
2017-05-29 17:21:11 +10:00
|
|
|
typeidx.cpp
|
|
|
|
typeidx.hpp
|
2018-11-13 12:57:19 +11:00
|
|
|
types.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
types/bits.hpp
|
|
|
|
types/comparator.hpp
|
2018-06-03 15:25:50 +10:00
|
|
|
types/description.cpp
|
|
|
|
types/description.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
types/string.cpp
|
|
|
|
types/string.hpp
|
2018-11-13 12:57:19 +11:00
|
|
|
types/tagged.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
types/traits.hpp
|
|
|
|
uri.cpp
|
|
|
|
uri.hpp
|
2017-10-02 15:25:59 +11:00
|
|
|
utf8.cpp
|
|
|
|
utf8.hpp
|
2017-01-17 19:20:30 +11:00
|
|
|
variadic.cpp
|
|
|
|
variadic.hpp
|
|
|
|
vector.cpp
|
|
|
|
vector.hpp
|
|
|
|
version.cpp
|
|
|
|
version.hpp
|
|
|
|
view.cpp
|
|
|
|
view.hpp
|
|
|
|
)
|
|
|
|
|
2018-09-13 14:52:00 +10:00
|
|
|
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 ()
|
2017-09-12 14:17:30 +10:00
|
|
|
|
|
|
|
##-----------------------------------------------------------------------------
|
|
|
|
## 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
|
2018-10-30 21:41:15 +11:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}/preprocessor.hpp"
|
2017-09-12 14:17:30 +10:00
|
|
|
COMMENT
|
|
|
|
"[preprocessor.py] preprocessor.hpp"
|
|
|
|
COMMAND
|
|
|
|
"${PYTHON_EXECUTABLE}"
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/preprocessor.py"
|
2018-10-30 21:41:15 +11:00
|
|
|
"${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}/preprocessor.hpp"
|
2019-03-06 01:00:47 +11:00
|
|
|
480
|
2017-09-12 14:17:30 +10:00
|
|
|
DEPENDS
|
|
|
|
"${CMAKE_CURRENT_SOURCE_DIR}/preprocessor.py"
|
|
|
|
)
|
|
|
|
|
|
|
|
|
2017-01-17 19:20:30 +11:00
|
|
|
###############################################################################
|
2018-08-13 14:50:48 +10:00
|
|
|
target_sources(cruft PRIVATE ${UTIL_FILES})
|
2018-08-05 14:42:02 +10:00
|
|
|
add_library(cruft-util ALIAS cruft)
|
|
|
|
target_include_directories(cruft PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}")
|
2017-11-22 16:34:02 +11:00
|
|
|
|
2018-01-23 18:52:42 +11:00
|
|
|
|
2017-11-22 16:34:02 +11:00
|
|
|
search_libs (SHM_LIBS shm_open rt)
|
|
|
|
search_libs (DL_LIBS dlopen dl)
|
|
|
|
search_libs (CLOCK_LIBS clock_gettime rt c)
|
|
|
|
search_libs (MATH_LIBS cos m)
|
|
|
|
|
2018-08-05 14:42:02 +10:00
|
|
|
target_link_libraries(cruft ${SHM_LIBS})
|
|
|
|
target_link_libraries(cruft ${DL_LIBS})
|
|
|
|
target_link_libraries(cruft ${CLOCK_LIBS})
|
|
|
|
target_link_libraries(cruft ${MATH_LIBS})
|
2018-01-23 18:52:42 +11:00
|
|
|
|
|
|
|
# HACK: -ldl isn't getting discovered correctly so we add it unconditionally
|
|
|
|
# for the time being.
|
2018-08-13 14:50:48 +10:00
|
|
|
if (NOT WIN32)
|
|
|
|
target_link_libraries(cruft dl)
|
|
|
|
endif ()
|
2017-01-17 19:20:30 +11:00
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
2019-04-23 08:19:47 +10:00
|
|
|
foreach (tool cpuid poisson macro scratch)
|
2017-01-19 14:23:13 +11:00
|
|
|
add_executable (util_${tool} tools/${tool}.cpp)
|
|
|
|
set_target_properties (util_${tool} PROPERTIES OUTPUT_NAME ${tool})
|
2018-08-05 14:42:02 +10:00
|
|
|
target_link_libraries (util_${tool} cruft)
|
2017-11-22 16:34:02 +11:00
|
|
|
target_include_directories(util_${tool} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
2017-01-19 14:23:13 +11:00
|
|
|
endforeach ()
|
2017-01-17 19:20:30 +11:00
|
|
|
|
|
|
|
|
|
|
|
###############################################################################
|
2017-01-19 14:23:13 +11:00
|
|
|
option (TESTS "enable unit testing" ON)
|
2017-01-18 21:46:25 +11:00
|
|
|
|
2017-01-19 14:23:13 +11:00
|
|
|
if (TESTS)
|
|
|
|
include(CTest)
|
|
|
|
enable_testing()
|
2017-01-25 15:06:47 +11:00
|
|
|
|
|
|
|
list (
|
|
|
|
APPEND TEST_BIN
|
2017-05-22 15:57:40 +10:00
|
|
|
ascii
|
2018-11-14 10:21:51 +11:00
|
|
|
algo/search
|
2017-05-18 18:24:48 +10:00
|
|
|
algo/sort
|
2018-03-02 12:18:20 +11:00
|
|
|
alloc/aligned/foreign
|
|
|
|
alloc/aligned/direct
|
2018-12-19 17:16:57 +11:00
|
|
|
alloc/easy
|
2017-01-25 15:06:47 +11:00
|
|
|
alloc/linear
|
|
|
|
alloc/stack
|
|
|
|
affine
|
2018-11-05 21:31:30 +11:00
|
|
|
array/darray
|
2018-12-17 12:35:45 +11:00
|
|
|
array/sarray
|
|
|
|
array/parray
|
2017-01-25 15:06:47 +11:00
|
|
|
backtrace
|
|
|
|
bezier
|
|
|
|
bitwise
|
2018-12-19 20:22:18 +11:00
|
|
|
buffer/simple
|
2017-01-25 15:06:47 +11:00
|
|
|
cmdopt
|
|
|
|
colour
|
2017-06-19 15:28:10 +10:00
|
|
|
comparator
|
2017-01-25 15:06:47 +11:00
|
|
|
coord
|
2018-12-16 16:24:45 +11:00
|
|
|
encode/number
|
2017-12-22 12:37:04 +11:00
|
|
|
encode/base
|
2017-10-12 17:36:46 +11:00
|
|
|
endian
|
2017-01-25 15:06:47 +11:00
|
|
|
exe
|
2019-02-07 17:12:59 +11:00
|
|
|
expected
|
2017-01-25 15:06:47 +11:00
|
|
|
extent
|
|
|
|
fixed
|
|
|
|
float
|
|
|
|
format
|
|
|
|
geom/aabb
|
2018-04-16 15:59:39 +10:00
|
|
|
geom/ellipse
|
2018-03-13 22:37:40 +11:00
|
|
|
geom/frustum
|
2018-04-20 15:04:54 +10:00
|
|
|
geom/line
|
|
|
|
geom/plane
|
2018-04-16 15:59:39 +10:00
|
|
|
geom/ray
|
2018-04-20 15:07:16 +10:00
|
|
|
geom/segment
|
2018-04-13 18:46:37 +10:00
|
|
|
geom/sphere
|
2019-04-22 13:59:48 +10:00
|
|
|
hash/buzhash
|
2017-01-25 15:06:47 +11:00
|
|
|
hash/checksum
|
2017-01-25 16:12:12 +11:00
|
|
|
hash/crc
|
2017-01-25 15:06:47 +11:00
|
|
|
hash/fasthash
|
2018-01-13 13:48:58 +11:00
|
|
|
hash/fnv1a
|
2017-01-25 15:06:47 +11:00
|
|
|
hash/murmur
|
2018-01-19 11:31:12 +11:00
|
|
|
hash/siphash
|
2019-04-22 09:51:04 +10:00
|
|
|
hash/table
|
2017-01-25 15:06:47 +11:00
|
|
|
hash/xxhash
|
|
|
|
hton
|
2018-12-17 12:42:22 +11:00
|
|
|
io
|
2017-01-25 15:06:47 +11:00
|
|
|
introspection
|
2017-06-13 16:59:24 +10:00
|
|
|
iterator
|
2019-03-08 09:42:15 +11:00
|
|
|
job/dispatch
|
2017-07-03 17:05:01 +10:00
|
|
|
job/queue
|
2018-04-18 21:48:24 +10:00
|
|
|
kmeans
|
2019-03-28 14:27:34 +11:00
|
|
|
map/fixed
|
2017-01-25 15:06:47 +11:00
|
|
|
maths
|
2018-03-20 13:33:07 +11:00
|
|
|
maths/fast
|
2017-01-25 15:06:47 +11:00
|
|
|
matrix
|
|
|
|
memory/deleter
|
2018-03-22 13:05:51 +11:00
|
|
|
parallel/queue
|
2019-05-23 15:21:07 +10:00
|
|
|
parallel/stack
|
2019-03-19 16:01:55 +11:00
|
|
|
parse/value
|
2019-03-19 16:02:07 +11:00
|
|
|
parse/time
|
2019-03-19 16:01:55 +11:00
|
|
|
parse/si
|
2017-01-25 15:06:47 +11:00
|
|
|
point
|
|
|
|
polynomial
|
|
|
|
pool
|
2017-09-12 14:17:30 +10:00
|
|
|
preprocessor
|
2017-01-25 15:06:47 +11:00
|
|
|
quaternion
|
|
|
|
rand/buckets
|
2018-11-28 15:24:28 +11:00
|
|
|
random
|
2017-01-25 15:06:47 +11:00
|
|
|
range
|
|
|
|
rational
|
|
|
|
region
|
2019-04-16 11:02:26 +10:00
|
|
|
registrar
|
2017-01-25 15:06:47 +11:00
|
|
|
roots/bisection
|
2019-04-12 16:40:17 +10:00
|
|
|
scoped
|
2017-01-25 15:06:47 +11:00
|
|
|
signal
|
2018-03-22 15:06:48 +11:00
|
|
|
singleton
|
2017-01-25 15:06:47 +11:00
|
|
|
stream
|
|
|
|
string
|
|
|
|
stringid
|
|
|
|
strongdef
|
2018-03-23 14:10:20 +11:00
|
|
|
thread/event
|
|
|
|
thread/flag
|
|
|
|
thread/monitor
|
|
|
|
thread/semaphore
|
|
|
|
thread/spinlock
|
|
|
|
thread/ticketlock
|
2018-01-01 15:47:41 +11:00
|
|
|
time/8601
|
2017-09-08 14:20:01 +10:00
|
|
|
traits
|
2018-04-05 15:18:30 +10:00
|
|
|
tuple/index
|
2018-04-05 13:54:42 +10:00
|
|
|
tuple/value
|
|
|
|
tuple/type
|
2017-05-29 17:21:11 +10:00
|
|
|
typeidx
|
2019-05-09 10:32:39 +10:00
|
|
|
types/description
|
2018-11-13 12:57:19 +11:00
|
|
|
types/tagged
|
2017-01-25 15:06:47 +11:00
|
|
|
uri
|
2017-10-02 15:25:59 +11:00
|
|
|
utf8
|
2017-01-25 15:06:47 +11:00
|
|
|
vector
|
|
|
|
version
|
|
|
|
view
|
|
|
|
)
|
|
|
|
|
2018-12-19 20:22:18 +11:00
|
|
|
if (NOT WIN32)
|
|
|
|
list (APPEND TEST_BIN
|
|
|
|
buffer/circular
|
|
|
|
buffer/paged
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
if (SIMD)
|
|
|
|
list (APPEND TEST_BIN
|
|
|
|
coord/simd
|
|
|
|
)
|
|
|
|
endif()
|
2018-09-13 14:52:00 +10:00
|
|
|
|
2019-05-24 10:58:32 +10:00
|
|
|
add_custom_target(util_test)
|
|
|
|
|
2017-01-25 15:06:47 +11:00
|
|
|
foreach(t ${TEST_BIN})
|
|
|
|
string(REPLACE "/" "_" name "test/${t}")
|
|
|
|
add_executable(util_${name} test/${t}.cpp)
|
2018-08-05 14:42:02 +10:00
|
|
|
target_link_libraries(util_${name} PRIVATE cruft)
|
2017-11-22 16:34:02 +11:00
|
|
|
target_include_directories(util_${name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR})
|
2017-01-25 15:06:47 +11:00
|
|
|
add_test(NAME util_${name} COMMAND util_${name})
|
2018-07-16 11:28:04 +10:00
|
|
|
set_tests_properties(util_${name} PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -")
|
2019-05-24 10:58:32 +10:00
|
|
|
add_dependencies(util_test util_${name})
|
2017-01-25 15:06:47 +11:00
|
|
|
endforeach(t)
|
2018-04-01 14:49:10 +10:00
|
|
|
|
2018-08-13 23:29:14 +10:00
|
|
|
configure_file (test/cpp.py.in util_test_cpp.py @ONLY)
|
|
|
|
add_test (NAME util_test_cpp COMMAND ${PYTHON_EXECUTABLE} util_test_cpp.py)
|
2018-04-01 14:49:10 +10:00
|
|
|
set_property (TEST util_test_cpp APPEND PROPERTY DEPENDS util_macro)
|
2018-07-16 11:28:04 +10:00
|
|
|
set_tests_properties(util_test_cpp PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -")
|
2019-05-24 10:58:32 +10:00
|
|
|
|
2017-01-18 21:46:25 +11:00
|
|
|
endif ()
|
2017-01-17 19:20:30 +11:00
|
|
|
|
2017-01-19 14:23:13 +11:00
|
|
|
|
|
|
|
###############################################################################
|
2018-08-05 14:42:02 +10:00
|
|
|
configure_file(libcruft.pc.in libcruft.pc)
|
2017-01-19 14:23:13 +11:00
|
|
|
configure_file(Doxyfile.in Doxyfile)
|