comparison OrthancFramework/Resources/CMake/CivetwebConfiguration.cmake @ 4259:5227df2a650f

upgrade to civetweb 1.13
author Sebastien Jodogne <s.jodogne@gmail.com>
date Tue, 27 Oct 2020 13:29:23 +0100
parents c8c0bbaaace3
children 4c91fbede7d2
comparison
equal deleted inserted replaced
4258:6f5d4bfb2c90 4259:5227df2a650f
18 # <http://www.gnu.org/licenses/>. 18 # <http://www.gnu.org/licenses/>.
19 19
20 20
21 if (STATIC_BUILD OR NOT USE_SYSTEM_CIVETWEB) 21 if (STATIC_BUILD OR NOT USE_SYSTEM_CIVETWEB)
22 22
23 ## WARNING: "civetweb-1.12.tar.gz" comes with a subfolder 23 ## WARNING: "civetweb-1.13.tar.gz" comes with a subfolder
24 ## "civetweb-1.12/test/nonlatin" that cannot be removed by "hg purge 24 ## "civetweb-1.13/test/nonlatin" that cannot be removed by "hg purge
25 ## --all" on Windows hosts. We thus created a custom 25 ## --all" on Windows hosts. We thus created a custom
26 ## "civetweb-1.12-fixed.tar.gz" as follows: 26 ## "civetweb-1.13-fixed.tar.gz" as follows:
27 ## 27 ##
28 ## $ cd /tmp 28 ## $ cd /tmp
29 ## $ wget http://orthanc.osimis.io/ThirdPartyDownloads/civetweb-1.12.tar.gz 29 ## $ wget http://orthanc.osimis.io/ThirdPartyDownloads/civetweb-1.13.tar.gz
30 ## $ tar xvf civetweb-1.12.tar.gz 30 ## $ tar xvf civetweb-1.13.tar.gz
31 ## $ rm -rf civetweb-1.12/src/third_party/ civetweb-1.12/test/ 31 ## $ rm -rf civetweb-1.13/src/third_party/ civetweb-1.13/test/
32 ## $ tar cvfz civetweb-1.12-fixed.tar.gz civetweb-1.12 32 ## $ tar cvfz civetweb-1.13-fixed.tar.gz civetweb-1.13
33 ## 33 ##
34 34
35 set(CIVETWEB_SOURCES_DIR ${CMAKE_BINARY_DIR}/civetweb-1.12) 35 set(CIVETWEB_SOURCES_DIR ${CMAKE_BINARY_DIR}/civetweb-1.13)
36 set(CIVETWEB_URL "http://orthanc.osimis.io/ThirdPartyDownloads/civetweb-1.12-fixed.tar.gz") 36 set(CIVETWEB_URL "http://orthanc.osimis.io/ThirdPartyDownloads/civetweb-1.13-fixed.tar.gz")
37 set(CIVETWEB_MD5 "016ed7cd26cbc46b5941f0cbfb2e4ac8") 37 set(CIVETWEB_MD5 "9cf9d22cf8a06a8487d98637bbcd543c")
38 38
39 if (IS_DIRECTORY "${CIVETWEB_SOURCES_DIR}") 39 if (IS_DIRECTORY "${CIVETWEB_SOURCES_DIR}")
40 set(FirstRun OFF) 40 set(FirstRun OFF)
41 else() 41 else()
42 set(FirstRun ON) 42 set(FirstRun ON)
44 44
45 DownloadPackage(${CIVETWEB_MD5} ${CIVETWEB_URL} "${CIVETWEB_SOURCES_DIR}") 45 DownloadPackage(${CIVETWEB_MD5} ${CIVETWEB_URL} "${CIVETWEB_SOURCES_DIR}")
46 46
47 execute_process( 47 execute_process(
48 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i 48 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
49 ${CMAKE_CURRENT_LIST_DIR}/../Patches/civetweb-1.12.patch 49 ${CMAKE_CURRENT_LIST_DIR}/../Patches/civetweb-1.13.patch
50 WORKING_DIRECTORY ${CMAKE_BINARY_DIR} 50 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
51 RESULT_VARIABLE Failure 51 RESULT_VARIABLE Failure
52 ) 52 )
53 53
54 if (FirstRun AND Failure) 54 if (FirstRun AND Failure)
62 set(CIVETWEB_SOURCES 62 set(CIVETWEB_SOURCES
63 ${CIVETWEB_SOURCES_DIR}/src/civetweb.c 63 ${CIVETWEB_SOURCES_DIR}/src/civetweb.c
64 ) 64 )
65 65
66 # New in Orthanc 1.6.0: Enable support of compression in civetweb 66 # New in Orthanc 1.6.0: Enable support of compression in civetweb
67 set_source_files_properties( 67 set(tmp "USE_ZLIB=1")
68 ${CIVETWEB_SOURCES} 68
69 PROPERTIES COMPILE_DEFINITIONS
70 "USE_ZLIB=1")
71
72 if (ENABLE_SSL) 69 if (ENABLE_SSL)
73 add_definitions( 70 add_definitions(
74 -DNO_SSL_DL=1 71 -DNO_SSL_DL=1
75 ) 72 )
76 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR 73 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" OR
77 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD") 74 ${CMAKE_SYSTEM_NAME} STREQUAL "kFreeBSD")
78 link_libraries(dl) 75 link_libraries(dl)
79 endif() 76 endif()
80 77
78 if (CIVETWEB_OPENSSL_API STREQUAL "1.0")
79 set(tmp "${tmp};OPENSSL_API_1_0=1")
80 elseif (CIVETWEB_OPENSSL_API STREQUAL "1.1")
81 set(tmp "${tmp};OPENSSL_API_1_1=1")
82 else()
83 message(FATAL_ERROR "Unsupported value for CIVETWEB_OPENSSL_API: ${CIVETWEB_OPENSSL_API}")
84 endif()
85
81 else() 86 else()
82 add_definitions( 87 add_definitions(
83 -DNO_SSL=1 # Remove SSL support from civetweb 88 -DNO_SSL=1 # Remove SSL support from civetweb
84 ) 89 )
85 endif() 90 endif()
86 91
92 set_source_files_properties(
93 ${CIVETWEB_SOURCES}
94 PROPERTIES COMPILE_DEFINITIONS "${tmp}"
95 )
96
87 source_group(ThirdParty\\Civetweb REGULAR_EXPRESSION ${CIVETWEB_SOURCES_DIR}/.*) 97 source_group(ThirdParty\\Civetweb REGULAR_EXPRESSION ${CIVETWEB_SOURCES_DIR}/.*)
88 98
89 add_definitions( 99 add_definitions(
90 -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=1 100 -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=1
91 -DCIVETWEB_HAS_WEBDAV_WRITING=1 101 -DCIVETWEB_HAS_WEBDAV_WRITING=1
106 116
107 link_libraries(civetweb) 117 link_libraries(civetweb)
108 unset(CMAKE_REQUIRED_LIBRARIES) 118 unset(CMAKE_REQUIRED_LIBRARIES)
109 119
110 # Check whether the system distribution of civetweb contains the 120 # Check whether the system distribution of civetweb contains the
111 # patch "../Patches/civetweb-1.12.patch" that allows to disable 121 # patch "../Patches/civetweb-1.13.patch" that allows to disable
112 # keep-alive on selected HTTP connections. This is useful to speed 122 # keep-alive on selected HTTP connections. This is useful to speed
113 # up multipart transfers, as encountered in DICOMweb. 123 # up multipart transfers, as encountered in DICOMweb.
114 CHECK_LIBRARY_EXISTS(civetweb mg_disable_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE) 124 CHECK_LIBRARY_EXISTS(civetweb mg_disable_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE)
115 if (CIVETWEB_HAS_DISABLE_KEEP_ALIVE) 125 if (CIVETWEB_HAS_DISABLE_KEEP_ALIVE)
116 add_definitions( 126 add_definitions(