From 3b20b37e955297474a65b58726593a9b8f36e7ef Mon Sep 17 00:00:00 2001 From: David Grove Date: Wed, 28 Jun 2017 12:32:14 -0400 Subject: [PATCH] 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) --- CMakeLists.txt | 2 ++ src/CMakeLists.txt | 12 ++++++++++++ tests/CMakeLists.txt | 2 +- 3 files changed, 15 insertions(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1593569bd..3bd2cdbbb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -29,6 +29,8 @@ include(DispatchAppleOptions) option(ENABLE_DISPATCH_INIT_CONSTRUCTOR "enable libdispatch_init as a constructor" ON) set(USE_LIBDISPATCH_INIT_CONSTRUCTOR ${ENABLE_DISPATCH_INIT_CONSTRUCTOR}) +option(BUILD_SHARED_LIBS "build shared libraries" ON) + # TODO(compnerd) swift options if(CMAKE_SYSTEM_NAME STREQUAL Linux OR diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index bbc7f461a..a63a87850 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,7 +1,18 @@ include(SwiftSupport) +set(dispatch_DTRACE_HEADERS) +if(dtrace_EXECUTABLE) + list(APPEND dispatch_DTRACE_HEADERS ${CMAKE_CURRENT_BINARY_DIR}/provider.h) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/provider.h + COMMAND ${dtrace_EXECUTABLE} -h -s ${CMAKE_CURRENT_SOURCE_DIR}/provider.d -o ${header} ${CMAKE_CURRENT_BINARY_DIR}/provider.h + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/provider.d + ) +endif() + add_library(dispatch + ${dispatch_DTRACE_HEADERS} allocator.c apply.c benchmark.c @@ -106,6 +117,7 @@ endif() target_include_directories(dispatch PRIVATE ${CMAKE_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/private) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 3d5b1c1e6..e86b186c5 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -90,7 +90,7 @@ function(add_unit_test name) COMMAND bsdtestharness $) set_tests_properties(${name} PROPERTIES - TIMEOUT 30 + TIMEOUT 600 DEPENDS bsdtestharness WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) if(NOT leaks_EXECUTABLE)