Skip to content

Fixes for C-level build of libdispatch on Linux #263

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
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
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to default to the shared libraries first? We can, I went with the defaults of auto tools, which was static by default.

Copy link
Contributor Author

@dgrove-oss dgrove-oss Jun 28, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we need the shared libraries when building to include in Swift. For me at least, autotools/libtool was defaulting to shared libs before. libtool called the linker script libdispatch.a, but what it really was building was .libs/libdisaptch.so


# TODO(compnerd) swift options

if(CMAKE_SYSTEM_NAME STREQUAL Linux OR
Expand Down
12 changes: 12 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use target_sources instead please.

allocator.c
apply.c
benchmark.c
Expand Down Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ function(add_unit_test name)
COMMAND bsdtestharness $<TARGET_FILE:${name}>)
set_tests_properties(${name}
PROPERTIES
TIMEOUT 30
TIMEOUT 600
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ill leave this to @das to figure out. The old timeout used to be 30s.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

right. 30 is not long enough. Swift CI machines get very loaded. I'm seeing dispatch_select routinely take 40 or 50 seconds.

DEPENDS bsdtestharness
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
if(NOT leaks_EXECUTABLE)
Expand Down