Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,10 @@ check_include_files("unistd.h" HAVE_UNISTD_H)
check_include_files("objc/objc-internal.h" HAVE_OBJC)

check_library_exists(pthread sem_init "" USE_POSIX_SEM)
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
add_definitions(-DTARGET_OS_WIN32)
add_definitions(-DUSE_WIN32_SEM)
endif()

check_symbol_exists(CLOCK_UPTIME "time.h" HAVE_DECL_CLOCK_UPTIME)
check_symbol_exists(CLOCK_UPTIME_FAST "time.h" HAVE_DECL_CLOCK_UPTIME_FAST)
Expand Down
4 changes: 4 additions & 0 deletions dispatch/dispatch.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,17 @@
#endif
#endif // __APPLE__

#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
#include <sys/types.h>
#include <stddef.h>
#include <stdint.h>
#include <stdbool.h>
#include <stdarg.h>
#if HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <fcntl.h>

#if defined(__linux__) && defined(__has_feature)
Expand Down
6 changes: 3 additions & 3 deletions os/object.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,10 +26,10 @@
#include <TargetConditionals.h>
#include <os/availability.h>
#endif
#ifndef __linux__
#include <os/base.h>
#else
#ifdef __linux__
#include <os/linux_base.h>
#else
#include <os/base.h>
#endif

/*!
Expand Down
2 changes: 2 additions & 0 deletions os/object_private.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,9 @@
#ifndef __OS_OBJECT_PRIVATE__
#define __OS_OBJECT_PRIVATE__

#if HAVE_SYS_CDEFS_H
#include <sys/cdefs.h>
#endif
#include <stddef.h>
#include <os/object.h>

Expand Down
39 changes: 31 additions & 8 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,24 +72,47 @@ if(WITH_BLOCKS_RUNTIME)
SYSTEM BEFORE PRIVATE
"${WITH_BLOCKS_RUNTIME}")
endif()
# TODO(compnerd) make this portable
target_compile_options(dispatch PRIVATE -fno-exceptions)
if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")
target_compile_options(dispatch PRIVATE /EHsc-)
else()
target_compile_options(dispatch PRIVATE -fno-exceptions)
endif()
if(DISPATCH_ENABLE_ASSERTS)
target_compile_definitions(dispatch
PRIVATE
-DDISPATCH_DEBUG=1)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
target_compile_definitions(dispatch
PRIVATE
-D_CRT_SECURE_NO_WARNINGS)
endif()
if(BSD_OVERLAY_FOUND)
target_compile_options(dispatch
PRIVATE
${BSD_OVERLAY_CFLAGS})
endif()
# FIXME(compnerd) add check for -momit-leaf-frame-pointer?
target_compile_options(dispatch
PRIVATE
-Wall
-fblocks
-momit-leaf-frame-pointer)
if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")
target_compile_options(dispatch
PRIVATE
/W3)
else()
target_compile_options(dispatch
PRIVATE
-Wall)
endif()
# FIXME(compnerd) add check for -fblocks?
if("${CMAKE_C_SIMULATE_ID}" STREQUAL "MSVC")
target_compile_options(dispatch
PRIVATE
-Xclang -fblocks)
else()
# FIXME(compnerd) add check for -momit-leaf-frame-pointer?
target_compile_options(dispatch
PRIVATE
-fblocks
-momit-leaf-frame-pointer)
endif()
if(BSD_OVERLAY_FOUND)
target_link_libraries(dispatch PRIVATE ${BSD_OVERLAY_LDFLAGS})
endif()
Expand Down