Bug#590180: Patches for Flightcrew to use system libs when available
Hi John,
As promised in my previous mail, here is a set of patch to
make flightcrew use system libs and to allow installing
flightcrew and XercesExtensions as a shared library.
Note that the 11th patch also allows building zipios as
a shared lib. I'm not using this atm since zipios is only
used by FlightCrew itself and not by Sigil.
Thanks & Regards,
Hans
From 3b3d9e316248662f7ba27359149a34adab8e16ef Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan[at]danny.cz>
Date: Wed, 18 Jan 2012 20:38:14 +0100
Subject: [PATCH 01/11] add versioning information to the shared library
---
CMakeLists.txt | 2 ++
src/FlightCrew/CMakeLists.txt | 5 +++++
2 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 30a6a76..397f138 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -20,6 +20,8 @@ set( FLIGHTCREW_MAJOR_VERSION 0 )
set( FLIGHTCREW_MINOR_VERSION 7 )
set( FLIGHTCREW_REVISION_VERSION 2 )
set( FLIGHTCREW_FULL_VERSION ${FLIGHTCREW_MAJOR_VERSION}.${FLIGHTCREW_MINOR_VERSION}.${FLIGHTCREW_REVISION_VERSION} )
+set( FLIGHTCREW_SOVERSION ${FLIGHTCREW_FULL_VERSION} )
+set( FLIGHTCREW_LIBVERSION ${FLIGHTCREW_SOVERSION} )
# Check if platform is 64 bit
if( NOT APPLE )
diff --git a/src/FlightCrew/CMakeLists.txt b/src/FlightCrew/CMakeLists.txt
index 77538e7..5a5c62b 100644
--- a/src/FlightCrew/CMakeLists.txt
+++ b/src/FlightCrew/CMakeLists.txt
@@ -78,6 +78,11 @@ if( BUILD_SHARED_FC )
# when they want a dll, but NOT FC_DLL_EXPORTING
add_definitions( -DFC_DLL_EXPORTING -DFC_BUILT_AS_DLL )
add_library( ${PROJECT_NAME} SHARED ${SOURCES} )
+ set_target_properties( ${PROJECT_NAME} PROPERTIES
+ VERSION "${FLIGHTCREW_LIBVERSION}"
+ SOVERSION "${FLIGHTCREW_SOVERSION}"
+ OUTPUT_NAME "${PROJECT_NAME}"
+ )
else()
add_library( ${PROJECT_NAME} ${SOURCES} )
endif()
--
1.7.7.4
From d6742d2745f96058caab9d60d836714ac9a0d02c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan[at]danny.cz>
Date: Wed, 18 Jan 2012 20:38:46 +0100
Subject: [PATCH 02/11] fix building as a shared library on Unix
---
src/BoostParts/CMakeLists.txt | 4 ++++
src/Xerces/CMakeLists.txt | 3 +++
src/XercesExtensions/CMakeLists.txt | 4 ++++
src/zipios/CMakeLists.txt | 3 +++
src/zlib/CMakeLists.txt | 3 +++
5 files changed, 17 insertions(+), 0 deletions(-)
diff --git a/src/BoostParts/CMakeLists.txt b/src/BoostParts/CMakeLists.txt
index f22410a..4f50444 100644
--- a/src/BoostParts/CMakeLists.txt
+++ b/src/BoostParts/CMakeLists.txt
@@ -105,3 +105,7 @@ if( MSVC )
set( CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} /Oi /GL" )
set_target_properties( ${PROJECT_NAME} PROPERTIES STATIC_LIBRARY_FLAGS "/LTCG" )
endif()
+
+if( UNIX AND BUILD_SHARED_FC )
+ add_definitions(-fPIC)
+endif()
diff --git a/src/Xerces/CMakeLists.txt b/src/Xerces/CMakeLists.txt
index 33ea5c3..f9e2cad 100644
--- a/src/Xerces/CMakeLists.txt
+++ b/src/Xerces/CMakeLists.txt
@@ -174,4 +174,7 @@ else()
# We need to link to pthreads on unix
target_link_libraries( ${PROJECT_NAME} pthread )
+ if( BUILD_SHARED_FC )
+ add_definitions(-fPIC)
+ endif()
endif()
diff --git a/src/XercesExtensions/CMakeLists.txt b/src/XercesExtensions/CMakeLists.txt
index 08196e0..5a304a7 100644
--- a/src/XercesExtensions/CMakeLists.txt
+++ b/src/XercesExtensions/CMakeLists.txt
@@ -48,6 +48,10 @@ elseif( CMAKE_COMPILER_IS_GNUCXX )
add_definitions( -Wall )
endif()
+if( UNIX AND BUILD_SHARED_FC )
+ add_definitions(-fPIC)
+endif()
+
# needed for correct Xerces header inclusion
add_definitions( -DXERCES_STATIC_LIBRARY )
diff --git a/src/zipios/CMakeLists.txt b/src/zipios/CMakeLists.txt
index 88fdb7d..1c135c1 100644
--- a/src/zipios/CMakeLists.txt
+++ b/src/zipios/CMakeLists.txt
@@ -47,3 +47,6 @@ elseif( CMAKE_COMPILER_IS_GNUCXX )
add_definitions( -Wall )
endif()
+if( UNIX AND BUILD_SHARED_FC )
+ add_definitions(-fPIC)
+endif()
diff --git a/src/zlib/CMakeLists.txt b/src/zlib/CMakeLists.txt
index e59f844..fb2638b 100644
--- a/src/zlib/CMakeLists.txt
+++ b/src/zlib/CMakeLists.txt
@@ -133,5 +133,8 @@ if( MSVC )
set_target_properties( ${PROJECT_NAME} PROPERTIES STATIC_LIBRARY_FLAGS "/LTCG" )
endif()
+if( UNIX AND BUILD_SHARED_FC )
+ add_definitions(-fPIC)
+endif()
--
1.7.7.4
From d369d18ac9e8f249a6bfc4ed70cdeaf6a861e931 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan[at]danny.cz>
Date: Wed, 18 Jan 2012 20:39:05 +0100
Subject: [PATCH 03/11] use system zlib if available
---
CMakeLists.txt | 6 +++++-
src/zipios/CMakeLists.txt | 16 +++++++++++++---
2 files changed, 18 insertions(+), 4 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 397f138..b627129 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,11 +42,15 @@ set( CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk" )
# Universal builds for mac
set( CMAKE_OSX_ARCHITECTURES "i386;x86_64" )
+find_package( ZLIB )
+
# The parsing order is significant!
add_subdirectory( src/BoostParts )
add_subdirectory( src/Xerces )
add_subdirectory( src/XercesExtensions )
-add_subdirectory( src/zlib )
+if( NOT ZLIB_FOUND )
+ add_subdirectory( src/zlib )
+endif()
add_subdirectory( src/zipios )
add_subdirectory( src/googlemock )
add_subdirectory( src/FlightCrew )
diff --git a/src/zipios/CMakeLists.txt b/src/zipios/CMakeLists.txt
index 1c135c1..9b4d039 100644
--- a/src/zipios/CMakeLists.txt
+++ b/src/zipios/CMakeLists.txt
@@ -17,15 +17,25 @@ file( GLOB_RECURSE SOURCES *.cpp *.h )
# and the headers for the linked-to libraries
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
${BoostParts_SOURCE_DIR}
- ${zlib_SOURCE_DIR}
- ${zlib_BINARY_DIR}
)
+if( ZLIB_FOUND )
+ include_directories( ${ZLIB_INCLUDE_DIRS} )
+else()
+ include_directories( ${zlib_SOURCE_DIR} ${zlib_BINARY_DIR} )
+endif()
+
link_directories ( ${PROJECT_BINARY_DIR}/lib )
add_library( ${PROJECT_NAME} ${SOURCES} )
-target_link_libraries( ${PROJECT_NAME} zlib BoostParts )
+target_link_libraries( ${PROJECT_NAME} BoostParts )
+if( ZLIB_FOUND )
+ target_link_libraries( ${PROJECT_NAME} ${ZLIB_LIBRARIES} )
+else()
+ target_link_libraries( ${PROJECT_NAME} zlib )
+endif()
+
#############################################################################
--
1.7.7.4
From 011cb3b15ecc12b18197410975beaf6764942260 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan[at]danny.cz>
Date: Wed, 18 Jan 2012 20:40:05 +0100
Subject: [PATCH 04/11] use system boost libraries if available
---
CMakeLists.txt | 10 +++++++++-
src/FlightCrew-cli/CMakeLists.txt | 2 +-
src/FlightCrew-gui/CMakeLists.txt | 2 +-
src/FlightCrew/CMakeLists.txt | 6 +++---
src/XercesExtensions/CMakeLists.txt | 2 +-
src/utf8-cpp/utf8/core.h | 2 +-
src/zipios/CMakeLists.txt | 4 ++--
7 files changed, 18 insertions(+), 10 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b627129..21f5cc7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,10 +42,18 @@ set( CMAKE_OSX_SYSROOT "/Developer/SDKs/MacOSX10.6.sdk" )
# Universal builds for mac
set( CMAKE_OSX_ARCHITECTURES "i386;x86_64" )
+find_package( Boost COMPONENTS date_time filesystem program_options regex system thread )
find_package( ZLIB )
# The parsing order is significant!
-add_subdirectory( src/BoostParts )
+if( Boost_FOUND )
+ set( BOOST_LIBS ${Boost_DATE_TIME_LIBRARY} ${Boost_FILESYSTEM_LIBRARY} ${Boost_PROGRAM_OPTIONS_LIBRARY} ${Boost_REGEX_LIBRARY} ${Boost_SYSTEM_LIBRARY} ${Boost_THREAD_LIBRARY} )
+ set( BOOST_INCLUDE_DIRS ${Boost_INCLUDE_DIRS} )
+else()
+ add_subdirectory( src/BoostParts )
+ set( BOOST_LIBS BoostParts )
+ set( BOOST_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/BoostParts )
+endif()
add_subdirectory( src/Xerces )
add_subdirectory( src/XercesExtensions )
if( NOT ZLIB_FOUND )
diff --git a/src/FlightCrew-cli/CMakeLists.txt b/src/FlightCrew-cli/CMakeLists.txt
index 6b134e0..cb9292a 100644
--- a/src/FlightCrew-cli/CMakeLists.txt
+++ b/src/FlightCrew-cli/CMakeLists.txt
@@ -30,7 +30,7 @@ create_source_groups( SOURCES )
# We need to pick up the stdafx.h file
# and the headers for the linked-to libraries
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
- ${BoostParts_SOURCE_DIR}
+ ${BOOST_INCLUDE_DIRS}
${FlightCrew_SOURCE_DIR}
${XercesExtensions_SOURCE_DIR}
)
diff --git a/src/FlightCrew-gui/CMakeLists.txt b/src/FlightCrew-gui/CMakeLists.txt
index 8d6afaf..2efed3b 100644
--- a/src/FlightCrew-gui/CMakeLists.txt
+++ b/src/FlightCrew-gui/CMakeLists.txt
@@ -67,7 +67,7 @@ create_source_groups( RAW_SOURCES )
# and the headers for the linked-to libraries
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
- ${BoostParts_SOURCE_DIR}
+ ${BOOST_INCLUDE_DIRS}
${FlightCrew_SOURCE_DIR}
${XercesExtensions_SOURCE_DIR}
)
diff --git a/src/FlightCrew/CMakeLists.txt b/src/FlightCrew/CMakeLists.txt
index 5a5c62b..72c7a0b 100644
--- a/src/FlightCrew/CMakeLists.txt
+++ b/src/FlightCrew/CMakeLists.txt
@@ -50,7 +50,7 @@ list( REMOVE_ITEM SOURCES ${to_remove} )
# creating PCH's for MSVC and GCC on Linux
include( ${CMAKE_SOURCE_DIR}/cmake_extras/CustomPCH.cmake )
-set( ALL_INCLUDES ${BoostParts_SOURCE_DIR}
+set( ALL_INCLUDES ${BOOST_INCLUDE_DIRS}
${Xerces_SOURCE_DIR}
${zipios_SOURCE_DIR} )
set( GCC_PCH_TARGET gccPCH_fc )
@@ -65,7 +65,7 @@ precompiled_header( SOURCES ALL_INCLUDES ${GCC_PCH_TARGET} ${PCH_NAME} )
include_directories( ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
../zipios
- ../BoostParts
+ ${BOOST_INCLUDE_DIRS}
../Xerces
../XercesExtensions
../utf8-cpp
@@ -87,7 +87,7 @@ else()
add_library( ${PROJECT_NAME} ${SOURCES} )
endif()
-target_link_libraries( ${PROJECT_NAME} zipios BoostParts XercesExtensions )
+target_link_libraries( ${PROJECT_NAME} zipios ${BOOST_LIBS} XercesExtensions )
#############################################################################
diff --git a/src/XercesExtensions/CMakeLists.txt b/src/XercesExtensions/CMakeLists.txt
index 5a304a7..d7ac6a8 100644
--- a/src/XercesExtensions/CMakeLists.txt
+++ b/src/XercesExtensions/CMakeLists.txt
@@ -17,7 +17,7 @@ file( GLOB SOURCES *.cpp *.h )
# and the headers for the linked-to libraries
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
../Xerces
- ../BoostParts )
+ ${BOOST_INCLUDE_DIRS} )
link_directories ( ${PROJECT_BINARY_DIR}/lib )
diff --git a/src/utf8-cpp/utf8/core.h b/src/utf8-cpp/utf8/core.h
index 294aad0..1fe84cd 100755
--- a/src/utf8-cpp/utf8/core.h
+++ b/src/utf8-cpp/utf8/core.h
@@ -29,7 +29,7 @@ DEALINGS IN THE SOFTWARE.
#define UTF8_FOR_CPP_CORE_H_2675DCD0_9480_4c0c_B92A_CC14C027B731
#include <iterator>
-#include "../../BoostParts/boost/cstdint.hpp"
+#include <boost/cstdint.hpp>
namespace utf8
{
diff --git a/src/zipios/CMakeLists.txt b/src/zipios/CMakeLists.txt
index 9b4d039..3ab775c 100644
--- a/src/zipios/CMakeLists.txt
+++ b/src/zipios/CMakeLists.txt
@@ -16,7 +16,7 @@ file( GLOB_RECURSE SOURCES *.cpp *.h )
# We need to pick up the stdafx.h file
# and the headers for the linked-to libraries
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
- ${BoostParts_SOURCE_DIR}
+ ${BOOST_INCLUDE_DIRS}
)
if( ZLIB_FOUND )
@@ -29,7 +29,7 @@ link_directories ( ${PROJECT_BINARY_DIR}/lib )
add_library( ${PROJECT_NAME} ${SOURCES} )
-target_link_libraries( ${PROJECT_NAME} BoostParts )
+target_link_libraries( ${PROJECT_NAME} ${BOOST_LIBS} )
if( ZLIB_FOUND )
target_link_libraries( ${PROJECT_NAME} ${ZLIB_LIBRARIES} )
else()
--
1.7.7.4
From b67de26d18ccb37b663eaacb8c2cfbbae54c7987 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan[at]danny.cz>
Date: Wed, 18 Jan 2012 20:40:27 +0100
Subject: [PATCH 05/11] fix build with boost >= 1.48
---
.../Validators/Opf/ReachabilityAnalysis.cpp | 3 +++
1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/src/FlightCrew/Validators/Opf/ReachabilityAnalysis.cpp b/src/FlightCrew/Validators/Opf/ReachabilityAnalysis.cpp
index 24c0f28..4a83fc0 100644
--- a/src/FlightCrew/Validators/Opf/ReachabilityAnalysis.cpp
+++ b/src/FlightCrew/Validators/Opf/ReachabilityAnalysis.cpp
@@ -26,7 +26,9 @@
#include <XmlUtils.h>
#include "Misc/DetermineMimetype.h"
#include "Misc/Utilities.h"
+#include <boost/version.hpp>
+#if BOOST_VERSION < 104800
namespace boost
{
@@ -48,6 +50,7 @@ namespace filesystem3
} // namespace filesystem3
} // namespace boost
+#endif
namespace FlightCrew
--
1.7.7.4
From cc366be2341b14a23321d93e50ccedd9a5a49282 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan[at]danny.cz>
Date: Wed, 18 Jan 2012 20:41:05 +0100
Subject: [PATCH 06/11] use system xerces-c if available
---
CMakeLists.txt | 8 +++++++-
src/FlightCrew/CMakeLists.txt | 8 +++++---
src/XercesExtensions/CMakeLists.txt | 8 +++++---
3 files changed, 17 insertions(+), 7 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 21f5cc7..335f004 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -44,6 +44,8 @@ set( CMAKE_OSX_ARCHITECTURES "i386;x86_64" )
find_package( Boost COMPONENTS date_time filesystem program_options regex system thread )
find_package( ZLIB )
+find_package( PkgConfig )
+pkg_check_modules( XERCES xerces-c>=3.1 )
# The parsing order is significant!
if( Boost_FOUND )
@@ -54,7 +56,11 @@ else()
set( BOOST_LIBS BoostParts )
set( BOOST_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/BoostParts )
endif()
-add_subdirectory( src/Xerces )
+if( NOT XERCES_FOUND )
+ add_subdirectory( src/Xerces )
+ set( XERCES_LIBRARIES Xerces )
+ set( XERCES_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR}/src/Xerces )
+endif()
add_subdirectory( src/XercesExtensions )
if( NOT ZLIB_FOUND )
add_subdirectory( src/zlib )
diff --git a/src/FlightCrew/CMakeLists.txt b/src/FlightCrew/CMakeLists.txt
index 72c7a0b..e86fc19 100644
--- a/src/FlightCrew/CMakeLists.txt
+++ b/src/FlightCrew/CMakeLists.txt
@@ -51,7 +51,7 @@ list( REMOVE_ITEM SOURCES ${to_remove} )
# creating PCH's for MSVC and GCC on Linux
include( ${CMAKE_SOURCE_DIR}/cmake_extras/CustomPCH.cmake )
set( ALL_INCLUDES ${BOOST_INCLUDE_DIRS}
- ${Xerces_SOURCE_DIR}
+ ${XERCES_INCLUDE_DIRS}
${zipios_SOURCE_DIR} )
set( GCC_PCH_TARGET gccPCH_fc )
@@ -66,7 +66,7 @@ include_directories( ${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
../zipios
${BOOST_INCLUDE_DIRS}
- ../Xerces
+ ${XERCES_INCLUDE_DIRS}
../XercesExtensions
../utf8-cpp
)
@@ -121,7 +121,9 @@ elseif( CMAKE_COMPILER_IS_GNUCXX )
endif()
# needed for correct Xerces header inclusion
-add_definitions( -DXERCES_STATIC_LIBRARY )
+if( NOT XERCES_FOUND )
+ add_definitions( -DXERCES_STATIC_LIBRARY )
+endif()
#############################################################################
diff --git a/src/XercesExtensions/CMakeLists.txt b/src/XercesExtensions/CMakeLists.txt
index d7ac6a8..98de34b 100644
--- a/src/XercesExtensions/CMakeLists.txt
+++ b/src/XercesExtensions/CMakeLists.txt
@@ -16,14 +16,14 @@ file( GLOB SOURCES *.cpp *.h )
# We need to pick up the stdafx.h file
# and the headers for the linked-to libraries
include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
- ../Xerces
+ ${XERCES_INCLUDE_DIRS}
${BOOST_INCLUDE_DIRS} )
link_directories ( ${PROJECT_BINARY_DIR}/lib )
add_library( ${PROJECT_NAME} ${SOURCES} )
-target_link_libraries( ${PROJECT_NAME} Xerces )
+target_link_libraries( ${PROJECT_NAME} ${XERCES_LIBRARIES} )
#############################################################################
@@ -53,5 +53,7 @@ if( UNIX AND BUILD_SHARED_FC )
endif()
# needed for correct Xerces header inclusion
-add_definitions( -DXERCES_STATIC_LIBRARY )
+if( NOT XERCES_FOUND )
+ add_definitions( -DXERCES_STATIC_LIBRARY )
+endif()
--
1.7.7.4
From 2df0d625ba8ebb28f5c4702bef096a917830278f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan[at]danny.cz>
Date: Wed, 18 Jan 2012 20:41:42 +0100
Subject: [PATCH 07/11] install FlightCrew library and headers
With minor changes by Hans de Goede:
-Also install the headers under src/FlightCrew/Misc and
src/FlightCrew/Validators
---
src/FlightCrew/CMakeLists.txt | 14 ++++++++++++++
1 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/src/FlightCrew/CMakeLists.txt b/src/FlightCrew/CMakeLists.txt
index e86fc19..9214c85 100644
--- a/src/FlightCrew/CMakeLists.txt
+++ b/src/FlightCrew/CMakeLists.txt
@@ -135,3 +135,17 @@ endif()
if( NOT ( BUILD_SHARED_FC AND MSVC ) AND NOT NO_TEST_EXE )
add_subdirectory( tests )
endif()
+
+if( UNIX AND NOT APPLE )
+ install( TARGETS ${PROJECT_NAME}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
+ )
+ file( GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.h" )
+ install( FILES ${files} DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME} )
+ file( GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/Misc/*.h" )
+ install( FILES ${files} DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}/Misc )
+ file( GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/Validators/*.h" )
+ install( FILES ${files} DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}/Validators )
+ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../XercesExtensions/NodeLocationInfo.h DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME} )
+endif()
--
1.7.7.4
From d2f5f2e8919a09ac9f57d074661ed625a4bebfaa Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Dan=20Hor=C3=A1k?= <dan[at]danny.cz>
Date: Wed, 18 Jan 2012 20:42:27 +0100
Subject: [PATCH 08/11] don't build googlemock when NO_TEST_EXE is specified
---
CMakeLists.txt | 4 +++-
1 files changed, 3 insertions(+), 1 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 335f004..d8edc19 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -66,7 +66,9 @@ if( NOT ZLIB_FOUND )
add_subdirectory( src/zlib )
endif()
add_subdirectory( src/zipios )
-add_subdirectory( src/googlemock )
+if( NOT NO_TEST_EXE )
+ add_subdirectory( src/googlemock )
+endif()
add_subdirectory( src/FlightCrew )
add_subdirectory( src/FlightCrew-cli )
--
1.7.7.4
From 3ddd72318be7119768b9b471c283aedd7d616048 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 18 Jan 2012 20:43:39 +0100
Subject: [PATCH 09/11] Add a FindFlightCrew.cmake cmake module
---
src/FlightCrew/CMakeLists.txt | 1 +
src/FlightCrew/FindFlightCrew.cmake | 49 +++++++++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 0 deletions(-)
create mode 100644 src/FlightCrew/FindFlightCrew.cmake
diff --git a/src/FlightCrew/CMakeLists.txt b/src/FlightCrew/CMakeLists.txt
index 9214c85..a294b7f 100644
--- a/src/FlightCrew/CMakeLists.txt
+++ b/src/FlightCrew/CMakeLists.txt
@@ -148,4 +148,5 @@ if( UNIX AND NOT APPLE )
file( GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/Validators/*.h" )
install( FILES ${files} DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}/Validators )
install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/../XercesExtensions/NodeLocationInfo.h DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME} )
+ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/FindFlightCrew.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/cmake/${PROJECT_NAME} )
endif()
diff --git a/src/FlightCrew/FindFlightCrew.cmake b/src/FlightCrew/FindFlightCrew.cmake
new file mode 100644
index 0000000..d0f5102
--- /dev/null
+++ b/src/FlightCrew/FindFlightCrew.cmake
@@ -0,0 +1,49 @@
+# Try to find the FlightCrew lib
+# Once done this will define:
+#
+# FLIGHTCREW_FOUND - system has FlightCrew
+# FLIGHTCREW_INCLUDE_DIRS - the FlightCrew include directory
+# FLIGHTCREW_LIBRARIES - The libraries needed to use FlightCrew
+#
+# Copyright (c) 2011, Dan Horák <dan[at]danny.cz>
+# Copyright (c) 2012, Hans de Goede <hdegoede@redhat.com>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+if (FLIGHTCREW_INCLUDE_DIRS)
+ # Already in cache, be silent
+ set(FLIGHTCREW_FIND_QUIETLY TRUE)
+endif (FLIGHTCREW_INCLUDE_DIRS)
+
+#FIND_PATH(FLIGHTCREW_INCLUDE_DIRS flightcrew.h)
+
+if( NOT FLIGHTCREW_INCLUDE_DIRS )
+ find_path(FLIGHTCREW_INCLUDE_DIRS flightcrew.h PATH_SUFFIXES FlightCrew)
+ #now flightcrew.h was inside a FlightCrew subdirectory so we need to
+ #add that to the include dir
+ set(FLIGHTCREW_INCLUDE_DIRS ${FLIGHTCREW_INCLUDE_DIRS}/FlightCrew CACHE PATH "FlightCrew include directory")
+endif( NOT FLIGHTCREW_INCLUDE_DIRS )
+
+
+FIND_LIBRARY(FLIGHTCREW_LIBRARIES NAMES FlightCrew)
+
+if (FLIGHTCREW_INCLUDE_DIRS AND FLIGHTCREW_LIBRARIES)
+ set(FLIGHTCREW_FOUND TRUE)
+endif (FLIGHTCREW_INCLUDE_DIRS AND FLIGHTCREW_LIBRARIES)
+
+
+if (FLIGHTCREW_FOUND)
+ if (NOT FLIGHTCREW_FIND_QUIETLY)
+ message(STATUS "Found FlightCrew: ${FLIGHTCREW_LIBRARIES}")
+ endif (NOT FLIGHTCREW_FIND_QUIETLY)
+else (FLIGHTCREW_FOUND)
+ if (FLIGHTCREW_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find FlightCrew")
+ else (FLIGHTCREW_FIND_REQUIRED)
+ message(STATUS "Could NOT find FlightCrew")
+ endif (FLIGHTCREW_FIND_REQUIRED)
+endif (FLIGHTCREW_FOUND)
+
+MARK_AS_ADVANCED(FLIGHTCREW_INCLUDE_DIRS FLIGHTCREW_LIBRARIES)
--
1.7.7.4
From 77bb2faf427049a5edda9060d17ab3517f736fdd Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 18 Jan 2012 20:44:30 +0100
Subject: [PATCH 10/11] allow building XercesExtensions as a shared lib
---
src/XercesExtensions/CMakeLists.txt | 27 ++++++++++--
src/XercesExtensions/FindXercesExtensions.cmake | 49 +++++++++++++++++++++++
2 files changed, 71 insertions(+), 5 deletions(-)
create mode 100644 src/XercesExtensions/FindXercesExtensions.cmake
diff --git a/src/XercesExtensions/CMakeLists.txt b/src/XercesExtensions/CMakeLists.txt
index 98de34b..ab5fadf 100644
--- a/src/XercesExtensions/CMakeLists.txt
+++ b/src/XercesExtensions/CMakeLists.txt
@@ -21,7 +21,19 @@ include_directories( ${CMAKE_CURRENT_SOURCE_DIR}
link_directories ( ${PROJECT_BINARY_DIR}/lib )
-add_library( ${PROJECT_NAME} ${SOURCES} )
+if( BUILD_SHARED_XE )
+ add_library( ${PROJECT_NAME} SHARED ${SOURCES} )
+ set_target_properties( ${PROJECT_NAME} PROPERTIES
+ VERSION "${FLIGHTCREW_LIBVERSION}"
+ SOVERSION "${FLIGHTCREW_SOVERSION}"
+ OUTPUT_NAME "${PROJECT_NAME}"
+ )
+else()
+ add_library( ${PROJECT_NAME} ${SOURCES} )
+ if( UNIX AND BUILD_SHARED_FC )
+ add_definitions(-fPIC)
+ endif()
+endif()
target_link_libraries( ${PROJECT_NAME} ${XERCES_LIBRARIES} )
@@ -48,12 +60,17 @@ elseif( CMAKE_COMPILER_IS_GNUCXX )
add_definitions( -Wall )
endif()
-if( UNIX AND BUILD_SHARED_FC )
- add_definitions(-fPIC)
-endif()
-
# needed for correct Xerces header inclusion
if( NOT XERCES_FOUND )
add_definitions( -DXERCES_STATIC_LIBRARY )
endif()
+if( BUILD_SHARED_XE AND UNIX AND NOT APPLE )
+ install( TARGETS ${PROJECT_NAME}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
+ )
+ file( GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/*.h" )
+ install( FILES ${files} DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME} )
+ install( FILES ${CMAKE_CURRENT_SOURCE_DIR}/FindXercesExtensions.cmake DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}/cmake/${PROJECT_NAME} )
+endif()
diff --git a/src/XercesExtensions/FindXercesExtensions.cmake b/src/XercesExtensions/FindXercesExtensions.cmake
new file mode 100644
index 0000000..4f4f8aa
--- /dev/null
+++ b/src/XercesExtensions/FindXercesExtensions.cmake
@@ -0,0 +1,49 @@
+# Try to find the XercesExtensions lib
+# Once done this will define:
+#
+# XERCESEXTENSIONS_FOUND - system has XercesExtensions
+# XERCESEXTENSIONS_INCLUDE_DIRS - the XercesExtensions include directory
+# XERCESEXTENSIONS_LIBRARIES - The libraries needed to use XercesExtensions
+#
+# Copyright (c) 2011, Dan Horák <dan[at]danny.cz>
+# Copyright (c) 2012, Hans de Goede <hdegoede@redhat.com>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+if (XERCESEXTENSIONS_INCLUDE_DIRS)
+ # Already in cache, be silent
+ set(XERCESEXTENSIONS_FIND_QUIETLY TRUE)
+endif (XERCESEXTENSIONS_INCLUDE_DIRS)
+
+#FIND_PATH(XERCESEXTENSIONS_INCLUDE_DIRS XercesInit.h)
+
+if( NOT XERCESEXTENSIONS_INCLUDE_DIRS )
+ find_path(XERCESEXTENSIONS_INCLUDE_DIRS XercesInit.h PATH_SUFFIXES XercesExtensions)
+ #now XercesInit.h was inside a XercesExtensions subdirectory so we need to
+ #add that to the include dir
+ set(XERCESEXTENSIONS_INCLUDE_DIRS ${XERCESEXTENSIONS_INCLUDE_DIRS}/XercesExtensions CACHE PATH "XercesExtensions include directory")
+endif( NOT XERCESEXTENSIONS_INCLUDE_DIRS )
+
+
+FIND_LIBRARY(XERCESEXTENSIONS_LIBRARIES NAMES XercesExtensions)
+
+if (XERCESEXTENSIONS_INCLUDE_DIRS AND XERCESEXTENSIONS_LIBRARIES)
+ set(XERCESEXTENSIONS_FOUND TRUE)
+endif (XERCESEXTENSIONS_INCLUDE_DIRS AND XERCESEXTENSIONS_LIBRARIES)
+
+
+if (XERCESEXTENSIONS_FOUND)
+ if (NOT XERCESEXTENSIONS_FIND_QUIETLY)
+ message(STATUS "Found XercesExtensions: ${XERCESEXTENSIONS_LIBRARIES}")
+ endif (NOT XERCESEXTENSIONS_FIND_QUIETLY)
+else (XERCESEXTENSIONS_FOUND)
+ if (XERCESEXTENSIONS_FIND_REQUIRED)
+ message(FATAL_ERROR "Could NOT find XercesExtensions")
+ else (XERCESEXTENSIONS_FIND_REQUIRED)
+ message(STATUS "Could NOT find XercesExtensions")
+ endif (XERCESEXTENSIONS_FIND_REQUIRED)
+endif (XERCESEXTENSIONS_FOUND)
+
+MARK_AS_ADVANCED(XERCESEXTENSIONS_INCLUDE_DIRS XERCESEXTENSIONS_LIBRARIES)
--
1.7.7.4
From 2973b6c50c86b4477be3b1fd3399c62bac0d9497 Mon Sep 17 00:00:00 2001
From: Hans de Goede <hdegoede@redhat.com>
Date: Wed, 18 Jan 2012 20:44:47 +0100
Subject: [PATCH 11/11] allow building zipios as a shared lib
---
src/zipios/CMakeLists.txt | 23 ++++++++++++++++++++---
1 files changed, 20 insertions(+), 3 deletions(-)
diff --git a/src/zipios/CMakeLists.txt b/src/zipios/CMakeLists.txt
index 3ab775c..781c30d 100644
--- a/src/zipios/CMakeLists.txt
+++ b/src/zipios/CMakeLists.txt
@@ -27,7 +27,19 @@ endif()
link_directories ( ${PROJECT_BINARY_DIR}/lib )
-add_library( ${PROJECT_NAME} ${SOURCES} )
+if( BUILD_SHARED_ZI )
+ add_library( ${PROJECT_NAME} SHARED ${SOURCES} )
+ set_target_properties( ${PROJECT_NAME} PROPERTIES
+ VERSION "${FLIGHTCREW_LIBVERSION}"
+ SOVERSION "${FLIGHTCREW_SOVERSION}"
+ OUTPUT_NAME "${PROJECT_NAME}"
+ )
+else()
+ add_library( ${PROJECT_NAME} ${SOURCES} )
+ if( UNIX AND BUILD_SHARED_FC )
+ add_definitions(-fPIC)
+ endif()
+endif()
target_link_libraries( ${PROJECT_NAME} ${BOOST_LIBS} )
if( ZLIB_FOUND )
@@ -57,6 +69,11 @@ elseif( CMAKE_COMPILER_IS_GNUCXX )
add_definitions( -Wall )
endif()
-if( UNIX AND BUILD_SHARED_FC )
- add_definitions(-fPIC)
+if( BUILD_SHARED_ZI AND UNIX AND NOT APPLE )
+ install( TARGETS ${PROJECT_NAME}
+ LIBRARY DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
+ ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib${LIB_SUFFIX}
+ )
+ file( GLOB files "${CMAKE_CURRENT_SOURCE_DIR}/zipios++/*.h" )
+ install( FILES ${files} DESTINATION ${INCLUDE_INSTALL_DIR}/${PROJECT_NAME}/zipios++ )
endif()
--
1.7.7.4
Reply to: