Merge pull request #1197 from Exiv2/add_c++11_support_0.27

Add c++11 support 0.27
v0.27.3
Robin Mills 5 years ago committed by GitHub
commit 0d17fb63d8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -10,7 +10,7 @@ matrix:
dist: xenial dist: xenial
sudo: required sudo: required
compiler: gcc 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 - os: linux
dist: xenial dist: xenial
@ -18,18 +18,18 @@ matrix:
compiler: gcc compiler: gcc
env: env:
- WITH_VALGRIND=1 - 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 - os: linux
dist: xenial dist: xenial
sudo: required sudo: required
compiler: clang 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 - os: osx
osx_image: xcode11.3 osx_image: xcode11.3
compiler: clang 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 install: ./ci/install.sh
script: ./ci/run.sh script: ./ci/run.sh

@ -28,9 +28,8 @@ option( EXIV2_ENABLE_SSH "USE Libssh for SshIo (WEBREADY)"
option( EXIV2_BUILD_SAMPLES "Build sample applications" ON ) option( EXIV2_BUILD_SAMPLES "Build sample applications" ON )
option( EXIV2_BUILD_EXIV2_COMMAND "Build exiv2 command-line executable" 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_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 # Only intended to be used by Exiv2 developers/contributors
option( EXIV2_TEAM_EXTRA_WARNINGS "Add more sanity checks using compiler flags" OFF ) option( EXIV2_TEAM_EXTRA_WARNINGS "Add more sanity checks using compiler flags" OFF )

@ -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 ### 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: To generate a build with C++11:
@ -712,7 +712,9 @@ $ cmake .. -DCMAKE_CXX_STANDARD=11 -DCMAKE_CXX_FLAGS=-Wno-deprecated
$ make $ 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.
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) [TOC](#TOC)
@ -768,7 +770,7 @@ There are different kinds of tests:
**Caution Visual Studio Users using cmd.exe**<br>_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) **Caution Visual Studio Users using cmd.exe**<br>_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 | | Variable | Default | Platforms | Purpose |
|:-- |:-- |:-- |:-- | |:-- |:-- |:-- |:-- |
@ -777,6 +779,7 @@ Environment Variables used by test suite
| EXIV2_EXT | _**not set**_ | Linux<br>macOS<br>Unix| | | EXIV2_EXT | _**not set**_ | Linux<br>macOS<br>Unix| |
| EXIV2_ECHO | _**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 | | VALGRIND | _**not set**_ | All Platforms | For debugging Bash scripts |
| VERBOSE | _**not set**_ | All Platforms | Causes make to report its actions |
<div id="4-1"> <div id="4-1">
@ -851,9 +854,10 @@ 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>conan install .. --build missing --profile msvc2019Release
c:\...\exiv2\build>cmake .. -DEXIV2_BUILD_UNIT_TESTS=On -G "Visual Studio 16 2019" 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 ... ... lots of output from compiler and linker ...
c:\...\exiv2\build> c:\...\exiv2\build>
``` ```
@ -871,6 +875,7 @@ c:\...\exiv2\build> set EXIV2_BINDIR=%CD%
c:\...\exiv2\build>set EXIV2_EXT=.exe 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\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. 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.
``` ```
@ -895,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:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin;"
set "P=%P%c:\Windows\System32;" # windows set "P=%P%c:\Windows\System32;" # windows
set "P=%P%%USERPROFILE%\com;" # my home-made magic set "P=%P%%USERPROFILE%\com;" # my home-made magic
echo %P%
set "PATH=%P%" set "PATH=%P%"
set "EXIV2_EXT=.exe" set "EXIV2_EXT=.exe"
set "EXIV2_BINDIR=%USERPROFILE%\gnu\github\exiv2\0.27-maintenance\build\bin" color 1e
color 0d cmd /S /K cd "%USERPROFILE%\gnu\github\exiv2\0.27-maintenance\"
cmd /S /K cd "%EXIV2_BINDIR%\..\.."
color color
endlocal endlocal
``` ```
@ -912,6 +915,19 @@ c:\...\exiv2\test>cd ..\build
c:\...\exiv2\build>cmake --build . --config Release --target tests 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) [TOC](#TOC)
<div id="4-3"> <div id="4-3">
@ -1078,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:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin;"
set "P=%P%c:\Windows\System32;" # windows set "P=%P%c:\Windows\System32;" # windows
set "P=%P%%USERPROFILE%\com;" # my home-made magic set "P=%P%%USERPROFILE%\com;" # my home-made magic
echo %P%
set "PATH=%P%" set "PATH=%P%"
set "EXIV2_EXT=.exe" set "EXIV2_EXT=.exe"
set "EXIV2_BINDIR=%USERPROFILE%\gnu\github\exiv2\0.27-maintenance\build\bin" color 1e
color 0d cmd /S /K cd "%USERPROFILE%\gnu\github\exiv2\0.27-maintenance\"
cmd /S /K cd "%EXIV2_BINDIR%\..\.."
color color
endlocal endlocal
``` ```
@ -1187,4 +1201,4 @@ $ sudo pkg install developer/gcc-7
[TOC](#TOC) [TOC](#TOC)
Written by Robin Mills<br>robin@clanmills.com<br>Updated: 2020-05-02 Written by Robin Mills<br>robin@clanmills.com<br>Updated: 2020-05-06

@ -5,13 +5,14 @@ environment:
PYTHON: "C:/Python37-x64" PYTHON: "C:/Python37-x64"
matrix: matrix:
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2019
CMAKE_GENERATOR: Ninja CMAKE_GENERATOR: Ninja
INTEGRATION_TESTS: 1 INTEGRATION_TESTS: 1
VS_COMPILER_VERSION: 14 VS_COMPILER_VERSION: 16
VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat
ARCHITECTURE: x86_64 ARCHITECTURE: x86_64
UNIT_TESTS: 1 UNIT_TESTS: 1
WEBREADY: True
WARNINGS_AS_ERRORS: ON WARNINGS_AS_ERRORS: ON
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017
CMAKE_GENERATOR: Ninja CMAKE_GENERATOR: Ninja
@ -20,14 +21,16 @@ environment:
VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat VCVARS: C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat
ARCHITECTURE: x86_64 ARCHITECTURE: x86_64
UNIT_TESTS: 1 UNIT_TESTS: 1
WEBREADY: True
WARNINGS_AS_ERRORS: ON WARNINGS_AS_ERRORS: ON
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015
CMAKE_GENERATOR: Ninja CMAKE_GENERATOR: Ninja
INTEGRATION_TESTS: 0 INTEGRATION_TESTS: 1
VS_COMPILER_VERSION: 11 VS_COMPILER_VERSION: 14
VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 11.0\VC\vcvarsall.bat VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat
ARCHITECTURE: x86_64 ARCHITECTURE: x86_64
UNIT_TESTS: 1 UNIT_TESTS: 1
WEBREADY: True
WARNINGS_AS_ERRORS: ON WARNINGS_AS_ERRORS: ON
- APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2013
CMAKE_GENERATOR: Ninja CMAKE_GENERATOR: Ninja
@ -35,8 +38,9 @@ environment:
VS_COMPILER_VERSION: 12 VS_COMPILER_VERSION: 12
VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat VCVARS: C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat
ARCHITECTURE: x86_64 ARCHITECTURE: x86_64
UNIT_TESTS: 1 UNIT_TESTS: 0
WARNINGS_AS_ERRORS: ON WEBREADY: False
WARNINGS_AS_ERRORS: OFF
shallow_clone: true shallow_clone: true
@ -45,11 +49,11 @@ install:
- echo %APPVEYOR_BUILD_FOLDER% - echo %APPVEYOR_BUILD_FOLDER%
- mkdir C:\projects\deps - mkdir C:\projects\deps
- cd 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 - 7z x ninja.zip -oC:\projects\deps\ninja > nul
- set PATH=C:\projects\deps\ninja;%PATH% - set PATH=C:\projects\deps\ninja;%PATH%
- ninja --version - ninja --version
- pip.exe install conan==1.24.0 - pip.exe install conan==1.24.1
- cd %APPVEYOR_BUILD_FOLDER% - cd %APPVEYOR_BUILD_FOLDER%
before_build: before_build:
@ -66,9 +70,9 @@ build_script:
- cmd: cd build - cmd: cd build
- cmd: call "%VCVARS%" x86_amd64 - cmd: call "%VCVARS%" x86_amd64
- cmd: conan --version - cmd: conan --version
- cmd: conan install .. -o webready=True --build missing - cmd: conan install .. -o webready=%WEBREADY% --build missing
- cmd: echo %CMAKE_GENERATOR% - 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
- cmd: cmake --build . --config Release --target install - cmd: cmake --build . --config Release --target install
- cmd: cd bin - cmd: cd bin
@ -76,3 +80,5 @@ build_script:
- cmd: cd ../../tests/ - cmd: cd ../../tests/
- cmd: set EXIV2_EXT=.exe - cmd: set EXIV2_EXT=.exe
- cmd: if %INTEGRATION_TESTS% == 1 %PYTHON%/python.exe runner.py -v - cmd: if %INTEGRATION_TESTS% == 1 %PYTHON%/python.exe runner.py -v
- cmd: cd ../build/bin
- cmd: exiv2 --version --verbose

@ -6,7 +6,6 @@ set -x
source conan/bin/activate source conan/bin/activate
if [[ "$(uname -s)" == 'Linux' ]]; then if [[ "$(uname -s)" == 'Linux' ]]; then
if [ "$CC" == "clang" ]; then if [ "$CC" == "clang" ]; then
# clang + Ubuntu don't like to run with UBSAN, but ASAN works # 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\"" 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,13 +18,11 @@ else
export CMAKE_OPTIONS="$CMAKE_OPTIONS -DEXIV2_TEAM_USE_SANITIZERS=ON" export CMAKE_OPTIONS="$CMAKE_OPTIONS -DEXIV2_TEAM_USE_SANITIZERS=ON"
fi fi
mkdir build
mkdir build && cd build cd build
conan install .. -o webready=True --build missing conan install .. -o webready=True --build missing
cmake ${CMAKE_OPTIONS} -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_INSTALL_PREFIX=install .. cmake ${CMAKE_OPTIONS} -DEXIV2_TEAM_WARNINGS_AS_ERRORS=ON -DCMAKE_INSTALL_PREFIX=install ..
make -j 2 make -j 2
make tests make tests
make install make install
@ -37,11 +34,6 @@ else
exit 1 exit 1
fi fi
pushd .
cd bin
$EXIV2_VALGRIND ./unit_tests
popd
if [ -n "$COVERAGE" ]; then if [ -n "$COVERAGE" ]; then
bash <(curl -s https://codecov.io/bash) bash <(curl -s https://codecov.io/bash)
fi fi

@ -90,6 +90,7 @@ endif ()
# http://stackoverflow.com/questions/10113017/setting-the-msvc-runtime-in-cmake # http://stackoverflow.com/questions/10113017/setting-the-msvc-runtime-in-cmake
if(MSVC) if(MSVC)
find_program(CLCACHE name clcache.exe find_program(CLCACHE name clcache.exe
PATHS ENV CLCACHE_PATH PATHS ENV CLCACHE_PATH
PATH_SUFFIXES Scripts clcache-4.1.0 PATH_SUFFIXES Scripts clcache-4.1.0
@ -136,4 +137,10 @@ if(MSVC)
# Object Level Parallelism # Object Level Parallelism
add_compile_options(/MP) add_compile_options(/MP)
add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN) add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN)
# https://devblogs.microsoft.com/cppblog/msvc-now-correctly-reports-__cplusplus/
if (MSVC_VERSION GREATER_EQUAL "1910") # VS2017 and up
add_compile_options("/Zc:__cplusplus")
endif()
endif() endif()

@ -40,6 +40,8 @@ class Exiv2Conan(ConanFile):
# libopenssl (a transitive dependency) # libopenssl (a transitive dependency)
if os_info.is_windows: if os_info.is_windows:
self.requires('libcurl/7.69.1') self.requires('libcurl/7.69.1')
self.options['libcurl'].with_openssl = False
self.options['libcurl'].with_winssl = True
else: else:
self.requires('libcurl/7.64.1@bincrafters/stable') self.requires('libcurl/7.64.1@bincrafters/stable')

@ -0,0 +1,47 @@
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
--------------------------------
1) Windows Users should install MinGW/msys2 as documented in README.md
2) All users should build Exiv2 with C++11 support as documented in README.md
3) Generate Makefile
Caution: You will have to modify commandLineTool.pro to fit your environment.
$ cd <exiv2dir>
$ cd contrib/Qt
$ qmake commandLinePro.pro
4) Build commandLineTool.cpp
$ make
5) Run commandLineTool.exe
$ commandLineTool.exe
UNICODE_PATH on Windows
-----------------------
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
---------------------------------------------------------------
These matters are occasionally discussed on the forum. Please search to read discussions.
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
Robin Mills
http://clanmills.com
2020-05-04

@ -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
}

@ -0,0 +1,15 @@
#include <QCoreApplication>
#include <exiv2/exiv2.hpp>
#include <iostream>
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();
}

@ -97,7 +97,9 @@ typedef int pid_t;
#if __cplusplus >= 201103L #if __cplusplus >= 201103L
#include <memory> #include <memory>
#include <sys/types.h> #include <sys/types.h>
#ifndef _MSC_VER
#include <unistd.h> #include <unistd.h>
#endif
template <typename T> template <typename T>
using auto_ptr = std::unique_ptr<T>; using auto_ptr = std::unique_ptr<T>;
#endif #endif

@ -105,7 +105,9 @@ if (EXIV2_ENABLE_WEBREADY)
if (USING_CONAN) if (USING_CONAN)
target_compile_definitions(conntest PRIVATE ${CONAN_COMPILE_DEFINITIONS_LIBCURL}) target_compile_definitions(conntest PRIVATE ${CONAN_COMPILE_DEFINITIONS_LIBCURL})
target_link_libraries(conntest PRIVATE ${CONAN_EXE_LINKER_FLAGS_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) target_link_libraries(conntest PRIVATE CONAN_PKG::OpenSSL)
endif() endif()
endif() endif()

@ -182,7 +182,9 @@ if (EXIV2_ENABLE_WEBREADY)
if (USING_CONAN) if (USING_CONAN)
target_compile_definitions(exiv2lib PRIVATE ${CONAN_COMPILE_DEFINITIONS_LIBCURL}) target_compile_definitions(exiv2lib PRIVATE ${CONAN_COMPILE_DEFINITIONS_LIBCURL})
target_link_libraries(exiv2lib PRIVATE ${CONAN_EXE_LINKER_FLAGS_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) target_link_libraries(exiv2lib PRIVATE CONAN_PKG::OpenSSL)
endif() endif()
endif() endif()

@ -74,6 +74,7 @@
# include <sys/socket.h> # include <sys/socket.h>
# include <sys/sysctl.h> # include <sys/sysctl.h>
# include <libprocstat.h> # include <libprocstat.h>
# include <unistd.h>
#elif defined(__sun__) #elif defined(__sun__)
# include <dlfcn.h> # include <dlfcn.h>
# include <link.h> # include <link.h>
@ -185,6 +186,8 @@ static Exiv2::StringVector getLoadedLibraries()
pushPath(path,libs,paths); pushPath(path,libs,paths);
} }
#elif defined(__FreeBSD__) #elif defined(__FreeBSD__)
// this code seg-faults when called from an SSH script! (security?)
if ( isatty(STDIN_FILENO) ) {
unsigned int n; unsigned int n;
struct procstat* procstat = procstat_open_sysctl(); struct procstat* procstat = procstat_open_sysctl();
struct kinfo_proc* procs = procstat ? procstat_getprocs(procstat, KERN_PROC_PID, getpid(), &n) : NULL; struct kinfo_proc* procs = procstat ? procstat_getprocs(procstat, KERN_PROC_PID, getpid(), &n) : NULL;
@ -200,6 +203,7 @@ static Exiv2::StringVector getLoadedLibraries()
if ( files ) procstat_freefiles(procstat, files); if ( files ) procstat_freefiles(procstat, files);
if ( procs ) procstat_freeprocs(procstat, procs); if ( procs ) procstat_freeprocs(procstat, procs);
if ( procstat ) procstat_close (procstat); if ( procstat ) procstat_close (procstat);
}
#elif defined (__sun__) || defined(__unix__) #elif defined (__sun__) || defined(__unix__)
// http://stackoverflow.com/questions/606041/how-do-i-get-the-path-of-a-process-in-unix-linux // http://stackoverflow.com/questions/606041/how-do-i-get-the-path-of-a-process-in-unix-linux
char procsz[100]; char procsz[100];
@ -210,8 +214,6 @@ static Exiv2::StringVector getLoadedLibraries()
pathsz[l]='\0'; pathsz[l]='\0';
path.assign(pathsz); path.assign(pathsz);
libs.push_back(path); libs.push_back(path);
} else {
libs.push_back("unknown");
} }
// read file /proc/self/maps which has a list of files in memory // read file /proc/self/maps which has a list of files in memory
@ -259,7 +261,7 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys)
size_t edition = (_MSC_VER-600)/100; 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"}; 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 >= 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 > lengthof(editions) ) edition = 0 ;
if ( edition ) sprintf(version+::strlen(version)," (%s/%s)",editions[edition],bits==64?"x64":"x86"); if ( edition ) sprintf(version+::strlen(version)," (%s/%s)",editions[edition],bits==64?"x64":"x86");

@ -139,14 +139,14 @@ unit_test :
-@./$@.sh -@./$@.sh
bash_tests: bash_tests:
-if [ -e $$EXIV2_BINDIR/../Makefile ]; then \ -@if [ -e $$EXIV2_BINDIR/../Makefile ]; then \
-@./$@.sh ; \ -@./$@.sh ; \
else \ else \
make alltest ; \ make alltest ; \
fi fi
tests: tests:
-if [ -e $$EXIV2_BINDIR/../Makefile ]; then \ -@if [ -e $$EXIV2_BINDIR/../Makefile ]; then \
-@./$@.sh ; \ -@./$@.sh ; \
else \ else \
make unit_test ; make alltest ; make python_tests ; make version_test ; \ 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 @if [ -e tmp/test-failed ]; then echo '***' FAILED ; cat tmp/test-failed ; echo '***' ; fi
python_tests: python_tests:
-( cd ../tests ; python3 runner.py --verbose ) -( cd ../tests ; if [ ! -z $$VERBOSE ]; then verbose=--verbose ;fi ; python3 runner.py $$verbose )
testv: testv:

@ -495,7 +495,7 @@ prepareTest()
good="$here/data/${this}.out" good="$here/data/${this}.out"
results="$here/tmp/${this}.out" results="$here/tmp/${this}.out"
tmpfile=$here/tmp/$this tmpfile=$here/tmp/$this
touch $tmpfile echo '' >> $tmpfile
if [ "$PLATFORM" == SunOS -o "$PLATFORM" == FreeBSD -o "$PLATFORM" == NetBSD ] ; then if [ "$PLATFORM" == SunOS -o "$PLATFORM" == FreeBSD -o "$PLATFORM" == NetBSD ] ; then
da1="" da1=""
@ -508,7 +508,7 @@ prepareTest()
fi fi
tmpfile=tmp/ttt tmpfile=tmp/ttt
touch $tmpfile echo '' >> $tmpfile
da1="--strip-trailing-cr" da1="--strip-trailing-cr"
diff -q $da1 $tmpfile $tmpfile 2>/dev/null diff -q $da1 $tmpfile $tmpfile 2>/dev/null
if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then

@ -1,7 +1,7 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# Test driver for exiv2.exe --verbose --version # 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! # That's all Folks!
## ##

@ -526,7 +526,6 @@ def path(path_string):
return os.path.join(*path_string.split('/')) return os.path.join(*path_string.split('/'))
def test_run(self):
""" """
This function reads in the attributes commands, retval, stdout, stderr, This function reads in the attributes commands, retval, stdout, stderr,
stdin and runs the `expand_variables` function on each. The resulting 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 by the CaseMeta metaclass. This ensures that it is run by each system
test **after** setUp() and setUpClass() were run. test **after** setUp() and setUpClass() were run.
""" """
def test_run(self):
if not (len(self.commands) == len(self.retval) if not (len(self.commands) == len(self.retval)
== len(self.stdout) == len(self.stderr) == len(self.stdin)): == len(self.stdout) == len(self.stderr) == len(self.stdin)):
raise ValueError( raise ValueError(

Loading…
Cancel
Save