diff --git a/CMakeLists.txt b/CMakeLists.txt index 570e5742..d93b5dd5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,10 +1,4 @@ -# CMake build system for exiv2 library and executables -# Copyright 2015- Daniel Kaneider -# Copyright 2010-2012 Gilles Caulier -# Copyright 2008 Patrick Spendrin - -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# CMakeLists.txt for exiv2 library cmake_minimum_required( VERSION 3.1.0 ) project( exiv2 ) @@ -30,67 +24,66 @@ set( GENERIC_LIB_VERSION "26.0.0" ) set( GENERIC_LIB_SOVERSION "26" ) # options and their default values -option( BUILD_SHARED_LIBS "Build exiv2lib as a shared library" ON ) -option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON ) -option( EXIV2_ENABLE_LIBXMP "Build a static convenience Library for XMP" ON ) -option( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON ) -option( EXIV2_ENABLE_NLS "Build native language support (requires gettext)" ON ) -option( EXIV2_ENABLE_PRINTUCS2 "Build with Printucs2" ON ) -option( EXIV2_ENABLE_LENSDATA "Build including lens data" ON ) -option( EXIV2_ENABLE_COMMERCIAL "Build with the EXV_COMMERCIAL_VERSION symbol set" OFF ) -option( EXIV2_ENABLE_BUILD_SAMPLES "Build the unit tests" ON ) -option( EXIV2_ENABLE_BUILD_PO "Build translations files" OFF ) -option( EXIV2_ENABLE_VIDEO "Build video support into library" OFF ) -option( EXIV2_ENABLE_WEBREADY "Build webready support into library" OFF ) -option( EXIV2_ENABLE_DYNAMIC_RUNTIME "Use dynamic runtime (used for static libs)" OFF ) -if (WIN32) - option( EXIV2_ENABLE_WIN_UNICODE "Use Unicode paths (wstring) on Windows" OFF ) - option( EXIV2_ENABLE_CURL "USE Libcurl for HttpIo" OFF ) - option( EXIV2_ENABLE_SSH "USE Libssh for SshIo" OFF ) -else() - option( EXIV2_ENABLE_CURL "USE Libcurl for HttpIo" ON ) - option( EXIV2_ENABLE_SSH "USE Libssh for SshIo" ON ) +option( BUILD_SHARED_LIBS "Build exiv2lib as a shared library" ON ) +option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON ) +option( EXIV2_ENABLE_LIBXMP "Build a static convenience Library for XMP" ON ) +option( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON ) +option( EXIV2_ENABLE_NLS "Build native language support (requires gettext)" ON ) +option( EXIV2_ENABLE_PRINTUCS2 "Build with Printucs2" ON ) +option( EXIV2_ENABLE_LENSDATA "Build including lens data" ON ) +option( EXIV2_ENABLE_COMMERCIAL "Build with the EXV_COMMERCIAL_VERSION symbol set" OFF ) +option( EXIV2_ENABLE_VIDEO "Build video support into library" OFF ) +option( EXIV2_ENABLE_WEBREADY "Build webready support into library" OFF ) +option( EXIV2_ENABLE_DYNAMIC_RUNTIME "Use dynamic runtime (used for static libs)" OFF ) +option( EXIV2_ENABLE_WIN_UNICODE "Use Unicode paths (wstring) on Windows" OFF ) +option( EXIV2_ENABLE_CURL "USE Libcurl for HttpIo" OFF ) +option( EXIV2_ENABLE_SSH "USE Libssh for SshIo" OFF ) +option( EXIV2_BUILD_SAMPLES "Build sample applications" ON ) +option( EXIV2_BUILD_PO "Build translations files" OFF ) +option( EXIV2_BUILD_EXIV2_COMMAND "Build exiv2 command-line executable" ON ) + +if ( EXIV2_ENABLE_WEBREADY ) + set ( EXIV2_ENABLE_CURL ON ) + set ( EXIV2_ENABLE_CURL ON ) + set ( EXIV2_ENABLE_SSH ON ) endif() -option( EXIV2_ENABLE_TOOLS "Build exiv2 executable" ON ) - -include(config/findDependencies.cmake) -include(config/compilerFlags.cmake) if( EXIV2_ENABLE_COMMERCIAL ) set (EXIV2_ENABLE_LENSDATA OFF) set (EXIV2_ENABLE_NLS OFF) endif() -if( MSVC ) - set(CMAKE_DEBUG_POSTFIX "d") -endif() - if( EXIV2_ENABLE_XMP ) set( HAVE_XMP_TOOLKIT ON ) endif() +include(config/findDependencies.cmake) +include(config/compilerFlags.cmake) include( config/generateConfigFile.cmake ) include_directories(${CMAKE_BINARY_DIR}) # Make the exv_conf.h file visible for the full project include( config/CMakeChecks.txt ) +if( MSVC ) + set(CMAKE_DEBUG_POSTFIX "d") +endif() + if( EXIV2_ENABLE_XMP ) add_subdirectory( xmpsdk ) endif() add_subdirectory( src ) -if( EXIV2_ENABLE_BUILD_SAMPLES ) +if( EXIV2_BUILD_SAMPLES ) add_subdirectory( samples ) endif() -if( EXIV2_ENABLE_BUILD_PO ) +if( EXIV2_BUILD_PO ) add_subdirectory( po ) endif() ## # tests add_custom_target(tests COMMAND env EXIV2_BINDIR="${CMAKE_BINARY_DIR}"/bin make tests WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" ) -add_custom_target(geotag-test COMMAND env EXIV2_BINDIR="${CMAKE_BINARY_DIR}"/bin make geotag-test WORKING_DIRECTORY "${CMAKE_SOURCE_DIR}" ) ## # http://dev.exiv2.org/boards/3/topics/1364 @@ -106,3 +99,6 @@ if( MINGW OR UNIX OR APPLE) endif() include( config/printSummary.cmake ) + +# That's all Folks! +## diff --git a/config/compilerFlags.cmake b/config/compilerFlags.cmake index c02a4139..6cac7b82 100644 --- a/config/compilerFlags.cmake +++ b/config/compilerFlags.cmake @@ -23,7 +23,7 @@ if(MSVC) CMAKE_CXX_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELWITHDEBINFO ) - if ( ${BUILD_SHARED_LIBS} OR ${EXIV2_ENABLE_DYNAMIC_RUNTIME}) + if ( ${BUILD_SHARED_LIBS} OR ${EXIV2_ENABLE_DYNAMIC_RUNTIME} ) message(STATUS "MSVC -> forcing use of dynamically-linked runtime." ) foreach(variable ${variables}) if(${variable} MATCHES "/MT") diff --git a/config/config.h.cmake b/config/config.h.cmake index 865d8b3c..f481a88c 100644 --- a/config/config.h.cmake +++ b/config/config.h.cmake @@ -1,47 +1,36 @@ // File generated by cmake from config/config.h.cmake. #pragma once +#ifndef _EXV_CONF_H_ +#define _EXV_CONF_H_ -// Defined to 1 if when using `libssh' for SshIO. -#cmakedefine01 EXV_USE_SSH +// Defined if you want to use libssh for SshIO. +#cmakedefine EXV_USE_SSH -// Define to 1 if you want to use `libcurl' in httpIO. -#cmakedefine01 EXV_USE_CURL +// Define to 1 if you want to use libcurl in httpIO. +#cmakedefine EXV_USE_CURL // Define if you require webready support. #cmakedefine EXV_ENABLE_WEBREADY -// Define to 1 if you have the `gmtime_r' function. +// Define if you have the `gmtime_r' function. #cmakedefine EXV_HAVE_GMTIME_R -// Define to 1 if you have the header file. +// Define if you have the header file. #cmakedefine EXV_HAVE_LIBINTL_H -// Define to 1 if translation of program messages to the user's native language is requested. +// Define if you want translation of program messages to the user's native language #cmakedefine EXV_ENABLE_NLS -// Define to 1 if you require video support. +// Define if you want video support. #cmakedefine EXV_ENABLE_VIDEO +// Define if you have correct declaration of strerror_r(). #cmakedefine EXV_HAVE_DECL_STRERROR_R -#ifndef EXV_COMMERCIAL_VERSION - -// Definition to enable translation of Nikon lens names. -#cmakedefine EXV_HAVE_LENSDATA - -// Define to 1 if you have the `iconv' function. -#cmakedefine EXV_HAVE_ICONV - -// Definition to enable conversion of UCS2 encoded Windows tags to UTF-8. -#cmakedefine EXV_HAVE_PRINTUCS2 - -#endif /* !EXV_COMMERCIAL_VERSION */ - -// Definition to enable the Windows unicode path support. +// Define to enable the Windows unicode path support. #cmakedefine EXV_UNICODE_PATH - /* Define to `const' or to empty, depending on the second argument of `iconv'. */ #cmakedefine ICONV_ACCEPTS_CONST_INPUT #if defined ICONV_ACCEPTS_CONST_INPUT @@ -50,19 +39,22 @@ #define EXV_ICONV_CONST #endif -// Definition to indicate if you have the header file. +// Define if you have the header file. #cmakedefine EXV_HAVE_REGEX -// Definition to indicate you have the header file. +// Define if you have the header file. +#cmakedefine EXV_HAVE_REGEX_H + +// Define if have the header file. #cmakedefine EXV_HAVE_MEMORY_H -// Definition to indicate if you have the `memset' function. +// Define if you have the memset function. #cmakedefine EXV_HAVE_MEMSET -// Definition to indicate if stdbool.h conforms to C99. +// Define if stdbool.h conforms to C99. #cmakedefine EXV_HAVE_STDBOOL_H -// Definition to indicate if you have the header file. +// Define if you have the header file. #cmakedefine EXV_HAVE_STDINT_H #ifndef EXV_HAVE_STDINT_H @@ -71,53 +63,53 @@ #endif #endif -// Definition to indicate if you have the header file. +// Define if you have the header file. #cmakedefine EXV_HAVE_STDLIB_H -// Definition to indicate if you have the `strchr' function. +// Define if you have the strchr function. #cmakedefine EXV_HAVE_STRCHR -// Definition to indicate if you have the `strerror' function. +// Define if you have the strerror function. #cmakedefine EXV_HAVE_STRERROR -// Definition to indicate if you have the `strerror_r' function. +// Define if you have the strerror_r function. #cmakedefine EXV_HAVE_STRERROR_R -// Definition to indicate if strerror_r returns char *. +// Define if strerror_r returns char *. #cmakedefine STRERROR_R_CHAR_P -// Definition to indicate if you have the header file. +// Define if you have the header file. #cmakedefine EXV_HAVE_STRINGS_H -// Definition to indicate if you have the `strtol' function. +// Define if you have the strtol function. #cmakedefine EXV_HAVE_STRTOL -// Definition to indicate if you have the `mmap' function. +// Define if you have the mmap function. #cmakedefine EXV_HAVE_MMAP -// Definition to indicate if you have the `munmap' function. +// Define if you have the munmap function. #cmakedefine EXV_HAVE_MUNMAP -// Definition to indicate if you have the header file. +// Define if you have header file. #cmakedefine EXV_HAVE_SYS_STAT_H -// Definition to indicate if you have the header file. +// Define if you have the header file. #cmakedefine EXV_HAVE_SYS_TYPES_H -// Definition to indicate if you have the `timegm' function. +// Define if you have the timegm function. #cmakedefine EXV_HAVE_TIMEGM -/* Define to 1 if you have the header file. */ +/* Define if you have the header file. */ #cmakedefine EXV_HAVE_UNISTD_H 1 #if !defined( EXV_HAVE_UNISTD_H) && defined(__CYGWIN__) #define EXV_HAVE_UNISTD_H 1 #endif -// Definition to indicate if you have the header file. +// Define if you have the header file. #cmakedefine EXV_HAVE_SYS_MMAN_H -// Definition to indicate if the `zlib' library will be used +// Define if you have are using the zlib library. #cmakedefine EXV_HAVE_LIBZ #if defined(_MSC_VER) && HAVE_LIBZ @@ -126,11 +118,11 @@ #endif #endif -// Definition to indicate if you have the header file. +// Define if you have the header file. #cmakedefine EXV_HAVE_PROCESS_H -/* Define to 1 if you have the Adobe XMP Toolkit. */ -#cmakedefine EXV_HAVE_XMP_TOOLKIT 1 +/* Define if you have (Exiv2/xmpsdk) Adobe XMP Toolkit. */ +#cmakedefine EXV_HAVE_XMP_TOOLKIT /* Define to 1 if `lstat' dereferences a symlink specified with a trailing slash. */ @@ -165,3 +157,22 @@ /* Define to `unsigned' if does not define. */ #cmakedefine size_t + +// ------------------------------------------------------------------ +// The following features are not available for Commercial use +#ifndef EXV_COMMERCIAL_VERSION + +// Definition to enable translation of Nikon lens names. +#cmakedefine EXV_HAVE_LENSDATA + +// Define if you have the iconv function. +#cmakedefine EXV_HAVE_ICONV + +// Definition to enable conversion of UCS2 encoded Windows tags to UTF-8. +#cmakedefine EXV_HAVE_PRINTUCS2 + +#endif /* !EXV_COMMERCIAL_VERSION */ +// ------------------------------------------------------------------ +#endif /* !_EXV_CONF_H_ */ +// That's All Folks! +// ------------------------------------------------------------------ diff --git a/config/config.h.in b/config/config.h.in index fdc3abf2..93873682 100644 --- a/config/config.h.in +++ b/config/config.h.in @@ -47,8 +47,11 @@ /* Define to 1 if you have the header file. */ #undef HAVE_LIBINTL_H +/* Define to 1 if you have the header file. */ +#undef HAVE_REGEX + /* Define to 1 if you have the header file. */ -#define HAVE_REGEX 1 +#undef HAVE_REGEX_H /* Define to 1 if you have the header file. */ #undef HAVE_MEMORY_H diff --git a/config/configure.ac b/config/configure.ac index 3972f4d1..bfb49f8d 100644 --- a/config/configure.ac +++ b/config/configure.ac @@ -56,7 +56,7 @@ AM_ICONV # Checks for header files. # --------------------------------------------------------------------------- AC_HEADER_STDC -AC_CHECK_HEADERS([libintl.h locale.h malloc.h stdint.h stdlib.h string.h unistd.h sys/mman.h utime.h regex.h]) +AC_CHECK_HEADERS([libintl.h locale.h malloc.h stdint.h stdlib.h string.h unistd.h sys/mman.h utime.h regex.h regex]) # --------------------------------------------------------------------------- # Checks for typedefs, structures, and compiler characteristics. @@ -401,7 +401,7 @@ if test "$ADOBE" = "2016" -o "$ADOBE" = "2014" -o "$ADOBE" = "2013" ; then if test "$ADOBE" == "2013" ; then ADOBE_SDK=XMP-Toolkit-SDK-CC201306; fi ENABLE_XMP=$ADOBE XMPSDK_CPPFLAGS="-Ixmpsdk/Adobe/$ADOBE_SDK/public/include" - XMPSDK_LDFLAGS="-Lxmpsdk/Adobe/$ADOBE_SDK" + XMPSDK_LDFLAGS="-Lxmpsdk/Adobe/$ADOBE_SDK -lXMPCore" case "$host_os" in *arwin*) EXV_DARWIN_FLAGS="-stdlib=libstdc++ -Wno-deprecated" diff --git a/config/generateConfigFile.cmake b/config/generateConfigFile.cmake index 7d925a30..d06147b8 100644 --- a/config/generateConfigFile.cmake +++ b/config/generateConfigFile.cmake @@ -43,7 +43,8 @@ check_include_file( "strings.h" EXV_HAVE_STRINGS_H ) check_include_file( "sys/mman.h" EXV_HAVE_SYS_MMAN_H ) check_include_file( "sys/stat.h" EXV_HAVE_SYS_STAT_H ) check_include_file( "sys/types.h" EXV_HAVE_SYS_TYPES_H ) -check_include_file( "regex.h" EXV_HAVE_REGEX ) +check_include_file( "regex" EXV_HAVE_REGEX ) +check_include_file( "regex.h" EXV_HAVE_REGEX_H ) check_include_file( "inttypes.h" EXV_HAVE_INTTYPES_H ) if (NOT EXV_HAVE_LIBINTL_H) @@ -66,4 +67,4 @@ return 0; ##################################################################################### -configure_file( config/config.h.cmake ${CMAKE_BINARY_DIR}/exv_conf.h @ONLY) +configure_file( config/config.h.cmake ${CMAKE_SOURCE_DIR}/include/exiv2/exv_conf.h @ONLY) diff --git a/config/printSummary.cmake b/config/printSummary.cmake index bc8afe6d..deb5a094 100644 --- a/config/printSummary.cmake +++ b/config/printSummary.cmake @@ -19,19 +19,16 @@ message( STATUS "Compiler info: ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) message( STATUS "------------------------------------------------------------------" ) message( STATUS "${PACKAGE_STRING} configure results <${PACKAGE_URL}>" ) -OptionOutput( "Building PNG support: " EXIV2_ENABLE_PNG AND ZLIB_FOUND ) OptionOutput( "Building shared library: " BUILD_SHARED_LIBS ) +OptionOutput( "Building PNG support: " EXIV2_ENABLE_PNG AND ZLIB_FOUND ) OptionOutput( "XMP metadata support: " EXIV2_ENABLE_XMP ) OptionOutput( "Building static libxmp: " EXIV2_ENABLE_LIBXMP ) OptionOutput( "Native language support: " EXIV2_ENABLE_NLS ) OptionOutput( "Conversion of Windows XP tags: " EXIV2_ENABLE_PRINTUCS2 ) OptionOutput( "Nikon lens database: " EXIV2_ENABLE_LENSDATA ) OptionOutput( "Commercial build: " EXIV2_ENABLE_COMMERCIAL ) -OptionOutput( "Build the unit tests: " EXIV2_ENABLE_BUILD_SAMPLES ) -OptionOutput( "Building translations files: " EXIV2_ENABLE_BUILD_PO ) OptionOutput( "Building video support: " EXIV2_ENABLE_VIDEO ) OptionOutput( "Building webready support: " EXIV2_ENABLE_WEBREADY ) - if ( EXIV2_ENABLE_WEBREADY ) OptionOutput( "USE Libcurl for HttpIo: " EXIV2_ENABLE_CURL ) OptionOutput( "USE Libssh for SshIo: " EXIV2_ENABLE_SSH ) @@ -41,5 +38,9 @@ if (WIN32) OptionOutput( "Dynamic runtime override: " EXIV2_ENABLE_DYNAMIC_RUNTIME) OptionOutput( "Unicode paths (wstring): " EXIV2_ENABLE_WIN_UNICODE ) endif() +OptionOutput( "Building exiv2 command: " EXIV2_BUILD_EXIV2_COMMAND ) +OptionOutput( "Building samples: " EXIV2_BUILD_SAMPLES ) +OptionOutput( "Building PO files: " EXIV2_BUILD_PO ) + message( STATUS "------------------------------------------------------------------" ) diff --git a/contrib/buildserver/dailyTest.sh b/contrib/buildserver/dailyTest.sh index ceca37f0..8d03bca5 100755 --- a/contrib/buildserver/dailyTest.sh +++ b/contrib/buildserver/dailyTest.sh @@ -111,7 +111,7 @@ case $PLATFORM in msvc) cd /tmp/jenkins/dist - for vs in 2005 2008 2010 2012 2013 2015; do + for vs in 2005 2008 2010 2012 2013 2015 2017; do for arch in x64 Win32; do if [ -e "$PWD/$vs/$arch/dll/Release/bin/exiv2.exe" ] ; then ( # test the delivered exiv2 diff --git a/contrib/cmake/msvc/ReadMe.txt b/contrib/cmake/msvc/ReadMe.txt index 1c5f5bc2..099d2cfa 100755 --- a/contrib/cmake/msvc/ReadMe.txt +++ b/contrib/cmake/msvc/ReadMe.txt @@ -1,4 +1,4 @@ - @@@Marco@@@@@b ;mm /##Gilles###\ + @@@Luis@@@@@b ;mm /##Gilles###\ j@@@#Robin", Brad /@@@Thomas@@@@Q @@@# \ ## @@@b |@@@b @@@# .;;;;, ,;;;, ,;;;; ,;;;p .;;; 7@@ ]Alan @@ -9,7 +9,7 @@ @@@# ,@@##@@m @@@b @@@p @@C #@@#C @@@# ,/ s@@# @@@@ @@@b Volker @Tuan@ ]@@@Abhinav@@\ /@@@\ \@@@Q @@@Q %@@@# /@@@@Mahesh@@# - /@@Raphael@@@@@\ /@@@@@\ C++ Metadata Library /@Sridhar@@@v0.26\ + /@@Raphael@@@@@\ /@@@@@\ C++ Metadata Library /@Sridhar@@@v0.26.1\ exiv2/contrib/cmake/msvc/ReadMe.txt ----------------------------------- @@ -17,201 +17,261 @@ exiv2/contrib/cmake/msvc/ReadMe.txt How to use this --------------- -1 Setting up your machine - You need cmake.exe, svn.exe and 7z.exe on your PATH. - - Please get "Windows" versions of cmake/svn/7z (NOT Cygwin or MinGW versions) - - You should initialize the Visual Studio environment - using the version of vcvars32.bat or vcvarsall.bat - installed with Visual Studio. For example: - - call "C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin\vcvars32.bat" - - The batch file contrib\cmake\msvc\vcvars.bat is designed to take the pain - out of this - provided Visual Studio is installed in %ProgramFiles(x86)% - %ProgramFiles(x86)% is usually c:\Program Files (x86) - - vcvars 2005 # sets 2005 x86 - vcvars 2010 64 # sets 2010 x86_amd64 - -2 Always build "out of source". I recommend: - cd \contrib\cmake\cmake - cmd.exe - vcvars 2015 64 - cmakeBuild --help # display syntax and options - cmakeBuild --rebuild - .... - exit - - +-------------------------------------------------------+ - | Never attempt to build in a directory with a space in | - | the path name. Example c:\My Build Tree\exiv2\build | - +-------------------------------------------------------+ - - You should never have reason to modify the code in cmakeBuild.cmd - You may wish to change the defaults in cmakeDefaults.cmd - You can change the defaults on the command-line (or modify cmakeDefaults.cmd) - You can also change defaults using the dos set command. For example: - set _CONFIG_=Debug - - To unset an environment string, set _CONFIG_= - - For your first build, I recommend the command: - cmakeBuild --pause --verbose - - This will print out a lot of information, and pause after each build step. - - When you are building happily, you may prefer: - cmakeBuild --silent - -3 What gets built? - The build is performed in work - The output is generated in dist - dist\..mumble..\bin contains *.exe and *.dll files - dist\..mumble..\lib contains *.lib files - dist\..mumble..\include contains *.h and *.hpp files - - mumble identifies the compiler and build. - Example C:\gnu\github\exiv2\contrib\cmake\msvc\dist\2013\x64\dll\Release\bin - 2013 = Visual Studio Choices: 2005/2008/2010/2012/2013/2015 - x64 = 64 bit build Win32/x64 - dll = shared library dll/static - Release = configuration Release/Debug/RelWithDebInfo/MinSizeRel - -4 Building manually with CMake - The cmake option -G Generator should be chosen for the version of Visual Studio installed. - cmake --help for more information - - I personally always build/test with Visual Studio 2005 in 64 bits. - The generator is: "Visual Studio 8 2005 Win64" - - cd - mkdir ../build - cd ../build - - rem download support libraries - svn export svn://dev.exiv2.org/svn/team/libraries/zlib-1.2.8.tar.gz - svn export svn://dev.exiv2.org/svn/team/libraries/expat-2.1.0.tar.gz - - ... + 1 Setting up your machine + You need cmake.exe, svn.exe and 7z.exe on your PATH. + + Please get "Windows" versions of cmake/svn/7z (NOT Cygwin or MinGW versions) + + cd /contrib/cmake/msvc + ...\cmake\msvc> cmd /c "vcvars 2015 64 & cmakeBuild.cmd --build" + + cmakeBuild.cmd creates Visual Studio solution/project files + Option: --build says "build using the generated files" + + More options: --static --test --debug --webready etc... (see below) + + 2 Selecting the version of Visual Studio + + You should initialize the Visual Studio environment + using the version of vcvars32.bat or vcvarsall.bat + installed with Visual Studio. For example: + + call "C:\Program Files (x86)\Microsoft Visual Studio 8\VC\bin\vcvars32.bat" + + The batch file contrib\cmake\msvc\vcvars.bat is designed to take the pain + out of this - provided Visual Studio is installed in %ProgramFiles(x86)% + %ProgramFiles(x86)% is usually c:\Program Files (x86) + + vcvars 2005 32 # sets 2005 x86 + vcvars 2010 64 # sets 2010 amd64 + + 3 Always build "out of source". I recommend: + cd \contrib\cmake\cmake + cmd.exe + vcvars 2015 64 + cmakeBuild --help # display syntax and options + cmakeBuild --build + .... + exit + + +-------------------------------------------------------+ + | Never attempt to build in a directory with a space in | + | the path name. Example c:\My Build Tree\exiv2\build | + +-------------------------------------------------------+ + + You should never have reason to modify the code in cmakeBuild.cmd + You may wish to change the defaults in cmakeDefaults.cmd + You can change the defaults on the command-line (or modify cmakeDefaults.cmd) + You can also change defaults using the dos set command. For example: + set _CONFIG_=Debug + + To unset an environment string, set _CONFIG_= + + For your first build, I recommend the command: + cmakeBuild --pause --verbose + + This will print out a lot of information, and pause after each build step. + + When you are building happily, you may prefer: + cmakeBuild --silent + + 4 Options + C:\Users\rmills\gnu\github\clanmills\exiv2\contrib\cmake\msvc>cmakeBuild --help + Options: --help | --silent | --verbose | --pause | --dryrun | --trace | --test + --build | --static | --unicode | --nls | --webready | --video | --samples + --exiv2 C:\Users\rmills\gnu\github\clanmills\exiv2 | --work work | --config Release | --generator generator + --zlib zlib-1.2.8 | --expat expat-2.1.0 | --curl curl-7.45.0 | --libssh libssh-0.7.2 + --bash c:\cygwin64\bin\bash.exe + + Option switches. + --help Print help message and quit + --silent Run script with minimal "chatter" + --verbose Run script with maximum "chatter" + --pause Pause at every build step + --dryrun Don't build anything. Report and quit + --trace Show commands begin executed by the script (implies --build --samples) + --test Execute the test suite after the build + + --build Build the code + --static Build and link static libraries and programs + --dll Build DLLs (not static libraries) + --unicode Build UNICODE path support + --ascii Do not build UNICODE path support + --nls Build with Natural Language Support + --webready Build and Link the webready feature + --video Build and link video support + --samples Include samples in projects + --debug Build debug (shorthand for --config Debug) + --release Build release (shorthand for --config Release) + + Option/values (See section 10 below) + --zlib zlib-1.2.8 + --expath expat-2.1.0 + --curl curl-7.44.0 + --libssh libssh-0.7.2 + + Other build key/value pairs: + --config Release | Debug + --generator The script default is almost always correct and is passed as -G "Generator" to CMake + --work The "work" directory in which the build will be performed (see 4 below) + --bash Path to bash.exe to be used when --test is specified. + + 5 What gets built? + The build is performed in work_Config (for example work_Release) + The output is generated in dist + dist\..mumble..\bin contains *.exe and *.dll files + dist\..mumble..\lib contains *.lib files + dist\..mumble..\include contains *.h and *.hpp files + + mumble identifies the compiler and build. + Example C:\gnu\github\exiv2\contrib\cmake\msvc\dist\2013\x64\dll\Release\bin + 2013 = Visual Studio Choices: 2005 | 2008 | 2010 | 2012 | 2013 | 2015 | 2017 + x64 = 64 bit build Win32 | x64 + dll = shared library dll | static + Release = configuration Release | Debug | RelWithDebInfo | MinSizeRel + + 6 Building manually with CMake + The cmake option -G Generator should be chosen for the version of Visual Studio installed. + cmake --help for more information + + I personally always build/test with Visual Studio 2005 in 64 bits. + The generator is: "Visual Studio 8 2005 Win64" + + cd + mkdir ../build + cd ../build + + rem download support libraries + svn export svn://dev.exiv2.org/svn/team/libraries/zlib-1.2.8.tar.gz + svn export svn://dev.exiv2.org/svn/team/libraries/expat-2.1.0.tar.gz + + ... for webready you need curl-7.45.0 libssh-0.7.2 and openssl-1.0.1p See below: "About webready support libraries (openssl, libssh and curl) - ... - - rem create a temp directory and a dist (distribution) directory - mkdir temp # build, compile and link in this directory - mkdir dist # the output artifacts are stored here - - rem build zlib-1.2.8 - mkdir temp\zlib-1.2.8 - cd temp\zlib-1.2.8 - cmake -G "Visual Studio 8 2005 Win64" "-DCMAKE_INSTALL_PREFIX=..\..dist" ..\..\zlib-1.2.8 - cmake --build . # TAKE CARE with expat-2.1.0 use: cmake --build . --target expat - cmake --build . --target install - cd ..\.. - - rem build expat-2.1.0 and other required libraries - - rem build exiv2 - mkdir temp\exiv2 - cd temp\exiv2 - cmake -G "Visual Studio 8 2005 Win64" "-DCMAKE_INSTALL_PREFIX=..\..\dist" ^ - "-DCMAKE_LIBRARY_PATH=..\..\dist\lib" "-DCMAKE_INCLUDE_PATH=..\..\dist\include" ^ - -DBUILD_SHARED_LIBS=ON ^ - ..\..\..\ - cmake --build . --config Release - cmake --build . --config Release --target install - -5 About webready support libraries (openssl, libssh and curl) - - a) openssl - You cannot build openssl with CMake. However we have prebuilt binaries which - you can download and extract into your build tree. - - You will have to match the version to your compiler. - In this example: vs2015/64 bit - - svn export svn://dev.exiv2.org/svn/team/libraries/openssl-1.0.1p-vs2015.7z - 7z x openssl-1.0.1p-vs2015.7z - xcopy/yesihq openssl-1.0.1p-vs2015\bin64 dist\bin" - xcopy/yesihq openssl-1.0.1p-vs2015\lib64 dist\bin" - xcopy/yesihq openssl-1.0.1p-vs2015\include64 dist\include" - - In this example: vs2008/32 bit - svn export svn://dev.exiv2.org/svn/team/libraries/openssl-1.0.1p-vs2008.7z - 7z x openssl-1.0.1p-vs2015.7z - xcopy/yesihq openssl-1.0.1p-vs2008\bin dist\bin" - xcopy/yesihq openssl-1.0.1p-vs2008\lib dist\bin" - xcopy/yesihq openssl-1.0.1p-vs2008\include dist\include" - - The script contrib/cmake/msvc/cmakeOpenssl was used to create the vs2005.7z file - from a complete build performed by msvc/exiv2-webready.sln and openssl-1.0.1p source - - b) curl - curl does not seem to build with CMake. - It announces itself "the curl cmake build system is poorly maintained. Be aware" - - I have given up trying to get this to work and used nmake in the winbuild directory. - For more information, read: winbuild\BUILD.WINDOWS.txt - - c) libssh - Three changes have been made to libssh to build with VS2015, VS2008, VS2995 - These have been reported (with fixes) - VS2015: https://red.libssh.org/issues/214 - VS2005/8: https://red.libssh.org/issues/2205 - - The fixes are included in svn://dev.exiv2.org/svn/team/libraries/libssh-0.7.2.tar.gz - A 'vanilla' version of libssh will may require those fixes to be applied. - -6 Build options - You can inspect CMake options by running grep OPTION on CMakeLists.txt in - C:\cygwin64\home\rmills\gnu\exiv2\build>cd ..\trunk - - C:\cygwin64\home\rmills\gnu\exiv2\trunk>grep OPTION CMakeLists.txt - OPTION( BUILD_SHARED_LIBS "Build exiv2 as a shared library (dll)" ON ) - OPTION( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON ) - OPTION( EXIV2_ENABLE_LIBXMP "Build a static convenience Library for XMP" ON ) - OPTION( EXIV2_ENABLE_VIDEO "Build with video support" OFF ) - OPTION( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON ) - OPTION( EXIV2_ENABLE_NLS "Build native language support (requires gettext)" ON ) - OPTION( EXIV2_ENABLE_PRINTUCS2 "Build with Printucs2" ON ) - OPTION( EXIV2_ENABLE_LENSDATA "Build including lens data" ON ) - OPTION( EXIV2_ENABLE_COMMERCIAL "Build with the EXV_COMMERCIAL_VERSION symbol set" OFF ) - OPTION( EXIV2_ENABLE_BUILD_SAMPLES "Build the unit tests" ON ) - OPTION( EXIV2_ENABLE_BUILD_PO "Build translations files" OFF ) - OPTION( EXIV2_ENABLE_VIDEO "Build video support into library" OFF ) - OPTION( EXIV2_ENABLE_WEBREADY "Build webready support into library" OFF ) - OPTION( EXIV2_ENABLE_WIN_UNICODE "Use Unicode paths (wstring) on Windows" OFF ) - OPTION( EXIV2_ENABLE_CURL "USE Libcurl for HttpIo" OFF ) - OPTION( EXIV2_ENABLE_SSH "USE Libssh for SshIo" OFF ) - - C:\cygwin64\home\rmills\gnu\exiv2\trunk> - -7 Running the test suite - http://dev.exiv2.org/projects/exiv2/wiki/How_do_I_run_the_test_suite_for_Exiv2 - - You can run the test-suite directly from cmakeBuild.cmd with the argument --test - You need cygwin's bash.exe to run the test suite. - -8 Building with different versions of the support libraries - You can change the standard libraries. For example, to build with curl-7.39.0 - 1) set _CURL_=curl-7.39.0 - 2) add curl-7.39.0.tar.gz in your build directory - - To change the version of openssl: - 1) set _OPENSSL_=openssl-1.0.1j - 2) add openssl-1.0.1j-vs2015.zip into your build directory - -9 Rebuilding with VS 2005/8/10/12/13/15 32/64 - The script cmakeBuildAll.cmd is provided for convenience: - cmakeBuildAll.cmd --test > rebuildAll.txt - To view progress, open another shell: tail -f rebuildAll.txt - - cmakeBuildAll.cmd takes about a hour if you don't specify --webready - 12 build+test cycles of about 5 minutes each. - With webready, 12 build+test cycles of 12 minutes = 2.5 hours + ... + + rem create a temp directory and a dist (distribution) directory + mkdir temp # build, compile and link in this directory + mkdir dist # the output artifacts are stored here + + rem build zlib-1.2.8 + mkdir temp\zlib-1.2.8 + cd temp\zlib-1.2.8 + cmake -G "Visual Studio 8 2005 Win64" "-DCMAKE_INSTALL_PREFIX=..\..dist" ..\..\zlib-1.2.8 + cmake --build . # TAKE CARE with expat-2.1.0 use: cmake --build . --target expat + cmake --build . --target install + cd ..\.. + + rem build expat-2.1.0 and other required libraries + + rem build exiv2 + mkdir temp\exiv2 + cd temp\exiv2 + cmake -G "Visual Studio 8 2005 Win64" "-DCMAKE_INSTALL_PREFIX=..\..\dist" ^ + "-DCMAKE_LIBRARY_PATH=..\..\dist\lib" "-DCMAKE_INCLUDE_PATH=..\..\dist\include" ^ + -DBUILD_SHARED_LIBS=ON ^ + ..\..\..\ + cmake --build . --config Release + cmake --build . --config Release --target install + + 7 About webready support libraries (openssl, libssh and curl) + + +-----------------------------------------------+ + | cmakeBuild.cmd always builds shared (--dll) | + | when you use --webready | + | You can build static versions of exiv2 and | + | supporting libraries with the msvc/ solution | + +-----------------------------------------------+ + + a) openssl + You cannot build openssl with CMake. However we have prebuilt binaries which + you can download and extract into your build tree. + + You will have to match the version to your compiler. + In this example: vs2015/64 bit + + svn export svn://dev.exiv2.org/svn/team/libraries/openssl-1.0.1p-vs2015.7z + 7z x openssl-1.0.1p-vs2015.7z + xcopy/yesihq openssl-1.0.1p-vs2015\bin64 dist\bin" + xcopy/yesihq openssl-1.0.1p-vs2015\lib64 dist\bin" + xcopy/yesihq openssl-1.0.1p-vs2015\include64 dist\include" + + In this example: vs2008/32 bit + svn export svn://dev.exiv2.org/svn/team/libraries/openssl-1.0.1p-vs2008.7z + 7z x openssl-1.0.1p-vs2015.7z + xcopy/yesihq openssl-1.0.1p-vs2008\bin dist\bin" + xcopy/yesihq openssl-1.0.1p-vs2008\lib dist\bin" + xcopy/yesihq openssl-1.0.1p-vs2008\include dist\include" + + The script contrib/cmake/msvc/cmakeOpenssl was used to create the vs2005.7z file + from a complete build performed by msvc/exiv2-webready.sln and openssl-1.0.1p source + + b) curl + curl does not seem to build with CMake. + It announces itself "the curl cmake build system is poorly maintained. Be aware" + + I have given up trying to get this to work and used nmake in the winbuild directory. + For more information, read: winbuild\BUILD.WINDOWS.txt + + c) libssh + Three changes have been made to libssh to build with VS2015, VS2008, VS2995 + These have been reported (with fixes) + VS2015: https://red.libssh.org/issues/214 + VS2005/8: https://red.libssh.org/issues/2205 + + The fixes are included in svn://dev.exiv2.org/svn/team/libraries/libssh-0.7.2.tar.gz + A 'vanilla' version of libssh will may require those fixes to be applied. + + 8 Build options + You can inspect CMake options by running 'grep option /CMakeLists.txt' + + C:\cygwin64\home\rmills\gnu\github\clanmills\exiv2\contrib\cmake\msvc>cd ..\..\.. + C:\cygwin64\home\rmills\gnu\github\clanmills\exiv2>grep option CMakeLists.txt + # options and their default values + option( BUILD_SHARED_LIBS "Build exiv2 as a shared library (dll)" ON ) + option( EXIV2_ENABLE_XMP "Build with XMP metadata support" ON ) + option( EXIV2_ENABLE_LIBXMP "Build a static convenience Library for XMP" ON ) + option( EXIV2_ENABLE_PNG "Build with png support (requires libz)" ON ) + option( EXIV2_ENABLE_NLS "Build native language support (requires gettext)" ON ) + option( EXIV2_ENABLE_PRINTUCS2 "Build with Printucs2" ON ) + option( EXIV2_ENABLE_LENSDATA "Build including lens data" ON ) + option( EXIV2_ENABLE_COMMERCIAL "Build with the EXV_COMMERCIAL_VERSION symbol set" OFF ) + option( EXIV2_ENABLE_VIDEO "Build video support into library" OFF ) + option( EXIV2_ENABLE_WEBREADY "Build webready support into library" OFF ) + option( EXIV2_ENABLE_DYNAMIC_RUNTIME "Use dynamic runtime (used for static libs)" OFF ) + option( EXIV2_ENABLE_WIN_UNICODE "Use Unicode paths (wstring) on Windows" OFF ) + option( EXIV2_ENABLE_CURL "USE Libcurl for HttpIo" OFF ) + option( EXIV2_ENABLE_SSH "USE Libssh for SshIo" OFF ) + option( EXIV2_BUILD_SAMPLES "Build sample applications" ON ) + option( EXIV2_BUILD_PO "Build translations files" OFF ) + option( EXIV2_BUILD_EXIV2_COMMAND "Build exiv2 command-line executable" ON ) + + 9 Running the test suite + http://dev.exiv2.org/projects/exiv2/wiki/How_do_I_run_the_test_suite_for_Exiv2 + + You can run the test-suite directly from cmakeBuild.cmd with the argument --test + You need cygwin's bash.exe to run the test suite. + +10 Building with different versions of the support libraries + You can change the standard libraries. For example, to build with curl-7.39.0 + 1) set _CURL_=curl-7.39.0 + 2) add curl-7.39.0.tar.gz in your build directory + + To change the version of openssl: + 1) set _OPENSSL_=openssl-1.0.1j + 2) add openssl-1.0.1j-vs2015.zip into your build directory + +11 Rebuilding with VS 2005/8/10/12/13/15/17 32/64 + The script cmakeBuildAll.cmd is provided for convenience: + cmakeBuildAll.cmd --test > rebuildAll.txt + To view progress, open another shell: tail -f rebuildAll.txt + + cmakeBuildAll.cmd takes about a hour if you don't specify --webready + 14 build+test cycles of about 5 minutes each. Just over 1 hour. + With webready, 14 build+test cycles of 12 minutes = 3 hours +>>>>>>> robin/master Robin Mills robin@clanmills.com +Updated: 2017-09-13 diff --git a/contrib/cmake/msvc/cltest.cpp b/contrib/cmake/msvc/cltest.cpp index 9d7a741a..3531ebb9 100644 --- a/contrib/cmake/msvc/cltest.cpp +++ b/contrib/cmake/msvc/cltest.cpp @@ -2,7 +2,7 @@ int main(int,const char**) { - const char* vs[] = { "unknown" , "2005", "2008", "2010", "2012", "2013", "2015" }; + const char* vs[] = { "unknown" , "2005", "2008", "2010", "2012", "2013", "2015","2017" }; int v = (_MSC_VER-1300)/100; if ( v < 0 || v >= (sizeof(vs)/sizeof(vs[0])) ) v = 0; fprintf(stderr,"_%s = %d (%s) sizeof(void*) = %d\n","MSC_VER",_MSC_VER,vs[v],(int)sizeof(void*)); diff --git a/contrib/cmake/msvc/cmakeBuild.cmd b/contrib/cmake/msvc/cmakeBuild.cmd index 62e1e2f8..7a6c7022 100755 --- a/contrib/cmake/msvc/cmakeBuild.cmd +++ b/contrib/cmake/msvc/cmakeBuild.cmd @@ -1,41 +1,68 @@ @echo off setlocal enableextensions +rem ---- +rem always run this script in /contrib/cmake/msvc +cd %~dp0 + set "_BUILDDIR_=%CD%" +call:echo calling cmakeDefaults.cmd +call cmakeDefaults.cmd +IF ERRORLEVEL 1 ( + echo "*** cmakeDefaults.cmd has failed ***" >&2 + GOTO error_end +) :GETOPTS -if /I "%1" == "--bash" set "_BASH_=%2"& shift -if /I "%1" == "--config" set "_CONFIG_=%2"& shift -if /I "%1" == "--curl" set "_CURL_=%2"& shift -if /I "%1" == "--exiv2" set "_EXIV2_=%2"& shift -if /I "%1" == "--expat" set "_EXPAT_=%2"& shift -if /I "%1" == "--generator" set "_GENERATOR_=%2"& shift -if /I "%1" == "--openssl" set "_OPENSSL_=%2"& shift -if /I "%1" == "--libssh" set "_LIBSSH_=%2"& shift -if /I "%1" == "--work" set "_WORK_=%2"& shift -if /I "%1" == "--zlib" set "_ZLIB_=%2"& shift +set _CLAIMED_=0 +if /I "%1" == "--bash" call:set "_BASH_=%2"& shift +if /I "%1" == "--config" call:set "_CONFIG_=%2"& shift +if /I "%1" == "--curl" call:set "_CURL_=%2"& shift +if /I "%1" == "--exiv2" call:set "_EXIV2_=%2"& shift +if /I "%1" == "--expat" call:set "_EXPAT_=%2"& shift +if /I "%1" == "--generator" call:set "_GENERATOR_=%2"& shift +if /I "%1" == "--openssl" call:set "_OPENSSL_=%2"& shift +if /I "%1" == "--libssh" call:set "_LIBSSH_=%2"& shift +if /I "%1" == "--work" call:set "_WORK_=%2"& shift +if /I "%1" == "--zlib" call:set "_ZLIB_=%2"& shift if /I "%1" == "--help" call:Help && goto end -if /I "%1" == "--dryrun" set "_DRYRUN_=1" -if /I "%1" == "--nosamples" set "_NOSAMPLES_=1" -if /I "%1" == "--pause" set "_PAUSE_=1" -if /I "%1" == "--rebuild" set "_REBUILD_=1" -if /I "%1" == "--silent" set "_SILENT_=1" -if /I "%1" == "--static" set "_MODE_=static" -if /I "%1" == "--test" set "_TEST_=1" -if /I "%1" == "--trace" set ("_VERBOSE_=1 && echo on)" -if /I "%1" == "--verbose" set "_VERBOSE_=1" -if /I "%1" == "--video" set "_VIDEO_=1" -if /I "%1" == "--webready" set "_WEBREADY_=1" +if /I "%1" == "--dryrun" call:set "_DRYRUN_=1" +if /I "%1" == "--build" call:set "_BUILD_=1" +if /I "%1" == "--samples" call:set "_SAMPLES_=1" +if /I "%1" == "--pause" call:set "_PAUSE_=1" +if /I "%1" == "--silent" call:set "_SILENT_=1" +if /I "%1" == "--static" call:set "_SHARED_=0" +if /I "%1" == "--shared" call:set "_SHARED_=1" +if /I "%1" == "--dll" call:set "_SHARED_=1" +if /I "%1" == "--test" call:set "_TEST_=1" +if /I "%1" == "--trace" call:set "_TRACE_=1" +if /I "%1" == "--verbose" call:set "_VERBOSE_=1" +if /I "%1" == "--video" call:set "_VIDEO_=1" +if /I "%1" == "--webready" call:set "_WEBREADY_=1" +if /I "%1" == "--unicode" call:set "_UNICODE_=1" +if /I "%1" == "--ascii" call:set "_UNICODE_=0" +if /I "%1" == "--nls" call:set "_NLS_=1" +if /I "%1" == "--debug" call:set "_CONFIG_=Debug" +if /I "%1" == "--release" call:set "_CONFIG_=Release" + +if /I "%_CLAIMED_%" == "0" ( + echo "*** unknown command argument %1 ***" >&2 + goto error_end +) shift if not (%1) EQU () goto GETOPTS goto main +:set +set %1 +set _CLAIMED_=1 +exit /b 0 + :help -call cmakeDefaults >NUL 2>NUL -echo Options: --help ^| --webready ^| --rebuild ^| --video ^| --static -echo. --silent ^| --verbose ^| --pause ^| --dryrun ^| --test ^| --trace +echo Options: --help ^| --silent ^| --verbose ^| --pause ^| --dryrun ^| --trace ^| --test +echo. --build ^| --static ^| --unicode ^| --nls ^| --webready ^| --video ^| --samples echo. --exiv2 %_EXIV2_% ^| --work %_WORK_% ^| --config %_CONFIG_% ^| --generator generator echo. --zlib %_ZLIB_% ^| --expat %_EXPAT_% ^| --curl %_CURL_% ^| --libssh %_LIBSSH_% echo. --bash %_BASH_% @@ -46,23 +73,30 @@ echo.&&echo.&&echo. echo.------ cmakeBuild Settings ---------- echo.bash = %_BASH_% echo.binpath = %_BINPATH_% +echo.build = %_BUILD_% echo.builddir = %_BUILDDIR_% echo.config = %_CONFIG_% echo.curl = %_CURL_% +echo.dryrun = %_DRYRUN_% echo.exiv2 = %_EXIV2_% echo.expat = %_EXPAT_% echo.generator = %_GENERATOR_% +echo.install = %_INSTALL_% echo.incpath = %_INCPATH_% echo.libpath = %_LIBPATH_% echo.libssh = %_LIBSSH_% -echo.mode = %_MODE_% +echo.nls = %_NLS_% echo.openssl = %_OPENSSL_% -echo.work = %_WORK_% +echo.platform = %PLATFORM% +echo.samples = %_SAMPLES_% +echo.shared = %_SHARED_% echo.test = %_TEST_% -echo.video = %_VIDEO_% +echo.unicode = %_UNICODE_% echo.vc = %_VC_% +echo.video = %_VIDEO_% echo.vs = %_VS_% echo.webready = %_WEBREADY_% +echo.work = %_WORK_% echo.zlib = %_ZLIB_% echo.&&echo.&&echo. exit /b 0 @@ -72,12 +106,6 @@ if NOT DEFINED _SILENT_ set _VERBOSE_=1 set _UNSUPPORTED_= rem ---- -call:echo calling cmakeDefaults.cmd -call cmakeDefaults -IF ERRORLEVEL 1 ( - echo "*** cmakeDefaults.cmd has failed ***" >&2 - GOTO error_end -) call:echo _EXIV2_ = %_EXIV2_% rem ---- @@ -91,6 +119,7 @@ IF NOT EXIST "%VSINSTALLDIR%" ( GOTO error_end ) +if /I "%VSINSTALLDIR%" == "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Community\" set "_VS_=2017" && set "_VC_=15" if /I "%VSINSTALLDIR%" == "%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\" set "_VS_=2015" && set "_VC_=14" if /I "%VSINSTALLDIR%" == "%ProgramFiles(x86)%\Microsoft Visual Studio 12.0\" set "_VS_=2013" && set "_VC_=12" if /I "%VSINSTALLDIR%" == "%ProgramFiles(x86)%\Microsoft Visual Studio 11.0\" set "_VS_=2012" && set "_VC_=11" @@ -105,11 +134,17 @@ if NOT DEFINED _VS_ ( ) call:echo testing architecture -if "%PROCESSOR_ARCHITECTURE%" EQU "x86" ( +set _ARCH_=64 +if /I "%PROCESSOR_ARCHITECTURE%" == "x86" set _ARCH_=32 +if /I "%VSCMD_ARG_HOST_ARCH%" == "x86" set _ARCH_=32 + +if /I "%_ARCH_%" == "32" ( set Platform=Win32 set RawPlatform=x86 set CpuPlatform=ia32 -) ELSE ( +) + +if NOT DEFINED Platform ( set Platform=x64 set RawPlatform=x64 set CpuPlatform=intel64 @@ -164,23 +199,38 @@ IF ERRORLEVEL 1 ( GOTO error_end ) +rem ---- +call:echo fixups +set _WORK_=%_WORK_%_%_CONFIG_% +if DEFINED _TRACE_ ( + set _VERBOSE_=1 + echo on +) +if DEFINED _TEST_ ( + set _SAMPLES_=1 + set _BUILD_=1 +) +if DEFINED _WEBREADY_ set _SHARED_=1 + +if /I "%_SHARED_%" == "1" set _MODE_=dll +if /I "%_SHARED_%" == "0" set _MODE_=static + rem ---- call:echo testing work directory _WORK_ = %_WORK_% -if defined _REBUILD_ if EXIST "%_WORK_%" rmdir/s/q "%_WORK_%" -if defined _REBUILD_ del/s CMakeCache.txt >NUL 2>NUL +if EXIST "%_WORK_%" rmdir/s/q "%_WORK_%" +del/s CMakeCache.txt >NUL 2>NUL IF NOT EXIST "%_WORK_%" mkdir "%_WORK_%" pushd "%_WORK_%" -set "_WORK_=%CD%" +set "_WORK_=%CD%" popd -call:echo _WORK_ = %_WORK_% +call:echo _WORK_ = %_WORK_% rem ---- call:echo testing INSTALL SET _INSTALL_=dist\%_VS_%\%Platform%\%_MODE_%\%_CONFIG_% if NOT EXIST %_INSTALL_% mkdir %_INSTALL_% -IF NOT EXIST %_INSTALL_% mkdir %_INSTALL_% pushd %_INSTALL_% -set "_INSTALL_=%CD%" + set "_INSTALL_=%CD%" popd call:echo _INSTALL_ = %_INSTALL_% @@ -200,7 +250,8 @@ if defined _TEST_ if NOT EXIST "%_BASH_%" ( if NOT DEFINED _GENERATOR_ set "_GENERATOR_=%VS_CMAKE%" if /I "%_GENERATOR_%" == "NMake" set "_GENERATOR_=NMake Makefiles" -if /I "%_MODE_%" == "static" "_LINK_=-DCMAKE_LINK=static" +rem Fixup for openssl/vs 2017 +if /I "%_OPENSSL_%" == "openssl-1.0.1p" if /I "%_VS_%" == 2017 set _OPENSSL_ = openssl-1.1.0f call:cltest call:report @@ -211,12 +262,18 @@ IF DEFINED _PAUSE_ pause echo ---------- ZLIB building with cmake ------------------ call:buildLib %_ZLIB_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_% +rem Fixup ZLIB. This should be possible inside CMake +if /I "%_MODE_%" == "static" ( + if EXIST "%_WORK_%\%_ZLIB_%\%_CONFIG_%\zlibstaticd.lib" copy/y "%_WORK_%\%_ZLIB_%\%_CONFIG_%\zlibstaticd.lib" "%_LIBPATH_%\zlibd.lib" + if EXIST "%_WORK_%\%_ZLIB_%\%_CONFIG_%\zlibstatic.lib" copy/y "%_WORK_%\%_ZLIB_%\%_CONFIG_%\zlibstatic.lib" "%_LIBPATH_%\zlib.lib" +) + echo ---------- EXPAT building with cmake ----------------- set "_TARGET_=--target expat" -if /I "%_MODE_%" == "static" ( - call:buildLib %_EXPAT_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_% -DBUILD_shared=0 -DCMAKE_C_FLAGS_RELEASE=/MT -DBUILD_examples=0 -DBUILD_tests=0 +if /I "%_SHARED_%" == "0" ( + call:buildLib %_EXPAT_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_% -DBUILD_shared=0 -DCMAKE_C_FLAGS_RELEASE=/MT -DCMAKE_C_FLAGS_DEBUG=/MTd -DBUILD_examples=0 -DBUILD_tests=0 ) else ( - call:buildLib %_EXPAT_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_% + call:buildLib %_EXPAT_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_% -DBUILD_examples=0 -DBUILD_tests=0 ) set _TARGET_= @@ -239,7 +296,7 @@ if DEFINED _WEBREADY_ ( call:buildLib %_CURL_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_% -DCMAKE_LIBRARY_PATH=%_LIBPATH_% -DCMAKE_INCLUDE_PATH=%_INCPATH_% -DWITH_GSSAPI=OFF -DWITH_ZLIB=OFF -DWITH_SFTP=OFF -DWITH_SERVER=OFF -DWITH_EXAMPLES=OFF -DWITH_NACL=OFF -DWITH_PCAP=OFF -DCMAKE_USE_LIBSSH2=OFF -DCMAKE_USE_LIBSSH=OFF if errorlevel 1 set _WEBREADY_= ) ELSE ( - if defined _REBUILD_ rmdir/s/q "%_ONCPATH_%\curl" >NUL 2>NUL + rmdir/s/q "%_ONCPATH_%\curl" >NUL 2>NUL if NOT EXIST "%_ONCPATH_%"\curl ( echo ---------- CURL building with nmake ----------------- IF NOT EXIST %_CURL_%.tar.gz svn export svn://dev.exiv2.org/svn/team/libraries/%_CURL_%.tar.gz >NUL @@ -268,9 +325,8 @@ if NOT DEFINED _WEBREADY_ set _CURL_= && set _LIBSSH_= echo ---------- EXIV2 building with cmake ------------------ set "EXIV_B=%_WORK_%\exiv2" -if defined _REBUILD_ IF EXIST "%EXIV_B%" rmdir/s/q "%EXIV_B%" -IF NOT EXIST "%EXIV_B%" mkdir "%EXIV_B%" - +IF EXIST "%EXIV_B%" rmdir/s/q "%EXIV_B%" +IF NOT EXIST "%EXIV_B%" mkdir "%EXIV_B%" pushd "%EXIV_B%" set ENABLE_CURL=-DEXIV2_ENABLE_CURL=OFF set ENABLE_LIBSSH=-DEXIV2_ENABLE_SSH=OFF @@ -280,19 +336,19 @@ pushd "%EXIV_B%" set ENABLE_DYNAMIC=ON if defined _CURL_ set ENABLE_CURL=-DEXIV2_ENABLE_CURL=ON - if defined _LIBSSH_ set ENABLE_SSH=-DEXIV2_ENABLE_SSH=ON + if defined _LIBSSH_ set ENABLE_LIBSSH=-DEXIV2_ENABLE_SSH=ON if defined _WEBREADY_ set ENABLE_WEBREADY=-DEXIV2_ENABLE_WEBREADY=ON if defined _VIDEO_ set ENABLE_VIDEO=-DEXIV2_ENABLE_VIDEO=ON if /I "%_MODE_%" == "static" ( set ENABLE_SHARED=OFF set ENABLE_DYNAMIC=OFF ) - set BUILD_SAMPLES=ON - if DEFINED _NOSAMPLES_ set BUILD_SAMPLES=OFF + set BUILD_SAMPLES=OFF + if DEFINED _SAMPLES_ set BUILD_SAMPLES=ON - call:run cmake -G "%_GENERATOR_%" -DCMAKE_BUILD_TYPE=%_CONFIG_% %_LINK_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_% -DCMAKE_LIBRARY_PATH=%_LIBPATH_% -DCMAKE_INCLUDE_PATH=%_INCPATH_% ^ - -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_BUILD_SAMPLES=%BUILD_SAMPLES% ^ - -DEXIV2_ENABLE_WIN_UNICODE=OFF -DBUILD_SHARED_LIBS=%ENABLE_SHARED% ^ + call:run cmake -G "%_GENERATOR_%" -DCMAKE_BUILD_TYPE=%_CONFIG_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_% -DCMAKE_LIBRARY_PATH=%_LIBPATH_% -DCMAKE_INCLUDE_PATH=%_INCPATH_% ^ + -DEXIV2_ENABLE_NLS=%_NLS_% -DEXIV2_BUILD_SAMPLES=%BUILD_SAMPLES% ^ + -DEXIV2_ENABLE_WIN_UNICODE=%_UNICODE_% -DBUILD_SHARED_LIBS=%ENABLE_SHARED% ^ -DEXIV2_ENABLE_DYNAMIC_RUNTIME=%ENABLE_DYNAMIC% ^ %ENABLE_WEBREADY% %ENABLE_CURL% %ENABLE_LIBSSH% %ENABLE_VIDEO% ^ "%_EXIV2_%" @@ -303,14 +359,16 @@ pushd "%EXIV_B%" goto error_end ) - call:run cmake --build . --config %_CONFIG_% + rem if DEFINED _BUILDX_ devenv %_WORK_%\exiv2\exiv2.sln /Build "%_CONFIG_%|%Platform%" /ProjectConfig INSTALL + + if DEFINED _BUILD_ call:run cmake --build . --config %_CONFIG_% IF errorlevel 1 ( echo "*** build errors in EXIV2 ***" >&2 popd goto error_end ) - call:run cmake --build . --config %_CONFIG_% --target install + if DEFINED _BUILD_ call:run cmake --build . --config %_CONFIG_% --target install IF errorlevel 1 ( echo "*** install errors in EXIV2 ***" >&2 popd @@ -327,12 +385,12 @@ if defined _TEST_ ( rem ----------------------------------------- rem Exit -rem end syntax: goto end +rem end syntax: GOTO end :end endlocal exit /b 0 -rem end with an error syntax: call:error_end +rem end with an error syntax: GOTO error_end :error_end endlocal exit /b 1 @@ -344,7 +402,7 @@ rem echo (or don't if --silent). syntax: call:echo args ... if NOT DEFINED _SILENT_ echo %*% exit /b 0 -rem run a command. syntax call:run args +rem run a command. syntax call:run args :run if defined _VERBOSE_ ( echo. @@ -360,7 +418,6 @@ set _RESULT_=%ERRORLEVEL% if DEFINED _PAUSE_ pause exit /b %_RESULT_% -rem ----------------------------------------- rem build a library with CMake. syntax: call:buildLib name cmake-args ... :buildLib cd "%_BUILDDIR_%" @@ -377,7 +434,7 @@ IF NOT EXIST "%LOB%" 7z x "%LOB_TAR%" if NOT EXIST "%LOB_B%" mkdir "%LOB_B%" pushd "%LOB_B%" - call:run cmake -G "%_GENERATOR_%" -DCMAKE_BUILD_TYPE=%_CONFIG_% %_LINK_% %* ..\..\%LOB% + call:run cmake -G "%_GENERATOR_%" -DCMAKE_BUILD_TYPE=%_CONFIG_% %* ..\..\%LOB% IF errorlevel 1 ( echo "*** cmake errors in %LOB% ***" popd @@ -389,7 +446,20 @@ pushd "%LOB_B%" echo "*** warning: build errors in %LOB% ***" ) - call:run cmake --build . --config %_CONFIG_% --target install + rem --static expat fails to install on VS 2010+ + set buildLibInstallExpatStatic=0 + if /I "%_TARGET_%" == "--target expat" if /I "%_MODE_%" == "static" set buildLibInstallExpatStatic=1 + + if /I "%buildLibInstallExpatStatic%" == "1" ( + rem msvc\expat-2.1.0\lib\expat*.h => msvc\dist\2005\x64\static\Release\include + call:run copy/y "%_BUILDDIR_%\%LOB%\lib\expat*.h" "%_ONCPATH_%" + + rem msvc\work\expat-2.1.0\release\*.lib => msvc\dist\2005\x64\static\Release\lib + call:run copy/y "%_WORK_%\%LOB%\%_CONFIG_%\*.lib" "%_INSTALL_%\lib" + ) else ( + call:run cmake --build . --config %_CONFIG_% --target install + ) + IF errorlevel 1 ( echo "*** warning: install errors in %LOB% ***" ) @@ -434,7 +504,7 @@ exit /b 0 rem ----------------------------------------- rem this runs the compiler and reports _MSC_VER and sizeof(void*) -:cltest +:cltest pushd "%_EXIV2_%\contrib\cmake\msvc" nmake -a cltest.exe cltest.exe diff --git a/contrib/cmake/msvc/cmakeBuildAll.cmd b/contrib/cmake/msvc/cmakeBuildAll.cmd index 2c32f7a1..781a8001 100755 --- a/contrib/cmake/msvc/cmakeBuildAll.cmd +++ b/contrib/cmake/msvc/cmakeBuildAll.cmd @@ -1 +1 @@ -for %%a in (32) do for %%v in (2010 2008 2005) do cmd /c "vcvars %%v %%a && cmakeBuild %* 2>&1" +for %%a in (64 32) do for %%v in (2017 2015 2013 2012 2010 2008 2005) do for %%s in (--static --dll) do for %%r in (--release --debug) do for %%u in (--ascii --unicode) do cmd /c "vcvars %%v %%a && cmakeBuild --test %%s %%r %%u %* 2>&1" diff --git a/contrib/cmake/msvc/cmakeDefaults.cmd b/contrib/cmake/msvc/cmakeDefaults.cmd index 8dd5aa55..b1ee88cb 100755 --- a/contrib/cmake/msvc/cmakeDefaults.cmd +++ b/contrib/cmake/msvc/cmakeDefaults.cmd @@ -3,17 +3,19 @@ rem set up some defaults to be used by cmakeBuild.cmd and related scripts rem use environment strings to set defaults which will not be clobbered by this script -if not defined _CONFIG_ SET _CONFIG_=Release -if NOT DEFINED _WORK_ SET _WORK_=work -if NOT DEFINED _EXIV2_ SET _EXIV2_=..\..\.. -if NOT DEFINED _CURL_ SET _CURL_=curl-7.45.0 -if NOT DEFINED _LIBSSH_ SET _LIBSSH_=libssh-0.7.2 -if NOT DEFINED _OPENSSL_ SET _OPENSSL_=openssl-1.0.1p -if NOT DEFINED _ZLIB_ SET _ZLIB_=zlib-1.2.8 -if NOT DEFINED _EXPAT_ SET _EXPAT_=expat-2.1.0 -if NOT DEFINED _BASH_ SET _BASH_=c:\cygwin64\bin\bash.exe -if NOT DEFINED _MODE_ SET _MODE_=dll -if NOT DEFINED COPYCMD SET COPYCMD=/Y +if NOT DEFINED _CONFIG_ set _CONFIG_=Release +if NOT DEFINED _WORK_ set _WORK_=work +if NOT DEFINED _EXIV2_ set _EXIV2_=..\..\.. +if NOT DEFINED _CURL_ set _CURL_=curl-7.45.0 +if NOT DEFINED _LIBSSH_ set _LIBSSH_=libssh-0.7.2 +if NOT DEFINED _OPENSSL_ set _OPENSSL_=openssl-1.0.1p +if NOT DEFINED _ZLIB_ set _ZLIB_=zlib-1.2.8 +if NOT DEFINED _EXPAT_ set _EXPAT_=expat-2.1.0 +if NOT DEFINED _BASH_ set _BASH_=c:\cygwin64\bin\bash.exe +if NOT DEFINED _SHARED_ set _SHARED_=1 +if NOT DEFINED _UNICODE_ set _UNICODE_=0 +if NOT DEFINED _NLS_ set _NLS_=0 +if NOT DEFINED COPYCMD set COPYCMD=/Y rem ---------- check that EXIV2 exists echo checking that %_EXIV2_% exists diff --git a/include/exiv2/basicio.hpp b/include/exiv2/basicio.hpp index 95713bfc..9d0b31cf 100644 --- a/include/exiv2/basicio.hpp +++ b/include/exiv2/basicio.hpp @@ -43,12 +43,6 @@ #ifndef EXV_XPATH_MEMIO #define EXV_XPATH_MEMIO 0 #endif -#ifndef EXV_USE_CURL -#define EXV_USE_CURL 0 -#endif -#ifndef EXV_USE_SSH -#define EXV_USE_SSH 0 -#endif // ***************************************************************************** // namespace extensions @@ -1117,7 +1111,7 @@ namespace Exiv2 { //@} }; -#if EXV_USE_CURL == 1 +#ifdef EXV_USE_CURL /*! @brief Provides the http, https read/write access and ftp read access for the RemoteIo. This class is based on libcurl. @@ -1173,7 +1167,7 @@ namespace Exiv2 { }; #endif -#if EXV_USE_SSH == 1 +#ifdef EXV_USE_SSH /*! @brief Provides the ssh read/write access and sftp read access for the RemoteIo. This class is based on libssh. @@ -1262,7 +1256,7 @@ namespace Exiv2 { EXIV2API std::wstring ReplaceStringInPlace(std::wstring subject, const std::wstring& search, const std::wstring& replace); #endif -#if EXV_USE_CURL == 1 +#ifdef EXV_USE_CURL /*! @brief The callback function is called by libcurl to write the data */ diff --git a/include/exiv2/config.h b/include/exiv2/config.h index c0fb8939..2e857b49 100644 --- a/include/exiv2/config.h +++ b/include/exiv2/config.h @@ -78,6 +78,11 @@ typedef int pid_t; # define CURL_STATICLIB #endif +#ifndef WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN +#endif +#include + #endif // _MSC_VER ///// End of Visual Studio Support ///// diff --git a/include/exiv2/exiv2.hpp b/include/exiv2/exiv2.hpp index d4cc566e..0bba515a 100644 --- a/include/exiv2/exiv2.hpp +++ b/include/exiv2/exiv2.hpp @@ -53,17 +53,21 @@ #include "exiv2/mrwimage.hpp" #include "exiv2/orfimage.hpp" #include "exiv2/pgfimage.hpp" + #ifdef EXV_HAVE_LIBZ #include "exiv2/pngimage.hpp" #endif + #include "exiv2/preview.hpp" #include "exiv2/properties.hpp" #include "exiv2/psdimage.hpp" #include "exiv2/rafimage.hpp" #include "exiv2/rw2image.hpp" -#if EXV_USE_SSH == 1 + +#ifdef EXV_USE_SSH #include "exiv2/ssh.hpp" #endif + #include "exiv2/tags.hpp" #include "exiv2/tgaimage.hpp" #include "exiv2/tiffimage.hpp" diff --git a/include/exiv2/http.hpp b/include/exiv2/http.hpp index ccc27a14..eab54f5e 100644 --- a/include/exiv2/http.hpp +++ b/include/exiv2/http.hpp @@ -1,6 +1,7 @@ #ifndef HTTP_HPP_ #define HTTP_HPP_ +#include "config.h" #include #include #include @@ -18,10 +19,7 @@ namespace Exiv2 { EXIV2API int http(Exiv2::Dictionary& request,Exiv2::Dictionary& response,std::string& errors); } -#ifndef EXV_USE_CURL -#define EXV_USE_CURL 0 -#endif -#if EXV_USE_CURL == 1 +#ifdef EXV_USE_CURL #include #endif diff --git a/include/exiv2/ssh.hpp b/include/exiv2/ssh.hpp index 2750c157..cc698d65 100644 --- a/include/exiv2/ssh.hpp +++ b/include/exiv2/ssh.hpp @@ -24,7 +24,7 @@ // included header files #include "config.h" -#if EXV_USE_SSH == 1 +#ifdef EXV_USE_SSH #include #include #include diff --git a/include/exiv2/value.hpp b/include/exiv2/value.hpp index b7d76fef..684cd2a4 100644 --- a/include/exiv2/value.hpp +++ b/include/exiv2/value.hpp @@ -1665,7 +1665,7 @@ namespace Exiv2 { template<> inline long ValueType::toLong(long n) const { - ok_ = (value_[n].second != 0 && -LARGE_INT < value_[n].first && value_[n].first < LARGE_INT); + ok_ = (value_[n].second != 0 && INT_MIN < value_[n].first && value_[n].first < INT_MAX ); if (!ok_) return 0; return value_[n].first / value_[n].second; } diff --git a/include/exiv2/version.hpp b/include/exiv2/version.hpp index 1fa1ccba..a9683997 100644 --- a/include/exiv2/version.hpp +++ b/include/exiv2/version.hpp @@ -37,20 +37,14 @@ // + standard includes #include -/*! - @brief CPLUSPLUS11 is the value of macro --cplusplus for C++11 -*/ -#define CPLUSPLUS11 201103L - -#if __cplusplus >= CPLUSPLUS11 +#if defined(HAVE_REGEX) # include /*! @brief exv_grep_keys_t is a vector of keys to match to strings */ typedef std::vector exv_grep_keys_t ; -#else -# ifdef EXV_HAVE_REGEX -# include +#elif defined(EXV_HAVE_REGEX_H) +# include /*! @brief exv_grep_keys_t is a vector of keys to match to strings */ @@ -76,7 +70,6 @@ @brief exv_grep_keys_t is a vector of keys to match to strings */ typedef std::vector exv_grep_keys_t ; -# endif #endif /*! diff --git a/po/CMakeLists.txt b/po/CMakeLists.txt index a15da0f8..cb34e180 100644 --- a/po/CMakeLists.txt +++ b/po/CMakeLists.txt @@ -1,29 +1,41 @@ -# CMake build system for exiv2 library and executables -# Copyright 2008 by Patrick Spendrin -# Copyright 2010-2012 by Gilles Caulier -# -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# CMakeLists.txt for i18n files -# automatically include all po files in the directory -FILE(GLOB PO_FILES *.po) +# List of files PO files +set(PO_FILES bs.po + de.po + es.po + fi.po + fr.po + gl.po + ms.po + pl.po + pt.po + ru.po + sk.po + sv.po + ug.po + uk.po + vi.po +) -UPDATE_TRANSLATIONS(exiv2 ${PO_FILES}) - -ADD_TRANSLATIONS(exiv2 ${PO_FILES}) +update_translations(exiv2 ${PO_FILES}) +add_translations(exiv2 ${PO_FILES}) +## +# execute xgettext on every file add_custom_target( pot-update - COMMAND xgettext -d ${PACKAGE_NAME} - -s - -D ${CMAKE_CURRENT_SOURCE_DIR}/.. - -o ${PACKAGE_NAME}.pot - -p ${CMAKE_CURRENT_SOURCE_DIR}/ - --from-code=UTF-8 - --files-from=POTFILES.in - -j - --keyword=_ - --package-name=${PACKAGE_NAME} - --package-version=${PACKAGE_VERSION} - --copyright-holder=${PACKAGE_COPYRIGHT} - --msgid-bugs-address=${PACKAGE_BUGREPORT} - ) + COMMAND xgettext -d ${PACKAGE_NAME} + -s -D ${CMAKE_CURRENT_SOURCE_DIR}/.. + -o ${PACKAGE_NAME}.pot + -p ${CMAKE_CURRENT_SOURCE_DIR}/ + --from-code=UTF-8 --files-from=POTFILES.in + -j + --keyword=_ + --package-name=${PACKAGE_NAME} + --package-version=${PACKAGE_VERSION} + --copyright-holder=${PACKAGE_COPYRIGHT} + --msgid-bugs-address=${PACKAGE_BUGREPORT} +) + +# That's all Folks! +## diff --git a/samples/CMakeLists.txt b/samples/CMakeLists.txt index 78119323..b8d43821 100644 --- a/samples/CMakeLists.txt +++ b/samples/CMakeLists.txt @@ -1,41 +1,41 @@ -# CMake build system for exiv2 library and executables -# Copyright 2010-2012 Gilles Caulier -# Copyright 2008 Patrick Spendrin -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -set( SAMPLES addmoddel.cpp - convert-test.cpp - easyaccess-test.cpp - exifcomment.cpp - exifdata-test.cpp - exifdata.cpp - exifprint.cpp - exifvalue.cpp - ini-test.cpp - iotest.cpp - iptceasy.cpp - iptcprint.cpp - iptctest.cpp - key-test.cpp - largeiptc-test.cpp - mmap-test.cpp - prevtest.cpp - stringto-test.cpp - taglist.cpp - tiff-test.cpp - werror-test.cpp - write-test.cpp - write2-test.cpp - xmpparse.cpp - xmpparser-test.cpp - xmpprint.cpp - xmpsample.cpp - ) +# CMakeLists.txt for exiv2 library sample applications +set( SAMPLES + addmoddel.cpp + convert-test.cpp + easyaccess-test.cpp + exifcomment.cpp + exifdata-test.cpp + exifdata.cpp + exifprint.cpp + exifvalue.cpp + ini-test.cpp + iotest.cpp + iptceasy.cpp + iptcprint.cpp + iptctest.cpp + key-test.cpp + largeiptc-test.cpp + mmap-test.cpp + prevtest.cpp + stringto-test.cpp + taglist.cpp + tiff-test.cpp + werror-test.cpp + write-test.cpp + write2-test.cpp + xmpparse.cpp + xmpparser-test.cpp + xmpprint.cpp + xmpsample.cpp +) + +## +# build samples AND add them to the APPLICATIONS list foreach(entry ${SAMPLES}) string( REPLACE ".cpp" "" target ${entry}) add_executable( ${target} ${target}.cpp ) + list(APPEND APPLICATIONS ${target}) add_test( ${target}_test ${target} ) target_link_libraries( ${target} PRIVATE exiv2lib) install( TARGETS ${target} RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) @@ -43,21 +43,28 @@ endforeach() ################################### +if (MSVC) + link_directories(${CMAKE_INSTALL_PREFIX}/lib) +endif() + add_executable( metacopy metacopy.cpp ../src/utils.cpp) +list(APPEND APPLICATIONS metacopy) target_link_libraries( metacopy PRIVATE exiv2lib) target_include_directories(metacopy PRIVATE ${CMAKE_SOURCE_DIR}/src) # To find utils.hpp -add_executable ( pathtest path-test.cpp ../src/utils.cpp) -set_target_properties( pathtest PROPERTIES OUTPUT_NAME path-test ) -target_link_libraries( pathtest PRIVATE exiv2lib) +add_executable( pathtest path-test.cpp ../src/utils.cpp) +list(APPEND APPLICATIONS pathtest) +set_target_properties( pathtest PROPERTIES OUTPUT_NAME path-test ) +target_link_libraries( pathtest PRIVATE exiv2lib) target_include_directories(pathtest PRIVATE ${CMAKE_SOURCE_DIR}/src) # To find utils.hpp if(NOT EXV_HAVE_TIMEGM ) target_sources(pathtest PRIVATE ../src/localtime.c) endif() -add_executable( exiv2json exiv2json.cpp Jzon.cpp) -target_link_libraries( exiv2json PRIVATE exiv2lib) +add_executable( exiv2json exiv2json.cpp Jzon.cpp) +list(APPEND APPLICATIONS exiv2json) +target_link_libraries( exiv2json PRIVATE exiv2lib) install( TARGETS metacopy pathtest exiv2json RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) @@ -66,9 +73,10 @@ if (MSVC) target_sources(metacopy PRIVATE ../src/getopt_win32.c) endif() -if( EXIV2_ENABLE_XMP ) +if( EXPAT_FOUND ) add_executable( geotag geotag.cpp) - target_link_libraries( geotag PRIVATE exiv2lib ${ZLIB_LIBRARIES}) + list(APPEND APPLICATIONS geotag) + target_link_libraries( geotag PRIVATE exiv2lib ${EXPAT_LIBRARIES}) install( TARGETS geotag RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() @@ -76,17 +84,29 @@ endif() # connection test application add_executable(conntest conntest.cpp) target_link_libraries(conntest PRIVATE exiv2lib) - -# ****************************************************************************** -# exifprint application -# ADD_EXECUTABLE( exifprint exifprint.cpp ) -# target_link_libraries( exifprint exiv2lib ) +list(APPEND APPLICATIONS conntest) # ****************************************************************************** # remotetest application add_executable(remotetest remotetest.cpp) -target_link_libraries(remotetest exiv2lib) +target_link_libraries(remotetest PRIVATE exiv2lib) +list(APPEND APPLICATIONS remotetest) + +# ****************************************************************************** +# set compiler -DEXV_HAVE_DLL when linking exiv2 dll +foreach(application ${APPLICATIONS}) + message(STATUS "sample: ${application}") + if ( BUILD_SHARED_LIBS ) + target_compile_definitions(${application} PRIVATE EXV_HAVE_DLL ) + endif() + if( EXIV2_ENABLE_PNG ) + target_link_libraries( ${application} PRIVATE ${ZLIB_LIBRARIES} ) + endif() +endforeach() # ****************************************************************************** # Man page install( FILES exiv2samples.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 ) + +# That's all Folks! +## diff --git a/samples/conntest.cpp b/samples/conntest.cpp index 43eb42e3..bb05bab6 100644 --- a/samples/conntest.cpp +++ b/samples/conntest.cpp @@ -26,7 +26,7 @@ void httpcon(const std::string& url, bool useHttp1_0 = false) { } } -#if EXV_USE_CURL == 1 +#ifdef EXV_USE_CURL void curlcon(const std::string& url, bool useHttp1_0 = false) { CURL* curl = curl_easy_init(); if(!curl) { @@ -68,7 +68,7 @@ void curlcon(const std::string& url, bool useHttp1_0 = false) { } #endif -#if EXV_USE_SSH == 1 +#ifdef EXV_USE_SSH void sshcon(const std::string& url) { Exiv2::Uri uri = Exiv2::Uri::Parse(url); Exiv2::Uri::Decode(uri); @@ -125,7 +125,7 @@ int main(int argc,const char** argv) bool isOk = false; try { - #if EXV_USE_SSH == 1 + #ifdef EXV_USE_SSH if (prot == Exiv2::pSsh) { sshcon(url); isOk = true; @@ -134,7 +134,7 @@ int main(int argc,const char** argv) isOk = true; } #endif - #if EXV_USE_CURL == 1 + #ifdef EXV_USE_CURL if (prot == Exiv2::pHttp || prot == Exiv2::pHttps || prot == Exiv2::pFtp) { curlcon(url, useHttp1_0); isOk = true; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 99d9a90d..b25b71b9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1,87 +1,6 @@ -# CMake build system for exiv2 library and executables -# Copyright 2015- Daniel Kaneider -# Copyright 2010-2012 Gilles Caulier -# Copyright 2008 Patrick Spendrin +# CMakeLists.txt for exiv2 library and command-line program -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. - -# Private headers which are only needed for the library itself -set( LIBEXIV2_PRIVATE_HDR canonmn_int.hpp - casiomn_int.hpp - cr2image_int.hpp - crwimage_int.hpp - fujimn_int.hpp - makernote_int.hpp - minoltamn_int.hpp - nikonmn_int.hpp - olympusmn_int.hpp - orfimage_int.hpp - panasonicmn_int.hpp - pentaxmn_int.hpp - pngchunk_int.hpp - rcsid_int.hpp - rw2image_int.hpp - samsungmn_int.hpp - sigmamn_int.hpp - sonymn_int.hpp - tags_int.hpp - tiffcomposite_int.hpp - tifffwd_int.hpp - tiffimage_int.hpp - tiffvisitor_int.hpp - ) - -# Add standalone C++ header files to this list -set( LIBEXIV2_HDR ../include/exiv2/asfvideo.hpp - ../include/exiv2/basicio.hpp - ../include/exiv2/bmpimage.hpp - ../include/exiv2/config.h - ../include/exiv2/convert.hpp - ../include/exiv2/cr2image.hpp - ../include/exiv2/crwimage.hpp - ../include/exiv2/datasets.hpp - ../include/exiv2/easyaccess.hpp - ../include/exiv2/epsimage.hpp - ../include/exiv2/error.hpp - ../include/exiv2/exif.hpp - ../include/exiv2/exiv2.hpp - ../include/exiv2/futils.hpp - ../include/exiv2/gifimage.hpp - ../include/exiv2/http.hpp - ../include/exiv2/image.hpp - ../include/exiv2/ini.hpp - ../include/exiv2/iptc.hpp - ../include/exiv2/jp2image.hpp - ../include/exiv2/jpgimage.hpp - ../include/exiv2/matroskavideo.hpp - ../include/exiv2/metadatum.hpp - ../include/exiv2/mrwimage.hpp - ../include/exiv2/orfimage.hpp - ../include/exiv2/pgfimage.hpp - ../include/exiv2/preview.hpp - ../include/exiv2/properties.hpp - ../include/exiv2/psdimage.hpp - ../include/exiv2/quicktimevideo.hpp - ../include/exiv2/rafimage.hpp - ../include/exiv2/riffvideo.hpp - ../include/exiv2/rwlock.hpp - ../include/exiv2/rw2image.hpp - ../include/exiv2/tags.hpp - ../include/exiv2/tgaimage.hpp - ../include/exiv2/tiffimage.hpp - ../include/exiv2/types.hpp - ../include/exiv2/utilsvideo.hpp - ../include/exiv2/value.hpp - ../include/exiv2/version.hpp - ../include/exiv2/webpimage.hpp - ../include/exiv2/xmp_exiv2.hpp - ../include/exiv2/xmpsidecar.hpp - ../include/exiv2/utilsvideo.hpp - ${CMAKE_BINARY_DIR}/exv_conf.h - ) - -# Add library C++ source files to this list +# C++ source files set( LIBEXIV2_SRC asfvideo.cpp basicio.cpp bigtiffimage.cpp @@ -142,6 +61,82 @@ set( LIBEXIV2_SRC asfvideo.cpp utilsvideo.cpp ) +# Public C++ header files +set( LIBEXIV2_HDR ../include/exiv2/asfvideo.hpp + ../include/exiv2/basicio.hpp + ../include/exiv2/bmpimage.hpp + ../include/exiv2/config.h + ../include/exiv2/convert.hpp + ../include/exiv2/cr2image.hpp + ../include/exiv2/crwimage.hpp + ../include/exiv2/datasets.hpp + ../include/exiv2/easyaccess.hpp + ../include/exiv2/epsimage.hpp + ../include/exiv2/error.hpp + ../include/exiv2/exif.hpp + ../include/exiv2/exiv2.hpp + ../include/exiv2/futils.hpp + ../include/exiv2/gifimage.hpp + ../include/exiv2/http.hpp + ../include/exiv2/image.hpp + ../include/exiv2/ini.hpp + ../include/exiv2/iptc.hpp + ../include/exiv2/jp2image.hpp + ../include/exiv2/jpgimage.hpp + ../include/exiv2/matroskavideo.hpp + ../include/exiv2/metadatum.hpp + ../include/exiv2/mrwimage.hpp + ../include/exiv2/orfimage.hpp + ../include/exiv2/pgfimage.hpp + ../include/exiv2/preview.hpp + ../include/exiv2/properties.hpp + ../include/exiv2/psdimage.hpp + ../include/exiv2/quicktimevideo.hpp + ../include/exiv2/rafimage.hpp + ../include/exiv2/riffvideo.hpp + ../include/exiv2/rwlock.hpp + ../include/exiv2/rw2image.hpp + ../include/exiv2/tags.hpp + ../include/exiv2/tgaimage.hpp + ../include/exiv2/tiffimage.hpp + ../include/exiv2/types.hpp + ../include/exiv2/utilsvideo.hpp + ../include/exiv2/value.hpp + ../include/exiv2/version.hpp + ../include/exiv2/webpimage.hpp + ../include/exiv2/xmp_exiv2.hpp + ../include/exiv2/xmpsidecar.hpp + ../include/exiv2/utilsvideo.hpp + ../include/exiv2/exv_conf.h + ) + +# Private headers only needed to build the library +set( LIBEXIV2_PRIVATE_HDR canonmn_int.hpp + casiomn_int.hpp + cr2image_int.hpp + crwimage_int.hpp + fujimn_int.hpp + makernote_int.hpp + minoltamn_int.hpp + nikonmn_int.hpp + olympusmn_int.hpp + orfimage_int.hpp + panasonicmn_int.hpp + pentaxmn_int.hpp + pngchunk_int.hpp + rcsid_int.hpp + rw2image_int.hpp + samsungmn_int.hpp + sigmamn_int.hpp + sonymn_int.hpp + tags_int.hpp + tiffcomposite_int.hpp + tifffwd_int.hpp + tiffimage_int.hpp + tiffvisitor_int.hpp + ) + + if( EXIV2_ENABLE_WEBREADY ) if( EXIV2_ENABLE_CURL) set( LIBEXIV2_SRC ${LIBEXIV2_SRC} easyaccess.cpp) @@ -180,11 +175,13 @@ endif() set_target_properties( exiv2lib PROPERTIES VERSION ${GENERIC_LIB_VERSION} SOVERSION ${GENERIC_LIB_SOVERSION} - DEFINE_SYMBOL EXV_BUILDING_LIB OUTPUT_NAME exiv2 ) -target_compile_definitions(exiv2lib PRIVATE EXV_LOCALEDIR="${CMAKE_INSTALL_LOCALEDIR}" ) +target_compile_definitions(exiv2lib PRIVATE EXV_LOCALEDIR="${CMAKE_INSTALL_LOCALEDIR}" EXV_BUILDING_LIB ) +if ( BUILD_SHARED_LIBS ) + target_compile_definitions(exiv2lib PRIVATE EXV_HAVE_DLL ) +endif() if ( ${BUILD_SHARED_LIBS} ) target_compile_definitions(exiv2lib PUBLIC EXV_HAVE_DLL) @@ -239,9 +236,14 @@ if ( MSVC ) PSAPI_VERSION=1 # to be compatible with <= WinVista (#905) ) + source_group("Header Files" FILES ${LIBEXIV2_HDR} ) + source_group("Header Files" FILES ${LIBCURL_HDR} ) + source_group("Header Files" FILES ${SSH_HDR} ) + target_link_libraries( exiv2lib PRIVATE ${CURL_LIBRARIES} ${SSH_LIBRARIES}) else() - if ( UNIX ) - target_link_libraries( exiv2lib PRIVATE ${CMAKE_DL_LIBS}) + # TODO: Check if this is really needed. + if ( UNIX AND NOT FREEBSD ) + target_link_libraries( exiv2lib PRIVATE ${CMAKE_DL_LIBS}) # -ldl = dynamic loader used by src/version.cpp endif() if (CYGWIN OR MINGW) @@ -277,18 +279,22 @@ install(FILES ${LIBEXIV2_HDR} # ****************************************************************************** # exiv2 application -set( EXIV2_SRC exiv2.cpp - exiv2app.hpp - actions.cpp - actions.hpp - utils.cpp - utils.hpp +set( EXIV2_SRC + exiv2.cpp + exiv2app.hpp + actions.cpp + actions.hpp + utils.cpp + utils.hpp ) -if(EXIV2_ENABLE_TOOLS) +if(EXIV2_BUILD_EXIV2_COMMAND) add_executable( exiv2 ${EXIV2_SRC} ) target_compile_definitions(exiv2 PRIVATE EXV_LOCALEDIR="${CMAKE_INSTALL_LOCALEDIR}" ) target_link_libraries( exiv2 PRIVATE exiv2lib ) + if ( BUILD_SHARED_LIBS ) + target_compile_definitions(exiv2 PRIVATE EXV_HAVE_DLL ) + endif() install(TARGETS exiv2 RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) endif() @@ -309,3 +315,6 @@ endif() # ****************************************************************************** # Man page install( FILES exiv2.1 DESTINATION ${CMAKE_INSTALL_MANDIR}/man1 ) + +# That's all Folks! +## diff --git a/src/actions.cpp b/src/actions.cpp index 1e16c3b6..fe14de40 100644 --- a/src/actions.cpp +++ b/src/actions.cpp @@ -591,11 +591,10 @@ namespace Action { for (Params::Greps::const_iterator g = Params::instance().greps_.begin(); !result && g != Params::instance().greps_.end(); ++g) { -#if __cplusplus >= CPLUSPLUS11 +#if defined(EXV_HAVE_REGEX) std::smatch m; result = std::regex_search(key,m, *g); -#else -#ifdef EXV_HAVE_REGEX +#elif defined(EXV_HAVE_REGEX_H) result = regexec( &(*g), key.c_str(), 0, NULL, 0) == 0 ; #else std::string Pattern(g->pattern_); @@ -606,7 +605,6 @@ namespace Action { std::transform(Key.begin() , Key.end() ,Key.begin() , ::tolower); } result = Key.find(Pattern) != std::string::npos; -#endif #endif } return result ; diff --git a/src/basicio.cpp b/src/basicio.cpp index 9c5c04ca..990212c7 100644 --- a/src/basicio.cpp +++ b/src/basicio.cpp @@ -46,6 +46,7 @@ EXIV2_RCSID("@(#) $Id$") #include // for alloc, realloc, free #include // for stat, chmod #include // for stat, chmod + #ifdef EXV_HAVE_SYS_MMAN_H # include // for mmap and munmap #endif @@ -55,13 +56,15 @@ EXIV2_RCSID("@(#) $Id$") #ifdef EXV_HAVE_UNISTD_H # include // for getpid, stat #endif -#if EXV_USE_CURL == 1 -#include + +#ifdef EXV_USE_CURL +# include #endif -#if EXV_USE_SSH == 1 -#include "ssh.hpp" + +#ifdef EXV_USE_SSH +# include "ssh.hpp" #else -#define mode_t unsigned short +# define mode_t unsigned short #endif // Platform specific headers for handling extended attributes (xattr) @@ -2080,7 +2083,7 @@ namespace Exiv2 { } #endif -#if EXV_USE_CURL == 1 +#ifdef EXV_USE_CURL //! Internal Pimpl structure of class RemoteIo. class CurlIo::CurlImpl : public Impl { public: @@ -2329,7 +2332,7 @@ namespace Exiv2 { #endif -#if EXV_USE_SSH == 1 +#ifdef EXV_USE_SSH //! Internal Pimpl structure of class RemoteIo. class SshIo::SshImpl : public Impl { public: @@ -2628,7 +2631,7 @@ namespace Exiv2 { return subject; } #endif -#if EXV_USE_CURL == 1 +#ifdef EXV_USE_CURL size_t curlWriter(char* data, size_t size, size_t nmemb, std::string* writerData) { diff --git a/src/exiv2.cpp b/src/exiv2.cpp index 698b528e..46ea833c 100644 --- a/src/exiv2.cpp +++ b/src/exiv2.cpp @@ -47,7 +47,9 @@ EXIV2_RCSID("@(#) $Id$") #include #include -#ifdef EXV_HAVE_REGEX +#if defined(EXV_HAVE_REGEX) +#include +#elif defined(EXV_HAVE_REGEX_H) #include #endif @@ -451,10 +453,9 @@ int Params::evalGrep( const std::string& optarg) std::string pattern; std::string ignoreCase("/i"); bool bIgnoreCase = ends_with(optarg,ignoreCase,pattern); -#if __cplusplus >= CPLUSPLUS11 +#if defined(EXV_HAVE_REGEX) greps_.push_back( std::regex(pattern, bIgnoreCase ? std::regex::icase|std::regex::extended : std::regex::extended) ); -#else -#ifdef EXV_HAVE_REGEX +#elif defined(EXV_HAVE_REGEX_H) // try to compile a reg-exp from the input argument and store it in the vector const size_t i = greps_.size(); greps_.resize(i + 1); @@ -478,7 +479,6 @@ int Params::evalGrep( const std::string& optarg) } #else greps_.push_back(Exiv2_grep_key_t(pattern,bIgnoreCase)); -#endif #endif return result; } // Params::evalGrep diff --git a/src/image.cpp b/src/image.cpp index ce79c0a6..084b1977 100644 --- a/src/image.cpp +++ b/src/image.cpp @@ -829,16 +829,19 @@ namespace Exiv2 { BasicIo::AutoPtr ImageFactory::createIo(const std::string& path, bool useCurl) { Protocol fProt = fileProtocol(path); -#if EXV_USE_SSH == 1 + +#ifdef EXV_USE_SSH if (fProt == pSsh || fProt == pSftp) { return BasicIo::AutoPtr(new SshIo(path)); // may throw } #endif -#if EXV_USE_CURL == 1 + +#ifdef EXV_USE_CURL if (useCurl && (fProt == pHttp || fProt == pHttps || fProt == pFtp)) { return BasicIo::AutoPtr(new CurlIo(path)); // may throw } #endif + if (fProt == pHttp) return BasicIo::AutoPtr(new HttpIo(path)); // may throw if (fProt == pFileUri) diff --git a/src/ssh.cpp b/src/ssh.cpp index eb745676..68ad1273 100644 --- a/src/ssh.cpp +++ b/src/ssh.cpp @@ -32,7 +32,8 @@ EXIV2_RCSID("@(#) $Id: rw2image.cpp 3201 2013-12-01 12:13:42Z ahuggel $") // included header files #include "config.h" #include "ssh.hpp" -#if EXV_USE_SSH == 1 + +#ifdef EXV_USE_SSH // class member definitions namespace Exiv2 { diff --git a/src/version.cpp b/src/version.cpp index 3b92e852..ddc3b90d 100644 --- a/src/version.cpp +++ b/src/version.cpp @@ -31,15 +31,7 @@ EXIV2_RCSID("@(#) $Id$") #include "config.h" -#ifndef EXV_USE_SSH -#define EXV_USE_SSH 0 -#endif - -#ifndef EXV_USE_CURL -#define EXV_USE_CURL 0 -#endif - -#if EXV_USE_CURL == 1 +#ifdef EXV_USE_CURL #include #endif @@ -53,32 +45,12 @@ EXIV2_RCSID("@(#) $Id$") # endif #endif -#ifndef EXV_HAVE_XMP_TOOLKIT -#define EXV_HAVE_XMP_TOOLKIT 0 -#endif - -#ifndef EXV_HAVE_STRINGS -#define EXV_HAVE_STRINGS 0 -#endif - -#ifndef EXV_SYS_TYPES -#define EXV_SYS_TYPES 0 -#endif - -#ifndef EXV_HAVE_UNISTD -#define EXV_HAVE_UNISTD 0 -#endif - -#ifndef EXV_UNICODE_PATH -#define EXV_UNICODE_PATH 0 -#endif - #include "http.hpp" #include "version.hpp" #include "makernote_int.hpp" // Adobe XMP Toolkit -#if EXV_HAVE_XMP_TOOLKIT +#ifdef EXV_HAVE_XMP_TOOLKIT #include "xmp_exiv2.hpp" #endif @@ -173,11 +145,10 @@ static bool shouldOutput(const exv_grep_keys_t& greps,const char* key,const std: !bPrint && g != greps.end() ; ++g ) { std::string Key(key); -#if __cplusplus >= CPLUSPLUS11 +#if defined(EXV_HAVE_REGEX) std::smatch m; bPrint = std::regex_search(Key,m,*g) || std::regex_search(value,m,*g); -#else -#ifdef EXV_HAVE_REGEX +#elif defined(EXV_HAVE_REGEX_H) bPrint = ( 0 == regexec( &(*g), key , 0, NULL, 0) || 0 == regexec( &(*g), value.c_str(), 0, NULL, 0) ); @@ -191,7 +162,6 @@ static bool shouldOutput(const exv_grep_keys_t& greps,const char* key,const std: std::transform(Value.begin() , Value.end() ,Value.begin() , ::tolower); } bPrint = Key.find(Pattern) != std::string::npos || Value.find(Pattern) != std::string::npos; -#endif #endif } return bPrint; @@ -321,6 +291,8 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) int enable_video =0; int enable_webready =0; + int use_curl =0; + int use_ssh =0; #ifdef EXV_HAVE_GMTIME_R have_gmtime_r=1; @@ -462,6 +434,14 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) enable_webready=1; #endif +#ifdef EXV_USE_CURL + use_curl=1; +#endif + +#ifdef EXV_USE_SSH + use_ssh=1; +#endif + #if defined(WIN32) || defined(__CYGWIN__) || defined(__MINGW__) // enumerate loaded libraries and determine path to executable HMODULE handles[200]; @@ -518,8 +498,8 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) output(os,keys,"version" , __VERSION__); output(os,keys,"date" , __DATE__ ); output(os,keys,"time" , __TIME__ ); - output(os,keys,"ssh" , EXV_USE_SSH); -#if EXV_USE_CURL == 1 + +#ifdef EXV_USE_CURL std::string curl_protocols; curl_version_info_data* vinfo = curl_version_info(CURLVERSION_NOW); for (int i = 0; vinfo->protocols[i]; i++) { @@ -527,9 +507,9 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) curl_protocols += " " ; } output(os,keys,"curlprotocols" ,curl_protocols); -#else - output(os,keys,"curl" , EXV_USE_CURL); #endif + + output(os,keys,"curl" , use_curl); output(os,keys,"id" , "$Id$"); if ( libs.begin() != libs.end() ) { output(os,keys,"executable" ,*libs.begin()); @@ -572,6 +552,9 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) output(os,keys,"have_unicode_path" ,have_unicode_path); output(os,keys,"enable_video" ,enable_video ); output(os,keys,"enable_webready" ,enable_webready ); + output(os,keys,"use_curl" ,use_curl ); + output(os,keys,"use_ssh" ,use_ssh ); + output(os,keys,"config_path" ,Exiv2::Internal::getExiv2ConfigPath()); // #1147 @@ -581,7 +564,7 @@ void Exiv2::dumpLibraryInfo(std::ostream& os,const exv_grep_keys_t& keys) uid_t gid = getgid() ; output(os,keys,"gid" , gid ); #endif -#if EXV_HAVE_XMP_TOOLKIT +#ifdef EXV_HAVE_XMP_TOOLKIT const char* name = "xmlns"; Exiv2::Dictionary ns; diff --git a/xmpsdk/CMakeLists.txt b/xmpsdk/CMakeLists.txt index 35359e3b..4a507573 100644 --- a/xmpsdk/CMakeLists.txt +++ b/xmpsdk/CMakeLists.txt @@ -1,10 +1,6 @@ -# CMake build system for exiv2 library and executables -# Copyright 2010-2012 Gilles Caulier -# Copyright 2008 Patrick Spendrin - -# Redistribution and use is allowed according to the terms of the BSD license. -# For details see the accompanying COPYING-CMAKE-SCRIPTS file. +# CMakeLists.txt exiv2/xmpsdk +# list files to be use to build XMPsdk set(XMPSRC src/ExpatAdapter.cpp src/MD5.cpp src/ParseRDF.cpp @@ -21,14 +17,14 @@ set(XMPSRC src/ExpatAdapter.cpp src/XMPMeta.cpp src/XMPUtils-FileInfo.cpp src/XMPUtils.cpp - include/MD5.h - include/TXMPIterator.hpp - include/TXMPMeta.hpp - include/TXMPUtils.hpp - include/XMP_Const.h - include/XMP_Environment.h - include/XMP.incl_cpp - include/XMPSDK.hpp + include/MD5.h + include/TXMPIterator.hpp + include/TXMPMeta.hpp + include/TXMPUtils.hpp + include/XMP_Const.h + include/XMP_Environment.h + include/XMP.incl_cpp + include/XMPSDK.hpp include/XMP_Version.h ) @@ -74,9 +70,11 @@ if( EXIV2_ENABLE_LIBXMP ) set_property(TARGET xmp_object PROPERTY POSITION_INDEPENDENT_CODE ON) endif() - # 1119 Install libxmp.a for use by third party applications (Thanks, Emmanuel) - install(TARGETS xmp +# 1119 Install libxmp.a for use by third party applications (Thanks, Emmanuel) +install(TARGETS xmp LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} - ) -endif() +) + +# That's all Folks! +## diff --git a/xmpsdk/buildXMPsdk.cmd b/xmpsdk/buildXMPsdk.cmd new file mode 100644 index 00000000..aada74bc --- /dev/null +++ b/xmpsdk/buildXMPsdk.cmd @@ -0,0 +1,281 @@ +@echo off +rem ---- +rem buildXMPsdk.cmd +setlocal enableextensions +set "_THIS_=%0%" + +GOTO main +:help +echo %_THIS_% [Options] +echo.Options: --help ^| --2016 ^| --2014 ^| --2013 ^| --64 ^| --32 ^| --rebuild ^| --dryrun ^| --distclean ^| --generate +echo --sdk [2013^|2014^|2016] ^| --bit [32^|64] ^| --vs [2005^|2008^|2010^|2012^|2013^|2015^|2017] ^| --log [path] +exit /b 0 + +:main +rem ---- +rem always run this script in /xmpsdk +cd %~dp0 + +set "_BUILDDIR_=%CD%" +if NOT DEFINED _SDK_ set _SDK_=2016 +if NOT DEFINED _BIT_ set _BIT_=64 +if NOT DEFINED _VS_ set _VS_=2015 + +:GETOPTS +if /I "%1" == "--2013" set "_SDK_=2013" +if /I "%1" == "--2014" set "_SDK_=2014" +if /I "%1" == "--2016" set "_SDK_=2016" +if /I "%1" == "2013" set "_SDK_=2013" +if /I "%1" == "2014" set "_SDK_=2014" +if /I "%1" == "2016" set "_SDK_=2016" + +if /I "%1" == "--32" set "_BIT_=32" +if /I "%1" == "--64" set "_BIT_=64" +if /I "%1" == "32" set "_BIT_=32" +if /I "%1" == "64" set "_BIT_=64" + +if /I "%1" == "--vs" set "_VS_=%2"&shift +if /I "%1" == "--sdk" set "_SDK_=%2"&shift +if /I "%1" == "--bit" set "_BIT_=%2"&shift +if /I "%1" == "--log" set "_LOG_=%2"&shift + +if /I "%1" == "--verbose" echo on +if /I "%1" == "--silent" set _SILENT_=1 +if /I "%1" == "--help" call:help && goto end +if /I "%1" == "--rebuild" set _REBUILD_=1 +if /I "%1" == "--distclean" set _DISTCLEAN_=1 +if /I "%1" == "--dryrun" set _DRYRUN_=1 +if /I "%1" == "--generate" set _GENERATE_=1 + +shift +if not (%1) EQU () goto GETOPTS + +if /I "%_SDK_%" == "2013" ( + set "_SDK_=XMP-Toolkit-SDK-CC201306" + set "_ZIP_=XMP-Toolkit-SDK-CC-201306" +) +if /I "%_SDK_%" == "2014" ( + set "_SDK_=XMP-Toolkit-SDK-CC201412" + set "_ZIP_=XMP-Toolkit-SDK-CC201412" +) +if /I "%_SDK_%" == "2016" ( + set "_SDK_=XMP-Toolkit-SDK-CC201607" + set "_ZIP_=XMP-Toolkit-SDK-CC201607" +) + +if /I "%_VS_%" == "2017" set "_VC_=15" +if /I "%_VS_%" == "2015" set "_VC_=14" +if /I "%_VS_%" == "2013" set "_VC_=12" +if /I "%_VS_%" == "2012" set "_VC_=11" +if /I "%_VS_%" == "2010" set "_VC_=10" +if /I "%_VS_%" == "2008" set "_VC_=9" +if /I "%_VS_%" == "2005" set "_VC_=8" + set "_GENERATOR_=Visual Studio %_VC_% %_VS_%" +IF /I "%_BIT_%" == "64" set "_GENERATOR_=Visual Studio %_VC_% %_VS_% Win64" +if DEFINED _DRYRUN_ ( + call:report + GOTO end +) + +if DEFINED _REBUILD_ if EXIST Adobe\%_SDK_% rmdir/s/q Adobe\%_SDK_% +if DEFINED _DISTCLEAN_ if EXIST Adobe rmdir/s/q Adobe + +rem ---- +rem if it's already built, we're done +set "_TARGET_=Adobe\%_SDK_%\public\doesntexist +if /I %_BIT_% == 64 set "_TARGET_=Adobe\%_SDK_%\public\libraries\windows_x64\Release\XMPCoreStatic.lib" +if /I %_BIT_% == 32 set "_TARGET_=Adobe\%_SDK_%\public\libraries\windows\Release\XMPCoreStatic.lib" +if EXIST %_TARGET_% ( + dir %_TARGET_% + GOTO end +) + +rem ---- +call:echo testing 7z is on path +7z > NUL +IF ERRORLEVEL 1 ( + echo "*** please ensure 7z.exe is on the PATH ***" + GOTO error_end +) + +rem ---- +call:echo testing curl is on path +curl --version > NUL +IF ERRORLEVEL 1 ( + echo "*** please ensure cmake.exe is on the PATH ***" + GOTO error_end +) + +rem ---- +call:echo testing cmake.exe is on path +cmake.exe > NUL +IF ERRORLEVEL 1 ( + echo "*** please ensure cmake.exe is on the PATH ***" + GOTO error_end +) + +call:report + +rem ---- +rem Download the code from Adobe +if NOT EXIST Adobe\%_SDK_% ( + if NOT EXIST Adobe mkdir Adobe + cd Adobe + if NOT EXIST %_ZIP_%.zip curl -O http://download.macromedia.com/pub/developer/xmp/sdk/%_ZIP_%.zip + IF NOT ERRORLEVEL 1 7z x %_ZIP_%.zip 2>nul + cd .. +) + +if NOT EXIST Adobe\%_SDK_% ( + echo *** ERROR SDK = Adobe\%_SDK_% not found" + GOTO error_end +) + +rem ---- +rem Copy in the third-party files +xcopy/yesihq third-party\zlib Adobe\%_SDK_%\third-party\zlib +xcopy/yesihq third-party\expat\lib Adobe\%_SDK_%\third-party\expat\lib +xcopy/yesihq third-party\zuid\interfaces Adobe\%_SDK_%\third-party\zuid\interfaces + +rem ---- +rem generate and build the SDK +cd Adobe\%_SDK_%\build + +if EXIST CMakeCache.txt del CMakeCache.txt +if EXIST CMakeFiles rmdir/s/q CMakeFiles + +rem ------------------------------------------------------------------------------ +rem The Adobe script GeneratXMPToolkitSDK_win.bat +rem use the CMake Generators "Visual Studio 14 2015 Win64" and "Visual Studio 14 2015" +rem Adobe generate the Visual Studio Solution with the CMake command: +rem cmake ../../../. ^ +rem -G"Visual Studio 14 2015 Win64" ^ or -G"Visual Studio 14 2015" +rem -DXMP_CMAKEFOLDER_NAME="vc14/static/windows_x64" ^ +rem -DCMAKE_CL_64=ON ^ +rem -DCMAKE_ARCH=x64 ^ or -DCMAKE_ARCH=x86 +rem -DXMP_BUILD_WARNING_AS_ERROR=ON ^ +rem -DXMP_BUILD_STATIC=ON +rem -DCMAKE_BUILD_TYPE=Release +rem ------------------------------------------------------------------------------ +if DEFINED _GENERATE_ call:generate +if NOT DEFINED _GENERATE_ call:cmakebuild + +cd ..\..\.. + +cd "%_BUILDDIR_%" +if DEFINED _LOG_ call:log >> "%_LOG_%" +call:log +GOTO end + +rem ----------------------------------------- +rem Functions + +rem ---- +rem normal end +:end +endlocal +exit /b 0 + +rem ---- +rem echo (or don't if --silent). syntax: call:echo args ... +:echo +if NOT DEFINED _SILENT_ echo %*% +exit /b 0 + +rem ---- +rem end with an error syntax: call:error_end +:error_end +endlocal +exit /b 1 + +rem ---- +rem report settings +:report +cmake.exe > NUL +IF NOT ERRORLEVEL 1 cmake.exe --version +echo.vs = %_VS_% +echo.bit = %_BIT_% +echo.sdk = %_SDK_% +echo.generator = %_GENERATOR_% +echo.zip = %_ZIP_% +echo.builddir = %_BUILDDIR_% +echo ---------------------------------- +exit /b 0 + +rem ---- +rem log +:log +echo VS = %_VS_% BIT = %_BIT_% GENERATE = %_GENERATE_% +dir/s XMPCoreStatic.lib +echo.------------------------------------------------- +exit /b 0 + +rem ---- +rem generate +:generate +rem Building with the Adobe batch file GenerateXMPToolkitSDK_win.bat +rem SDK=2016 demands VS=2015/14.0 (SDK=2014 => VS=2012/11.0) (SDK 2013 => VS=2010/10.0) +set _VS_=2015 +set _VC_=14 +if /I %_SDK_% == XMP-Toolkit-SDK-CC201412 ( + set _VS_=2012 + set _VC_=11 +) +if /I %_SDK_% == XMP-Toolkit-SDK-CC201306 ( + set _VS_=2010 + set _VC_=10 +) + +if /I %_BIT_% == 64 ( + echo 5|GenerateXMPToolkitSDK_win.bat + call "%_BUILDDIR_%\..\contrib\cmake\msvc\vcvars.bat" %_VS_% %_BIT_% + devenv vc%_VC_%\static\windows_x64\XMPToolkitSDK64.sln /Build "Release|x64" /ProjectConfig XMPCoreStatic +) +if /I %_BIT_% == 32 ( + echo 3|GenerateXMPToolkitSDK_win.bat + call "%_BUILDDIR_%\..\contrib\cmake\msvc\vcvars.bat" %_VS_% %_BIT_% + devenv vc%_VC_%\static\windows\XMPToolkitSDK.sln /Build "Release|Win32" /ProjectConfig XMPCoreStatic +) +exit /b 0 + +rem ---- +rem cmakebuild +:cmakebuild + set "_CL64_=ON" + set "_ARCH_=x64" + set "_OUT_=%_VS_%/static/windows_x64" + set "_BUILD_=Release|x64" + set "_SLN_=XMPToolkitSDK64.sln" +if /I "%_BIT_%" == "32" ( + set "_CL64_=OFF" + set "_ARCH_==x86" + set "_OUT_=%_VS_%/static/windows" + set "_BUILD_=Release|Win32" + set "_SLN_=XMPToolkitSDK.sln" +) + +cmake.exe . "-G%_GENERATOR_%" "-DCMAKE_CL_64=%_CL64_%" "-DCMAKE_ARCH=%_ARCH_%" -DXMP_BUILD_STATIC=ON -DCMAKE_BUILD_TYPE=Release "-DXMP_CMAKEFOLDER_NAME=%_OUT_%" +rem cmake.exe . --build +call "%_BUILDDIR_%\..\contrib\cmake\msvc\vcvars.bat" %_VS_% %_BIT_% +devenv "%_SLN_%" /Build "%_BUILD_%" /ProjectConfig XMPCoreStatic + +exit /b 0 + +rem That's all Folks! +rem --- + +:-------------------------------------------------------------------------: +:Results (XMPCoreStatic.lib in bytes) : +:SDK 2016 (100mb) 2014 (19mb) 2013 (16mb) : +:BIT 64 32 64 32 64 32 : +:--generate 101641740 102822984 19286538 19450862 16460768 16401436 : +:--vs 2017 98051466 99325340 21777156 22077510 21742182 22042920 : +:--vs 2015 101639620 102822984 22062886 22146768 22029954 22112392 : +:--vs 2013 87074304 87437858 19390614 19373912 19358838 19340578 : +:--vs 2012 19286538 FAILS 19286538 88888888 FAILS 88888888 : +:--vs 2010 FAILS FAILS 16490010 88888888 16460768 88888888 : +:--vs 2008 88888888 88888888 88888888 88888888 88888888 88888888 : +:--vs 2005 88888888 88888888 88888888 88888888 88888888 88888888 : +:-------------------------------------------------------------------------: +:88888888 = Not tested + diff --git a/xmpsdk/include/MD5.h b/xmpsdk/include/MD5.h index f6c5e783..dd35d8ba 100644 --- a/xmpsdk/include/MD5.h +++ b/xmpsdk/include/MD5.h @@ -34,7 +34,7 @@ # endif #endif -#if defined(EXV_HAVE_STDINT_H) || defined(__MINGW32__) || defined(__MING64__) +#if defined(EXV_HAVE_STDINT_H) || defined(__MINGW32__) || defined(__MING64__) || defined(__APPLE__) # include #endif diff --git a/xmpsdk/third-party/zlib/zconf.h b/xmpsdk/third-party/zlib/zconf.h index a3a6b54f..6939aa3e 100644 --- a/xmpsdk/third-party/zlib/zconf.h +++ b/xmpsdk/third-party/zlib/zconf.h @@ -446,6 +446,10 @@ typedef uLong FAR uLongf; # undef _LARGEFILE64_SOURCE #endif +#if defined(_MSC_VER) && defined(Z_HAVE_UNISTD_H) +#undef Z_HAVE_UNISTD_H +#endif + #if defined(__WATCOMC__) && !defined(Z_HAVE_UNISTD_H) # define Z_HAVE_UNISTD_H #endif