forked from chmorgan/libesphttpd
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
86 lines (67 loc) · 3.04 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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
cmake_minimum_required(VERSION 3.2.2)
include(CheckCCompilerFlag)
function(enable_c_compiler_flag_if_supported flag)
string(FIND "${CMAKE_C_FLAGS}" "${flag}" flag_already_set)
if(flag_already_set EQUAL -1)
check_c_compiler_flag("${flag}" flag_supported)
if(flag_supported)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${flag}" PARENT_SCOPE)
endif()
endif()
endfunction()
enable_c_compiler_flag_if_supported("-Wall")
enable_c_compiler_flag_if_supported("-Werror")
# Enable when heatshink fallthrough bug is fixed, see https://github.com/atomicobject/heatshrink/pull/46
#enable_c_compiler_flag_if_supported("-Wextra")
add_library(esphttpd
core/auth.c
core/base64.c
core/httpdespfs.c
core/httpd.c
core/httpd-freertos.c
core/sha1.c
core/linux/esp_log.c
espfs/espfs.c
util/cgiwebsocket.c
util/cgiredirect.c
)
set(ENABLE_SSL_SUPPORT 1)
if(ENABLE_SSL_SUPPORT)
target_compile_definitions(esphttpd PUBLIC "CONFIG_ESPHTTPD_SSL_SUPPORT=1")
endif()
target_compile_definitions(esphttpd PUBLIC "CONFIG_LOG_DEFAULT_LEVEL=ESP_LOG_INFO")
target_compile_definitions(esphttpd PUBLIC "CONFIG_ESPHTTPD_SO_REUSEADDR")
target_compile_definitions(esphttpd PUBLIC "CONFIG_ESPHTTPD_SHUTDOWN_SUPPORT")
target_include_directories(esphttpd PUBLIC "core")
target_include_directories(esphttpd PUBLIC "include")
target_include_directories(esphttpd PUBLIC "espfs")
target_include_directories(esphttpd PUBLIC "include/linux")
add_executable(mkespfsimage
espfs/mkespfsimage/main.c
espfs/mkespfsimage/heatshrink_encoder.c
)
find_package(ZLIB REQUIRED)
target_link_libraries(mkespfsimage ${ZLIB_LIBRARIES})
if(ENABLE_SSL_SUPPORT)
find_package(OpenSSL REQUIRED)
target_link_libraries(esphttpd ${OPENSSL_LIBRARIES})
include_directories(${OPENSSL_INCLUDE_DIRS})
endif()
target_compile_definitions(mkespfsimage PUBLIC "ESPFS_HEATSHRINK=1")
target_compile_definitions(mkespfsimage PUBLIC "ESPFS_GZIP=1")
target_include_directories(mkespfsimage PUBLIC "include")
target_include_directories(mkespfsimage PUBLIC "espfs")
target_include_directories(mkespfsimage PUBLIC "lib/heatshrink")
install(TARGETS esphttpd DESTINATION lib)
install(TARGETS mkespfsimage DESTINATION bin)
install(FILES include/libesphttpd/httpd.h DESTINATION include/libesphttpd)
install(FILES include/libesphttpd/httpd-freertos.h DESTINATION include/libesphttpd)
install(FILES include/libesphttpd/cgiwebsocket.h DESTINATION include/libesphttpd)
install(FILES include/libesphttpd/cgiredirect.h DESTINATION include/libesphttpd)
install(FILES include/libesphttpd/httpdespfs.h DESTINATION include/libesphttpd)
install(FILES include/libesphttpd/linux.h DESTINATION include/libesphttpd)
install(FILES include/libesphttpd/platform.h DESTINATION include/libesphttpd)
install(FILES include/libesphttpd/route.h DESTINATION include/libesphttpd)
install(FILES include/libesphttpd/espfs.h DESTINATION include/libesphttpd)
install(FILES include/libesphttpd/webpages-espfs.h DESTINATION include/libesphttpd)
install(FILES include/libesphttpd/esp.h DESTINATION include/libesphttpd)