[sword-svn] r3047 - in trunk: . cmake

chrislit at crosswire.org chrislit at crosswire.org
Sun Mar 2 03:28:02 MST 2014


Author: chrislit
Date: 2014-03-02 03:28:02 -0700 (Sun, 02 Mar 2014)
New Revision: 3047

Added:
   trunk/cmake/FindBZIP2.cmake
   trunk/cmake/FindXZ.cmake
Modified:
   trunk/CMakeLists.txt
   trunk/cmake/muxsources.cmake
   trunk/cmake/sources.cmake
Log:
added CMake build stuff for bzip2 & xz (... but I have no idea what I'm doing)


Modified: trunk/CMakeLists.txt
===================================================================
--- trunk/CMakeLists.txt	2014-03-02 07:56:21 UTC (rev 3046)
+++ trunk/CMakeLists.txt	2014-03-02 10:28:02 UTC (rev 3047)
@@ -44,6 +44,8 @@
 MESSAGE(STATUS "\n-- SEARCHING FOR SYTEM PACKAGES")
 # Find our packages
 FIND_PACKAGE(ZLIB QUIET)
+FIND_PACKAGE(BZIP2 QUIET)
+FIND_PACKAGE(XZ QUIET)
 FIND_PACKAGE(ICU QUIET)
 FIND_PACKAGE(CURL QUIET)
 FIND_PACKAGE(CLucene QUIET)
@@ -165,6 +167,14 @@
 	INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIR})
 	SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${ZLIB_LIBRARY})
 ENDIF(WITH_ZLIB)
+IF(WITH_BZIP2)
+	INCLUDE_DIRECTORIES(${BZIP2_INCLUDE_DIR})
+	SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${BZIP2_LIBRARY})
+ENDIF(WITH_BZIP2)
+IF(WITH_XZ)
+	INCLUDE_DIRECTORIES(${XZ_INCLUDE_DIR})
+	SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${XZ_LIBRARY})
+ENDIF(WITH_XZ)
 IF(WITH_CURL)
 	FIND_PROGRAM(CURL_CONFIG curl-config
 		DOC "The curl-config executable path, used to determine SFTP support.")

Added: trunk/cmake/FindBZIP2.cmake
===================================================================
--- trunk/cmake/FindBZIP2.cmake	                        (rev 0)
+++ trunk/cmake/FindBZIP2.cmake	2014-03-02 10:28:02 UTC (rev 3047)
@@ -0,0 +1,34 @@
+# - Try to find BZIP2
+# Once done this will define
+#
+#  BZIP2_FOUND - system has BZIP2
+#  BZIP2_INCLUDE_DIR - the BZIP2 include directory
+#  BZIP2_LIBRARIES - Link these to use BZIP2
+#  BZIP2_DEFINITIONS - Compiler switches required for using BZIP2
+#  BZIP2_NEED_PREFIX - this is set if the functions are prefixed with BZ2_
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+IF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
+    SET(BZIP2_FIND_QUIETLY TRUE)
+ENDIF (BZIP2_INCLUDE_DIR AND BZIP2_LIBRARIES)
+
+FIND_PATH(BZIP2_INCLUDE_DIR bzlib.h )
+
+FIND_LIBRARY(BZIP2_LIBRARY bz2 )
+
+# handle the QUIETLY and REQUIRED arguments and set BZIP2_FOUND to TRUE if 
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(BZIP2 DEFAULT_MSG BZIP2_LIBRARIES BZIP2_INCLUDE_DIR)
+
+IF (BZIP2_FOUND)
+   INCLUDE(CheckLibraryExists)
+   CHECK_LIBRARY_EXISTS(${BZIP2_LIBRARIES} BZ2_bzBuffToBuffCompress "" BZIP2_NEED_PREFIX)
+ENDIF (BZIP2_FOUND)
+
+MARK_AS_ADVANCED(BZIP2_INCLUDE_DIR BZIP2_LIBRARIES)

Added: trunk/cmake/FindXZ.cmake
===================================================================
--- trunk/cmake/FindXZ.cmake	                        (rev 0)
+++ trunk/cmake/FindXZ.cmake	2014-03-02 10:28:02 UTC (rev 3047)
@@ -0,0 +1,28 @@
+# - Try to find XZ
+# Once done this will define
+#
+#  XZ_FOUND - system has XZ
+#  XZ_INCLUDE_DIR - the XZ include directory
+#  XZ_LIBRARIES - Link these to use XZ
+#  XZ_DEFINITIONS - Compiler switches required for using XZ
+
+# Copyright (c) 2006, Alexander Neundorf, <neundorf at kde.org>
+#
+# Redistribution and use is allowed according to the terms of the BSD license.
+# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
+
+
+IF (XZ_INCLUDE_DIR AND XZ_LIBRARIES)
+    SET(XZ_FIND_QUIETLY TRUE)
+ENDIF (XZ_INCLUDE_DIR AND XZ_LIBRARIES)
+
+FIND_PATH(XZ_INCLUDE_DIR lzma.h )
+
+FIND_LIBRARY(XZ_LIBRARY NAMES lzma )
+
+# handle the QUIETLY and REQUIRED arguments and set XZ_FOUND to TRUE if 
+# all listed variables are TRUE
+INCLUDE(FindPackageHandleStandardArgs)
+FIND_PACKAGE_HANDLE_STANDARD_ARGS(XZ DEFAULT_MSG XZ_LIBRARIES XZ_INCLUDE_DIR)
+
+MARK_AS_ADVANCED(XZ_INCLUDE_DIR XZ_LIBRARIES)

Modified: trunk/cmake/muxsources.cmake
===================================================================
--- trunk/cmake/muxsources.cmake	2014-03-02 07:56:21 UTC (rev 3046)
+++ trunk/cmake/muxsources.cmake	2014-03-02 10:28:02 UTC (rev 3047)
@@ -5,12 +5,14 @@
 #
 # Written by Greg Hellings
 SET(sword_SOURCES ${sword_base_SOURCES})
+
+MESSAGE(STATUS "\n-- CONFIGURING SOURCE LIST")
+
 # Check for if we've found ZLIB
 # This one is a bit more unique, since we still allow compilation without
 # a ZLIB at all, and allowing a user to disable it does not bring about use
 # of some internal fall-back but just leaves the ability to read ZLIB files
 # out of the library altogether
-MESSAGE(STATUS "\n-- CONFIGURING SOURCE LIST")
 IF(SWORD_NO_ZLIB STREQUAL "Yes")
 	MESSAGE(STATUS "ZLib: excluded by use option")
 	ADD_DEFINITIONS(-DEXCLUDEZLIB)
@@ -27,6 +29,32 @@
 	ENDIF(NOT ZLIB_FOUND OR SWORD_USE_INTERNAL_ZLIB STREQUAL "Yes")
 ENDIF(SWORD_NO_ZLIB STREQUAL "Yes")
 
+# Check for if we've found bzip2 (libbz2)
+IF(SWORD_NO_BZIP2 STREQUAL "Yes")
+	MESSAGE(STATUS "bzip2: excluded by use option")
+	ADD_DEFINITIONS(-DEXCLUDEBZIP2)
+	SET(WITH_BZIP2 0)
+ELSE(SWORD_NO_BZIP2 STREQUAL "Yes")
+	SET(sword_SOURCES ${sword_SOURCES} ${sword_bzip2_used_SOURCES})
+	IF(BZIP2_FOUND)
+		MESSAGE(STATUS "bzip2: system ${BZIP2_LIBRARY}")
+		SET(WITH_BZIP2 1)
+	ENDIF(BZIP2_FOUND)
+ENDIF(SWORD_NO_BZIP2 STREQUAL "Yes")
+
+# Check for if we've found xz (liblzma)
+IF(SWORD_NO_XZ STREQUAL "Yes")
+	MESSAGE(STATUS "xz: excluded by use option")
+	ADD_DEFINITIONS(-DEXCLUDEXZ)
+	SET(WITH_XZ 0)
+ELSE(SWORD_NO_XZ STREQUAL "Yes")
+	SET(sword_SOURCES ${sword_SOURCES} ${sword_xz_used_SOURCES})
+	IF(XZ_FOUND)
+		MESSAGE(STATUS "xz: system ${XZ_LIBRARY}")
+		SET(WITH_XZ 1)
+	ENDIF(XZ_FOUND)
+ENDIF(SWORD_NO_XZ STREQUAL "Yes")
+
 # Check for if we've found cURL
 IF(CURL_FOUND AND NOT SWORD_NO_CURL STREQUAL "Yes")
 	MESSAGE(STATUS "cURL: system ${CURL_LIBRARY} and ${CURL_INCLUDE_DIRS}")

Modified: trunk/cmake/sources.cmake
===================================================================
--- trunk/cmake/sources.cmake	2014-03-02 07:56:21 UTC (rev 3046)
+++ trunk/cmake/sources.cmake	2014-03-02 10:28:02 UTC (rev 3047)
@@ -188,8 +188,6 @@
 # Sources relying on ZLib
 SET(sword_zlib_used_SOURCES
 	src/modules/common/zipcomprs.cpp
-	src/modules/common/bz2comprs.cpp
-	src/modules/common/xzcomprs.cpp
 	src/utilfuns/zlib/untgz.c
 )
 SET(sword_zlib_nofound_SOURCES
@@ -210,6 +208,16 @@
 	src/utilfuns/zlib/zutil.c
 )
 
+# Sources relying on bzip2 (libbz2)
+SET(sword_bzip2_used_SOURCES
+	src/modules/common/bz2comprs.cpp
+)
+
+# Sources relying on xz (liblzma)
+SET(sword_xz_used_SOURCES
+	src/modules/common/xzcomprs.cpp
+)
+
 # Sources relying on cURL
 SET(sword_curl_found_SOURCES
 	src/mgr/curlftpt.cpp




More information about the sword-cvs mailing list