Skip to content

Commit 3b20b37

Browse files
committed
Fixes for C-level build of libdispatch on Linux
Still needed pieces of PR#257 related to C-level build/test. 1. rule to generate provider.h from provider.d using dtrace 2. default to building shared libraries (needed for Swift) 3. increase test timeout to 600 seconds (for noisy Swift CI)
1 parent 1d25040 commit 3b20b37

File tree

3 files changed

+15
-1
lines changed

3 files changed

+15
-1
lines changed

CMakeLists.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ include(DispatchAppleOptions)
2929
option(ENABLE_DISPATCH_INIT_CONSTRUCTOR "enable libdispatch_init as a constructor" ON)
3030
set(USE_LIBDISPATCH_INIT_CONSTRUCTOR ${ENABLE_DISPATCH_INIT_CONSTRUCTOR})
3131

32+
option(BUILD_SHARED_LIBS "build shared libraries" ON)
33+
3234
# TODO(compnerd) swift options
3335

3436
if(CMAKE_SYSTEM_NAME STREQUAL Linux OR

src/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,18 @@
11

22
include(SwiftSupport)
33

4+
set(dispatch_DTRACE_HEADERS)
5+
if(dtrace_EXECUTABLE)
6+
list(APPEND dispatch_DTRACE_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/provider.h)
7+
add_custom_command(
8+
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/provider.h
9+
COMMAND ${dtrace_EXECUTABLE} -h -s ${CMAKE_CURRENT_SOURCE_DIR}/provider.d -o ${header} ${CMAKE_CURRENT_BINARY_DIR}/provider.h
10+
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/provider.d
11+
)
12+
endif()
13+
414
add_library(dispatch
15+
${dispatch_DTRACE_HEADERS}
516
allocator.c
617
apply.c
718
benchmark.c
@@ -106,6 +117,7 @@ endif()
106117
target_include_directories(dispatch
107118
PRIVATE
108119
${CMAKE_BINARY_DIR}
120+
${CMAKE_CURRENT_BINARY_DIR}
109121
${CMAKE_SOURCE_DIR}
110122
${CMAKE_CURRENT_SOURCE_DIR}
111123
${CMAKE_SOURCE_DIR}/private)

tests/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ function(add_unit_test name)
9090
COMMAND bsdtestharness $<TARGET_FILE:${name}>)
9191
set_tests_properties(${name}
9292
PROPERTIES
93-
TIMEOUT 30
93+
TIMEOUT 600
9494
DEPENDS bsdtestharness
9595
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
9696
if(NOT leaks_EXECUTABLE)

0 commit comments

Comments
 (0)