-
Notifications
You must be signed in to change notification settings - Fork 1
/
CMakeLists.txt
62 lines (56 loc) · 2.24 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
cmake_minimum_required(VERSION 2.8.12)
project(kwebp)
list(APPEND KWEBP_SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/access.c
${CMAKE_CURRENT_SOURCE_DIR}/src/main.c
${CMAKE_CURRENT_SOURCE_DIR}/src/push_gate.c
${CMAKE_CURRENT_SOURCE_DIR}/src/upstream.c
${CMAKE_CURRENT_SOURCE_DIR}/src/vary.c
${CMAKE_CURRENT_SOURCE_DIR}/src/webp_encode.c
${CMAKE_CURRENT_SOURCE_DIR}/src/unix_encode.c
)
if (CMAKE_SYSTEM_NAME MATCHES "Windows")
list(APPEND KWEBP_LIBS "windowscodecs")
list(APPEND KWEBP_SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/win_encode.c
)
else()
# list(APPEND KWEBP_LIBS "webp")
list(APPEND KWEBP_SOURCE_FILES
${CMAKE_CURRENT_SOURCE_DIR}/src/gifdec.c
${CMAKE_CURRENT_SOURCE_DIR}/src/gif2webp.c
)
option(LIBWEBP_DIR "set libwebp dir")
list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBWEBP_DIR})
list(APPEND KWEBP_LIBS imagedec jpeg png tiff webpdemux imageioutil)
list(APPEND KWEB_LIBS_DIR ${LIBWEBP_DIR}/build)
endif()
option(KANGLE_DIR "set kangle dir")
#option(LIBWEBP_DIR "set libwebp dir")
list(APPEND CMAKE_REQUIRED_INCLUDES ${KANGLE_DIR}/include)
list(APPEND CMAKE_REQUIRED_INCLUDES ${KANGLE_DIR}/kasync/include)
list(APPEND CMAKE_REQUIRED_INCLUDES ${KANGLE_DIR}/khttpd/include)
#list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBWEBP_DIR})
#list(APPEND CMAKE_REQUIRED_INCLUDES ${LIBWEBP_DIR}/src)
include(CheckIncludeFiles)
check_include_files("ksapi.h;kfeature.h;kforwin32.h" FOUND_KSAPI_HEADER)
if (NOT FOUND_KSAPI_HEADER)
message(FATAL_ERROR "cann't found ksapi.h. try cmake -DKANGLE_DIR=kangle_dir ${CMAKE_REQUIRED_INCLUDES}")
endif()
find_package(WebP)
message(STATUS "libwebp version ${WEBP_VERSION}")
list(APPEND KWEBP_LIBS WebP::webp)
add_library(kwebp MODULE ${KWEBP_SOURCE_FILES})
set_property(TARGET kwebp PROPERTY PREFIX "")
target_include_directories(kwebp PUBLIC ${CMAKE_REQUIRED_INCLUDES} ${WEBP_INCLUDE_DIRS})
target_link_directories(kwebp PUBLIC ${KWEB_LIBS_DIR})
target_link_libraries(kwebp ${KWEBP_LIBS} )
#message(STATUS "link libs ${KWEBP_LIBS}")
set(CMAKE_INSTALL_PREFIX ${KANGLE_DIR})
install(TARGETS kwebp LIBRARY DESTINATION bin)
install(DIRECTORY
${CMAKE_CURRENT_SOURCE_DIR}/ext/
DESTINATION "ext"
)
include(CPack)
set(CPACK_PACKAGE_NAME "kwebp")