Mercurial > hg > orthanc
changeset 3835:cbe847575c62
merge
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Wed, 15 Apr 2020 16:59:47 +0200 |
parents | 219de90c1f43 (current diff) a3e38994d95a (diff) |
children | 963ea9fab402 |
files | |
diffstat | 11 files changed, 177 insertions(+), 20 deletions(-) [+] |
line wrap: on
line diff
--- a/NEWS Wed Apr 15 16:58:28 2020 +0200 +++ b/NEWS Wed Apr 15 16:59:47 2020 +0200 @@ -19,6 +19,7 @@ * Fix lookup form in Orthanc Explorer (wildcards not allowed in StudyDate) * Fix signature of "OrthancPluginRegisterStorageCommitmentScpCallback()" in plugins SDK * Error reporting on failure while initializing SSL +* Fix unit test ParsedDicomFile.ToJsonFlags2 on big-endian architectures * Upgraded dependencies for static builds (notably on Windows): - civetweb 1.12 - openssl 1.1.1f
--- a/Resources/CMake/Compiler.cmake Wed Apr 15 16:58:28 2020 +0200 +++ b/Resources/CMake/Compiler.cmake Wed Apr 15 16:59:47 2020 +0200 @@ -1,6 +1,7 @@ # This file sets all the compiler-related flags -if (CMAKE_CROSSCOMPILING OR +if ((CMAKE_CROSSCOMPILING AND NOT + "${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg") OR "${CMAKE_SYSTEM_VERSION}" STREQUAL "LinuxStandardBase") # Cross-compilation necessarily implies standalone and static build SET(STATIC_BUILD ON)
--- a/Resources/CMake/DcmtkConfiguration.cmake Wed Apr 15 16:58:28 2020 +0200 +++ b/Resources/CMake/DcmtkConfiguration.cmake Wed Apr 15 16:59:47 2020 +0200 @@ -133,13 +133,34 @@ else() - # The following line allows to manually add libraries at the - # command-line, which is necessary for Ubuntu/Debian packages - set(tmp "${DCMTK_LIBRARIES}") - include(FindDCMTK) - list(APPEND DCMTK_LIBRARIES "${tmp}") + if (CMAKE_CROSSCOMPILING AND + "${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg") + + CHECK_INCLUDE_FILE_CXX(dcmtk/dcmdata/dcfilefo.h HAVE_DCMTK_H) + if (NOT HAVE_DCMTK_H) + message(FATAL_ERROR "Please install the libdcmtk-dev package") + endif() + + CHECK_LIBRARY_EXISTS(dcmdata "dcmDataDict" "" HAVE_DCMTK_LIB) + if (NOT HAVE_DCMTK_LIB) + message(FATAL_ERROR "Please install the libdcmtk package") + endif() - include_directories(${DCMTK_INCLUDE_DIRS}) + find_path(DCMTK_INCLUDE_DIRS dcmtk/config/osconfig.h + /usr/include + ) + + link_libraries(dcmdata dcmnet dcmjpeg oflog ofstd) + + else() + # The following line allows to manually add libraries at the + # command-line, which is necessary for Ubuntu/Debian packages + set(tmp "${DCMTK_LIBRARIES}") + include(FindDCMTK) + list(APPEND DCMTK_LIBRARIES "${tmp}") + + include_directories(${DCMTK_INCLUDE_DIRS}) + endif() add_definitions( -DHAVE_CONFIG_H=1 @@ -210,6 +231,13 @@ message(FATAL_ERROR "Cannot locate the DICOM dictionary on this system") endif() + if (CMAKE_CROSSCOMPILING AND + "${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg") + # Remove the sysroot prefix + file(RELATIVE_PATH tmp ${CMAKE_FIND_ROOT_PATH} ${DCMTK_DICTIONARY_DIR_AUTO}) + set(DCMTK_DICTIONARY_DIR_AUTO /${tmp} CACHE INTERNAL "") + endif() + message("Autodetected path to the DICOM dictionaries: ${DCMTK_DICTIONARY_DIR_AUTO}") add_definitions(-DDCMTK_DICTIONARY_DIR="${DCMTK_DICTIONARY_DIR_AUTO}") else()
--- a/Resources/CMake/GoogleTestConfiguration.cmake Wed Apr 15 16:58:28 2020 +0200 +++ b/Resources/CMake/GoogleTestConfiguration.cmake Wed Apr 15 16:59:47 2020 +0200 @@ -2,15 +2,15 @@ find_path(GOOGLE_TEST_DEBIAN_SOURCES_DIR NAMES src/gtest-all.cc PATHS - /usr/src/gtest - /usr/src/googletest/googletest + ${CROSSTOOL_NG_IMAGE}/usr/src/gtest + ${CROSSTOOL_NG_IMAGE}/usr/src/googletest/googletest PATH_SUFFIXES src ) find_path(GOOGLE_TEST_DEBIAN_INCLUDE_DIR NAMES gtest.h PATHS - /usr/include/gtest + ${CROSSTOOL_NG_IMAGE}/usr/include/gtest ) message("Path to the Debian Google Test sources: ${GOOGLE_TEST_DEBIAN_SOURCES_DIR}")
--- a/Resources/CMake/LibCurlConfiguration.cmake Wed Apr 15 16:58:28 2020 +0200 +++ b/Resources/CMake/LibCurlConfiguration.cmake Wed Apr 15 16:59:47 2020 +0200 @@ -262,7 +262,7 @@ check_struct_has_member("struct sockaddr_un" sun_path "sys/un.h" USE_UNIX_SOCKETS) - set(CMAKE_REQUIRED_INCLUDES "${CURL_SOURCES_DIR}/include") + list(APPEND CMAKE_REQUIRED_INCLUDES "${CURL_SOURCES_DIR}/include") set(CMAKE_EXTRA_INCLUDE_FILES "curl/system.h") check_type_size("curl_off_t" SIZEOF_CURL_OFF_T) @@ -312,6 +312,22 @@ ${CURL_SOURCES_DIR}/lib/curl_config.h ) endif() + +elseif (CMAKE_CROSSCOMPILING AND + "${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg") + + CHECK_INCLUDE_FILE_CXX(curl/curl.h HAVE_CURL_H) + if (NOT HAVE_CURL_H) + message(FATAL_ERROR "Please install the libcurl-dev package") + endif() + + CHECK_LIBRARY_EXISTS(curl "curl_easy_init" "" HAVE_CURL_LIB) + if (NOT HAVE_CURL_LIB) + message(FATAL_ERROR "Please install the libcurl package") + endif() + + link_libraries(curl) + else() include(FindCURL) include_directories(${CURL_INCLUDE_DIRS})
--- a/Resources/CMake/LuaConfiguration.cmake Wed Apr 15 16:58:28 2020 +0200 +++ b/Resources/CMake/LuaConfiguration.cmake Wed Apr 15 16:59:47 2020 +0200 @@ -100,6 +100,32 @@ source_group(ThirdParty\\Lua REGULAR_EXPRESSION ${LUA_SOURCES_DIR}/.*) +elseif (CMAKE_CROSSCOMPILING AND + "${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg") + + set(LUA_VERSIONS 5.3 5.2 5.1) + + unset(LUA_VERSION) + foreach(version IN ITEMS ${LUA_VERSIONS}) + CHECK_INCLUDE_FILE(lua${version}/lua.h HAVE_LUA${version}_H) + if (HAVE_LUA${version}_H) + set(LUA_VERSION ${version}) + break() + endif() + endforeach() + + if (NOT LUA_VERSION) + message(FATAL_ERROR "Please install the liblua-dev package") + endif() + + CHECK_LIBRARY_EXISTS(lua${LUA_VERSION} "lua_call" "${LUA_LIB_DIR}" HAVE_LUA_LIB) + if (NOT HAVE_LUA_LIB) + message(FATAL_ERROR "Please install the liblua package") + endif() + + include_directories(${CROSSTOOL_NG_IMAGE}/usr/include/lua${LUA_VERSION}) + link_libraries(lua${LUA_VERSION}) + else() include(FindLua)
--- a/Resources/CMake/OpenSslConfiguration.cmake Wed Apr 15 16:58:28 2020 +0200 +++ b/Resources/CMake/OpenSslConfiguration.cmake Wed Apr 15 16:59:47 2020 +0200 @@ -9,6 +9,26 @@ source_group(ThirdParty\\OpenSSL REGULAR_EXPRESSION ${OPENSSL_SOURCES_DIR}/.*) +elseif (CMAKE_CROSSCOMPILING AND + "${CMAKE_SYSTEM_VERSION}" STREQUAL "CrossToolNg") + + CHECK_INCLUDE_FILE_CXX(openssl/opensslv.h HAVE_OPENSSL_H) + if (NOT HAVE_OPENSSL_H) + message(FATAL_ERROR "Please install the libopenssl-dev package") + endif() + + CHECK_LIBRARY_EXISTS(crypto "OPENSSL_init" "" HAVE_OPENSSL_CRYPTO_LIB) + if (NOT HAVE_OPENSSL_CRYPTO_LIB) + message(FATAL_ERROR "Please install the libopenssl package") + endif() + + CHECK_LIBRARY_EXISTS(ssl "SSL_library_init" "" HAVE_OPENSSL_SSL_LIB) + if (NOT HAVE_OPENSSL_SSL_LIB) + message(FATAL_ERROR "Please install the libopenssl package") + endif() + + link_libraries(crypto ssl) + else() include(FindOpenSSL)
--- a/Resources/CMake/SQLiteConfiguration.cmake Wed Apr 15 16:58:28 2020 +0200 +++ b/Resources/CMake/SQLiteConfiguration.cmake Wed Apr 15 16:59:47 2020 +0200 @@ -41,12 +41,14 @@ source_group(ThirdParty\\SQLite REGULAR_EXPRESSION ${SQLITE_SOURCES_DIR}/.*) else() - CHECK_INCLUDE_FILE_CXX(sqlite3.h HAVE_SQLITE_H) + CHECK_INCLUDE_FILE(sqlite3.h HAVE_SQLITE_H) if (NOT HAVE_SQLITE_H) message(FATAL_ERROR "Please install the libsqlite3-dev package") endif() - find_path(SQLITE_INCLUDE_DIR sqlite3.h + find_path(SQLITE_INCLUDE_DIR + NAMES sqlite3.h + PATHS /usr/include /usr/local/include )
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/Resources/CrossToolchain.cmake Wed Apr 15 16:59:47 2020 +0200 @@ -0,0 +1,56 @@ +# +# $ CROSSTOOL_NG_ARCH=mips CROSSTOOL_NG_BOARD=malta CROSSTOOL_NG_IMAGE=/tmp/mips cmake .. -DCMAKE_BUILD_TYPE=Debug -DCMAKE_TOOLCHAIN_FILE=../Resources/CrossToolchain.cmake -DBUILD_CONNECTIVITY_CHECKS=OFF -DUSE_SYSTEM_CIVETWEB=OFF -DUSE_GOOGLE_TEST_DEBIAN_PACKAGE=ON -DUSE_SYSTEM_JSONCPP=OFF -DUSE_SYSTEM_UUID=OFF -DENABLE_DCMTK_JPEG_LOSSLESS=OFF -G Ninja && ninja +# + +INCLUDE(CMakeForceCompiler) + +SET(CROSSTOOL_NG_ROOT $ENV{CROSSTOOL_NG_ROOT} CACHE STRING "") +SET(CROSSTOOL_NG_ARCH $ENV{CROSSTOOL_NG_ARCH} CACHE STRING "") +SET(CROSSTOOL_NG_BOARD $ENV{CROSSTOOL_NG_BOARD} CACHE STRING "") +SET(CROSSTOOL_NG_SUFFIX $ENV{CROSSTOOL_NG_SUFFIX} CACHE STRING "") +SET(CROSSTOOL_NG_IMAGE $ENV{CROSSTOOL_NG_IMAGE} CACHE STRING "") + +IF ("${CROSSTOOL_NG_ROOT}" STREQUAL "") + SET(CROSSTOOL_NG_ROOT "/home/$ENV{USER}/x-tools") +ENDIF() + +IF ("${CROSSTOOL_NG_SUFFIX}" STREQUAL "") + SET(CROSSTOOL_NG_SUFFIX "linux-gnu") +ENDIF() + +SET(CROSSTOOL_NG_NAME ${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_BOARD}-${CROSSTOOL_NG_SUFFIX}) +SET(CROSSTOOL_NG_BASE ${CROSSTOOL_NG_ROOT}/${CROSSTOOL_NG_NAME}) + +# the name of the target operating system +SET(CMAKE_SYSTEM_NAME Linux) +SET(CMAKE_SYSTEM_VERSION CrossToolNg) +SET(CMAKE_SYSTEM_PROCESSOR ${CROSSTOOL_NG_ARCH}) + +# which compilers to use for C and C++ +SET(CMAKE_C_COMPILER ${CROSSTOOL_NG_BASE}/bin/${CROSSTOOL_NG_NAME}-gcc) + +if (${CMAKE_VERSION} VERSION_LESS "3.6.0") + CMAKE_FORCE_CXX_COMPILER(${CROSSTOOL_NG_BASE}/bin/${CROSSTOOL_NG_NAME}-g++ GNU) +else() + SET(CMAKE_CXX_COMPILER ${CROSSTOOL_NG_BASE}/bin/${CROSSTOOL_NG_NAME}-g++) +endif() + +# here is the target environment located +SET(CMAKE_FIND_ROOT_PATH ${CROSSTOOL_NG_IMAGE}) +#SET(CMAKE_FIND_ROOT_PATH ${CROSSTOOL_NG_BASE}/${CROSSTOOL_NG_NAME}/sysroot) + +# adjust the default behaviour of the FIND_XXX() commands: +# search headers and libraries in the target environment, search +# programs in the host environment +SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY) +SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY) +SET(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE ONLY) + +SET(CMAKE_CROSSCOMPILING ON) +#SET(CROSS_COMPILER_PREFIX ${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_SUFFIX}) + +SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -I${CROSSTOOL_NG_IMAGE}/usr/include -I${CROSSTOOL_NG_IMAGE}/usr/include/${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_SUFFIX}" CACHE INTERNAL "" FORCE) +SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -I${CROSSTOOL_NG_IMAGE}/usr/include -I${CROSSTOOL_NG_IMAGE}/usr/include/${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_SUFFIX}" CACHE INTERNAL "" FORCE) +SET(CMAKE_EXE_LINKER_FLAGS "-Wl,--unresolved-symbols=ignore-in-shared-libs -L${CROSSTOOL_NG_BASE}/${CROSSTOOL_NG_NAME}/sysroot/usr/lib -L${CROSSTOOL_NG_IMAGE}/usr/lib -L${CROSSTOOL_NG_IMAGE}/usr/lib/${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_SUFFIX} -L${CROSSTOOL_NG_IMAGE}/lib -L${CROSSTOOL_NG_IMAGE}/lib/${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_SUFFIX}" CACHE INTERNAL "" FORCE) +SET(CMAKE_SHARED_LINKER_FLAGS "-Wl,--unresolved-symbols=ignore-in-shared-libs -L${CROSSTOOL_NG_BASE}/${CROSSTOOL_NG_NAME}/sysroot/usr/lib -L${CROSSTOOL_NG_IMAGE}/usr/lib -L${CROSSTOOL_NG_IMAGE}/usr/lib/${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_SUFFIX} -L${CROSSTOOL_NG_IMAGE}/lib -L${CROSSTOOL_NG_IMAGE}/lib/${CROSSTOOL_NG_ARCH}-${CROSSTOOL_NG_SUFFIX}" CACHE INTERNAL "" FORCE)
--- a/Resources/LinuxStandardBaseToolchain.cmake Wed Apr 15 16:58:28 2020 +0200 +++ b/Resources/LinuxStandardBaseToolchain.cmake Wed Apr 15 16:59:47 2020 +0200 @@ -10,10 +10,10 @@ INCLUDE(CMakeForceCompiler) -SET(LSB_PATH $ENV{LSB_PATH}) -SET(LSB_CC $ENV{LSB_CC}) -SET(LSB_CXX $ENV{LSB_CXX}) -SET(LSB_TARGET_VERSION "4.0") +SET(LSB_PATH $ENV{LSB_PATH} CACHE STRING "") +SET(LSB_CC $ENV{LSB_CC} CACHE STRING "") +SET(LSB_CXX $ENV{LSB_CXX} CACHE STRING "") +SET(LSB_TARGET_VERSION "4.0" CACHE STRING "") IF ("${LSB_PATH}" STREQUAL "") SET(LSB_PATH "/opt/lsb")
--- a/UnitTestsSources/FromDcmtkTests.cpp Wed Apr 15 16:58:28 2020 +0200 +++ b/UnitTestsSources/FromDcmtkTests.cpp Wed Apr 15 16:59:47 2020 +0200 @@ -710,7 +710,14 @@ TEST(ParsedDicomFile, ToJsonFlags2) { ParsedDicomFile f(true); - f.Insert(DICOM_TAG_PIXEL_DATA, "Pixels", false, ""); + + { + // "ParsedDicomFile" uses Little Endian => 'B' (least significant + // byte) will be stored first in the memory buffer and in the + // file, then 'A'. Hence the expected "BA" value below. + Uint16 v[] = { 'A' * 256 + 'B', 0 }; + ASSERT_TRUE(f.GetDcmtkObject().getDataset()->putAndInsertUint16Array(DCM_PixelData, v, 2).good()); + } Json::Value v; f.DatasetToJson(v, DicomToJsonFormat_Short, DicomToJsonFlags_None, 0); @@ -729,7 +736,7 @@ ASSERT_EQ(6u, v.getMemberNames().size()); ASSERT_TRUE(v.isMember("7fe0,0010")); ASSERT_EQ(Json::stringValue, v["7fe0,0010"].type()); - ASSERT_EQ("Pixels", v["7fe0,0010"].asString()); + ASSERT_EQ("BA", v["7fe0,0010"].asString().substr(0, 2)); f.DatasetToJson(v, DicomToJsonFormat_Short, DicomToJsonFlags_IncludePixelData, 0); ASSERT_EQ(Json::objectValue, v.type()); @@ -739,7 +746,7 @@ std::string mime, content; ASSERT_TRUE(Toolbox::DecodeDataUriScheme(mime, content, v["7fe0,0010"].asString())); ASSERT_EQ("application/octet-stream", mime); - ASSERT_EQ("Pixels", content); + ASSERT_EQ("BA", content.substr(0, 2)); }