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_