diff --git a/contrib/cmake/msvc/ReadMe.txt b/contrib/cmake/msvc/ReadMe.txt index 25dbf076..6cb601c9 100755 --- a/contrib/cmake/msvc/ReadMe.txt +++ b/contrib/cmake/msvc/ReadMe.txt @@ -1,217 +1,217 @@ - @@@Marco@@@@@b ;mm /##Gilles###\ - j@@@#Robin", Brad /@@@Thomas@@@@Q - @@@# \ ## @@@b |@@@b - @@@# .;;;;, ,;;;, ,;;;; ,;;;p .;;; 7@@ ]Alan - @@@# j@@@@, ]@@#/ '@@@# j@@@# ]@@^ ;@@@" - @@@Andreas@C "@@@p @@@" @@@b j@@@p @@b @@@#/ - @@@#^7"7%#\ ^@@@@@#~ Benb 1@@@ {@# s@@@# - @@@# Niels @@@b @@@Q ]@# ;@@@#/ - @@@# ,@@##@@m @@@b @@@p @@C #@@#C - @@@# ,/ s@@# @@@@ @@@b Volker @Tuan@ - ]@@@Abhinav@@\ /@@@\ \@@@Q @@@Q %@@@# /@@@@Mahesh@@# - /@@Raphael@@@@@\ /@@@@@\ C++ Metadata Library /@Sridhar@@@v0.26\ - -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 etc (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 - mkdir build - - +-------------------------------------------------------+ - | Never attempt to build in a directory with a space in | - | the path name. Example c:\My Build Tree\exiv2\build | - +-------------------------------------------------------+ - - Ensure that cmakeBuild.cmd and cmakeDefaults.cmd are on your path (eg your build directory) - copy contrib\cmake\msvc\* build - cd build - cmakeBuild --help - - 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 build\temp - The output is generated in build\dist - build\dist\..mumble..\bin contains *.exe and *.dll files - build\dist\..mumble..\lib contains *.lib files - build\dist\..mumble..\include contains *.h and *.hpp files - - mumble identifies the compiler and build. - Example C:\gnu\exiv2\build\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 - - ... - 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" ^ - -DEXIV2_ENABLE_SHARED=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( EXIV2_ENABLE_SHARED "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 - -Robin Mills -robin@clanmills.com + @@@Marco@@@@@b ;mm /##Gilles###\ + j@@@#Robin", Brad /@@@Thomas@@@@Q + @@@# \ ## @@@b |@@@b + @@@# .;;;;, ,;;;, ,;;;; ,;;;p .;;; 7@@ ]Alan + @@@# j@@@@, ]@@#/ '@@@# j@@@# ]@@^ ;@@@" + @@@Andreas@C "@@@p @@@" @@@b j@@@p @@b @@@#/ + @@@#^7"7%#\ ^@@@@@#~ Benb 1@@@ {@# s@@@# + @@@# Niels @@@b @@@Q ]@# ;@@@#/ + @@@# ,@@##@@m @@@b @@@p @@C #@@#C + @@@# ,/ s@@# @@@@ @@@b Volker @Tuan@ + ]@@@Abhinav@@\ /@@@\ \@@@Q @@@Q %@@@# /@@@@Mahesh@@# + /@@Raphael@@@@@\ /@@@@@\ C++ Metadata Library /@Sridhar@@@v0.26\ + +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 + + ... + 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" ^ + -DEXIV2_ENABLE_SHARED=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( EXIV2_ENABLE_SHARED "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 + +Robin Mills +robin@clanmills.com diff --git a/contrib/cmake/msvc/cmakeBuild.cmd b/contrib/cmake/msvc/cmakeBuild.cmd index e4bb82f5..c44ca0d7 100755 --- a/contrib/cmake/msvc/cmakeBuild.cmd +++ b/contrib/cmake/msvc/cmakeBuild.cmd @@ -1,438 +1,445 @@ -@echo off -setlocal enableextensions - -set "_BUILDDIR_=%CD%" - -: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 - -if /I "%1" == "--help" call:Help && goto end -if /I "%1" == "--dryrun" set "_DRYRUN_=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" - -shift -if not (%1) EQU () goto GETOPTS -goto main - -:help -call cmakeDefaults >NUL 2>NUL -echo Options: --help ^| --webready ^| --rebuild ^| --video ^| --static -echo. --silent ^| --verbose ^| --pause ^| --dryrun ^| --test ^| --trace -echo. --exiv2 %_EXIV2_% ^| --work %_WORK_% ^| --config %_CONFIG_% ^| --generator generator -echo. --zlib %_ZLIB_% ^| --expat %_EXPAT_% ^| --curl %_CURL_% ^| --libssh %_LIBSSH_% -echo. --bash %_BASH_% -exit /b 0 - -:report -echo.&&echo.&&echo. -echo.------ cmakeBuild Settings ---------- -echo.bash = %_BASH_% -echo.binpath = %_BINPATH_% -echo.builddir = %_BUILDDIR_% -echo.config = %_CONFIG_% -echo.curl = %_CURL_% -echo.exiv2 = %_EXIV2_% -echo.expat = %_EXPAT_% -echo.generator = %_GENERATOR_% -echo.incpath = %_INCPATH_% -echo.libpath = %_LIBPATH_% -echo.libssh = %_LIBSSH_% -echo.mode = %_MODE_% -echo.openssl = %_OPENSSL_% -echo.work = %_WORK_% -echo.test = %_TEST_% -echo.video = %_VIDEO_% -echo.vc = %_VC_% -echo.vs = %_VS_% -echo.webready = %_WEBREADY_% -echo.zlib = %_ZLIB_% -echo.&&echo.&&echo. -exit /b 0 - -:main -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 ---- -call:echo testing VSINSTALLDIR "%VSINSTALLDIR%" -IF NOT DEFINED VSINSTALLDIR ( - echo "VSINSTALLDIR not set. Run vcvars32.bat or vcvarsall.bat or vcvars.bat ***" - GOTO error_end -) -IF NOT EXIST "%VSINSTALLDIR%" ( - echo "VSINSTALLDIR %VSINSTALLDIR% does not exist. Run vcvars32.bat or vcvarsall.bat ***" - GOTO error_end -) - -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" -if /I "%VSINSTALLDIR%" == "%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\" set "_VS_=2010" && set "_VC_=10" -if /I "%VSINSTALLDIR%" == "%ProgramFiles(x86)%\Microsoft Visual Studio 9.0" set "_VS_=2008" && set "_VC_=9" -if /I "%VSINSTALLDIR%" == "%ProgramFiles(x86)%\Microsoft Visual Studio 8" set "_VS_=2005" && set "_VC_=8" - -if NOT DEFINED _VC_ set _VS_= -if NOT DEFINED _VS_ ( - echo "*** Unsupported version of Visual Studio in '%VSINSTALLDIR%' ***" - GOTO error_end -) - -call:echo testing architecture -if "%PROCESSOR_ARCHITECTURE%" EQU "x86" ( - set Platform=Win32 - set RawPlatform=x86 - set CpuPlatform=ia32 -) ELSE ( - set Platform=x64 - set RawPlatform=x64 - set CpuPlatform=intel64 -) -call:echo Platform = %Platform% (%RawPlatform%) - -call:echo determine generator -if NOT DEFINED _GENERATOR_ ( - set "_GENERATOR_=Visual Studio %_VC_% %_VS_%" - IF /I "%Platform%" == "x64" set "_GENERATOR_=Visual Studio %_VC_% %_VS_% Win64" -) -call:echo GENERATOR = %_GENERATOR_% - -rem ---- -call:echo testing out of source build -dir/s exiv2.cpp >NUL 2>NUL -IF NOT ERRORLEVEL 1 ( - echo "*** error: do not execute this script within the exiv2 source directory ***" - goto error_end -) - -rem ---- -call:echo testing compiler -cl > NUL 2>NUL -IF ERRORLEVEL 1 ( - echo "*** ensure cl is on path. Run vcvars32.bat or vcvarsall.bat ***" - GOTO error_end -) -if NOT DEFINED _SILENT_ cl - -rem ---- -call:echo testing svn is on path -svn --version > NUL -IF ERRORLEVEL 1 ( - echo "*** please ensure svn.exe is on the PATH ***" - GOTO error_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 cmake is on path -cmake --version > NUL -IF ERRORLEVEL 1 ( - echo "*** please ensure cmake.exe is on the PATH ***" - GOTO error_end -) - -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 NOT EXIST "%_WORK_%" mkdir "%_WORK_%" -pushd "%_WORK_%" -set "_WORK_=%CD%" -popd -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%" -popd -call:echo _INSTALL_ = %_INSTALL_% - -set "_LIBPATH_=%_INSTALL_%\bin" -set "_INCPATH_=%_INSTALL_%\include" -set "_BINPATH_=%_INSTALL_%\bin" -set "_ONCPATH_=%_INCPATH_%" -set _LIBPATH_=%_LIBPATH_:\=/% -set _INCPATH_=%_INCPATH_:\=/% -set _BINPATH_=%_BINPATH_:\=/% - -if defined _TEST_ if NOT EXIST "%_BASH_%" ( - echo "*** bash does not exist %_BASH_% ***" - GOTO error_end -) - -if NOT DEFINED _GENERATOR_ set "_GENERATOR_=%VS_CMAKE%" -if /I "%_GENERATOR_%" == "NMake" set "_GENERATOR_=NMake Makefiles" - -if /I "%_MODE_%" == "static" "_LINK_=-DCMAKE_LINK=static" - -call:cltest -call:report - -IF DEFINED _DRYRUN_ goto end -IF DEFINED _PAUSE_ pause - -echo ---------- ZLIB building with cmake ------------------ -call:buildLib %_ZLIB_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_% - -echo ---------- EXPAT building with cmake ----------------- -set "_TARGET_=--target expat" -call:buildLib %_EXPAT_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_% -set _TARGET_= - -if DEFINED _WEBREADY_ ( - echo ---------- OPENSSL installing pre-built binaries ----------------- - call:getOPENSSL %_OPENSSL_% - if errorlevel 1 set _OPENSSL_= && set _WEBREADY_= -) - -if DEFINED _WEBREADY_ ( - echo ---------- LIBSSH building with cmake ----------------- - call:buildLib %_LIBSSH_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_% -DCMAKE_LIBRARY_PATH=%_LIBPATH_% -DCMAKE_INCLUDE_PATH=%_INCPATH_% -DWITH_GSSAPI=OFF -DWITH_ZLIB=ON -DWITH_SFTP=ON -DWITH_SERVER=OFF -DWITH_EXAMPLES=OFF -DWITH_NACL=OFF -DWITH_PCAP=OFF - if errorlevel 1 set _LIBSSH_= && set _WEBREADY_= -) - -if DEFINED _WEBREADY_ ( - set CURL_CMAKE= - if DEFINED CURL_CMAKE ( - echo ---------- CURL building with cmake ----------------- - 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 - 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 - pushd "%_WORK_%" - - IF EXIST %_CURL_% rmdir/s/q %_CURL_% - IF NOT EXIST %_CURL_%.tar.gz copy "%_BUILDDIR_%\%_CURL_%.tar.gz" >NUL - IF NOT EXIST %_CURL_%.tar 7z x %_CURL_%.tar.gz - 7z x %_CURL_%.tar - - cd "%_CURL_%\winbuild" - call:run nmake /f Makefile.vc mode=%_MODE_% vc=%_VC_% machine=%RawPlatform% "WITH_DEVEL=%_INSTALL_%" WITH_ZLIB=%_MODE_% ENABLE_WINSSL=yes ENABLE_IDN=no - if errorlevel 1 set _CURL_= && set _WEBREADY_= - if DEFINED _WEBREADY_ ( - cd .. - call:run copy builds\libcurl-vc%_VC_%-%RawPlatform%-release-%_MODE_%-zlib-%_MODE_%-ipv6-sspi-winssl\lib\* "%_LIBPATH_%" - call:run copy builds\libcurl-vc%_VC_%-%RawPlatform%-release-%_MODE_%-zlib-%_MODE_%-ipv6-sspi-winssl\bin\* "%_BINPATH_%" - call:run xcopy/yesihq builds\libcurl-vc%_VC_%-%RawPlatform%-release-%_MODE_%-zlib-%_MODE_%-ipv6-sspi-winssl\include\curl "%_ONCPATH_%"\curl - ) - popd - ) - ) -) - -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%" - -pushd "%EXIV_B%" - set ENABLE_CURL=-DEXIV2_ENABLE_CURL=OFF - set ENABLE_LIBSSH=-DEXIV2_ENABLE_SSH=OFF - set ENABLE_WEBREADY=-DEXIV2_ENABLE_WEBREADY=OFF - set ENABLE_VIDEO=-DEXIV2_ENABLE_VIDEO=OFF - set ENABLE_SHARED=ON - 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 _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 - ) - - 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=ON ^ - -DEXIV2_ENABLE_WIN_UNICODE=OFF -DEXIV2_ENABLE_SHARED=%ENABLE_SHARED% ^ - -DEXIV2_ENABLE_DYNAMIC_RUNTIME=%ENABLE_DYNAMIC% ^ - %ENABLE_WEBREADY% %ENABLE_CURL% %ENABLE_LIBSSH% %ENABLE_VIDEO% ^ - "%_EXIV2_%" - - IF errorlevel 1 ( - echo "*** cmake errors in EXIV2 ***" >&2 - popd - goto error_end - ) - - 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 errorlevel 1 ( - echo "*** install errors in EXIV2 ***" >&2 - popd - goto error_end - ) -popd - -if defined _TEST_ ( - pushd "%_EXIV2_%\test" - "%_BASH_%" -c "export 'PATH=/usr/bin:$PATH' ; ./testMSVC.sh $(cygpath -au '%_BINPATH_%')" - popd - exit /b 0 -) - -rem ----------------------------------------- -rem Exit -rem end syntax: goto end -:end -endlocal -exit /b 0 - -rem end with an error syntax: call:error_end -:error_end -endlocal -exit /b 1 - -rem ----------------------------------------- -rem Functions -rem echo (or don't if --silent). syntax: call:echo args ... -:echo -if NOT DEFINED _SILENT_ echo %*% -exit /b 0 - -rem run a command. syntax call:run args -:run -if defined _VERBOSE_ ( - echo. - echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ - echo CD = %CD% - echo %*% - if DEFINED _PAUSE_ pause -) -if defined _SILENT_ %*% >nul 2>nul -if NOT defined _SILENT_ %*% - -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_%" -set "LOB=%1" -shift - -set "LOB_B=%_WORK_%\%LOB%" -set "LOB_TAR=%LOB%.tar" -set "LOB_TAR_GZ=%LOB_TAR%.gz" - -IF NOT EXIST "%LOB_TAR_GZ%" svn export svn://dev.exiv2.org/svn/team/libraries/%LOB_TAR_GZ% >NUL -IF NOT EXIST "%LOB_TAR%" 7z x "%LOB_TAR_GZ%" -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% - IF errorlevel 1 ( - echo "*** cmake errors in %LOB% ***" - popd - exit /b 1 - ) - - call:run cmake --build . --config %_CONFIG_% %_TARGET_% - IF errorlevel 1 ( - echo "*** warning: build errors in %LOB% ***" - ) - - call:run cmake --build . --config %_CONFIG_% --target install - IF errorlevel 1 ( - echo "*** warning: install errors in %LOB% ***" - ) -popd -exit /b 0 - -rem ----------------------------------------- -rem get pre-built openssl binaries syntax: call:getOPENSSL version -:getOPENSSL -cd "%_BUILDDIR_%" - -set "LOB=%1-vs%_VS_%" -set "LOB_7Z=%LOB%.7z" - -IF NOT EXIST "%LOB_7Z%" svn export svn://dev.exiv2.org/svn/team/libraries/%LOB_7Z% >NUL -IF NOT EXIST "%LOB%" 7z x "%LOB_7Z%" >nul - -set _BINARY_=bin -set _LIBRARY_=lib -set _INCLUDE_=include -if /I "%Platform%" == "x64" ( - set "_BINARY_=bin64" - set "_LIBRARY_=lib64" - set "_INCLUDE_=include64" -) - -xcopy/yesihq "%LOB%\%_BINARY_%" "%_INSTALL_%\bin" -xcopy/yesihq "%LOB%\%_LIBRARY_%" "%_INSTALL_%\lib" -xcopy/yesihq "%LOB%\%_INCLUDE_%" "%_INSTALL_%\include" - -rem curl requires libeay32 and ssleay32 (and not libeay32MD and ssleay32MD) -pushd "%_INSTALL_%\lib" - copy libeay32MD.lib libeay32.lib - copy ssleay32MD.lib ssleay32.lib -popd -pushd "%_INSTALL_%\bin" - copy libeay32MD.dll libeay32.dll - copy ssleay32MD.dll ssleay32.dll -popd - -exit /b 0 - -rem ----------------------------------------- -rem this runs the compiler and reports _MSC_VER and sizeof(void*) -:cltest -pushd "%_EXIV2_%\contrib\cmake\msvc" -nmake -a cltest.exe -cltest.exe -popd -exit /b %ERRORLEVEL% - -rem That's all Folks! -rem ----------------------------------------- +@echo off +setlocal enableextensions + +set "_BUILDDIR_=%CD%" + +: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 + +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" + +shift +if not (%1) EQU () goto GETOPTS +goto main + +:help +call cmakeDefaults >NUL 2>NUL +echo Options: --help ^| --webready ^| --rebuild ^| --video ^| --static +echo. --silent ^| --verbose ^| --pause ^| --dryrun ^| --test ^| --trace +echo. --exiv2 %_EXIV2_% ^| --work %_WORK_% ^| --config %_CONFIG_% ^| --generator generator +echo. --zlib %_ZLIB_% ^| --expat %_EXPAT_% ^| --curl %_CURL_% ^| --libssh %_LIBSSH_% +echo. --bash %_BASH_% +exit /b 0 + +:report +echo.&&echo.&&echo. +echo.------ cmakeBuild Settings ---------- +echo.bash = %_BASH_% +echo.binpath = %_BINPATH_% +echo.builddir = %_BUILDDIR_% +echo.config = %_CONFIG_% +echo.curl = %_CURL_% +echo.exiv2 = %_EXIV2_% +echo.expat = %_EXPAT_% +echo.generator = %_GENERATOR_% +echo.incpath = %_INCPATH_% +echo.libpath = %_LIBPATH_% +echo.libssh = %_LIBSSH_% +echo.mode = %_MODE_% +echo.openssl = %_OPENSSL_% +echo.work = %_WORK_% +echo.test = %_TEST_% +echo.video = %_VIDEO_% +echo.vc = %_VC_% +echo.vs = %_VS_% +echo.webready = %_WEBREADY_% +echo.zlib = %_ZLIB_% +echo.&&echo.&&echo. +exit /b 0 + +:main +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 ---- +call:echo testing VSINSTALLDIR "%VSINSTALLDIR%" +IF NOT DEFINED VSINSTALLDIR ( + echo "VSINSTALLDIR not set. Run vcvars32.bat or vcvarsall.bat or vcvars.bat ***" + GOTO error_end +) +IF NOT EXIST "%VSINSTALLDIR%" ( + echo "VSINSTALLDIR %VSINSTALLDIR% does not exist. Run vcvars32.bat or vcvarsall.bat ***" + GOTO error_end +) + +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" +if /I "%VSINSTALLDIR%" == "%ProgramFiles(x86)%\Microsoft Visual Studio 10.0\" set "_VS_=2010" && set "_VC_=10" +if /I "%VSINSTALLDIR%" == "%ProgramFiles(x86)%\Microsoft Visual Studio 9.0" set "_VS_=2008" && set "_VC_=9" +if /I "%VSINSTALLDIR%" == "%ProgramFiles(x86)%\Microsoft Visual Studio 8" set "_VS_=2005" && set "_VC_=8" + +if NOT DEFINED _VC_ set _VS_= +if NOT DEFINED _VS_ ( + echo "*** Unsupported version of Visual Studio in '%VSINSTALLDIR%' ***" + GOTO error_end +) + +call:echo testing architecture +if "%PROCESSOR_ARCHITECTURE%" EQU "x86" ( + set Platform=Win32 + set RawPlatform=x86 + set CpuPlatform=ia32 +) ELSE ( + set Platform=x64 + set RawPlatform=x64 + set CpuPlatform=intel64 +) +call:echo Platform = %Platform% (%RawPlatform%) + +call:echo determine generator +if NOT DEFINED _GENERATOR_ ( + set "_GENERATOR_=Visual Studio %_VC_% %_VS_%" + IF /I "%Platform%" == "x64" set "_GENERATOR_=Visual Studio %_VC_% %_VS_% Win64" +) +call:echo GENERATOR = %_GENERATOR_% + +rem ---- +call:echo testing out of source build +dir/s exiv2.cpp >NUL 2>NUL +IF NOT ERRORLEVEL 1 ( + echo "*** error: do not execute this script within the exiv2 source directory ***" + goto error_end +) + +rem ---- +call:echo testing compiler +cl > NUL 2>NUL +IF ERRORLEVEL 1 ( + echo "*** ensure cl is on path. Run vcvars32.bat or vcvarsall.bat ***" + GOTO error_end +) +if NOT DEFINED _SILENT_ cl + +rem ---- +call:echo testing svn is on path +svn --version > NUL +IF ERRORLEVEL 1 ( + echo "*** please ensure svn.exe is on the PATH ***" + GOTO error_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 cmake is on path +cmake --version > NUL +IF ERRORLEVEL 1 ( + echo "*** please ensure cmake.exe is on the PATH ***" + GOTO error_end +) + +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 NOT EXIST "%_WORK_%" mkdir "%_WORK_%" +pushd "%_WORK_%" +set "_WORK_=%CD%" +popd +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%" +popd +call:echo _INSTALL_ = %_INSTALL_% + +set "_LIBPATH_=%_INSTALL_%\bin" +set "_INCPATH_=%_INSTALL_%\include" +set "_BINPATH_=%_INSTALL_%\bin" +set "_ONCPATH_=%_INCPATH_%" +set _LIBPATH_=%_LIBPATH_:\=/% +set _INCPATH_=%_INCPATH_:\=/% +set _BINPATH_=%_BINPATH_:\=/% + +if defined _TEST_ if NOT EXIST "%_BASH_%" ( + echo "*** bash does not exist %_BASH_% ***" + GOTO error_end +) + +if NOT DEFINED _GENERATOR_ set "_GENERATOR_=%VS_CMAKE%" +if /I "%_GENERATOR_%" == "NMake" set "_GENERATOR_=NMake Makefiles" + +if /I "%_MODE_%" == "static" "_LINK_=-DCMAKE_LINK=static" + +call:cltest +call:report + +IF DEFINED _DRYRUN_ goto end +IF DEFINED _PAUSE_ pause + +echo ---------- ZLIB building with cmake ------------------ +call:buildLib %_ZLIB_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_% + +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 +) else ( + call:buildLib %_EXPAT_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_% +) +set _TARGET_= + +if DEFINED _WEBREADY_ ( + echo ---------- OPENSSL installing pre-built binaries ----------------- + call:getOPENSSL %_OPENSSL_% + if errorlevel 1 set _OPENSSL_= && set _WEBREADY_= +) + +if DEFINED _WEBREADY_ ( + echo ---------- LIBSSH building with cmake ----------------- + call:buildLib %_LIBSSH_% -DCMAKE_INSTALL_PREFIX=%_INSTALL_% -DCMAKE_LIBRARY_PATH=%_LIBPATH_% -DCMAKE_INCLUDE_PATH=%_INCPATH_% -DWITH_GSSAPI=OFF -DWITH_ZLIB=ON -DWITH_SFTP=ON -DWITH_SERVER=OFF -DWITH_EXAMPLES=OFF -DWITH_NACL=OFF -DWITH_PCAP=OFF + if errorlevel 1 set _LIBSSH_= && set _WEBREADY_= +) + +if DEFINED _WEBREADY_ ( + set CURL_CMAKE= + if DEFINED CURL_CMAKE ( + echo ---------- CURL building with cmake ----------------- + 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 + 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 + pushd "%_WORK_%" + + IF EXIST %_CURL_% rmdir/s/q %_CURL_% + IF NOT EXIST %_CURL_%.tar.gz copy "%_BUILDDIR_%\%_CURL_%.tar.gz" >NUL + IF NOT EXIST %_CURL_%.tar 7z x %_CURL_%.tar.gz + 7z x %_CURL_%.tar + + cd "%_CURL_%\winbuild" + call:run nmake /f Makefile.vc mode=%_MODE_% vc=%_VC_% machine=%RawPlatform% "WITH_DEVEL=%_INSTALL_%" WITH_ZLIB=%_MODE_% ENABLE_WINSSL=yes ENABLE_IDN=no + if errorlevel 1 set _CURL_= && set _WEBREADY_= + if DEFINED _WEBREADY_ ( + cd .. + call:run copy builds\libcurl-vc%_VC_%-%RawPlatform%-release-%_MODE_%-zlib-%_MODE_%-ipv6-sspi-winssl\lib\* "%_LIBPATH_%" + call:run copy builds\libcurl-vc%_VC_%-%RawPlatform%-release-%_MODE_%-zlib-%_MODE_%-ipv6-sspi-winssl\bin\* "%_BINPATH_%" + call:run xcopy/yesihq builds\libcurl-vc%_VC_%-%RawPlatform%-release-%_MODE_%-zlib-%_MODE_%-ipv6-sspi-winssl\include\curl "%_ONCPATH_%"\curl + ) + popd + ) + ) +) + +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%" + +pushd "%EXIV_B%" + set ENABLE_CURL=-DEXIV2_ENABLE_CURL=OFF + set ENABLE_LIBSSH=-DEXIV2_ENABLE_SSH=OFF + set ENABLE_WEBREADY=-DEXIV2_ENABLE_WEBREADY=OFF + set ENABLE_VIDEO=-DEXIV2_ENABLE_VIDEO=OFF + set ENABLE_SHARED=ON + 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 _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 + + 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 -DEXIV2_ENABLE_SHARED=%ENABLE_SHARED% ^ + -DEXIV2_ENABLE_DYNAMIC_RUNTIME=%ENABLE_DYNAMIC% ^ + %ENABLE_WEBREADY% %ENABLE_CURL% %ENABLE_LIBSSH% %ENABLE_VIDEO% ^ + "%_EXIV2_%" + + IF errorlevel 1 ( + echo "*** cmake errors in EXIV2 ***" >&2 + popd + goto error_end + ) + + 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 errorlevel 1 ( + echo "*** install errors in EXIV2 ***" >&2 + popd + goto error_end + ) +popd + +if defined _TEST_ ( + pushd "%_EXIV2_%\test" + "%_BASH_%" -c "export 'PATH=/usr/bin:$PATH' ; ./testMSVC.sh $(cygpath -au '%_BINPATH_%')" + popd + exit /b 0 +) + +rem ----------------------------------------- +rem Exit +rem end syntax: goto end +:end +endlocal +exit /b 0 + +rem end with an error syntax: call:error_end +:error_end +endlocal +exit /b 1 + +rem ----------------------------------------- +rem Functions +rem echo (or don't if --silent). syntax: call:echo args ... +:echo +if NOT DEFINED _SILENT_ echo %*% +exit /b 0 + +rem run a command. syntax call:run args +:run +if defined _VERBOSE_ ( + echo. + echo ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ + echo CD = %CD% + echo %*% + if DEFINED _PAUSE_ pause +) +if defined _SILENT_ %*% >nul 2>nul +if NOT defined _SILENT_ %*% + +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_%" +set "LOB=%1" +shift + +set "LOB_B=%_WORK_%\%LOB%" +set "LOB_TAR=%LOB%.tar" +set "LOB_TAR_GZ=%LOB_TAR%.gz" + +IF NOT EXIST "%LOB_TAR_GZ%" svn export svn://dev.exiv2.org/svn/team/libraries/%LOB_TAR_GZ% >NUL +IF NOT EXIST "%LOB_TAR%" 7z x "%LOB_TAR_GZ%" +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% + IF errorlevel 1 ( + echo "*** cmake errors in %LOB% ***" + popd + exit /b 1 + ) + + call:run cmake --build . --config %_CONFIG_% %_TARGET_% + IF errorlevel 1 ( + echo "*** warning: build errors in %LOB% ***" + ) + + call:run cmake --build . --config %_CONFIG_% --target install + IF errorlevel 1 ( + echo "*** warning: install errors in %LOB% ***" + ) +popd +exit /b 0 + +rem ----------------------------------------- +rem get pre-built openssl binaries syntax: call:getOPENSSL version +:getOPENSSL +cd "%_BUILDDIR_%" + +set "LOB=%1-vs%_VS_%" +set "LOB_7Z=%LOB%.7z" + +IF NOT EXIST "%LOB_7Z%" svn export svn://dev.exiv2.org/svn/team/libraries/%LOB_7Z% >NUL +IF NOT EXIST "%LOB%" 7z x "%LOB_7Z%" >nul + +set _BINARY_=bin +set _LIBRARY_=lib +set _INCLUDE_=include +if /I "%Platform%" == "x64" ( + set "_BINARY_=bin64" + set "_LIBRARY_=lib64" + set "_INCLUDE_=include64" +) + +xcopy/yesihq "%LOB%\%_BINARY_%" "%_INSTALL_%\bin" +xcopy/yesihq "%LOB%\%_LIBRARY_%" "%_INSTALL_%\lib" +xcopy/yesihq "%LOB%\%_INCLUDE_%" "%_INSTALL_%\include" + +rem curl requires libeay32 and ssleay32 (and not libeay32MD and ssleay32MD) +pushd "%_INSTALL_%\lib" + copy libeay32MD.lib libeay32.lib + copy ssleay32MD.lib ssleay32.lib +popd +pushd "%_INSTALL_%\bin" + copy libeay32MD.dll libeay32.dll + copy ssleay32MD.dll ssleay32.dll +popd + +exit /b 0 + +rem ----------------------------------------- +rem this runs the compiler and reports _MSC_VER and sizeof(void*) +:cltest +pushd "%_EXIV2_%\contrib\cmake\msvc" +nmake -a cltest.exe +cltest.exe +popd +exit /b %ERRORLEVEL% + +rem That's all Folks! +rem ----------------------------------------- diff --git a/contrib/cmake/msvc/cmakeDefaults.cmd b/contrib/cmake/msvc/cmakeDefaults.cmd index 31ae55d5..8dd5aa55 100755 --- a/contrib/cmake/msvc/cmakeDefaults.cmd +++ b/contrib/cmake/msvc/cmakeDefaults.cmd @@ -1,33 +1,33 @@ -@echo off - -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_=..\trunk -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 - -rem ---------- check that EXIV2 exists -echo checking that %_EXIV2_% exists -if NOT EXIST %_EXIV2_% ( - echo "_EXIV2_ = %_EXIV2_% does not exist ***" >&2 - exit /b 1 -) -pushd %_EXIV2_% -set _EXIV2_=%CD% -popd -if NOT EXIST %_EXIV2_%\src\version.cpp ( - echo "_EXIV2_ = %_EXIV2_% %_EXIV2_%\src\version.cpp does not exist ***" >&2 - exit /b 1 -) - -rem That's all Folks! -rem +@echo off + +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 + +rem ---------- check that EXIV2 exists +echo checking that %_EXIV2_% exists +if NOT EXIST %_EXIV2_% ( + echo "_EXIV2_ = %_EXIV2_% does not exist ***" >&2 + exit /b 1 +) +pushd %_EXIV2_% +set _EXIV2_=%CD% +popd +if NOT EXIST %_EXIV2_%\src\version.cpp ( + echo "_EXIV2_ = %_EXIV2_% %_EXIV2_%\src\version.cpp does not exist ***" >&2 + exit /b 1 +) + +rem That's all Folks! +rem diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 27b78a48..7fcebfd3 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -257,6 +257,11 @@ ENDIF() target_include_directories(exiv2lib PRIVATE ${CMAKE_SOURCE_DIR}/xmpsdk/include) if ( MSVC ) + if ( EXIV2_ENABLE_STATIC ) + TARGET_LINK_LIBRARIES( exiv2lib zlibstatic ${ZLIB_LIBRARIES} ) + else() + TARGET_LINK_LIBRARIES( exiv2lib ${PRIVATE_VAR} ${ZLIB_LIBRARIES} ) + endif() source_group("Header Files" FILES ${LIBEXIV2_HDR} ) TARGET_LINK_LIBRARIES( exiv2lib ${PRIVATE_VAR} ${ZLIB_LIBRARIES} ) TARGET_LINK_LIBRARIES( exiv2lib ${PRIVATE_VAR} ${EXPAT_LIBRARIES} )