sword/sword-1.8.1-icu61.diff
Gregory Hellings dab06ef8dc Fix Fedora 29+ builds & Python3
Patch for building against ICU 61+
Patch for building Python bindings in 2/3
Add python3 package
2018-07-11 23:52:51 -05:00

139 lines
4.7 KiB
Diff

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5cbd06a..1d3a2d2 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,5 +1,4 @@
-# TODO: write FindICU (icu-config only for 2.2 and up) -- currently taken from another CMake system
-# limit pkg-config version to >= 0.14, demo, utilities, doc, tests
+# TODO: limit pkg-config version to >= 0.14, demo, utilities, doc, tests
# use BUILD_SHARED_LIBS
# convince perl swig bindings to build properly
#
@@ -13,7 +12,7 @@
# all posterity and eternity, wherever such transfer is possible. Where it is
# not, then this file is released under the GPLv2 by myself.
PROJECT(libsword CXX C)
-CMAKE_MINIMUM_REQUIRED(VERSION 2.6.0)
+CMAKE_MINIMUM_REQUIRED(VERSION 3.7.0)
SET(SWORD_VERSION 1.8.1)
# Make sure it's an out-of-stream build
@@ -56,7 +55,8 @@ IF(MSVC)
ELSE(MSVC)
FIND_PACKAGE(BZIP2 QUIET)
FIND_PACKAGE(XZ QUIET)
- FIND_PACKAGE(ICU QUIET)
+ FIND_PACKAGE(ICU
+ COMPONENTS data i18n io uc)
FIND_PACKAGE(CURL QUIET)
ENDIF(MSVC)
FIND_PACKAGE(CLucene QUIET)
@@ -237,7 +237,11 @@ ENDIF(WITH_CLUCENE)
IF(WITH_ICU)
INCLUDE_DIRECTORIES(${ICU_INCLUDE_DIRS})
ADD_DEFINITIONS(${ICU_DEFINITIONS})
- SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES})
+ MESSAGE(STATUS "ICU Version: ${ICU_VERSION}")
+ IF("${ICU_VERSION}" VERSION_GREATER "61")
+ ADD_DEFINITIONS(-DU_USING_ICU_NAMESPACE)
+ ENDIF("${ICU_VERSION}" VERSION_GREATER "61")
+ SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${ICU_LIBRARIES})
ENDIF(WITH_ICU)
IF(REGEX_FOUND AND CROSS_COMPILE_MINGW32)
SET(SWORD_LINK_LIBRARIES ${SWORD_LINK_LIBRARIES} ${REGEX_LIBRARY})
diff --git a/cmake/FindICU.cmake b/cmake/FindICU.cmake
deleted file mode 100644
index 451c2f3..0000000
--- a/cmake/FindICU.cmake
+++ /dev/null
@@ -1,68 +0,0 @@
-# Finds the International Components for Unicode (ICU) Library
-#
-# ICU_FOUND - True if ICU found.
-# ICU_I18N_FOUND - True if ICU's internationalization library found.
-# ICU_INCLUDE_DIRS - Directory to include to get ICU headers
-# Note: always include ICU headers as, e.g.,
-# unicode/utypes.h
-# ICU_LIBRARIES - Libraries to link against for the common ICU
-# ICU_I18N_LIBRARIES - Libraries to link against for ICU internationaliation
-# (note: in addition to ICU_LIBRARIES)
-
-# Look for the header file.
-find_path(
- ICU_INCLUDE_DIR
- NAMES unicode/utypes.h
- DOC "Include directory for the ICU library")
-mark_as_advanced(ICU_INCLUDE_DIR)
-
-# Look for the library.
-find_library(
- ICU_LIBRARY
- NAMES icuuc cygicuuc cygicuuc32
- DOC "Libraries to link against for the common parts of ICU")
-mark_as_advanced(ICU_LIBRARY)
-
-# Copy the results to the output variables.
-if(ICU_INCLUDE_DIR AND ICU_LIBRARY)
- set(ICU_FOUND 1)
- set(ICU_LIBRARIES ${ICU_LIBRARY})
- set(ICU_INCLUDE_DIRS ${ICU_INCLUDE_DIR})
-
- # Look for the ICU internationalization libraries
- find_library(
- ICU_I18N_LIBRARY
- NAMES icuin icui18n cygicuin cygicuin32
- DOC "Libraries to link against for ICU internationalization")
- if(MSVC)
- find_library(ICU_DATA_LIBRARY
- NAMES icudt
- DOC "Libraries to link against for ICU data")
- set(ICU_LIBRARIES ${ICU_LIBRARIES} ${ICU_DATA_LIBRARY})
- endif(MSVC)
- mark_as_advanced(ICU_I18N_LIBRARY)
- mark_as_advanced(ICU_DATA_LIBRARY)
- if (ICU_I18N_LIBRARY)
- set(ICU_I18N_FOUND 1)
- set(ICU_I18N_LIBRARIES ${ICU_I18N_LIBRARY})
- else (ICU_I18N_LIBRARY)
- set(ICU_I18N_FOUND 0)
- set(ICU_I18N_LIBRARIES)
- endif (ICU_I18N_LIBRARY)
-else(ICU_INCLUDE_DIR AND ICU_LIBRARY)
- set(ICU_FOUND 0)
- set(ICU_I18N_FOUND 0)
- set(ICU_LIBRARIES)
- set(ICU_I18N_LIBRARIES)
- set(ICU_INCLUDE_DIRS)
-endif(ICU_INCLUDE_DIR AND ICU_LIBRARY)
-
-IF(ICU_FOUND)
- IF(NOT ICU_FIND_QUIETLY)
- MESSAGE(STATUS "ICU: Yes ${ICU_I18N_LIBRARY}")
- ENDIF(NOT ICU_FIND_QUIETLY)
-ELSE(ICU_FOUND)
- IF(ICU_FIND_REQUIRED)
- MESSAGE(FATAL_ERROR "ICU: No")
- ENDIF(ICU_FIND_REQUIRED)
-ENDIF(ICU_FOUND)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 30818a8..08bc573 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -75,10 +75,12 @@ ENDFOREACH(TEST ${test_PROGRAMS})
########################################################################################
# The following tests require extra libraries to run
-#
-FOREACH(ICUTEST icutest translittest)
- TARGET_LINK_LIBRARIES(${ICUTEST} ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES})
-ENDFOREACH(ICUTEST icutest translittest)
+#
+IF(WITH_ICU)
+ FOREACH(ICUTEST icutest translittest)
+ TARGET_LINK_LIBRARIES(${ICUTEST} ${ICU_LIBRARIES} ${ICU_I18N_LIBRARIES})
+ ENDFOREACH(ICUTEST icutest translittest)
+ENDIF(WITH_ICU)
# Excluded until I know we have the tests working
ADD_SUBDIRECTORY(testsuite)