From b34c93c3992d58970fba39ad14a534393204e23f Mon Sep 17 00:00:00 2001 From: mckaygerhard Date: Fri, 15 Sep 2023 05:20:25 -0400 Subject: [PATCH] fix missing flags, fix gettex generation, fix postgresql find pkg * add missing flags for release flags on cmake * use only cmake or pkgdonfig, remove PostgreSQL fallback code missed the includes https://github.com/minetest/minetest/issues/11219 https://github.com/minetest/minetest/commit/a24899bf2dcd58916922d671ee8761448b6876e5 https://github.com/minetest/minetest/commit/3e2145d662d26443e96ac7191eda093c85c6f2bc * fix po build gettex due named files as minetest.po * fix conditional gettex when no gettex configuration on cmake --- src/CMakeLists.txt | 37 ++++++++++++++++--------------------- 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 58eec3f03..19f0affc2 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -182,20 +182,6 @@ if(ENABLE_POSTGRESQL) set(PostgreSQL_FOUND TRUE) set(PostgreSQL_INCLUDE_DIRS ${PostgreSQL_INCLUDE_DIR}) set(PostgreSQL_LIBRARIES ${PostgreSQL_LIBRARY}) - else() - find_program(POSTGRESQL_CONFIG_EXECUTABLE pg_config DOC "pg_config") - find_library(POSTGRESQL_LIBRARY pq) - if(POSTGRESQL_CONFIG_EXECUTABLE) - execute_process(COMMAND ${POSTGRESQL_CONFIG_EXECUTABLE} --includedir-server - OUTPUT_VARIABLE POSTGRESQL_SERVER_INCLUDE_DIRS - OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND ${POSTGRESQL_CONFIG_EXECUTABLE} - OUTPUT_VARIABLE POSTGRESQL_CLIENT_INCLUDE_DIRS - OUTPUT_STRIP_TRAILING_WHITESPACE) - # This variable is case sensitive for the cmake PostgreSQL module - set(PostgreSQL_ADDITIONAL_SEARCH_PATHS ${POSTGRESQL_SERVER_INCLUDE_DIRS} ${POSTGRESQL_CLIENT_INCLUDE_DIRS}) - endif() - find_package("PostgreSQL") endif() else() find_package(PostgreSQL) @@ -205,8 +191,8 @@ if(ENABLE_POSTGRESQL) set(USE_POSTGRESQL TRUE) message(STATUS "PostgreSQL backend enabled") # This variable is case sensitive, don't try to change it to POSTGRESQL_INCLUDE_DIR - message(STATUS "PostgreSQL includes: ${PostgreSQL_INCLUDE_DIR}") - include_directories(${PostgreSQL_INCLUDE_DIR}) + message(STATUS "PostgreSQL includes: ${PostgreSQL_INCLUDE_DIRS}") + include_directories(${PostgreSQL_INCLUDE_DIRS}) else() message(STATUS "PostgreSQL not found!") endif() @@ -581,7 +567,6 @@ include_directories( ${ZLIB_INCLUDE_DIR} ${CMAKE_BUILD_TYPE} ${PNG_INCLUDE_DIR} - ${GETTEXT_INCLUDE_DIR} ${SOUND_INCLUDE_DIRS} ${SQLITE3_INCLUDE_DIR} ${LUA_INCLUDE_DIR} @@ -591,6 +576,9 @@ include_directories( ${PROJECT_SOURCE_DIR}/script ) +if(USE_GETTEXT) + include_directories(${GETTEXT_INCLUDE_DIR}) +endif() if(USE_FREETYPE) include_directories(${FREETYPE_INCLUDE_DIRS} ${CGUITTFONT_INCLUDE_DIR}) @@ -681,13 +669,15 @@ if(BUILD_SERVER) ${ZLIB_LIBRARIES} ${SQLITE3_LIBRARY} ${JSON_LIBRARY} - ${GETTEXT_LIBRARY} ${LUA_LIBRARY} ${GMP_LIBRARY} ${PLATFORM_LIBS} ) set_target_properties(${PROJECT_NAME}server PROPERTIES COMPILE_DEFINITIONS "SERVER") + if (USE_GETTEXT) + target_link_libraries(${PROJECT_NAME}server ${GETTEXT_LIBRARY}) + endif() if (USE_CURSES) target_link_libraries(${PROJECT_NAME}server ${CURSES_LIBRARIES}) endif() @@ -878,8 +868,13 @@ else() set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} ${MATH_FLAGS}") endif() endif(CMAKE_SYSTEM_NAME MATCHES "(Darwin|BSD|DragonFly)") - set(CMAKE_CXX_FLAGS_SEMIDEBUG "-g -O1 -Wall ${WARNING_FLAGS} ${OTHER_FLAGS}") - set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall ${WARNING_FLAGS} ${OTHER_FLAGS}") + + set(CMAKE_CXX_FLAGS_SEMIDEBUG "-g -O1 -Wall ${WARNING_FLAGS} ${CMAKE_C_FLAGS} ${OTHER_FLAGS}") + set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -Wall ${WARNING_FLAGS} ${CMAKE_C_FLAGS} ${OTHER_FLAGS}") + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} ${CMAKE_C_FLAGS} ") + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} ${CMAKE_C_FLAGS} -g") + set(CMAKE_C_FLAGS_PROFILE "${CMAKE_C_FLAGS_PROFILE} ${CMAKE_C_FLAGS} -O1 -g") + set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_WITHDEBINFO} ${CMAKE_C_FLAGS} -g") if(USE_GPROF) set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -pg") @@ -975,7 +970,7 @@ if (USE_GETTEXT) set(MO_FILES) foreach(LOCALE ${GETTEXT_USED_LOCALES}) - set(PO_FILE_PATH "${GETTEXT_PO_PATH}/${LOCALE}/${PROJECT_NAME}.po") + set(PO_FILE_PATH "${GETTEXT_PO_PATH}/${LOCALE}/minetest.po") set_mo_paths(MO_BUILD_PATH MO_DEST_PATH ${LOCALE}) set(MO_FILE_PATH "${MO_BUILD_PATH}/${PROJECT_NAME}.mo")