From 71e2e4b6957e5e2184b87657460053efd345e534 Mon Sep 17 00:00:00 2001 From: David Gonzalez Martin Date: Fri, 20 Sep 2024 09:36:44 -0600 Subject: [PATCH] Some Windows integration --- bootstrap/lib.h | 20 +++++++++++++++++++- project.bat | 1 + 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 project.bat diff --git a/bootstrap/lib.h b/bootstrap/lib.h index 3dd4982..927405c 100644 --- a/bootstrap/lib.h +++ b/bootstrap/lib.h @@ -1,16 +1,21 @@ #include #include #include -#include #if defined(__x86_64__) #include #endif +#ifdef _WIN32 +#define WIN32_LEAN_AND_MEAN 1 +#include +#else #include #include #include #include #include +#include +#endif #ifdef NDEBUG #define _DEBUG 0 @@ -98,13 +103,22 @@ FOR_N(_i, 0, ((set)->arr.capacity + 63) / 64) FOR_BIT(it, _i*64, (set)->arr.poin } while (0) fn +#if _WIN32 +u64 +#else #if LINK_LIBC struct timespec #else u64 #endif +#endif timestamp() { +#ifdef _WIN32 + LARGE_INTEGER li; + QueryPerformanceCounter(&li); + return (u64)li.QuadPart; +#else #if LINK_LIBC struct timespec ts; clock_gettime(CLOCK_MONOTONIC, &ts); @@ -116,6 +130,7 @@ timestamp() return 0; #endif #endif +#endif } #if LINK_LIBC @@ -441,6 +456,9 @@ may_be_unused fn s32 cast_s64_to_s32(s64 source, const char* name, int line) #define unreachable() __builtin_unreachable() #endif +#ifdef static_assert +#undef static_assert +#endif #define static_assert(x) _Static_assert((x), "Static assert failed!") #define alignof(x) _Alignof(x) #define auto __auto_type diff --git a/project.bat b/project.bat new file mode 100644 index 0000000..59c2198 --- /dev/null +++ b/project.bat @@ -0,0 +1 @@ +clang -o build/build bootstrap/build.c -g -march=native -std=gnu2x -Wall -Wextra -Wpedantic -Wno-nested-anon-types -Wno-keyword-macro -Wno-gnu-auto-type -Wno-auto-decl-extensions -Wno-gnu-empty-initializer -Wno-fixed-enum-extension -pedantic -fno-exceptions -fno-stack-protector