comparison Orthanc/Resources/CMake/Compiler.cmake @ 128:e8cfda4c8a2f

Sync + support of JPEG2000 lossless images with YBR_RCT photometric interpretation
author Sebastien Jodogne <s.jodogne@gmail.com>
date Fri, 15 Apr 2016 21:44:03 +0200
parents f395dddfbf16
children ee5ff71f133b
comparison
equal deleted inserted replaced
127:5754d39b011d 128:e8cfda4c8a2f
8 8
9 if (CMAKE_COMPILER_IS_GNUCXX) 9 if (CMAKE_COMPILER_IS_GNUCXX)
10 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-long-long -Wno-implicit-function-declaration") 10 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wno-long-long -Wno-implicit-function-declaration")
11 # --std=c99 makes libcurl not to compile 11 # --std=c99 makes libcurl not to compile
12 # -pedantic gives a lot of warnings on OpenSSL 12 # -pedantic gives a lot of warnings on OpenSSL
13 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wno-long-long -Wno-variadic-macros") 13 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wno-long-long -Wno-variadic-macros")
14 14
15 if (CMAKE_CROSSCOMPILING) 15 if (CMAKE_CROSSCOMPILING)
16 # http://stackoverflow.com/a/3543845/881731 16 # http://stackoverflow.com/a/3543845/881731
17 set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -I<CMAKE_CURRENT_SOURCE_DIR> <SOURCE> <OBJECT>") 17 set(CMAKE_RC_COMPILE_OBJECT "<CMAKE_RC_COMPILER> -O coff -I<CMAKE_CURRENT_SOURCE_DIR> <SOURCE> <OBJECT>")
18 endif() 18 endif()
71 -D_FILE_OFFSET_BITS=64 71 -D_FILE_OFFSET_BITS=64
72 ) 72 )
73 link_libraries(dl) 73 link_libraries(dl)
74 endif() 74 endif()
75 75
76 CHECK_INCLUDE_FILES(uuid/uuid.h HAVE_UUID_H)
77 if (NOT HAVE_UUID_H)
78 message(FATAL_ERROR "Please install the uuid-dev package")
79 endif()
80
76 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows") 81 elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
77 if (MSVC) 82 if (MSVC)
78 message("MSVC compiler version = " ${MSVC_VERSION} "\n") 83 message("MSVC compiler version = " ${MSVC_VERSION} "\n")
79 # Starting Visual Studio 2013 (version 1800), it is not possible 84 # Starting Visual Studio 2013 (version 1800), it is not possible
80 # to target Windows XP anymore 85 # to target Windows XP anymore
95 -D_CRT_SECURE_NO_WARNINGS=1 100 -D_CRT_SECURE_NO_WARNINGS=1
96 ) 101 )
97 link_libraries(rpcrt4 ws2_32) 102 link_libraries(rpcrt4 ws2_32)
98 103
99 if (CMAKE_COMPILER_IS_GNUCXX) 104 if (CMAKE_COMPILER_IS_GNUCXX)
105 # Some additional C/C++ compiler flags for MinGW
106 SET(MINGW_NO_WARNINGS "-Wno-unused-function -Wno-unused-variable")
107 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${MINGW_NO_WARNINGS} -Wno-pointer-to-int-cast -Wno-int-to-pointer-cast")
108 SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${MINGW_NO_WARNINGS}")
109
100 # This is a patch for MinGW64 110 # This is a patch for MinGW64
101 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++") 111 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++")
102 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++") 112 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Wl,--allow-multiple-definition -static-libgcc -static-libstdc++")
103 113
104 CHECK_LIBRARY_EXISTS(winpthread pthread_create "" HAVE_WIN_PTHREAD) 114 CHECK_LIBRARY_EXISTS(winpthread pthread_create "" HAVE_WIN_PTHREAD)
118 add_definitions( 128 add_definitions(
119 -D_XOPEN_SOURCE=1 129 -D_XOPEN_SOURCE=1
120 ) 130 )
121 link_libraries(iconv) 131 link_libraries(iconv)
122 132
133 CHECK_INCLUDE_FILES(uuid/uuid.h HAVE_UUID_H)
134 if (NOT HAVE_UUID_H)
135 message(FATAL_ERROR "Please install the uuid-dev package")
136 endif()
137
123 endif() 138 endif()
124 139
125 140
126 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") 141 if ("${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase")
127 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -I${LSB_PATH}/include") 142 SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --lsb-target-version=${LSB_TARGET_VERSION} -I${LSB_PATH}/include")
137 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib") 152 SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -L/usr/local/lib")
138 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -L/usr/local/lib") 153 SET(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -L/usr/local/lib")
139 endif() 154 endif()
140 155
141 156
142 if (${CMAKE_SYSTEM_NAME} STREQUAL "Windows")
143 CHECK_INCLUDE_FILES(rpc.h HAVE_UUID_H)
144 else()
145 CHECK_INCLUDE_FILES(uuid/uuid.h HAVE_UUID_H)
146 endif()
147
148 if (NOT HAVE_UUID_H)
149 message(FATAL_ERROR "Please install the uuid-dev package")
150 endif()
151
152
153 if (STATIC_BUILD) 157 if (STATIC_BUILD)
154 add_definitions(-DORTHANC_STATIC=1) 158 add_definitions(-DORTHANC_STATIC=1)
155 else() 159 else()
156 add_definitions(-DORTHANC_STATIC=0) 160 add_definitions(-DORTHANC_STATIC=0)
157 endif() 161 endif()