Skip to content

build: make the static build work well #433

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

Merged
merged 1 commit into from
Nov 27, 2018
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
7 changes: 4 additions & 3 deletions cmake/modules/SwiftSupport.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ function(add_swift_target target)
if(AST_SHARED OR BUILD_SHARED_LIBS)
set(AST_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}.dir/${CMAKE_SHARED_LIBRARY_PREFIX}${target}${CMAKE_SHARED_LIBRARY_SUFFIX})
else()
# NOTE(compnerd) this is a hack for the computation of the
# basename/dirname below for the static path.
set(AST_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}.dir/${target})
set(AST_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}.dir/${CMAKE_STATIC_LIBRARY_PREFIX}${target}${CMAKE_STATIC_LIBRARY_SUFFIX})
endif()
else()
set(AST_OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${target}.dir/${target}${CMAKE_EXECUTABLE_SUFFIX})
Expand Down Expand Up @@ -155,10 +153,13 @@ function(add_swift_target target)
add_library(${target}-static STATIC ${objs})
add_dependencies(${target}-static ${AST_DEPENDS})
get_filename_component(ast_output_bn ${AST_OUTPUT} NAME)
string(REGEX REPLACE "^${CMAKE_STATIC_LIBRARY_PREFIX}" "" ast_output_bn ${ast_output_bn})
string(REGEX REPLACE "${CMAKE_STATIC_LIBRARY_SUFFIX}$" "" ast_output_bn ${ast_output_bn})
get_filename_component(ast_output_dn ${AST_OUTPUT} DIRECTORY)
set_target_properties(${target}-static
PROPERTIES
LINKER_LANGUAGE C
ARCHIVE_OUTPUT_DIRECTORY ${ast_output_dn}
OUTPUT_DIRECTORY ${ast_output_dn}
OUTPUT_NAME ${ast_output_bn})
add_custom_target(${target}
Expand Down
2 changes: 1 addition & 1 deletion src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ if(ENABLE_SWIFT)
-fblocks
-fmodule-map-file=${PROJECT_SOURCE_DIR}/dispatch/module.modulemap
DEPENDS
${PROJECT_SOURCE_DIR}/dispatch/module.modulemap
module-maps
DispatchStubs
LINK_FLAGS
${use_ld_flag}
Expand Down