Skip to content

Commit c52dcf9

Browse files
committed
Fix Windows CI: timespec double-guard + exclude server on MSVC
1 parent 9e646c3 commit c52dcf9

3 files changed

Lines changed: 8 additions & 6 deletions

File tree

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -280,8 +280,8 @@ foreach(ex_src ${EXAMPLE_C_SOURCES} ${EXAMPLE_CXX_SOURCES})
280280
target_link_libraries(${ex_name} turboquant)
281281
endforeach()
282282

283-
# OpenAI-compatible HTTP server
284-
if(TQ_BUILD_SERVER)
283+
# OpenAI-compatible HTTP server (POSIX only — uses sys/socket.h)
284+
if(TQ_BUILD_SERVER AND NOT MSVC)
285285
add_executable(quant-server src/server/tq_server.c)
286286
target_include_directories(quant-server PRIVATE
287287
${CMAKE_SOURCE_DIR}/src/server

quant.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,9 @@ typedef volatile long atomic_int;
144144
#ifndef CLOCK_MONOTONIC
145145
#define CLOCK_MONOTONIC 1
146146
#endif
147-
#ifndef _TIMESPEC_DEFINED
148-
#define _TIMESPEC_DEFINED
147+
#if !defined(_TIMESPEC_DEFINED) && !defined(__struct_timespec_defined)
148+
#define _TIMESPEC_DEFINED 1
149+
#define __struct_timespec_defined 1
149150
struct timespec { long tv_sec; long tv_nsec; };
150151
#endif
151152
static inline int clock_gettime(int id, struct timespec* ts) {

tools/quant.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,9 @@
4343
#ifndef CLOCK_MONOTONIC
4444
#define CLOCK_MONOTONIC 1
4545
#endif
46-
#if defined(_WIN32) && !defined(_TIMESPEC_DEFINED)
47-
#define _TIMESPEC_DEFINED
46+
#if defined(_WIN32) && !defined(_TIMESPEC_DEFINED) && !defined(__struct_timespec_defined)
47+
#define _TIMESPEC_DEFINED 1
48+
#define __struct_timespec_defined 1
4849
struct timespec { long tv_sec; long tv_nsec; };
4950
#endif
5051
static int clock_gettime(int id, struct timespec* ts) {

0 commit comments

Comments
 (0)