Compile SkForceLinking on CMake
BUG=skia: GOLD_TRYBOT_URL= https://gold.skia.org/search2?unt=true&query=source_type%3Dgm&master=false&issue=1956573002 CQ_EXTRA_TRYBOTS=client.skia.compile:Build-Ubuntu-GCC-x86_64-Release-CMake-Trybot,Build-Mac-Clang-x86_64-Release-CMake-Trybot Review-Url: https://codereview.chromium.org/1956573002
This commit is contained in:
parent
56a85e69a8
commit
ad3a5c634d
@ -43,8 +43,6 @@ endfunction()
|
||||
|
||||
# This file is empty and is only used to trick GYP.
|
||||
remove_srcs (../src/core/SkForceCPlusPlusLinking.cpp)
|
||||
# This file forces linking for all our supported image decoders. We're more fine-grained.
|
||||
remove_srcs (../src/images/SkForceLinking.cpp)
|
||||
# Chrome only?
|
||||
remove_srcs (../src/ports/SkFontHost_fontconfig.cpp
|
||||
../src/fonts/SkFontMgr_fontconfig.cpp
|
||||
@ -166,7 +164,7 @@ endif()
|
||||
if (GIF_FOUND)
|
||||
list (APPEND private_includes ${GIF_INCLUDE_DIRS})
|
||||
list (APPEND libs ${GIF_LIBRARIES})
|
||||
add_definitions(-DSK_CODEC_DECODES_GIF)
|
||||
add_definitions(-DSK_HAS_GIF_LIBRARY)
|
||||
else()
|
||||
remove_srcs(../src/images/*GIF*)
|
||||
remove_srcs(../src/codec/*Gif*)
|
||||
@ -175,7 +173,7 @@ endif()
|
||||
if (JPEG_FOUND)
|
||||
list (APPEND private_includes ${JPEG_INCLUDE_DIRS})
|
||||
list (APPEND libs ${JPEG_LIBRARIES})
|
||||
add_definitions(-DSK_CODEC_DECODES_JPEG)
|
||||
add_definitions(-DSK_HAS_JPEG_LIBRARY)
|
||||
else()
|
||||
remove_srcs(../src/images/*JPEG*)
|
||||
remove_srcs(../src/codec/*Jpeg*)
|
||||
@ -193,7 +191,7 @@ if (PNG_FOUND)
|
||||
list (APPEND libs ${PNG_LIBRARIES})
|
||||
add_definitions(-DPNG_SKIP_SETJMP_CHECK)
|
||||
add_definitions(-DPNG_SKIP_SKIA_OPTS)
|
||||
add_definitions(-DSK_CODEC_DECODES_PNG)
|
||||
add_definitions(-DSK_HAS_PNG_LIBRARY)
|
||||
else()
|
||||
remove_srcs(../src/images/*PNG*)
|
||||
remove_srcs(../src/codec/*Png*)
|
||||
@ -212,7 +210,7 @@ endif()
|
||||
if (WEBP_INCLUDE_DIRS AND WEBP_LIBRARIES)
|
||||
list (APPEND private_includes ${WEBP_INCLUDE_DIRS})
|
||||
list (APPEND libs ${WEBP_LIBRARIES})
|
||||
add_definitions(-DSK_CODEC_DECODES_WEBP)
|
||||
add_definitions(-DSK_HAS_WEBP_LIBRARY)
|
||||
else()
|
||||
remove_srcs(../src/images/*WEBP*)
|
||||
remove_srcs(../src/codec/*Webp*)
|
||||
|
@ -64,15 +64,6 @@
|
||||
],
|
||||
},
|
||||
'defines': [
|
||||
# Turn on all of the codecs, since we know that we have all of the
|
||||
# necessary dependencies. Clients that are missing some of the
|
||||
# required decoding libraries may choose to turn the codecs on or
|
||||
# off individually.
|
||||
'SK_CODEC_DECODES_GIF',
|
||||
'SK_CODEC_DECODES_JPEG',
|
||||
'SK_CODEC_DECODES_PNG',
|
||||
'SK_CODEC_DECODES_WEBP',
|
||||
|
||||
# Turn on libjpeg-turbo optimizations since we know that the
|
||||
# appropriate version of libjpeg-turbo is present.
|
||||
'TURBO_HAS_CROP',
|
||||
|
@ -10,6 +10,15 @@
|
||||
'SK_ALLOW_STATIC_GLOBAL_INITIALIZERS=<(skia_static_initializers)',
|
||||
'SK_SUPPORT_GPU=<(skia_gpu)',
|
||||
'SK_FORCE_DISTANCE_FIELD_TEXT=<(skia_force_distance_field_text)',
|
||||
|
||||
# Indicate that all dependency libraries are present. Clients that
|
||||
# are missing some of the required decoding libraries may choose
|
||||
# not to define these. This will disable some decoder and encoder
|
||||
# features.
|
||||
'SK_HAS_GIF_LIBRARY',
|
||||
'SK_HAS_JPEG_LIBRARY',
|
||||
'SK_HAS_PNG_LIBRARY',
|
||||
'SK_HAS_WEBP_LIBRARY',
|
||||
],
|
||||
'conditions' : [
|
||||
[ 'skia_is_bot', {
|
||||
|
16
public.bzl
16
public.bzl
@ -551,20 +551,20 @@ DEFINES_UNIX = [
|
||||
"SK_BUILD_FOR_UNIX",
|
||||
"SK_SAMPLES_FOR_X",
|
||||
"SK_SFNTLY_SUBSETTER",
|
||||
"SK_CODEC_DECODES_GIF",
|
||||
"SK_CODEC_DECODES_JPEG",
|
||||
"SK_CODEC_DECODES_PNG",
|
||||
"SK_CODEC_DECODES_RAW",
|
||||
"SK_CODEC_DECODES_WEBP",
|
||||
"SK_HAS_GIF_LIBRARY",
|
||||
"SK_HAS_JPEG_LIBRARY",
|
||||
"SK_HAS_PNG_LIBRARY",
|
||||
"SK_HAS_WEBP_LIBRARY",
|
||||
]
|
||||
|
||||
DEFINES_ANDROID = [
|
||||
"SK_BUILD_FOR_ANDROID",
|
||||
"SK_CODEC_DECODES_GIF",
|
||||
"SK_CODEC_DECODES_JPEG",
|
||||
"SK_CODEC_DECODES_PNG",
|
||||
"SK_CODEC_DECODES_RAW",
|
||||
"SK_CODEC_DECODES_WEBP",
|
||||
"SK_HAS_GIF_LIBRARY",
|
||||
"SK_HAS_JPEG_LIBRARY",
|
||||
"SK_HAS_PNG_LIBRARY",
|
||||
"SK_HAS_WEBP_LIBRARY",
|
||||
]
|
||||
|
||||
DEFINES_IOS = [
|
||||
|
@ -29,20 +29,20 @@ SkAndroidCodec* SkAndroidCodec::NewFromStream(SkStream* stream, SkPngChunkReader
|
||||
}
|
||||
|
||||
switch (codec->getEncodedFormat()) {
|
||||
#ifdef SK_CODEC_DECODES_PNG
|
||||
#ifdef SK_HAS_PNG_LIBRARY
|
||||
case kPNG_SkEncodedFormat:
|
||||
case kICO_SkEncodedFormat:
|
||||
#endif
|
||||
#ifdef SK_CODEC_DECODES_JPEG
|
||||
#ifdef SK_HAS_JPEG_LIBRARY
|
||||
case kJPEG_SkEncodedFormat:
|
||||
#endif
|
||||
#ifdef SK_CODEC_DECODES_GIF
|
||||
#ifdef SK_HAS_GIF_LIBRARY
|
||||
case kGIF_SkEncodedFormat:
|
||||
#endif
|
||||
case kBMP_SkEncodedFormat:
|
||||
case kWBMP_SkEncodedFormat:
|
||||
return new SkSampledCodec(codec.release());
|
||||
#ifdef SK_CODEC_DECODES_WEBP
|
||||
#ifdef SK_HAS_WEBP_LIBRARY
|
||||
case kWEBP_SkEncodedFormat:
|
||||
return new SkWebpAdapterCodec((SkWebpCodec*) codec.release());
|
||||
#endif
|
||||
|
@ -13,7 +13,7 @@
|
||||
#include "SkGifCodec.h"
|
||||
#include "SkIcoCodec.h"
|
||||
#include "SkJpegCodec.h"
|
||||
#ifdef SK_CODEC_DECODES_PNG
|
||||
#ifdef SK_HAS_PNG_LIBRARY
|
||||
#include "SkPngCodec.h"
|
||||
#endif
|
||||
#include "SkRawCodec.h"
|
||||
@ -27,16 +27,16 @@ struct DecoderProc {
|
||||
};
|
||||
|
||||
static const DecoderProc gDecoderProcs[] = {
|
||||
#ifdef SK_CODEC_DECODES_JPEG
|
||||
#ifdef SK_HAS_JPEG_LIBRARY
|
||||
{ SkJpegCodec::IsJpeg, SkJpegCodec::NewFromStream },
|
||||
#endif
|
||||
#ifdef SK_CODEC_DECODES_WEBP
|
||||
#ifdef SK_HAS_WEBP_LIBRARY
|
||||
{ SkWebpCodec::IsWebp, SkWebpCodec::NewFromStream },
|
||||
#endif
|
||||
#ifdef SK_CODEC_DECODES_GIF
|
||||
#ifdef SK_HAS_GIF_LIBRARY
|
||||
{ SkGifCodec::IsGif, SkGifCodec::NewFromStream },
|
||||
#endif
|
||||
#ifdef SK_CODEC_DECODES_PNG
|
||||
#ifdef SK_HAS_PNG_LIBRARY
|
||||
{ SkIcoCodec::IsIco, SkIcoCodec::NewFromStream },
|
||||
#endif
|
||||
{ SkBmpCodec::IsBmp, SkBmpCodec::NewFromStream },
|
||||
@ -86,7 +86,7 @@ SkCodec* SkCodec::NewFromStream(SkStream* stream,
|
||||
|
||||
// PNG is special, since we want to be able to supply an SkPngChunkReader.
|
||||
// But this code follows the same pattern as the loop.
|
||||
#ifdef SK_CODEC_DECODES_PNG
|
||||
#ifdef SK_HAS_PNG_LIBRARY
|
||||
if (SkPngCodec::IsPng(buffer, bytesRead)) {
|
||||
return SkPngCodec::NewFromStream(streamDeleter.release(), chunkReader);
|
||||
} else
|
||||
|
@ -14,15 +14,20 @@
|
||||
int SkForceLinking(bool doNotPassTrue) {
|
||||
if (doNotPassTrue) {
|
||||
SkASSERT(false);
|
||||
#if defined(SK_HAS_JPEG_LIBRARY)
|
||||
CreateJPEGImageEncoder();
|
||||
#endif
|
||||
#if defined(SK_HAS_WEBP_LIBRARY)
|
||||
CreateWEBPImageEncoder();
|
||||
#endif
|
||||
|
||||
// Only link hardware texture codecs on platforms that build them. See images.gyp
|
||||
#ifndef SK_BUILD_FOR_ANDROID_FRAMEWORK
|
||||
CreateKTXImageEncoder();
|
||||
#endif
|
||||
|
||||
#if !defined(SK_BUILD_FOR_MAC) && !defined(SK_BUILD_FOR_WIN) && !defined(SK_BUILD_FOR_IOS)
|
||||
#if !defined(SK_BUILD_FOR_MAC) && !defined(SK_BUILD_FOR_WIN) && !defined(SK_BUILD_FOR_IOS) && \
|
||||
defined(SK_HAS_PNG_LIBRARY)
|
||||
CreatePNGImageEncoder();
|
||||
#endif
|
||||
#if defined(SK_BUILD_FOR_MAC) || defined(SK_BUILD_FOR_IOS)
|
||||
|
Loading…
Reference in New Issue
Block a user