diff --git a/contrib/cmake/msvc/ReadMe.txt b/contrib/cmake/msvc/ReadMe.txt index e2b9f050..3135412c 100755 --- a/contrib/cmake/msvc/ReadMe.txt +++ b/contrib/cmake/msvc/ReadMe.txt @@ -4,11 +4,131 @@ contrib/cmake/msvc/ReadMe.txt These scripts are "in development". They are derived from Daniels contrib/build scripts. +How to use this +--------------- + +1 Ensure that build.cmd and setenv.cmd are on your path (eg the build directory) + +2 Your machine setup: + You need cmake.exe and svn.exe on your PATH. + Please get "Windows" versions of cmake and svn (NOT Cygwin versions) + You need a "Windows" version of perl.exe on the path to build openssl + + You should initialize the Visual Studio environment + using the version 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 cmake option -G Generator should be chosen for the version of Visual Studio installed. + cmake --help for more information + +3 Always build "out of source". I recommend: + cd + mkdir ..\build + copy contrib\cmake\msvc\* ..\build + cd ..\build + build --help + + You should never have reason to modify the code in build.cmd + You may wish to change the defaults in setenv.cmd + You can change the defaults on the command-line (or modify setenv.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: + build --verbose --pause + + This will print out a lot of information, and pause after each build step. + + When you are building happily, you may prefer: + build --silent + +4 What gets built? + The build is performed in build\temp + The output is generated in build\dist + build\dist\bin contains *.exe and *.dll files + build\dist\lib contains *.lib files + build\dist\include contains *.h and *.hpp files + +5 Building manually with CMake + cd + mkdir ../build + cd ../build + + rem download support libraries + svn export svn:/dev.exiv2.org/team/libraries/zlib-1.2.8 + svn export svn:/dev.exiv2.org/team/libraries/expat-2.1.0 + ... for webready, you also need libssh-0.5.5 curl-7.39.0 openssl-1.0.1j ... + + rem create a temp directory and a dist (distribution) directory + mkdir temp + mkdir dist + + 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 . --config Release # TAKE CARE with expat-2.1.0 use: cmake --build . --config Release --target expat + cmake --build . --target install --config Release + 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 + +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 ) + OPTION( EXIV2_ENABLE_CURL "USE Libcurl for HttpIo" ON ) + OPTION( EXIV2_ENABLE_SSH "USE Libssh for SshIo" ON ) + + 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 + Status: -2015-11-17 Added command-line parser +2015-11-18 "Work in Progress" + Lots of simplification. + Removed need for cygwin. + Added user documentation to ReadMe.txt + More work required on webready support. + +2015-11-17 "Work in Progress" + Added command-line parser Building exiv2 with zlib and expat and exiv2 -webready = curl etc broken -2015-11-16 The current status is "Work in Progress" = Not working yet. + +2015-11-16 "Work in Progress" = Not working yet. These script are not for public use at the moment by Daniel or anybody else. Rather than endlessly discuss these scripts with Daniel diff --git a/contrib/cmake/msvc/build.cmd b/contrib/cmake/msvc/build.cmd index 247e56a3..a61bf5f5 100755 --- a/contrib/cmake/msvc/build.cmd +++ b/contrib/cmake/msvc/build.cmd @@ -12,7 +12,6 @@ if /I "%1" == "--webready" set "_WEBREADY_=1" if /I "%1" == "--config" set "_CONFIG_=%2"& shift if /I "%1" == "--temp" set "_TEMP_=%2"& shift if /I "%1" == "--generator" set "_GENERATOR_=%2"& shift -if /I "%1" == "--cygwin" set "_CYGWIN_=%2"& shift if /I "%1" == "--exiv2" set "_EXIV2_=%2"& shift if /I "%1" == "--verbose" set "_VERBOSE_=1" if /I "%1" == "--dryrun" set "_DRYRUN_=1" @@ -20,6 +19,13 @@ if /I "%1" == "--rebuild" set "_REBUILD_=1" if /I "%1" == "--silent" set "_SILENT_=1" if /I "%1" == "--silent" set "_QUIET_=1" if /I "%1" == "--quiet" set "_QUIET_=1" +if /I "%1" == "--video" set "_VIDEO_=1" +if /I "%1" == "--pause" set "_PAUSE_=1" +if /I "%1" == "--zlib" set "_ZLIB_=%2"& shift +if /I "%1" == "--expat" set "_EXPAT_=%2"& shift +if /I "%1" == "--libssh" set "_LIBSSH_=%2"& shift +if /I "%1" == "--curl" set "_CURL_=%2"& shift +if /I "%1" == "--openssl" set "_OPENSSL_=%2"& shift shift if not (%1) EQU () goto GETOPTS @@ -28,18 +34,14 @@ rem ---- call:echo calling setenv call setenv.cmd IF ERRORLEVEL 1 ( - echo "*** setenv.cmd has failed ***" + echo "*** setenv.cmd has failed ***" >&2 GOTO error_end ) -rem if NOT DEFINED _DRYRUN_ if DEFINED _REBUILD_ ( -rem for /F "delims=" %%i in ('dir /b') do (rmdir "%%i" /s/q || del "%%i" /s/q) -rem ) - rem ---- call:echo checking that %_EXIV2_% exists if NOT EXIST %_EXIV2_% ( - echo "_EXIV2_ = %_EXIV2_% does not exist ***" + echo "_EXIV2_ = %_EXIV2_% does not exist ***" >&2 exit /b 1 ) pushd %_EXIV2_% @@ -60,48 +62,30 @@ IF NOT EXIST "%VSINSTALLDIR%" ( rem http://stackoverflow.com/questions/9252980/how-to-split-the-filename-from-a-full-path-in-batch for %%A in ("%VSINSTALLDIR%") do ( - set "VSSTUDIO=%%~nA" + set "VS_PROG_FILES=%%~nA" ) -call:echo VSSTUDIO = "%VSSTUDIO%" +call:echo VS_PROG_FILES = "%VS_PROG_FILES%" rem ---- call:echo setting CMake command options -IF "%VSSTUDIO%" EQU "Microsoft Visual Studio 14" ( +IF "%VS_PROG_FILES%" EQU "Microsoft Visual Studio 14" ( rem Visual Studio 2015 - set VS_SHORT=vc14 set VS_CMAKE=Visual Studio 14 - set VS_PROG_FILES=Microsoft Visual Studio 14.0 - set VS_OPENSSL=vs2015 -) ELSE IF "%VSSTUDIO%" EQU "Microsoft Visual Studio 12" ( +) ELSE IF "%VS_PROG_FILES%" EQU "Microsoft Visual Studio 12" ( rem Visual Studio 2013 - set VS_SHORT=vc12 set VS_CMAKE=Visual Studio 12 - set VS_PROG_FILES=Microsoft Visual Studio 12.0 - set VS_OPENSSL=vs2013 -) ELSE IF "%VSSTUDIO%" EQU "Microsoft Visual Studio 11" ( +) ELSE IF "%VS_PROG_FILES%" EQU "Microsoft Visual Studio 11" ( rem Visual Studio 2012 - set VS_SHORT=vc11 set VS_CMAKE=Visual Studio 11 - set VS_PROG_FILES=Microsoft Visual Studio 11.0 - set VS_OPENSSL=vs2012 -) ELSE IF "%VSSTUDIO%" EQU "Microsoft Visual Studio 10" ( +) ELSE IF "%VS_PROG_FILES%" EQU "Microsoft Visual Studio 10" ( rem Visual Studio 2010 - set VS_SHORT=vc10 set VS_CMAKE=Visual Studio 10 - set VS_PROG_FILES=Microsoft Visual Studio 10.0 - set VS_OPENSSL=vs2010 -) ELSE IF "%VSSTUDIO%" EQU "Microsoft Visual Studio 9" ( +) ELSE IF "%VS_PROG_FILES%" EQU "Microsoft Visual Studio 9" ( rem Visual Studio 2008 - set VS_SHORT=vc9 set VS_CMAKE=Visual Studio 9 2008 - set VS_PROG_FILES=Microsoft Visual Studio 9.0 - set VS_OPENSSL=vs2008 -) ELSE IF "%VSSTUDIO%" EQU "Microsoft Visual Studio 8" ( +) ELSE IF "%VS_PROG_FILES%" EQU "Microsoft Visual Studio 8" ( rem Visual Studio 2005 - set VS_SHORT=vc8 set VS_CMAKE=Visual Studio 8 2005 - set VS_PROG_FILES=Microsoft Visual Studio 8.0 - set VS_OPENSSL=vs2005 ) ELSE ( echo "*** Unsupported version of Visual Studio in '%VSINSTALLDIR%' ***" GOTO error_end @@ -119,7 +103,7 @@ if "%PROCESSOR_ARCHITECTURE%" EQU "AMD64" ( ) IF %Platform% EQU x64 ( - set VS_CMAKE=%VS_CMAKE% Win64 + set "VS_CMAKE=%VS_CMAKE% Win64" ) call:echo Platform = %Platform% (%RawPlatform%) @@ -156,35 +140,13 @@ IF ERRORLEVEL 1 ( GOTO error_end ) -rem ---- -call:echo testing that _CYGWIN_ exists -if NOT EXIST %_CYGWIN_% ( - echo "*** _CYGWIN_ %_CYGWIN_% does not exist ***" - GOTO error_end -) - -rem ---- -call:echo testing cygwin tools are available -IF NOT EXIST %_CYGWIN_%\bin\cp.exe GOTO cygwin_error -IF NOT EXIST %_CYGWIN_%\bin\tar.exe GOTO cygwin_error -GOTO cygwin_ok - -:cygwin_error -echo "*** Cygwin with bin/cp and bin/tar are required ***" -GOTO error_end - -:cygwin_ok -pushd %_CYGWIN_% -set _CYGWIN_=%CD% -popd - rem ---- call:echo testing temporary directory IF NOT EXIST "%_TEMP_%" mkdir "%_TEMP_%" pushd "%_TEMP_%" -set "_TEMP_=%CD%" +set "_TEMP_=%CD%" popd -call:echo _TEMP_ = %_TEMP_% +call:echo _TEMP_ = %_TEMP_% rem ---- call:echo testing INSTALL @@ -198,32 +160,38 @@ call:echo _INSTALL_ = %_INSTALL_% if NOT DEFINED _GENERATOR_ set "_GENERATOR_=%VS_CMAKE%" if /I "%_GENERATOR_%" == "NMake" set "_GENERATOR_=NMake Makefiles" +if defined _VIDEO_ set _VIDEO_=-DEXIV2_ENABLE_VIDEO=ON + rem ---- echo. -echo config = %_CONFIG_% webready = %_WEBREADY_% _EXIV2_= %_EXIV2_%" +echo.config = %_CONFIG_% +echo.video = %_VIDEO_% +echo.webready = %_WEBREADY_% +echo.exiv2 = %_EXIV2_%" IF DEFINED _DRYRUN_ exit /b 1 echo ---------- building ZLIB ------------------ -call:buildLib zlib-1.2.8 +call:buildLib %_ZLIB_% echo ---------- building EXPAT ----------------- set "TARGET=--target expat" -call:buildLib expat-2.1.0 +call:buildLib %_EXPAT_% set TARGET= + if DEFINED _WEBREADY_ ( echo ---------- building LIBSSH ----------------- set _SSH_=-DEXIV2_ENABLE_SSH=ON - call:buildLib libssh-0.5.5 + call:buildLib "%_LIBSSH_%" if errorlevel 1 set _SSH_=-DEXIV2_ENABLE_SSH=OFF echo ---------- building OPENSSL ----------------- - call:buildLib openssl-1.0.1j + call:buildLib "%_OPENSSL_%" echo ---------- building CURL ----------------- set _CURL_=-DEXIV2_ENABLE_CURL=ON - call:buildLib curl-7.39.0 + call:buildLib %_CURL_%" if errorlevel 1 set _CURL_=-DEXIV2_ENABLE_CURL=OFF set _WEBREADY_=-DEXIV2_ENABLE_WEBREADY=ON @@ -234,58 +202,58 @@ if DEFINED _WEBREADY_ ( ) echo ---------- building EXIV2 ------------------ +set "EXIV_BUILD=%_TEMP_%\exiv2" -set EXIV_BUILD="%_TEMP_%\exiv2" - -if defined _REBUILD_ "%EXIV_BUILD%" -IF NOT EXIST "%EXIV_BUILD%" mkdir "%EXIV_BUILD%" -pushd "%EXIV_BUILD%" +if defined _REBUILD_ rmdir/s/q "%EXIV_BUILD%" +IF NOT EXIST "%EXIV_BUILD%" mkdir "%EXIV_BUILD%" +pushd "%EXIV_BUILD%" call:run cmake -G "%_GENERATOR_%" ^ - "-DCMAKE_INSTALL_PREFIX=%_INSTALL_%" "-DCMAKE_PROGRAM_PATH=%SVN_DIR%" ^ - "-DCMAKE_LIBRARY_PATH=%INSTALL_PATH%\lib" "-DCMAKE_INCLUDE_PATH=%INSTALL_PATH%\include" ^ - -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_BUILD_SAMPLES=ON ^ + "-DCMAKE_INSTALL_PREFIX=%_INSTALL_%" "-DCMAKE_PROGRAM_PATH=%SVN_DIR%" ^ + "-DCMAKE_LIBRARY_PATH=%_INSTALL_%\lib" "-DCMAKE_INCLUDE_PATH=%_INSTALL_%\include" ^ + -DEXIV2_ENABLE_NLS=OFF -DEXIV2_ENABLE_BUILD_SAMPLES=ON ^ -DEXIV2_ENABLE_WIN_UNICODE=OFF -DEXIV2_ENABLE_SHARED=ON ^ - %_WEBREADY_% %_CURL_% %_SSH_% ^ + %_WEBREADY_% %_CURL_% %_SSH_% %_VIDEO_% ^ "%_EXIV2_%" IF errorlevel 1 ( - echo "*** errors in EXIV2 build [1] ***" + echo "*** cmake errors in EXIV2 ***" >&2 popd goto error_end ) call:run cmake --build . --config %_CONFIG_% IF errorlevel 1 ( - echo "*** errors in EXIV2 build [2] ***" + echo "*** build errors in EXIV2 ***" >&2 popd goto error_end ) call:run cmake --build . --config %_CONFIG_% --target install IF errorlevel 1 ( - echo "*** errors in EXIV2 build [3] ***" + echo "*** install errors in EXIV2 ***" >&2 popd goto error_end ) - copy/y "samples\%_CONFIG_%\"*.exe "%_INSTALL_%\bin" + if defined _SILENT_ copy/y "samples\%_CONFIG_%\"*.exe "%_INSTALL_%\bin" >nul + if NOT defined _SILENT_ copy/y "samples\%_CONFIG_%\"*.exe "%_INSTALL_%\bin" popd rem ----------------------------------------- rem Exit -:error_end -endlocal -REM pause -exit /b 1 - :end endlocal exit /b 0 +:error_end +endlocal +exit /b 1 + rem ----------------------------------------- rem Functions :help -echo Options: --help ^| --webready ^| --dryrun ^| --verbose ^| --rebuild ^| --silent ^| --verbose -echo. --exiv2 directory ^| --cygwin directory ^| --temp directory ^| --config name ^| --generator generator +echo Options: --help ^| --pause ^| --webready ^| --dryrun ^| --verbose ^| --rebuild ^| --silent ^| --verbose ^| --video +echo. --exiv2 directory ^| --temp directory ^| --config name ^| --generator generator +echo. --zlib zlib.1.2.8 ^| --expat expat-2.1.0 ^| --curl curl-7.39.0 ^| --libssh libssh-0.5.5 ^| --openssl openssl-1.0.1j exit /b 0 :echo @@ -301,55 +269,39 @@ if defined _VERBOSE_ ( ) if defined _SILENT_ %*% >nul 2>nul if NOT defined _SILENT_ %*% -exit /b %ERRORLEVEL% - +set _RESULT_=%ERRORLEVEL% +if DEFINED _PAUSE_ pause +exit /b %_RESULT_% rem ------------------------------------------------------------- :buildLib -cd "%_BUILDDIR_%" - -set LIB=%1% -set LIB_T=%LIB%.tar -set LIB_Z=%LIB%.tar.Z -set LIB_B="%_TEMP_%\%LIB%" - -if defined _REBUILD_ del "%LIB_Z%" -IF NOT EXIST "%LIB_Z%" ( - call:run svn export svn://dev.exiv2.org/svn/team/libraries/%LIB_Z% -) - -if defined _REBUILD_ rmdir/s/q "%LIB%" -IF NOT EXIST "%LIB%" "%_CYGWIN_%\bin\tar.exe" xzf "%LIB_Z%" +cd "%_BUILDDIR_%" +set "LIB=%1%" +set "LIB_B=%_TEMP_%\%LIB%" -if defined _REBUILD_ rmdir/s/q "%LIB_B%" -IF NOT EXIST %LIB_B% mkdir "%LIB_B%" - - pushd "%LIB_B%" +if defined _REBUILD_ rmdir/s/q "%LIB%" "%LIB_B%" +IF NOT EXIST "%LIB%" svn export svn://dev.exiv2.org/svn/team/libraries/%LIB% >NUL +IF NOT EXIST "%LIB_B%" mkdir "%LIB_B%" +pushd "%LIB_B%" call:run cmake -G "%_GENERATOR_%" -DCMAKE_INSTALL_PREFIX=%_INSTALL_% ..\..\%LIB% IF errorlevel 1 ( - echo "*** errors in %LIB% build [1] ***" + echo "*** cmake errors in %LIB% ***" popd exit /b 1 ) call:run cmake --build . --config %_CONFIG_% %TARGET% IF errorlevel 1 ( - echo "*** warning: errors in %LIB% build [2] ***" - popd - exit /b 0 + echo "*** warning: build errors in %LIB% ***" ) call:run cmake --build . --config %_CONFIG_% --target install IF errorlevel 1 ( - echo "*** warning: errors in %LIB% build [3] ***" - popd - exit /b 0 + echo "*** warning: install errors in %LIB% ***" ) - - popd - +popd exit /b 0 rem That's all Folks! diff --git a/contrib/cmake/msvc/setenv.cmd b/contrib/cmake/msvc/setenv.cmd index a4af4abe..1ad21f9c 100755 --- a/contrib/cmake/msvc/setenv.cmd +++ b/contrib/cmake/msvc/setenv.cmd @@ -1,9 +1,13 @@ @echo off if not defined _CONFIG_ SET _CONFIG_=Release -IF NOT DEFINED _CYGWIN_ SET _CYGWIN_=c:\cygwin64 if NOT DEFINED _TEMP_ SET _TEMP_=temp if NOT DEFINED _EXIV2_ SET _EXIV2_=..\trunk +if NOT DEFINED _CURL_ SET _CURL_=curl-7.39.0 +if NOT DEFINED _LIBSSH_ SET _LIBSSH_=libssh-0.5.5 +if NOT DEFINED _OPENSSL_ SET _OPENSSL_=openssl-1.0.1j +if NOT DEFINED _ZLIB_ SET _ZLIB_=zlib-1.2.8 +if NOT DEFINED _EXPAT_ SET _EXPAT_=expat-2.1.0 rem That's all Folks! rem