Disable webp support by default (related to #799)

There is a new WITH_WEBP_SUPPORT cmake option to enable webp support.
This commit is contained in:
David Capello 2015-09-07 14:43:31 -03:00
parent 361973d880
commit 2a0f8ca536
4 changed files with 42 additions and 21 deletions

View File

@ -33,6 +33,8 @@ project(aseprite C CXX)
# Options (these can be specified in cmake command line or modifying # Options (these can be specified in cmake command line or modifying
# CMakeCache.txt) # CMakeCache.txt)
option(WITH_WEBP_SUPPORT "Enable support to load/save .webp files" off)
option(USE_STATIC_LIBC "Use static version of C and C++ runtimes" off) option(USE_STATIC_LIBC "Use static version of C and C++ runtimes" off)
option(USE_SHARED_CURL "Use your installed copy of curl" off) option(USE_SHARED_CURL "Use your installed copy of curl" off)
option(USE_SHARED_GIFLIB "Use your installed copy of giflib" off) option(USE_SHARED_GIFLIB "Use your installed copy of giflib" off)
@ -173,17 +175,19 @@ include_directories(${PNG_INCLUDE_DIR})
add_definitions(-DPNG_NO_MMX_CODE) # Do not use MMX optimizations in PNG code add_definitions(-DPNG_NO_MMX_CODE) # Do not use MMX optimizations in PNG code
# libwebp # libwebp
if(USE_SHARED_LIBWEBP) if(WITH_WEBP_SUPPORT)
find_package(PkgConfig) if(USE_SHARED_LIBWEBP)
pkg_check_modules(WEBP libwebp) find_package(PkgConfig)
if(NOT WEBP_FOUND) pkg_check_modules(WEBP libwebp)
message(FATAL_ERROR "libwebp not found") if(NOT WEBP_FOUND)
message(FATAL_ERROR "libwebp not found")
endif()
else()
set(WEBP_LIBRARIES webp)
set(WEBP_INCLUDE_DIR ${LIBWEBP_DIR}/src)
endif() endif()
else() include_directories(${WEBP_INCLUDE_DIR})
set(WEBP_LIBRARIES webp)
set(WEBP_INCLUDE_DIR ${LIBWEBP_DIR}/src)
endif() endif()
include_directories(${WEBP_INCLUDE_DIR})
# tinyxml # tinyxml
if(USE_SHARED_TINYXML) if(USE_SHARED_TINYXML)

View File

@ -56,6 +56,10 @@ list(APPEND generated_files ${output_fn})
# Directory where generated files by "gen" utility will stay. # Directory where generated files by "gen" utility will stay.
include_directories(${CMAKE_CURRENT_BINARY_DIR}) include_directories(${CMAKE_CURRENT_BINARY_DIR})
if(WITH_WEBP_SUPPORT)
add_definitions(-DASEPRITE_WITH_WEBP_SUPPORT)
endif()
###################################################################### ######################################################################
# app-lib target # app-lib target
@ -70,6 +74,20 @@ if(NOT ENABLE_TRIAL_MODE)
ui/data_recovery_view.cpp) ui/data_recovery_view.cpp)
endif() endif()
set(file_formats
file/ase_format.cpp
file/bmp_format.cpp
file/fli_format.cpp
file/gif_format.cpp
file/ico_format.cpp
file/jpeg_format.cpp
file/pcx_format.cpp
file/png_format.cpp
file/tga_format.cpp)
if(WITH_WEBP_SUPPORT)
list(APPEND file_formats file/webp_format.cpp)
endif()
add_library(app-lib add_library(app-lib
app.cpp app.cpp
app_menus.cpp app_menus.cpp
@ -259,22 +277,13 @@ add_library(app-lib
document_range_ops.cpp document_range_ops.cpp
document_undo.cpp document_undo.cpp
extra_cel.cpp extra_cel.cpp
file/ase_format.cpp
file/bmp_format.cpp
file/file.cpp file/file.cpp
file/file_format.cpp file/file_format.cpp
file/file_formats_manager.cpp file/file_formats_manager.cpp
file/fli/fli.cpp file/fli/fli.cpp
file/fli_format.cpp
file/gif_format.cpp
file/ico_format.cpp
file/jpeg_format.cpp
file/palette_file.cpp file/palette_file.cpp
file/pcx_format.cpp
file/png_format.cpp
file/split_filename.cpp file/split_filename.cpp
file/tga_format.cpp ${file_formats}
file/webp_format.cpp
file_selector.cpp file_selector.cpp
file_system.cpp file_system.cpp
filename_formatter.cpp filename_formatter.cpp

View File

@ -29,7 +29,10 @@ extern FileFormat* CreateJpegFormat();
extern FileFormat* CreatePcxFormat(); extern FileFormat* CreatePcxFormat();
extern FileFormat* CreatePngFormat(); extern FileFormat* CreatePngFormat();
extern FileFormat* CreateTgaFormat(); extern FileFormat* CreateTgaFormat();
#ifdef ASEPRITE_WITH_WEBP_SUPPORT
extern FileFormat* CreateWebPFormat(); extern FileFormat* CreateWebPFormat();
#endif
static FileFormatsManager* singleton = NULL; static FileFormatsManager* singleton = NULL;
@ -68,7 +71,10 @@ void FileFormatsManager::registerAllFormats()
registerFormat(CreatePcxFormat()); registerFormat(CreatePcxFormat());
registerFormat(CreatePngFormat()); registerFormat(CreatePngFormat());
registerFormat(CreateTgaFormat()); registerFormat(CreateTgaFormat());
#ifdef ASEPRITE_WITH_WEBP_SUPPORT
registerFormat(CreateWebPFormat()); registerFormat(CreateWebPFormat());
#endif
} }
void FileFormatsManager::registerFormat(FileFormat* fileFormat) void FileFormatsManager::registerFormat(FileFormat* fileFormat)

View File

@ -20,8 +20,10 @@ if(NOT USE_SHARED_LIBPNG)
add_subdirectory(libpng) add_subdirectory(libpng)
endif() endif()
if(NOT USE_SHARED_LIBWEBP) if(WITH_WEBP_SUPPORT)
add_subdirectory(libwebp-cmake) if(NOT USE_SHARED_LIBWEBP)
add_subdirectory(libwebp-cmake)
endif()
endif() endif()
if(NOT USE_SHARED_GIFLIB) if(NOT USE_SHARED_GIFLIB)