2015-08-28 18:51:06 +00:00
|
|
|
# Boilerplate.
|
2015-09-01 16:22:31 +00:00
|
|
|
cmake_minimum_required (VERSION 3.1) # First version with CMAKE_CXX_STANDARD.
|
2015-08-28 18:51:06 +00:00
|
|
|
project (skimake)
|
|
|
|
set (CMAKE_CXX_STANDARD 11)
|
|
|
|
|
|
|
|
# Default to Release mode. We're mainly targeting Skia users, not Skia developers.
|
|
|
|
if (NOT CMAKE_BUILD_TYPE)
|
|
|
|
set (CMAKE_BUILD_TYPE Release)
|
|
|
|
endif ()
|
|
|
|
|
|
|
|
# To first approximation, the Skia library comprises all .cpp files under src/.
|
|
|
|
file (GLOB_RECURSE srcs ../src/*.cpp)
|
|
|
|
|
|
|
|
function (find_include_dirs out)
|
2015-08-31 13:59:21 +00:00
|
|
|
file (GLOB_RECURSE headers ${ARGN})
|
2015-08-28 18:51:06 +00:00
|
|
|
foreach (path ${headers})
|
|
|
|
get_filename_component (dir ${path} PATH)
|
|
|
|
list (APPEND include_dirs ${dir})
|
|
|
|
endforeach()
|
|
|
|
list (REMOVE_DUPLICATES include_dirs)
|
|
|
|
set (${out} ${include_dirs} PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
# We need src/ directories and include/private on our path when building Skia.
|
|
|
|
# Users should be able to use Skia with only include/ directories that are not include/private.
|
|
|
|
find_include_dirs(private_includes ../src/*.h ../include/private/*.h)
|
|
|
|
find_include_dirs(public_includes ../include/*.h)
|
|
|
|
list (REMOVE_ITEM public_includes ${private_includes}) # Easiest way to exclude private.
|
2015-11-30 18:29:25 +00:00
|
|
|
file (GLOB default_include_config "../include/config")
|
|
|
|
list (REMOVE_ITEM public_includes ${default_include_config})
|
2015-11-30 20:42:58 +00:00
|
|
|
set (userconfig_directory ${CMAKE_BINARY_DIR}/include)
|
2015-11-30 18:29:25 +00:00
|
|
|
list (APPEND public_includes ${userconfig_directory})
|
2015-08-28 18:51:06 +00:00
|
|
|
|
|
|
|
# These guys are third_party but provided by a Skia checkout.
|
|
|
|
list (APPEND srcs ../third_party/etc1/etc1.cpp ../third_party/ktx/ktx.cpp)
|
|
|
|
list (APPEND private_includes ../third_party/etc1 ../third_party/ktx)
|
|
|
|
|
2016-06-02 19:59:59 +00:00
|
|
|
list (APPEND private_includes ../third_party/libpng)
|
|
|
|
file (GLOB libpng_srcs ../third_party/libpng/*.c)
|
|
|
|
foreach (src ${libpng_srcs})
|
|
|
|
list (APPEND srcs ${src})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
|
2015-08-28 18:51:06 +00:00
|
|
|
function (remove_srcs)
|
2015-08-31 13:59:21 +00:00
|
|
|
file (GLOB_RECURSE to_remove ${ARGN})
|
2015-08-28 18:51:06 +00:00
|
|
|
list (REMOVE_ITEM srcs ${to_remove})
|
|
|
|
set (srcs ${srcs} PARENT_SCOPE)
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
# This file is empty and is only used to trick GYP.
|
|
|
|
remove_srcs (../src/core/SkForceCPlusPlusLinking.cpp)
|
2015-08-31 13:59:21 +00:00
|
|
|
# Chrome only?
|
2016-09-19 19:13:16 +00:00
|
|
|
remove_srcs (../src/ports/SkFontConfigInterface.cpp
|
|
|
|
../src/ports/SkFontConfigInterface_direct.cpp
|
2015-12-01 19:26:28 +00:00
|
|
|
../src/ports/SkFontConfigInterface_direct_factory.cpp
|
|
|
|
../src/ports/SkFontConfigInterface_direct_google3.cpp
|
2016-08-02 14:07:33 +00:00
|
|
|
../src/ports/SkFontConfigInterface_direct_google3_factory.cpp
|
|
|
|
../src/ports/SkFontMgr_FontConfigInterface.cpp
|
|
|
|
../src/ports/SkFontMgr_FontConfigInterface_factory.cpp)
|
2015-08-31 13:59:21 +00:00
|
|
|
# Alternative font managers.
|
|
|
|
remove_srcs (../src/ports/SkFontMgr_custom*.cpp)
|
2016-07-01 15:22:01 +00:00
|
|
|
# skslc main()
|
|
|
|
remove_srcs (../src/sksl/SkSLMain.cpp)
|
|
|
|
|
2015-08-28 18:51:06 +00:00
|
|
|
|
|
|
|
# Skia sure ships a lot of code no one uses.
|
|
|
|
remove_srcs (../src/animator/* ../src/*nacl* ../src/svg/* ../src/views/* ../src/xml/*)
|
2016-07-19 13:12:54 +00:00
|
|
|
foreach (include animator svg views xml gpu/vk)
|
2015-12-01 17:02:49 +00:00
|
|
|
file (GLOB globed_include ../include/${include})
|
|
|
|
list (REMOVE_ITEM public_includes ${globed_include})
|
|
|
|
endforeach()
|
2015-08-28 18:51:06 +00:00
|
|
|
|
|
|
|
# Remove OS-specific source files.
|
2015-09-30 18:06:53 +00:00
|
|
|
if (NOT UNIX)
|
2015-11-02 18:20:27 +00:00
|
|
|
remove_srcs(../src/ports/*_posix.cpp
|
2015-09-30 18:06:53 +00:00
|
|
|
../src/ports/SkTLS_pthread.cpp
|
|
|
|
../src/ports/SkTime_Unix.cpp
|
2015-10-20 18:05:06 +00:00
|
|
|
../src/utils/SkThreadUtils_pthread.cpp)
|
2015-09-30 18:06:53 +00:00
|
|
|
endif()
|
2015-08-31 13:59:21 +00:00
|
|
|
if (APPLE OR NOT UNIX)
|
|
|
|
remove_srcs(../src/gpu/gl/glx/*
|
|
|
|
../src/ports/SkFontMgr_fontconfig*.cpp
|
2016-01-21 22:38:13 +00:00
|
|
|
../src/ports/SkFontMgr_android*.cpp
|
2015-08-31 13:59:21 +00:00
|
|
|
../src/*FreeType*)
|
2015-08-28 18:51:06 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
# Remove processor-specific source files.
|
2015-09-14 19:02:32 +00:00
|
|
|
if (NOT CMAKE_SYSTEM_PROCESSOR STREQUAL ARM)
|
2015-08-28 18:51:06 +00:00
|
|
|
remove_srcs(../src/*arm* ../src/*ARM* ../src/*neon* ../src/*NEON*)
|
|
|
|
endif()
|
2015-09-14 19:02:32 +00:00
|
|
|
if (NOT CMAKE_SYSTEM_PROCESSOR STREQUAL MIPS)
|
2015-08-28 18:51:06 +00:00
|
|
|
remove_srcs(../src/*mips* ../src/*MIPS*)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Make our ports choices.
|
|
|
|
remove_srcs(
|
|
|
|
../src/*moz* # We're probably not Mozilla.
|
|
|
|
../src/gpu/GrContextFactory.cpp # For internal testing only.
|
|
|
|
../src/gpu/gl/GrGLCreateNativeInterface_none.cpp
|
|
|
|
../src/gpu/gl/GrGLDefaultInterface_none.cpp
|
|
|
|
../src/gpu/gl/command_buffer/*
|
|
|
|
../src/gpu/gl/egl/*
|
2016-03-28 18:34:27 +00:00
|
|
|
../src/gpu/gl/glfw/*
|
2015-08-28 18:51:06 +00:00
|
|
|
../src/gpu/gl/iOS/*
|
2016-02-22 15:19:10 +00:00
|
|
|
../src/gpu/vk/*
|
2015-08-28 18:51:06 +00:00
|
|
|
../src/opts/SkBitmapProcState_opts_none.cpp
|
|
|
|
../src/opts/SkBlitMask_opts_none.cpp
|
|
|
|
../src/opts/SkBlitRow_opts_none.cpp
|
|
|
|
../src/ports/SkFontMgr_empty_factory.cpp
|
|
|
|
../src/ports/SkGlobalInitialization_chromium.cpp
|
2016-03-25 15:58:55 +00:00
|
|
|
../src/ports/SkImageEncoder_none.cpp
|
2015-08-28 18:51:06 +00:00
|
|
|
../src/ports/SkImageGenerator_none.cpp
|
2015-08-31 13:59:21 +00:00
|
|
|
../src/ports/SkTLS_none.cpp)
|
2015-08-28 18:51:06 +00:00
|
|
|
|
2016-03-09 23:12:31 +00:00
|
|
|
if (NOT APPLE)
|
|
|
|
remove_srcs(../src/ports/SkImageGeneratorCG.cpp)
|
|
|
|
endif()
|
|
|
|
|
2016-03-17 20:50:17 +00:00
|
|
|
if (NOT WIN32)
|
|
|
|
remove_srcs(../src/ports/SkImageGeneratorWIC.cpp)
|
|
|
|
endif()
|
|
|
|
|
2015-09-30 18:06:53 +00:00
|
|
|
if (WIN32)
|
|
|
|
if(SKIA_GDI)
|
|
|
|
remove_srcs(../src/ports/SkFontMgr_win_dw_factory.cpp)
|
|
|
|
else()
|
|
|
|
remove_srcs(../src/ports/SkFontMgr_win_gdi_factory.cpp)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2015-12-17 18:18:04 +00:00
|
|
|
# Certain files must be compiled with support for SSSE3, SSE4.1, AVX, or AVX2 intrinsics.
|
2015-08-28 18:51:06 +00:00
|
|
|
file (GLOB_RECURSE ssse3_srcs ../src/*ssse3*.cpp ../src/*SSSE3*.cpp)
|
2016-08-08 16:06:27 +00:00
|
|
|
file (GLOB_RECURSE sse41_srcs ../src/*sse41*.cpp ../src/*SSE41*.cpp)
|
|
|
|
file (GLOB_RECURSE sse42_srcs ../src/*sse42*.cpp ../src/*SSE42*.cpp)
|
2015-12-17 18:18:04 +00:00
|
|
|
file (GLOB_RECURSE avx_srcs ../src/*_avx.cpp)
|
2016-09-30 14:48:01 +00:00
|
|
|
file (GLOB_RECURSE hsw_srcs ../src/*_hsw.cpp)
|
2016-05-12 18:25:00 +00:00
|
|
|
if (NOT WIN32)
|
|
|
|
set_source_files_properties(${ssse3_srcs} PROPERTIES COMPILE_FLAGS -mssse3)
|
|
|
|
set_source_files_properties(${sse41_srcs} PROPERTIES COMPILE_FLAGS -msse4.1)
|
2016-08-08 16:06:27 +00:00
|
|
|
set_source_files_properties(${sse42_srcs} PROPERTIES COMPILE_FLAGS -msse4.2)
|
2016-05-12 18:25:00 +00:00
|
|
|
set_source_files_properties(${avx_srcs} PROPERTIES COMPILE_FLAGS -mavx)
|
2016-09-30 14:48:01 +00:00
|
|
|
set_source_files_properties(${hsw_srcs} PROPERTIES COMPILE_FLAGS
|
|
|
|
-mavx2 -mbmi -mbmi2 -mf16c -mfma)
|
2016-05-12 18:25:00 +00:00
|
|
|
endif()
|
2015-08-28 18:51:06 +00:00
|
|
|
|
|
|
|
# Detect our optional dependencies.
|
|
|
|
# If we can't find them, don't build the parts of Skia that use them.
|
2015-11-02 18:20:27 +00:00
|
|
|
find_package (EXPAT)
|
2015-08-31 13:59:21 +00:00
|
|
|
find_package (Lua)
|
2015-08-28 18:51:06 +00:00
|
|
|
find_package (ZLIB)
|
2016-08-23 18:01:33 +00:00
|
|
|
|
|
|
|
# For libraries that don't have find_package() scripts, we do it ourselves:
|
2015-08-28 18:51:06 +00:00
|
|
|
find_path (WEBP_INCLUDE_DIRS "webp/decode.h")
|
2016-08-23 18:01:33 +00:00
|
|
|
find_library (WEBP_LIBRARIES "webp")
|
|
|
|
|
2015-09-21 16:42:23 +00:00
|
|
|
find_path (OSMESA_INCLUDE_DIRS "GL/osmesa.h")
|
|
|
|
find_library(OSMESA_LIBRARIES "OSMesa")
|
2015-08-28 18:51:06 +00:00
|
|
|
|
2015-08-31 13:59:21 +00:00
|
|
|
if (UNIX AND NOT APPLE)
|
|
|
|
find_package (Freetype)
|
2016-08-23 18:01:33 +00:00
|
|
|
find_package (GIF)
|
|
|
|
|
2015-08-31 13:59:21 +00:00
|
|
|
find_path (FONTCONFIG_INCLUDE_DIRS "fontconfig/fontconfig.h")
|
|
|
|
find_library (FONTCONFIG_LIBRARIES fontconfig)
|
2016-08-23 18:01:33 +00:00
|
|
|
|
|
|
|
# We require libjpeg-turbo >= 1.5.0.
|
|
|
|
find_package(PkgConfig)
|
|
|
|
pkg_check_modules(JPEG_TURBO libjpeg>=1.5.0)
|
2015-08-31 13:59:21 +00:00
|
|
|
endif()
|
|
|
|
|
2016-02-16 21:16:39 +00:00
|
|
|
# Do not compile SkRawCodec.
|
|
|
|
remove_srcs(../src/codec/*Raw*.cpp)
|
|
|
|
|
2015-08-31 13:59:21 +00:00
|
|
|
# TODO: macro away this if (found) ... else() ... endif() stuff.
|
|
|
|
|
2015-11-02 18:20:27 +00:00
|
|
|
if (EXPAT_FOUND)
|
|
|
|
list (APPEND private_includes ${EXPAT_INCLUDE_DIRS})
|
|
|
|
list (APPEND libs ${EXPAT_LIBRARIES})
|
|
|
|
else()
|
|
|
|
remove_srcs (../src/ports/SkFontMgr_android_parser.cpp)
|
|
|
|
endif()
|
|
|
|
|
2015-08-31 13:59:21 +00:00
|
|
|
if (GIF_FOUND)
|
|
|
|
list (APPEND private_includes ${GIF_INCLUDE_DIRS})
|
|
|
|
list (APPEND libs ${GIF_LIBRARIES})
|
|
|
|
else()
|
2016-03-25 15:58:55 +00:00
|
|
|
remove_srcs(../src/images/*GIF*)
|
2015-08-28 18:51:06 +00:00
|
|
|
endif()
|
2015-08-31 13:59:21 +00:00
|
|
|
|
2016-08-23 18:01:33 +00:00
|
|
|
if (JPEG_TURBO_FOUND)
|
|
|
|
list (APPEND private_includes ${JPEG_TURBO_INCLUDE_DIRS})
|
|
|
|
list (APPEND libs ${JPEG_TURBO_LIBRARIES})
|
2016-05-06 14:21:26 +00:00
|
|
|
add_definitions(-DSK_HAS_JPEG_LIBRARY)
|
2015-08-31 13:59:21 +00:00
|
|
|
else()
|
2016-03-25 15:58:55 +00:00
|
|
|
remove_srcs(../src/images/*JPEG*)
|
2016-02-17 16:26:31 +00:00
|
|
|
remove_srcs(../src/codec/*Jpeg*)
|
2015-08-28 18:51:06 +00:00
|
|
|
endif()
|
2015-08-31 13:59:21 +00:00
|
|
|
|
|
|
|
if (LUA_FOUND)
|
|
|
|
list (APPEND private_includes ${LUA_INCLUDE_DIR})
|
|
|
|
list (APPEND libs ${LUA_LIBRARIES})
|
|
|
|
else()
|
|
|
|
remove_srcs(../src/utils/*Lua*)
|
2015-08-28 18:51:06 +00:00
|
|
|
endif()
|
2015-08-31 13:59:21 +00:00
|
|
|
|
2016-06-02 19:59:59 +00:00
|
|
|
# PNG
|
|
|
|
add_definitions(-DSK_HAS_PNG_LIBRARY)
|
|
|
|
add_definitions(-DPNG_ARM_NEON_OPT=0)
|
2015-08-31 13:59:21 +00:00
|
|
|
|
|
|
|
if (ZLIB_FOUND)
|
|
|
|
list (APPEND private_includes ${ZLIB_INCLUDE_DIRS})
|
|
|
|
list (APPEND libs ${ZLIB_LIBRARIES})
|
2016-03-12 13:59:39 +00:00
|
|
|
remove_srcs(../src/pdf/SkDocument_PDF_None.cpp)
|
2015-08-31 13:59:21 +00:00
|
|
|
else()
|
2016-03-12 13:59:39 +00:00
|
|
|
remove_srcs(../src/pdf/*.cpp)
|
|
|
|
set (srcs ${srcs} ../src/pdf/SkDocument_PDF_None.cpp)
|
2015-08-28 18:51:06 +00:00
|
|
|
endif()
|
2015-08-31 13:59:21 +00:00
|
|
|
|
|
|
|
if (WEBP_INCLUDE_DIRS AND WEBP_LIBRARIES)
|
|
|
|
list (APPEND private_includes ${WEBP_INCLUDE_DIRS})
|
|
|
|
list (APPEND libs ${WEBP_LIBRARIES})
|
2016-05-06 14:21:26 +00:00
|
|
|
add_definitions(-DSK_HAS_WEBP_LIBRARY)
|
2015-08-31 13:59:21 +00:00
|
|
|
else()
|
2016-03-25 15:58:55 +00:00
|
|
|
remove_srcs(../src/images/*WEBP*)
|
2016-02-17 16:26:31 +00:00
|
|
|
remove_srcs(../src/codec/*Webp*)
|
2015-08-28 18:51:06 +00:00
|
|
|
endif()
|
|
|
|
|
2015-08-31 13:59:21 +00:00
|
|
|
if (FREETYPE_FOUND)
|
|
|
|
list (APPEND private_includes ${FREETYPE_INCLUDE_DIRS})
|
|
|
|
list (APPEND libs ${FREETYPE_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (FONTCONFIG_INCLUDE_DIRS AND FONTCONFIG_LIBRARIES)
|
|
|
|
list (APPEND private_includes ${FONTCONFIG_INCLUDE_DIRS})
|
|
|
|
list (APPEND libs ${FONTCONFIG_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
|
2015-08-28 18:51:06 +00:00
|
|
|
if (APPLE)
|
2015-08-31 13:59:21 +00:00
|
|
|
find_library(APPLICATION_SERVICES_FRAMEWORK ApplicationServices REQUIRED)
|
|
|
|
list (APPEND libs ${APPLICATION_SERVICES_FRAMEWORK})
|
2015-08-28 18:51:06 +00:00
|
|
|
endif()
|
|
|
|
|
2015-09-21 16:42:23 +00:00
|
|
|
if (OSMESA_LIBRARIES AND OSMESA_INCLUDE_DIRS)
|
|
|
|
list (APPEND libs ${OSMESA_LIBRARIES})
|
|
|
|
list (APPEND private_includes ${OSMESA_INCLUDE_DIRS})
|
|
|
|
list (APPEND public_defines "-DSK_MESA=1")
|
2016-01-05 16:32:32 +00:00
|
|
|
set (SK_MESA 1)
|
2015-09-21 16:42:23 +00:00
|
|
|
else()
|
|
|
|
remove_srcs(../src/gpu/gl/mesa/*)
|
|
|
|
endif()
|
|
|
|
|
2015-09-30 18:06:53 +00:00
|
|
|
if (WIN32)
|
|
|
|
list (APPEND libs FontSub.lib Usp10.lib)
|
2016-05-24 16:44:05 +00:00
|
|
|
else()
|
|
|
|
list (APPEND libs pthread)
|
2015-09-30 18:06:53 +00:00
|
|
|
endif()
|
|
|
|
|
2015-09-01 17:11:44 +00:00
|
|
|
find_package(OpenGL REQUIRED)
|
|
|
|
list (APPEND libs ${OPENGL_LIBRARIES})
|
|
|
|
|
2016-05-24 16:44:05 +00:00
|
|
|
# This is our main output, libskia.{a,so,dll,dylib,etc...}
|
|
|
|
# You can control whether this is static or shared with BUILD_SHARED_LIBS.
|
|
|
|
add_library (skia ${srcs})
|
2015-08-28 18:51:06 +00:00
|
|
|
|
|
|
|
target_compile_definitions(skia
|
2015-09-21 16:42:23 +00:00
|
|
|
PUBLIC ${public_defines}
|
2015-09-30 18:06:53 +00:00
|
|
|
PRIVATE -DSKIA_DLL -DSKIA_IMPLEMENTATION=1)
|
2015-08-28 18:51:06 +00:00
|
|
|
|
|
|
|
target_include_directories(skia
|
|
|
|
PUBLIC ${public_includes}
|
2015-08-31 13:59:21 +00:00
|
|
|
PRIVATE ${private_includes})
|
2015-08-28 18:51:06 +00:00
|
|
|
|
|
|
|
target_link_libraries(skia
|
|
|
|
PUBLIC
|
2015-08-31 13:59:21 +00:00
|
|
|
PRIVATE ${libs})
|
|
|
|
|
2015-09-30 18:06:53 +00:00
|
|
|
if (MSVC)
|
2016-05-12 18:25:00 +00:00
|
|
|
string(REGEX REPLACE " /W3 " " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
|
2015-09-30 18:06:53 +00:00
|
|
|
set(cc_flags "/w /GR-")
|
|
|
|
else()
|
|
|
|
set(cc_flags "-w -fno-rtti -fno-exceptions")
|
|
|
|
endif()
|
2015-08-28 18:51:06 +00:00
|
|
|
|
|
|
|
set_target_properties(skia PROPERTIES
|
2016-05-24 16:44:05 +00:00
|
|
|
COMPILE_FLAGS ${cc_flags})
|
|
|
|
if (BUILD_SHARED_LIBS)
|
|
|
|
set_target_properties(skia PROPERTIES
|
|
|
|
CXX_VISIBILITY_PRESET hidden
|
|
|
|
VISIBILITY_INLINES_HIDDEN true)
|
|
|
|
endif()
|
2015-08-28 18:51:06 +00:00
|
|
|
|
2015-09-03 21:23:17 +00:00
|
|
|
# Experimental C API install:
|
2015-09-29 20:16:33 +00:00
|
|
|
file(GLOB c_headers "../include/c/*.h")
|
|
|
|
install(FILES ${c_headers} DESTINATION include)
|
2015-09-03 21:23:17 +00:00
|
|
|
install(TARGETS skia DESTINATION lib)
|
|
|
|
|
2015-11-30 20:42:58 +00:00
|
|
|
# SkUserConfig.h
|
|
|
|
if (CMAKE_BUILD_TYPE STREQUAL Release)
|
2016-01-05 16:32:32 +00:00
|
|
|
set (SK_RELEASE 1)
|
2016-01-07 14:56:11 +00:00
|
|
|
else()
|
|
|
|
set (SK_RELEASE 0)
|
2015-11-30 20:42:58 +00:00
|
|
|
endif()
|
2016-03-25 16:01:26 +00:00
|
|
|
if (UNIX AND NOT APPLE)
|
|
|
|
set (SK_SAMPLES_FOR_X 1)
|
|
|
|
else()
|
|
|
|
set (SK_SAMPLES_FOR_X 0)
|
|
|
|
endif()
|
2016-01-05 16:32:32 +00:00
|
|
|
configure_file ("SkUserConfig.h.in" "${userconfig_directory}/SkUserConfig.h")
|
2015-11-30 20:42:58 +00:00
|
|
|
|
|
|
|
# skia_link_arguments.txt
|
|
|
|
set (link_arguments ${CMAKE_BINARY_DIR}/skia_link_arguments.txt)
|
2016-05-24 18:23:23 +00:00
|
|
|
if (BUILD_SHARED_LIBS)
|
|
|
|
file (WRITE ${link_arguments} "-L${CMAKE_BINARY_DIR}\n")
|
|
|
|
file (APPEND ${link_arguments} "-lskia\n")
|
|
|
|
file (APPEND ${link_arguments} "-Wl,-rpath,${CMAKE_BINARY_DIR}\n")
|
|
|
|
else()
|
|
|
|
file (WRITE ${link_arguments} "${CMAKE_BINARY_DIR}/libskia.a\n")
|
|
|
|
foreach (lib ${libs})
|
|
|
|
if (EXISTS ${lib})
|
|
|
|
get_filename_component(lib_path ${lib} ABSOLUTE)
|
|
|
|
file (APPEND ${link_arguments} "${lib_path}\n")
|
|
|
|
else()
|
|
|
|
file (APPEND ${link_arguments} "-l${lib}\n")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
endif()
|
2015-11-30 20:42:58 +00:00
|
|
|
|
|
|
|
# skia_compile_arguments.txt
|
|
|
|
set (compile_arguments ${CMAKE_BINARY_DIR}/skia_compile_arguments.txt)
|
|
|
|
file (WRITE ${compile_arguments} "--std=c++11\n")
|
|
|
|
foreach (include ${public_includes})
|
|
|
|
get_filename_component (abs_include ${include} ABSOLUTE)
|
|
|
|
file (APPEND ${compile_arguments} "-I${abs_include}\n")
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
# cmake .
|
|
|
|
# cmake --build . --target skia
|
|
|
|
# c++ -c @skia_compile_arguments.txt example.cpp
|
|
|
|
# c++ example.o @skia_link_arguments.txt
|
|
|
|
|
|
|
|
# skia.h
|
2016-07-26 19:41:27 +00:00
|
|
|
set (bad_files GrGLConfig_chrome.h)
|
2015-12-01 17:02:49 +00:00
|
|
|
# make `c++ @skia_compile_arguments.txt include/skia.h` work.
|
2015-11-30 20:42:58 +00:00
|
|
|
set (skia_h_path ${userconfig_directory}/skia.h)
|
|
|
|
file (WRITE ${skia_h_path} "// skia.h generated by CMake.\n")
|
|
|
|
file(APPEND ${skia_h_path} "#ifndef skia_DEFINED\n")
|
|
|
|
file(APPEND ${skia_h_path} "#define skia_DEFINED\n")
|
|
|
|
foreach (include ${public_includes})
|
|
|
|
if (NOT include STREQUAL userconfig_directory)
|
|
|
|
file (APPEND ${skia_h_path} "\n")
|
|
|
|
file (GLOB all_public_headers ${include}/*.h)
|
|
|
|
foreach (public_header ${all_public_headers})
|
|
|
|
get_filename_component (filename_component ${public_header} NAME)
|
2015-12-01 17:02:49 +00:00
|
|
|
if (NOT ";${bad_files};" MATCHES ";${filename_component};")
|
|
|
|
file (APPEND ${skia_h_path} "#include \"${filename_component}\"\n")
|
|
|
|
endif ()
|
2015-11-30 20:42:58 +00:00
|
|
|
endforeach()
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
file(APPEND ${skia_h_path} "\n#endif // skia_DEFINED\n")
|
|
|
|
|
2015-08-28 18:51:06 +00:00
|
|
|
# Now build a simple example app that uses Skia via libskia.so.
|
|
|
|
add_executable(example example.cpp)
|
|
|
|
target_link_libraries(example skia ${OPENGL_LIBRARIES})
|