[sword-svn] r2536 - trunk/cmake
greg.hellings at crosswire.org
greg.hellings at crosswire.org
Sat Aug 7 00:19:15 MST 2010
Author: greg.hellings
Date: 2010-08-07 00:19:15 -0700 (Sat, 07 Aug 2010)
New Revision: 2536
Modified:
trunk/cmake/FindICU.cmake
trunk/cmake/install.cmake
trunk/cmake/sources.cmake
Log:
Now builds properly against ICU.
Modified: trunk/cmake/FindICU.cmake
===================================================================
--- trunk/cmake/FindICU.cmake 2010-08-03 09:17:05 UTC (rev 2535)
+++ trunk/cmake/FindICU.cmake 2010-08-07 07:19:15 UTC (rev 2536)
@@ -9,20 +9,67 @@
# 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)
+# Our first goal is to find the icu-config script, if possible
+find_program(
+ ICU_CONFIG_BIN
+ icu-config
+)
+find_program(
+ ICU_GENRB
+ genrb
+)
-# 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)
+if(ICU_CONFIG_BIN)
+ MESSAGE(STATUS "icu-config found at ${ICU_CONFIG_BIN}: Using that for configuration")
+ MESSAGE(STATUS "genrb found at ${ICU_GENRB}: Using that for generating transliteration data")
+ # Get include directories
+ execute_process(COMMAND "${ICU_CONFIG_BIN}" "--cppflags"
+ OUTPUT_VARIABLE ICU_INCLUDE_DIR
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+ # Sanitize output
+ string(REPLACE "-I" "" ICU_INCLUDE_DIR ${ICU_INCLUDE_DIR})
+ string(REGEX REPLACE "^[ ]+" "" ICU_INCLUDE_DIR ${ICU_INCLUDE_DIR})
+
+ # Try to get the Libraries we need
+ execute_process(COMMAND "${ICU_CONFIG_BIN}" "--ldflags"
+ OUTPUT_VARIABLE ICU_LIBRARY_RAW
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+ execute_process(COMMAND "${ICU_CONFIG_BIN}" "--ldflags-icuio"
+ OUTPUT_VARIABLE ICU_LIBRARY_IO_RAW
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+
+ string(REGEX REPLACE "^[ ]+" "" ICU_LIBRARY ${ICU_LIBRARY_RAW})
+ string(REGEX REPLACE "^[ ]+" "" ICU_LIBRARY_IO ${ICU_LIBRARY_IO_RAW})
+ # Combine them
+ set(ICU_LIBRARY "${ICU_LIBRARY} ${ICU_LIBRARY_IO_RAW}")
+
+ # Get the version
+ execute_process(COMMAND "${ICU_CONFIG_BIN}" "--version"
+ OUTPUT_VARIABLE ICU_VERSION
+ OUTPUT_STRIP_TRAILING_WHITESPACE
+ )
+else(ICU_CONFIG_BIN)
+
+ # 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)
+endif(ICU_CONFIG_BIN)
+
# Copy the results to the output variables.
if(ICU_INCLUDE_DIR AND ICU_LIBRARY)
set(ICU_FOUND 1)
Modified: trunk/cmake/install.cmake
===================================================================
--- trunk/cmake/install.cmake 2010-08-03 09:17:05 UTC (rev 2535)
+++ trunk/cmake/install.cmake 2010-08-07 07:19:15 UTC (rev 2536)
@@ -53,3 +53,21 @@
CONFIGURE_FILE(${CMAKE_CURRENT_SOURCE_DIR}/sword.pc.in ${CMAKE_CURRENT_BINARY_DIR}/sword.pc @ONLY)
INSTALL(FILES ${CMAKE_CURRENT_BINARY_DIR}/sword.pc
DESTINATION "${SWORD_INSTALL_DIR}/lib/pkgconfig")
+
+# Need to build/install the
+IF(WITH_ICU AND ICU_GENRB)
+ ADD_DEFINITIONS(-DSWICU_DATA="${libdir}/${SWORD_VERSION}_icu_${ICU_VERSION}")
+ FILE(MAKE_DIRECTORY "${CMAKE_CURRENT_BINARY_DIR}/icu")
+ FOREACH(translit ${translit_SOURCES})
+ STRING(REPLACE ".txt" ".res" translit_OUTPUT ${translit})
+ ADD_CUSTOM_COMMAND(TARGET sword
+ POST_BUILD
+ COMMAND ${ICU_GENRB} -s . -d "${CMAKE_CURRENT_BINARY_DIR}/icu" ${translit}
+ WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/icu"
+ COMMENT "Converting ${translit}"
+ VERBATIM
+ )
+ INSTALL(FILES "${CMAKE_CURRENT_BINARY_DIR}/icu/${translit_OUTPUT}"
+ DESTINATION "${libdir}/${SWORD_VERSION}_icu_${ICU_VERSION}")
+ ENDFOREACH(translit ${translit_SOURCES})
+ENDIF(WITH_ICU AND ICU_GENRB)
\ No newline at end of file
Modified: trunk/cmake/sources.cmake
===================================================================
--- trunk/cmake/sources.cmake 2010-08-03 09:17:05 UTC (rev 2535)
+++ trunk/cmake/sources.cmake 2010-08-07 07:19:15 UTC (rev 2536)
@@ -405,3 +405,16 @@
SET(INTERNAL_REGEX_HEADER
include/internal/regex/regex.h
)
+
+SET(translit_SOURCES
+ translit_Any_Latex.txt
+ translit_Any_Latin1.txt
+ translit_BETA_Greek.txt
+ translit_BGreek_Greek.txt
+ translit_CCAT_Hebrew.txt
+ translit_CCAT_Syriac.txt
+ translit_Latin_Coptic.txt
+ translit_Latin_Gothic.txt
+ translit_Latin_Ugaritic.txt
+ translit_swordindex.txt
+)
\ No newline at end of file
More information about the sword-cvs
mailing list