This repository has been archived by the owner on Feb 25, 2023. It is now read-only.
forked from twitter/pelikan
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
2168fec minimize osx build config (twitter#185) 42b24de Simplify rust options, specify fewer output targets (twitter#183) c9fa905 update CMakeRust used to latest version, tweaks to make build work (twitter#184) git-subtree-dir: deps/ccommon git-subtree-split: 2168fec
- Loading branch information
Yao Yue
committed
Dec 13, 2018
1 parent
e4d6eef
commit bdbd760
Showing
14 changed files
with
130 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
|
||
function(cargo_print) | ||
execute_process(COMMAND ${CMAKE_COMMAND} -E echo "${ARGN}") | ||
endfunction() | ||
|
||
function(cargo_link) | ||
cmake_parse_arguments(CARGO_LINK "" "NAME" "TARGETS;EXCLUDE" ${ARGN}) | ||
|
||
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/cargo-link.c" "void cargo_link() {}") | ||
add_library(${CARGO_LINK_NAME} "${CMAKE_CURRENT_BINARY_DIR}/cargo-link.c") | ||
target_link_libraries(${CARGO_LINK_NAME} ${CARGO_LINK_TARGETS}) | ||
|
||
get_target_property(LINK_LIBRARIES ${CARGO_LINK_NAME} LINK_LIBRARIES) | ||
|
||
foreach(LINK_LIBRARY ${LINK_LIBRARIES}) | ||
get_target_property(_INTERFACE_LINK_LIBRARIES ${LINK_LIBRARY} INTERFACE_LINK_LIBRARIES) | ||
list(APPEND LINK_LIBRARIES ${_INTERFACE_LINK_LIBRARIES}) | ||
endforeach() | ||
list(REMOVE_DUPLICATES LINK_LIBRARIES) | ||
|
||
if(CARGO_LINK_EXCLUDE) | ||
list(REMOVE_ITEM LINK_LIBRARIES ${CARGO_LINK_EXCLUDE}) | ||
endif() | ||
|
||
set(LINK_DIRECTORIES "") | ||
foreach(LINK_LIBRARY ${LINK_LIBRARIES}) | ||
if(TARGET ${LINK_LIBRARY}) | ||
get_target_property(_IMPORTED_CONFIGURATIONS ${LINK_LIBRARY} IMPORTED_CONFIGURATIONS) | ||
list(FIND _IMPORTED_CONFIGURATIONS "RELEASE" _IMPORTED_CONFIGURATION_INDEX) | ||
if (NOT (${_IMPORTED_CONFIGURATION_INDEX} GREATER -1)) | ||
set(_IMPORTED_CONFIGURATION_INDEX 0) | ||
endif() | ||
list(GET _IMPORTED_CONFIGURATIONS ${_IMPORTED_CONFIGURATION_INDEX} _IMPORTED_CONFIGURATION) | ||
get_target_property(_IMPORTED_LOCATION ${LINK_LIBRARY} "IMPORTED_LOCATION_${_IMPORTED_CONFIGURATION}") | ||
get_filename_component(_IMPORTED_DIR ${_IMPORTED_LOCATION} DIRECTORY) | ||
get_filename_component(_IMPORTED_NAME ${_IMPORTED_LOCATION} NAME_WE) | ||
if(NOT WIN32) | ||
string(REGEX REPLACE "^lib" "" _IMPORTED_NAME ${_IMPORTED_NAME}) | ||
endif() | ||
list(APPEND LINK_DIRECTORIES ${_IMPORTED_DIR}) | ||
cargo_print("cargo:rustc-link-lib=static=${_IMPORTED_NAME}") | ||
else() | ||
if("${LINK_LIBRARY}" MATCHES "^.*/(.+)\\.framework$") | ||
set(FRAMEWORK_NAME ${CMAKE_MATCH_1}) | ||
cargo_print("cargo:rustc-link-lib=framework=${FRAMEWORK_NAME}") | ||
elseif("${LINK_LIBRARY}" MATCHES "^(.*)/(.+)\\.so$") | ||
set(LIBRARY_DIR ${CMAKE_MATCH_1}) | ||
set(LIBRARY_NAME ${CMAKE_MATCH_2}) | ||
if(NOT WIN32) | ||
string(REGEX REPLACE "^lib" "" LIBRARY_NAME ${LIBRARY_NAME}) | ||
endif() | ||
list(APPEND LINK_DIRECTORIES ${LIBRARY_DIR}) | ||
cargo_print("cargo:rustc-link-lib=${LIBRARY_NAME}") | ||
else() | ||
cargo_print("cargo:rustc-link-lib=${LINK_LIBRARY}") | ||
endif() | ||
endif() | ||
endforeach() | ||
list(REMOVE_DUPLICATES LINK_DIRECTORIES) | ||
|
||
foreach(LINK_DIRECTORY ${LINK_DIRECTORIES}) | ||
cargo_print("cargo:rustc-link-search=native=${LINK_DIRECTORY}") | ||
endforeach() | ||
endfunction() |
Oops, something went wrong.