minetest-engine-minetest/cmake/Modules/FindGettextLib.cmake
mckaygerhard 8f690d2bbb set a new compilation set of rules, tune cmakefiles, tune buils
* tune up gitlab ci:
  * add winbuntu 14, add debian 7, winbuntu 17, build minetest for olders one
  * use minenux minetest repo game (seems not work)
  * remove non buildable stages.. remove windo shit
  * back cmake in list new behaviour for blacklist locales
  * gitlab ci build for debian 8 using backports on jsoncpp
  * solved https://github.com/minetest/minetest/issues/6567
  * solved https://github.com/minetest/minetest/issues/7681
* cmake fixed to minimum supported and c++11 standar able
  * Fix no locales being generated when APPLY_LOCALE_BLACKLIST=0
  * Fix linking with Postgres libs:
  * closes https://github.com/minetest/minetest/issues/12149
  * closes https://github.com/minetest/minetest/issues/11219
  * PostgreSQL fallback code missed the includes
  https://github.com/minetest/minetest/issues/11219
  * a24899bf2d
  * 3e2145d662
  * integrates https://github.com/minetest/minetest/pull/11215
  *  a24899bf2d
  * backported 998e4820c9
* use SSE registers for FP operations on i386 for modern gcc platforms only
  * only use if related are given, by example 32bit using gcc
    compilers/stdlibs becouse of the long time bugs around those
    errors by desing, its not about to crash the engine.. its about to
    permits to hacked clients (either players or the client program per se)
    making predictable results, so predictable results permits to catch
    securit issues!
  * floating point problems are only on modern gcc and modern platform
    arches, raising problems like bad calculations positions..
    a long time bug  reported at https://git.minetest.land/Mineclonia/Mineclonia/issues/201
    and addressed at https://github.com/minetest/minetest/issues/11742#issuecomment-994444462
    with enought explanations but not accepted byt stupid developers..
    now years later.. the problems were solved and reconiced as big bug!
    A workaround were proposed at https://github.com/minetest/minetest/pull/12389/files
    but never accepted (included in this repository), cos was superset by 8ff3fadba0
  * related minenux/minetest-engine-multicraft2#57
2023-09-14 20:29:46 -04:00

83 lines
2.5 KiB
CMake

set(CUSTOM_GETTEXT_PATH "${PROJECT_SOURCE_DIR}/../../gettext"
CACHE FILEPATH "path to custom gettext")
find_path(GETTEXT_INCLUDE_DIR
NAMES libintl.h
PATHS "${CUSTOM_GETTEXT_PATH}/include"
DOC "GetText include directory")
find_program(GETTEXT_MSGFMT
NAMES msgfmt
PATHS "${CUSTOM_GETTEXT_PATH}/bin"
DOC "Path to msgfmt")
set(GETTEXT_REQUIRED_VARS GETTEXT_INCLUDE_DIR GETTEXT_MSGFMT)
if(APPLE)
find_library(GETTEXT_LIBRARY
NAMES libintl.a
PATHS "${CUSTOM_GETTEXT_PATH}/lib"
DOC "GetText library")
find_library(ICONV_LIBRARY
NAMES libiconv.dylib
PATHS "/usr/lib"
DOC "IConv library")
set(GETTEXT_REQUIRED_VARS ${GETTEXT_REQUIRED_VARS} GETTEXT_LIBRARY ICONV_LIBRARY)
endif(APPLE)
# Modern Linux, as well as OSX, does not require special linking because
# GetText is part of glibc.
# TODO: check the requirements on other BSDs and older Linux
if(WIN32)
if(MSVC)
set(GETTEXT_LIB_NAMES
libintl.lib intl.lib libintl3.lib intl3.lib)
else()
set(GETTEXT_LIB_NAMES
libintl.dll.a intl.dll.a libintl3.dll.a intl3.dll.a)
endif()
find_library(GETTEXT_LIBRARY
NAMES ${GETTEXT_LIB_NAMES}
PATHS "${CUSTOM_GETTEXT_PATH}/lib"
DOC "GetText library")
find_file(GETTEXT_DLL
NAMES libintl.dll intl.dll libintl3.dll intl3.dll
PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib"
DOC "gettext *intl*.dll")
find_file(GETTEXT_ICONV_DLL
NAMES libiconv2.dll
PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib"
DOC "gettext *iconv*.lib")
set(GETTEXT_REQUIRED_VARS ${GETTEXT_REQUIRED_VARS} GETTEXT_DLL GETTEXT_ICONV_DLL)
endif(WIN32)
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(GettextLib DEFAULT_MSG ${GETTEXT_REQUIRED_VARS})
if(GETTEXTLIB_FOUND)
# BSD variants require special linkage as they don't use glibc
if(${CMAKE_SYSTEM_NAME} MATCHES "BSD|DragonFly")
set(GETTEXT_LIBRARY "intl")
endif()
set(GETTEXT_PO_PATH ${CMAKE_SOURCE_DIR}/po)
if(WIN32)
set(GETTEXT_MO_BUILD_PATH ${CMAKE_SOURCE_DIR}/locale/<locale>/LC_MESSAGES)
else()
set(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale/<locale>/LC_MESSAGES)
endif()
set(GETTEXT_MO_DEST_PATH ${LOCALEDIR}/<locale>/LC_MESSAGES)
file(GLOB GETTEXT_AVAILABLE_LOCALES RELATIVE ${GETTEXT_PO_PATH} "${GETTEXT_PO_PATH}/*")
list(REMOVE_ITEM GETTEXT_AVAILABLE_LOCALES minetest.pot)
list(REMOVE_ITEM GETTEXT_AVAILABLE_LOCALES timestamp)
macro(SET_MO_PATHS _buildvar _destvar _locale)
string(REPLACE "<locale>" ${_locale} ${_buildvar} ${GETTEXT_MO_BUILD_PATH})
string(REPLACE "<locale>" ${_locale} ${_destvar} ${GETTEXT_MO_DEST_PATH})
endmacro()
endif()