-
Notifications
You must be signed in to change notification settings - Fork 244
Unified Search Architecture Redesign #428
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
62ae973
0e29bd0
442b949
2cc6ffc
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,83 @@ | ||
| # Find ICU (International Components for Unicode) | ||
| # This module finds the ICU libraries and defines: | ||
| # ICU_FOUND - True if ICU was found | ||
| # ICU_INCLUDE_DIRS - Include directories for ICU | ||
| # ICU_LIBRARIES - Libraries to link against | ||
| # ICU_VERSION - Version of ICU | ||
|
|
||
| find_package(PkgConfig) | ||
| if(PKG_CONFIG_FOUND) | ||
| pkg_check_modules(ICU_UC icu-uc) | ||
| pkg_check_modules(ICU_I18N icu-i18n) | ||
| endif() | ||
|
|
||
| # If pkg-config didn't find ICU, try manual search | ||
| if(NOT ICU_UC_FOUND) | ||
| find_path(ICU_INCLUDE_DIR | ||
| NAMES unicode/utypes.h | ||
| PATHS | ||
| /usr/include | ||
| /usr/local/include | ||
| /opt/local/include | ||
| ) | ||
|
|
||
| find_library(ICU_UC_LIB | ||
| NAMES icuuc icuucd | ||
| PATHS | ||
| /usr/lib | ||
| /usr/local/lib | ||
| /opt/local/lib | ||
| /usr/lib/x86_64-linux-gnu | ||
| ) | ||
|
|
||
| find_library(ICU_I18N_LIB | ||
| NAMES icui18n icui18nd | ||
| PATHS | ||
| /usr/lib | ||
| /usr/local/lib | ||
| /opt/local/lib | ||
| /usr/lib/x86_64-linux-gnu | ||
| ) | ||
|
|
||
| if(ICU_INCLUDE_DIR AND ICU_UC_LIB AND ICU_I18N_LIB) | ||
| set(ICU_UC_FOUND TRUE) | ||
| set(ICU_I18N_FOUND TRUE) | ||
| set(ICU_UC_INCLUDE_DIRS ${ICU_INCLUDE_DIR}) | ||
| set(ICU_UC_LIBRARIES ${ICU_UC_LIB}) | ||
| set(ICU_I18N_LIBRARIES ${ICU_I18N_LIB}) | ||
| endif() | ||
| endif() | ||
|
|
||
| # Combine results | ||
| if(ICU_UC_FOUND AND ICU_I18N_FOUND) | ||
| set(ICU_FOUND TRUE) | ||
| set(ICU_INCLUDE_DIRS ${ICU_UC_INCLUDE_DIRS}) | ||
| set(ICU_LIBRARIES ${ICU_UC_LIBRARIES} ${ICU_I18N_LIBRARIES}) | ||
|
|
||
| if(DEFINED ICU_UC_VERSION) | ||
| set(ICU_VERSION ${ICU_UC_VERSION}) | ||
| else() | ||
| # Try to get version from header file | ||
| if(EXISTS "${ICU_INCLUDE_DIR}/unicode/uversion.h") | ||
| file(READ "${ICU_INCLUDE_DIR}/unicode/uversion.h" ICU_VERSION_H) | ||
| string(REGEX MATCH "U_ICU_VERSION_MAJOR_NUM ([0-9]+)" _ ${ICU_VERSION_H}) | ||
| set(ICU_VERSION_MAJOR ${CMAKE_MATCH_1}) | ||
| string(REGEX MATCH "U_ICU_VERSION_MINOR_NUM ([0-9]+)" _ ${ICU_VERSION_H}) | ||
| set(ICU_VERSION_MINOR ${CMAKE_MATCH_1}) | ||
| set(ICU_VERSION "${ICU_VERSION_MAJOR}.${ICU_VERSION_MINOR}") | ||
| endif() | ||
| endif() | ||
|
|
||
| message(STATUS "Found ICU: ${ICU_INCLUDE_DIRS}, ${ICU_LIBRARIES}") | ||
| message(STATUS "ICU Version: ${ICU_VERSION}") | ||
| else() | ||
| set(ICU_FOUND FALSE) | ||
| message(STATUS "ICU not found, will use wxWidgets encoding fallback") | ||
| endif() | ||
|
|
||
| # Hide cache variables from GUI | ||
| mark_as_advanced( | ||
| ICU_INCLUDE_DIR | ||
| ICU_UC_LIB | ||
| ICU_I18N_LIB | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,42 +1,65 @@ | ||
| if (GEOIP_INCLUDE_DIR) | ||
| set (CMAKE_REQUIRED_INCLUDES ${GEOIP_INCLUDE_DIR}) | ||
| # MaxMind DB implementation for IP2Country | ||
| find_package(maxminddb QUIET) | ||
| if (NOT maxminddb_FOUND) | ||
| # Try alternative spelling | ||
| find_package(MaxMindDB QUIET) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Shouldn't be needed as upstream creates maxminddb-config.cmake that's the right spelling, if anyone (any Distro/Packagemanager) renames it, not our problem. |
||
| endif() | ||
|
|
||
| if (NOT GEOIP_LIB) | ||
| include (CheckIncludeFile) | ||
| if (maxminddb_FOUND) | ||
| message(STATUS "MaxMind DB found: ${maxminddb_VERSION}") | ||
| else() | ||
| # Try to find manually | ||
| find_path(MAXMINDDB_INCLUDE_DIR maxminddb.h) | ||
| find_library(MAXMINDDB_LIBRARY NAMES maxminddb) | ||
|
|
||
| if (MAXMINDDB_INCLUDE_DIR AND MAXMINDDB_LIBRARY) | ||
| set(maxminddb_FOUND TRUE) | ||
| set(maxminddb_INCLUDE_DIRS ${MAXMINDDB_INCLUDE_DIR}) | ||
| set(maxminddb_LIBRARIES ${MAXMINDDB_LIBRARY}) | ||
|
|
||
| check_include_file (GeoIP.h GEOIP_H) | ||
| # Get version from pkg-config | ||
| find_package(PkgConfig QUIET) | ||
| if(PKG_CONFIG_FOUND) | ||
| execute_process( | ||
| COMMAND pkg-config --modversion libmaxminddb | ||
| OUTPUT_VARIABLE maxminddb_VERSION | ||
| OUTPUT_STRIP_TRAILING_WHITESPACE | ||
| ERROR_QUIET | ||
| ) | ||
| if(maxminddb_VERSION) | ||
| message(STATUS "MaxMind DB version from pkg-config: ${maxminddb_VERSION}") | ||
| endif() | ||
| endif() | ||
|
|
||
| if (GEOIP_H) | ||
| find_library (GEOIP_LIB GeoIP) | ||
|
|
||
| if (NOT GEOIP_LIB AND GEOIP_INCLUDE_DIR) | ||
| find_library (GEOIP_LIB GeoIP | ||
| PATHS ${GEOIP_INCLUDE_DIR} | ||
| ) | ||
| endif() | ||
|
|
||
| if (NOT GEOIP_LIB) | ||
| set (ENABLE_IP2COUNTRY FALSE) | ||
| message (STATUS "GeoIP lib not found, disabling support") | ||
| else() | ||
| message (STATUS "GeoIP found useable") | ||
| endif() | ||
| else() | ||
| set (ENABLE_IP2COUNTRY FALSE) | ||
| message (STATUS "GeoIP headers not found, disabling support") | ||
| endif() | ||
| message(STATUS "MaxMind DB found manually") | ||
| else() | ||
| if (ENABLE_IP2COUNTRY) | ||
| message(FATAL_ERROR "**************************************************") | ||
| message(FATAL_ERROR "libmaxminddb not found but ENABLE_IP2COUNTRY is enabled") | ||
| message(FATAL_ERROR "Please install: sudo apt install libmaxminddb-dev") | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I doubt this command is portable, just "please install" should be enough |
||
| message(FATAL_ERROR "**************************************************") | ||
| else() | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As this file isn't even included when ENABLE-IP2COUNTRY is not set, the else branch is never reaches, so the complete if can be omitted. |
||
| message(STATUS "MaxMind DB not found - GeoIP/country flags will be disabled") | ||
| message(STATUS "To enable, install: sudo apt install libmaxminddb-dev") | ||
| set(maxminddb_FOUND FALSE) | ||
| endif() | ||
| endif() | ||
| endif() | ||
|
|
||
| if (ENABLE_IP2COUNTRY) | ||
| add_library (GeoIP::Shared UNKNOWN IMPORTED) | ||
| if (maxminddb_FOUND) | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Both if's can be omitted here, as this isn't reached if one of them is false. |
||
| # MaxMind DB implementation | ||
| add_library(maxminddb::maxminddb UNKNOWN IMPORTED) | ||
|
|
||
| set_target_properties (GeoIP::Shared PROPERTIES | ||
| INTERFACE_COMPILE_DEFINITIONS "ENABLE_IP2COUNTRY" | ||
| INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_REQUIRED_INCLUDES}" | ||
| IMPORTED_LOCATION "${GEOIP_LIB}" | ||
| ) | ||
| set_target_properties(maxminddb::maxminddb PROPERTIES | ||
| INTERFACE_COMPILE_DEFINITIONS "ENABLE_IP2COUNTRY" | ||
| INTERFACE_INCLUDE_DIRECTORIES "${maxminddb_INCLUDE_DIRS}" | ||
| IMPORTED_LOCATION "${maxminddb_LIBRARIES}" | ||
| ) | ||
| message(STATUS "Using MaxMind DB implementation") | ||
| else() | ||
| # No MaxMind DB library found, disable support | ||
| set(ENABLE_IP2COUNTRY FALSE) | ||
| message(STATUS "MaxMind DB not found, disabling IP2Country support") | ||
| endif() | ||
| endif() | ||
|
|
||
| unset (CMAKE_REQUIRED_INCLUDES) | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not bumping min version to 3.7 and using FindICU?