Cdroid/cmake/options.cmake

167 lines
5.3 KiB
CMake
Raw Normal View History

2021-06-24 10:12:55 +08:00
option(MINIMAL_SIZE_OPTIMIZED "For IOT/Embedded size optimize" OFF)
option(BUILD_EXAMPLES "Build examples" ON)
2023-09-18 08:33:15 +08:00
option(BUILD_APPS "Build cdroid custom apps" ON)
option(BUILD_CDROID_TESTS "Build unit tests" ON)
2021-06-24 10:12:55 +08:00
2023-10-27 11:33:43 +08:00
option(ENABLE_GIF "enable gif encode and decoder" ON)
option(ENABLE_JPEG "enable jpeg decoder" OFF)
2024-04-07 11:13:01 +08:00
option(ENABLE_WEBP "enable webp decoder" ON)
2021-06-24 10:12:55 +08:00
option(ENABLE_CAIROSVG "enable svg decoder" OFF)
2022-11-26 23:21:07 +08:00
option(ENABLE_MBEDTLS "enable mbedtls" ON)
2022-02-20 19:54:12 +08:00
option(ENABLE_PLPLOT "Enable PLPLot" OFF)
option(ENABLE_DTV "DTV modules support" OFF)
2022-02-20 19:54:12 +08:00
option(FT_WITH_HARFBUZZ "Improve auto-hinting of OpenType fonts." ON)
2021-06-24 10:12:55 +08:00
2023-04-21 08:49:04 +08:00
option(ENABLE_PINYIN2HZ "Chinese Pinyin to HZ support" ON)
2021-06-24 10:12:55 +08:00
2022-11-26 23:21:07 +08:00
set(CMAKE_USE_OPENSSL ON)
set(ENABLE_IPV6 OFF)#for CURL
2021-06-24 10:12:55 +08:00
if(ENABLE_GIF)
find_package(GIF REQUIRED)
list(APPEND CDROID_DEPLIBS ${GIF_LIBRARIES})
list(APPEND OPTIONAL_LIBS ${GIF_LIBRARIES})
list(APPEND CDROID_DEPINCLUDES ${GIF_INCLUDE_DIRS})
2021-06-24 10:12:55 +08:00
endif()
2024-04-07 11:13:01 +08:00
if(ENABLE_WEBP)
find_package(WEBP)
list(APPEND CDROID_DEPLIBS ${WEBP_LIBRARIES})
list(APPEND OPTIONAL_LIBS ${WEBP_LIBRARIES})
list(APPEND CDROID_DEPINCLUDES ${WEBP_INCLUDE_DIRS})
endif()
find_package(PNG REQUIRED)
find_package(JPEG REQUIRED)
#find_package(TurboJPEG)
2022-11-29 19:02:11 +08:00
find_package(ZLIB REQUIRED)
find_package(ZIP REQUIRED)
find_package(Freetype2 REQUIRED)
find_package(EXPAT REQUIRED)
find_package(Pixman REQUIRED)
find_package(Cairo REQUIRED)
2023-09-27 15:50:16 +08:00
#find_package(MBEDTLS)
2024-03-14 11:28:44 +08:00
find_package(LUNASVG)
2023-10-27 11:33:43 +08:00
find_package(OpenSSL)
2022-11-29 19:02:11 +08:00
find_package(Fontconfig REQUIRED)
2023-09-18 11:27:10 +08:00
find_package(Brotli)
2023-09-18 09:05:57 +08:00
find_package(BZip2)
2022-11-30 17:11:10 +08:00
find_package(UniBreak REQUIRED)
2023-04-20 14:20:15 +08:00
find_package(litehtml CONFIG)
find_package(PLPLOT)
2023-04-17 22:36:30 +08:00
find_package(zint CONFIG) #barcode generater
2024-05-09 09:21:17 +08:00
find_package(Fribidi)
2023-01-06 14:10:56 +08:00
list(APPEND CDROID_DEPLIBS
${CAIRO_LIBRARIES}
${PIXMAN_LIBRARIES}
2022-11-30 17:11:10 +08:00
${FONTCONFIG_LIBRARIES}
${FREETYPE2_LIBRARIES}
2022-12-07 09:30:22 +08:00
${ZIP_LIBRARIES}
2023-01-06 15:23:44 +08:00
${PNG_LIBRARIES}
${EXPAT_LIBRARIES}
2022-12-07 09:30:22 +08:00
${ZLIB_LIBRARIES}
2023-01-06 15:23:44 +08:00
${UNIBREAK_LIBRARIES}
)
2023-09-18 11:27:10 +08:00
if ( BROTLIDEC_FOUND )
#list(APPEND CDROID_DEPLIBS ${BROTLIDEC_LIBRARIES})
endif()
2023-09-18 09:05:57 +08:00
if (BZIP2_FOUND)
list(APPEND CDROID_DEPLIBS ${BZIP2_LIBRARIES})
endif()
2023-03-16 16:18:31 +08:00
if (TURBOJPEG_FOUND)
add_definitions(-DENABLE_TURBOJPEG=1)
list(APPEND CDROID_DEPLIBS ${TURBOJPEG_LIBRARIES})
2023-09-18 08:33:15 +08:00
list(APPEND CDROID_DEPINCLUDES ${TURBOJPEG_INCLUDE_DIRS})
endif()
if(JPEG_FOUND)
add_definitions(-DENABLE_JPEG=1)
list(APPEND CDROID_DEPLIBS ${JPEG_LIBRARIES})
2023-09-18 08:33:15 +08:00
list(APPEND CDROID_DEPINCLUDES ${JPEG_INCLUDE_DIRSS})
2023-03-16 16:18:31 +08:00
endif()
2023-04-17 22:36:30 +08:00
if (litehtml_FOUND)
list( APPEND CDROID_DEPLIBS litehtml)
#list(APPEND CDROID_DEPINCLUDES ${LITEHTML_INCLUDE_DIRS})
add_definitions(-DENABLE_LITEHTML=1)
endif()
if (PLPLOT_FOUND)
list( APPEND CDROID_DEPLIBS ${PLPLOT_LIBRARIES})
list(APPEND CDROID_DEPINCLUDES ${PLPLOT_INCLUDE_DIRS})
add_definitions(-DENABLE_PLPLOT=1)
endif()
2023-04-17 22:36:30 +08:00
if (zint_FOUND)
list( APPEND CDROID_DEPLIBS zint::zint)
#list(APPEND CDROID_DEPINCLUDES ${ZINT_INCLUDE_DIRS})
add_definitions(-DENABLE_BARCODE=1)
endif()
2024-05-09 09:21:17 +08:00
if(ENABLE_FRIBIDI OR FRIBIDI_FOUND)
2022-12-07 09:30:22 +08:00
find_package(Fribidi REQUIRED)
list(APPEND CDROID_DEPINCLUDES ${FRIBIDI_INCLUDE_DIRS})
2022-12-07 09:30:22 +08:00
list(APPEND CDROID_DEPLIBS ${FRIBIDI_LIBRARIES})
2024-05-09 09:21:17 +08:00
add_definitions(-DENABLE_FRIBIDI=1)
set(ENABLE_FRIBIDI ON)
2022-12-07 09:30:22 +08:00
endif(ENABLE_FRIBIDI)
2023-01-06 15:23:44 +08:00
list(APPEND CDROID_DEPINCLUDES
${PNG_INCLUDE_DIRS}
${ZIP_INCLUDE_DIRS}
${EXPAT_INCLUDE_DIRS}
${CAIRO_INCLUDE_DIRS}
${CAIRO_INCLUDE_DIRS}/cairo
${PIXMAN_INCLUDE_DIRS}
)
2022-12-12 16:24:10 +08:00
if(BROTLI_FOUND)
list(APPEND CDROID_DEPLIBS ${BROTLIDEC_LIBRARIES})
list(APPEND CDROID_DEPINCLUDES ${BROTLI_INCLUDE_DIRS})
endif(BROTLI_FOUND)
if(OPENSSL_FOUND)
list(APPEND CDROID_DEPINCLUDES ${OPENSSL_INCLUDE_DIRS})
list(APPEND CDROID_DEPLIBS ${OPENSSL_LIBRARIES})
elseif(MBEDTLS_FOUND)
list(APPEND CDROID_DEPINCLUDES ${MBEDTLS_INCLUDE_DIRS})
list(APPEND CDROID_DEPLIBS ${MBEDTLS_LIBRARIES})
endif(OPENSSL_FOUND)
message("CDROID_DEPLIBS=${CDROID_DEPLIBS}")
2021-12-28 16:30:28 +08:00
2021-06-24 10:12:55 +08:00
if(ENABLE_PINYIN2HZ)
2024-06-19 16:13:26 +08:00
list(APPEND OPTIONAL_LIBS pinyin)
list(APPEND CDROID_DEPLIBS pinyin)
list(APPEND CDROID_DEPINCLUDES ${CMAKE_SOURCE_DIR}/src/3rdparty/pinyin/include)
2021-06-24 10:12:55 +08:00
endif()
if(EXISTS "${CMAKE_SOURCE_DIR}/src/gui/gui_features.h.cmake")
2024-06-19 16:13:26 +08:00
configure_file(src/gui/gui_features.h.cmake ${CMAKE_BINARY_DIR}/include/gui/gui_features.h)
configure_file(src/gui/gui_features.h.cmake ${CMAKE_SOURCE_DIR}/src/gui/gui_features.h)
2021-06-24 10:12:55 +08:00
endif()
2022-03-07 12:08:16 +08:00
set(SKIP_INSTALL_EXPORT TRUE)
2023-09-08 09:12:03 +08:00
if(NOT VCPKG_TARGET_TRIPLET)
foreach(lib ${CDROID_DEPLIBS})
get_filename_component(libpath ${lib} DIRECTORY)
set(linkdone FALSE)
while(NOT linkdone AND EXISTS ${lib})
execute_process( COMMAND readlink ${lib} OUTPUT_VARIABLE linkfile OUTPUT_STRIP_TRAILING_WHITESPACE)
get_filename_component(libname ${lib} NAME)
get_filename_component(linkpath "${linkfile}" DIRECTORY)
get_filename_component(linkname "${linkfile}" NAME)
if("${linkpath}" STREQUAL "")
set(linkpath ${libpath})
endif()
if("${linkfile}" STREQUAL "")
install(FILES ${lib} DESTINATION lib)
else()
get_filename_component(fromfile ${linkfile} NAME)
install(CODE "execute_process(COMMAND ${CMAKE_COMMAND} -E create_symlink
${fromfile} ${libname} WORKING_DIRECTORY ${CMAKE_BINARY_DIR}/lib)")
endif("${linkfile" STREQUAL "")
set(lib ${linkpath}/${linkname})
if("${linkfile}" STREQUAL "")
set(linkdone TRUE)
endif()
endwhile()
endforeach(lib ${CDROID_DEPLIBS})
2023-09-08 09:12:03 +08:00
endif(NOT VCPKG_TARGET_TRIPLET)