forked from etc/pineapple-src
46 lines
1.7 KiB
CMake
Executable file
46 lines
1.7 KiB
CMake
Executable file
add_library(skia INTERFACE)
|
|
add_library(skia::skia ALIAS skia)
|
|
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@)
|
|
|
|
# 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()
|
|
|
|
find_library(SKIA_LIB NAMES skia skia.dll)
|
|
target_link_libraries(skia INTERFACE "${SKIA_LIB}")
|
|
|
|
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}>)
|
|
|
|
target_include_directories(skia INTERFACE ${_IMPORT_PREFIX}/include)
|