diff --git a/CMakeLists.txt b/CMakeLists.txt index f8cf22af..a61f483f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -5,877 +5,24 @@ include (nc) include(CheckFunctionExists) include(CheckCXXCompilerFlag) +include(CMakePackageConfigHelpers) +include(GNUInstallDirs) include (search_libs) -find_package (Python3 REQUIRED COMPONENTS Interpreter) -find_package (RAGEL 6.9 REQUIRED) -find_package (fmt REQUIRED) - -if (WIN32) - # Enable features for Windows Vista and higher - add_definitions("-D_WIN32_WINNT=0x0600") -endif () - - -############################################################################### -include (TestBigEndian) -TEST_BIG_ENDIAN(ENDIANNESS) -if (ENDIANNESS) - add_definitions(-DWORDS_BIGENDIAN) -endif() - - -############################################################################### -RAGEL_TARGET(uri uri.cpp.rl ${CMAKE_CURRENT_BINARY_DIR}/uri.rl.cpp COMPILE_FLAGS -G2) -RAGEL_TARGET(version version.cpp.rl ${CMAKE_CURRENT_BINARY_DIR}/version.cpp) -RAGEL_TARGET(parse8601 time/parse8601.cpp.rl ${CMAKE_CURRENT_BINARY_DIR}/time/parse8601.cpp) - -include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - - -############################################################################### -add_library(cruft) - -target_link_libraries(cruft ${NC_CXX_STDCXXFS} fmt::fmt) - - -# 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 PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}") -target_include_directories(cruft PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/prefix/") -target_include_directories(cruft INTERFACE "${CMAKE_CURRENT_BINARY_DIR}/prefix/") - - -# 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") - - -############################################################################### -search_libs (BACKTRACE_LIB backtrace execinfo) -search_libs (DBGHELP_LIB SymFromAddr dbghelp) -check_function_exists (RtlCaptureStackBackTrace HAVE_CAPTURESTACKBACKTRACE) - - -##----------------------------------------------------------------------------- -if (BACKTRACE_LIB_FOUND) - list (APPEND UTIL_FILES backtrace_execinfo.cpp) -elseif (HAVE_CAPTURESTACKBACKTRACE) - list (APPEND UTIL_FILES backtrace_stackwalk.cpp) - target_link_libraries(cruft dbghelp) -else () - list (APPEND UTIL_FILES backtrace_null.cpp) -endif () - - -############################################################################### -# Platform wrappers -if (LINUX) - list (APPEND UTIL_FILES exe_linux.cpp) -elseif (FREEBSD) - list (APPEND UTIL_FILES exe_freebsd.cpp) -elseif (WIN32) - list (APPEND UTIL_FILES exe_win32.cpp) -else () - message (FATAL_ERROR "unhandled platform") -endif () - - -############################################################################### -# platform wrappers -list ( - APPEND UTIL_FILES - posix/dir.cpp - posix/dir.hpp - posix/except.cpp - posix/except.hpp - posix/fd.cpp - posix/fd.hpp - posix/flock.cpp - posix/flock.hpp - posix/ostream.cpp - posix/ostream.hpp - posix/util.cpp - posix/util.hpp -) - - -##----------------------------------------------------------------------------- -if (LINUX) - list (APPEND UTIL_FILES - thread/event_futex.cpp - thread/flag_futex.cpp - rand/system_linux.cpp - rand/system_linux.hpp - ) -endif () - - -##----------------------------------------------------------------------------- -if (NOT WIN32) - list ( - APPEND UTIL_FILES - buffer/circular.cpp - buffer/circular.hpp - buffer/paged.cpp - buffer/paged.hpp - memory/system.cpp - memory/system.hpp - debug_posix.cpp - debug/crash_posix.cpp - debug/fpe_posix.cpp - debug/system_posix.cpp - fs/tmp_posix.cpp - io_posix.cpp - io_posix.hpp - library_posix.hpp - library_posix.cpp - paths_posix.cpp - posix/fwd.hpp - posix/interface.hpp - posix/interface.cpp - posix/map.cpp - posix/map.hpp - posix/socket.cpp - posix/socket.hpp - time_posix.cpp - ) -endif () - - -##----------------------------------------------------------------------------- -if (WIN32) - list ( - APPEND UTIL_FILES - debug_win32.cpp - debug/crash_win32.cpp - debug/fpe_win32.cpp - debug/system_win32.cpp - exe_win32.cpp - fs/tmp_win32.cpp - io_win32.cpp - io_win32.hpp - library_win32.cpp - library_win32.hpp - paths_win32.cpp - rand/system_win32.cpp - rand/system_win32.hpp - time_win32.cpp - win32/windows.hpp - win32/except.cpp - win32/except.hpp - win32/file.cpp - win32/file.hpp - win32/handle.cpp - win32/handle.hpp - win32/registry.cpp - win32/registry.hpp - ) - - target_link_libraries (cruft ws2_32) -endif () - - -############################################################################### -list (APPEND UTIL_FILES - thread/event.hpp - thread/flag.hpp - thread/primitive.hpp - thread/semaphore.hpp -) - -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/event_win32.cpp - thread/semaphore_win32.hpp - thread/semaphore_win32.cpp - thread/flag_std.cpp - thread/flag_std.hpp - ) -else () - message (FATAL_ERROR "Unsupported thread platform") -endif () - - -if (host_cpu STREQUAL "x86_64") - list (APPEND UTIL_FILES - cpuid/x86.cpp - cpuid/x86.hpp - ) -else () - message (WARNING "Unknown architecture ${host_cpu}. Defaulting to null implementation") - list (APPEND UTIL_FILES - cpuid/none.cpp - cpuid/none.hpp - ) -endif () - - -if (WIN32) - list (APPEND UTIL_FILES sysinfo_win32.cpp) -else () - list (APPEND UTIL_FILES sysinfo_posix.cpp) -endif () - - -############################################################################### -# Common files -list ( - APPEND UTIL_FILES - fwd.hpp - - adapter.hpp - adapter.cpp - algo/search.hpp - algo/sort.cpp - algo/sort.hpp - alloc/fwd.hpp - alloc/affix.cpp - alloc/affix.hpp - alloc/aligned/direct.hpp - alloc/aligned/foreign.hpp - alloc/allocator.cpp - alloc/allocator.hpp - alloc/chunked.cpp - alloc/chunked.hpp - alloc/easy.hpp - 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 - alloc/std.hpp - alloc/traits.hpp - alloc/traits.hpp - annotation.hpp - array/darray.hpp - array/md.cpp - array/md.hpp - array/parray.cpp - array/parray.hpp - array/sarray.cpp - array/sarray.hpp - array/varray.hpp - ascii.hpp - backtrace.hpp - bezier.cpp - bezier1.cpp - bezier2.cpp - bezier3.cpp - bezier.hpp - bitwise.cpp - bitwise.hpp - bool.cpp - bool.hpp - buffer/simple.cpp - buffer/simple.hpp - buffer/traits.hpp - cast.hpp - cmdopt.cpp - cmdopt.hpp - cmdopt2/fwd.hpp - cmdopt2/args.cpp - cmdopt2/args.hpp - cmdopt2/parser.cpp - cmdopt2/parser.hpp - colour.cpp - colour.hpp - concepts.hpp - concepts/clock.hpp - concepts/string.hpp - container.hpp - coord.hpp - coord/fwd.hpp - coord/base.hpp - coord/comparator.hpp - coord/init.hpp - coord/iostream.hpp - coord/ops.hpp - coord/store.hpp - coord/traits.hpp - cpp.cpp - cpp.hpp - cpuid.cpp - cpuid.hpp - debug/assert.cpp - debug/assert.hpp - debug/common.cpp - debug/common.hpp - debug/compiler.cpp - debug/compiler.hpp - debug/crash.hpp - debug/debugger.cpp - debug/debugger.hpp - debug/fpe.hpp - debug/fpe.cpp - debug/memory.cpp - debug/memory.hpp - debug/panic.cpp - debug/panic.hpp - debug/system.cpp - debug/system.hpp - debug/trace.cpp - debug/trace.hpp - debug/validate.cpp - debug/validate.hpp - debug/warn.cpp - debug/warn.hpp - encode/number.hpp - encode/base.cpp - encode/base.hpp - endian.cpp - endian.hpp - except.cpp - except.hpp - exe.hpp - expected.hpp - extent.cpp - extent.hpp - fixed.cpp - fixed.hpp - fixed_string.hpp - float.cpp - float.hpp - format/quoted.hpp - fourcc.cpp - fourcc.hpp - fs/scoped.cpp - fs/scoped.hpp - fs/tmp.hpp - functor.hpp - geom/fwd.hpp - geom/aabb.cpp - geom/aabb.hpp - geom/cylinder.cpp - geom/cylinder.hpp - geom/ellipse.cpp - geom/ellipse.hpp - geom/frustum.cpp - geom/frustum.hpp - geom/iostream.cpp - geom/iostream.hpp - geom/line.hpp - geom/line.cpp - geom/ops.cpp - geom/ops.hpp - geom/plane.cpp - geom/plane.hpp - geom/ray.cpp - geom/ray.hpp - geom/rect.cpp - geom/rect.hpp - geom/region.cpp - geom/sample/fwd.hpp - geom/sample/edge.hpp - geom/sample/surface.hpp - geom/sample/volume.hpp - geom/sample/subregion.hpp - geom/segment.cpp - geom/segment.hpp - geom/sphere.cpp - geom/sphere.hpp - geom/traits.hpp - geom/tri.cpp - geom/tri.hpp - hash.hpp - hash/fwd.hpp - hash/adapter.hpp - hash/adler.cpp - hash/adler.hpp - hash/buzhash.hpp - 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/halfsipmix.cpp - hash/halfsipmix.hpp - hash/mix.cpp - hash/mix.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 - hash/siphash.cpp - hash/siphash.hpp - hash/std.cpp - hash/std.hpp - hash/table.cpp - hash/table.hpp - hash/tuple.cpp - hash/tuple.hpp - hash/wang.hpp - hash/xxhash.cpp - hash/xxhash.hpp - init.cpp - init.hpp - introspection/enum_manual.cpp - introspection/enum_manual.hpp - introspection/enum_simple.cpp - introspection/enum_simple.hpp - introspection/name.cpp - introspection/name.hpp - introspection/type.cpp - introspection/type.hpp - io.cpp - io.hpp - iterator/cast.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/placement_output.hpp - iterator/referencing.hpp - iterator/transform.hpp - iterator/tuple_picker.hpp - iterator/unequal.hpp - iterator/unordered_insert.hpp - iterator/zip.hpp - job/fwd.hpp - job/dispatch.hpp - job/queue.cpp - job/queue.hpp - kmeans.hpp - library.hpp - list/node.hpp - list/sort.hpp - log.hpp - log/fwd.hpp - log/level.cpp - log/level.hpp - log/log.cpp - log/log.hpp - log/packet.cpp - log/packet.hpp - log/scoped.cpp - log/scoped.hpp - log/sink/base.cpp - log/sink/base.hpp - log/sink/console.cpp - log/sink/console.hpp - log/sink/null.cpp - log/sink/null.hpp - log/sink/path.cpp - log/sink/path.hpp - map/multi_fixed.cpp - map/multi_fixed.hpp - map/fixed.cpp - map/fixed.hpp - maths.cpp - maths.hpp - maths/fast.hpp - matrix.cpp - matrix2.cpp - matrix3.cpp - matrix4.cpp - matrix.hpp - memory/deleter.cpp - memory/deleter.hpp - parallel/queue.cpp - parallel/queue.hpp - parallel/stack.cpp - 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 - paths.cpp - paths.hpp - platform.hpp - point.cpp - point.hpp - pointer.hpp - polynomial.cpp - polynomial.hpp - pool.cpp - pool.hpp - "${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}/preprocessor.hpp" - quaternion.cpp - quaternion.hpp - rand/distribution/normal.cpp - rand/distribution/normal.hpp - rand/distribution/uniform.cpp - rand/distribution/uniform.hpp - rand/generic.hpp - rand/lcg.cpp - rand/lcg.hpp - rand/mwc64x.cpp - rand/mwc64x.hpp - rand/pcg.cpp - rand/pcg.hpp - rand/rdrand.cpp - rand/rdrand.hpp - rand/splitmix64.hpp - rand/system.hpp - rand/xoshiro.cpp - rand/xoshiro.hpp - rand/xorshift.cpp - rand/xorshift.hpp - random.cpp - random.hpp - range.cpp - range.hpp - rational.cpp - rational.hpp - region.cpp - region.hpp - registrar.cpp - registrar.hpp - roots/bisection.hpp - scoped.hpp - serialise/converter.hpp - serialise/ops.hpp - serialise/std.hpp - set/dset.cpp - set/dset.hpp - signal.cpp - signal.hpp - singleton.hpp - stats.cpp - stats.hpp - std.hpp - stream.cpp - stream.hpp - string.cpp - string.hpp - stringcache.cpp - stringcache.hpp - stringid.cpp - stringid.hpp - strongdef.cpp - strongdef.hpp - sysinfo.hpp - tap.cpp - tap.hpp - term.cpp - term.hpp - thread/event.hpp - thread/flag.hpp - thread/monitor.cpp - thread/monitor.hpp - thread/ticketlock.cpp - thread/ticketlock.hpp - thread/spinlock.cpp - thread/spinlock.hpp - time.cpp - time.hpp - time/parse.hpp - time/parse8601.cpp - tuple/index.hpp - tuple/type.hpp - tuple/value.hpp - typeidx.cpp - typeidx.hpp - types.hpp - types/sized.hpp - types/comparator.hpp - types/description.cpp - types/description.hpp - types/dispatch.hpp - types/string.cpp - types/string.hpp - types/tagged.hpp - types/traits.hpp - uri.cpp - uri.rl.cpp - uri.hpp - utf8.cpp - utf8.hpp - variadic.cpp - variadic.hpp - vector.cpp - vector.hpp - version.cpp - version.hpp - view.cpp - view.hpp -) - -option (SIMD "enable simd support" OFF) - -if (SIMD) - list (APPEND UTIL_FILES - "coord/simd.cpp" - "coord/simd.hpp" - "coord/simd_sse.hpp" - "coord/simd_neon.hpp" - ) -endif () - -##----------------------------------------------------------------------------- -## 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 - "${Python3_EXECUTABLE}" - "${CMAKE_CURRENT_SOURCE_DIR}/preprocessor.py" - "${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}/preprocessor.hpp" - 480 -DEPENDS - "${CMAKE_CURRENT_SOURCE_DIR}/preprocessor.py" -) - - -############################################################################### -target_sources(cruft PRIVATE ${UTIL_FILES}) -add_library(cruft-util ALIAS cruft) - -target_include_directories(cruft PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}") - -install (TARGETS cruft LIBRARY COMPONENT development) - -set (headers ${UTIL_FILES}) -list (FILTER headers INCLUDE REGEX "\\.hpp$") -install (FILES ${headers} DESTINATION "include/cruft/util" COMPONENT development) - - -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) - -target_link_libraries(cruft ${SHM_LIBS}) -target_link_libraries(cruft ${DL_LIBS}) -target_link_libraries(cruft ${CLOCK_LIBS}) -target_link_libraries(cruft ${MATH_LIBS}) - -# HACK: -ldl isn't getting discovered correctly so we add it unconditionally -# for the time being. -if (NOT WIN32) - target_link_libraries(cruft dl) -endif () - - -############################################################################### -set(TOOL_BINARIES backtrace crash log poisson macro scratch) - -if (NOT WIN32) - list(APPEND TOOL_BINARIES cpuid) -endif() - -foreach (tool ${TOOL_BINARIES}) - add_executable (util_${tool} tools/${tool}.cpp) - set_target_properties (util_${tool} PROPERTIES OUTPUT_NAME ${tool}) - target_link_libraries (util_${tool} cruft) - target_include_directories(util_${tool} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) - target_include_directories(util_${tool} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/prefix/${PREFIX}") -endforeach () - - -############################################################################### -option (TESTS "enable unit testing" ON) - -if (TESTS) - include(CTest) - enable_testing() - - list ( - APPEND TEST_BIN - ascii - algo/search - algo/sort - alloc/aligned/foreign - alloc/aligned/direct - alloc/easy - alloc/linear - alloc/stack - affine - array/darray - array/sarray - array/parray - backtrace - bezier - bitwise - bool - buffer/simple - cmdopt - cmdopt2 - colour - concepts - comparator - coord - debug/fpe - encode/number - encode/base - endian - exe - expected - extent - fixed - float - format/quoted - fs/scoped - fs/tmp - geom/aabb - geom/ellipse - geom/frustum - geom/line - geom/plane - geom/ray - geom/sample/edge - geom/sample/subregion - geom/segment - geom/sphere - hash/buzhash - hash/checksum - hash/crc - hash/fasthash - hash/fnv1a - hash/halfsipmix - hash/murmur - hash/siphash - hash/table - hash/tuple - hash/xxhash - hton - io - introspection - introspection/enum_simple - iterator - job/dispatch - job/queue - kmeans - list/sort - map/fixed - map/multi_fixed - maths - maths/fast - matrix - memory/deleter - parallel/queue - parallel/stack - parse/enum - parse/value - parse/time - parse/si - paths - point - polynomial - pool - preprocessor - quaternion - rand/buckets - rand/generator/normal - random - range - rational - region - registrar - roots/bisection - scoped - serialise - set/dset - signal - singleton - stream - string - stringid - stringcache - strongdef - thread/event - thread/flag - thread/monitor - thread/semaphore - thread/spinlock - thread/ticketlock - time/8601 - traits - tuple/index - tuple/value - tuple/type - typeidx - types/description - types/tagged - uri - utf8 - vector - version - view - ) - - if (NOT WIN32) - list (APPEND TEST_BIN - buffer/circular - buffer/paged - ) - endif () - - if (SIMD) - list (APPEND TEST_BIN - coord/simd - ) - endif() - - add_custom_target(util_test) - - foreach(t ${TEST_BIN}) - string(REPLACE "/" "_" name "test/${t}") - add_executable(util_${name} test/${t}.cpp) - 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_BINARY_DIR}/prefix/${PREFIX}") - add_test(NAME util_${name} COMMAND util_${name}) - set_tests_properties(util_${name} PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -") - add_dependencies(util_test util_${name}) - endforeach(t) - - configure_file (test/cpp.py.in util_test_cpp.py @ONLY) - add_test (NAME util_test_cpp COMMAND ${Python3_EXECUTABLE} util_test_cpp.py) - set_property (TEST util_test_cpp APPEND PROPERTY DEPENDS util_macro) - set_tests_properties(util_test_cpp PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -") - -endif () +add_subdirectory ("cruft/util") +add_subdirectory ("test") +add_subdirectory ("tools") ############################################################################### configure_file(libcruft.pc.in libcruft.pc @ONLY) install ( -FILES + FILES "${CMAKE_CURRENT_BINARY_DIR}/libcruft.pc" -DESTINATION + DESTINATION "share/pkgconfig" -COMPONENT + COMPONENT development ) diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 00000000..bfb97d52 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,52 @@ +import os.path + +from conan import ConanFile +from conan.tools.cmake import cmake_layout, CMake + + +class MyConan(ConanFile): + name = 'cruft-util' + version = '0.1' + user = 'nerdcruft' + + settings = "os", "compiler", "build_type", "arch" + + build_requires = ( + 'nc/0.1@nerdcruft', + ) + + requires = ( + 'fmt/[~10]', + 'range-v3/[~0.11]', + ) + + generators = "CMakeToolchain", "CMakeDeps" + + exports_sources = 'CMakeLists.txt', 'src*', 'test*', 'Doxyfile.in', 'preprocessor.py', 'libcruft.pc.in', + + def layout(self): + cmake_layout(self) + return + + self.folders.source = '.' + self.folders.build = os.path.join('build', 'debug', 'gcc') + self.folders.generators = os.path.join(self.folders.build, 'generators') + + self.cpp.source.includedirs = ['.'] + self.cpp.build.includedirs = [ + os.path.join('generated') + ] + + self.cpp.package.libs = ['cruft'] + + def build(self): + cmake = CMake(self) + cmake.configure(cli_args=['-G=Ninja']) + cmake.build() + + def package(self): + cmake = CMake(self) + cmake.install() + + def package_info(self): + self.cpp_info.libs = ['cruft'] \ No newline at end of file diff --git a/cruft/util/CMakeLists.txt b/cruft/util/CMakeLists.txt new file mode 100644 index 00000000..449f59ff --- /dev/null +++ b/cruft/util/CMakeLists.txt @@ -0,0 +1,702 @@ + +find_package (Python3 REQUIRED COMPONENTS Interpreter) +find_package (RAGEL 6.9 REQUIRED) +find_package (fmt REQUIRED) + +if (WIN32) + # Enable features for Windows Vista and higher + add_definitions("-D_WIN32_WINNT=0x0600") +endif () + + +############################################################################### +include (TestBigEndian) +TEST_BIG_ENDIAN(ENDIANNESS) +if (ENDIANNESS) + add_definitions(-DWORDS_BIGENDIAN) +endif() + + +############################################################################### +RAGEL_TARGET(uri uri.cpp.rl ${CMAKE_CURRENT_BINARY_DIR}/uri.rl.cpp COMPILE_FLAGS -G2) +RAGEL_TARGET(version version.cpp.rl ${CMAKE_CURRENT_BINARY_DIR}/version.cpp) +RAGEL_TARGET(parse8601 time/parse8601.cpp.rl ${CMAKE_CURRENT_BINARY_DIR}/time/parse8601.cpp) + + +############################################################################### +add_library(libcruft-util) + +target_link_libraries(libcruft-util ${NC_CXX_STDCXXFS} fmt::fmt) + + +# Setup a directory to hold built sources we may need to export to clients. +set (PREFIX_BASE "${CMAKE_CURRENT_BINARY_DIR}/generated") +set (PREFIX "${PREFIX_BASE}/cruft/util") +file (MAKE_DIRECTORY "${PREFIX}") + +target_include_directories(libcruft-util +PUBLIC + $ +) + + +# Preemptively define an identity panic macro so that TCL doens't fuck us over +# by renaming a commonly used symbol. +target_compile_definitions(libcruft-util PUBLIC "-Dpanic=panic") + + +############################################################################### +search_libs (BACKTRACE_LIB backtrace execinfo) +search_libs (DBGHELP_LIB SymFromAddr dbghelp) +check_function_exists (RtlCaptureStackBackTrace HAVE_CAPTURESTACKBACKTRACE) + + +##----------------------------------------------------------------------------- +if (BACKTRACE_LIB_FOUND) + list (APPEND UTIL_FILES backtrace_execinfo.cpp) +elseif (HAVE_CAPTURESTACKBACKTRACE) + list (APPEND UTIL_FILES backtrace_stackwalk.cpp) + target_link_libraries(libcruft-util dbghelp) +else () + list (APPEND UTIL_FILES backtrace_null.cpp) +endif () + + +############################################################################### +# Platform wrappers +if (LINUX) + list (APPEND UTIL_FILES exe_linux.cpp) +elseif (FREEBSD) + list (APPEND UTIL_FILES exe_freebsd.cpp) +elseif (WIN32) + list (APPEND UTIL_FILES exe_win32.cpp) +else () + message (FATAL_ERROR "unhandled platform") +endif () + + +############################################################################### +# platform wrappers +list ( + APPEND UTIL_FILES + posix/dir.cpp + posix/dir.hpp + posix/except.cpp + posix/except.hpp + posix/fd.cpp + posix/fd.hpp + posix/flock.cpp + posix/flock.hpp + posix/ostream.cpp + posix/ostream.hpp + posix/util.cpp + posix/util.hpp +) + + +##----------------------------------------------------------------------------- +if (LINUX) + list (APPEND UTIL_FILES + thread/event_futex.cpp + thread/flag_futex.cpp + rand/system_linux.cpp + rand/system_linux.hpp + ) +endif () + + +##----------------------------------------------------------------------------- +if (NOT WIN32) + list ( + APPEND UTIL_FILES + buffer/circular.cpp + buffer/circular.hpp + buffer/paged.cpp + buffer/paged.hpp + memory/system.cpp + memory/system.hpp + debug_posix.cpp + debug/crash_posix.cpp + debug/fpe_posix.cpp + debug/system_posix.cpp + fs/tmp_posix.cpp + io_posix.cpp + io_posix.hpp + library_posix.hpp + library_posix.cpp + paths_posix.cpp + posix/fwd.hpp + posix/interface.hpp + posix/interface.cpp + posix/map.cpp + posix/map.hpp + posix/socket.cpp + posix/socket.hpp + time_posix.cpp + ) +endif () + + +##----------------------------------------------------------------------------- +if (WIN32) + list ( + APPEND UTIL_FILES + debug_win32.cpp + debug/crash_win32.cpp + debug/fpe_win32.cpp + debug/system_win32.cpp + exe_win32.cpp + fs/tmp_win32.cpp + io_win32.cpp + io_win32.hpp + library_win32.cpp + library_win32.hpp + paths_win32.cpp + rand/system_win32.cpp + rand/system_win32.hpp + time_win32.cpp + win32/windows.hpp + win32/except.cpp + win32/except.hpp + win32/file.cpp + win32/file.hpp + win32/handle.cpp + win32/handle.hpp + win32/registry.cpp + win32/registry.hpp + ) + + target_link_libraries (libcruft-util ws2_32) +endif () + + +############################################################################### +list (APPEND UTIL_FILES + thread/event.hpp + thread/flag.hpp + thread/primitive.hpp + thread/semaphore.hpp +) + +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/event_win32.cpp + thread/semaphore_win32.hpp + thread/semaphore_win32.cpp + thread/flag_std.cpp + thread/flag_std.hpp + ) +else () + message (FATAL_ERROR "Unsupported thread platform") +endif () + + +if (host_cpu STREQUAL "x86_64") + list (APPEND UTIL_FILES + cpuid/x86.cpp + cpuid/x86.hpp + ) +else () + message (WARNING "Unknown architecture ${host_cpu}. Defaulting to null implementation") + list (APPEND UTIL_FILES + cpuid/none.cpp + cpuid/none.hpp + ) +endif () + + +if (WIN32) + list (APPEND UTIL_FILES sysinfo_win32.cpp) +else () + list (APPEND UTIL_FILES sysinfo_posix.cpp) +endif () + + +############################################################################### +# Common files +list ( + APPEND UTIL_FILES + fwd.hpp + + adapter.hpp + adapter.cpp + algo/search.hpp + algo/sort.cpp + algo/sort.hpp + alloc/fwd.hpp + alloc/affix.cpp + alloc/affix.hpp + alloc/aligned/direct.hpp + alloc/aligned/foreign.hpp + alloc/allocator.cpp + alloc/allocator.hpp + alloc/chunked.cpp + alloc/chunked.hpp + alloc/easy.hpp + 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 + alloc/std.hpp + alloc/traits.hpp + alloc/traits.hpp + annotation.hpp + array/darray.hpp + array/md.cpp + array/md.hpp + array/parray.cpp + array/parray.hpp + array/sarray.cpp + array/sarray.hpp + array/varray.hpp + ascii.hpp + backtrace.hpp + bezier.cpp + bezier1.cpp + bezier2.cpp + bezier3.cpp + bezier.hpp + bitwise.cpp + bitwise.hpp + bool.cpp + bool.hpp + buffer/simple.cpp + buffer/simple.hpp + buffer/traits.hpp + cast.hpp + cmdopt.cpp + cmdopt.hpp + cmdopt2/fwd.hpp + cmdopt2/args.cpp + cmdopt2/args.hpp + cmdopt2/parser.cpp + cmdopt2/parser.hpp + colour.cpp + colour.hpp + concepts.hpp + concepts/clock.hpp + concepts/string.hpp + container.hpp + coord.hpp + coord/fwd.hpp + coord/base.hpp + coord/comparator.hpp + coord/init.hpp + coord/iostream.hpp + coord/ops.hpp + coord/store.hpp + coord/traits.hpp + cpp.cpp + cpp.hpp + cpuid.cpp + cpuid.hpp + debug/assert.cpp + debug/assert.hpp + debug/common.cpp + debug/common.hpp + debug/compiler.cpp + debug/compiler.hpp + debug/crash.hpp + debug/debugger.cpp + debug/debugger.hpp + debug/fpe.hpp + debug/fpe.cpp + debug/memory.cpp + debug/memory.hpp + debug/panic.cpp + debug/panic.hpp + debug/system.cpp + debug/system.hpp + debug/trace.cpp + debug/trace.hpp + debug/validate.cpp + debug/validate.hpp + debug/warn.cpp + debug/warn.hpp + encode/number.hpp + encode/base.cpp + encode/base.hpp + endian.cpp + endian.hpp + except.cpp + except.hpp + exe.hpp + expected.hpp + extent.cpp + extent.hpp + fixed.cpp + fixed.hpp + fixed_string.hpp + float.cpp + float.hpp + format/quoted.hpp + fourcc.cpp + fourcc.hpp + fs/scoped.cpp + fs/scoped.hpp + fs/tmp.hpp + functor.hpp + geom/fwd.hpp + geom/aabb.cpp + geom/aabb.hpp + geom/cylinder.cpp + geom/cylinder.hpp + geom/ellipse.cpp + geom/ellipse.hpp + geom/frustum.cpp + geom/frustum.hpp + geom/iostream.cpp + geom/iostream.hpp + geom/line.hpp + geom/line.cpp + geom/ops.cpp + geom/ops.hpp + geom/plane.cpp + geom/plane.hpp + geom/ray.cpp + geom/ray.hpp + geom/rect.cpp + geom/rect.hpp + geom/region.cpp + geom/sample/fwd.hpp + geom/sample/edge.hpp + geom/sample/surface.hpp + geom/sample/volume.hpp + geom/sample/subregion.hpp + geom/segment.cpp + geom/segment.hpp + geom/sphere.cpp + geom/sphere.hpp + geom/traits.hpp + geom/tri.cpp + geom/tri.hpp + hash.hpp + hash/fwd.hpp + hash/adapter.hpp + hash/adler.cpp + hash/adler.hpp + hash/buzhash.hpp + 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/halfsipmix.cpp + hash/halfsipmix.hpp + hash/mix.cpp + hash/mix.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 + hash/siphash.cpp + hash/siphash.hpp + hash/std.cpp + hash/std.hpp + hash/table.cpp + hash/table.hpp + hash/tuple.cpp + hash/tuple.hpp + hash/wang.hpp + hash/xxhash.cpp + hash/xxhash.hpp + init.cpp + init.hpp + introspection/enum_manual.cpp + introspection/enum_manual.hpp + introspection/enum_simple.cpp + introspection/enum_simple.hpp + introspection/name.cpp + introspection/name.hpp + introspection/type.cpp + introspection/type.hpp + io.cpp + io.hpp + iterator/cast.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/placement_output.hpp + iterator/referencing.hpp + iterator/transform.hpp + iterator/tuple_picker.hpp + iterator/unequal.hpp + iterator/unordered_insert.hpp + iterator/zip.hpp + job/fwd.hpp + job/dispatch.hpp + job/queue.cpp + job/queue.hpp + kmeans.hpp + library.hpp + list/node.hpp + list/sort.hpp + log.hpp + log/fwd.hpp + log/level.cpp + log/level.hpp + log/log.cpp + log/log.hpp + log/packet.cpp + log/packet.hpp + log/scoped.cpp + log/scoped.hpp + log/sink/base.cpp + log/sink/base.hpp + log/sink/console.cpp + log/sink/console.hpp + log/sink/null.cpp + log/sink/null.hpp + log/sink/path.cpp + log/sink/path.hpp + map/multi_fixed.cpp + map/multi_fixed.hpp + map/fixed.cpp + map/fixed.hpp + maths.cpp + maths.hpp + maths/fast.hpp + matrix.cpp + matrix2.cpp + matrix3.cpp + matrix4.cpp + matrix.hpp + memory/deleter.cpp + memory/deleter.hpp + parallel/queue.cpp + parallel/queue.hpp + parallel/stack.cpp + 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 + paths.cpp + paths.hpp + platform.hpp + point.cpp + point.hpp + pointer.hpp + polynomial.cpp + polynomial.hpp + pool.cpp + pool.hpp + "${PREFIX}/preprocessor.hpp" + quaternion.cpp + quaternion.hpp + rand/distribution/normal.cpp + rand/distribution/normal.hpp + rand/distribution/uniform.cpp + rand/distribution/uniform.hpp + rand/generic.hpp + rand/lcg.cpp + rand/lcg.hpp + rand/mwc64x.cpp + rand/mwc64x.hpp + rand/pcg.cpp + rand/pcg.hpp + rand/rdrand.cpp + rand/rdrand.hpp + rand/splitmix64.hpp + rand/system.hpp + rand/xoshiro.cpp + rand/xoshiro.hpp + rand/xorshift.cpp + rand/xorshift.hpp + random.cpp + random.hpp + range.cpp + range.hpp + rational.cpp + rational.hpp + region.cpp + region.hpp + registrar.cpp + registrar.hpp + roots/bisection.hpp + scoped.hpp + serialise/converter.hpp + serialise/ops.hpp + serialise/std.hpp + set/dset.cpp + set/dset.hpp + signal.cpp + signal.hpp + singleton.hpp + stats.cpp + stats.hpp + std.hpp + stream.cpp + stream.hpp + string.cpp + string.hpp + stringcache.cpp + stringcache.hpp + stringid.cpp + stringid.hpp + strongdef.cpp + strongdef.hpp + sysinfo.hpp + tap.cpp + tap.hpp + term.cpp + term.hpp + thread/event.hpp + thread/flag.hpp + thread/monitor.cpp + thread/monitor.hpp + thread/ticketlock.cpp + thread/ticketlock.hpp + thread/spinlock.cpp + thread/spinlock.hpp + time.cpp + time.hpp + time/parse.hpp + time/parse8601.cpp + tuple/index.hpp + tuple/type.hpp + tuple/value.hpp + typeidx.cpp + typeidx.hpp + types.hpp + types/sized.hpp + types/comparator.hpp + types/description.cpp + types/description.hpp + types/dispatch.hpp + types/string.cpp + types/string.hpp + types/tagged.hpp + types/traits.hpp + uri.cpp + uri.rl.cpp + uri.hpp + utf8.cpp + utf8.hpp + variadic.cpp + variadic.hpp + vector.cpp + vector.hpp + version.cpp + version.hpp + view.cpp + view.hpp +) + +option (SIMD "enable simd support" OFF) + +if (SIMD) + list (APPEND UTIL_FILES + "coord/simd.cpp" + "coord/simd.hpp" + "coord/simd_sse.hpp" + "coord/simd_neon.hpp" + ) +endif () + +##----------------------------------------------------------------------------- +## 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 + "${PREFIX}/preprocessor.hpp" +COMMENT + "[preprocessor.py] preprocessor.hpp" +COMMAND + "${Python3_EXECUTABLE}" + "${CMAKE_CURRENT_SOURCE_DIR}/../../preprocessor.py" + "${PREFIX}/preprocessor.hpp" + 480 +DEPENDS + "${CMAKE_CURRENT_SOURCE_DIR}/../../preprocessor.py" +) + + +############################################################################### +target_sources(libcruft-util PRIVATE ${UTIL_FILES}) +set_target_properties(libcruft-util +PROPERTIES + EXPORT_NAME "util" +) + +target_include_directories(libcruft-util +PUBLIC + $ +) + +install (TARGETS libcruft-util EXPORT cruft-util-targets LIBRARY COMPONENT development) + +set (headers ${UTIL_FILES}) +list (FILTER headers INCLUDE REGEX "\\.hpp$") +install (FILES ${headers} DESTINATION "include/cruft/util" COMPONENT development) + +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) + +target_link_libraries(libcruft-util ${SHM_LIBS}) +target_link_libraries(libcruft-util ${DL_LIBS}) +target_link_libraries(libcruft-util ${CLOCK_LIBS}) +target_link_libraries(libcruft-util ${MATH_LIBS}) + +# HACK: -ldl isn't getting discovered correctly so we add it unconditionally +# for the time being. +if (NOT WIN32) + target_link_libraries(libcruft-util dl) +endif () + + +############################################################################### +add_library(cruft::util ALIAS libcruft-util) +#add_library(cruft-util ALIAS cruft-util::cruft-util) + +export( + TARGETS libcruft-util + NAMESPACE cruft:: + APPEND FILE "${CMAKE_BINARY_DIR}/cruftConfig.cmake" +) + +install ( + EXPORT cruft-util-targets + NAMESPACE cruft:: + FILE cruft-config.cmake + DESTINATION "${CMAKE_INSTALL_LIBDIR}/cmake/cruft" +) diff --git a/abnf.rl b/cruft/util/abnf.rl similarity index 100% rename from abnf.rl rename to cruft/util/abnf.rl diff --git a/adapter.cpp b/cruft/util/adapter.cpp similarity index 100% rename from adapter.cpp rename to cruft/util/adapter.cpp diff --git a/adapter.hpp b/cruft/util/adapter.hpp similarity index 100% rename from adapter.hpp rename to cruft/util/adapter.hpp diff --git a/algo/search.hpp b/cruft/util/algo/search.hpp similarity index 100% rename from algo/search.hpp rename to cruft/util/algo/search.hpp diff --git a/algo/sort.cpp b/cruft/util/algo/sort.cpp similarity index 100% rename from algo/sort.cpp rename to cruft/util/algo/sort.cpp diff --git a/algo/sort.hpp b/cruft/util/algo/sort.hpp similarity index 100% rename from algo/sort.hpp rename to cruft/util/algo/sort.hpp diff --git a/alloc/affix.cpp b/cruft/util/alloc/affix.cpp similarity index 100% rename from alloc/affix.cpp rename to cruft/util/alloc/affix.cpp diff --git a/alloc/affix.hpp b/cruft/util/alloc/affix.hpp similarity index 100% rename from alloc/affix.hpp rename to cruft/util/alloc/affix.hpp diff --git a/alloc/aligned/direct.hpp b/cruft/util/alloc/aligned/direct.hpp similarity index 100% rename from alloc/aligned/direct.hpp rename to cruft/util/alloc/aligned/direct.hpp diff --git a/alloc/aligned/foreign.hpp b/cruft/util/alloc/aligned/foreign.hpp similarity index 100% rename from alloc/aligned/foreign.hpp rename to cruft/util/alloc/aligned/foreign.hpp diff --git a/alloc/allocator.cpp b/cruft/util/alloc/allocator.cpp similarity index 100% rename from alloc/allocator.cpp rename to cruft/util/alloc/allocator.cpp diff --git a/alloc/allocator.hpp b/cruft/util/alloc/allocator.hpp similarity index 100% rename from alloc/allocator.hpp rename to cruft/util/alloc/allocator.hpp diff --git a/alloc/chunked.cpp b/cruft/util/alloc/chunked.cpp similarity index 100% rename from alloc/chunked.cpp rename to cruft/util/alloc/chunked.cpp diff --git a/alloc/chunked.hpp b/cruft/util/alloc/chunked.hpp similarity index 100% rename from alloc/chunked.hpp rename to cruft/util/alloc/chunked.hpp diff --git a/alloc/easy.hpp b/cruft/util/alloc/easy.hpp similarity index 100% rename from alloc/easy.hpp rename to cruft/util/alloc/easy.hpp diff --git a/alloc/fallback.cpp b/cruft/util/alloc/fallback.cpp similarity index 100% rename from alloc/fallback.cpp rename to cruft/util/alloc/fallback.cpp diff --git a/alloc/fallback.hpp b/cruft/util/alloc/fallback.hpp similarity index 100% rename from alloc/fallback.hpp rename to cruft/util/alloc/fallback.hpp diff --git a/alloc/fwd.hpp b/cruft/util/alloc/fwd.hpp similarity index 100% rename from alloc/fwd.hpp rename to cruft/util/alloc/fwd.hpp diff --git a/alloc/linear.cpp b/cruft/util/alloc/linear.cpp similarity index 100% rename from alloc/linear.cpp rename to cruft/util/alloc/linear.cpp diff --git a/alloc/linear.hpp b/cruft/util/alloc/linear.hpp similarity index 100% rename from alloc/linear.hpp rename to cruft/util/alloc/linear.hpp diff --git a/alloc/malloc.cpp b/cruft/util/alloc/malloc.cpp similarity index 100% rename from alloc/malloc.cpp rename to cruft/util/alloc/malloc.cpp diff --git a/alloc/malloc.hpp b/cruft/util/alloc/malloc.hpp similarity index 100% rename from alloc/malloc.hpp rename to cruft/util/alloc/malloc.hpp diff --git a/alloc/null.cpp b/cruft/util/alloc/null.cpp similarity index 100% rename from alloc/null.cpp rename to cruft/util/alloc/null.cpp diff --git a/alloc/null.hpp b/cruft/util/alloc/null.hpp similarity index 100% rename from alloc/null.hpp rename to cruft/util/alloc/null.hpp diff --git a/alloc/stack.cpp b/cruft/util/alloc/stack.cpp similarity index 100% rename from alloc/stack.cpp rename to cruft/util/alloc/stack.cpp diff --git a/alloc/stack.hpp b/cruft/util/alloc/stack.hpp similarity index 100% rename from alloc/stack.hpp rename to cruft/util/alloc/stack.hpp diff --git a/alloc/std.hpp b/cruft/util/alloc/std.hpp similarity index 100% rename from alloc/std.hpp rename to cruft/util/alloc/std.hpp diff --git a/alloc/traits.hpp b/cruft/util/alloc/traits.hpp similarity index 100% rename from alloc/traits.hpp rename to cruft/util/alloc/traits.hpp diff --git a/annotation.hpp b/cruft/util/annotation.hpp similarity index 100% rename from annotation.hpp rename to cruft/util/annotation.hpp diff --git a/array/darray.hpp b/cruft/util/array/darray.hpp similarity index 100% rename from array/darray.hpp rename to cruft/util/array/darray.hpp diff --git a/array/md.cpp b/cruft/util/array/md.cpp similarity index 100% rename from array/md.cpp rename to cruft/util/array/md.cpp diff --git a/array/md.hpp b/cruft/util/array/md.hpp similarity index 100% rename from array/md.hpp rename to cruft/util/array/md.hpp diff --git a/array/parray.cpp b/cruft/util/array/parray.cpp similarity index 100% rename from array/parray.cpp rename to cruft/util/array/parray.cpp diff --git a/array/parray.hpp b/cruft/util/array/parray.hpp similarity index 100% rename from array/parray.hpp rename to cruft/util/array/parray.hpp diff --git a/array/sarray.cpp b/cruft/util/array/sarray.cpp similarity index 100% rename from array/sarray.cpp rename to cruft/util/array/sarray.cpp diff --git a/array/sarray.hpp b/cruft/util/array/sarray.hpp similarity index 100% rename from array/sarray.hpp rename to cruft/util/array/sarray.hpp diff --git a/array/varray.hpp b/cruft/util/array/varray.hpp similarity index 100% rename from array/varray.hpp rename to cruft/util/array/varray.hpp diff --git a/ascii.hpp b/cruft/util/ascii.hpp similarity index 100% rename from ascii.hpp rename to cruft/util/ascii.hpp diff --git a/backtrace.hpp b/cruft/util/backtrace.hpp similarity index 100% rename from backtrace.hpp rename to cruft/util/backtrace.hpp diff --git a/backtrace_execinfo.cpp b/cruft/util/backtrace_execinfo.cpp similarity index 100% rename from backtrace_execinfo.cpp rename to cruft/util/backtrace_execinfo.cpp diff --git a/backtrace_null.cpp b/cruft/util/backtrace_null.cpp similarity index 100% rename from backtrace_null.cpp rename to cruft/util/backtrace_null.cpp diff --git a/backtrace_stackwalk.cpp b/cruft/util/backtrace_stackwalk.cpp similarity index 100% rename from backtrace_stackwalk.cpp rename to cruft/util/backtrace_stackwalk.cpp diff --git a/backtrace_win32.cpp b/cruft/util/backtrace_win32.cpp similarity index 100% rename from backtrace_win32.cpp rename to cruft/util/backtrace_win32.cpp diff --git a/bezier.cpp b/cruft/util/bezier.cpp similarity index 100% rename from bezier.cpp rename to cruft/util/bezier.cpp diff --git a/bezier.hpp b/cruft/util/bezier.hpp similarity index 100% rename from bezier.hpp rename to cruft/util/bezier.hpp diff --git a/bezier1.cpp b/cruft/util/bezier1.cpp similarity index 100% rename from bezier1.cpp rename to cruft/util/bezier1.cpp diff --git a/bezier2.cpp b/cruft/util/bezier2.cpp similarity index 100% rename from bezier2.cpp rename to cruft/util/bezier2.cpp diff --git a/bezier3.cpp b/cruft/util/bezier3.cpp similarity index 100% rename from bezier3.cpp rename to cruft/util/bezier3.cpp diff --git a/bitwise.cpp b/cruft/util/bitwise.cpp similarity index 100% rename from bitwise.cpp rename to cruft/util/bitwise.cpp diff --git a/bitwise.hpp b/cruft/util/bitwise.hpp similarity index 100% rename from bitwise.hpp rename to cruft/util/bitwise.hpp diff --git a/bool.cpp b/cruft/util/bool.cpp similarity index 100% rename from bool.cpp rename to cruft/util/bool.cpp diff --git a/bool.hpp b/cruft/util/bool.hpp similarity index 100% rename from bool.hpp rename to cruft/util/bool.hpp diff --git a/buffer/circular.cpp b/cruft/util/buffer/circular.cpp similarity index 100% rename from buffer/circular.cpp rename to cruft/util/buffer/circular.cpp diff --git a/buffer/circular.hpp b/cruft/util/buffer/circular.hpp similarity index 100% rename from buffer/circular.hpp rename to cruft/util/buffer/circular.hpp diff --git a/buffer/paged.cpp b/cruft/util/buffer/paged.cpp similarity index 100% rename from buffer/paged.cpp rename to cruft/util/buffer/paged.cpp diff --git a/buffer/paged.hpp b/cruft/util/buffer/paged.hpp similarity index 100% rename from buffer/paged.hpp rename to cruft/util/buffer/paged.hpp diff --git a/buffer/paged_win32.cpp b/cruft/util/buffer/paged_win32.cpp similarity index 100% rename from buffer/paged_win32.cpp rename to cruft/util/buffer/paged_win32.cpp diff --git a/buffer/simple.cpp b/cruft/util/buffer/simple.cpp similarity index 100% rename from buffer/simple.cpp rename to cruft/util/buffer/simple.cpp diff --git a/buffer/simple.hpp b/cruft/util/buffer/simple.hpp similarity index 100% rename from buffer/simple.hpp rename to cruft/util/buffer/simple.hpp diff --git a/buffer/traits.hpp b/cruft/util/buffer/traits.hpp similarity index 100% rename from buffer/traits.hpp rename to cruft/util/buffer/traits.hpp diff --git a/cast.hpp b/cruft/util/cast.hpp similarity index 100% rename from cast.hpp rename to cruft/util/cast.hpp diff --git a/cmdopt.cpp b/cruft/util/cmdopt.cpp similarity index 100% rename from cmdopt.cpp rename to cruft/util/cmdopt.cpp diff --git a/cmdopt.hpp b/cruft/util/cmdopt.hpp similarity index 100% rename from cmdopt.hpp rename to cruft/util/cmdopt.hpp diff --git a/cmdopt2/args.cpp b/cruft/util/cmdopt2/args.cpp similarity index 100% rename from cmdopt2/args.cpp rename to cruft/util/cmdopt2/args.cpp diff --git a/cmdopt2/args.hpp b/cruft/util/cmdopt2/args.hpp similarity index 100% rename from cmdopt2/args.hpp rename to cruft/util/cmdopt2/args.hpp diff --git a/cmdopt2/fwd.hpp b/cruft/util/cmdopt2/fwd.hpp similarity index 100% rename from cmdopt2/fwd.hpp rename to cruft/util/cmdopt2/fwd.hpp diff --git a/cmdopt2/parser.cpp b/cruft/util/cmdopt2/parser.cpp similarity index 100% rename from cmdopt2/parser.cpp rename to cruft/util/cmdopt2/parser.cpp diff --git a/cmdopt2/parser.hpp b/cruft/util/cmdopt2/parser.hpp similarity index 100% rename from cmdopt2/parser.hpp rename to cruft/util/cmdopt2/parser.hpp diff --git a/colour.cpp b/cruft/util/colour.cpp similarity index 100% rename from colour.cpp rename to cruft/util/colour.cpp diff --git a/colour.hpp b/cruft/util/colour.hpp similarity index 100% rename from colour.hpp rename to cruft/util/colour.hpp diff --git a/concepts.hpp b/cruft/util/concepts.hpp similarity index 100% rename from concepts.hpp rename to cruft/util/concepts.hpp diff --git a/concepts/clock.hpp b/cruft/util/concepts/clock.hpp similarity index 100% rename from concepts/clock.hpp rename to cruft/util/concepts/clock.hpp diff --git a/concepts/named.hpp b/cruft/util/concepts/named.hpp similarity index 100% rename from concepts/named.hpp rename to cruft/util/concepts/named.hpp diff --git a/concepts/string.hpp b/cruft/util/concepts/string.hpp similarity index 100% rename from concepts/string.hpp rename to cruft/util/concepts/string.hpp diff --git a/concepts/traits.hpp b/cruft/util/concepts/traits.hpp similarity index 100% rename from concepts/traits.hpp rename to cruft/util/concepts/traits.hpp diff --git a/container.hpp b/cruft/util/container.hpp similarity index 100% rename from container.hpp rename to cruft/util/container.hpp diff --git a/coord.hpp b/cruft/util/coord.hpp similarity index 100% rename from coord.hpp rename to cruft/util/coord.hpp diff --git a/coord/base.hpp b/cruft/util/coord/base.hpp similarity index 100% rename from coord/base.hpp rename to cruft/util/coord/base.hpp diff --git a/coord/comparator.hpp b/cruft/util/coord/comparator.hpp similarity index 100% rename from coord/comparator.hpp rename to cruft/util/coord/comparator.hpp diff --git a/coord/fwd.hpp b/cruft/util/coord/fwd.hpp similarity index 100% rename from coord/fwd.hpp rename to cruft/util/coord/fwd.hpp diff --git a/coord/init.hpp b/cruft/util/coord/init.hpp similarity index 100% rename from coord/init.hpp rename to cruft/util/coord/init.hpp diff --git a/coord/iostream.hpp b/cruft/util/coord/iostream.hpp similarity index 100% rename from coord/iostream.hpp rename to cruft/util/coord/iostream.hpp diff --git a/coord/ops.hpp b/cruft/util/coord/ops.hpp similarity index 100% rename from coord/ops.hpp rename to cruft/util/coord/ops.hpp diff --git a/coord/simd.cpp b/cruft/util/coord/simd.cpp similarity index 100% rename from coord/simd.cpp rename to cruft/util/coord/simd.cpp diff --git a/coord/simd.hpp b/cruft/util/coord/simd.hpp similarity index 100% rename from coord/simd.hpp rename to cruft/util/coord/simd.hpp diff --git a/coord/simd_neon.hpp b/cruft/util/coord/simd_neon.hpp similarity index 100% rename from coord/simd_neon.hpp rename to cruft/util/coord/simd_neon.hpp diff --git a/coord/simd_sse.hpp b/cruft/util/coord/simd_sse.hpp similarity index 100% rename from coord/simd_sse.hpp rename to cruft/util/coord/simd_sse.hpp diff --git a/coord/store.hpp b/cruft/util/coord/store.hpp similarity index 100% rename from coord/store.hpp rename to cruft/util/coord/store.hpp diff --git a/coord/traits.hpp b/cruft/util/coord/traits.hpp similarity index 100% rename from coord/traits.hpp rename to cruft/util/coord/traits.hpp diff --git a/cpp.cpp b/cruft/util/cpp.cpp similarity index 100% rename from cpp.cpp rename to cruft/util/cpp.cpp diff --git a/cpp.hpp b/cruft/util/cpp.hpp similarity index 100% rename from cpp.hpp rename to cruft/util/cpp.hpp diff --git a/cpuid.cpp b/cruft/util/cpuid.cpp similarity index 100% rename from cpuid.cpp rename to cruft/util/cpuid.cpp diff --git a/cpuid.hpp b/cruft/util/cpuid.hpp similarity index 100% rename from cpuid.hpp rename to cruft/util/cpuid.hpp diff --git a/cpuid/none.cpp b/cruft/util/cpuid/none.cpp similarity index 100% rename from cpuid/none.cpp rename to cruft/util/cpuid/none.cpp diff --git a/cpuid/none.hpp b/cruft/util/cpuid/none.hpp similarity index 100% rename from cpuid/none.hpp rename to cruft/util/cpuid/none.hpp diff --git a/cpuid/x86.cpp b/cruft/util/cpuid/x86.cpp similarity index 100% rename from cpuid/x86.cpp rename to cruft/util/cpuid/x86.cpp diff --git a/cpuid/x86.hpp b/cruft/util/cpuid/x86.hpp similarity index 100% rename from cpuid/x86.hpp rename to cruft/util/cpuid/x86.hpp diff --git a/debug/assert.cpp b/cruft/util/debug/assert.cpp similarity index 100% rename from debug/assert.cpp rename to cruft/util/debug/assert.cpp diff --git a/debug/assert.hpp b/cruft/util/debug/assert.hpp similarity index 100% rename from debug/assert.hpp rename to cruft/util/debug/assert.hpp diff --git a/debug/common.cpp b/cruft/util/debug/common.cpp similarity index 100% rename from debug/common.cpp rename to cruft/util/debug/common.cpp diff --git a/debug/common.hpp b/cruft/util/debug/common.hpp similarity index 100% rename from debug/common.hpp rename to cruft/util/debug/common.hpp diff --git a/debug/compiler.cpp b/cruft/util/debug/compiler.cpp similarity index 100% rename from debug/compiler.cpp rename to cruft/util/debug/compiler.cpp diff --git a/debug/compiler.hpp b/cruft/util/debug/compiler.hpp similarity index 100% rename from debug/compiler.hpp rename to cruft/util/debug/compiler.hpp diff --git a/debug/crash.hpp b/cruft/util/debug/crash.hpp similarity index 100% rename from debug/crash.hpp rename to cruft/util/debug/crash.hpp diff --git a/debug/crash_posix.cpp b/cruft/util/debug/crash_posix.cpp similarity index 100% rename from debug/crash_posix.cpp rename to cruft/util/debug/crash_posix.cpp diff --git a/debug/crash_win32.cpp b/cruft/util/debug/crash_win32.cpp similarity index 100% rename from debug/crash_win32.cpp rename to cruft/util/debug/crash_win32.cpp diff --git a/debug/debugger.cpp b/cruft/util/debug/debugger.cpp similarity index 100% rename from debug/debugger.cpp rename to cruft/util/debug/debugger.cpp diff --git a/debug/debugger.hpp b/cruft/util/debug/debugger.hpp similarity index 100% rename from debug/debugger.hpp rename to cruft/util/debug/debugger.hpp diff --git a/debug/fpe.cpp b/cruft/util/debug/fpe.cpp similarity index 100% rename from debug/fpe.cpp rename to cruft/util/debug/fpe.cpp diff --git a/debug/fpe.hpp b/cruft/util/debug/fpe.hpp similarity index 100% rename from debug/fpe.hpp rename to cruft/util/debug/fpe.hpp diff --git a/debug/fpe_posix.cpp b/cruft/util/debug/fpe_posix.cpp similarity index 100% rename from debug/fpe_posix.cpp rename to cruft/util/debug/fpe_posix.cpp diff --git a/debug/fpe_win32.cpp b/cruft/util/debug/fpe_win32.cpp similarity index 100% rename from debug/fpe_win32.cpp rename to cruft/util/debug/fpe_win32.cpp diff --git a/debug/gdb/printers.py b/cruft/util/debug/gdb/printers.py similarity index 100% rename from debug/gdb/printers.py rename to cruft/util/debug/gdb/printers.py diff --git a/debug/memory.cpp b/cruft/util/debug/memory.cpp similarity index 96% rename from debug/memory.cpp rename to cruft/util/debug/memory.cpp index e9e615a6..85a3d214 100644 --- a/debug/memory.cpp +++ b/cruft/util/debug/memory.cpp @@ -8,9 +8,9 @@ #include "memory.hpp" -#include "std.hpp" -#include "maths.hpp" -#include "debug/panic.hpp" +#include +#include +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/debug/memory.hpp b/cruft/util/debug/memory.hpp similarity index 100% rename from debug/memory.hpp rename to cruft/util/debug/memory.hpp diff --git a/debug/panic.cpp b/cruft/util/debug/panic.cpp similarity index 100% rename from debug/panic.cpp rename to cruft/util/debug/panic.cpp diff --git a/debug/panic.hpp b/cruft/util/debug/panic.hpp similarity index 100% rename from debug/panic.hpp rename to cruft/util/debug/panic.hpp diff --git a/debug/system.cpp b/cruft/util/debug/system.cpp similarity index 98% rename from debug/system.cpp rename to cruft/util/debug/system.cpp index c2c4027b..d86f9ba6 100644 --- a/debug/system.cpp +++ b/cruft/util/debug/system.cpp @@ -10,9 +10,10 @@ #include "./assert.hpp" #include "./debugger.hpp" -#include "./except.hpp" #include "./crash.hpp" +#include + #include "../backtrace.hpp" #include "../log.hpp" diff --git a/debug/system.hpp b/cruft/util/debug/system.hpp similarity index 100% rename from debug/system.hpp rename to cruft/util/debug/system.hpp diff --git a/debug/system_posix.cpp b/cruft/util/debug/system_posix.cpp similarity index 100% rename from debug/system_posix.cpp rename to cruft/util/debug/system_posix.cpp diff --git a/debug/system_win32.cpp b/cruft/util/debug/system_win32.cpp similarity index 100% rename from debug/system_win32.cpp rename to cruft/util/debug/system_win32.cpp diff --git a/debug/trace.cpp b/cruft/util/debug/trace.cpp similarity index 100% rename from debug/trace.cpp rename to cruft/util/debug/trace.cpp diff --git a/debug/trace.hpp b/cruft/util/debug/trace.hpp similarity index 100% rename from debug/trace.hpp rename to cruft/util/debug/trace.hpp diff --git a/debug/validate.cpp b/cruft/util/debug/validate.cpp similarity index 95% rename from debug/validate.cpp rename to cruft/util/debug/validate.cpp index edecdfc2..211cac9e 100644 --- a/debug/validate.cpp +++ b/cruft/util/debug/validate.cpp @@ -8,7 +8,7 @@ #include "./validate.hpp" -#include "preprocessor.hpp" +#include #include @@ -31,7 +31,7 @@ cruft::debug::validator::is_valid (const double &val) noexcept } /////////////////////////////////////////////////////////////////////////////// -#include "std.hpp" +#include //----------------------------------------------------------------------------- diff --git a/debug/validate.hpp b/cruft/util/debug/validate.hpp similarity index 100% rename from debug/validate.hpp rename to cruft/util/debug/validate.hpp diff --git a/debug/warn.cpp b/cruft/util/debug/warn.cpp similarity index 100% rename from debug/warn.cpp rename to cruft/util/debug/warn.cpp diff --git a/debug/warn.hpp b/cruft/util/debug/warn.hpp similarity index 100% rename from debug/warn.hpp rename to cruft/util/debug/warn.hpp diff --git a/debug_posix.cpp b/cruft/util/debug_posix.cpp similarity index 100% rename from debug_posix.cpp rename to cruft/util/debug_posix.cpp diff --git a/debug_win32.cpp b/cruft/util/debug_win32.cpp similarity index 100% rename from debug_win32.cpp rename to cruft/util/debug_win32.cpp diff --git a/encode/base.cpp b/cruft/util/encode/base.cpp similarity index 100% rename from encode/base.cpp rename to cruft/util/encode/base.cpp diff --git a/encode/base.hpp b/cruft/util/encode/base.hpp similarity index 100% rename from encode/base.hpp rename to cruft/util/encode/base.hpp diff --git a/encode/number.hpp b/cruft/util/encode/number.hpp similarity index 100% rename from encode/number.hpp rename to cruft/util/encode/number.hpp diff --git a/endian.cpp b/cruft/util/endian.cpp similarity index 100% rename from endian.cpp rename to cruft/util/endian.cpp diff --git a/endian.hpp b/cruft/util/endian.hpp similarity index 100% rename from endian.hpp rename to cruft/util/endian.hpp diff --git a/except.cpp b/cruft/util/except.cpp similarity index 100% rename from except.cpp rename to cruft/util/except.cpp diff --git a/except.hpp b/cruft/util/except.hpp similarity index 100% rename from except.hpp rename to cruft/util/except.hpp diff --git a/exe.hpp b/cruft/util/exe.hpp similarity index 100% rename from exe.hpp rename to cruft/util/exe.hpp diff --git a/exe_freebsd.cpp b/cruft/util/exe_freebsd.cpp similarity index 100% rename from exe_freebsd.cpp rename to cruft/util/exe_freebsd.cpp diff --git a/exe_linux.cpp b/cruft/util/exe_linux.cpp similarity index 100% rename from exe_linux.cpp rename to cruft/util/exe_linux.cpp diff --git a/exe_win32.cpp b/cruft/util/exe_win32.cpp similarity index 100% rename from exe_win32.cpp rename to cruft/util/exe_win32.cpp diff --git a/expected.hpp b/cruft/util/expected.hpp similarity index 100% rename from expected.hpp rename to cruft/util/expected.hpp diff --git a/extent.cpp b/cruft/util/extent.cpp similarity index 100% rename from extent.cpp rename to cruft/util/extent.cpp diff --git a/extent.hpp b/cruft/util/extent.hpp similarity index 100% rename from extent.hpp rename to cruft/util/extent.hpp diff --git a/fixed.cpp b/cruft/util/fixed.cpp similarity index 100% rename from fixed.cpp rename to cruft/util/fixed.cpp diff --git a/fixed.hpp b/cruft/util/fixed.hpp similarity index 100% rename from fixed.hpp rename to cruft/util/fixed.hpp diff --git a/fixed_string.hpp b/cruft/util/fixed_string.hpp similarity index 100% rename from fixed_string.hpp rename to cruft/util/fixed_string.hpp diff --git a/float.cpp b/cruft/util/float.cpp similarity index 100% rename from float.cpp rename to cruft/util/float.cpp diff --git a/float.hpp b/cruft/util/float.hpp similarity index 100% rename from float.hpp rename to cruft/util/float.hpp diff --git a/format/quoted.hpp b/cruft/util/format/quoted.hpp similarity index 100% rename from format/quoted.hpp rename to cruft/util/format/quoted.hpp diff --git a/fourcc.cpp b/cruft/util/fourcc.cpp similarity index 100% rename from fourcc.cpp rename to cruft/util/fourcc.cpp diff --git a/fourcc.hpp b/cruft/util/fourcc.hpp similarity index 100% rename from fourcc.hpp rename to cruft/util/fourcc.hpp diff --git a/fs/scoped.cpp b/cruft/util/fs/scoped.cpp similarity index 100% rename from fs/scoped.cpp rename to cruft/util/fs/scoped.cpp diff --git a/fs/scoped.hpp b/cruft/util/fs/scoped.hpp similarity index 100% rename from fs/scoped.hpp rename to cruft/util/fs/scoped.hpp diff --git a/fs/tmp.hpp b/cruft/util/fs/tmp.hpp similarity index 100% rename from fs/tmp.hpp rename to cruft/util/fs/tmp.hpp diff --git a/fs/tmp_posix.cpp b/cruft/util/fs/tmp_posix.cpp similarity index 95% rename from fs/tmp_posix.cpp rename to cruft/util/fs/tmp_posix.cpp index 8287feed..f52c3d84 100644 --- a/fs/tmp_posix.cpp +++ b/cruft/util/fs/tmp_posix.cpp @@ -8,8 +8,8 @@ #include "./tmp.hpp" -#include "./paths.hpp" -#include "./posix/except.hpp" +#include +#include #include diff --git a/fs/tmp_win32.cpp b/cruft/util/fs/tmp_win32.cpp similarity index 100% rename from fs/tmp_win32.cpp rename to cruft/util/fs/tmp_win32.cpp diff --git a/functor.hpp b/cruft/util/functor.hpp similarity index 100% rename from functor.hpp rename to cruft/util/functor.hpp diff --git a/fwd.hpp b/cruft/util/fwd.hpp similarity index 100% rename from fwd.hpp rename to cruft/util/fwd.hpp diff --git a/gcc.hpp b/cruft/util/gcc.hpp similarity index 100% rename from gcc.hpp rename to cruft/util/gcc.hpp diff --git a/geom/aabb.cpp b/cruft/util/geom/aabb.cpp similarity index 100% rename from geom/aabb.cpp rename to cruft/util/geom/aabb.cpp diff --git a/geom/aabb.hpp b/cruft/util/geom/aabb.hpp similarity index 100% rename from geom/aabb.hpp rename to cruft/util/geom/aabb.hpp diff --git a/geom/cylinder.cpp b/cruft/util/geom/cylinder.cpp similarity index 100% rename from geom/cylinder.cpp rename to cruft/util/geom/cylinder.cpp diff --git a/geom/cylinder.hpp b/cruft/util/geom/cylinder.hpp similarity index 100% rename from geom/cylinder.hpp rename to cruft/util/geom/cylinder.hpp diff --git a/geom/ellipse.cpp b/cruft/util/geom/ellipse.cpp similarity index 99% rename from geom/ellipse.cpp rename to cruft/util/geom/ellipse.cpp index dcf8968b..09696bbf 100644 --- a/geom/ellipse.cpp +++ b/cruft/util/geom/ellipse.cpp @@ -12,7 +12,8 @@ #include "aabb.hpp" #include "ray.hpp" #include "sphere.hpp" -#include "quaternion.hpp" + +#include #include "../point.hpp" #include "../matrix.hpp" diff --git a/geom/ellipse.hpp b/cruft/util/geom/ellipse.hpp similarity index 100% rename from geom/ellipse.hpp rename to cruft/util/geom/ellipse.hpp diff --git a/geom/frustum.cpp b/cruft/util/geom/frustum.cpp similarity index 100% rename from geom/frustum.cpp rename to cruft/util/geom/frustum.cpp diff --git a/geom/frustum.hpp b/cruft/util/geom/frustum.hpp similarity index 100% rename from geom/frustum.hpp rename to cruft/util/geom/frustum.hpp diff --git a/geom/fwd.hpp b/cruft/util/geom/fwd.hpp similarity index 100% rename from geom/fwd.hpp rename to cruft/util/geom/fwd.hpp diff --git a/geom/iostream.cpp b/cruft/util/geom/iostream.cpp similarity index 100% rename from geom/iostream.cpp rename to cruft/util/geom/iostream.cpp diff --git a/geom/iostream.hpp b/cruft/util/geom/iostream.hpp similarity index 100% rename from geom/iostream.hpp rename to cruft/util/geom/iostream.hpp diff --git a/geom/line.cpp b/cruft/util/geom/line.cpp similarity index 100% rename from geom/line.cpp rename to cruft/util/geom/line.cpp diff --git a/geom/line.hpp b/cruft/util/geom/line.hpp similarity index 100% rename from geom/line.hpp rename to cruft/util/geom/line.hpp diff --git a/geom/ops.cpp b/cruft/util/geom/ops.cpp similarity index 100% rename from geom/ops.cpp rename to cruft/util/geom/ops.cpp diff --git a/geom/ops.hpp b/cruft/util/geom/ops.hpp similarity index 100% rename from geom/ops.hpp rename to cruft/util/geom/ops.hpp diff --git a/geom/plane.cpp b/cruft/util/geom/plane.cpp similarity index 100% rename from geom/plane.cpp rename to cruft/util/geom/plane.cpp diff --git a/geom/plane.hpp b/cruft/util/geom/plane.hpp similarity index 100% rename from geom/plane.hpp rename to cruft/util/geom/plane.hpp diff --git a/geom/ray.cpp b/cruft/util/geom/ray.cpp similarity index 100% rename from geom/ray.cpp rename to cruft/util/geom/ray.cpp diff --git a/geom/ray.hpp b/cruft/util/geom/ray.hpp similarity index 100% rename from geom/ray.hpp rename to cruft/util/geom/ray.hpp diff --git a/geom/rect.cpp b/cruft/util/geom/rect.cpp similarity index 100% rename from geom/rect.cpp rename to cruft/util/geom/rect.cpp diff --git a/geom/rect.hpp b/cruft/util/geom/rect.hpp similarity index 100% rename from geom/rect.hpp rename to cruft/util/geom/rect.hpp diff --git a/geom/region.cpp b/cruft/util/geom/region.cpp similarity index 100% rename from geom/region.cpp rename to cruft/util/geom/region.cpp diff --git a/geom/sample/edge.hpp b/cruft/util/geom/sample/edge.hpp similarity index 100% rename from geom/sample/edge.hpp rename to cruft/util/geom/sample/edge.hpp diff --git a/geom/sample/fwd.hpp b/cruft/util/geom/sample/fwd.hpp similarity index 100% rename from geom/sample/fwd.hpp rename to cruft/util/geom/sample/fwd.hpp diff --git a/geom/sample/subregion.hpp b/cruft/util/geom/sample/subregion.hpp similarity index 100% rename from geom/sample/subregion.hpp rename to cruft/util/geom/sample/subregion.hpp diff --git a/geom/sample/surface.hpp b/cruft/util/geom/sample/surface.hpp similarity index 100% rename from geom/sample/surface.hpp rename to cruft/util/geom/sample/surface.hpp diff --git a/geom/sample/volume.hpp b/cruft/util/geom/sample/volume.hpp similarity index 100% rename from geom/sample/volume.hpp rename to cruft/util/geom/sample/volume.hpp diff --git a/geom/segment.cpp b/cruft/util/geom/segment.cpp similarity index 100% rename from geom/segment.cpp rename to cruft/util/geom/segment.cpp diff --git a/geom/segment.hpp b/cruft/util/geom/segment.hpp similarity index 100% rename from geom/segment.hpp rename to cruft/util/geom/segment.hpp diff --git a/geom/sphere.cpp b/cruft/util/geom/sphere.cpp similarity index 100% rename from geom/sphere.cpp rename to cruft/util/geom/sphere.cpp diff --git a/geom/sphere.hpp b/cruft/util/geom/sphere.hpp similarity index 100% rename from geom/sphere.hpp rename to cruft/util/geom/sphere.hpp diff --git a/geom/traits.hpp b/cruft/util/geom/traits.hpp similarity index 100% rename from geom/traits.hpp rename to cruft/util/geom/traits.hpp diff --git a/geom/tri.cpp b/cruft/util/geom/tri.cpp similarity index 100% rename from geom/tri.cpp rename to cruft/util/geom/tri.cpp diff --git a/geom/tri.hpp b/cruft/util/geom/tri.hpp similarity index 100% rename from geom/tri.hpp rename to cruft/util/geom/tri.hpp diff --git a/hash.hpp b/cruft/util/hash.hpp similarity index 100% rename from hash.hpp rename to cruft/util/hash.hpp diff --git a/hash/adapter.hpp b/cruft/util/hash/adapter.hpp similarity index 100% rename from hash/adapter.hpp rename to cruft/util/hash/adapter.hpp diff --git a/hash/adler.cpp b/cruft/util/hash/adler.cpp similarity index 100% rename from hash/adler.cpp rename to cruft/util/hash/adler.cpp diff --git a/hash/adler.hpp b/cruft/util/hash/adler.hpp similarity index 100% rename from hash/adler.hpp rename to cruft/util/hash/adler.hpp diff --git a/hash/bsdsum.cpp b/cruft/util/hash/bsdsum.cpp similarity index 100% rename from hash/bsdsum.cpp rename to cruft/util/hash/bsdsum.cpp diff --git a/hash/bsdsum.hpp b/cruft/util/hash/bsdsum.hpp similarity index 100% rename from hash/bsdsum.hpp rename to cruft/util/hash/bsdsum.hpp diff --git a/hash/buzhash.hpp b/cruft/util/hash/buzhash.hpp similarity index 100% rename from hash/buzhash.hpp rename to cruft/util/hash/buzhash.hpp diff --git a/hash/crc.cpp b/cruft/util/hash/crc.cpp similarity index 100% rename from hash/crc.cpp rename to cruft/util/hash/crc.cpp diff --git a/hash/crc.hpp b/cruft/util/hash/crc.hpp similarity index 100% rename from hash/crc.hpp rename to cruft/util/hash/crc.hpp diff --git a/hash/fasthash.cpp b/cruft/util/hash/fasthash.cpp similarity index 100% rename from hash/fasthash.cpp rename to cruft/util/hash/fasthash.cpp diff --git a/hash/fasthash.hpp b/cruft/util/hash/fasthash.hpp similarity index 100% rename from hash/fasthash.hpp rename to cruft/util/hash/fasthash.hpp diff --git a/hash/fletcher.cpp b/cruft/util/hash/fletcher.cpp similarity index 100% rename from hash/fletcher.cpp rename to cruft/util/hash/fletcher.cpp diff --git a/hash/fletcher.hpp b/cruft/util/hash/fletcher.hpp similarity index 100% rename from hash/fletcher.hpp rename to cruft/util/hash/fletcher.hpp diff --git a/hash/fnv1a.cpp b/cruft/util/hash/fnv1a.cpp similarity index 100% rename from hash/fnv1a.cpp rename to cruft/util/hash/fnv1a.cpp diff --git a/hash/fnv1a.hpp b/cruft/util/hash/fnv1a.hpp similarity index 94% rename from hash/fnv1a.hpp rename to cruft/util/hash/fnv1a.hpp index c70c059b..4c4ac0c5 100644 --- a/hash/fnv1a.hpp +++ b/cruft/util/hash/fnv1a.hpp @@ -8,7 +8,7 @@ #pragma once -#include "view.hpp" +#include #include #include diff --git a/hash/fwd.hpp b/cruft/util/hash/fwd.hpp similarity index 100% rename from hash/fwd.hpp rename to cruft/util/hash/fwd.hpp diff --git a/hash/halfsipmix.cpp b/cruft/util/hash/halfsipmix.cpp similarity index 100% rename from hash/halfsipmix.cpp rename to cruft/util/hash/halfsipmix.cpp diff --git a/hash/halfsipmix.hpp b/cruft/util/hash/halfsipmix.hpp similarity index 100% rename from hash/halfsipmix.hpp rename to cruft/util/hash/halfsipmix.hpp diff --git a/hash/mix.cpp b/cruft/util/hash/mix.cpp similarity index 100% rename from hash/mix.cpp rename to cruft/util/hash/mix.cpp diff --git a/hash/mix.hpp b/cruft/util/hash/mix.hpp similarity index 100% rename from hash/mix.hpp rename to cruft/util/hash/mix.hpp diff --git a/hash/murmur.hpp b/cruft/util/hash/murmur.hpp similarity index 100% rename from hash/murmur.hpp rename to cruft/util/hash/murmur.hpp diff --git a/hash/murmur/common.cpp b/cruft/util/hash/murmur/common.cpp similarity index 100% rename from hash/murmur/common.cpp rename to cruft/util/hash/murmur/common.cpp diff --git a/hash/murmur/common.hpp b/cruft/util/hash/murmur/common.hpp similarity index 100% rename from hash/murmur/common.hpp rename to cruft/util/hash/murmur/common.hpp diff --git a/hash/murmur/murmur1.cpp b/cruft/util/hash/murmur/murmur1.cpp similarity index 100% rename from hash/murmur/murmur1.cpp rename to cruft/util/hash/murmur/murmur1.cpp diff --git a/hash/murmur/murmur1.hpp b/cruft/util/hash/murmur/murmur1.hpp similarity index 100% rename from hash/murmur/murmur1.hpp rename to cruft/util/hash/murmur/murmur1.hpp diff --git a/hash/murmur/murmur2.cpp b/cruft/util/hash/murmur/murmur2.cpp similarity index 100% rename from hash/murmur/murmur2.cpp rename to cruft/util/hash/murmur/murmur2.cpp diff --git a/hash/murmur/murmur2.hpp b/cruft/util/hash/murmur/murmur2.hpp similarity index 100% rename from hash/murmur/murmur2.hpp rename to cruft/util/hash/murmur/murmur2.hpp diff --git a/hash/murmur/murmur3.cpp b/cruft/util/hash/murmur/murmur3.cpp similarity index 100% rename from hash/murmur/murmur3.cpp rename to cruft/util/hash/murmur/murmur3.cpp diff --git a/hash/murmur/murmur3.hpp b/cruft/util/hash/murmur/murmur3.hpp similarity index 100% rename from hash/murmur/murmur3.hpp rename to cruft/util/hash/murmur/murmur3.hpp diff --git a/hash/siphash.cpp b/cruft/util/hash/siphash.cpp similarity index 100% rename from hash/siphash.cpp rename to cruft/util/hash/siphash.cpp diff --git a/hash/siphash.hpp b/cruft/util/hash/siphash.hpp similarity index 100% rename from hash/siphash.hpp rename to cruft/util/hash/siphash.hpp diff --git a/hash/std.cpp b/cruft/util/hash/std.cpp similarity index 100% rename from hash/std.cpp rename to cruft/util/hash/std.cpp diff --git a/hash/std.hpp b/cruft/util/hash/std.hpp similarity index 100% rename from hash/std.hpp rename to cruft/util/hash/std.hpp diff --git a/hash/table.cpp b/cruft/util/hash/table.cpp similarity index 100% rename from hash/table.cpp rename to cruft/util/hash/table.cpp diff --git a/hash/table.hpp b/cruft/util/hash/table.hpp similarity index 100% rename from hash/table.hpp rename to cruft/util/hash/table.hpp diff --git a/hash/tuple.cpp b/cruft/util/hash/tuple.cpp similarity index 100% rename from hash/tuple.cpp rename to cruft/util/hash/tuple.cpp diff --git a/hash/tuple.hpp b/cruft/util/hash/tuple.hpp similarity index 100% rename from hash/tuple.hpp rename to cruft/util/hash/tuple.hpp diff --git a/hash/wang.hpp b/cruft/util/hash/wang.hpp similarity index 100% rename from hash/wang.hpp rename to cruft/util/hash/wang.hpp diff --git a/hash/xxhash.cpp b/cruft/util/hash/xxhash.cpp similarity index 100% rename from hash/xxhash.cpp rename to cruft/util/hash/xxhash.cpp diff --git a/hash/xxhash.hpp b/cruft/util/hash/xxhash.hpp similarity index 100% rename from hash/xxhash.hpp rename to cruft/util/hash/xxhash.hpp diff --git a/init.cpp b/cruft/util/init.cpp similarity index 100% rename from init.cpp rename to cruft/util/init.cpp diff --git a/init.hpp b/cruft/util/init.hpp similarity index 100% rename from init.hpp rename to cruft/util/init.hpp diff --git a/introspection/enum_manual.cpp b/cruft/util/introspection/enum_manual.cpp similarity index 100% rename from introspection/enum_manual.cpp rename to cruft/util/introspection/enum_manual.cpp diff --git a/introspection/enum_manual.hpp b/cruft/util/introspection/enum_manual.hpp similarity index 100% rename from introspection/enum_manual.hpp rename to cruft/util/introspection/enum_manual.hpp diff --git a/introspection/enum_simple.cpp b/cruft/util/introspection/enum_simple.cpp similarity index 100% rename from introspection/enum_simple.cpp rename to cruft/util/introspection/enum_simple.cpp diff --git a/introspection/enum_simple.hpp b/cruft/util/introspection/enum_simple.hpp similarity index 100% rename from introspection/enum_simple.hpp rename to cruft/util/introspection/enum_simple.hpp diff --git a/introspection/name.cpp b/cruft/util/introspection/name.cpp similarity index 100% rename from introspection/name.cpp rename to cruft/util/introspection/name.cpp diff --git a/introspection/name.hpp b/cruft/util/introspection/name.hpp similarity index 100% rename from introspection/name.hpp rename to cruft/util/introspection/name.hpp diff --git a/introspection/type.cpp b/cruft/util/introspection/type.cpp similarity index 100% rename from introspection/type.cpp rename to cruft/util/introspection/type.cpp diff --git a/introspection/type.hpp b/cruft/util/introspection/type.hpp similarity index 100% rename from introspection/type.hpp rename to cruft/util/introspection/type.hpp diff --git a/io.cpp b/cruft/util/io.cpp similarity index 100% rename from io.cpp rename to cruft/util/io.cpp diff --git a/io.hpp b/cruft/util/io.hpp similarity index 100% rename from io.hpp rename to cruft/util/io.hpp diff --git a/io_posix.cpp b/cruft/util/io_posix.cpp similarity index 100% rename from io_posix.cpp rename to cruft/util/io_posix.cpp diff --git a/io_posix.hpp b/cruft/util/io_posix.hpp similarity index 100% rename from io_posix.hpp rename to cruft/util/io_posix.hpp diff --git a/io_win32.cpp b/cruft/util/io_win32.cpp similarity index 100% rename from io_win32.cpp rename to cruft/util/io_win32.cpp diff --git a/io_win32.hpp b/cruft/util/io_win32.hpp similarity index 100% rename from io_win32.hpp rename to cruft/util/io_win32.hpp diff --git a/iterator/cast.hpp b/cruft/util/iterator/cast.hpp similarity index 100% rename from iterator/cast.hpp rename to cruft/util/iterator/cast.hpp diff --git a/iterator/constant.hpp b/cruft/util/iterator/constant.hpp similarity index 100% rename from iterator/constant.hpp rename to cruft/util/iterator/constant.hpp diff --git a/iterator/counting.hpp b/cruft/util/iterator/counting.hpp similarity index 100% rename from iterator/counting.hpp rename to cruft/util/iterator/counting.hpp diff --git a/iterator/dereference.hpp b/cruft/util/iterator/dereference.hpp similarity index 100% rename from iterator/dereference.hpp rename to cruft/util/iterator/dereference.hpp diff --git a/iterator/discard.hpp b/cruft/util/iterator/discard.hpp similarity index 100% rename from iterator/discard.hpp rename to cruft/util/iterator/discard.hpp diff --git a/iterator/indices.hpp b/cruft/util/iterator/indices.hpp similarity index 100% rename from iterator/indices.hpp rename to cruft/util/iterator/indices.hpp diff --git a/iterator/infix.hpp b/cruft/util/iterator/infix.hpp similarity index 100% rename from iterator/infix.hpp rename to cruft/util/iterator/infix.hpp diff --git a/iterator/iota.hpp b/cruft/util/iterator/iota.hpp similarity index 100% rename from iterator/iota.hpp rename to cruft/util/iterator/iota.hpp diff --git a/iterator/numeric.hpp b/cruft/util/iterator/numeric.hpp similarity index 100% rename from iterator/numeric.hpp rename to cruft/util/iterator/numeric.hpp diff --git a/iterator/placement_output.hpp b/cruft/util/iterator/placement_output.hpp similarity index 100% rename from iterator/placement_output.hpp rename to cruft/util/iterator/placement_output.hpp diff --git a/iterator/referencing.hpp b/cruft/util/iterator/referencing.hpp similarity index 100% rename from iterator/referencing.hpp rename to cruft/util/iterator/referencing.hpp diff --git a/iterator/transform.hpp b/cruft/util/iterator/transform.hpp similarity index 100% rename from iterator/transform.hpp rename to cruft/util/iterator/transform.hpp diff --git a/iterator/tuple_picker.hpp b/cruft/util/iterator/tuple_picker.hpp similarity index 100% rename from iterator/tuple_picker.hpp rename to cruft/util/iterator/tuple_picker.hpp diff --git a/iterator/unequal.hpp b/cruft/util/iterator/unequal.hpp similarity index 100% rename from iterator/unequal.hpp rename to cruft/util/iterator/unequal.hpp diff --git a/iterator/unordered_insert.hpp b/cruft/util/iterator/unordered_insert.hpp similarity index 100% rename from iterator/unordered_insert.hpp rename to cruft/util/iterator/unordered_insert.hpp diff --git a/iterator/zip.hpp b/cruft/util/iterator/zip.hpp similarity index 100% rename from iterator/zip.hpp rename to cruft/util/iterator/zip.hpp diff --git a/job/dispatch.hpp b/cruft/util/job/dispatch.hpp similarity index 100% rename from job/dispatch.hpp rename to cruft/util/job/dispatch.hpp diff --git a/job/fwd.hpp b/cruft/util/job/fwd.hpp similarity index 100% rename from job/fwd.hpp rename to cruft/util/job/fwd.hpp diff --git a/job/queue.cpp b/cruft/util/job/queue.cpp similarity index 100% rename from job/queue.cpp rename to cruft/util/job/queue.cpp diff --git a/job/queue.hpp b/cruft/util/job/queue.hpp similarity index 100% rename from job/queue.hpp rename to cruft/util/job/queue.hpp diff --git a/kmeans.hpp b/cruft/util/kmeans.hpp similarity index 100% rename from kmeans.hpp rename to cruft/util/kmeans.hpp diff --git a/library.hpp b/cruft/util/library.hpp similarity index 100% rename from library.hpp rename to cruft/util/library.hpp diff --git a/library_posix.cpp b/cruft/util/library_posix.cpp similarity index 100% rename from library_posix.cpp rename to cruft/util/library_posix.cpp diff --git a/library_posix.hpp b/cruft/util/library_posix.hpp similarity index 100% rename from library_posix.hpp rename to cruft/util/library_posix.hpp diff --git a/library_win32.cpp b/cruft/util/library_win32.cpp similarity index 100% rename from library_win32.cpp rename to cruft/util/library_win32.cpp diff --git a/library_win32.hpp b/cruft/util/library_win32.hpp similarity index 100% rename from library_win32.hpp rename to cruft/util/library_win32.hpp diff --git a/list/node.hpp b/cruft/util/list/node.hpp similarity index 100% rename from list/node.hpp rename to cruft/util/list/node.hpp diff --git a/list/sort.hpp b/cruft/util/list/sort.hpp similarity index 100% rename from list/sort.hpp rename to cruft/util/list/sort.hpp diff --git a/log.hpp b/cruft/util/log.hpp similarity index 100% rename from log.hpp rename to cruft/util/log.hpp diff --git a/log/fwd.hpp b/cruft/util/log/fwd.hpp similarity index 100% rename from log/fwd.hpp rename to cruft/util/log/fwd.hpp diff --git a/log/level.cpp b/cruft/util/log/level.cpp similarity index 100% rename from log/level.cpp rename to cruft/util/log/level.cpp diff --git a/log/level.hpp b/cruft/util/log/level.hpp similarity index 100% rename from log/level.hpp rename to cruft/util/log/level.hpp diff --git a/log/log.cpp b/cruft/util/log/log.cpp similarity index 100% rename from log/log.cpp rename to cruft/util/log/log.cpp diff --git a/log/log.hpp b/cruft/util/log/log.hpp similarity index 100% rename from log/log.hpp rename to cruft/util/log/log.hpp diff --git a/log/packet.cpp b/cruft/util/log/packet.cpp similarity index 100% rename from log/packet.cpp rename to cruft/util/log/packet.cpp diff --git a/log/packet.hpp b/cruft/util/log/packet.hpp similarity index 100% rename from log/packet.hpp rename to cruft/util/log/packet.hpp diff --git a/log/scoped.cpp b/cruft/util/log/scoped.cpp similarity index 100% rename from log/scoped.cpp rename to cruft/util/log/scoped.cpp diff --git a/log/scoped.hpp b/cruft/util/log/scoped.hpp similarity index 100% rename from log/scoped.hpp rename to cruft/util/log/scoped.hpp diff --git a/log/sink/base.cpp b/cruft/util/log/sink/base.cpp similarity index 100% rename from log/sink/base.cpp rename to cruft/util/log/sink/base.cpp diff --git a/log/sink/base.hpp b/cruft/util/log/sink/base.hpp similarity index 100% rename from log/sink/base.hpp rename to cruft/util/log/sink/base.hpp diff --git a/log/sink/console.cpp b/cruft/util/log/sink/console.cpp similarity index 100% rename from log/sink/console.cpp rename to cruft/util/log/sink/console.cpp diff --git a/log/sink/console.hpp b/cruft/util/log/sink/console.hpp similarity index 100% rename from log/sink/console.hpp rename to cruft/util/log/sink/console.hpp diff --git a/log/sink/null.cpp b/cruft/util/log/sink/null.cpp similarity index 100% rename from log/sink/null.cpp rename to cruft/util/log/sink/null.cpp diff --git a/log/sink/null.hpp b/cruft/util/log/sink/null.hpp similarity index 100% rename from log/sink/null.hpp rename to cruft/util/log/sink/null.hpp diff --git a/log/sink/path.cpp b/cruft/util/log/sink/path.cpp similarity index 100% rename from log/sink/path.cpp rename to cruft/util/log/sink/path.cpp diff --git a/log/sink/path.hpp b/cruft/util/log/sink/path.hpp similarity index 100% rename from log/sink/path.hpp rename to cruft/util/log/sink/path.hpp diff --git a/log/sink/tee.cpp b/cruft/util/log/sink/tee.cpp similarity index 100% rename from log/sink/tee.cpp rename to cruft/util/log/sink/tee.cpp diff --git a/log/sink/tee.hpp b/cruft/util/log/sink/tee.hpp similarity index 100% rename from log/sink/tee.hpp rename to cruft/util/log/sink/tee.hpp diff --git a/map/fixed.cpp b/cruft/util/map/fixed.cpp similarity index 100% rename from map/fixed.cpp rename to cruft/util/map/fixed.cpp diff --git a/map/fixed.hpp b/cruft/util/map/fixed.hpp similarity index 100% rename from map/fixed.hpp rename to cruft/util/map/fixed.hpp diff --git a/map/multi_fixed.cpp b/cruft/util/map/multi_fixed.cpp similarity index 100% rename from map/multi_fixed.cpp rename to cruft/util/map/multi_fixed.cpp diff --git a/map/multi_fixed.hpp b/cruft/util/map/multi_fixed.hpp similarity index 100% rename from map/multi_fixed.hpp rename to cruft/util/map/multi_fixed.hpp diff --git a/maths.cpp b/cruft/util/maths.cpp similarity index 100% rename from maths.cpp rename to cruft/util/maths.cpp diff --git a/maths.hpp b/cruft/util/maths.hpp similarity index 100% rename from maths.hpp rename to cruft/util/maths.hpp diff --git a/maths/fast.hpp b/cruft/util/maths/fast.hpp similarity index 100% rename from maths/fast.hpp rename to cruft/util/maths/fast.hpp diff --git a/matrix.cpp b/cruft/util/matrix.cpp similarity index 100% rename from matrix.cpp rename to cruft/util/matrix.cpp diff --git a/matrix.hpp b/cruft/util/matrix.hpp similarity index 100% rename from matrix.hpp rename to cruft/util/matrix.hpp diff --git a/matrix2.cpp b/cruft/util/matrix2.cpp similarity index 100% rename from matrix2.cpp rename to cruft/util/matrix2.cpp diff --git a/matrix3.cpp b/cruft/util/matrix3.cpp similarity index 100% rename from matrix3.cpp rename to cruft/util/matrix3.cpp diff --git a/matrix4.cpp b/cruft/util/matrix4.cpp similarity index 100% rename from matrix4.cpp rename to cruft/util/matrix4.cpp diff --git a/memory/deleter.cpp b/cruft/util/memory/deleter.cpp similarity index 100% rename from memory/deleter.cpp rename to cruft/util/memory/deleter.cpp diff --git a/memory/deleter.hpp b/cruft/util/memory/deleter.hpp similarity index 100% rename from memory/deleter.hpp rename to cruft/util/memory/deleter.hpp diff --git a/memory/system.cpp b/cruft/util/memory/system.cpp similarity index 100% rename from memory/system.cpp rename to cruft/util/memory/system.cpp diff --git a/memory/system.hpp b/cruft/util/memory/system.hpp similarity index 100% rename from memory/system.hpp rename to cruft/util/memory/system.hpp diff --git a/cruft/util/meson.build b/cruft/util/meson.build new file mode 100644 index 00000000..2752c621 --- /dev/null +++ b/cruft/util/meson.build @@ -0,0 +1,630 @@ +cpp = meson.get_compiler('cpp') + + +############################################################################### +dependencies = [] + +dependencies += dependency('fmt', version: '>=10') + + +############################################################################### +ragel = generator( + find_program('ragel'), + output: '@BASENAME@.cpp', + arguments: [ '@INPUT@', '-o@OUTPUT@', '-G2' ] +) + + +sources = [ +] + + +############################################################################### +backtrace_dep = cpp.find_library('execinfo', required: false) +dbghelp_dep = cpp.find_library('dbghelp', required: false) + +if cpp.has_function('backtrace', dependencies: [backtrace_dep]) + sources += ['backtrace_execinfo.cpp'] + dependencies += backtrace_dep +elif cpp.has_function('RtlCaptureStackBackTrace', dependencies: [dbghelp_dep]) + sources += ['backtrace_stackwalk.cpp'] + dependencies += dbghelp_dep +else + sources += ['backtrace_null.cpp'] +endif + + +############################################################################### +# Platform wrappers + +if host_machine.system() == 'linux' + sources += 'exe_linux.cpp' +elif host_machine.system() == 'freebsd' + sources += 'exe_freebsd.cpp' +elif host_machine.system() == 'windows' + sources += 'exe_win32.cpp' +else + error('Unhandled platform') +endif + + +##----------------------------------------------------------------------------- +sources += [ + 'posix/dir.cpp', + 'posix/dir.hpp', + 'posix/except.cpp', + 'posix/except.hpp', + 'posix/fd.cpp', + 'posix/fd.hpp', + 'posix/flock.cpp', + 'posix/flock.hpp', + 'posix/ostream.cpp', + 'posix/ostream.hpp', + 'posix/util.cpp', + 'posix/util.hpp', +] + + +if host_machine.system() == 'linux' + sources += [ + 'thread/event_futex.cpp', + 'thread/flag_futex.cpp', + 'rand/system_linux.cpp', + 'rand/system_linux.hpp', + ] +endif + + +if host_machine.system() != 'windows' + sources += [ + 'buffer/circular.cpp', + 'buffer/circular.hpp', + 'buffer/paged.cpp', + 'buffer/paged.hpp', + 'memory/system.cpp', + 'memory/system.hpp', + 'debug_posix.cpp', + 'debug/crash_posix.cpp', + 'debug/fpe_posix.cpp', + 'debug/system_posix.cpp', + 'fs/tmp_posix.cpp', + 'io_posix.cpp', + 'io_posix.hpp', + 'library_posix.hpp', + 'library_posix.cpp', + 'paths_posix.cpp', + 'posix/fwd.hpp', + 'posix/interface.hpp', + 'posix/interface.cpp', + 'posix/map.cpp', + 'posix/map.hpp', + 'posix/socket.cpp', + 'posix/socket.hpp', + 'time_posix.cpp', + ] +endif + +if host_machine.system() == 'windows' + sources += [ + 'debug_win32.cpp', + 'debug/crash_win32.cpp', + 'debug/fpe_win32.cpp', + 'debug/system_win32.cpp', + 'exe_win32.cpp', + 'fs/tmp_win32.cpp', + 'io_win32.cpp', + 'io_win32.hpp', + 'library_win32.cpp', + 'library_win32.hpp', + 'paths_win32.cpp', + 'rand/system_win32.cpp', + 'rand/system_win32.hpp', + 'time_win32.cpp', + 'win32/windows.hpp', + 'win32/except.cpp', + 'win32/except.hpp', + 'win32/file.cpp', + 'win32/file.hpp', + 'win32/handle.cpp', + 'win32/handle.hpp', + 'win32/registry.cpp', + 'win32/registry.hpp', + ] +endif + + +############################################################################### +sources += [ + 'thread/event.hpp', + 'thread/flag.hpp', + 'thread/primitive.hpp', + 'thread/semaphore.hpp', +] + + +if host_machine.system() == 'linux' + sources += [ + 'thread/event_futex.cpp', + 'thread/event_futex.hpp', + 'thread/semaphore_linux.hpp', + 'thread/semaphore_linux.cpp', + 'thread/flag_futex.cpp', + 'thread/flag_futex.hpp', + ] +elif host_machine.system() == 'windows' + sources += [ + 'thread/event_std.cpp', + 'thread/event_std.hpp', + 'thread/event_win32.cpp', + 'thread/semaphore_win32.hpp', + 'thread/semaphore_win32.cpp', + 'thread/flag_std.cpp', + 'thread/flag_std.hpp', + ] +else + error ('Unsupported thread platform') +endif + + +if host_machine.cpu_family() == 'x86_64' + sources += [ + 'cpuid/x86.cpp', + 'cpuid/x86.hpp', + ] +else + warning('Unknown architecture @host_machine.cpu_family()@. Defaulting to null implementation') + + sources += [ + 'cpuid/none.cpp', + 'cpuid/none.hpp', + ] +endif + + +if host_machine.system() == 'windows' + sources += 'sysinfo_win32.cpp' +else + sources += 'sysinfo_posix.cpp' +endif + + +############################################################################### +# Common files + +sources += [ + 'fwd.hpp', + + 'adapter.hpp', + 'adapter.cpp', + 'algo/search.hpp', + 'algo/sort.cpp', + 'algo/sort.hpp', + 'alloc/fwd.hpp', + 'alloc/affix.cpp', + 'alloc/affix.hpp', + 'alloc/aligned/direct.hpp', + 'alloc/aligned/foreign.hpp', + 'alloc/allocator.cpp', + 'alloc/allocator.hpp', + 'alloc/chunked.cpp', + 'alloc/chunked.hpp', + 'alloc/easy.hpp', + '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', + 'alloc/std.hpp', + 'alloc/traits.hpp', + 'alloc/traits.hpp', + 'annotation.hpp', + 'array/darray.hpp', + 'array/md.cpp', + 'array/md.hpp', + 'array/parray.cpp', + 'array/parray.hpp', + 'array/sarray.cpp', + 'array/sarray.hpp', + 'array/varray.hpp', + 'ascii.hpp', + 'backtrace.hpp', + 'bezier.cpp', + 'bezier1.cpp', + 'bezier2.cpp', + 'bezier3.cpp', + 'bezier.hpp', + 'bitwise.cpp', + 'bitwise.hpp', + 'bool.cpp', + 'bool.hpp', + 'buffer/simple.cpp', + 'buffer/simple.hpp', + 'buffer/traits.hpp', + 'cast.hpp', + 'cmdopt.cpp', + 'cmdopt.hpp', + 'cmdopt2/fwd.hpp', + 'cmdopt2/args.cpp', + 'cmdopt2/args.hpp', + 'cmdopt2/parser.cpp', + 'cmdopt2/parser.hpp', + 'colour.cpp', + 'colour.hpp', + 'concepts.hpp', + 'concepts/clock.hpp', + 'concepts/string.hpp', + 'container.hpp', + 'coord.hpp', + 'coord/fwd.hpp', + 'coord/base.hpp', + 'coord/comparator.hpp', + 'coord/init.hpp', + 'coord/iostream.hpp', + 'coord/ops.hpp', + 'coord/store.hpp', + 'coord/traits.hpp', + 'cpp.cpp', + 'cpp.hpp', + 'cpuid.cpp', + 'cpuid.hpp', + 'debug/assert.cpp', + 'debug/assert.hpp', + 'debug/common.cpp', + 'debug/common.hpp', + 'debug/compiler.cpp', + 'debug/compiler.hpp', + 'debug/crash.hpp', + 'debug/debugger.cpp', + 'debug/debugger.hpp', + 'debug/fpe.hpp', + 'debug/fpe.cpp', + 'debug/memory.cpp', + 'debug/memory.hpp', + 'debug/panic.cpp', + 'debug/panic.hpp', + 'debug/system.cpp', + 'debug/system.hpp', + 'debug/trace.cpp', + 'debug/trace.hpp', + 'debug/validate.cpp', + 'debug/validate.hpp', + 'debug/warn.cpp', + 'debug/warn.hpp', + 'encode/number.hpp', + 'encode/base.cpp', + 'encode/base.hpp', + 'endian.cpp', + 'endian.hpp', + 'except.cpp', + 'except.hpp', + 'exe.hpp', + 'expected.hpp', + 'extent.cpp', + 'extent.hpp', + 'fixed.cpp', + 'fixed.hpp', + 'fixed_string.hpp', + 'float.cpp', + 'float.hpp', + 'format/quoted.hpp', + 'fourcc.cpp', + 'fourcc.hpp', + 'fs/scoped.cpp', + 'fs/scoped.hpp', + 'fs/tmp.hpp', + 'functor.hpp', + 'geom/fwd.hpp', + 'geom/aabb.cpp', + 'geom/aabb.hpp', + 'geom/cylinder.cpp', + 'geom/cylinder.hpp', + 'geom/ellipse.cpp', + 'geom/ellipse.hpp', + 'geom/frustum.cpp', + 'geom/frustum.hpp', + 'geom/iostream.cpp', + 'geom/iostream.hpp', + 'geom/line.hpp', + 'geom/line.cpp', + 'geom/ops.cpp', + 'geom/ops.hpp', + 'geom/plane.cpp', + 'geom/plane.hpp', + 'geom/ray.cpp', + 'geom/ray.hpp', + 'geom/rect.cpp', + 'geom/rect.hpp', + 'geom/region.cpp', + 'geom/sample/fwd.hpp', + 'geom/sample/edge.hpp', + 'geom/sample/surface.hpp', + 'geom/sample/volume.hpp', + 'geom/sample/subregion.hpp', + 'geom/segment.cpp', + 'geom/segment.hpp', + 'geom/sphere.cpp', + 'geom/sphere.hpp', + 'geom/traits.hpp', + 'geom/tri.cpp', + 'geom/tri.hpp', + 'hash.hpp', + 'hash/fwd.hpp', + 'hash/adapter.hpp', + 'hash/adler.cpp', + 'hash/adler.hpp', + 'hash/buzhash.hpp', + '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/halfsipmix.cpp', + 'hash/halfsipmix.hpp', + 'hash/mix.cpp', + 'hash/mix.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', + 'hash/siphash.cpp', + 'hash/siphash.hpp', + 'hash/std.cpp', + 'hash/std.hpp', + 'hash/table.cpp', + 'hash/table.hpp', + 'hash/tuple.cpp', + 'hash/tuple.hpp', + 'hash/wang.hpp', + 'hash/xxhash.cpp', + 'hash/xxhash.hpp', + 'init.cpp', + 'init.hpp', + 'introspection/enum_manual.cpp', + 'introspection/enum_manual.hpp', + 'introspection/enum_simple.cpp', + 'introspection/enum_simple.hpp', + 'introspection/name.cpp', + 'introspection/name.hpp', + 'introspection/type.cpp', + 'introspection/type.hpp', + 'io.cpp', + 'io.hpp', + 'iterator/cast.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/placement_output.hpp', + 'iterator/referencing.hpp', + 'iterator/transform.hpp', + 'iterator/tuple_picker.hpp', + 'iterator/unequal.hpp', + 'iterator/unordered_insert.hpp', + 'iterator/zip.hpp', + 'job/fwd.hpp', + 'job/dispatch.hpp', + 'job/queue.cpp', + 'job/queue.hpp', + 'kmeans.hpp', + 'library.hpp', + 'list/node.hpp', + 'list/sort.hpp', + 'log.hpp', + 'log/fwd.hpp', + 'log/level.cpp', + 'log/level.hpp', + 'log/log.cpp', + 'log/log.hpp', + 'log/packet.cpp', + 'log/packet.hpp', + 'log/scoped.cpp', + 'log/scoped.hpp', + 'log/sink/base.cpp', + 'log/sink/base.hpp', + 'log/sink/console.cpp', + 'log/sink/console.hpp', + 'log/sink/null.cpp', + 'log/sink/null.hpp', + 'log/sink/path.cpp', + 'log/sink/path.hpp', + 'map/multi_fixed.cpp', + 'map/multi_fixed.hpp', + 'map/fixed.cpp', + 'map/fixed.hpp', + 'maths.cpp', + 'maths.hpp', + 'maths/fast.hpp', + 'matrix.cpp', + 'matrix2.cpp', + 'matrix3.cpp', + 'matrix4.cpp', + 'matrix.hpp', + 'memory/deleter.cpp', + 'memory/deleter.hpp', + 'parallel/queue.cpp', + 'parallel/queue.hpp', + 'parallel/stack.cpp', + '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', + 'paths.cpp', + 'paths.hpp', + 'platform.hpp', + 'point.cpp', + 'point.hpp', + 'pointer.hpp', + 'polynomial.cpp', + 'polynomial.hpp', + 'pool.cpp', + 'pool.hpp', + 'quaternion.cpp', + 'quaternion.hpp', + 'rand/distribution/normal.cpp', + 'rand/distribution/normal.hpp', + 'rand/distribution/uniform.cpp', + 'rand/distribution/uniform.hpp', + 'rand/generic.hpp', + 'rand/lcg.cpp', + 'rand/lcg.hpp', + 'rand/mwc64x.cpp', + 'rand/mwc64x.hpp', + 'rand/pcg.cpp', + 'rand/pcg.hpp', + 'rand/rdrand.cpp', + 'rand/rdrand.hpp', + 'rand/splitmix64.hpp', + 'rand/system.hpp', + 'rand/xoshiro.cpp', + 'rand/xoshiro.hpp', + 'rand/xorshift.cpp', + 'rand/xorshift.hpp', + 'random.cpp', + 'random.hpp', + 'range.cpp', + 'range.hpp', + 'rational.cpp', + 'rational.hpp', + 'region.cpp', + 'region.hpp', + 'registrar.cpp', + 'registrar.hpp', + 'roots/bisection.hpp', + 'scoped.hpp', + 'serialise/converter.hpp', + 'serialise/ops.hpp', + 'serialise/std.hpp', + 'set/dset.cpp', + 'set/dset.hpp', + 'signal.cpp', + 'signal.hpp', + 'singleton.hpp', + 'stats.cpp', + 'stats.hpp', + 'std.hpp', + 'stream.cpp', + 'stream.hpp', + 'string.cpp', + 'string.hpp', + 'stringcache.cpp', + 'stringcache.hpp', + 'stringid.cpp', + 'stringid.hpp', + 'strongdef.cpp', + 'strongdef.hpp', + 'sysinfo.hpp', + 'tap.cpp', + 'tap.hpp', + 'term.cpp', + 'term.hpp', + 'thread/event.hpp', + 'thread/flag.hpp', + 'thread/monitor.cpp', + 'thread/monitor.hpp', + 'thread/ticketlock.cpp', + 'thread/ticketlock.hpp', + 'thread/spinlock.cpp', + 'thread/spinlock.hpp', + 'time.cpp', + 'time.hpp', + 'time/parse.hpp', + ragel.process('time/parse8601.cpp.rl'), + 'tuple/index.hpp', + 'tuple/type.hpp', + 'tuple/value.hpp', + 'typeidx.cpp', + 'typeidx.hpp', + 'types.hpp', + 'types/sized.hpp', + 'types/comparator.hpp', + 'types/description.cpp', + 'types/description.hpp', + 'types/dispatch.hpp', + 'types/string.cpp', + 'types/string.hpp', + 'types/tagged.hpp', + 'types/traits.hpp', + ragel.process('uri.cpp.rl'), + 'uri.cpp', + 'uri.hpp', + 'utf8.cpp', + 'utf8.hpp', + 'variadic.cpp', + 'variadic.hpp', + 'vector.cpp', + 'vector.hpp', + 'version.hpp', + ragel.process('version.cpp.rl'), + 'view.cpp', + 'view.hpp', +] + + +preprocessor_hpp = custom_target( + 'preprocessor.hpp', + output: 'preprocessor.hpp', + input: meson.project_source_root() / 'preprocessor.py', + command: [python, '@INPUT@', '@OUTPUT@', '480'] +) + +sources += preprocessor_hpp + + +if get_option('simd') + sources += [ + 'coord/simd.cpp', + 'coord/simd.hpp', + 'coord/simd_sse.hpp', + 'coord/simd_neon.hpp', + ] +endif + + +############################################################################### +dependencies += [ + cpp.find_library('rt', required: false), + cpp.find_library('dl', required: false), + cpp.find_library('m', required: false), +] + + +inc = include_directories('../../') + +libcruft = static_library( + 'cruft-util', + sources, + dependencies: dependencies, + include_directories: inc +) + +libcruft_dep = declare_dependency( + link_with: libcruft, + include_directories: inc, + sources: [preprocessor_hpp], + dependencies: dependencies, +) \ No newline at end of file diff --git a/parallel/queue.cpp b/cruft/util/parallel/queue.cpp similarity index 100% rename from parallel/queue.cpp rename to cruft/util/parallel/queue.cpp diff --git a/parallel/queue.hpp b/cruft/util/parallel/queue.hpp similarity index 100% rename from parallel/queue.hpp rename to cruft/util/parallel/queue.hpp diff --git a/parallel/stack.cpp b/cruft/util/parallel/stack.cpp similarity index 100% rename from parallel/stack.cpp rename to cruft/util/parallel/stack.cpp diff --git a/parallel/stack.hpp b/cruft/util/parallel/stack.hpp similarity index 100% rename from parallel/stack.hpp rename to cruft/util/parallel/stack.hpp diff --git a/parse/enum.cpp b/cruft/util/parse/enum.cpp similarity index 100% rename from parse/enum.cpp rename to cruft/util/parse/enum.cpp diff --git a/parse/enum.hpp b/cruft/util/parse/enum.hpp similarity index 100% rename from parse/enum.hpp rename to cruft/util/parse/enum.hpp diff --git a/parse/fwd.hpp b/cruft/util/parse/fwd.hpp similarity index 100% rename from parse/fwd.hpp rename to cruft/util/parse/fwd.hpp diff --git a/parse/si.cpp b/cruft/util/parse/si.cpp similarity index 92% rename from parse/si.cpp rename to cruft/util/parse/si.cpp index 4f477ffe..eb525f33 100644 --- a/parse/si.cpp +++ b/cruft/util/parse/si.cpp @@ -6,13 +6,12 @@ * Copyright 2019 Danny Robson */ -#include "si.hpp" +#include "./si.hpp" -#include "value.hpp" +#include "./value.hpp" -#include "../std.hpp" - -#include "preprocessor.hpp" +#include +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/parse/si.hpp b/cruft/util/parse/si.hpp similarity index 100% rename from parse/si.hpp rename to cruft/util/parse/si.hpp diff --git a/parse/time.cpp b/cruft/util/parse/time.cpp similarity index 98% rename from parse/time.cpp rename to cruft/util/parse/time.cpp index b50af854..14887338 100644 --- a/parse/time.cpp +++ b/cruft/util/parse/time.cpp @@ -6,9 +6,9 @@ * Copyright 2019 Danny Robson */ -#include "parse/time.hpp" +#include "./time.hpp" -#include "parse/value.hpp" +#include "./value.hpp" #include "../ascii.hpp" #include diff --git a/parse/time.hpp b/cruft/util/parse/time.hpp similarity index 100% rename from parse/time.hpp rename to cruft/util/parse/time.hpp diff --git a/parse/value.cpp b/cruft/util/parse/value.cpp similarity index 98% rename from parse/value.cpp rename to cruft/util/parse/value.cpp index cf60723a..60d6da88 100644 --- a/parse/value.cpp +++ b/cruft/util/parse/value.cpp @@ -8,10 +8,9 @@ #include "value.hpp" -#include "../bool.hpp" -#include "../cast.hpp" - -#include "preprocessor.hpp" +#include +#include +#include #include #include diff --git a/parse/value.hpp b/cruft/util/parse/value.hpp similarity index 100% rename from parse/value.hpp rename to cruft/util/parse/value.hpp diff --git a/paths.cpp b/cruft/util/paths.cpp similarity index 100% rename from paths.cpp rename to cruft/util/paths.cpp diff --git a/paths.hpp b/cruft/util/paths.hpp similarity index 100% rename from paths.hpp rename to cruft/util/paths.hpp diff --git a/paths_posix.cpp b/cruft/util/paths_posix.cpp similarity index 100% rename from paths_posix.cpp rename to cruft/util/paths_posix.cpp diff --git a/paths_win32.cpp b/cruft/util/paths_win32.cpp similarity index 100% rename from paths_win32.cpp rename to cruft/util/paths_win32.cpp diff --git a/platform.hpp b/cruft/util/platform.hpp similarity index 100% rename from platform.hpp rename to cruft/util/platform.hpp diff --git a/point.cpp b/cruft/util/point.cpp similarity index 100% rename from point.cpp rename to cruft/util/point.cpp diff --git a/point.hpp b/cruft/util/point.hpp similarity index 100% rename from point.hpp rename to cruft/util/point.hpp diff --git a/pointer.hpp b/cruft/util/pointer.hpp similarity index 100% rename from pointer.hpp rename to cruft/util/pointer.hpp diff --git a/polynomial.cpp b/cruft/util/polynomial.cpp similarity index 100% rename from polynomial.cpp rename to cruft/util/polynomial.cpp diff --git a/polynomial.hpp b/cruft/util/polynomial.hpp similarity index 100% rename from polynomial.hpp rename to cruft/util/polynomial.hpp diff --git a/pool.cpp b/cruft/util/pool.cpp similarity index 100% rename from pool.cpp rename to cruft/util/pool.cpp diff --git a/pool.hpp b/cruft/util/pool.hpp similarity index 100% rename from pool.hpp rename to cruft/util/pool.hpp diff --git a/posix/dir.cpp b/cruft/util/posix/dir.cpp similarity index 100% rename from posix/dir.cpp rename to cruft/util/posix/dir.cpp diff --git a/posix/dir.hpp b/cruft/util/posix/dir.hpp similarity index 100% rename from posix/dir.hpp rename to cruft/util/posix/dir.hpp diff --git a/posix/except.cpp b/cruft/util/posix/except.cpp similarity index 100% rename from posix/except.cpp rename to cruft/util/posix/except.cpp diff --git a/posix/except.hpp b/cruft/util/posix/except.hpp similarity index 100% rename from posix/except.hpp rename to cruft/util/posix/except.hpp diff --git a/posix/fd.cpp b/cruft/util/posix/fd.cpp similarity index 98% rename from posix/fd.cpp rename to cruft/util/posix/fd.cpp index bd001ef5..976fd80b 100644 --- a/posix/fd.cpp +++ b/cruft/util/posix/fd.cpp @@ -6,10 +6,10 @@ * Copyright 2016-2019 Danny Robson */ -#include "fd.hpp" +#include "./fd.hpp" -#include "except.hpp" -#include "cast.hpp" +#include +#include #include #include diff --git a/posix/fd.hpp b/cruft/util/posix/fd.hpp similarity index 100% rename from posix/fd.hpp rename to cruft/util/posix/fd.hpp diff --git a/posix/flock.cpp b/cruft/util/posix/flock.cpp similarity index 100% rename from posix/flock.cpp rename to cruft/util/posix/flock.cpp diff --git a/posix/flock.hpp b/cruft/util/posix/flock.hpp similarity index 100% rename from posix/flock.hpp rename to cruft/util/posix/flock.hpp diff --git a/posix/fwd.hpp b/cruft/util/posix/fwd.hpp similarity index 100% rename from posix/fwd.hpp rename to cruft/util/posix/fwd.hpp diff --git a/posix/interface.cpp b/cruft/util/posix/interface.cpp similarity index 100% rename from posix/interface.cpp rename to cruft/util/posix/interface.cpp diff --git a/posix/interface.hpp b/cruft/util/posix/interface.hpp similarity index 100% rename from posix/interface.hpp rename to cruft/util/posix/interface.hpp diff --git a/posix/map.cpp b/cruft/util/posix/map.cpp similarity index 99% rename from posix/map.cpp rename to cruft/util/posix/map.cpp index c2795852..0b414561 100644 --- a/posix/map.cpp +++ b/cruft/util/posix/map.cpp @@ -8,7 +8,7 @@ #include "map.hpp" -#include "posix/except.hpp" +#include "./except.hpp" using cruft::posix::map; diff --git a/posix/map.hpp b/cruft/util/posix/map.hpp similarity index 100% rename from posix/map.hpp rename to cruft/util/posix/map.hpp diff --git a/posix/ostream.cpp b/cruft/util/posix/ostream.cpp similarity index 100% rename from posix/ostream.cpp rename to cruft/util/posix/ostream.cpp diff --git a/posix/ostream.hpp b/cruft/util/posix/ostream.hpp similarity index 100% rename from posix/ostream.hpp rename to cruft/util/posix/ostream.hpp diff --git a/posix/socket.cpp b/cruft/util/posix/socket.cpp similarity index 98% rename from posix/socket.cpp rename to cruft/util/posix/socket.cpp index bd87416b..ec7c4032 100644 --- a/posix/socket.cpp +++ b/cruft/util/posix/socket.cpp @@ -8,8 +8,8 @@ #include "socket.hpp" -#include "platform.hpp" -#include "except.hpp" +#include +#include #if !defined(PLATFORM_WIN32) #include diff --git a/posix/socket.hpp b/cruft/util/posix/socket.hpp similarity index 100% rename from posix/socket.hpp rename to cruft/util/posix/socket.hpp diff --git a/posix/util.cpp b/cruft/util/posix/util.cpp similarity index 100% rename from posix/util.cpp rename to cruft/util/posix/util.cpp diff --git a/posix/util.hpp b/cruft/util/posix/util.hpp similarity index 100% rename from posix/util.hpp rename to cruft/util/posix/util.hpp diff --git a/quaternion.cpp b/cruft/util/quaternion.cpp similarity index 100% rename from quaternion.cpp rename to cruft/util/quaternion.cpp diff --git a/quaternion.hpp b/cruft/util/quaternion.hpp similarity index 100% rename from quaternion.hpp rename to cruft/util/quaternion.hpp diff --git a/rand/distribution/normal.cpp b/cruft/util/rand/distribution/normal.cpp similarity index 100% rename from rand/distribution/normal.cpp rename to cruft/util/rand/distribution/normal.cpp diff --git a/rand/distribution/normal.hpp b/cruft/util/rand/distribution/normal.hpp similarity index 100% rename from rand/distribution/normal.hpp rename to cruft/util/rand/distribution/normal.hpp diff --git a/rand/distribution/uniform.cpp b/cruft/util/rand/distribution/uniform.cpp similarity index 100% rename from rand/distribution/uniform.cpp rename to cruft/util/rand/distribution/uniform.cpp diff --git a/rand/distribution/uniform.hpp b/cruft/util/rand/distribution/uniform.hpp similarity index 100% rename from rand/distribution/uniform.hpp rename to cruft/util/rand/distribution/uniform.hpp diff --git a/rand/generic.hpp b/cruft/util/rand/generic.hpp similarity index 100% rename from rand/generic.hpp rename to cruft/util/rand/generic.hpp diff --git a/rand/lcg.cpp b/cruft/util/rand/lcg.cpp similarity index 100% rename from rand/lcg.cpp rename to cruft/util/rand/lcg.cpp diff --git a/rand/lcg.hpp b/cruft/util/rand/lcg.hpp similarity index 100% rename from rand/lcg.hpp rename to cruft/util/rand/lcg.hpp diff --git a/rand/mwc64x.cpp b/cruft/util/rand/mwc64x.cpp similarity index 100% rename from rand/mwc64x.cpp rename to cruft/util/rand/mwc64x.cpp diff --git a/rand/mwc64x.hpp b/cruft/util/rand/mwc64x.hpp similarity index 100% rename from rand/mwc64x.hpp rename to cruft/util/rand/mwc64x.hpp diff --git a/rand/pcg.cpp b/cruft/util/rand/pcg.cpp similarity index 100% rename from rand/pcg.cpp rename to cruft/util/rand/pcg.cpp diff --git a/rand/pcg.hpp b/cruft/util/rand/pcg.hpp similarity index 100% rename from rand/pcg.hpp rename to cruft/util/rand/pcg.hpp diff --git a/rand/rdrand.cpp b/cruft/util/rand/rdrand.cpp similarity index 100% rename from rand/rdrand.cpp rename to cruft/util/rand/rdrand.cpp diff --git a/rand/rdrand.hpp b/cruft/util/rand/rdrand.hpp similarity index 100% rename from rand/rdrand.hpp rename to cruft/util/rand/rdrand.hpp diff --git a/rand/splitmix64.hpp b/cruft/util/rand/splitmix64.hpp similarity index 100% rename from rand/splitmix64.hpp rename to cruft/util/rand/splitmix64.hpp diff --git a/rand/system.hpp b/cruft/util/rand/system.hpp similarity index 100% rename from rand/system.hpp rename to cruft/util/rand/system.hpp diff --git a/rand/system_linux.cpp b/cruft/util/rand/system_linux.cpp similarity index 100% rename from rand/system_linux.cpp rename to cruft/util/rand/system_linux.cpp diff --git a/rand/system_linux.hpp b/cruft/util/rand/system_linux.hpp similarity index 100% rename from rand/system_linux.hpp rename to cruft/util/rand/system_linux.hpp diff --git a/rand/system_win32.cpp b/cruft/util/rand/system_win32.cpp similarity index 100% rename from rand/system_win32.cpp rename to cruft/util/rand/system_win32.cpp diff --git a/rand/system_win32.hpp b/cruft/util/rand/system_win32.hpp similarity index 100% rename from rand/system_win32.hpp rename to cruft/util/rand/system_win32.hpp diff --git a/rand/xorshift.cpp b/cruft/util/rand/xorshift.cpp similarity index 100% rename from rand/xorshift.cpp rename to cruft/util/rand/xorshift.cpp diff --git a/rand/xorshift.hpp b/cruft/util/rand/xorshift.hpp similarity index 100% rename from rand/xorshift.hpp rename to cruft/util/rand/xorshift.hpp diff --git a/rand/xoshiro.cpp b/cruft/util/rand/xoshiro.cpp similarity index 100% rename from rand/xoshiro.cpp rename to cruft/util/rand/xoshiro.cpp diff --git a/rand/xoshiro.hpp b/cruft/util/rand/xoshiro.hpp similarity index 100% rename from rand/xoshiro.hpp rename to cruft/util/rand/xoshiro.hpp diff --git a/random.cpp b/cruft/util/random.cpp similarity index 100% rename from random.cpp rename to cruft/util/random.cpp diff --git a/random.hpp b/cruft/util/random.hpp similarity index 100% rename from random.hpp rename to cruft/util/random.hpp diff --git a/range.cpp b/cruft/util/range.cpp similarity index 100% rename from range.cpp rename to cruft/util/range.cpp diff --git a/range.hpp b/cruft/util/range.hpp similarity index 100% rename from range.hpp rename to cruft/util/range.hpp diff --git a/rational.cpp b/cruft/util/rational.cpp similarity index 100% rename from rational.cpp rename to cruft/util/rational.cpp diff --git a/rational.hpp b/cruft/util/rational.hpp similarity index 100% rename from rational.hpp rename to cruft/util/rational.hpp diff --git a/region.cpp b/cruft/util/region.cpp similarity index 100% rename from region.cpp rename to cruft/util/region.cpp diff --git a/region.hpp b/cruft/util/region.hpp similarity index 100% rename from region.hpp rename to cruft/util/region.hpp diff --git a/registrar.cpp b/cruft/util/registrar.cpp similarity index 100% rename from registrar.cpp rename to cruft/util/registrar.cpp diff --git a/registrar.hpp b/cruft/util/registrar.hpp similarity index 100% rename from registrar.hpp rename to cruft/util/registrar.hpp diff --git a/rfc3986.rl b/cruft/util/rfc3986.rl similarity index 100% rename from rfc3986.rl rename to cruft/util/rfc3986.rl diff --git a/roots/bisection.hpp b/cruft/util/roots/bisection.hpp similarity index 100% rename from roots/bisection.hpp rename to cruft/util/roots/bisection.hpp diff --git a/scoped.hpp b/cruft/util/scoped.hpp similarity index 100% rename from scoped.hpp rename to cruft/util/scoped.hpp diff --git a/serialise/converter.hpp b/cruft/util/serialise/converter.hpp similarity index 100% rename from serialise/converter.hpp rename to cruft/util/serialise/converter.hpp diff --git a/serialise/ops.hpp b/cruft/util/serialise/ops.hpp similarity index 100% rename from serialise/ops.hpp rename to cruft/util/serialise/ops.hpp diff --git a/serialise/std.hpp b/cruft/util/serialise/std.hpp similarity index 100% rename from serialise/std.hpp rename to cruft/util/serialise/std.hpp diff --git a/set/dset.cpp b/cruft/util/set/dset.cpp similarity index 100% rename from set/dset.cpp rename to cruft/util/set/dset.cpp diff --git a/set/dset.hpp b/cruft/util/set/dset.hpp similarity index 100% rename from set/dset.hpp rename to cruft/util/set/dset.hpp diff --git a/signal.cpp b/cruft/util/signal.cpp similarity index 100% rename from signal.cpp rename to cruft/util/signal.cpp diff --git a/signal.hpp b/cruft/util/signal.hpp similarity index 100% rename from signal.hpp rename to cruft/util/signal.hpp diff --git a/singleton.hpp b/cruft/util/singleton.hpp similarity index 100% rename from singleton.hpp rename to cruft/util/singleton.hpp diff --git a/stats.cpp b/cruft/util/stats.cpp similarity index 100% rename from stats.cpp rename to cruft/util/stats.cpp diff --git a/stats.hpp b/cruft/util/stats.hpp similarity index 100% rename from stats.hpp rename to cruft/util/stats.hpp diff --git a/std.hpp b/cruft/util/std.hpp similarity index 100% rename from std.hpp rename to cruft/util/std.hpp diff --git a/stream.cpp b/cruft/util/stream.cpp similarity index 100% rename from stream.cpp rename to cruft/util/stream.cpp diff --git a/stream.hpp b/cruft/util/stream.hpp similarity index 100% rename from stream.hpp rename to cruft/util/stream.hpp diff --git a/string.cpp b/cruft/util/string.cpp similarity index 100% rename from string.cpp rename to cruft/util/string.cpp diff --git a/string.hpp b/cruft/util/string.hpp similarity index 100% rename from string.hpp rename to cruft/util/string.hpp diff --git a/stringcache.cpp b/cruft/util/stringcache.cpp similarity index 100% rename from stringcache.cpp rename to cruft/util/stringcache.cpp diff --git a/stringcache.hpp b/cruft/util/stringcache.hpp similarity index 100% rename from stringcache.hpp rename to cruft/util/stringcache.hpp diff --git a/stringid.cpp b/cruft/util/stringid.cpp similarity index 100% rename from stringid.cpp rename to cruft/util/stringid.cpp diff --git a/stringid.hpp b/cruft/util/stringid.hpp similarity index 100% rename from stringid.hpp rename to cruft/util/stringid.hpp diff --git a/strongdef.cpp b/cruft/util/strongdef.cpp similarity index 100% rename from strongdef.cpp rename to cruft/util/strongdef.cpp diff --git a/strongdef.hpp b/cruft/util/strongdef.hpp similarity index 100% rename from strongdef.hpp rename to cruft/util/strongdef.hpp diff --git a/sysinfo.hpp b/cruft/util/sysinfo.hpp similarity index 100% rename from sysinfo.hpp rename to cruft/util/sysinfo.hpp diff --git a/sysinfo_posix.cpp b/cruft/util/sysinfo_posix.cpp similarity index 100% rename from sysinfo_posix.cpp rename to cruft/util/sysinfo_posix.cpp diff --git a/sysinfo_win32.cpp b/cruft/util/sysinfo_win32.cpp similarity index 100% rename from sysinfo_win32.cpp rename to cruft/util/sysinfo_win32.cpp diff --git a/tap.cpp b/cruft/util/tap.cpp similarity index 100% rename from tap.cpp rename to cruft/util/tap.cpp diff --git a/tap.hpp b/cruft/util/tap.hpp similarity index 100% rename from tap.hpp rename to cruft/util/tap.hpp diff --git a/term.cpp b/cruft/util/term.cpp similarity index 100% rename from term.cpp rename to cruft/util/term.cpp diff --git a/term.hpp b/cruft/util/term.hpp similarity index 100% rename from term.hpp rename to cruft/util/term.hpp diff --git a/cruft/util/thread/event.hpp b/cruft/util/thread/event.hpp new file mode 100644 index 00000000..e249ff42 --- /dev/null +++ b/cruft/util/thread/event.hpp @@ -0,0 +1,7 @@ +#include + +#if defined(PLATFORM_LINUX) +#include "./event_futex.hpp" +#else +#include "./event_std.hpp" +#endif \ No newline at end of file diff --git a/thread/event_futex.cpp b/cruft/util/thread/event_futex.cpp similarity index 100% rename from thread/event_futex.cpp rename to cruft/util/thread/event_futex.cpp diff --git a/thread/event_futex.hpp b/cruft/util/thread/event_futex.hpp similarity index 100% rename from thread/event_futex.hpp rename to cruft/util/thread/event_futex.hpp diff --git a/thread/event_std.cpp b/cruft/util/thread/event_std.cpp similarity index 100% rename from thread/event_std.cpp rename to cruft/util/thread/event_std.cpp diff --git a/thread/event_std.hpp b/cruft/util/thread/event_std.hpp similarity index 100% rename from thread/event_std.hpp rename to cruft/util/thread/event_std.hpp diff --git a/thread/event_win32.cpp b/cruft/util/thread/event_win32.cpp similarity index 100% rename from thread/event_win32.cpp rename to cruft/util/thread/event_win32.cpp diff --git a/thread/flag.hpp b/cruft/util/thread/flag.hpp similarity index 100% rename from thread/flag.hpp rename to cruft/util/thread/flag.hpp diff --git a/thread/flag_futex.cpp b/cruft/util/thread/flag_futex.cpp similarity index 100% rename from thread/flag_futex.cpp rename to cruft/util/thread/flag_futex.cpp diff --git a/thread/flag_futex.hpp b/cruft/util/thread/flag_futex.hpp similarity index 100% rename from thread/flag_futex.hpp rename to cruft/util/thread/flag_futex.hpp diff --git a/thread/flag_std.cpp b/cruft/util/thread/flag_std.cpp similarity index 100% rename from thread/flag_std.cpp rename to cruft/util/thread/flag_std.cpp diff --git a/thread/flag_std.hpp b/cruft/util/thread/flag_std.hpp similarity index 100% rename from thread/flag_std.hpp rename to cruft/util/thread/flag_std.hpp diff --git a/thread/monitor.cpp b/cruft/util/thread/monitor.cpp similarity index 100% rename from thread/monitor.cpp rename to cruft/util/thread/monitor.cpp diff --git a/thread/monitor.hpp b/cruft/util/thread/monitor.hpp similarity index 100% rename from thread/monitor.hpp rename to cruft/util/thread/monitor.hpp diff --git a/thread/primitive.hpp b/cruft/util/thread/primitive.hpp similarity index 100% rename from thread/primitive.hpp rename to cruft/util/thread/primitive.hpp diff --git a/thread/semaphore.hpp b/cruft/util/thread/semaphore.hpp similarity index 100% rename from thread/semaphore.hpp rename to cruft/util/thread/semaphore.hpp diff --git a/thread/semaphore_linux.cpp b/cruft/util/thread/semaphore_linux.cpp similarity index 100% rename from thread/semaphore_linux.cpp rename to cruft/util/thread/semaphore_linux.cpp diff --git a/thread/semaphore_linux.hpp b/cruft/util/thread/semaphore_linux.hpp similarity index 100% rename from thread/semaphore_linux.hpp rename to cruft/util/thread/semaphore_linux.hpp diff --git a/thread/semaphore_win32.cpp b/cruft/util/thread/semaphore_win32.cpp similarity index 100% rename from thread/semaphore_win32.cpp rename to cruft/util/thread/semaphore_win32.cpp diff --git a/thread/semaphore_win32.hpp b/cruft/util/thread/semaphore_win32.hpp similarity index 100% rename from thread/semaphore_win32.hpp rename to cruft/util/thread/semaphore_win32.hpp diff --git a/thread/spinlock.cpp b/cruft/util/thread/spinlock.cpp similarity index 100% rename from thread/spinlock.cpp rename to cruft/util/thread/spinlock.cpp diff --git a/thread/spinlock.hpp b/cruft/util/thread/spinlock.hpp similarity index 100% rename from thread/spinlock.hpp rename to cruft/util/thread/spinlock.hpp diff --git a/thread/ticketlock.cpp b/cruft/util/thread/ticketlock.cpp similarity index 100% rename from thread/ticketlock.cpp rename to cruft/util/thread/ticketlock.cpp diff --git a/thread/ticketlock.hpp b/cruft/util/thread/ticketlock.hpp similarity index 100% rename from thread/ticketlock.hpp rename to cruft/util/thread/ticketlock.hpp diff --git a/time.cpp b/cruft/util/time.cpp similarity index 100% rename from time.cpp rename to cruft/util/time.cpp diff --git a/time.hpp b/cruft/util/time.hpp similarity index 100% rename from time.hpp rename to cruft/util/time.hpp diff --git a/time/parse.hpp b/cruft/util/time/parse.hpp similarity index 100% rename from time/parse.hpp rename to cruft/util/time/parse.hpp diff --git a/time/parse8601.cpp.rl b/cruft/util/time/parse8601.cpp.rl similarity index 97% rename from time/parse8601.cpp.rl rename to cruft/util/time/parse8601.cpp.rl index ac9fbdfd..5c8a726c 100644 --- a/time/parse8601.cpp.rl +++ b/cruft/util/time/parse8601.cpp.rl @@ -6,10 +6,10 @@ * Copyright 2017-2018 Danny Robson */ -#include "time/parse.hpp" +#include -#include "debug/assert.hpp" -#include "posix/except.hpp" +#include +#include #include #include diff --git a/time_posix.cpp b/cruft/util/time_posix.cpp similarity index 100% rename from time_posix.cpp rename to cruft/util/time_posix.cpp diff --git a/time_win32.cpp b/cruft/util/time_win32.cpp similarity index 100% rename from time_win32.cpp rename to cruft/util/time_win32.cpp diff --git a/tuple/index.hpp b/cruft/util/tuple/index.hpp similarity index 100% rename from tuple/index.hpp rename to cruft/util/tuple/index.hpp diff --git a/tuple/type.hpp b/cruft/util/tuple/type.hpp similarity index 100% rename from tuple/type.hpp rename to cruft/util/tuple/type.hpp diff --git a/tuple/value.hpp b/cruft/util/tuple/value.hpp similarity index 100% rename from tuple/value.hpp rename to cruft/util/tuple/value.hpp diff --git a/typeidx.cpp b/cruft/util/typeidx.cpp similarity index 100% rename from typeidx.cpp rename to cruft/util/typeidx.cpp diff --git a/typeidx.hpp b/cruft/util/typeidx.hpp similarity index 100% rename from typeidx.hpp rename to cruft/util/typeidx.hpp diff --git a/types.hpp b/cruft/util/types.hpp similarity index 100% rename from types.hpp rename to cruft/util/types.hpp diff --git a/types/comparator.hpp b/cruft/util/types/comparator.hpp similarity index 100% rename from types/comparator.hpp rename to cruft/util/types/comparator.hpp diff --git a/types/description.cpp b/cruft/util/types/description.cpp similarity index 100% rename from types/description.cpp rename to cruft/util/types/description.cpp diff --git a/types/description.hpp b/cruft/util/types/description.hpp similarity index 100% rename from types/description.hpp rename to cruft/util/types/description.hpp diff --git a/types/dispatch.hpp b/cruft/util/types/dispatch.hpp similarity index 100% rename from types/dispatch.hpp rename to cruft/util/types/dispatch.hpp diff --git a/types/sized.hpp b/cruft/util/types/sized.hpp similarity index 100% rename from types/sized.hpp rename to cruft/util/types/sized.hpp diff --git a/types/string.cpp b/cruft/util/types/string.cpp similarity index 100% rename from types/string.cpp rename to cruft/util/types/string.cpp diff --git a/types/string.hpp b/cruft/util/types/string.hpp similarity index 100% rename from types/string.hpp rename to cruft/util/types/string.hpp diff --git a/types/tagged.hpp b/cruft/util/types/tagged.hpp similarity index 100% rename from types/tagged.hpp rename to cruft/util/types/tagged.hpp diff --git a/types/traits.hpp b/cruft/util/types/traits.hpp similarity index 100% rename from types/traits.hpp rename to cruft/util/types/traits.hpp diff --git a/uri.cpp b/cruft/util/uri.cpp similarity index 100% rename from uri.cpp rename to cruft/util/uri.cpp diff --git a/uri.cpp.rl b/cruft/util/uri.cpp.rl similarity index 99% rename from uri.cpp.rl rename to cruft/util/uri.cpp.rl index 63127d90..db102e79 100644 --- a/uri.cpp.rl +++ b/cruft/util/uri.cpp.rl @@ -6,7 +6,7 @@ * Copyright 2015 Danny Robson */ -#include "uri.hpp" +#include #include diff --git a/uri.hpp b/cruft/util/uri.hpp similarity index 100% rename from uri.hpp rename to cruft/util/uri.hpp diff --git a/utf8.cpp b/cruft/util/utf8.cpp similarity index 100% rename from utf8.cpp rename to cruft/util/utf8.cpp diff --git a/utf8.hpp b/cruft/util/utf8.hpp similarity index 100% rename from utf8.hpp rename to cruft/util/utf8.hpp diff --git a/variadic.cpp b/cruft/util/variadic.cpp similarity index 100% rename from variadic.cpp rename to cruft/util/variadic.cpp diff --git a/variadic.hpp b/cruft/util/variadic.hpp similarity index 100% rename from variadic.hpp rename to cruft/util/variadic.hpp diff --git a/vector.cpp b/cruft/util/vector.cpp similarity index 100% rename from vector.cpp rename to cruft/util/vector.cpp diff --git a/vector.hpp b/cruft/util/vector.hpp similarity index 100% rename from vector.hpp rename to cruft/util/vector.hpp diff --git a/version.cpp.rl b/cruft/util/version.cpp.rl similarity index 98% rename from version.cpp.rl rename to cruft/util/version.cpp.rl index 6136ab90..355f6a06 100644 --- a/version.cpp.rl +++ b/cruft/util/version.cpp.rl @@ -6,10 +6,10 @@ * Copyright 2010 Danny Robson */ -#include "version.hpp" -#include "maths.hpp" -#include "debug/assert.hpp" -#include "debug/panic.hpp" +#include +#include +#include +#include #include #include diff --git a/version.hpp b/cruft/util/version.hpp similarity index 100% rename from version.hpp rename to cruft/util/version.hpp diff --git a/view.cpp b/cruft/util/view.cpp similarity index 100% rename from view.cpp rename to cruft/util/view.cpp diff --git a/view.hpp b/cruft/util/view.hpp similarity index 100% rename from view.hpp rename to cruft/util/view.hpp diff --git a/win32/except.cpp b/cruft/util/win32/except.cpp similarity index 100% rename from win32/except.cpp rename to cruft/util/win32/except.cpp diff --git a/win32/except.hpp b/cruft/util/win32/except.hpp similarity index 100% rename from win32/except.hpp rename to cruft/util/win32/except.hpp diff --git a/win32/file.cpp b/cruft/util/win32/file.cpp similarity index 100% rename from win32/file.cpp rename to cruft/util/win32/file.cpp diff --git a/win32/file.hpp b/cruft/util/win32/file.hpp similarity index 100% rename from win32/file.hpp rename to cruft/util/win32/file.hpp diff --git a/win32/handle.cpp b/cruft/util/win32/handle.cpp similarity index 100% rename from win32/handle.cpp rename to cruft/util/win32/handle.cpp diff --git a/win32/handle.hpp b/cruft/util/win32/handle.hpp similarity index 100% rename from win32/handle.hpp rename to cruft/util/win32/handle.hpp diff --git a/win32/registry.cpp b/cruft/util/win32/registry.cpp similarity index 100% rename from win32/registry.cpp rename to cruft/util/win32/registry.cpp diff --git a/win32/registry.hpp b/cruft/util/win32/registry.hpp similarity index 100% rename from win32/registry.hpp rename to cruft/util/win32/registry.hpp diff --git a/win32/windows.hpp b/cruft/util/win32/windows.hpp similarity index 100% rename from win32/windows.hpp rename to cruft/util/win32/windows.hpp diff --git a/zlib.cpp b/cruft/util/zlib.cpp similarity index 100% rename from zlib.cpp rename to cruft/util/zlib.cpp diff --git a/zlib.hpp b/cruft/util/zlib.hpp similarity index 100% rename from zlib.hpp rename to cruft/util/zlib.hpp diff --git a/meson.build b/meson.build index b64c1d0e..2c183907 100644 --- a/meson.build +++ b/meson.build @@ -1,722 +1,38 @@ -project('cruft', 'cpp') +project( + 'cruft-util', + 'cpp', + version: '2024-dev', + default_options: ['cpp_std=c++23'], +) +#add_project_arguments('-std=c++2b', language: 'cpp') + +add_project_arguments('-Drestrict=__restrict', language: 'cpp') +add_project_arguments('-Dpanic=panic', language: 'cpp') + +add_project_arguments('-DPACKAGE="@0@"'.format(meson.project_name()), language: 'cpp') +add_project_arguments('-DPACKAGE_VERSION="@0@"'.format(meson.project_version()), language: 'cpp') +add_project_arguments('-DPACKAGE_NAME="@0@"'.format(meson.project_name()), language: 'cpp') +add_project_arguments('-DPACKAGE_STRING="@0@ @1@"'.format(meson.project_name(), meson.project_version()), language: 'cpp') + +############################################################################### pymod = import('python') python = pymod.find_installation('python3') -ragel = generator( - find_program('ragel'), - output: '@BASENAME@.cpp', - arguments: [ '@INPUT@', '-o@OUTPUT@', '-G2' ] -) +if host_machine.system() == 'windows' + # Enable features for Windows Vista and higher + add_project_arguments('-D_WIN32_WINNT=0x0600') +endif + + +############################################################################### if host_machine.endian() == 'big' add_project_arguments('-DWORDS_BIGENDIAN') endif -add_project_arguments('-std=c++2a', language: 'cpp') -add_project_link_arguments('-lstdc++fs', language: 'cpp') -add_project_arguments('-Drestrict=__restrict', language: 'cpp') - -sources = [ - ragel.process('uri.cpp.rl'), - ragel.process('version.cpp.rl'), - ragel.process('format.cpp.rl'), - ragel.process('time/parse8601.cpp.rl'), -] - -dependencies = [ - dependency('threads') -] - - -### Preemptively define an identity panic macro so that TCL doens't fuck us over -### by renaming a commonly used symbol. -add_project_arguments('-Dpanic=panic', language: 'cpp') - - -################################################################################# -cpp = meson.get_compiler('cpp') -execinfo = cpp.find_library('execinfo', required: false) # sym:backtrace -dbghelp = cpp.find_library('dbghelp', required: false) # sym:SymFromAddr -capture_stack_backtrace = cpp.has_function('RtlCaptureStackBackTrace') - -if execinfo.found() - sources += 'backtrace_execinfo.cpp' -elif dbghelp.found() - sources += 'backtrace_stackwalk.cpp' - dependencies += dbghelp -else - sources += 'backtrace_null.cpp' -endif - - -sources += custom_target( - 'preprocessor.hpp', - output: 'preprocessor.hpp', - input: 'preprocessor.py', - command: [python, '@INPUT@', '@OUTPUT@', '480'], -) - - -################################################################################# -### Platform wrappers -systems = { - 'linux': 'linux', - 'freebsd': 'freebsd', - 'windows': 'win32' -} - -# TODO: handle missing system -sources += 'exe_@0@.cpp'.format(systems[host_machine.system()]) - - -sources += [ - 'posix/dir.cpp', - 'posix/dir.hpp', - 'posix/except.cpp', - 'posix/except.hpp', - 'posix/fd.cpp', - 'posix/fd.hpp', -] - - -if host_machine.system() == 'linux' - sources += [ - 'thread/event_futex.cpp', - 'thread/flag_futex.cpp', - ] -endif - - -if host_machine.system() != 'windows' - sources += [ - 'buffer/circular.cpp', - 'buffer/circular.hpp', - 'buffer/paged.cpp', - 'buffer/paged.hpp', - 'memory/system.cpp', - 'memory/system.hpp', - 'debug_posix.cpp', - 'io_posix.cpp', - 'io_posix.hpp', - 'library_posix.hpp', - 'library_posix.cpp', - 'posix/fwd.hpp', - 'posix/map.cpp', - 'posix/map.hpp', - 'posix/socket.cpp', - 'posix/socket.hpp', - 'time_posix.cpp', - ] -endif - - -####----------------------------------------------------------------------------- -if host_machine.system() == 'windows' - sources += [ - 'debug_win32.cpp', - 'exe_win32.cpp', - 'io_win32.cpp', - 'io_win32.hpp', - 'thread/event_win32.cpp', - 'library_win32.cpp', - 'library_win32.hpp', - 'time_win32.cpp', - 'win32/windows.hpp', - 'win32/except.cpp', - 'win32/except.hpp', - 'win32/file.cpp', - 'win32/file.hpp', - 'win32/handle.cpp', - 'win32/handle.hpp', - 'win32/registry.cpp', - 'win32/registry.hpp', - ] - - dependencies += cpp.find_library('ws2_32') -endif - - -sources += [ - 'thread/event.hpp', - 'thread/semaphore.hpp', - 'thread/flag.hpp', -] - - -if host_machine.system() == 'linux' - sources += [ - 'thread/event_futex.cpp', - 'thread/event_futex.hpp', - 'thread/semaphore_linux.hpp', - 'thread/semaphore_linux.cpp', - 'thread/flag_futex.cpp', - '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 - error('Unknown platform for threading') -endif - - -if host_machine.cpu_family() == 'x86_64' - sources += [ - 'cpuid/x86.cpp', - 'cpuid/x86.cpp', - ] -else - warning('Unknown architecture @0@. Defaulting to null cpuid'.format(host_machine.cpu_family())) - sources += [ - 'cpuid/none.cpp', - 'cpuid/none.hpp', - ] -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 - - -if host_machine.system() == 'linux' - sources += [ 'sysinfo_posix.cpp' ] -elif host_machine.system() == 'windows' - sources += [ 'sysinfo_win32.cpp' ] -else - error('Unsupported system for sysinfo') -endif - - -################################################################################# -### Common files -sources += [ - 'adapter.hpp', - 'adapter.cpp', - 'algo/search.hpp', - 'algo/sort.cpp', - 'algo/sort.hpp', - 'alloc/fwd.hpp', - 'alloc/affix.cpp', - 'alloc/affix.hpp', - 'alloc/aligned/direct.hpp', - 'alloc/aligned/foreign.hpp', - 'alloc/allocator.cpp', - 'alloc/allocator.hpp', - 'alloc/easy.hpp', - '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', - 'alloc/std.hpp', - 'alloc/traits.hpp', - 'alloc/traits.hpp', - 'annotation.hpp', - 'array/darray.hpp', - 'array/sarray.cpp', - 'array/sarray.hpp', - 'array/parray.cpp', - 'array/parray.hpp', - 'array/varray.hpp', - 'ascii.hpp', - 'backtrace.hpp', - 'bezier.cpp', - 'bezier1.cpp', - 'bezier2.cpp', - 'bezier3.cpp', - 'bezier.hpp', - 'bitwise.cpp', - 'bitwise.hpp', - 'buffer/simple.cpp', - 'buffer/simple.hpp', - 'buffer/traits.hpp', - 'cast.hpp', - 'cmdopt.cpp', - 'cmdopt.hpp', - 'colour.cpp', - 'colour.hpp', - 'coord.hpp', - 'coord/fwd.hpp', - 'coord/base.hpp', - 'coord/comparator.hpp', - 'coord/init.hpp', - 'coord/iostream.hpp', - 'coord/ops.hpp', - 'coord/store.hpp', - 'coord/traits.hpp', - 'cpp.cpp', - 'cpp.hpp', - 'cpuid.cpp', - 'cpuid.hpp', - 'debug/assert.cpp', - 'debug/assert.hpp', - 'debug/compiler.cpp', - '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/base.cpp', - 'encode/base.hpp', - 'endian.cpp', - 'endian.hpp', - 'except.cpp', - 'except.hpp', - 'exe.hpp', - 'expected.hpp', - 'extent.cpp', - 'extent.hpp', - 'fixed.cpp', - 'fixed.hpp', - 'float.cpp', - 'float.hpp', - 'format.hpp', - 'fourcc.cpp', - 'fourcc.hpp', - 'functor.hpp', - 'geom/fwd.hpp', - 'geom/aabb.cpp', - 'geom/aabb.hpp', - 'geom/cylinder.cpp', - 'geom/cylinder.hpp', - 'geom/ellipse.cpp', - 'geom/ellipse.hpp', - 'geom/frustum.cpp', - 'geom/frustum.hpp', - 'geom/iostream.cpp', - 'geom/iostream.hpp', - 'geom/line.hpp', - 'geom/line.cpp', - 'geom/ops.cpp', - 'geom/ops.hpp', - 'geom/plane.cpp', - 'geom/plane.hpp', - 'geom/ray.cpp', - 'geom/ray.hpp', - 'geom/rect.cpp', - 'geom/rect.hpp', - 'geom/sample/fwd.hpp', - 'geom/sample/surface.hpp', - 'geom/sample/volume.hpp', - 'geom/segment.cpp', - 'geom/segment.hpp', - 'geom/sphere.cpp', - 'geom/sphere.hpp', - 'geom/tri.cpp', - 'geom/tri.hpp', - 'hash.hpp', - 'hash/fwd.hpp', - 'hash/adler.cpp', - 'hash/adler.hpp', - 'hash/buzhash.hpp', - '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', - 'hash/siphash.cpp', - 'hash/siphash.hpp', - 'hash/table.cpp', - 'hash/table.hpp', - 'hash/wang.hpp', - 'hash/xxhash.cpp', - 'hash/xxhash.hpp', - 'introspection.cpp', - 'introspection.hpp', - 'io.cpp', - 'io.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/dispatch.hpp', - 'job/queue.cpp', - 'job/queue.hpp', - 'kmeans.hpp', - 'library.hpp', - 'log.cpp', - 'log.hpp', - 'map/fixed.cpp', - 'map/fixed.hpp', - 'maths.cpp', - 'maths.hpp', - 'maths/fast.hpp', - 'matrix.cpp', - 'matrix2.cpp', - 'matrix3.cpp', - 'matrix4.cpp', - 'matrix.hpp', - 'memory/deleter.cpp', - 'memory/deleter.hpp', - 'parallel/queue.cpp', - 'parallel/queue.hpp', - 'parallel/stack.cpp', - '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', - 'point.cpp', - 'point.hpp', - 'pointer.hpp', - 'polynomial.cpp', - 'polynomial.hpp', - 'pool.cpp', - 'pool.hpp', - 'quaternion.cpp', - 'quaternion.hpp', - 'rand/lcg.cpp', - 'rand/lcg.hpp', - 'rand/xorshift.cpp', - 'rand/xorshift.hpp', - 'rand/mwc64x.cpp', - 'rand/mwc64x.hpp', - 'rand/pcg.cpp', - 'rand/pcg.hpp', - 'rand/rdrand.cpp', - 'rand/rdrand.hpp', - 'rand/system.hpp', - 'random.cpp', - 'random.hpp', - 'range.cpp', - 'range.hpp', - 'rational.cpp', - 'rational.hpp', - 'region.cpp', - 'region.hpp', - 'registrar.cpp', - 'registrar.hpp', - 'roots/bisection.hpp', - 'scoped.hpp', - 'signal.cpp', - 'signal.hpp', - 'singleton.hpp', - 'stats.cpp', - 'stats.hpp', - 'std.hpp', - 'stream.cpp', - 'stream.hpp', - 'string.cpp', - 'string.hpp', - 'stringid.cpp', - 'stringid.hpp', - 'strongdef.cpp', - 'strongdef.hpp', - 'sysinfo.hpp', - 'tap.cpp', - 'tap.hpp', - 'term.cpp', - 'term.hpp', - 'thread/event.hpp', - 'thread/flag.hpp', - 'thread/monitor.cpp', - 'thread/monitor.hpp', - 'thread/ticketlock.cpp', - 'thread/ticketlock.hpp', - 'thread/spinlock.cpp', - 'thread/spinlock.hpp', - 'time.cpp', - 'time.hpp', - 'time/parse.hpp', - 'tuple/index.hpp', - 'tuple/type.hpp', - 'tuple/value.hpp', - 'typeidx.cpp', - 'typeidx.hpp', - 'types.hpp', - 'types/bits.hpp', - 'types/comparator.hpp', - 'types/description.cpp', - 'types/description.hpp', - 'types/dispatch.hpp', - 'types/string.cpp', - 'types/string.hpp', - 'types/tagged.hpp', - 'types/traits.hpp', - 'uri.hpp', - 'utf8.cpp', - 'utf8.hpp', - 'variadic.cpp', - 'variadic.hpp', - 'vector.cpp', - 'vector.hpp', - 'version.hpp', - 'view.cpp', - 'view.hpp', -] - - -if get_option('simd') - sources += [ - 'coord/simd.cpp', - 'coord/simd.hpp', - 'coord/simd_sse.hpp', - 'coord/simd_neon.hpp', - ] -endif - - -################################################################################# -rt = cpp.find_library('rt', required: false) -if not cpp.has_function('shm_open', dependencies: [rt]) - error('Cannot find shm library') -endif -dependencies += rt - -dl = cpp.find_library('dl', required: false) -if not cpp.has_function('dlopen', dependencies: dl) - error ('Cannot find dl library') -endif -dependencies += dl - -if not cpp.has_function('clock_gettime', dependencies: rt) - error('Cannot find clock_gettime library') -endif - -m = cpp.find_library('m', required: false) -if not cpp.has_function('cos', dependencies: m) - error('Cannot find maths library') -endif -dependencies += m - - -libcruft = library('cruft', sources, dependencies: dependencies) -libcruft_dep = declare_dependency( - include_directories: include_directories('.'), - link_with: libcruft -) - - -################################################################################# -foreach tool: ['cpuid', 'poisson', 'macro', 'scratch'] - executable(tool, 'tools/@0@.cpp'.format(tool), link_with: libcruft) -endforeach - - -################################################################################# -tests = [ - 'ascii', - 'algo/search', - 'algo/sort', - 'alloc/aligned/foreign', - 'alloc/aligned/direct', - 'alloc/easy', - 'alloc/linear', - 'alloc/stack', - 'affine', - 'array/darray', - 'array/sarray', - 'array/parray', - 'backtrace', - 'bezier', - 'bitwise', - 'buffer/simple', - 'cmdopt', - 'colour', - 'comparator', - 'coord', - 'encode/number', - 'encode/base', - 'endian', - 'exe', - 'expected', - 'extent', - 'fixed', - 'float', - 'format', - 'geom/aabb', - 'geom/ellipse', - 'geom/frustum', - 'geom/line', - 'geom/plane', - 'geom/ray', - 'geom/segment', - 'geom/sphere', - 'hash/buzhash', - 'hash/checksum', - 'hash/crc', - 'hash/fasthash', - 'hash/fnv1a', - 'hash/murmur', - 'hash/siphash', - 'hash/table', - 'hash/xxhash', - 'hton', - 'io', - 'introspection', - 'iterator', - 'job/dispatch', - 'job/queue', - 'kmeans', - 'map/fixed', - 'maths', - 'maths/fast', - 'matrix', - 'memory/deleter', - 'parallel/queue', - 'parallel/stack', - 'parse/enum', - 'parse/value', - 'parse/time', - 'parse/si', - 'point', - 'polynomial', - 'pool', - 'preprocessor', - 'quaternion', - 'rand/buckets', - 'random', - 'range', - 'rational', - 'region', - 'registrar', - 'roots/bisection', - 'scoped', - 'signal', - 'singleton', - 'stream', - 'string', - 'stringid', - 'strongdef', - 'thread/event', - 'thread/flag', - 'thread/monitor', - 'thread/semaphore', - 'thread/spinlock', - 'thread/ticketlock', - 'time/8601', - 'traits', - 'tuple/index', - 'tuple/value', - 'tuple/type', - 'typeidx', - 'types/description', - 'types/tagged', - 'uri', - 'utf8', - 'vector', - 'version', - 'view', -] - - -if host_machine.system() != 'windows' - tests += [ - 'buffer/circular', - 'buffer/paged', - ] -endif - - -if get_option('simd') - tests += [ - 'coord/simd' - ] -endif - - -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) -## add_test (NAME util_test_cpp COMMAND ${PYTHON_EXECUTABLE} util_test_cpp.py) -## set_property (TEST util_test_cpp APPEND PROPERTY DEPENDS util_macro) -## set_tests_properties(util_test_cpp PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -") -##endif () -## -## -################################################################################# -cmake_config = configuration_data() - -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(), - } -) +############################################################################### +subdir('src/cruft/util') +subdir('tools') +subdir('test') diff --git a/meson.options b/meson.options new file mode 100644 index 00000000..9a615dc1 --- /dev/null +++ b/meson.options @@ -0,0 +1 @@ +option('simd', type: 'boolean', value: false, description: 'enable SIMD support') diff --git a/meson_options.txt b/meson_options.txt deleted file mode 100644 index e1bc6c4d..00000000 --- a/meson_options.txt +++ /dev/null @@ -1 +0,0 @@ -option('simd', type: 'boolean', value: false) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt new file mode 100644 index 00000000..a6681b7f --- /dev/null +++ b/test/CMakeLists.txt @@ -0,0 +1,162 @@ +############################################################################### +option (TESTS "enable unit testing" ON) + +if (TESTS) + include(CTest) + enable_testing() + + list ( + APPEND TEST_BIN + ascii + algo/search + algo/sort + alloc/aligned/foreign + alloc/aligned/direct + alloc/easy + alloc/linear + alloc/stack + affine + array/darray + array/sarray + array/parray + backtrace + bezier + bitwise + bool + buffer/simple + cmdopt + cmdopt2 + colour + concepts + comparator + coord + debug/fpe + encode/number + encode/base + endian + exe + expected + extent + fixed + float + format/quoted + fs/scoped + fs/tmp + geom/aabb + geom/ellipse + geom/frustum + geom/line + geom/plane + geom/ray + geom/sample/edge + geom/sample/subregion + geom/segment + geom/sphere + hash/buzhash + hash/checksum + hash/crc + hash/fasthash + hash/fnv1a + hash/halfsipmix + hash/murmur + hash/siphash + hash/table + hash/tuple + hash/xxhash + hton + io + introspection + introspection/enum_simple + iterator + job/dispatch + job/queue + kmeans + list/sort + map/fixed + map/multi_fixed + maths + maths/fast + matrix + memory/deleter + parallel/queue + parallel/stack + parse/enum + parse/value + parse/time + parse/si + paths + point + polynomial + pool + preprocessor + quaternion + rand/buckets + rand/generator/normal + random + range + rational + region + registrar + roots/bisection + scoped + serialise + set/dset + signal + singleton + stream + string + stringid + stringcache + strongdef + thread/event + thread/flag + thread/monitor + thread/semaphore + thread/spinlock + thread/ticketlock + time/8601 + traits + tuple/index + tuple/value + tuple/type + typeidx + types/description + types/tagged + uri + utf8 + vector + version + view + ) + + if (NOT WIN32) + list (APPEND TEST_BIN + buffer/circular + buffer/paged + ) + endif () + + if (SIMD) + list (APPEND TEST_BIN + coord/simd + ) + endif() + + add_custom_target(util_test) + + foreach(t ${TEST_BIN}) + string(REPLACE "/" "_" name "test/${t}") + add_executable(util_${name} "${t}.cpp") + target_link_libraries(util_${name} PRIVATE cruft::util) + #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}) + set_tests_properties(util_${name} PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -") + add_dependencies(util_test util_${name}) + endforeach(t) + + configure_file (cpp.py.in util_test_cpp.py @ONLY) + add_test (NAME util_test_cpp COMMAND ${Python3_EXECUTABLE} util_test_cpp.py) + set_property (TEST util_test_cpp APPEND PROPERTY DEPENDS util_macro) + set_tests_properties(util_test_cpp PROPERTIES FAIL_REGULAR_EXPRESSION "not ok -") +endif () diff --git a/test/affine.cpp b/test/affine.cpp index 6f514c61..3c341b46 100644 --- a/test/affine.cpp +++ b/test/affine.cpp @@ -1,11 +1,11 @@ -#include "tap.hpp" +#include -#include "vector.hpp" -#include "matrix.hpp" -#include "quaternion.hpp" +#include +#include +#include -#include "coord/iostream.hpp" -#include "matrix.hpp" +#include +#include #include diff --git a/test/algo/search.cpp b/test/algo/search.cpp index 8bf791b3..2a8e3a84 100644 --- a/test/algo/search.cpp +++ b/test/algo/search.cpp @@ -7,9 +7,9 @@ * 2018, Danny Robson */ -#include "algo/search.hpp" -#include "tap.hpp" -#include "point.hpp" +#include +#include +#include int diff --git a/test/algo/sort.cpp b/test/algo/sort.cpp index 4d1fcac1..d24bd4da 100644 --- a/test/algo/sort.cpp +++ b/test/algo/sort.cpp @@ -1,10 +1,10 @@ -#include "algo/sort.hpp" -#include "tap.hpp" +#include +#include #include - +/////////////////////////////////////////////////////////////////////////////// void reorder (std::vector &values, std::vector &indices) { @@ -26,6 +26,7 @@ reorder (std::vector &values, std::vector &indices) } +/////////////////////////////////////////////////////////////////////////////// int main (int, char**) { diff --git a/test/alloc/aligned/direct.cpp b/test/alloc/aligned/direct.cpp index 50fa85fb..89c011a0 100644 --- a/test/alloc/aligned/direct.cpp +++ b/test/alloc/aligned/direct.cpp @@ -1,9 +1,10 @@ -#include "tap.hpp" +#include -#include "alloc/aligned/direct.hpp" -#include "alloc/linear.hpp" +#include +#include +/////////////////////////////////////////////////////////////////////////////// int main (int, char**) { diff --git a/test/alloc/aligned/foreign.cpp b/test/alloc/aligned/foreign.cpp index 14a517c8..237d807d 100644 --- a/test/alloc/aligned/foreign.cpp +++ b/test/alloc/aligned/foreign.cpp @@ -1,7 +1,7 @@ -#include "alloc/aligned/foreign.hpp" -#include "alloc/linear.hpp" -#include "pointer.hpp" -#include "tap.hpp" +#include +#include +#include +#include int main () diff --git a/test/alloc/easy.cpp b/test/alloc/easy.cpp index a5d6b520..8f791b80 100644 --- a/test/alloc/easy.cpp +++ b/test/alloc/easy.cpp @@ -1,7 +1,7 @@ -#include "alloc/easy.hpp" -#include "alloc/linear.hpp" -#include "buffer/simple.hpp" -#include "tap.hpp" +#include +#include +#include +#include #include diff --git a/test/alloc/linear.cpp b/test/alloc/linear.cpp index e8059b72..7fa38ece 100644 --- a/test/alloc/linear.cpp +++ b/test/alloc/linear.cpp @@ -1,5 +1,5 @@ -#include "tap.hpp" -#include "alloc/linear.hpp" +#include +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/alloc/stack.cpp b/test/alloc/stack.cpp index 022223d8..4974d43e 100644 --- a/test/alloc/stack.cpp +++ b/test/alloc/stack.cpp @@ -1,5 +1,5 @@ -#include "tap.hpp" -#include "alloc/stack.hpp" +#include +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/array/darray.cpp b/test/array/darray.cpp index 3ab6e953..671a1e7c 100644 --- a/test/array/darray.cpp +++ b/test/array/darray.cpp @@ -1,6 +1,6 @@ -#include "tap.hpp" +#include -#include "array/darray.hpp" +#include int main (int, char**) diff --git a/test/array/parray.cpp b/test/array/parray.cpp index b9638eb6..8f595d84 100644 --- a/test/array/parray.cpp +++ b/test/array/parray.cpp @@ -1,6 +1,6 @@ -#include "array/parray.hpp" +#include -#include "tap.hpp" +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/array/sarray.cpp b/test/array/sarray.cpp index 905ef9c7..efdfdf81 100644 --- a/test/array/sarray.cpp +++ b/test/array/sarray.cpp @@ -1,7 +1,7 @@ -#include "tap.hpp" +#include -#include "array/sarray.hpp" -#include "debug/assert.hpp" +#include +#include #include diff --git a/test/ascii.cpp b/test/ascii.cpp index c837246e..29545a76 100644 --- a/test/ascii.cpp +++ b/test/ascii.cpp @@ -6,9 +6,9 @@ * Copyright 2017 Danny Robson */ -#include "tap.hpp" +#include -#include "ascii.hpp" +#include int main (int, char**) diff --git a/test/backtrace.cpp b/test/backtrace.cpp index 1238c403..5d0c9e7d 100644 --- a/test/backtrace.cpp +++ b/test/backtrace.cpp @@ -1,6 +1,6 @@ -#include "backtrace.hpp" -#include "tap.hpp" -#include "stream.hpp" +#include +#include +#include #include diff --git a/test/bezier.cpp b/test/bezier.cpp index f575e126..84331325 100644 --- a/test/bezier.cpp +++ b/test/bezier.cpp @@ -1,6 +1,6 @@ -#include "bezier.hpp" +#include -#include "tap.hpp" +#include #include diff --git a/test/bitwise.cpp b/test/bitwise.cpp index 2d0fabee..60bdfce0 100644 --- a/test/bitwise.cpp +++ b/test/bitwise.cpp @@ -1,6 +1,6 @@ -#include "bitwise.hpp" -#include "std.hpp" -#include "tap.hpp" +#include +#include +#include //----------------------------------------------------------------------------- diff --git a/test/buffer/circular.cpp b/test/buffer/circular.cpp index 90451381..f9be04fc 100644 --- a/test/buffer/circular.cpp +++ b/test/buffer/circular.cpp @@ -6,9 +6,9 @@ * Copyright 2015 Danny Robson */ -#include "std.hpp" -#include "buffer/circular.hpp" -#include "tap.hpp" +#include +#include +#include #include diff --git a/test/buffer/paged.cpp b/test/buffer/paged.cpp index 9e2d5c83..fc1c9bb8 100644 --- a/test/buffer/paged.cpp +++ b/test/buffer/paged.cpp @@ -1,9 +1,9 @@ -#include "std.hpp" -#include "tap.hpp" -#include "buffer/paged.hpp" -#include "debug/assert.hpp" -#include "except.hpp" -#include "posix/except.hpp" +#include +#include +#include +#include +#include +#include #include #include diff --git a/test/buffer/simple.cpp b/test/buffer/simple.cpp index 5c7dad8a..e867c3e1 100644 --- a/test/buffer/simple.cpp +++ b/test/buffer/simple.cpp @@ -6,7 +6,7 @@ * Copyright 2018 Danny Robson */ -#include "buffer/simple.hpp" +#include #include #include diff --git a/test/cmdopt.cpp b/test/cmdopt.cpp index 5789bd1b..f6aa3d4a 100644 --- a/test/cmdopt.cpp +++ b/test/cmdopt.cpp @@ -1,8 +1,8 @@ -#include "cmdopt.hpp" +#include -#include "tap.hpp" -#include "types.hpp" -#include "maths.hpp" +#include +#include +#include #include diff --git a/test/colour.cpp b/test/colour.cpp index 3afed11b..9e09f845 100644 --- a/test/colour.cpp +++ b/test/colour.cpp @@ -1,6 +1,6 @@ -#include "colour.hpp" +#include -#include "tap.hpp" +#include int diff --git a/test/comparator.cpp b/test/comparator.cpp index 279c0461..70aae638 100644 --- a/test/comparator.cpp +++ b/test/comparator.cpp @@ -1,6 +1,6 @@ -#include "tap.hpp" +#include -#include "types/comparator.hpp" +#include int main (int, char**) diff --git a/test/coord.cpp b/test/coord.cpp index 79cd03c5..dfbdeeb2 100644 --- a/test/coord.cpp +++ b/test/coord.cpp @@ -1,9 +1,9 @@ -#include "tap.hpp" -#include "point.hpp" -#include "vector.hpp" +#include +#include +#include -#include "coord/iostream.hpp" -#include "coord/comparator.hpp" +#include +#include #include diff --git a/test/encode/base.cpp b/test/encode/base.cpp index 038c97e5..8e6ad54f 100644 --- a/test/encode/base.cpp +++ b/test/encode/base.cpp @@ -1,6 +1,6 @@ -#include "../../tap.hpp" +#include -#include "../../encode/base.hpp" +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/encode/number.cpp b/test/encode/number.cpp index 9248dda3..8aff00b9 100644 --- a/test/encode/number.cpp +++ b/test/encode/number.cpp @@ -1,5 +1,5 @@ -#include "encode/number.hpp" -#include "tap.hpp" +#include +#include #include diff --git a/test/endian.cpp b/test/endian.cpp index a5236431..12e6c39f 100644 --- a/test/endian.cpp +++ b/test/endian.cpp @@ -1,6 +1,6 @@ -#include "tap.hpp" +#include -#include "endian.hpp" +#include #include diff --git a/test/exe.cpp b/test/exe.cpp index f22dbcae..30021586 100644 --- a/test/exe.cpp +++ b/test/exe.cpp @@ -1,6 +1,6 @@ -#include "../tap.hpp" +#include -#include "../exe.hpp" +#include #include diff --git a/test/expected.cpp b/test/expected.cpp index 833c2d8a..5ff15b95 100644 --- a/test/expected.cpp +++ b/test/expected.cpp @@ -1,6 +1,6 @@ -#include "../expected.hpp" +#include -#include "../tap.hpp" +#include diff --git a/test/extent.cpp b/test/extent.cpp index 1ef15e6e..fb8f1ce1 100644 --- a/test/extent.cpp +++ b/test/extent.cpp @@ -1,6 +1,6 @@ -#include "extent.hpp" -#include "tap.hpp" -#include "types.hpp" +#include +#include +#include int main (void) diff --git a/test/fixed.cpp b/test/fixed.cpp index bb3b4abb..4403f2a4 100644 --- a/test/fixed.cpp +++ b/test/fixed.cpp @@ -1,7 +1,7 @@ -#include "fixed.hpp" -#include "types/string.hpp" +#include +#include -#include "tap.hpp" +#include #include diff --git a/test/float.cpp b/test/float.cpp index d845b560..57b1b03a 100644 --- a/test/float.cpp +++ b/test/float.cpp @@ -1,7 +1,7 @@ -#include "float.hpp" +#include -#include "tap.hpp" -#include "types.hpp" +#include +#include #include diff --git a/test/geom/aabb.cpp b/test/geom/aabb.cpp index 364281f9..3836976a 100644 --- a/test/geom/aabb.cpp +++ b/test/geom/aabb.cpp @@ -1,7 +1,7 @@ -#include "geom/aabb.hpp" -#include "geom/ray.hpp" +#include +#include -#include "tap.hpp" +#include #include diff --git a/test/geom/ellipse.cpp b/test/geom/ellipse.cpp index 7d6b5e54..ea0eacd5 100644 --- a/test/geom/ellipse.cpp +++ b/test/geom/ellipse.cpp @@ -1,9 +1,9 @@ -#include "tap.hpp" +#include -#include "geom/ellipse.hpp" -#include "geom/ray.hpp" -#include "point.hpp" -#include "vector.hpp" +#include +#include +#include +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/geom/frustum.cpp b/test/geom/frustum.cpp index 2fe481d4..a58558c4 100644 --- a/test/geom/frustum.cpp +++ b/test/geom/frustum.cpp @@ -1,10 +1,10 @@ -#include "tap.hpp" +#include -#include "geom/frustum.hpp" -#include "geom/aabb.hpp" -#include "matrix.hpp" +#include +#include +#include -#include "geom/iostream.hpp" +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/geom/line.cpp b/test/geom/line.cpp index 76077097..2f01a8ec 100644 --- a/test/geom/line.cpp +++ b/test/geom/line.cpp @@ -1,6 +1,6 @@ -#include "tap.hpp" +#include -#include "geom/line.hpp" +#include int main (int, char**) diff --git a/test/geom/plane.cpp b/test/geom/plane.cpp index 9e966661..343c0ecb 100644 --- a/test/geom/plane.cpp +++ b/test/geom/plane.cpp @@ -1,6 +1,6 @@ -#include "geom/plane.hpp" -#include "point.hpp" -#include "tap.hpp" +#include +#include +#include void diff --git a/test/geom/ray.cpp b/test/geom/ray.cpp index cda80fba..5056df5a 100644 --- a/test/geom/ray.cpp +++ b/test/geom/ray.cpp @@ -1,8 +1,8 @@ -#include "geom/aabb.hpp" -#include "geom/plane.hpp" -#include "geom/ray.hpp" -#include "geom/iostream.hpp" -#include "tap.hpp" +#include +#include +#include +#include +#include using cruft::geom::ray2f; using cruft::geom::ray3f; diff --git a/test/geom/sample/edge.cpp b/test/geom/sample/edge.cpp index 9762d121..d05ef573 100644 --- a/test/geom/sample/edge.cpp +++ b/test/geom/sample/edge.cpp @@ -1,8 +1,8 @@ -#include "coord/comparator.hpp" -#include "coord/iostream.hpp" -#include "geom/sample/edge.hpp" -#include "rand/generic.hpp" -#include "tap.hpp" +#include +#include +#include +#include +#include #include diff --git a/test/geom/sample/subregion.cpp b/test/geom/sample/subregion.cpp index c59d73f7..33b94d32 100644 --- a/test/geom/sample/subregion.cpp +++ b/test/geom/sample/subregion.cpp @@ -1,4 +1,3 @@ - #include #include diff --git a/test/geom/segment.cpp b/test/geom/segment.cpp index bc441b91..d3868195 100644 --- a/test/geom/segment.cpp +++ b/test/geom/segment.cpp @@ -1,8 +1,8 @@ -#include "tap.hpp" +#include -#include "geom/segment.hpp" -#include "geom/ops.hpp" -#include "region.hpp" +#include +#include +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/geom/sphere.cpp b/test/geom/sphere.cpp index eccd2770..28f0a951 100644 --- a/test/geom/sphere.cpp +++ b/test/geom/sphere.cpp @@ -1,6 +1,6 @@ -#include "tap.hpp" +#include -#include "geom/sphere.hpp" +#include using cruft::geom::ray2f; using cruft::geom::ray3f; diff --git a/test/hash/buzhash.cpp b/test/hash/buzhash.cpp index 2bd85c84..755a5ebc 100644 --- a/test/hash/buzhash.cpp +++ b/test/hash/buzhash.cpp @@ -1,6 +1,6 @@ -#include "tap.hpp" -#include "hash/buzhash.hpp" -#include "std.hpp" +#include +#include +#include int main () diff --git a/test/hash/checksum.cpp b/test/hash/checksum.cpp index 7a4aa97d..89cfbc0b 100644 --- a/test/hash/checksum.cpp +++ b/test/hash/checksum.cpp @@ -1,9 +1,8 @@ +#include +#include -#include "hash/adler.hpp" -#include "hash/bsdsum.hpp" - -#include "types.hpp" -#include "tap.hpp" +#include +#include #include #include diff --git a/test/hash/crc.cpp b/test/hash/crc.cpp index a1027eab..53c75448 100644 --- a/test/hash/crc.cpp +++ b/test/hash/crc.cpp @@ -1,5 +1,5 @@ -#include "tap.hpp" -#include "hash/crc.hpp" +#include +#include #include #include diff --git a/test/hash/fasthash.cpp b/test/hash/fasthash.cpp index 3c3d7d3f..fa488a7f 100644 --- a/test/hash/fasthash.cpp +++ b/test/hash/fasthash.cpp @@ -1,5 +1,5 @@ -#include "hash/fasthash.hpp" -#include "tap.hpp" +#include +#include #include #include diff --git a/test/hash/fnv1a.cpp b/test/hash/fnv1a.cpp index 9178aa50..15792f9d 100644 --- a/test/hash/fnv1a.cpp +++ b/test/hash/fnv1a.cpp @@ -1,5 +1,5 @@ -#include "hash/fnv1a.hpp" -#include "tap.hpp" +#include +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/hash/halfsipmix.cpp b/test/hash/halfsipmix.cpp index 3234c4f0..7d360df2 100644 --- a/test/hash/halfsipmix.cpp +++ b/test/hash/halfsipmix.cpp @@ -1,5 +1,5 @@ -#include "hash/halfsipmix.hpp" -#include "tap.hpp" +#include +#include #include diff --git a/test/hash/murmur.cpp b/test/hash/murmur.cpp index 23d338ce..5acb3372 100644 --- a/test/hash/murmur.cpp +++ b/test/hash/murmur.cpp @@ -1,7 +1,7 @@ -#include "tap.hpp" +#include -#include "hash/murmur.hpp" -#include "types.hpp" +#include +#include #include diff --git a/test/hash/siphash.cpp b/test/hash/siphash.cpp index 3d5610c3..d23313a1 100644 --- a/test/hash/siphash.cpp +++ b/test/hash/siphash.cpp @@ -1,6 +1,6 @@ -#include "tap.hpp" +#include -#include "hash/siphash.hpp" +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/hash/table.cpp b/test/hash/table.cpp index 2c4576ea..969508b6 100644 --- a/test/hash/table.cpp +++ b/test/hash/table.cpp @@ -1,7 +1,7 @@ -#include "hash/table.hpp" +#include -#include "tap.hpp" -#include "introspection/name.hpp" +#include +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/hash/tuple.cpp b/test/hash/tuple.cpp index 1af35e60..147ed4b5 100644 --- a/test/hash/tuple.cpp +++ b/test/hash/tuple.cpp @@ -1,6 +1,6 @@ -#include "hash/tuple.hpp" +#include -#include "tap.hpp" +#include #include diff --git a/test/hash/xxhash.cpp b/test/hash/xxhash.cpp index dbdf462b..37570dc4 100644 --- a/test/hash/xxhash.cpp +++ b/test/hash/xxhash.cpp @@ -7,9 +7,9 @@ */ -#include "tap.hpp" +#include -#include "hash/xxhash.hpp" +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/hton.cpp b/test/hton.cpp index c8bfa124..db11ad52 100644 --- a/test/hton.cpp +++ b/test/hton.cpp @@ -1,8 +1,7 @@ +#include -#include "endian.hpp" - -#include "tap.hpp" -#include "platform.hpp" +#include +#include #include #if defined(PLATFORM_WIN32) diff --git a/test/introspection.cpp b/test/introspection.cpp index 759553f5..fc42b478 100644 --- a/test/introspection.cpp +++ b/test/introspection.cpp @@ -1,10 +1,10 @@ +#include +#include +#include +#include -#include "introspection/name.hpp" -#include "introspection/type.hpp" -#include "std.hpp" -#include "view.hpp" +#include -#include "tap.hpp" #include diff --git a/test/io.cpp b/test/io.cpp index df30c129..fefb6337 100644 --- a/test/io.cpp +++ b/test/io.cpp @@ -1,7 +1,7 @@ -#include "tap.hpp" +#include -#include "io.hpp" -#include "types/traits.hpp" +#include +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/ip.cpp b/test/ip.cpp index 26490b3a..ee4ddb7d 100644 --- a/test/ip.cpp +++ b/test/ip.cpp @@ -1,10 +1,9 @@ +#include -#include "ip.hpp" - -#include "debug.hpp" -#include "platform.hpp" -#include "tap.hpp" -#include "types.hpp" +#include +#include +#include +#include #include diff --git a/test/iterator.cpp b/test/iterator.cpp index 7f7d2517..2d0d9971 100644 --- a/test/iterator.cpp +++ b/test/iterator.cpp @@ -1,9 +1,9 @@ -#include "../tap.hpp" +#include -#include "../iterator/counting.hpp" -#include "../iterator/dereference.hpp" -#include "../iterator/iota.hpp" -#include "../iterator/zip.hpp" +#include +#include +#include +#include #include #include diff --git a/test/job/dispatch.cpp b/test/job/dispatch.cpp index 8a1ced06..46b243ea 100644 --- a/test/job/dispatch.cpp +++ b/test/job/dispatch.cpp @@ -6,9 +6,9 @@ * Copyright 2019 Danny Robson */ -#include "coord/comparator.hpp" -#include "job/dispatch.hpp" -#include "tap.hpp" +#include +#include +#include #include diff --git a/test/job/queue.cpp b/test/job/queue.cpp index 9c83a865..28dd6d06 100644 --- a/test/job/queue.cpp +++ b/test/job/queue.cpp @@ -1,6 +1,6 @@ /////////////////////////////////////////////////////////////////////////////// -#include "job/queue.hpp" -#include "tap.hpp" +#include +#include #include #include diff --git a/test/kmeans.cpp b/test/kmeans.cpp index cae8a3fd..6217fefb 100644 --- a/test/kmeans.cpp +++ b/test/kmeans.cpp @@ -1,8 +1,8 @@ -#include "tap.hpp" +#include -#include "kmeans.hpp" +#include -#include "point.hpp" +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/list/sort.cpp b/test/list/sort.cpp index b09a2a5f..dfd5fc15 100644 --- a/test/list/sort.cpp +++ b/test/list/sort.cpp @@ -6,11 +6,11 @@ * Copyright 2019 Danny Robson */ -#include "list/sort.hpp" -#include "random.hpp" -#include "rand/generic.hpp" -#include "tap.hpp" -#include "iterator/zip.hpp" +#include +#include +#include +#include +#include #include #include diff --git a/test/map/fixed.cpp b/test/map/fixed.cpp index 5ab21635..44d2b43b 100644 --- a/test/map/fixed.cpp +++ b/test/map/fixed.cpp @@ -1,6 +1,6 @@ -#include "tap.hpp" +#include -#include "map/fixed.hpp" +#include int main () { diff --git a/test/maths.cpp b/test/maths.cpp index 287212fe..a8bbbd00 100644 --- a/test/maths.cpp +++ b/test/maths.cpp @@ -1,6 +1,6 @@ -#include "maths.hpp" +#include -#include "tap.hpp" +#include #include #include diff --git a/test/maths/fast.cpp b/test/maths/fast.cpp index c8e224f8..50cfc134 100644 --- a/test/maths/fast.cpp +++ b/test/maths/fast.cpp @@ -1,5 +1,5 @@ -#include "maths/fast.hpp" -#include "tap.hpp" +#include +#include #include #include diff --git a/test/matrix.cpp b/test/matrix.cpp index 03a237ef..d851656f 100644 --- a/test/matrix.cpp +++ b/test/matrix.cpp @@ -1,9 +1,9 @@ -#include "matrix.hpp" +#include -#include "tap.hpp" -#include "vector.hpp" -#include "coord/iostream.hpp" -#include "quaternion.hpp" +#include +#include +#include +#include #include diff --git a/test/memory/deleter.cpp b/test/memory/deleter.cpp index 4a26e685..4cba8b33 100644 --- a/test/memory/deleter.cpp +++ b/test/memory/deleter.cpp @@ -1,5 +1,5 @@ -#include "memory/deleter.hpp" -#include "tap.hpp" +#include +#include #include diff --git a/test/meson.build b/test/meson.build new file mode 100644 index 00000000..22ff9203 --- /dev/null +++ b/test/meson.build @@ -0,0 +1,143 @@ +test_sources = [ + 'ascii.cpp', + 'algo/search.cpp', + 'algo/sort.cpp', + 'alloc/aligned/foreign.cpp', + 'alloc/aligned/direct.cpp', + 'alloc/easy.cpp', + 'alloc/linear.cpp', + 'alloc/stack.cpp', + 'affine.cpp', + 'array/darray.cpp', + 'array/sarray.cpp', + 'array/parray.cpp', + 'backtrace.cpp', + 'bezier.cpp', + 'bitwise.cpp', + 'bool.cpp', + 'buffer/simple.cpp', + 'cmdopt.cpp', + 'cmdopt2.cpp', + 'colour.cpp', + 'concepts.cpp', + 'comparator.cpp', + 'coord.cpp', + 'debug/fpe.cpp', + 'encode/number.cpp', + 'encode/base.cpp', + 'endian.cpp', + 'exe.cpp', + 'expected.cpp', + 'extent.cpp', + 'fixed.cpp', + 'float.cpp', + 'format/quoted.cpp', + 'fs/scoped.cpp', + 'fs/tmp.cpp', + 'geom/aabb.cpp', + 'geom/ellipse.cpp', + 'geom/frustum.cpp', + 'geom/line.cpp', + 'geom/plane.cpp', + 'geom/ray.cpp', + 'geom/sample/edge.cpp', + 'geom/sample/subregion.cpp', + 'geom/segment.cpp', + 'geom/sphere.cpp', + 'hash/buzhash.cpp', + 'hash/checksum.cpp', + 'hash/crc.cpp', + 'hash/fasthash.cpp', + 'hash/fnv1a.cpp', + 'hash/halfsipmix.cpp', + 'hash/murmur.cpp', + 'hash/siphash.cpp', + 'hash/table.cpp', + 'hash/tuple.cpp', + 'hash/xxhash.cpp', + 'hton.cpp', + 'io.cpp', + 'introspection.cpp', + 'introspection/enum_simple.cpp', + 'iterator.cpp', + 'job/dispatch.cpp', + 'job/queue.cpp', + 'kmeans.cpp', + 'list/sort.cpp', + 'map/fixed.cpp', + 'map/multi_fixed.cpp', + 'maths.cpp', + 'maths/fast.cpp', + 'matrix.cpp', + 'memory/deleter.cpp', + 'parallel/queue.cpp', + 'parallel/stack.cpp', + 'parse/enum.cpp', + 'parse/value.cpp', + 'parse/time.cpp', + 'parse/si.cpp', + 'paths.cpp', + 'point.cpp', + 'polynomial.cpp', + 'pool.cpp', + 'preprocessor.cpp', + 'quaternion.cpp', + 'rand/buckets.cpp', + 'rand/generator/normal.cpp', + 'random.cpp', + 'range.cpp', + 'rational.cpp', + 'region.cpp', + 'registrar.cpp', + 'roots/bisection.cpp', + 'scoped.cpp', + 'serialise.cpp', + 'set/dset.cpp', + 'signal.cpp', + 'singleton.cpp', + 'stream.cpp', + 'string.cpp', + 'stringid.cpp', + 'stringcache.cpp', + 'strongdef.cpp', + 'thread/event.cpp', + 'thread/flag.cpp', + 'thread/monitor.cpp', + 'thread/semaphore.cpp', + 'thread/spinlock.cpp', + 'thread/ticketlock.cpp', + 'time/8601.cpp', + 'traits.cpp', + 'tuple/index.cpp', + 'tuple/value.cpp', + 'tuple/type.cpp', + 'typeidx.cpp', + 'types/description.cpp', + 'types/tagged.cpp', + 'uri.cpp', + 'utf8.cpp', + 'vector.cpp', + 'version.cpp', + 'view.cpp', +] + +if host_machine.system() != 'windows' + test_sources += [ + 'buffer/circular.cpp', + 'buffer/paged.cpp', + ] +endif + +if get_option('simd') + test_sources += 'coord/simd.cpp' +endif + + +foreach t : test_sources + name = 'test_@0@'.format(t.underscorify()) + test( + name, + executable(name, t, dependencies: libcruft_dep), + protocol: 'tap', + ) +endforeach \ No newline at end of file diff --git a/test/parallel/queue.cpp b/test/parallel/queue.cpp index 20224953..a4ec0c5c 100644 --- a/test/parallel/queue.cpp +++ b/test/parallel/queue.cpp @@ -1,9 +1,9 @@ -#include "tap.hpp" +#include -#include "parallel/queue.hpp" -#include "thread/flag.hpp" -#include "thread/semaphore.hpp" -#include "view.hpp" +#include +#include +#include +#include #include diff --git a/test/parallel/stack.cpp b/test/parallel/stack.cpp index 47e03306..997d9705 100644 --- a/test/parallel/stack.cpp +++ b/test/parallel/stack.cpp @@ -1,7 +1,7 @@ -#include "thread/flag.hpp" -#include "parallel/stack.hpp" +#include +#include -#include "tap.hpp" +#include #include diff --git a/test/parse/enum.cpp b/test/parse/enum.cpp index b524d144..cabd9cfc 100644 --- a/test/parse/enum.cpp +++ b/test/parse/enum.cpp @@ -1,7 +1,7 @@ -#include "parse/enum.hpp" -#include "parse/value.hpp" -#include "std.hpp" -#include "tap.hpp" +#include +#include +#include +#include int main () { diff --git a/test/parse/si.cpp b/test/parse/si.cpp index efa52bda..b082f28e 100644 --- a/test/parse/si.cpp +++ b/test/parse/si.cpp @@ -1,5 +1,5 @@ -#include "tap.hpp" -#include "parse/si.hpp" +#include +#include int main () diff --git a/test/parse/time.cpp b/test/parse/time.cpp index bb40431c..c418d1e5 100644 --- a/test/parse/time.cpp +++ b/test/parse/time.cpp @@ -1,5 +1,5 @@ -#include "tap.hpp" -#include "parse/time.hpp" +#include +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/parse/value.cpp b/test/parse/value.cpp index 8c6b7362..5fafd86d 100644 --- a/test/parse/value.cpp +++ b/test/parse/value.cpp @@ -1,5 +1,5 @@ -#include "parse/value.hpp" -#include "tap.hpp" +#include +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/point.cpp b/test/point.cpp index 7256df56..830ad98f 100644 --- a/test/point.cpp +++ b/test/point.cpp @@ -1,8 +1,8 @@ -#include "point.hpp" +#include -#include "tap.hpp" -#include "types.hpp" -#include "coord/iostream.hpp" +#include +#include +#include using namespace cruft; diff --git a/test/polynomial.cpp b/test/polynomial.cpp index ccf740f0..6cd94f8d 100644 --- a/test/polynomial.cpp +++ b/test/polynomial.cpp @@ -1,8 +1,8 @@ -#include "polynomial.hpp" +#include -#include "float.hpp" -#include "tap.hpp" -#include "types.hpp" +#include +#include +#include #include #include diff --git a/test/pool.cpp b/test/pool.cpp index 3608546d..3f31ba15 100644 --- a/test/pool.cpp +++ b/test/pool.cpp @@ -1,7 +1,7 @@ -#include "../pool.hpp" +#include -#include "../tap.hpp" -#include "../random.hpp" +#include +#include #include #include diff --git a/test/preprocessor.cpp b/test/preprocessor.cpp index cf0b9e3f..3e637cdc 100644 --- a/test/preprocessor.cpp +++ b/test/preprocessor.cpp @@ -1,6 +1,6 @@ -#include "tap.hpp" +#include -#include "preprocessor.hpp" +#include #define PLUS(X,Y) ((X)+(Y)) diff --git a/test/quaternion.cpp b/test/quaternion.cpp index f4ba1e89..35bb23f6 100644 --- a/test/quaternion.cpp +++ b/test/quaternion.cpp @@ -1,9 +1,9 @@ -#include +#include -#include "tap.hpp" -#include "types.hpp" -#include "maths.hpp" -#include "coord/iostream.hpp" +#include +#include +#include +#include using cruft::quaternion; using cruft::quaternionf; diff --git a/test/rand/buckets.cpp b/test/rand/buckets.cpp index 3a4e244f..e2d375ba 100644 --- a/test/rand/buckets.cpp +++ b/test/rand/buckets.cpp @@ -1,16 +1,16 @@ -#include "rand/xorshift.hpp" -#include "rand/lcg.hpp" -#include "rand/mwc64x.hpp" -#include "rand/pcg.hpp" -#include "rand/rdrand.hpp" -#include "rand/system.hpp" -#include "rand/xoshiro.hpp" -#include "rand/splitmix64.hpp" +#include +#include +#include +#include +#include +#include +#include +#include -#include "tap.hpp" -#include "maths.hpp" -#include "types/string.hpp" -#include "introspection/name.hpp" +#include +#include +#include +#include /// ////////////////////////////////////////////////////////////////////////////// diff --git a/test/rand/generator/normal.cpp b/test/rand/generator/normal.cpp index aa38f5cf..e446f0c5 100644 --- a/test/rand/generator/normal.cpp +++ b/test/rand/generator/normal.cpp @@ -1,6 +1,6 @@ -#include "maths.hpp" -#include "rand/distribution/normal.hpp" -#include "tap.hpp" +#include +#include +#include #include #include diff --git a/test/random.cpp b/test/random.cpp index a8c17195..e2a90aa9 100644 --- a/test/random.cpp +++ b/test/random.cpp @@ -1,6 +1,6 @@ -#include "tap.hpp" +#include -#include "random.hpp" +#include #include diff --git a/test/range.cpp b/test/range.cpp index 6609663e..a6cf6c3a 100644 --- a/test/range.cpp +++ b/test/range.cpp @@ -1,6 +1,6 @@ -#include "range.hpp" +#include -#include "tap.hpp" +#include #include #include diff --git a/test/rational.cpp b/test/rational.cpp index 71a1dda3..b36b8994 100644 --- a/test/rational.cpp +++ b/test/rational.cpp @@ -1,5 +1,5 @@ -#include "rational.hpp" -#include "tap.hpp" +#include +#include using cruft::rational; diff --git a/test/region.cpp b/test/region.cpp index 3e12a176..cdaa8730 100644 --- a/test/region.cpp +++ b/test/region.cpp @@ -1,7 +1,7 @@ -#include "region.hpp" +#include -#include "point.hpp" -#include "tap.hpp" +#include +#include #include diff --git a/test/registrar.cpp b/test/registrar.cpp index c28f3993..5445ef7c 100644 --- a/test/registrar.cpp +++ b/test/registrar.cpp @@ -1,6 +1,6 @@ -#include "registrar.hpp" +#include -#include "tap.hpp" +#include void foo () { } diff --git a/test/roots/bisection.cpp b/test/roots/bisection.cpp index a81e1665..13e7eec2 100644 --- a/test/roots/bisection.cpp +++ b/test/roots/bisection.cpp @@ -1,8 +1,8 @@ -#include "roots/bisection.hpp" +#include -#include "tap.hpp" +#include -#include "maths.hpp" +#include using cruft::pow; diff --git a/test/scoped.cpp b/test/scoped.cpp index cefb3416..8b00a2ea 100644 --- a/test/scoped.cpp +++ b/test/scoped.cpp @@ -1,5 +1,5 @@ -#include "scoped.hpp" -#include "tap.hpp" +#include +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/set/dset.cpp b/test/set/dset.cpp index fe17d8e2..b5403d10 100644 --- a/test/set/dset.cpp +++ b/test/set/dset.cpp @@ -1,5 +1,5 @@ -#include "set/dset.hpp" -#include "tap.hpp" +#include +#include using cruft::set::dset; diff --git a/test/signal.cpp b/test/signal.cpp index 699f2df4..d2ec2bea 100644 --- a/test/signal.cpp +++ b/test/signal.cpp @@ -1,7 +1,7 @@ -#include "signal.hpp" +#include -#include "except.hpp" -#include "tap.hpp" +#include +#include //----------------------------------------------------------------------------- diff --git a/test/singleton.cpp b/test/singleton.cpp index d9075518..236cb820 100644 --- a/test/singleton.cpp +++ b/test/singleton.cpp @@ -1,6 +1,6 @@ -#include "singleton.hpp" +#include -#include "tap.hpp" +#include int main () diff --git a/test/stream.cpp b/test/stream.cpp index 0209abe6..e61c65e6 100644 --- a/test/stream.cpp +++ b/test/stream.cpp @@ -1,6 +1,6 @@ -#include "../tap.hpp" +#include -#include "../stream.hpp" +#include #include diff --git a/test/string.cpp b/test/string.cpp index 2d7e388f..cbabd1bd 100644 --- a/test/string.cpp +++ b/test/string.cpp @@ -1,7 +1,7 @@ -#include "tap.hpp" -#include "string.hpp" -#include "types.hpp" -#include "iterator/zip.hpp" +#include +#include +#include +#include #include diff --git a/test/stringid.cpp b/test/stringid.cpp index 4b2c2004..b4b3fb5f 100644 --- a/test/stringid.cpp +++ b/test/stringid.cpp @@ -1,6 +1,6 @@ -#include "stringid.hpp" +#include -#include "tap.hpp" +#include #include #include diff --git a/test/strongdef.cpp b/test/strongdef.cpp index 12265d37..bf92ae34 100644 --- a/test/strongdef.cpp +++ b/test/strongdef.cpp @@ -1,5 +1,5 @@ -#include "tap.hpp" -#include "strongdef.hpp" +#include +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/thread/event.cpp b/test/thread/event.cpp index 4253089d..bc37f473 100644 --- a/test/thread/event.cpp +++ b/test/thread/event.cpp @@ -1,6 +1,6 @@ -#include "thread/event.hpp" +#include -#include "tap.hpp" +#include #include #include diff --git a/test/thread/flag.cpp b/test/thread/flag.cpp index 47c87e97..1d36e8c2 100644 --- a/test/thread/flag.cpp +++ b/test/thread/flag.cpp @@ -1,6 +1,6 @@ -#include "thread/flag.hpp" +#include -#include "tap.hpp" +#include #include diff --git a/test/thread/monitor.cpp b/test/thread/monitor.cpp index 9408a954..83f2b3eb 100644 --- a/test/thread/monitor.cpp +++ b/test/thread/monitor.cpp @@ -6,11 +6,11 @@ * Copyright 2018 Danny Robson */ -#include "thread/event.hpp" -#include "thread/monitor.hpp" -#include "thread/semaphore.hpp" +#include +#include +#include -#include "tap.hpp" +#include #include #include diff --git a/test/thread/semaphore.cpp b/test/thread/semaphore.cpp index 65fddb87..ca684b93 100644 --- a/test/thread/semaphore.cpp +++ b/test/thread/semaphore.cpp @@ -1,7 +1,7 @@ -#include "thread/semaphore.hpp" -#include "thread/flag.hpp" +#include +#include -#include "tap.hpp" +#include #include #include diff --git a/test/thread/spinlock.cpp b/test/thread/spinlock.cpp index 8f54d6f5..5cc141a0 100644 --- a/test/thread/spinlock.cpp +++ b/test/thread/spinlock.cpp @@ -6,10 +6,10 @@ * Copyright 2018 Danny Robson */ -#include "thread/flag.hpp" -#include "thread/spinlock.hpp" +#include +#include -#include "tap.hpp" +#include #include #include diff --git a/test/thread/ticketlock.cpp b/test/thread/ticketlock.cpp index 2c1d6ac9..82d4dbd5 100644 --- a/test/thread/ticketlock.cpp +++ b/test/thread/ticketlock.cpp @@ -6,10 +6,10 @@ * Copyright 2018 Danny Robson */ -#include "thread/flag.hpp" -#include "thread/ticketlock.hpp" +#include +#include -#include "tap.hpp" +#include #include #include diff --git a/test/time/8601.cpp b/test/time/8601.cpp index aa707c56..7f531dbc 100644 --- a/test/time/8601.cpp +++ b/test/time/8601.cpp @@ -1,6 +1,6 @@ -#include "tap.hpp" +#include -#include "time/parse.hpp" +#include int diff --git a/test/traits.cpp b/test/traits.cpp index 4730594e..63d145c0 100644 --- a/test/traits.cpp +++ b/test/traits.cpp @@ -1,5 +1,5 @@ -#include "tap.hpp" -#include "types/traits.hpp" +#include +#include #include diff --git a/test/tuple/index.cpp b/test/tuple/index.cpp index fba932b3..1db01543 100644 --- a/test/tuple/index.cpp +++ b/test/tuple/index.cpp @@ -1,5 +1,5 @@ -#include "tap.hpp" -#include "tuple/index.hpp" +#include +#include int diff --git a/test/tuple/type.cpp b/test/tuple/type.cpp index b69aa841..0974c57a 100644 --- a/test/tuple/type.cpp +++ b/test/tuple/type.cpp @@ -1,6 +1,6 @@ -#include "tap.hpp" +#include -#include "tuple/type.hpp" +#include #include diff --git a/test/tuple/value.cpp b/test/tuple/value.cpp index 83bdc9c6..650391d0 100644 --- a/test/tuple/value.cpp +++ b/test/tuple/value.cpp @@ -1,6 +1,6 @@ -#include "tap.hpp" +#include -#include "tuple/value.hpp" +#include int diff --git a/test/typeidx.cpp b/test/typeidx.cpp index 4a77162c..2bec9911 100644 --- a/test/typeidx.cpp +++ b/test/typeidx.cpp @@ -1,6 +1,6 @@ -#include "../tap.hpp" +#include -#include "../typeidx.hpp" +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/types/description.cpp b/test/types/description.cpp index a0224783..23e2ff51 100644 --- a/test/types/description.cpp +++ b/test/types/description.cpp @@ -1,8 +1,8 @@ -#include "tap.hpp" -#include "types/description.hpp" -#include "types/dispatch.hpp" -#include "types.hpp" -#include "vector.hpp" +#include +#include +#include +#include +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/types/tagged.cpp b/test/types/tagged.cpp index d6af240a..7dab8173 100644 --- a/test/types/tagged.cpp +++ b/test/types/tagged.cpp @@ -1,6 +1,6 @@ -#include "tap.hpp" +#include -#include "types/tagged.hpp" +#include enum tag_t { A, B, C }; diff --git a/test/uri.cpp b/test/uri.cpp index f8d8aaa1..9a91ba75 100644 --- a/test/uri.cpp +++ b/test/uri.cpp @@ -1,6 +1,6 @@ -#include "uri.hpp" +#include -#include "tap.hpp" +#include #include #include diff --git a/test/utf8.cpp b/test/utf8.cpp index 6d51cc1f..46dbb32f 100644 --- a/test/utf8.cpp +++ b/test/utf8.cpp @@ -1,5 +1,5 @@ -#include "tap.hpp" -#include "utf8.hpp" +#include +#include #include #include diff --git a/test/vector.cpp b/test/vector.cpp index 53e0c4ca..1caca536 100644 --- a/test/vector.cpp +++ b/test/vector.cpp @@ -1,10 +1,10 @@ -#include "vector.hpp" +#include -#include "maths.hpp" -#include "tap.hpp" +#include +#include -#include "float.hpp" -#include "coord/iostream.hpp" +#include +#include using cruft::vector; using cruft::vector2f; diff --git a/test/version.cpp b/test/version.cpp index ec0809a5..7b3e903b 100644 --- a/test/version.cpp +++ b/test/version.cpp @@ -1,6 +1,6 @@ -#include "version.hpp" +#include -#include "tap.hpp" +#include /////////////////////////////////////////////////////////////////////////////// diff --git a/test/view.cpp b/test/view.cpp index e1f3b86d..4568df36 100644 --- a/test/view.cpp +++ b/test/view.cpp @@ -1,5 +1,5 @@ -#include "tap.hpp" -#include "view.hpp" +#include +#include #include diff --git a/thread/event.hpp b/thread/event.hpp deleted file mode 100644 index 2982aa85..00000000 --- a/thread/event.hpp +++ /dev/null @@ -1,7 +0,0 @@ -#include "platform.hpp" - -#if defined(PLATFORM_LINUX) -#include "event_futex.hpp" -#else -#include "event_std.hpp" -#endif \ No newline at end of file diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt new file mode 100644 index 00000000..aaa07c76 --- /dev/null +++ b/tools/CMakeLists.txt @@ -0,0 +1,14 @@ +############################################################################### +set(TOOL_BINARIES backtrace crash log poisson macro scratch) + +if (NOT WIN32) + list(APPEND TOOL_BINARIES cpuid) +endif() + +foreach (tool ${TOOL_BINARIES}) + add_executable (util_${tool} ${tool}.cpp) + set_target_properties (util_${tool} PROPERTIES OUTPUT_NAME ${tool}) + target_link_libraries (util_${tool} cruft::util) + #target_include_directories(util_${tool} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) + target_include_directories(util_${tool} PRIVATE "${PREFIX_BASE}") +endforeach () diff --git a/tools/backtrace.cpp b/tools/backtrace.cpp index db0e14b8..14f0eb8e 100644 --- a/tools/backtrace.cpp +++ b/tools/backtrace.cpp @@ -6,7 +6,7 @@ * Copyright 2019, Danny Robson */ -#include "../backtrace.hpp" +#include #include diff --git a/tools/cpuid.cpp b/tools/cpuid.cpp index fb382ced..45ad3f83 100644 --- a/tools/cpuid.cpp +++ b/tools/cpuid.cpp @@ -6,7 +6,7 @@ * Copyright 2018 Danny Robson */ -#include "cpuid.hpp" +#include //#include #include diff --git a/tools/crash.cpp b/tools/crash.cpp index eb57a66f..2f6ba28b 100644 --- a/tools/crash.cpp +++ b/tools/crash.cpp @@ -1,4 +1,4 @@ -#include "../debug/system.hpp" +#include int main () { diff --git a/tools/log.cpp b/tools/log.cpp index 2bdae952..964db85d 100644 --- a/tools/log.cpp +++ b/tools/log.cpp @@ -6,7 +6,7 @@ * Copyright 2019, Danny Robson */ -#include "../log.hpp" +#include #include #include diff --git a/tools/macro.cpp b/tools/macro.cpp index 47399a6d..f1835a7b 100644 --- a/tools/macro.cpp +++ b/tools/macro.cpp @@ -1,7 +1,7 @@ -#include "io.hpp" -#include "string.hpp" -#include "view.hpp" -#include "cpp.hpp" +#include +#include +#include +#include #include #include diff --git a/tools/meson.build b/tools/meson.build new file mode 100644 index 00000000..3c8f3a30 --- /dev/null +++ b/tools/meson.build @@ -0,0 +1,20 @@ +sources = [ + 'backtrace', + 'cpuid', + 'crash', + #'json-clean', + #'json-compare', + #'json-pointer', + #'json-schema', + #'json-validate', + 'log', + 'macro', + 'poisson', + 'scratch', +] + +foreach t : sources + executable( + t, f'@t@.cpp', dependencies: [libcruft_dep] + ) +endforeach \ No newline at end of file diff --git a/tools/poisson.cpp b/tools/poisson.cpp index d4c758fa..da91f1f6 100644 --- a/tools/poisson.cpp +++ b/tools/poisson.cpp @@ -1,8 +1,8 @@ -#include "cmdopt.hpp" -#include "functor.hpp" -#include "geom/aabb.hpp" -#include "geom/sample/surface.hpp" -#include "rand/generic.hpp" +#include +#include +#include +#include +#include #include #include