see TODO-CMAKE for details. work in progress update

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

@ -50,7 +50,7 @@ if( MSVC )
msvc_runtime_configure(${EXIV2_ENABLE_SHARED})
msvc_runtime_report()
##
if ( NOT EXPAT_LIBRARY )
# link dependant libraries
# apologies for the duplication of information
# I've been unable to simply this using the 'set' command
@ -59,6 +59,7 @@ if( MSVC )
include_directories( ../zlib-1.2.7 ../expat-2.1.0/lib)
set(EXPAT_INCLUDE_DIR ../expat-2.1.0/lib )
set(ZLIB_INCLUDE_DIR ../zlib-1.2.7 )
endif()
if ( EXIV2_ENABLE_SHARED )
add_library(expat-2.1.0 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 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.
CMake generates MSVC .sln and .vcproj files for your target environment.
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
2) 32bit or 64 bit builds
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.
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
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"
--- 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)
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
cmake CMakeLists.txt -G "Visual Studio 9 2008 Win64"
@ -186,6 +190,15 @@ Building with cmake involves 3 steps (build zlib/expat, build exiv2, test):
exiv2\bin\{ x64 | Win32 }\{ Dynamic|Static }\{Config}\exiv2.exe etc....
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
-------------------------------------
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.
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)
==============================================================

@ -1,18 +1,22 @@
My current list
Current Status
ToDo: * 2005/32/debug won't run. "SideBySide" error (manifest trouble)
* I'm not searching correctly for expat, zlib and iconv
ToDo: * Support for out of source builds
* Test Cygwin, MinGW, Xcode, NMake and more versions of MSVC
* Test Out of source builds
* Add the header files to the MSVC UI
* Revisit searching for zlib, expat and iconv
* 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
* Updated documentation (README-CMAKE)
Robin Mills
robin@clanmills.com
2012-06-03
2012-06-05
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 )
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()
@ -43,7 +43,7 @@ FOREACH(entry ${SAMPLES})
STRING( REPLACE ".cpp" "" target ${entry})
ADD_EXECUTABLE( ${target} ${target}.cpp )
ADD_TEST( ${target}_test ${target} )
TARGET_LINK_LIBRARIES( ${target} exiv2 )
TARGET_LINK_LIBRARIES( ${target} exiv2lib )
ENDFOREACH(entry ${SAMPLES})
# That's all Folks!

@ -181,47 +181,52 @@ include(../CMake_msvc.txt)
msvc_runtime_configure(${EXIV2_ENABLE_SHARED})
# ******************************************************************************
# exiv2 library
ADD_LIBRARY( exiv2 ${STATIC_FLAG} ${LIBEXIV2_SRC} )
SET_TARGET_PROPERTIES( exiv2 PROPERTIES
# exiv2lib library
ADD_LIBRARY( exiv2lib ${STATIC_FLAG} ${LIBEXIV2_SRC} ${LIBEXIV2_HDR} )
SET_TARGET_PROPERTIES( exiv2lib PROPERTIES
VERSION ${GENERIC_LIB_VERSION}
SOVERSION ${GENERIC_LIB_SOVERSION}
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 )
ADD_DEPENDENCIES( exiv2 xmp )
ADD_DEPENDENCIES( exiv2lib xmp )
LINK_DIRECTORIES(${LIBRARY_OUTPUT_PATH}/$(ConfigurationName))
TARGET_LINK_LIBRARIES( exiv2 xmp )
TARGET_LINK_LIBRARIES( exiv2lib xmp )
ENDIF()
IF( EXIV2_ENABLE_PNG )
IF( ZLIB_FOUND )
IF( MSVC )
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()
link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../zlib-1.2.7/$(ConfigurationName))
TARGET_LINK_LIBRARIES( exiv2 optimized zlibstatic.lib debug zlibstaticd.lib )
# link_directories(${CMAKE_CURRENT_SOURCE_DIR}/../../zlib-1.2.7/$(ConfigurationName))
TARGET_LINK_LIBRARIES( exiv2lib optimized zlibstatic.lib debug zlibstaticd.lib )
endif()
ELSE()
TARGET_LINK_LIBRARIES( exiv2 ${ZLIB_LIBRARIES} )
TARGET_LINK_LIBRARIES( exiv2lib ${ZLIB_LIBRARIES} )
ENDIF()
ENDIF()
ENDIF()
IF( EXIV2_ENABLE_NLS )
TARGET_LINK_LIBRARIES( exiv2 ${LIBINTL_LIBRARIES} )
TARGET_LINK_LIBRARIES( exiv2lib ${LIBINTL_LIBRARIES} )
ENDIF( EXIV2_ENABLE_NLS )
IF( ICONV_FOUND )
TARGET_LINK_LIBRARIES( exiv2 ${ICONV_LIBRARIES} )
TARGET_LINK_LIBRARIES( exiv2lib ${ICONV_LIBRARIES} )
ENDIF( ICONV_FOUND )
IF (MSVC )
ADD_CUSTOM_COMMAND(
TARGET exiv2
TARGET exiv2lib
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)
)
@ -231,42 +236,41 @@ ENDIF()
# copy zlib and expat dlls to output directory if necessary
IF ( MSVC AND EXIV2_ENABLE_SHARED )
ADD_CUSTOM_COMMAND(
TARGET exiv2
TARGET exiv2lib
POST_BUILD
COMMAND copy /y $(SolutionDir)\\..\\expat-2.1.0\\$(ConfigurationName)\\*.dll $(SolutionDir)\\bin\\${P_DIR}\\${T_DIR}\\$(ConfigurationName)
)
ADD_CUSTOM_COMMAND(
TARGET exiv2
TARGET exiv2lib
POST_BUILD
COMMAND copy /y $(SolutionDir)\\..\\zlib-1.2.7\\$(ConfigurationName)\\*.dll $(SolutionDir)\\bin\\${P_DIR}\\${T_DIR}\\$(ConfigurationName)
)
ENDIF()
INSTALL( TARGETS exiv2 ${INSTALL_TARGET_STANDARD_ARGS} )
INSTALL( TARGETS exiv2lib ${INSTALL_TARGET_STANDARD_ARGS} )
# ******************************************************************************
# exiv2 application
ADD_EXECUTABLE( exiv2bin ${EXIV2_SRC} )
SET_TARGET_PROPERTIES( exiv2bin PROPERTIES OUTPUT_NAME exiv2 )
TARGET_LINK_LIBRARIES( exiv2bin exiv2 )
INSTALL( TARGETS exiv2bin ${INSTALL_TARGET_STANDARD_ARGS} )
ADD_EXECUTABLE( exiv2 ${EXIV2_SRC} )
TARGET_LINK_LIBRARIES( exiv2 exiv2lib )
INSTALL( TARGETS exiv2 ${INSTALL_TARGET_STANDARD_ARGS} )
# ******************************************************************************
# metacopy sample application
ADD_EXECUTABLE( metacopy ${MC_SRC} )
TARGET_LINK_LIBRARIES( metacopy exiv2 )
TARGET_LINK_LIBRARIES( metacopy exiv2lib )
INSTALL( TARGETS metacopy ${INSTALL_TARGET_STANDARD_ARGS} )
# ******************************************************************************
# taglist sample application
ADD_EXECUTABLE( taglist ${TAGLIST_SRC} )
TARGET_LINK_LIBRARIES( taglist exiv2 )
TARGET_LINK_LIBRARIES( taglist exiv2lib )
INSTALL( TARGETS taglist ${INSTALL_TARGET_STANDARD_ARGS} )
# ******************************************************************************
# path-test sample application
ADD_EXECUTABLE( pathtest ${PATHTEST_SRC} )
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} )
# ******************************************************************************

Loading…
Cancel
Save