From cd5512e761e98752965967eeacc550eda1a0294e Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Mon, 4 May 2020 08:17:37 +0100 Subject: [PATCH 01/27] WIP. C++11 support --- cmake/compilerFlags.cmake | 33 +++++++++++++ contrib/Qt/ReadMe.txt | 88 ++++++++++++++++++++++++++++++++++ contrib/Qt/commandLineTool.pro | 15 ++++++ contrib/Qt/main.cpp | 15 ++++++ include/exiv2/config.h | 16 ++++--- 5 files changed, 160 insertions(+), 7 deletions(-) create mode 100644 contrib/Qt/ReadMe.txt create mode 100644 contrib/Qt/commandLineTool.pro create mode 100644 contrib/Qt/main.cpp diff --git a/cmake/compilerFlags.cmake b/cmake/compilerFlags.cmake index f2018781..8cb29698 100644 --- a/cmake/compilerFlags.cmake +++ b/cmake/compilerFlags.cmake @@ -90,6 +90,7 @@ endif () # http://stackoverflow.com/questions/10113017/setting-the-msvc-runtime-in-cmake if(MSVC) + find_program(CLCACHE name clcache.exe PATHS ENV CLCACHE_PATH PATH_SUFFIXES Scripts clcache-4.1.0 @@ -136,4 +137,36 @@ if(MSVC) # Object Level Parallelism add_compile_options(/MP) add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN) + + # https://stackoverflow.com/questions/44960715/how-to-enable-stdc17-in-vs2017-with-cmake + if (MSVC_VERSION GREATER_EQUAL "1700") # VS2015 and up + include(CheckCXXCompilerFlag) + # MSVC doesn't have a setting for C++11 as it's a subset of C++14 + if ( ${CMAKE_CXX_STANDARD} STREQUAL "11" OR ${CMAKE_CXX_STANDARD} STREQUAL "14" ) + CHECK_CXX_COMPILER_FLAG("/std:c++14" _cpp_14) + if (_cpp_14) + add_compile_options("/std:c++14") + else() + message(WARNING "Cannot set compiler option /std:c++14") + endif() + endif() + if ( ${CMAKE_CXX_STANDARD} STREQUAL "17" ) + CHECK_CXX_COMPILER_FLAG("/std:c++17" _cpp_17) + if (_cpp_17) + add_compile_options("/std:c++17") + else() + message(WARNING "Cannot set compiler option /std:c++17") + endif() + endif() + if ( ${CMAKE_CXX_STANDARD} STREQUAL "20" ) + CHECK_CXX_COMPILER_FLAG("/std:c++11" _cpp_20) + if (_cpp_20) + add_compile_options("/std:c++20") + else() + message(WARNING "Cannot set compiler option /std:c++20") + endif() + endif() + # https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ + add_compile_options("/Zc:__cplusplus") + endif() endif() diff --git a/contrib/Qt/ReadMe.txt b/contrib/Qt/ReadMe.txt new file mode 100644 index 00000000..eed5d8b8 --- /dev/null +++ b/contrib/Qt/ReadMe.txt @@ -0,0 +1,88 @@ +contrib/Qt/ReadMe.txt +--------------------- + +Exiv2 works well with Qt. To support Qt/Windows users, a daily build of Exiv2 for MinGW/32 is provided. + +To build and run commandLineTool +-------------------------------- + +1) Either build Exiv2/MinGW/32 as documented: + http://clanmills.com/exiv2/mingw.shtml +OR + Download and install a build from the buildserver: + http://exiv2.dyndns.org:8080/userContent/builds/Categorized/Platform/mingw/ + Instructions for installing the build are in the bundle ReadMe.txt + +2) Generate Makefile + /c/Users/rmills/gnu/exiv2/trunk/contrib/Qt > qmake commandLinePro.pro + +3) Build commandLineTool.cpp + /c/Users/rmills/gnu/exiv2/trunk/contrib/Qt > make -B LDFLAGS=-L/usr/local/lib + +4) Run commandLineTool.exe + /c/Users/rmills/gnu/exiv2/trunk/contrib/Qt > release/commandLineTool.exe + +Gotchas (that I know about) + +1 Set PKG_CONFIG_PATH correctly + export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" + +2 Set PATH to use the toolchain for Qt + PATH="/c/Qt/Qt5.6.0/5.6/mingw49_32/bin:/c/Qt/Qt5.6.0/Tools/mingw492_32/bin:/c/MinGW/bin:/usr/bin:/usr/local/bin:/c/cygwin64/bin:." + +3 You may need to copy libstdc++-6.dll to /usr/local/bin + cp $(which libstdc++-6.dll) /usr/local/bin + +4 You may have to edit commandLineTool.pro to match your environment + +5 DO NOT USE Cygwin Builds + +6 Do not give up. + This stuff works. You may have to work quite hard to get it working. + Don't give up. It will work. + +7 If you give up with MinGW, use Visual Studio. + +Running MinGW bash and setting Qt tools in the path +--------------------------------------------------- + +I have a batch file (mingw32.bat) to get me into MinGW. + +C:\>type \Users\rmills\com\mingw32.bat +@echo off +rem ------------------ +: mingw32.bat +: invoke MinGW bash +: +setlocal +set "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" +set "INCLUDE_PATH=/usr/local/inc" +set "LIBRARY_PATH=/usr/local/lib" +set "BINARY_PATH=/usr/local/bin" +rem set "PATH=c:\MinGW\bin;c:\MinGW\msys\1.0\bin;c:\MinGW\msys\1.0\local\bin;c:\Users\rmills\com;." +set "PATH=c:\Qt\Qt5.6.0\5.6\mingw49_32\bin;c:\Qt\Qt5.6.0\Tools\mingw492_32\bin;c:\MinGW\bin;\usr\bin:\usr\local\bin;c:\cygwin64\bin;c:\Users\rmills\com;." +set "PS1=\! -32- ${PWD}> " +c:\MinGW\msys\1.0\bin\bash.exe %*% + +: That's all Folks +rem ------------------ + +UNICODE_PATH +------------ + +Qt users may prefer to build Exiv2 to support UNICODE_PATH. The sample application samples/exifprint.cpp works with UNICODE_PATH. + +Searching for more information about Qt, MinGW and UNICODE_PATH +--------------------------------------------------------------- +These matters are occasionally discussed on the forum. Please search to read discussions. + +You will probably find the following helpful: +http://dev.exiv2.org/boards/3/topics/2311?r=2312#message-2312 +http://dev.exiv2.org/issues/1169 +http://dev.exiv2.org/boards/3/topics/2705 + +However there have been others and there will be more in future. + +Robin Mills +http://clanmills.com +2016-09-19 diff --git a/contrib/Qt/commandLineTool.pro b/contrib/Qt/commandLineTool.pro new file mode 100644 index 00000000..f8b9bef2 --- /dev/null +++ b/contrib/Qt/commandLineTool.pro @@ -0,0 +1,15 @@ +QT += core +QT -= gui + +TARGET = commandLineTool +CONFIG += console +CONFIG -= app_bundle + +TEMPLATE = app +SOURCES += main.cpp + +win32 { + INCLUDEPATH += $$quote(c:/Qt/5.14.2/mingw73_64/include) + INCLUDEPATH += /usr/local/include + LIBS += -L$$quote(c:/Qt/5.14.2/mingw73_64/include) -L/usr/local/lib -lexiv2 +} diff --git a/contrib/Qt/main.cpp b/contrib/Qt/main.cpp new file mode 100644 index 00000000..9e72c4fd --- /dev/null +++ b/contrib/Qt/main.cpp @@ -0,0 +1,15 @@ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + QCoreApplication a(argc, argv); + + exv_grep_keys_t keys; + Exiv2::dumpLibraryInfo(std::cout,keys); + + return 0; + // return a.exec(); +} + diff --git a/include/exiv2/config.h b/include/exiv2/config.h index 2dddcae8..8708fec1 100644 --- a/include/exiv2/config.h +++ b/include/exiv2/config.h @@ -93,13 +93,15 @@ typedef int pid_t; #endif ////////////////////////////////////// -// https://softwareengineering.stackexchange.com/questions/291141/how-to-handle-design-changes-for-auto-ptr-deprecation-in-c11 -#if __cplusplus >= 201103L - #include - #include - #include - template - using auto_ptr = std::unique_ptr; +#ifndef _MSC_VER + // https://softwareengineering.stackexchange.com/questions/291141/how-to-handle-design-changes-for-auto-ptr-deprecation-in-c11 + #if __cplusplus >= 201103L + #include + #include + #include + template + using auto_ptr = std::unique_ptr; + #endif #endif #endif // _CONFIG_H_ From f96ad7f0b3302dcad3183ae4a8ba911fef949567 Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Mon, 4 May 2020 08:31:25 +0100 Subject: [PATCH 02/27] Updated for MinGW/msys2 support. --- contrib/Qt/ReadMe.txt | 79 +++++++++---------------------------------- 1 file changed, 16 insertions(+), 63 deletions(-) diff --git a/contrib/Qt/ReadMe.txt b/contrib/Qt/ReadMe.txt index eed5d8b8..b8b702ca 100644 --- a/contrib/Qt/ReadMe.txt +++ b/contrib/Qt/ReadMe.txt @@ -1,74 +1,29 @@ contrib/Qt/ReadMe.txt --------------------- -Exiv2 works well with Qt. To support Qt/Windows users, a daily build of Exiv2 for MinGW/32 is provided. +Exiv2 works well with Qt. To build and run commandLineTool -------------------------------- -1) Either build Exiv2/MinGW/32 as documented: - http://clanmills.com/exiv2/mingw.shtml -OR - Download and install a build from the buildserver: - http://exiv2.dyndns.org:8080/userContent/builds/Categorized/Platform/mingw/ - Instructions for installing the build are in the bundle ReadMe.txt +1) Windows Users should install MinGW/msys2 as documented in README.md -2) Generate Makefile - /c/Users/rmills/gnu/exiv2/trunk/contrib/Qt > qmake commandLinePro.pro +2) All users should build Exiv2 with C++11 support as documented in README.md -3) Build commandLineTool.cpp - /c/Users/rmills/gnu/exiv2/trunk/contrib/Qt > make -B LDFLAGS=-L/usr/local/lib +3) Generate Makefile + Caution: You will have to modify commandLineTool.pro to fit your environment. + $ cd + $ cd contrib/Qt + $ qmake commandLinePro.pro -4) Run commandLineTool.exe - /c/Users/rmills/gnu/exiv2/trunk/contrib/Qt > release/commandLineTool.exe +4) Build commandLineTool.cpp + $ make -Gotchas (that I know about) +5) Run commandLineTool.exe + $ commandLineTool.exe -1 Set PKG_CONFIG_PATH correctly - export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" - -2 Set PATH to use the toolchain for Qt - PATH="/c/Qt/Qt5.6.0/5.6/mingw49_32/bin:/c/Qt/Qt5.6.0/Tools/mingw492_32/bin:/c/MinGW/bin:/usr/bin:/usr/local/bin:/c/cygwin64/bin:." - -3 You may need to copy libstdc++-6.dll to /usr/local/bin - cp $(which libstdc++-6.dll) /usr/local/bin - -4 You may have to edit commandLineTool.pro to match your environment - -5 DO NOT USE Cygwin Builds - -6 Do not give up. - This stuff works. You may have to work quite hard to get it working. - Don't give up. It will work. - -7 If you give up with MinGW, use Visual Studio. - -Running MinGW bash and setting Qt tools in the path ---------------------------------------------------- - -I have a batch file (mingw32.bat) to get me into MinGW. - -C:\>type \Users\rmills\com\mingw32.bat -@echo off -rem ------------------ -: mingw32.bat -: invoke MinGW bash -: -setlocal -set "PKG_CONFIG_PATH=/usr/local/lib/pkgconfig:/usr/lib/pkgconfig" -set "INCLUDE_PATH=/usr/local/inc" -set "LIBRARY_PATH=/usr/local/lib" -set "BINARY_PATH=/usr/local/bin" -rem set "PATH=c:\MinGW\bin;c:\MinGW\msys\1.0\bin;c:\MinGW\msys\1.0\local\bin;c:\Users\rmills\com;." -set "PATH=c:\Qt\Qt5.6.0\5.6\mingw49_32\bin;c:\Qt\Qt5.6.0\Tools\mingw492_32\bin;c:\MinGW\bin;\usr\bin:\usr\local\bin;c:\cygwin64\bin;c:\Users\rmills\com;." -set "PS1=\! -32- ${PWD}> " -c:\MinGW\msys\1.0\bin\bash.exe %*% - -: That's all Folks -rem ------------------ - -UNICODE_PATH ------------- +UNICODE_PATH on Windows +----------------------- Qt users may prefer to build Exiv2 to support UNICODE_PATH. The sample application samples/exifprint.cpp works with UNICODE_PATH. @@ -76,13 +31,11 @@ Searching for more information about Qt, MinGW and UNICODE_PATH --------------------------------------------------------------- These matters are occasionally discussed on the forum. Please search to read discussions. -You will probably find the following helpful: +https://github.com/Exiv2/exiv2/issues/1101#issuecomment-623141576 http://dev.exiv2.org/boards/3/topics/2311?r=2312#message-2312 http://dev.exiv2.org/issues/1169 http://dev.exiv2.org/boards/3/topics/2705 -However there have been others and there will be more in future. - Robin Mills http://clanmills.com -2016-09-19 +2020-05-04 From 97304989b7e97f27ef27c0fe932185b77bf3a102 Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Mon, 4 May 2020 12:04:58 +0100 Subject: [PATCH 03/27] Documentation Polishing. --- contrib/Qt/ReadMe.txt | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/contrib/Qt/ReadMe.txt b/contrib/Qt/ReadMe.txt index b8b702ca..5795c885 100644 --- a/contrib/Qt/ReadMe.txt +++ b/contrib/Qt/ReadMe.txt @@ -3,6 +3,10 @@ contrib/Qt/ReadMe.txt Exiv2 works well with Qt. +Qt requires C++11 libraries which are the default for Exiv2 v0.28 and later. +Exiv2 v0.27 default build (and pre-built binaries) are for C++98 +You will have to build Exiv2 v0.27 from source with C++11 for Qt. + To build and run commandLineTool -------------------------------- @@ -25,7 +29,9 @@ To build and run commandLineTool UNICODE_PATH on Windows ----------------------- -Qt users may prefer to build Exiv2 to support UNICODE_PATH. The sample application samples/exifprint.cpp works with UNICODE_PATH. +Windows users may prefer to build Exiv2 to support UNICODE_PATH. +The sample application samples/exifprint.cpp works with UNICODE_PATH. +The cmake option -DEXIV2_ENABLE_WIN_UNICODE=ON is documented in README.md Searching for more information about Qt, MinGW and UNICODE_PATH --------------------------------------------------------------- From ae87269ab1d746d749076be91288c3164f749679 Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Mon, 4 May 2020 12:19:38 +0100 Subject: [PATCH 04/27] Set default for -DEXIV2_BUILD_UNIT_TESTS OFF --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 99e694a4..bbe2b650 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,7 +28,7 @@ option( EXIV2_ENABLE_SSH "USE Libssh for SshIo (WEBREADY)" option( EXIV2_BUILD_SAMPLES "Build sample applications" ON ) option( EXIV2_BUILD_EXIV2_COMMAND "Build exiv2 command-line executable" ON ) -option( EXIV2_BUILD_UNIT_TESTS "Build unit tests" ON ) +option( EXIV2_BUILD_UNIT_TESTS "Build unit tests" OFF ) option( EXIV2_BUILD_DOC "Add 'doc' target to generate documentation" OFF ) option( EXIV2_BUILD_USE_C++11 "Use the C++11 compiler" OFF ) From 2e568e762b22376346118a93a1920768f26ab6cb Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Mon, 4 May 2020 12:20:33 +0100 Subject: [PATCH 05/27] Fix version= for Visual Studio 2019. --- src/version.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/version.cpp b/src/version.cpp index 765306db..77ab9b00 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -259,7 +259,7 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) size_t edition = (_MSC_VER-600)/100; const char* editions[] = { "0","1","2","3","4","5","6","2003", "2005", "2008", "2010", "2012","2013","2015","2017","2019"}; if ( edition == 13 && _MSC_VER >= 1910 ) edition++ ; // 2017 _MSC_VAR == 1910 - if ( edition == 13 && _MSC_VER >= 1920 ) edition++ ; // 2019 _MSC_VAR == 1920 + if ( edition == 14 && _MSC_VER >= 1920 ) edition++ ; // 2019 _MSC_VAR == 1920 if ( edition > lengthof(editions) ) edition = 0 ; if ( edition ) sprintf(version+::strlen(version)," (%s/%s)",editions[edition],bits==64?"x64":"x86"); From 99aa8881a289b8855ce218ce76b2e9f0ee3a0229 Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Mon, 4 May 2020 19:09:24 +0100 Subject: [PATCH 06/27] $ make version_test segfaults on FreeBSD when called from an ssh script. --- src/version.cpp | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/version.cpp b/src/version.cpp index 77ab9b00..4c32da5d 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -74,6 +74,7 @@ # include # include # include +# include #elif defined(__sun__) # include # include @@ -185,21 +186,24 @@ static Exiv2::StringVector getLoadedLibraries() pushPath(path,libs,paths); } #elif defined(__FreeBSD__) - unsigned int n; - struct procstat* procstat = procstat_open_sysctl(); - struct kinfo_proc* procs = procstat ? procstat_getprocs(procstat, KERN_PROC_PID, getpid(), &n) : NULL; - struct filestat_list* files = procs ? procstat_getfiles(procstat, procs, true) : NULL; - if ( files ) { - filestat* entry; - STAILQ_FOREACH(entry, files, next) { - std::string path(entry->fs_path); - pushPath(path,libs,paths); + // this code seg-faults when called from an SSH script! (security?) + if ( isatty(STDIN_FILENO) ) { + unsigned int n; + struct procstat* procstat = procstat_open_sysctl(); + struct kinfo_proc* procs = procstat ? procstat_getprocs(procstat, KERN_PROC_PID, getpid(), &n) : NULL; + struct filestat_list* files = procs ? procstat_getfiles(procstat, procs, true) : NULL; + if ( files ) { + filestat* entry; + STAILQ_FOREACH(entry, files, next) { + std::string path(entry->fs_path); + pushPath(path,libs,paths); + } } + // free resources + if ( files ) procstat_freefiles(procstat, files); + if ( procs ) procstat_freeprocs(procstat, procs); + if ( procstat ) procstat_close (procstat); } - // free resources - if ( files ) procstat_freefiles(procstat, files); - if ( procs ) procstat_freeprocs(procstat, procs); - if ( procstat ) procstat_close (procstat); #elif defined (__sun__) || defined(__unix__) // http://stackoverflow.com/questions/606041/how-do-i-get-the-path-of-a-process-in-unix-linux char procsz[100]; @@ -210,8 +214,6 @@ static Exiv2::StringVector getLoadedLibraries() pathsz[l]='\0'; path.assign(pathsz); libs.push_back(path); - } else { - libs.push_back("unknown"); } // read file /proc/self/maps which has a list of files in memory From 529ffdc418ad4b91b2c2322d49979593553195e5 Mon Sep 17 00:00:00 2001 From: clanmills Date: Mon, 4 May 2020 21:08:29 +0100 Subject: [PATCH 07/27] Use using auto_ptr = std::unique_ptr; on all C++11 (and greater) platforms. Don't include unistd.h on MSVC. --- include/exiv2/config.h | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/exiv2/config.h b/include/exiv2/config.h index 8708fec1..01897dea 100644 --- a/include/exiv2/config.h +++ b/include/exiv2/config.h @@ -93,15 +93,15 @@ typedef int pid_t; #endif ////////////////////////////////////// -#ifndef _MSC_VER - // https://softwareengineering.stackexchange.com/questions/291141/how-to-handle-design-changes-for-auto-ptr-deprecation-in-c11 - #if __cplusplus >= 201103L - #include - #include +// https://softwareengineering.stackexchange.com/questions/291141/how-to-handle-design-changes-for-auto-ptr-deprecation-in-c11 +#if __cplusplus >= 201103L + #include + #include + #ifndef _MSC_VER #include - template - using auto_ptr = std::unique_ptr; #endif + template + using auto_ptr = std::unique_ptr; #endif #endif // _CONFIG_H_ From 4511817028d84d8a6cde129c2041a17bd8014470 Mon Sep 17 00:00:00 2001 From: clanmills Date: Mon, 4 May 2020 21:41:17 +0100 Subject: [PATCH 08/27] MSVC Changes. Leave CMake to set /std:. Only set /Zc:__cplusplus for VS2019+. Updated README.md --- README.md | 4 +++- cmake/compilerFlags.cmake | 32 +++----------------------------- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/README.md b/README.md index 874c0eee..60917c11 100644 --- a/README.md +++ b/README.md @@ -714,6 +714,8 @@ $ make The option -DCMAKE\_CXX\_FLAGS=-Wno-deprecated suppresses warnings from C++11 concerning auto\_ptr and other deprecated features. +**Caution:** Visual Studio users should not use -DCMAKE\_CXX\_STANDARD=11 or -DCMAKE\_CXX\_FLAGS=-Wno-deprecated. + [TOC](#TOC)
@@ -1187,4 +1189,4 @@ $ sudo pkg install developer/gcc-7 [TOC](#TOC) -Written by Robin Mills
robin@clanmills.com
Updated: 2020-05-02 +Written by Robin Mills
robin@clanmills.com
Updated: 2020-05-04 diff --git a/cmake/compilerFlags.cmake b/cmake/compilerFlags.cmake index 8cb29698..495d239c 100644 --- a/cmake/compilerFlags.cmake +++ b/cmake/compilerFlags.cmake @@ -138,35 +138,9 @@ if(MSVC) add_compile_options(/MP) add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN) - # https://stackoverflow.com/questions/44960715/how-to-enable-stdc17-in-vs2017-with-cmake - if (MSVC_VERSION GREATER_EQUAL "1700") # VS2015 and up - include(CheckCXXCompilerFlag) - # MSVC doesn't have a setting for C++11 as it's a subset of C++14 - if ( ${CMAKE_CXX_STANDARD} STREQUAL "11" OR ${CMAKE_CXX_STANDARD} STREQUAL "14" ) - CHECK_CXX_COMPILER_FLAG("/std:c++14" _cpp_14) - if (_cpp_14) - add_compile_options("/std:c++14") - else() - message(WARNING "Cannot set compiler option /std:c++14") - endif() - endif() - if ( ${CMAKE_CXX_STANDARD} STREQUAL "17" ) - CHECK_CXX_COMPILER_FLAG("/std:c++17" _cpp_17) - if (_cpp_17) - add_compile_options("/std:c++17") - else() - message(WARNING "Cannot set compiler option /std:c++17") - endif() - endif() - if ( ${CMAKE_CXX_STANDARD} STREQUAL "20" ) - CHECK_CXX_COMPILER_FLAG("/std:c++11" _cpp_20) - if (_cpp_20) - add_compile_options("/std:c++20") - else() - message(WARNING "Cannot set compiler option /std:c++20") - endif() - endif() - # https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ + # https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ + if (MSVC_VERSION GREATER_EQUAL "1900") # VS2019 and up add_compile_options("/Zc:__cplusplus") endif() + endif() From ffde3c593b930e03165a99a962e78c026706b4bb Mon Sep 17 00:00:00 2001 From: clanmills Date: Tue, 5 May 2020 00:04:02 +0100 Subject: [PATCH 09/27] Clarify possible values for CMAKE_CXX_STANDARD. --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 60917c11..54cec59f 100644 --- a/README.md +++ b/README.md @@ -701,7 +701,7 @@ You will find that 3 tests fail at the end of the test suite. It is safe to ign ### 2.17 Building with C++11 and other compilers -Exiv2 uses the default compiler for your system. Exiv2 v0.27 was written to the C++ 1998 standard and uses auto\_ptr. The C++11 and C++14 compilers will issue deprecation warnings about auto\_ptr. As _auto\_ptr support has been removed from C++17, you cannot build Exiv2 v0.27 with C++17 or later compilers._ Exiv2 v0.28 and later do not use auto\_ptr and will build with all compilers. +Exiv2 uses the default compiler for your system. Exiv2 v0.27 was written to the C++ 1998 standard and uses auto\_ptr. The C++11 and C++14 compilers will issue deprecation warnings about auto\_ptr. As _auto\_ptr support has been removed from C++17, you cannot build Exiv2 v0.27 with C++17 or later compilers._ Exiv2 v0.28 and later do not use auto\_ptr and will build with modern Standard C++ Compilers. To generate a build with C++11: @@ -712,9 +712,9 @@ $ cmake .. -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_FLAGS=-Wno-deprecated $ make ``` -The option -DCMAKE\_CXX\_FLAGS=-Wno-deprecated suppresses warnings from C++11 concerning auto\_ptr and other deprecated features. +The option -DCMAKE\_CXX\_STANDARD=11 specifies the C++ Language Standard. Possible values are 98, 11 or 14. -**Caution:** Visual Studio users should not use -DCMAKE\_CXX\_STANDARD=11 or -DCMAKE\_CXX\_FLAGS=-Wno-deprecated. +The option -DCMAKE\_CXX\_FLAGS=-Wno-deprecated suppresses warnings from C++11 concerning auto\_ptr and other deprecated features. **Caution:** Visual Studio users should not use -DCMAKE\_CXX\_FLAGS=-Wno-deprecated. [TOC](#TOC) From 38e37b7c61e4313022ebca889e0f183319625068 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 5 May 2020 07:46:53 +0200 Subject: [PATCH 10/27] Use -DCMAKE_CXX_STANDARD=98 in our travis jobs --- .travis.yml | 8 ++++---- CMakeLists.txt | 1 - 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index d10b8cf9..9a8bffec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,7 +10,7 @@ matrix: dist: xenial sudo: required compiler: gcc - env: COVERAGE=1 CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DBUILD_WITH_COVERAGE=ON -DEXIV2_ENABLE_CURL=ON" + env: COVERAGE=1 CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Debug -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DBUILD_WITH_COVERAGE=ON -DEXIV2_ENABLE_CURL=ON -DCMAKE_CXX_STANDARD=98" - os: linux dist: xenial @@ -18,18 +18,18 @@ matrix: compiler: gcc env: - WITH_VALGRIND=1 - - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DEXIV2_ENABLE_CURL=ON" + - CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DEXIV2_ENABLE_CURL=ON -DCMAKE_CXX_STANDARD=98" - os: linux dist: xenial sudo: required compiler: clang - env: CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DEXIV2_ENABLE_CURL=ON" + env: CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DEXIV2_ENABLE_CURL=ON -DCMAKE_CXX_STANDARD=98" - os: osx osx_image: xcode11.3 compiler: clang - env: CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_CURL=ON" + env: CMAKE_OPTIONS="-DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_VIDEO=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=ON -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_CURL=ON -DCMAKE_CXX_STANDARD=98" install: ./ci/install.sh script: ./ci/run.sh diff --git a/CMakeLists.txt b/CMakeLists.txt index bbe2b650..5088b10f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,7 +30,6 @@ option( EXIV2_BUILD_SAMPLES "Build sample applications" option( EXIV2_BUILD_EXIV2_COMMAND "Build exiv2 command-line executable" ON ) option( EXIV2_BUILD_UNIT_TESTS "Build unit tests" OFF ) option( EXIV2_BUILD_DOC "Add 'doc' target to generate documentation" OFF ) -option( EXIV2_BUILD_USE_C++11 "Use the C++11 compiler" OFF ) # Only intended to be used by Exiv2 developers/contributors option( EXIV2_TEAM_EXTRA_WARNINGS "Add more sanity checks using compiler flags" OFF ) From 0614d123859bc69bec99da4aa9d0f30cd4d7cbcd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 5 May 2020 07:50:36 +0200 Subject: [PATCH 11/27] Update conan & ninja in appveyor --- appveyor.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index da25fbb5..c9275c83 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -45,11 +45,11 @@ install: - echo %APPVEYOR_BUILD_FOLDER% - mkdir C:\projects\deps - cd C:\projects\deps - - appveyor DownloadFile https://github.com/ninja-build/ninja/releases/download/v1.9.0/ninja-win.zip -FileName ninja.zip + - appveyor DownloadFile https://github.com/ninja-build/ninja/releases/download/v1.10.0/ninja-win.zip -FileName ninja.zip - 7z x ninja.zip -oC:\projects\deps\ninja > nul - set PATH=C:\projects\deps\ninja;%PATH% - ninja --version - - pip.exe install conan==1.24.0 + - pip.exe install conan==1.24.1 - cd %APPVEYOR_BUILD_FOLDER% before_build: From 6667e13c4b1bbab68836643b27782bf95e8a803e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Luis=20D=C3=ADaz=20M=C3=A1s?= Date: Tue, 5 May 2020 08:09:45 +0200 Subject: [PATCH 12/27] Only use __cplusplus trick from VS2017 --- cmake/compilerFlags.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/compilerFlags.cmake b/cmake/compilerFlags.cmake index 495d239c..0418aa61 100644 --- a/cmake/compilerFlags.cmake +++ b/cmake/compilerFlags.cmake @@ -139,7 +139,7 @@ if(MSVC) add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN) # https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/ - if (MSVC_VERSION GREATER_EQUAL "1900") # VS2019 and up + if (MSVC_VERSION GREATER_EQUAL "1910") # VS2017 and up add_compile_options("/Zc:__cplusplus") endif() From a1abe21a71ed273714c2b6d02c8b56b877481bde Mon Sep 17 00:00:00 2001 From: Robin Mills Date: Tue, 5 May 2020 11:58:55 +0100 Subject: [PATCH 13/27] Discussion: https://github.com/Exiv2/exiv2/issues/1200#issuecomment-623975537 --- conanfile.py | 2 ++ samples/CMakeLists.txt | 4 +++- src/CMakeLists.txt | 4 +++- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/conanfile.py b/conanfile.py index d161e655..ad76b393 100644 --- a/conanfile.py +++ b/conanfile.py @@ -40,6 +40,8 @@ class Exiv2Conan(ConanFile): # libopenssl (a transitive dependency) if os_info.is_windows: self.requires('libcurl/7.69.1') + self.options['libcurl'].with_openssl = False + self.options['libcurl'].with_winssl = True else: self.requires('libcurl/7.64.1@bincrafters/stable') diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 7628110d..26393352 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -105,7 +105,9 @@ if (EXIV2_ENABLE_WEBREADY) if (USING_CONAN) target_compile_definitions(conntest PRIVATE ${CONAN_COMPILE_DEFINITIONS_LIBCURL}) target_link_libraries(conntest PRIVATE ${CONAN_EXE_LINKER_FLAGS_LIBCURL}) - if (NOT APPLE) + if ( MSVC ) + target_link_libraries(conntest PRIVATE Crypt32 Ws2_32 ${CURL_LIBRARIES}) + elseif (NOT APPLE) target_link_libraries(conntest PRIVATE CONAN_PKG::OpenSSL) endif() endif() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 7809863e..f6efba2a 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -182,7 +182,9 @@ if (EXIV2_ENABLE_WEBREADY) if (USING_CONAN) target_compile_definitions(exiv2lib PRIVATE ${CONAN_COMPILE_DEFINITIONS_LIBCURL}) target_link_libraries(exiv2lib PRIVATE ${CONAN_EXE_LINKER_FLAGS_LIBCURL}) - if (NOT APPLE) + if ( MSVC ) + target_link_libraries(exiv2lib PRIVATE Crypt32) + elseif (NOT APPLE) target_link_libraries(exiv2lib PRIVATE CONAN_PKG::OpenSSL) endif() endif() From 089b37a637314318a65bff46d462bcf619c45722 Mon Sep 17 00:00:00 2001 From: clanmills Date: Wed, 6 May 2020 09:04:23 +0100 Subject: [PATCH 14/27] make python_tests is with python 3.8 (on several platforms) says "This function reads ..." on every test! --- tests/system_tests.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system_tests.py b/tests/system_tests.py index 78e52b98..15525d10 100644 --- a/tests/system_tests.py +++ b/tests/system_tests.py @@ -526,7 +526,6 @@ def path(path_string): return os.path.join(*path_string.split('/')) -def test_run(self): """ This function reads in the attributes commands, retval, stdout, stderr, stdin and runs the `expand_variables` function on each. The resulting @@ -539,6 +538,7 @@ def test_run(self): test by the CaseMeta metaclass. This ensures that it is run by each system test **after** setUp() and setUpClass() were run. """ +def test_run(self): if not (len(self.commands) == len(self.retval) == len(self.stdout) == len(self.stderr) == len(self.stdin)): raise ValueError( From 365c5fc474e1748218e513ff8b664d6a0d7c355d Mon Sep 17 00:00:00 2001 From: clanmills Date: Wed, 6 May 2020 17:25:48 +0100 Subject: [PATCH 15/27] Suppress unit_tests.exe color and remove the ugly "Unsupported date format" warning. --- test/unit_test.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit_test.sh b/test/unit_test.sh index c2cb0174..70150875 100755 --- a/test/unit_test.sh +++ b/test/unit_test.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash # Test driver for exiv2.exe --verbose --version -( source ./functions.source ; $bin/unit_tests$exe ) +( source ./functions.source ; runTest unit_tests --gtest_color=no | grep -v "Warning: Unsupported date format") # That's all Folks! ## From 450195a3704d626727872b3758d4629d54d56746 Mon Sep 17 00:00:00 2001 From: clanmills Date: Wed, 6 May 2020 19:33:56 +0100 Subject: [PATCH 16/27] Adding support for VERBOSE to python_tests. Fixing unnecessary output on bash_tests and tests --- test/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/test/Makefile b/test/Makefile index 9d049679..7a5100ee 100644 --- a/test/Makefile +++ b/test/Makefile @@ -139,14 +139,14 @@ unit_test : -@./$@.sh bash_tests: - -if [ -e $$EXIV2_BINDIR/../Makefile ]; then \ + -@if [ -e $$EXIV2_BINDIR/../Makefile ]; then \ -@./$@.sh ; \ else \ make alltest ; \ fi tests: - -if [ -e $$EXIV2_BINDIR/../Makefile ]; then \ + -@if [ -e $$EXIV2_BINDIR/../Makefile ]; then \ -@./$@.sh ; \ else \ make unit_test ; make alltest ; make python_tests ; make version_test ; \ @@ -184,7 +184,7 @@ unixtest: @if [ -e tmp/test-failed ]; then echo '***' FAILED ; cat tmp/test-failed ; echo '***' ; fi python_tests: - -( cd ../tests ; python3 runner.py --verbose ) + -( cd ../tests ; if [ ! -z $$VERBOSE ]; then verbose=--verbose ;fi ; python3 runner.py $$verbose ) testv: From 2e870c21899f1d4b3e3db83267d760046c021251 Mon Sep 17 00:00:00 2001 From: clanmills Date: Wed, 6 May 2020 19:34:23 +0100 Subject: [PATCH 17/27] Documentation polishing. --- README.md | 46 +++++++++++++++++++++++++++++----------------- 1 file changed, 29 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 54cec59f..8268fed0 100644 --- a/README.md +++ b/README.md @@ -770,15 +770,16 @@ There are different kinds of tests: **Caution Visual Studio Users using cmd.exe**
_You may use `make` to to execute tests in the test directory. To execute tests from the build directory, use `cmake`._ This is discussed in detail below: [Running tests on Visual Studio builds](#4-2) -Environment Variables used by test suite +Environment Variables used by the test suite: | Variable | Default | Platforms | Purpose | |:-- |:-- |:-- |:-- | | EXIV2_BINDIR | **\/build/bin** | All Platforms | Locatation of built binary object (exiv2.exe) | | EXIV2_EXT | **.exe** | msvc
Cygwin
Msys
MinGW | Extension used by executable binaries | | EXIV2_EXT | _**not set**_ | Linux
macOS
Unix| | -| EXIV2_ECHO | _**not set**_ | All Platforms | For debugging Bash scripts | -| VALGRIND | _**not set**_ | All Platforms | For debugging Bash scripts | +| EXIV2_ECHO | _**not set**_ | All Platforms | For debugging Bash scripts | +| VALGRIND | _**not set**_ | All Platforms | For debugging Bash scripts | +| VERBOSE | _**not set**_ | All Platforms | Causes make to report its actions |
@@ -852,10 +853,11 @@ You can build with Visual Studio using Conan. The is described in detail in [RE As a summary, the procedure is: ``` -c:\...\exiv2> mkdir build +c:\...\exiv2>mkdir build +c:\...\exiv2>cd build c:\...\exiv2\build>conan install .. --build missing --profile msvc2019Release c:\...\exiv2\build>cmake .. -DEXIV2_BUILD_UNIT_TESTS=On -G "Visual Studio 16 2019" -c:\...\exiv2\build>cmake --build . --config release +c:\...\exiv2\build>cmake --build . --config Release ... lots of output from compiler and linker ... c:\...\exiv2\build> ``` @@ -869,10 +871,11 @@ c:\...\exiv2\build>copy c:\Python37\python.exe c:\Python37\python3.exe You must set the environment strings EXIV2\_BINDIR, EXIV2\_EXT and modify PATH. You will need a DOS Python3 interpreter on your path, and you'll need the bash interpreter. By careful to ensure the DOS python3.exe is found before the MingW/msys2 python3. ``` -c:\...\exiv2\build> set EXIV2_BINDIR=%CD% -c:\...\exiv2\build> set EXIV2_EXT=.exe -c:\...\exiv2\build\bin> set "PATH=c:\Python37;c:\Python37\Scripts;c:\msys64\usr\bin;%PATH%" +c:\...\exiv2\build>set EXIV2_BINDIR=%CD% +c:\...\exiv2\build>set EXIV2_EXT=.exe +c:\...\exiv2\build\bin>set "PATH=c:\Python37;c:\Python37\Scripts;c:\msys64\usr\bin;%PATH%" ``` + Move to the test directory and use make (which is in c:\msys64\usr\bin) to drive the test procedures. You cannot run the tests in the build directory because there is no Makefile in the build directory. ``` @@ -897,12 +900,10 @@ set "P=%P%c:\msys64\usr\bin;" # msys2 make, bash etc set "P=%P%c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin;" set "P=%P%c:\Windows\System32;" # windows set "P=%P%%USERPROFILE%\com;" # my home-made magic -echo %P% set "PATH=%P%" set "EXIV2_EXT=.exe" -set "EXIV2_BINDIR=%USERPROFILE%\gnu\github\exiv2\0.27-maintenance\build\bin" -color 0d -cmd /S /K cd "%EXIV2_BINDIR%\..\.." +color 1e +cmd /S /K cd "%USERPROFILE%\gnu\github\exiv2\0.27-maintenance\" color endlocal ``` @@ -914,6 +915,19 @@ c:\...\exiv2\test>cd ..\build c:\...\exiv2\build>cmake --build . --config Release --target tests ``` +If you wish to use an environment variables, use env: + +``` +c:\...\exiv2\build>env VERBOSE=1 cmake --build . --config Release --target tests +``` + +When you are in the test directory, msys/make provides the following _(more convenient)_ syntax: + +``` +c:\...\exiv2\test>make tests VERBOSE=1 +``` + + [TOC](#TOC)
@@ -1080,12 +1094,10 @@ set "P=%P%c:\msys64\usr\bin;" # msys2 make, bash etc set "P=%P%c:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin;" set "P=%P%c:\Windows\System32;" # windows set "P=%P%%USERPROFILE%\com;" # my home-made magic -echo %P% set "PATH=%P%" set "EXIV2_EXT=.exe" -set "EXIV2_BINDIR=%USERPROFILE%\gnu\github\exiv2\0.27-maintenance\build\bin" -color 0d -cmd /S /K cd "%EXIV2_BINDIR%\..\.." +color 1e +cmd /S /K cd "%USERPROFILE%\gnu\github\exiv2\0.27-maintenance\" color endlocal ``` @@ -1189,4 +1201,4 @@ $ sudo pkg install developer/gcc-7 [TOC](#TOC) -Written by Robin Mills
robin@clanmills.com
Updated: 2020-05-04 +Written by Robin Mills
robin@clanmills.com
Updated: 2020-05-06 From 43bfe5369372e496bc7506c7a117b4d31222dacc Mon Sep 17 00:00:00 2001 From: clanmills Date: Thu, 7 May 2020 18:54:58 +0100 Subject: [PATCH 18/27] Add VS2019 to AppVeyor. Relax 2013 (NO webready, NO unit_tests, NO WarningsAsErrors). Removed one 2013 from matrix. --- appveyor.yml | 30 +++++++++++++++++------------- 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index c9275c83..3a1c7419 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -5,13 +5,14 @@ environment: PYTHON: "C:/Python37-x64" matrix: - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 CMAKE_GENERATOR: Ninja INTEGRATION_TESTS: 1 - VS_COMPILER_VERSION: 14 - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat + VS_COMPILER_VERSION: 16 + VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat ARCHITECTURE: x86_64 UNIT_TESTS: 1 + WEBREADY: True WARNINGS_AS_ERRORS: ON - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 CMAKE_GENERATOR: Ninja @@ -20,23 +21,26 @@ environment: VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat ARCHITECTURE: x86_64 UNIT_TESTS: 1 + WEBREADY: True WARNINGS_AS_ERRORS: ON - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 CMAKE_GENERATOR: Ninja - INTEGRATION_TESTS: 0 - VS_COMPILER_VERSION: 11 - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat + INTEGRATION_TESTS: 1 + VS_COMPILER_VERSION: 14 + VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat ARCHITECTURE: x86_64 UNIT_TESTS: 1 + WEBREADY: True WARNINGS_AS_ERRORS: ON - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 CMAKE_GENERATOR: Ninja INTEGRATION_TESTS: 0 - VS_COMPILER_VERSION: 12 - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat + VS_COMPILER_VERSION: 11 + VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat ARCHITECTURE: x86_64 - UNIT_TESTS: 1 - WARNINGS_AS_ERRORS: ON + UNIT_TESTS: 0 + WEBREADY: False + WARNINGS_AS_ERRORS: OFF shallow_clone: true @@ -66,9 +70,9 @@ build_script: - cmd: cd build - cmd: call "%VCVARS%" x86_amd64 - cmd: conan --version - - cmd: conan install .. -o webready=True --build missing + - cmd: conan install .. -o webready=%WEBREADY% --build missing - cmd: echo %CMAKE_GENERATOR% - - cmd: cmake -G "%CMAKE_GENERATOR%" -DEXIV2_TEAM_WARNINGS_AS_ERRORS=%WARNINGS_AS_ERRORS% -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=ON -DEXIV2_BUILD_UNIT_TESTS=%UNIT_TESTS% -DCMAKE_INSTALL_PREFIX=install .. + - cmd: cmake -G "%CMAKE_GENERATOR%" -DEXIV2_TEAM_WARNINGS_AS_ERRORS=%WARNINGS_AS_ERRORS% -DCMAKE_BUILD_TYPE=Release -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_PNG=ON -DEXIV2_ENABLE_WEBREADY=%WEBREADY% -DEXIV2_BUILD_UNIT_TESTS=%UNIT_TESTS% -DCMAKE_INSTALL_PREFIX=install .. - cmd: cmake --build . --config Release - cmd: cmake --build . --config Release --target install - cmd: cd bin From 33c3735afb7a3d8e82c2136884b59f881524d63d Mon Sep 17 00:00:00 2001 From: clanmills Date: Thu, 7 May 2020 19:18:01 +0100 Subject: [PATCH 19/27] Restored VS2012 in the build matrix --- appveyor.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 3a1c7419..d1844a04 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -33,6 +33,15 @@ environment: WEBREADY: True WARNINGS_AS_ERRORS: ON - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 + CMAKE_GENERATOR: Ninja + INTEGRATION_TESTS: 0 + VS_COMPILER_VERSION: 12 + VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat + ARCHITECTURE: x86_64 + UNIT_TESTS: 0 + WEBREADY: False + WARNINGS_AS_ERRORS: OFF + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2012 CMAKE_GENERATOR: Ninja INTEGRATION_TESTS: 0 VS_COMPILER_VERSION: 11 From 6674b91f8553889007b88332320d9283be4b9b9e Mon Sep 17 00:00:00 2001 From: clanmills Date: Thu, 7 May 2020 19:29:05 +0100 Subject: [PATCH 20/27] VS2012 builds in the 2013 Image. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index d1844a04..754e0036 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -41,7 +41,7 @@ environment: UNIT_TESTS: 0 WEBREADY: False WARNINGS_AS_ERRORS: OFF - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2012 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 CMAKE_GENERATOR: Ninja INTEGRATION_TESTS: 0 VS_COMPILER_VERSION: 11 From a4bc385accea136ebb127ba11d89d67823628f32 Mon Sep 17 00:00:00 2001 From: clanmills Date: Thu, 7 May 2020 21:03:37 +0100 Subject: [PATCH 21/27] run exiv2 --verbose --version at the end of the build so we can be certain about what was built! --- appveyor.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 754e0036..add415dc 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -89,3 +89,5 @@ build_script: - cmd: cd ../../tests/ - cmd: set EXIV2_EXT=.exe - cmd: if %INTEGRATION_TESTS% == 1 %PYTHON%/python.exe runner.py -v + - cmd: cd ../build/bind + - cmd: exiv2 --version --verbose From 07005e206e385b565f49a39de34a67e651189781 Mon Sep 17 00:00:00 2001 From: clanmills Date: Thu, 7 May 2020 22:24:09 +0100 Subject: [PATCH 22/27] Fix typo. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index add415dc..ceda1749 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -89,5 +89,5 @@ build_script: - cmd: cd ../../tests/ - cmd: set EXIV2_EXT=.exe - cmd: if %INTEGRATION_TESTS% == 1 %PYTHON%/python.exe runner.py -v - - cmd: cd ../build/bind + - cmd: cd ../build/bin - cmd: exiv2 --version --verbose From 8362fde7feb7095cf0ff36621aa83c5cc82b0fc0 Mon Sep 17 00:00:00 2001 From: clanmills Date: Thu, 7 May 2020 23:26:53 +0100 Subject: [PATCH 23/27] Do not use Appveyor < VS 2013. I build/test "legacy" VS 2008, 2010, 2012 on the Mac Mini. --- appveyor.yml | 9 --------- 1 file changed, 9 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index ceda1749..461d7bf5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -41,15 +41,6 @@ environment: UNIT_TESTS: 0 WEBREADY: False WARNINGS_AS_ERRORS: OFF - - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 - CMAKE_GENERATOR: Ninja - INTEGRATION_TESTS: 0 - VS_COMPILER_VERSION: 11 - VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat - ARCHITECTURE: x86_64 - UNIT_TESTS: 0 - WEBREADY: False - WARNINGS_AS_ERRORS: OFF shallow_clone: true From c6da7f01657de1a8e5db41227d208ddc00c9ade8 Mon Sep 17 00:00:00 2001 From: clanmills Date: Fri, 8 May 2020 07:01:19 +0100 Subject: [PATCH 24/27] Trivial change to re-trigger CI. No idea why it died last night. --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 461d7bf5..d9591d60 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,7 +4,7 @@ init: environment: PYTHON: "C:/Python37-x64" - matrix: +matrix: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 CMAKE_GENERATOR: Ninja INTEGRATION_TESTS: 1 From 599c127b9426372bf7d3c3220bf98db91148c88a Mon Sep 17 00:00:00 2001 From: clanmills Date: Fri, 8 May 2020 07:30:52 +0100 Subject: [PATCH 25/27] Revert previous trivial change to appveyor as it totally killed Appveyor! --- appveyor.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index d9591d60..461d7bf5 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -4,7 +4,7 @@ init: environment: PYTHON: "C:/Python37-x64" -matrix: + matrix: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019 CMAKE_GENERATOR: Ninja INTEGRATION_TESTS: 1 From c69c6d0848790a3d2e8a98b29b64a7b04fe1905b Mon Sep 17 00:00:00 2001 From: clanmills Date: Fri, 8 May 2020 08:23:17 +0100 Subject: [PATCH 26/27] tidy up ci and test scripts --- ci/run.sh | 18 +++++------------- test/functions.source | 4 ++-- 2 files changed, 7 insertions(+), 15 deletions(-) diff --git a/ci/run.sh b/ci/run.sh index d358fe0f..d3000dba 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -6,7 +6,6 @@ set -x source conan/bin/activate if [[ "$(uname -s)" == 'Linux' ]]; then - if [ "$CC" == "clang" ]; then # clang + Ubuntu don't like to run with UBSAN, but ASAN works export CMAKE_OPTIONS="$CMAKE_OPTIONS -DCMAKE_CXX_FLAGS=\"-fsanitize=address\" -DCMAKE_C_FLAGS=\"-fsanitize=address\" -DCMAKE_EXE_LINKER_FLAGS=\"-fsanitize=address\" -DCMAKE_MODULE_LINKER_FLAGS=\"-fsanitize=address\"" @@ -19,15 +18,13 @@ else export CMAKE_OPTIONS="$CMAKE_OPTIONS -DEXIV2_TEAM_USE_SANITIZERS=ON" fi - -mkdir build && cd build +mkdir build +cd build conan install .. -o webready=True --build missing - cmake ${CMAKE_OPTIONS} -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_INSTALL_PREFIX=install .. -make -j2 - -make tests -make install +make +make tests +make install # Check for detecting issues with the installation of headers if [ `ls install/include/exiv2/ | wc -l` > 10 ]; then @@ -37,11 +34,6 @@ else exit 1 fi -pushd . -cd bin -$EXIV2_VALGRIND ./unit_tests -popd - if [ -n "$COVERAGE" ]; then bash <(curl -s https://codecov.io/bash) fi diff --git a/test/functions.source b/test/functions.source index 0f1f993e..949394c8 100644 --- a/test/functions.source +++ b/test/functions.source @@ -495,7 +495,7 @@ prepareTest() good="$here/data/${this}.out" results="$here/tmp/${this}.out" tmpfile=$here/tmp/$this - touch $tmpfile + echo '' >> $tmpfile if [ "$PLATFORM" == SunOS -o "$PLATFORM" == FreeBSD -o "$PLATFORM" == NetBSD ] ; then da1="" @@ -508,7 +508,7 @@ prepareTest() fi tmpfile=tmp/ttt - touch $tmpfile + echo '' >> $tmpfile da1="--strip-trailing-cr" diff -q $da1 $tmpfile $tmpfile 2>/dev/null if [ $? -ne 0 ] ; then From d76d5345c486371e44fc2fcc36fc6c059a9f6217 Mon Sep 17 00:00:00 2001 From: clanmills Date: Fri, 8 May 2020 09:29:49 +0100 Subject: [PATCH 27/27] Use make -j 2 (can this fail if there's only one core?) --- ci/run.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/run.sh b/ci/run.sh index d3000dba..2a6dfe40 100755 --- a/ci/run.sh +++ b/ci/run.sh @@ -22,7 +22,7 @@ mkdir build cd build conan install .. -o webready=True --build missing cmake ${CMAKE_OPTIONS} -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_INSTALL_PREFIX=install .. -make +make -j 2 make tests make install