From 5897360d63f3234fd4b0eefb46be06732cbdb49d Mon Sep 17 00:00:00 2001 From: zhangjipeng Date: Sat, 1 Jun 2024 22:16:27 +0800 Subject: [PATCH] add cmake build scripts --- CMakeLists.txt | 20 ++++ build/configs.cmake | 11 ++ build/defines.cmake | 17 ++++ demos/demos.cmake | 27 +++++ ext/ext.cmake | 7 ++ ext/image_loader/gif/gif.cmake | 21 ++++ ext/image_loader/image.cmake | 31 ++++++ ext/image_loader/jpeg/jpeg.cmake | 21 ++++ ext/image_loader/png/png.cmake | 21 ++++ ext/image_loader/webp/webp.cmake | 21 ++++ include/picasso.h | 6 +- src/src.cmake | 24 +++++ test/test.cmake | 50 +++++++++ third_party/giflib.cmake | 27 +++++ third_party/libjpeg.cmake | 72 +++++++++++++ third_party/libpng.cmake | 35 +++++++ third_party/libwebp.cmake | 167 +++++++++++++++++++++++++++++++ third_party/third_party.cmake | 12 +++ third_party/zlib.cmake | 29 ++++++ 19 files changed, 616 insertions(+), 3 deletions(-) create mode 100644 CMakeLists.txt create mode 100644 build/configs.cmake create mode 100644 build/defines.cmake create mode 100644 demos/demos.cmake create mode 100644 ext/ext.cmake create mode 100644 ext/image_loader/gif/gif.cmake create mode 100644 ext/image_loader/image.cmake create mode 100644 ext/image_loader/jpeg/jpeg.cmake create mode 100644 ext/image_loader/png/png.cmake create mode 100644 ext/image_loader/webp/webp.cmake create mode 100644 src/src.cmake create mode 100644 test/test.cmake create mode 100644 third_party/giflib.cmake create mode 100644 third_party/libjpeg.cmake create mode 100644 third_party/libpng.cmake create mode 100644 third_party/libwebp.cmake create mode 100644 third_party/third_party.cmake create mode 100644 third_party/zlib.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..898309a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,20 @@ +cmake_minimum_required(VERSION 3.16.0) + +project(picasso LANGUAGES C CXX ASM HOMEPAGE_URL https://onecoolx.github.io/picasso/) + +set(BUILD_SHARED_LIBS ON) # build shared library, OFF for static + +set(PROJECT_ROOT ${CMAKE_CURRENT_LIST_DIR}) + +iF (NOT CMAKE_BUILD_TYPE) + set(CMAKE_BUILD_TYPE Debug CACHE STRING "Build Type" FORCE) +ENDIF() + +include (${CMAKE_CURRENT_LIST_DIR}/build/configs.cmake) +include (${CMAKE_CURRENT_LIST_DIR}/build/defines.cmake) +include (${CMAKE_CURRENT_LIST_DIR}/third_party/third_party.cmake) +include (${CMAKE_CURRENT_LIST_DIR}/src/src.cmake) +include (${CMAKE_CURRENT_LIST_DIR}/ext/ext.cmake) +include (${CMAKE_CURRENT_LIST_DIR}/test/test.cmake) +include (${CMAKE_CURRENT_LIST_DIR}/demos/demos.cmake) + diff --git a/build/configs.cmake b/build/configs.cmake new file mode 100644 index 0000000..8a8f7c2 --- /dev/null +++ b/build/configs.cmake @@ -0,0 +1,11 @@ +# Picasso - a vector graphics library +# +# Copyright (C) 2024 Zhang Ji Peng +# Contact: onecoolx@gmail.com + +IF (WIN32) +ELSEIF (UNIX AND NOT APPLE) +set(CMAKE_CXX_FLAGS_DEBUG "-O0 -Wall -g -fPIC -std=c++11 -fno-rtti -fno-exceptions -Wno-unused-result -Wno-register -Wno-attributes") +set(CMAKE_CXX_FLAGS_RELEASE "-O3 -Wall -fPIC -std=c++11 -fno-rtti -fno-exceptions -Wno-unused-result -Wno-register -Wno-attributes") +ELSEIF (APPLE) +ENDIF() diff --git a/build/defines.cmake b/build/defines.cmake new file mode 100644 index 0000000..ec50430 --- /dev/null +++ b/build/defines.cmake @@ -0,0 +1,17 @@ +# Picasso - a vector graphics library +# +# Copyright (C) 2024 Zhang Ji Peng +# Contact: onecoolx@gmail.com + +IF (WIN32) + add_compile_definitions(WIN32) + add_compile_definitions(DLL_EXPORT) + add_compile_definitions(ENABLE_FAST_COPY=1) + add_compile_definitions(ENABLE_SYSTEM_MALLOC=1) + add_compile_definitions(__SSE2__=1) +ELSEIF (UNIX AND NOT APPLE) + add_compile_definitions(ENABLE_FREE_TYPE2=1) + add_compile_definitions(ENABLE_FONT_CONFIG=1) +ELSEIF (APPLE) + add_compile_definitions(ENABLE_SYSTEM_MALLOC=1) +ENDIF() diff --git a/demos/demos.cmake b/demos/demos.cmake new file mode 100644 index 0000000..40a4ff6 --- /dev/null +++ b/demos/demos.cmake @@ -0,0 +1,27 @@ +# Picasso - a vector graphics library +# +# Copyright (C) 2024 Zhang Ji Peng +# Contact: onecoolx@gmail.com + +if (WIN32) +elseif (UNIX AND NOT APPLE) + find_package(GTK2 REQUIRED) + set(main_file ${PROJECT_ROOT}/demos/platform_gtk2.c) + set(main_gui_inc ${GTK2_INCLUDE_DIRS}) + set(main_gui_lib ${GTK2_LIBRARIES} pthread) +elseif (APPLE) +endif() + +set(DEMOS_SOURCES ${PROJECT_ROOT}/demos/clock.c + ${PROJECT_ROOT}/demos/flowers.c + ${PROJECT_ROOT}/demos/tiger.c + ${PROJECT_ROOT}/demos/subwaymap.c) + +foreach(demo_file ${DEMOS_SOURCES}) + get_filename_component(demo ${demo_file} NAME_WLE) + add_executable(${demo} ${demo_file} ${main_file}) + + include_directories(${demo} ${main_gui_inc}) + target_link_libraries(${demo} PRIVATE picasso PUBLIC ${main_gui_lib}) + +endforeach(demo_file ${DEMOS_SOURCES}) diff --git a/ext/ext.cmake b/ext/ext.cmake new file mode 100644 index 0000000..3d6ad0a --- /dev/null +++ b/ext/ext.cmake @@ -0,0 +1,7 @@ +# Picasso - a vector graphics library +# +# Copyright (C) 2024 Zhang Ji Peng +# Contact: onecoolx@gmail.com + +include (${CMAKE_CURRENT_LIST_DIR}/image_loader/image.cmake) + diff --git a/ext/image_loader/gif/gif.cmake b/ext/image_loader/gif/gif.cmake new file mode 100644 index 0000000..a6bcd32 --- /dev/null +++ b/ext/image_loader/gif/gif.cmake @@ -0,0 +1,21 @@ +# Picasso - a vector graphics library +# +# Copyright (C) 2024 Zhang Ji Peng +# Contact: onecoolx@gmail.com + +set(PXGIF_DIR ${PROJECT_ROOT}/ext/image_loader/gif) + +set(PXGIF_SOURCES + ${PXGIF_DIR}/../psx_image_io.h + ${PXGIF_DIR}/../psx_image_io.c + ${PXGIF_DIR}/gif_module.c +) + +add_definitions(-DEXPORT) +add_library(psxm_image_gif ${PXGIF_SOURCES}) +target_link_libraries(psxm_image_gif PRIVATE gif) + +set_target_properties(psxm_image_gif + PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/modules" +) diff --git a/ext/image_loader/image.cmake b/ext/image_loader/image.cmake new file mode 100644 index 0000000..b6600dc --- /dev/null +++ b/ext/image_loader/image.cmake @@ -0,0 +1,31 @@ +# Picasso - a vector graphics library +# +# Copyright (C) 2024 Zhang Ji Peng +# Contact: onecoolx@gmail.com + +set(PXIMG_DIR ${PROJECT_ROOT}/ext/image_loader) + +set(PXIMG_SOURCES + ${PXIMG_DIR}/psx_list.h + ${PXIMG_DIR}/psx_image_io.h + ${PXIMG_DIR}/psx_image_io.c + ${PXIMG_DIR}/psx_image_loader.h + ${PXIMG_DIR}/psx_image_loader.c + ${PXIMG_DIR}/psx_image_modules.h + ${PXIMG_DIR}/psx_image_modules.c +) + +add_definitions(-DEXPORT) +add_library(psx_image ${PXIMG_SOURCES}) + +include_directories(${PXIMG_DIR} ${PROJECT_ROOT}/include) +target_link_libraries(psx_image PRIVATE picasso PUBLIC dl) + +if (NOT APPLE) +include (${PXIMG_DIR}/png/png.cmake) +include (${PXIMG_DIR}/jpeg/jpeg.cmake) +include (${PXIMG_DIR}/gif/gif.cmake) +include (${PXIMG_DIR}/webp/webp.cmake) +else() +include (${PXIMG_DIR}/apple/apple.cmake) +endif() diff --git a/ext/image_loader/jpeg/jpeg.cmake b/ext/image_loader/jpeg/jpeg.cmake new file mode 100644 index 0000000..3e42cea --- /dev/null +++ b/ext/image_loader/jpeg/jpeg.cmake @@ -0,0 +1,21 @@ +# Picasso - a vector graphics library +# +# Copyright (C) 2024 Zhang Ji Peng +# Contact: onecoolx@gmail.com + +set(PXJPEG_DIR ${PROJECT_ROOT}/ext/image_loader/jpeg) + +set(PXJPEG_SOURCES + ${PXJPEG_DIR}/../psx_image_io.h + ${PXJPEG_DIR}/../psx_image_io.c + ${PXJPEG_DIR}/jpeg_module.c +) + +add_definitions(-DEXPORT) +add_library(psxm_image_jpeg ${PXJPEG_SOURCES}) +target_link_libraries(psxm_image_jpeg PRIVATE jpeg) + +set_target_properties(psxm_image_jpeg + PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/modules" +) diff --git a/ext/image_loader/png/png.cmake b/ext/image_loader/png/png.cmake new file mode 100644 index 0000000..cc69cb8 --- /dev/null +++ b/ext/image_loader/png/png.cmake @@ -0,0 +1,21 @@ +# Picasso - a vector graphics library +# +# Copyright (C) 2024 Zhang Ji Peng +# Contact: onecoolx@gmail.com + +set(PXPNG_DIR ${PROJECT_ROOT}/ext/image_loader/png) + +set(PXPNG_SOURCES + ${PXPNG_DIR}/../psx_image_io.h + ${PXPNG_DIR}/../psx_image_io.c + ${PXPNG_DIR}/png_module.c +) + +add_definitions(-DEXPORT) +add_library(psxm_image_png ${PXPNG_SOURCES}) +target_link_libraries(psxm_image_png PRIVATE png) + +set_target_properties(psxm_image_png + PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/modules" +) diff --git a/ext/image_loader/webp/webp.cmake b/ext/image_loader/webp/webp.cmake new file mode 100644 index 0000000..cf79bf6 --- /dev/null +++ b/ext/image_loader/webp/webp.cmake @@ -0,0 +1,21 @@ +# Picasso - a vector graphics library +# +# Copyright (C) 2024 Zhang Ji Peng +# Contact: onecoolx@gmail.com + +set(PXWEBP_DIR ${PROJECT_ROOT}/ext/image_loader/webp) + +set(PXWEBP_SOURCES + ${PXWEBP_DIR}/../psx_image_io.h + ${PXWEBP_DIR}/../psx_image_io.c + ${PXWEBP_DIR}/webp_module.c +) + +add_definitions(-DEXPORT) +add_library(psxm_image_webp ${PXWEBP_SOURCES}) +target_link_libraries(psxm_image_webp PRIVATE webp) + +set_target_properties(psxm_image_webp + PROPERTIES + LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/modules" +) diff --git a/include/picasso.h b/include/picasso.h index 72d6c87..f2e1a01 100644 --- a/include/picasso.h +++ b/include/picasso.h @@ -7,7 +7,7 @@ * \verbatim - Copyright (C) 2008 ~ 2018 Zhang Ji Peng + Copyright (C) 2008 ~ 2024 Zhang Ji Peng All rights reserved. @@ -1826,8 +1826,8 @@ PEXPORT void PICAPI ps_clip_rect(ps_context* ctx, const ps_rect* rect); /** * \fn void ps_scissor_rect(ps_context* ctx, const ps_rect* rect) - * \brief The fast way to clipping specified rectangle, the clip rect can not be rotated - * by world matrix. (Deprecated) + * \brief The fast way to clipping specified rectangle, the clip rect can not be transformed + * by world matrix. * * \param ctx Pointer to an existing context object. * \param rect The rectangle which will be clipped. diff --git a/src/src.cmake b/src/src.cmake new file mode 100644 index 0000000..bdcc4ba --- /dev/null +++ b/src/src.cmake @@ -0,0 +1,24 @@ +# Picasso - a vector graphics library +# +# Copyright (C) 2024 Zhang Ji Peng +# Contact: onecoolx@gmail.com + +file(GLOB_RECURSE SOURCES ${PROJECT_ROOT}/src/*.cpp) + +add_library(picasso ${SOURCES}) + +include_directories(${PROJECT_ROOT}/build + ${PROJECT_ROOT}/include + ${PROJECT_ROOT}/src/include + ${PROJECT_ROOT}/src + ${PROJECT_ROOT}/src/gfx + ${PROJECT_ROOT}/src/simd) + +IF (WIN32) +ELSEIF (UNIX AND NOT APPLE) + find_package(Freetype REQUIRED) + find_package(Fontconfig REQUIRED) + target_include_directories(picasso PRIVATE ${FREETYPE_INCLUDE_DIRS} ${FONTCONFIG_INCLUDE_DIRS}) + target_link_libraries(picasso PUBLIC Freetype::Freetype Fontconfig::Fontconfig) +ELSEIF (APPLE) +ENDIF() diff --git a/test/test.cmake b/test/test.cmake new file mode 100644 index 0000000..b3af02e --- /dev/null +++ b/test/test.cmake @@ -0,0 +1,50 @@ +# Picasso - a vector graphics library +# +# Copyright (C) 2024 Zhang Ji Peng +# Contact: onecoolx@gmail.com + + +file(GLOB_RECURSE TEST_SOURCES ${PROJECT_ROOT}/test/*_func.c) +file(GLOB_RECURSE IMAGE_SOURCES ${PROJECT_ROOT}/test/image_*.c) + +if (WIN32) +elseif (UNIX AND NOT APPLE) + find_package(GTK2 REQUIRED) + set(thread_file ${PROJECT_ROOT}/test/thr_posix.c) + set(main_file ${PROJECT_ROOT}/test/testGtk2.c) + set(host_gui_inc ${GTK2_INCLUDE_DIRS}) + set(host_gui_lib ${GTK2_LIBRARIES} pthread) + configure_file(${PROJECT_ROOT}/test/pat.png ${CMAKE_CURRENT_BINARY_DIR}/pat.png COPYONLY) + configure_file(${PROJECT_ROOT}/test/selt2.png ${CMAKE_CURRENT_BINARY_DIR}/selt2.png COPYONLY) +elseif (APPLE) +endif() + +foreach(test_file ${TEST_SOURCES}) + get_filename_component(test_name ${test_file} NAME_WLE) + string(REPLACE "_" ";" test_app ${test_name}) + list(GET test_app 0 test) + + if (${test} STREQUAL "thread") + add_executable(${test} ${test_file} ${main_file} ${thread_file}) + else() + add_executable(${test} ${test_file} ${main_file}) + endif() + + include_directories(${test} ${host_gui_inc}) + target_link_libraries(${test} PRIVATE picasso PUBLIC ${host_gui_lib}) + +endforeach(test_file ${TEST_SOURCES}) + +foreach(image_file ${IMAGE_SOURCES}) + get_filename_component(image_name ${image_file} NAME_WLE) + + if (${image_name} STREQUAL "image_info") + add_executable(${image_name} ${image_file}) + else() + add_executable(${image_name} ${image_file} ${main_file}) + endif() + + include_directories(${image_name} ${host_gui_inc}) + target_link_libraries(${image_name} PRIVATE picasso psx_image PUBLIC ${host_gui_lib}) + +endforeach(image_file ${IMAGE_SOURCES}) diff --git a/third_party/giflib.cmake b/third_party/giflib.cmake new file mode 100644 index 0000000..8c01869 --- /dev/null +++ b/third_party/giflib.cmake @@ -0,0 +1,27 @@ +# Picasso - a vector graphics library +# +# Copyright (C) 2024 Zhang Ji Peng +# Contact: onecoolx@gmail.com + +set(GIF_DIR ${PROJECT_ROOT}/third_party/giflib-5.1.3) + +set(GIF_SOURCES + ${GIF_DIR}/lib/gif_hash.h + ${GIF_DIR}/lib/gif_lib.h + ${GIF_DIR}/lib/gif_lib_private.h + ${GIF_DIR}/lib/dgif_lib.c + ${GIF_DIR}/lib/egif_lib.c + ${GIF_DIR}/lib/gif_err.c + ${GIF_DIR}/lib/gif_font.c + ${GIF_DIR}/lib/gif_hash.c + ${GIF_DIR}/lib/gifalloc.c + ${GIF_DIR}/lib/openbsd-reallocarray.c + ${GIF_DIR}/lib/quantize.c +) + +configure_file(${GIF_DIR}/lib/gif_lib.h ${CMAKE_CURRENT_BINARY_DIR}/include/gif_lib.h) + +add_library(gif ${GIF_SOURCES}) + +include_directories(${GIF_DIR} ${CMAKE_CURRENT_BINARY_DIR}/include) + diff --git a/third_party/libjpeg.cmake b/third_party/libjpeg.cmake new file mode 100644 index 0000000..ed1ebcb --- /dev/null +++ b/third_party/libjpeg.cmake @@ -0,0 +1,72 @@ +# Picasso - a vector graphics library +# +# Copyright (C) 2024 Zhang Ji Peng +# Contact: onecoolx@gmail.com + +set(JPEG_DIR ${PROJECT_ROOT}/third_party/libjpeg-turbo-1.4.1) + +set(JPEG_SOURCES + ${JPEG_DIR}/jcapimin.c + ${JPEG_DIR}/jcapistd.c + ${JPEG_DIR}/jccoefct.c + ${JPEG_DIR}/jccolor.c + ${JPEG_DIR}/jcdctmgr.c + ${JPEG_DIR}/jchuff.c + ${JPEG_DIR}/jcinit.c + ${JPEG_DIR}/jcmainct.c + ${JPEG_DIR}/jcmarker.c + ${JPEG_DIR}/jcmaster.c + ${JPEG_DIR}/jcomapi.c + ${JPEG_DIR}/jcparam.c + ${JPEG_DIR}/jcphuff.c + ${JPEG_DIR}/jcprepct.c + ${JPEG_DIR}/jcsample.c + ${JPEG_DIR}/jctrans.c + ${JPEG_DIR}/jdapimin.c + ${JPEG_DIR}/jdapistd.c + ${JPEG_DIR}/jdatadst.c + ${JPEG_DIR}/jdatasrc.c + ${JPEG_DIR}/jdcoefct.c + ${JPEG_DIR}/jdcolor.c + ${JPEG_DIR}/jddctmgr.c + ${JPEG_DIR}/jdhuff.c + ${JPEG_DIR}/jdinput.c + ${JPEG_DIR}/jdmainct.c + ${JPEG_DIR}/jdmarker.c + ${JPEG_DIR}/jdmaster.c + ${JPEG_DIR}/jdmerge.c + ${JPEG_DIR}/jdphuff.c + ${JPEG_DIR}/jdpostct.c + ${JPEG_DIR}/jdsample.c + ${JPEG_DIR}/jdtrans.c + ${JPEG_DIR}/jerror.c + ${JPEG_DIR}/jfdctflt.c + ${JPEG_DIR}/jfdctfst.c + ${JPEG_DIR}/jfdctint.c + ${JPEG_DIR}/jidctflt.c + ${JPEG_DIR}/jidctfst.c + ${JPEG_DIR}/jidctint.c + ${JPEG_DIR}/jidctred.c + ${JPEG_DIR}/jquant1.c + ${JPEG_DIR}/jquant2.c + ${JPEG_DIR}/jutils.c + ${JPEG_DIR}/jmemmgr.c + ${JPEG_DIR}/jmemnobs.c + ${JPEG_DIR}/jaricom.c + ${JPEG_DIR}/jcarith.c + ${JPEG_DIR}/jdarith.c + ${JPEG_DIR}/turbojpeg.c + ${JPEG_DIR}/transupp.c + ${JPEG_DIR}/jdatadst-tj.c + ${JPEG_DIR}/jdatasrc-tj.c + ${JPEG_DIR}/jsimd_none.c +) + +configure_file(${JPEG_DIR}/build/jconfig.h ${CMAKE_CURRENT_BINARY_DIR}/include/jconfig.h) +configure_file(${JPEG_DIR}/jmorecfg.h ${CMAKE_CURRENT_BINARY_DIR}/include/jmorecfg.h) +configure_file(${JPEG_DIR}/jpeglib.h ${CMAKE_CURRENT_BINARY_DIR}/include/jpeglib.h) + +add_library(jpeg ${JPEG_SOURCES}) + +include_directories(${JPEG_DIR} ${JPEG_DIR}/build ${JPEG_DIR}/simd ${CMAKE_CURRENT_BINARY_DIR}/include) + diff --git a/third_party/libpng.cmake b/third_party/libpng.cmake new file mode 100644 index 0000000..80f4911 --- /dev/null +++ b/third_party/libpng.cmake @@ -0,0 +1,35 @@ +# Picasso - a vector graphics library +# +# Copyright (C) 2024 Zhang Ji Peng +# Contact: onecoolx@gmail.com + +set(PNG_DIR ${PROJECT_ROOT}/third_party/libpng-1.6.17) + +set(PNG_SOURCES + ${PNG_DIR}/png.c + ${PNG_DIR}/pngerror.c + ${PNG_DIR}/pngget.c + ${PNG_DIR}/pngmem.c + ${PNG_DIR}/pngpread.c + ${PNG_DIR}/pngread.c + ${PNG_DIR}/pngrio.c + ${PNG_DIR}/pngrtran.c + ${PNG_DIR}/pngrutil.c + ${PNG_DIR}/pngset.c + ${PNG_DIR}/pngtrans.c + ${PNG_DIR}/pngwio.c + ${PNG_DIR}/pngwrite.c + ${PNG_DIR}/pngwtran.c + ${PNG_DIR}/pngwutil.c +) + +add_definitions(-DZLIB_DLL) +configure_file(${PNG_DIR}/scripts/pnglibconf.h.prebuilt ${CMAKE_CURRENT_BINARY_DIR}/include/pnglibconf.h) +configure_file(${PNG_DIR}/pngconf.h ${CMAKE_CURRENT_BINARY_DIR}/include/pngconf.h) +configure_file(${PNG_DIR}/png.h ${CMAKE_CURRENT_BINARY_DIR}/include/png.h) + +add_library(png ${PNG_SOURCES}) + +include_directories(${PNG_DIR} ${CMAKE_CURRENT_BINARY_DIR}/include) +target_link_libraries(png PRIVATE zlib) + diff --git a/third_party/libwebp.cmake b/third_party/libwebp.cmake new file mode 100644 index 0000000..91e17d2 --- /dev/null +++ b/third_party/libwebp.cmake @@ -0,0 +1,167 @@ +# Picasso - a vector graphics library +# +# Copyright (C) 2024 Zhang Ji Peng +# Contact: onecoolx@gmail.com + +set(WEBP_DIR ${PROJECT_ROOT}/third_party/libwebp-0.5.1) + +set(WEBP_SOURCES + ${WEBP_DIR}/src/dec/alpha.c + ${WEBP_DIR}/src/dec/buffer.c + ${WEBP_DIR}/src/dec/frame.c + ${WEBP_DIR}/src/dec/idec.c + ${WEBP_DIR}/src/dec/io.c + ${WEBP_DIR}/src/dec/quant.c + ${WEBP_DIR}/src/dec/tree.c + ${WEBP_DIR}/src/dec/vp8.c + ${WEBP_DIR}/src/dec/vp8l.c + ${WEBP_DIR}/src/dec/webp.c + ${WEBP_DIR}/src/demux/anim_decode.c + ${WEBP_DIR}/src/demux/demux.c + ${WEBP_DIR}/src/dsp/alpha_processing.c + ${WEBP_DIR}/src/dsp/alpha_processing_mips_dsp_r2.c + ${WEBP_DIR}/src/dsp/alpha_processing_sse2.c + ${WEBP_DIR}/src/dsp/alpha_processing_sse41.c + ${WEBP_DIR}/src/dsp/cpu.c + ${WEBP_DIR}/src/dsp/dec.c + ${WEBP_DIR}/src/dsp/dec_clip_tables.c + ${WEBP_DIR}/src/dsp/dec_mips32.c + ${WEBP_DIR}/src/dsp/dec_mips_dsp_r2.c + ${WEBP_DIR}/src/dsp/dec_msa.c + ${WEBP_DIR}/src/dsp/dec_neon.c + ${WEBP_DIR}/src/dsp/dec_sse2.c + ${WEBP_DIR}/src/dsp/dec_sse41.c + ${WEBP_DIR}/src/dsp/dfilters.c + ${WEBP_DIR}/src/dsp/filters_mips_dsp_r2.c + ${WEBP_DIR}/src/dsp/filters_sse2.c + ${WEBP_DIR}/src/dsp/lossless.c + ${WEBP_DIR}/src/dsp/lossless_mips_dsp_r2.c + ${WEBP_DIR}/src/dsp/lossless_neon.c + ${WEBP_DIR}/src/dsp/lossless_sse2.c + ${WEBP_DIR}/src/dsp/drescaler.c + ${WEBP_DIR}/src/dsp/rescaler_mips32.c + ${WEBP_DIR}/src/dsp/rescaler_mips_dsp_r2.c + ${WEBP_DIR}/src/dsp/rescaler_neon.c + ${WEBP_DIR}/src/dsp/rescaler_sse2.c + ${WEBP_DIR}/src/dsp/upsampling.c + ${WEBP_DIR}/src/dsp/upsampling_mips_dsp_r2.c + ${WEBP_DIR}/src/dsp/upsampling_neon.c + ${WEBP_DIR}/src/dsp/upsampling_sse2.c + ${WEBP_DIR}/src/dsp/yuv.c + ${WEBP_DIR}/src/dsp/yuv_mips32.c + ${WEBP_DIR}/src/dsp/yuv_mips_dsp_r2.c + ${WEBP_DIR}/src/dsp/yuv_sse2.c + ${WEBP_DIR}/src/dsp/argb.c + ${WEBP_DIR}/src/dsp/argb_mips_dsp_r2.c + ${WEBP_DIR}/src/dsp/argb_sse2.c + ${WEBP_DIR}/src/dsp/dcost.c + ${WEBP_DIR}/src/dsp/cost_mips32.c + ${WEBP_DIR}/src/dsp/cost_mips_dsp_r2.c + ${WEBP_DIR}/src/dsp/cost_sse2.c + ${WEBP_DIR}/src/dsp/enc.c + ${WEBP_DIR}/src/dsp/enc_avx2.c + ${WEBP_DIR}/src/dsp/enc_mips32.c + ${WEBP_DIR}/src/dsp/enc_mips_dsp_r2.c + ${WEBP_DIR}/src/dsp/enc_neon.c + ${WEBP_DIR}/src/dsp/enc_sse2.c + ${WEBP_DIR}/src/dsp/enc_sse41.c + ${WEBP_DIR}/src/dsp/lossless_enc.c + ${WEBP_DIR}/src/dsp/lossless_enc_mips32.c + ${WEBP_DIR}/src/dsp/lossless_enc_mips_dsp_r2.c + ${WEBP_DIR}/src/dsp/lossless_enc_neon.c + ${WEBP_DIR}/src/dsp/lossless_enc_sse2.c + ${WEBP_DIR}/src/dsp/lossless_enc_sse41.c + ${WEBP_DIR}/src/enc/ealpha.c + ${WEBP_DIR}/src/enc/analysis.c + ${WEBP_DIR}/src/enc/backward_references.c + ${WEBP_DIR}/src/enc/config.c + ${WEBP_DIR}/src/enc/cost.c + ${WEBP_DIR}/src/enc/delta_palettization.c + ${WEBP_DIR}/src/enc/filter.c + ${WEBP_DIR}/src/enc/eframe.c + ${WEBP_DIR}/src/enc/histogram.c + ${WEBP_DIR}/src/enc/iterator.c + ${WEBP_DIR}/src/enc/near_lossless.c + ${WEBP_DIR}/src/enc/picture.c + ${WEBP_DIR}/src/enc/picture_csp.c + ${WEBP_DIR}/src/enc/picture_psnr.c + ${WEBP_DIR}/src/enc/picture_rescale.c + ${WEBP_DIR}/src/enc/picture_tools.c + ${WEBP_DIR}/src/enc/equant.c + ${WEBP_DIR}/src/enc/syntax.c + ${WEBP_DIR}/src/enc/token.c + ${WEBP_DIR}/src/enc/etree.c + ${WEBP_DIR}/src/enc/evp8l.c + ${WEBP_DIR}/src/enc/webpenc.c + ${WEBP_DIR}/src/mux/anim_encode.c + ${WEBP_DIR}/src/mux/muxedit.c + ${WEBP_DIR}/src/mux/muxinternal.c + ${WEBP_DIR}/src/mux/muxread.c + ${WEBP_DIR}/src/utils/bit_reader.c + ${WEBP_DIR}/src/utils/color_cache.c + ${WEBP_DIR}/src/utils/filters.c + ${WEBP_DIR}/src/utils/huffman.c + ${WEBP_DIR}/src/utils/quant_levels_dec.c + ${WEBP_DIR}/src/utils/random.c + ${WEBP_DIR}/src/utils/rescaler.c + ${WEBP_DIR}/src/utils/thread.c + ${WEBP_DIR}/src/utils/utils.c + ${WEBP_DIR}/src/utils/bit_writer.c + ${WEBP_DIR}/src/utils/huffman_encode.c + ${WEBP_DIR}/src/utils/quant_levels.c + ${WEBP_DIR}/src/extras/extras.c + ${WEBP_DIR}/src/dec/alphai.h + ${WEBP_DIR}/src/dec/common.h + ${WEBP_DIR}/src/dec/decode_vp8.h + ${WEBP_DIR}/src/dec/vp8i.h + ${WEBP_DIR}/src/dec/vp8li.h + ${WEBP_DIR}/src/dec/webpi.h + ${WEBP_DIR}/src/dsp/common_sse2.h + ${WEBP_DIR}/src/dsp/dsp.h + ${WEBP_DIR}/src/dsp/lossless.h + ${WEBP_DIR}/src/dsp/mips_macro.h + ${WEBP_DIR}/src/dsp/msa_macro.h + ${WEBP_DIR}/src/dsp/neon.h + ${WEBP_DIR}/src/dsp/yuv.h + ${WEBP_DIR}/src/enc/backward_references.h + ${WEBP_DIR}/src/enc/cost.h + ${WEBP_DIR}/src/enc/delta_palettization.h + ${WEBP_DIR}/src/enc/histogram.h + ${WEBP_DIR}/src/enc/vp8enci.h + ${WEBP_DIR}/src/enc/vp8li.h + ${WEBP_DIR}/src/mux/muxi.h + ${WEBP_DIR}/src/utils/bit_reader.h + ${WEBP_DIR}/src/utils/bit_reader_inl.h + ${WEBP_DIR}/src/utils/bit_writer.h + ${WEBP_DIR}/src/utils/color_cache.h + ${WEBP_DIR}/src/utils/endian_inl.h + ${WEBP_DIR}/src/utils/filters.h + ${WEBP_DIR}/src/utils/huffman.h + ${WEBP_DIR}/src/utils/huffman_encode.h + ${WEBP_DIR}/src/utils/quant_levels.h + ${WEBP_DIR}/src/utils/quant_levels_dec.h + ${WEBP_DIR}/src/utils/random.h + ${WEBP_DIR}/src/utils/rescaler.h + ${WEBP_DIR}/src/utils/thread.h + ${WEBP_DIR}/src/utils/utils.h + ${WEBP_DIR}/src/webp/format_constants.h + ${WEBP_DIR}/src/webp/decode.h + ${WEBP_DIR}/src/webp/demux.h + ${WEBP_DIR}/src/webp/encode.h + ${WEBP_DIR}/src/webp/mux.h + ${WEBP_DIR}/src/webp/mux_types.h + ${WEBP_DIR}/src/webp/types.h +) + +add_definitions(-DWEBP_USE_THREAD) + +file(GLOB_RECURSE WEBP_HEADERS ${WEBP_DIR}/src/webp/*.h) +foreach(webp_header ${WEBP_HEADERS}) + get_filename_component(header_name ${webp_header} NAME) + configure_file(${webp_header} ${CMAKE_CURRENT_BINARY_DIR}/include/webp/${header_name}) +endforeach(webp_header ${WEBP_HEADERS}) + +add_library(webp ${WEBP_SOURCES}) + +include_directories(${WEBP_DIR} ${CMAKE_CURRENT_BINARY_DIR}/include) + diff --git a/third_party/third_party.cmake b/third_party/third_party.cmake new file mode 100644 index 0000000..86c84d0 --- /dev/null +++ b/third_party/third_party.cmake @@ -0,0 +1,12 @@ +# Picasso - a vector graphics library +# +# Copyright (C) 2024 Zhang Ji Peng +# Contact: onecoolx@gmail.com + +if (NOT APPLE) +include (${CMAKE_CURRENT_LIST_DIR}/zlib.cmake) +include (${CMAKE_CURRENT_LIST_DIR}/libpng.cmake) +include (${CMAKE_CURRENT_LIST_DIR}/libjpeg.cmake) +include (${CMAKE_CURRENT_LIST_DIR}/giflib.cmake) +include (${CMAKE_CURRENT_LIST_DIR}/libwebp.cmake) +endif() diff --git a/third_party/zlib.cmake b/third_party/zlib.cmake new file mode 100644 index 0000000..d607e89 --- /dev/null +++ b/third_party/zlib.cmake @@ -0,0 +1,29 @@ +# Picasso - a vector graphics library +# +# Copyright (C) 2024 Zhang Ji Peng +# Contact: onecoolx@gmail.com + +set(ZLIB_DIR ${PROJECT_ROOT}/third_party/zlib-1.2.8) + +set(ZLIB_SOURCES + ${ZLIB_DIR}/adler32.c + ${ZLIB_DIR}/compress.c + ${ZLIB_DIR}/crc32.c + ${ZLIB_DIR}/deflate.c + ${ZLIB_DIR}/infback.c + ${ZLIB_DIR}/inffast.c + ${ZLIB_DIR}/inflate.c + ${ZLIB_DIR}/inftrees.c + ${ZLIB_DIR}/trees.c + ${ZLIB_DIR}/uncompr.c + ${ZLIB_DIR}/zutil.c +) + +add_definitions(-DZLIB_DLL) +configure_file(${ZLIB_DIR}/zconf.h ${CMAKE_CURRENT_BINARY_DIR}/include/zconf.h) +configure_file(${ZLIB_DIR}/zlib.h ${CMAKE_CURRENT_BINARY_DIR}/include/zlib.h) + +add_library(zlib ${ZLIB_SOURCES}) + +include_directories(${ZLIB_DIR} ${CMAKE_CURRENT_BINARY_DIR}/include) +