2020-05-20 06:20:18 +08:00
|
|
|
add_library(skia INTERFACE)
|
|
|
|
add_library(skia::skia ALIAS skia)
|
2022-04-26 06:39:10 +08:00
|
|
|
set(SKIA_DEP_DBG @SKIA_DEP_DBG@)
|
|
|
|
set(SKIA_DEP_REL @SKIA_DEP_REL@)
|
|
|
|
set(SKIA_DEFINITIONS_DBG @SKIA_DEFINITIONS_DBG@)
|
|
|
|
set(SKIA_DEFINITIONS_REL @SKIA_DEFINITIONS_REL@)
|
2020-03-05 05:06:24 +08:00
|
|
|
|
|
|
|
# Compute the installation prefix relative to this file.
|
|
|
|
get_filename_component(_IMPORT_PREFIX "${CMAKE_CURRENT_LIST_FILE}" PATH)
|
|
|
|
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
|
|
|
get_filename_component(_IMPORT_PREFIX "${_IMPORT_PREFIX}" PATH)
|
|
|
|
if(_IMPORT_PREFIX STREQUAL "/")
|
|
|
|
set(_IMPORT_PREFIX "")
|
|
|
|
endif()
|
|
|
|
|
2022-06-18 04:57:34 +08:00
|
|
|
find_library(SKIA_LIB_DBG NAMES skia skia.dll PATHS ${_IMPORT_PREFIX}/debug/lib NO_DEFAULT_PATH)
|
|
|
|
find_library(SKIA_LIB_REL NAMES skia skia.dll PATHS ${_IMPORT_PREFIX}/lib NO_DEFAULT_PATH)
|
|
|
|
target_link_libraries(skia INTERFACE "$<$<CONFIG:Debug>:${SKIA_LIB_DBG}>")
|
|
|
|
target_link_libraries(skia INTERFACE "$<$<CONFIG:Release>:${SKIA_LIB_REL}>")
|
2020-03-05 05:06:24 +08:00
|
|
|
|
2020-05-20 06:20:18 +08:00
|
|
|
function(set_dependencies CONFIG LIBRARIES)
|
|
|
|
foreach(LIB ${LIBRARIES})
|
|
|
|
if(LIB MATCHES "^/")
|
|
|
|
if(WIN32)
|
|
|
|
string(SUBSTRING "${LIB}" 1 -1 LIB)
|
|
|
|
endif()
|
|
|
|
target_link_libraries(skia INTERFACE
|
|
|
|
"$<$<CONFIG:${CONFIG}>:${LIB}>")
|
|
|
|
else()
|
|
|
|
string(REGEX REPLACE "\\.framework" "" LIB ${LIB})
|
|
|
|
string(REGEX REPLACE "[^a-zA-Z]" "_" LIB_NAME ${LIB})
|
|
|
|
string(TOUPPER ${LIB_NAME} LIB_NAME)
|
|
|
|
set(LIB_NAME SKIA_${LIB_NAME}_LIBRARY)
|
|
|
|
find_library(${LIB_NAME} ${LIB})
|
|
|
|
target_link_libraries(skia INTERFACE
|
|
|
|
"$<$<CONFIG:${CONFIG}>:${${LIB_NAME}}>")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
set_dependencies(Debug "${SKIA_DEP_DBG}")
|
|
|
|
set_dependencies(Release "${SKIA_DEP_REL}")
|
|
|
|
|
|
|
|
target_compile_definitions(skia INTERFACE
|
|
|
|
$<$<CONFIG:Debug>:${SKIA_DEFINITIONS_DBG}>
|
|
|
|
$<$<CONFIG:Release>:${SKIA_DEFINITIONS_REL}>)
|
2020-03-05 05:06:24 +08:00
|
|
|
|
2020-05-20 06:20:18 +08:00
|
|
|
target_include_directories(skia INTERFACE ${_IMPORT_PREFIX}/include)
|