comparison OrthancFramework/Resources/CMake/CivetwebConfiguration.cmake @ 4616:57b1a36645ae

upgrade to civetweb 1.14
author Sebastien Jodogne <s.jodogne@gmail.com>
date Wed, 14 Apr 2021 12:08:20 +0200
parents d9473bd5ed43
children 68635d365a27
comparison
equal deleted inserted replaced
4610:8661811abca3 4616:57b1a36645ae
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.13.tar.gz" comes with a subfolder 23 ## WARNING: "civetweb-1.14.tar.gz" comes with a subfolder
24 ## "civetweb-1.13/test/nonlatin" that cannot be removed by "hg purge 24 ## "civetweb-1.14/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.13-fixed.tar.gz" as follows: 26 ## "civetweb-1.14-fixed.tar.gz" as follows:
27 ## 27 ##
28 ## $ cd /tmp 28 ## $ cd /tmp
29 ## $ wget http://orthanc.osimis.io/ThirdPartyDownloads/civetweb-1.13.tar.gz 29 ## $ wget http://orthanc.osimis.io/ThirdPartyDownloads/civetweb-1.14.tar.gz
30 ## $ tar xvf civetweb-1.13.tar.gz 30 ## $ tar xvf civetweb-1.14.tar.gz
31 ## $ rm -rf civetweb-1.13/src/third_party/ civetweb-1.13/test/ 31 ## $ rm -rf civetweb-1.14/src/third_party/ civetweb-1.14/test/
32 ## $ tar cvfz civetweb-1.13-fixed.tar.gz civetweb-1.13 32 ## $ tar cvfz civetweb-1.14-fixed.tar.gz civetweb-1.14
33 ## 33 ##
34 34
35 set(CIVETWEB_SOURCES_DIR ${CMAKE_BINARY_DIR}/civetweb-1.13) 35 set(CIVETWEB_SOURCES_DIR ${CMAKE_BINARY_DIR}/civetweb-1.14)
36 set(CIVETWEB_URL "http://orthanc.osimis.io/ThirdPartyDownloads/civetweb-1.13-fixed.tar.gz") 36 set(CIVETWEB_URL "http://orthanc.osimis.io/ThirdPartyDownloads/civetweb-1.14-fixed.tar.gz")
37 set(CIVETWEB_MD5 "9cf9d22cf8a06a8487d98637bbcd543c") 37 set(CIVETWEB_MD5 "1f25d516b7a4e65d8b270d1cc399e0a9")
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)
43 endif() 43 endif()
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(
48 COMMAND ${PATCH_EXECUTABLE} -p0 -N -i
49 ${CMAKE_CURRENT_LIST_DIR}/../Patches/civetweb-1.13.patch
50 WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
51 RESULT_VARIABLE Failure
52 )
53
54 if (FirstRun AND Failure)
55 message(FATAL_ERROR "Error while patching a file")
56 endif()
57
58 include_directories( 47 include_directories(
59 ${CIVETWEB_SOURCES_DIR}/include 48 ${CIVETWEB_SOURCES_DIR}/include
60 ) 49 )
61 50
62 set(CIVETWEB_SOURCES 51 set(CIVETWEB_SOURCES
113 if (NOT HAVE_CIVETWEB_LIB) 102 if (NOT HAVE_CIVETWEB_LIB)
114 message(FATAL_ERROR "Please install the libcivetweb-dev package") 103 message(FATAL_ERROR "Please install the libcivetweb-dev package")
115 endif() 104 endif()
116 105
117 link_libraries(civetweb) 106 link_libraries(civetweb)
118 unset(CMAKE_REQUIRED_LIBRARIES)
119 107
120 # Check whether the system distribution of civetweb contains the 108 # Check whether the system distribution of civetweb contains the
121 # patch "../Patches/civetweb-1.13.patch" that allows to disable 109 # patch "../Patches/civetweb-1.13.patch" that allows to disable
122 # keep-alive on selected HTTP connections. This is useful to speed 110 # keep-alive on selected HTTP connections. This is useful to speed
123 # up multipart transfers, as encountered in DICOMweb. 111 # up multipart transfers, as encountered in DICOMweb.
124 CHECK_LIBRARY_EXISTS(civetweb mg_disable_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE) 112 CHECK_LIBRARY_EXISTS(civetweb mg_disable_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE_1) # From "../Patches/civetweb-1.13.patch"
125 if (CIVETWEB_HAS_DISABLE_KEEP_ALIVE) 113 CHECK_LIBRARY_EXISTS(civetweb mg_disable_connection_keep_alive "" CIVETWEB_HAS_DISABLE_KEEP_ALIVE_2) # From civetweb >= 1.14
114 if (CIVETWEB_HAS_DISABLE_KEEP_ALIVE_1 OR
115 CIVETWEB_HAS_DISABLE_KEEP_ALIVE_2)
126 add_definitions( 116 add_definitions(
127 -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=1 117 -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=1
128 -DCIVETWEB_HAS_WEBDAV_WRITING=1 118 -DCIVETWEB_HAS_WEBDAV_WRITING=1
129 ) 119 )
130 message("Performance: Your system-wide distribution of civetweb is configured for best performance") 120 message("Performance: Your system-wide distribution of civetweb is configured for best performance")
133 add_definitions( 123 add_definitions(
134 -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=0 124 -DCIVETWEB_HAS_DISABLE_KEEP_ALIVE=0
135 -DCIVETWEB_HAS_WEBDAV_WRITING=0 125 -DCIVETWEB_HAS_WEBDAV_WRITING=0
136 ) 126 )
137 endif() 127 endif()
128
129 unset(CMAKE_REQUIRED_LIBRARIES) # This reset must be after "CHECK_LIBRARY_EXISTS"
138 endif() 130 endif()
139 131
140 132
141 # New in Orthanc 1.8.1 133 # New in Orthanc 1.8.1
142 add_definitions( 134 add_definitions(