see TODO-CMAKE for details. work in progress update

v0.27.3
Robin Mills 13 years ago
parent fba1884833
commit 7b49e908dc

@ -50,16 +50,17 @@ if( MSVC )
msvc_runtime_configure(${EXIV2_ENABLE_SHARED}) msvc_runtime_configure(${EXIV2_ENABLE_SHARED})
msvc_runtime_report() msvc_runtime_report()
## if ( NOT EXPAT_LIBRARY )
# link dependant libraries # link dependant libraries
# apologies for the duplication of information # apologies for the duplication of information
# I've been unable to simply this using the 'set' command # I've been unable to simply this using the 'set' command
set(EXPAT_LIBRARY "../../expat-2.1.0/$(ConfigurationName)/expat") set(EXPAT_LIBRARY "../../expat-2.1.0/$(ConfigurationName)/expat")
set(ZLIB_LIBRARY "../../zlib-1.2.7/$(ConfigurationName)/zlib" ) set(ZLIB_LIBRARY "../../zlib-1.2.7/$(ConfigurationName)/zlib" )
include_directories( ../zlib-1.2.7 ../expat-2.1.0/lib) include_directories( ../zlib-1.2.7 ../expat-2.1.0/lib)
set(EXPAT_INCLUDE_DIR ../expat-2.1.0/lib ) set(EXPAT_INCLUDE_DIR ../expat-2.1.0/lib )
set(ZLIB_INCLUDE_DIR ../zlib-1.2.7 ) set(ZLIB_INCLUDE_DIR ../zlib-1.2.7 )
endif()
if ( EXIV2_ENABLE_SHARED ) if ( EXIV2_ENABLE_SHARED )
add_library(expat-2.1.0 SHARED IMPORTED) add_library(expat-2.1.0 SHARED IMPORTED)
add_library(zlib-1.2.7 SHARED IMPORTED) add_library(zlib-1.2.7 SHARED IMPORTED)

@ -109,12 +109,12 @@ msvc64: 32 bit AND 64 bit build environment for MSVC 2005 (and 2008 and 2010)
cmake: This environment cmake: This environment
CMake doesn't build code. It generates build environments. CMake doesn't build code. It generates build environments.
CMake is a language for describing builds and the language interpreter generates CMake is a language for describing builds and the CMake interpreter generates
the build environment for your system. the build environment for your system.
CMake generates MSVC .sln and .vcproj files for your target environment. CMake generates MSVC .sln and .vcproj files for your target environment.
The files generated by CMake provide 4 configs: Debug|Release|RelWithDebInfo|MinSizeRel The files generated by CMake provide 4 configs: Debug|Release|RelWithDebInfo|MinSizeRel
The current architecture of CMake requires you to decide before running cmake about: The current architecture of CMake requires you to decide before running cmake:
1) The version of DevStudio 1) The version of DevStudio
2) 32bit or 64 bit builds 2) 32bit or 64 bit builds
3) Building static or shared libraries 3) Building static or shared libraries
@ -141,12 +141,16 @@ There are many options for the cmake command, and many generators. I've added a
batch file cm.bat for my convenience. batch file cm.bat for my convenience.
c:\> cm 2008 64 == cmake CMakeLists.txt -G "Visual Studio 9 2008 Win64" c:\> cm 2008 64 == cmake CMakeLists.txt -G "Visual Studio 9 2008 Win64"
Building with cmake involves 3 steps (build zlib/expat, build exiv2, test): Building from source
--------------------
1) Building the support libraries expat and zlib (with cmake) There are 3 steps (build zlib/expat, build exiv2, test).
You can skip step 1 if you have prebuilt libraries (see note below)
1) Building the support libraries expat and zlib with cmake
cd expat-2.1.0 cd expat-2.1.0
Edit CMakeLists.txt to specify shared or static library Edit CMakeLists.txt to specify shared or static library
If you wish to use static libries, you'll need the following patch (around line 23) If you wish to use STATIC libries, you'll need the following patch (around line 23)
See "Note about expat-2.1.0/CMakeLists.txt" See "Note about expat-2.1.0/CMakeLists.txt"
--- extract from CMakeLists.txt --- --- extract from CMakeLists.txt ---
@ -175,7 +179,7 @@ Building with cmake involves 3 steps (build zlib/expat, build exiv2, test):
Edit CMakeLists.txt to specify shared or static library (and other options) Edit CMakeLists.txt to specify shared or static library (and other options)
You may need to change the path specifications to expat and zlib to match your setup You may need to change the path specifications to expat and zlib to match your setup
You will find path references in the three files: You will find path references in the files:
CMakeLists.txt ./src/CMakeLists.txt and ./samples/CMakeLists.txt CMakeLists.txt ./src/CMakeLists.txt and ./samples/CMakeLists.txt
cmake CMakeLists.txt -G "Visual Studio 9 2008 Win64" cmake CMakeLists.txt -G "Visual Studio 9 2008 Win64"
@ -185,7 +189,16 @@ Building with cmake involves 3 steps (build zlib/expat, build exiv2, test):
3) Location of built files (exiv2.exe, exiv2.dll etc) 3) Location of built files (exiv2.exe, exiv2.dll etc)
exiv2\bin\{ x64 | Win32 }\{ Dynamic|Static }\{Config}\exiv2.exe etc.... exiv2\bin\{ x64 | Win32 }\{ Dynamic|Static }\{Config}\exiv2.exe etc....
Config: Debug | MinSizeRel | Release | RelWithDebInfo Config: Debug | MinSizeRel | Release | RelWithDebInfo
The test suite is a bash script and requires Cygwin.
cd /c/gnu/exiv2/test
./testMSVC.sh ${PWD}/../bin/x64/Dynamic/Release
or
./testMSVC.sh ${PWD}/../bin/x64/Dynamic/ | tee foo.txt
./verifyMSVC foo.txt
Note about expat-2.1.0/CMakeLists.txt Note about expat-2.1.0/CMakeLists.txt
------------------------------------- -------------------------------------
expat-2.1.0/CMakeLists.txt can build static or dynamic libraries. expat-2.1.0/CMakeLists.txt can build static or dynamic libraries.
@ -193,6 +206,17 @@ Note about expat-2.1.0/CMakeLists.txt
I've taken a decision to either link "All static" or "All dynamic" with no mixing. I've taken a decision to either link "All static" or "All dynamic" with no mixing.
This patch enforces my design and avoids linker headaches. This patch enforces my design and avoids linker headaches.
Note about using prebuilt zlib, expat and iconv
-----------------------------------------------
I expect you to setup the source build tree and build expat and zlib.
However you may wish to use prebuilt versions of zlib, iconv and expat.
Specify the location of the prebuilt libraries on the cmake command line:
For example:
cmake -G "NMake Makefiles" . -DEXPAT_LIBRARY=%KDE4_INSTALL_DIR%/lib/libexpat.lib
ToDo: More information about parameters -DEXPAT_LIBRARTY -DZLIB_LIBRARY etc.
4 Building and Installing for other users (Xcode, Eclipse, Qt) 4 Building and Installing for other users (Xcode, Eclipse, Qt)
============================================================== ==============================================================

@ -1,18 +1,22 @@
My current list Current Status
ToDo: * 2005/32/debug won't run. "SideBySide" error (manifest trouble) ToDo: * Support for out of source builds
* I'm not searching correctly for expat, zlib and iconv
* Test Cygwin, MinGW, Xcode, NMake and more versions of MSVC * Test Cygwin, MinGW, Xcode, NMake and more versions of MSVC
* Test Out of source builds * Revisit searching for zlib, expat and iconv
* Add the header files to the MSVC UI * Work on the "inherited from Gilles" list below
Done: * write FindLibexiv2.cmake (Thank you, Gilles) Bugs: * 2005/32/debug won't run. "SideBySide" error (manifest trouble)
* 2003/32 does not compile (1000's of template errors)
Done: * Add header files to MSVC UI for exiv2lib (and changed exiv2bin->exiv2 and exiv2->exiv2lib)
* Searching better for expat, zlib and iconv
* write FindLibexiv2.cmake (Thank you, Gilles)
* Builds and passes the test suite on 2005/32, 2008/64, Mac-Lion/64/Makefiles and Ubuntu/12.04/32bit * Builds and passes the test suite on 2005/32, 2008/64, Mac-Lion/64/Makefiles and Ubuntu/12.04/32bit
* Updated documentation (README-CMAKE) * Updated documentation (README-CMAKE)
Robin Mills Robin Mills
robin@clanmills.com robin@clanmills.com
2012-06-03 2012-06-05
Inherited from Gilles Caulier <caulier dot gilles at gmail dot com>: Inherited from Gilles Caulier <caulier dot gilles at gmail dot com>:

@ -11,7 +11,7 @@ if (MSVC)
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../include ${CMAKE_CURRENT_SOURCE_DIR}/../msvc64/include ) include_directories( ${CMAKE_CURRENT_SOURCE_DIR}/../include ${CMAKE_CURRENT_SOURCE_DIR}/../msvc64/include )
if ( NOT EXIV2_ENABLE_SHARED ) if ( NOT EXIV2_ENABLE_SHARED )
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../zlib-1.2.7/$(ConfigurationName)) # link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../zlib-1.2.7/$(ConfigurationName))
endif() endif()
endif() endif()
@ -43,7 +43,7 @@ FOREACH(entry ${SAMPLES})
STRING( REPLACE ".cpp" "" target ${entry}) STRING( REPLACE ".cpp" "" target ${entry})
ADD_EXECUTABLE( ${target} ${target}.cpp ) ADD_EXECUTABLE( ${target} ${target}.cpp )
ADD_TEST( ${target}_test ${target} ) ADD_TEST( ${target}_test ${target} )
TARGET_LINK_LIBRARIES( ${target} exiv2 ) TARGET_LINK_LIBRARIES( ${target} exiv2lib )
ENDFOREACH(entry ${SAMPLES}) ENDFOREACH(entry ${SAMPLES})
# That's all Folks! # That's all Folks!

@ -181,47 +181,52 @@ include(../CMake_msvc.txt)
msvc_runtime_configure(${EXIV2_ENABLE_SHARED}) msvc_runtime_configure(${EXIV2_ENABLE_SHARED})
# ****************************************************************************** # ******************************************************************************
# exiv2 library # exiv2lib library
ADD_LIBRARY( exiv2 ${STATIC_FLAG} ${LIBEXIV2_SRC} ) ADD_LIBRARY( exiv2lib ${STATIC_FLAG} ${LIBEXIV2_SRC} ${LIBEXIV2_HDR} )
SET_TARGET_PROPERTIES( exiv2 PROPERTIES SET_TARGET_PROPERTIES( exiv2lib PROPERTIES
VERSION ${GENERIC_LIB_VERSION} VERSION ${GENERIC_LIB_VERSION}
SOVERSION ${GENERIC_LIB_SOVERSION} SOVERSION ${GENERIC_LIB_SOVERSION}
DEFINE_SYMBOL EXV_BUILDING_LIB DEFINE_SYMBOL EXV_BUILDING_LIB
OUTPUT_NAME exiv2
) )
TARGET_LINK_LIBRARIES( exiv2 ${EXPAT_LIBRARIES} ) if ( MSVC )
source_group("Header Files" FILES ${LIBEXIV2_HDR} )
endif()
TARGET_LINK_LIBRARIES( exiv2lib ${EXPAT_LIBRARIES} )
if( EXIV2_ENABLE_LIBXMP ) if( EXIV2_ENABLE_LIBXMP )
ADD_DEPENDENCIES( exiv2 xmp ) ADD_DEPENDENCIES( exiv2lib xmp )
LINK_DIRECTORIES(${LIBRARY_OUTPUT_PATH}/$(ConfigurationName)) LINK_DIRECTORIES(${LIBRARY_OUTPUT_PATH}/$(ConfigurationName))
TARGET_LINK_LIBRARIES( exiv2 xmp ) TARGET_LINK_LIBRARIES( exiv2lib xmp )
ENDIF() ENDIF()
IF( EXIV2_ENABLE_PNG ) IF( EXIV2_ENABLE_PNG )
IF( ZLIB_FOUND ) IF( ZLIB_FOUND )
IF( MSVC ) IF( MSVC )
if ( EXIV2_ENABLE_SHARED ) if ( EXIV2_ENABLE_SHARED )
TARGET_LINK_LIBRARIES( exiv2 optimized ${ZLIB_LIBRARIES} debug ${ZLIB_LIBRARIES}d ) TARGET_LINK_LIBRARIES( exiv2lib optimized ${ZLIB_LIBRARIES} debug ${ZLIB_LIBRARIES}d )
else() else()
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../zlib-1.2.7/$(ConfigurationName)) # link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../zlib-1.2.7/$(ConfigurationName))
TARGET_LINK_LIBRARIES( exiv2 optimized zlibstatic.lib debug zlibstaticd.lib ) TARGET_LINK_LIBRARIES( exiv2lib optimized zlibstatic.lib debug zlibstaticd.lib )
endif() endif()
ELSE() ELSE()
TARGET_LINK_LIBRARIES( exiv2 ${ZLIB_LIBRARIES} ) TARGET_LINK_LIBRARIES( exiv2lib ${ZLIB_LIBRARIES} )
ENDIF() ENDIF()
ENDIF() ENDIF()
ENDIF() ENDIF()
IF( EXIV2_ENABLE_NLS ) IF( EXIV2_ENABLE_NLS )
TARGET_LINK_LIBRARIES( exiv2 ${LIBINTL_LIBRARIES} ) TARGET_LINK_LIBRARIES( exiv2lib ${LIBINTL_LIBRARIES} )
ENDIF( EXIV2_ENABLE_NLS ) ENDIF( EXIV2_ENABLE_NLS )
IF( ICONV_FOUND ) IF( ICONV_FOUND )
TARGET_LINK_LIBRARIES( exiv2 ${ICONV_LIBRARIES} ) TARGET_LINK_LIBRARIES( exiv2lib ${ICONV_LIBRARIES} )
ENDIF( ICONV_FOUND ) ENDIF( ICONV_FOUND )
IF (MSVC ) IF (MSVC )
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(
TARGET exiv2 TARGET exiv2lib
PRE_BUILD PRE_BUILD
COMMAND if NOT exist ..\\include mkdir ..\\include\r\nif NOT exist ..\\include\\exiv2 (\r\nmkdir ..\\include\\exiv2\r\ncopy /y ..\\src\\*.h ..\\include\\exiv2\r\ncopy /y ..\\src\\*.hpp ..\\include\\exiv2\r\n) COMMAND if NOT exist ..\\include mkdir ..\\include\r\nif NOT exist ..\\include\\exiv2 (\r\nmkdir ..\\include\\exiv2\r\ncopy /y ..\\src\\*.h ..\\include\\exiv2\r\ncopy /y ..\\src\\*.hpp ..\\include\\exiv2\r\n)
) )
@ -231,42 +236,41 @@ ENDIF()
# copy zlib and expat dlls to output directory if necessary # copy zlib and expat dlls to output directory if necessary
IF ( MSVC AND EXIV2_ENABLE_SHARED ) IF ( MSVC AND EXIV2_ENABLE_SHARED )
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(
TARGET exiv2 TARGET exiv2lib
POST_BUILD POST_BUILD
COMMAND copy /y $(SolutionDir)\\..\\expat-2.1.0\\$(ConfigurationName)\\*.dll $(SolutionDir)\\bin\\${P_DIR}\\${T_DIR}\\$(ConfigurationName) COMMAND copy /y $(SolutionDir)\\..\\expat-2.1.0\\$(ConfigurationName)\\*.dll $(SolutionDir)\\bin\\${P_DIR}\\${T_DIR}\\$(ConfigurationName)
) )
ADD_CUSTOM_COMMAND( ADD_CUSTOM_COMMAND(
TARGET exiv2 TARGET exiv2lib
POST_BUILD POST_BUILD
COMMAND copy /y $(SolutionDir)\\..\\zlib-1.2.7\\$(ConfigurationName)\\*.dll $(SolutionDir)\\bin\\${P_DIR}\\${T_DIR}\\$(ConfigurationName) COMMAND copy /y $(SolutionDir)\\..\\zlib-1.2.7\\$(ConfigurationName)\\*.dll $(SolutionDir)\\bin\\${P_DIR}\\${T_DIR}\\$(ConfigurationName)
) )
ENDIF() ENDIF()
INSTALL( TARGETS exiv2 ${INSTALL_TARGET_STANDARD_ARGS} ) INSTALL( TARGETS exiv2lib ${INSTALL_TARGET_STANDARD_ARGS} )
# ****************************************************************************** # ******************************************************************************
# exiv2 application # exiv2 application
ADD_EXECUTABLE( exiv2bin ${EXIV2_SRC} ) ADD_EXECUTABLE( exiv2 ${EXIV2_SRC} )
SET_TARGET_PROPERTIES( exiv2bin PROPERTIES OUTPUT_NAME exiv2 ) TARGET_LINK_LIBRARIES( exiv2 exiv2lib )
TARGET_LINK_LIBRARIES( exiv2bin exiv2 ) INSTALL( TARGETS exiv2 ${INSTALL_TARGET_STANDARD_ARGS} )
INSTALL( TARGETS exiv2bin ${INSTALL_TARGET_STANDARD_ARGS} )
# ****************************************************************************** # ******************************************************************************
# metacopy sample application # metacopy sample application
ADD_EXECUTABLE( metacopy ${MC_SRC} ) ADD_EXECUTABLE( metacopy ${MC_SRC} )
TARGET_LINK_LIBRARIES( metacopy exiv2 ) TARGET_LINK_LIBRARIES( metacopy exiv2lib )
INSTALL( TARGETS metacopy ${INSTALL_TARGET_STANDARD_ARGS} ) INSTALL( TARGETS metacopy ${INSTALL_TARGET_STANDARD_ARGS} )
# ****************************************************************************** # ******************************************************************************
# taglist sample application # taglist sample application
ADD_EXECUTABLE( taglist ${TAGLIST_SRC} ) ADD_EXECUTABLE( taglist ${TAGLIST_SRC} )
TARGET_LINK_LIBRARIES( taglist exiv2 ) TARGET_LINK_LIBRARIES( taglist exiv2lib )
INSTALL( TARGETS taglist ${INSTALL_TARGET_STANDARD_ARGS} ) INSTALL( TARGETS taglist ${INSTALL_TARGET_STANDARD_ARGS} )
# ****************************************************************************** # ******************************************************************************
# path-test sample application # path-test sample application
ADD_EXECUTABLE( pathtest ${PATHTEST_SRC} ) ADD_EXECUTABLE( pathtest ${PATHTEST_SRC} )
SET_TARGET_PROPERTIES( pathtest PROPERTIES OUTPUT_NAME path-test ) SET_TARGET_PROPERTIES( pathtest PROPERTIES OUTPUT_NAME path-test )
TARGET_LINK_LIBRARIES( pathtest exiv2 ) TARGET_LINK_LIBRARIES( pathtest exiv2lib )
INSTALL( TARGETS pathtest ${INSTALL_TARGET_STANDARD_ARGS} ) INSTALL( TARGETS pathtest ${INSTALL_TARGET_STANDARD_ARGS} )
# ****************************************************************************** # ******************************************************************************

Loading…
Cancel
Save