You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
Robin Mills c5136b444b Added cmakeBuild --static option. Fixed issues with include <stdint.h> in include/exiv2/types.hpp Documentation update. 10 years ago
..
ReadMe.txt Added cmakeBuild --static option. Fixed issues with include <stdint.h> in include/exiv2/types.hpp Documentation update. 10 years ago
cmakeBuild.cmd Added cmakeBuild --static option. Fixed issues with include <stdint.h> in include/exiv2/types.hpp Documentation update. 10 years ago
cmakeDefaults.cmd #1041. Adding option --test and --bash to cmakeBuild.cmd. Correction to vcvars.bat to respect 32 bit builds by setting PROCESSOR_ARGUMENT. 10 years ago
cmakeRebuildAll.cmd Added cmakeBuild --static option. Fixed issues with include <stdint.h> in include/exiv2/types.hpp Documentation update. 10 years ago
vcvars.bat #1041. Added script cmakeRebuildAll.cmd. Documentation Update. Fix to vcvars 2005 32 10 years ago

ReadMe.txt

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.

contrib/cmake/msvc/ReadMe.txt
-----------------------------

How to use this
---------------

1 Setting up your machine
  You need cmake.exe, svn.exe, 7z.exe and curl.exe on your PATH.
  
  Please get "Windows" versions of cmake etc (NOT Cygwin 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's installed in 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 <exiv2dir>
  mkdir ..\build
  
  Ensure that cmakeBuild.cmd and cmakeDefaults.cmd are on your path (eg your build directory)
  copy  contrib\cmake\msvc\* ..\build
  cd    ..\build
  build --help
  
  You should never have reason to modify the code in cmakeBuild.cmd
  You may wish to change the defaults in setenv.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
  
  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\bin contains *.exe and *.dll files
                             build\dist\lib contains *.lib files
                             build\dist\include contains *.h and *.hpp files

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 <exiv2dir>
  mkdir ../build
  cd    ../build
  
  rem download support libraries
  svn export svn://dev.exiv2.org/svn/team/libraries/zlib-1.2.8
  svn export svn://dev.exiv2.org/svn/team/libraries/expat-2.1.0

  ...
      for webready 
      you also need curl-7.45.0 libssh-0.7.2 
      you will have to install openssl for you compiler before building curl
      see note below "About openssl"
  ...
  
  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 ^
            ..\..\..\<exiv2dir>
  cmake --build . --config Release
  cmake --build . --config Release --target install

5 About 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"

6 Build options
  You can inspect CMake options by running grep OPTION on CMakeLists.txt in <exiv2dir>
  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 will need cygwin's bash.exe.  It may run with other versions of bash (such as MinGW)

8 Building with different libraries
  You can change the standard libraries.  For example, to build with curl-7.39.0
  1) set _CURL_=curl-7.39.0
  2) put curl-7.39.0.tar.gz into your build directory
  
  To change the version of openssl:
  1) set _OPENSSL_=openssl-1.0.1j
  2) put openssl-1.0.1j-vs2015.zip into your build directory
  
  To build a version of openssl-foo-vs2012:
  Try to find it online
  Building this with Visual Studio is to to be documented

9 Rebuilding with VS 2005/8/10/12/13/15 32/64
  The script cmakeRebuildAll.cmd is provided for convenience:
  cmakeRebuildAll.cmd > rebuildAll.txt
  To view progress, open another shell: tail -f rebuildAll.txt 
  
  cmakeRebuildAll.cmd takes about a hour.
  12 build+test cycles of about 5 minutes each.

TODO:
--webready isn't working (Daniel to fix)

Status:
2015-11-28 Added option -static
           Build into: dist/2005/x64/dll/Release/{lib|bin|include}

2015-11-27 Minor changes.  Solved 'cygwin tee' issue (redirect and tail -f)
           Reinstalled MSVC 2010 and 2012 on laptop and retested.
           Documentation update.

2015-11-26 Ready for use by others
           Added options --test and --bash=c:\cygwin64\bin\bash.exe
           Added script cmakeRebuildAll.cmd
           Updated Documentation.

2015-11-19 "Work in Progress"
           Added a dependency for 7z.exe to decompress archives.
           Added downloading openssl
           Updated documentation

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 "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
           I'm going to do parallel development and see how that goes.

I'll discuss this with Daniel when I'm convinced my versions are working well.

Robin Mills
robin@clanmills.com