Overlay/games-action/minetest/files/minetest-0.4.5-cmake.patch

89 lines
2.6 KiB
Diff

--- src/CMakeLists.txt
+++ src/CMakeLists.txt
@@ -387,6 +387,9 @@
${CGUITTFONT_LIBRARY}
)
endif(USE_FREETYPE)
+ set_target_properties(${PROJECT_NAME}
+ PROPERTIES COMPILE_FLAGS "${JTHREAD_CFLAGS}"
+ LINK_FLAGS "${JTHREAD_LDFLAGS}")
endif(BUILD_CLIENT)
if(BUILD_SERVER)
@@ -407,6 +410,9 @@
${CURL_LIBRARY}
)
endif(USE_CURL)
+ set_target_properties(${PROJECT_NAME}server
+ PROPERTIES COMPILE_FLAGS "${JTHREAD_CFLAGS}"
+ LINK_FLAGS "${JTHREAD_LDFLAGS}")
endif(BUILD_SERVER)
--- cmake/Modules/FindJthread.cmake
+++ cmake/Modules/FindJthread.cmake
@@ -1,16 +1,41 @@
# Look for jthread, use our own if not found
-FIND_PATH(JTHREAD_INCLUDE_DIR jthread.h)
-FIND_LIBRARY(JTHREAD_LIBRARY NAMES jthread)
+option(WITH_SYSTEM_JTHREAD "Use systm JThread copy" OFF)
-IF(JTHREAD_LIBRARY AND JTHREAD_INCLUDE_DIR)
- SET( JTHREAD_FOUND TRUE )
-ENDIF(JTHREAD_LIBRARY AND JTHREAD_INCLUDE_DIR)
+IF(WITH_SYSTEM_JTHREAD)
+ IF(UNIX)
+ # try to use pkgconfig file first
+ FIND_PACKAGE(PkgConfig QUIET)
+ pkg_check_modules(_PC_JTHREAD jthread)
+ IF(_PC_JTHREAD_FOUND)
+ SET(JTHREAD_FOUND TRUE)
+ # use CFLAGS/LDFLAGS instead of INCLUDE_DIR/LIBRARY
+ # because we want the full dependencies
+ SET(JTHREAD_CFLAGS ${_PC_JTHREAD_CFLAGS})
+ SET(JTHREAD_LDFLAGS ${_PC_JTHREAD_LDFLAGS})
+ ENDIF(_PC_JTHREAD_FOUND)
+ ENDIF(UNIX)
+
+ # fall back to cmake macros
+ IF(NOT JTHREAD_FOUND)
+ FIND_PATH(JTHREAD_INCLUDE_DIR jthread.h PATHS /usr/include/jthread)
+ FIND_LIBRARY(JTHREAD_LIBRARY NAMES jthread)
+
+ IF(JTHREAD_LIBRARY AND JTHREAD_INCLUDE_DIR)
+ SET( JTHREAD_FOUND TRUE )
+ ENDIF(JTHREAD_LIBRARY AND JTHREAD_INCLUDE_DIR)
+ ENDIF(NOT JTHREAD_FOUND)
+ENDIf(WITH_SYSTEM_JTHREAD)
IF(JTHREAD_FOUND)
- MESSAGE(STATUS "Found system jthread header file in ${JTHREAD_INCLUDE_DIR}")
- MESSAGE(STATUS "Found system jthread library ${JTHREAD_LIBRARY}")
+ IF(_PC_JTHREAD_FOUND)
+ MESSAGE(STATUS "Found system jthread: ${_PC_JTHREAD_VERSION}")
+ ELSE(_PC_JTHREAD_FOUND)
+ MESSAGE(STATUS "Found system jthread header file in ${JTHREAD_INCLUDE_DIR}")
+ MESSAGE(STATUS "Found system jthread library ${JTHREAD_LIBRARY}")
+ ENDIF(_PC_JTHREAD_FOUND)
+# fall back to bundled jthread
ELSE(JTHREAD_FOUND)
SET(JTHREAD_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/jthread)
SET(JTHREAD_LIBRARY jthread)
--- cmake/Modules/FindIrrlicht.cmake
+++ cmake/Modules/FindIrrlicht.cmake
@@ -50,10 +50,11 @@
/usr/include/irrlicht
)
- FIND_LIBRARY(IRRLICHT_LIBRARY NAMES libIrrlicht.a Irrlicht
+ FIND_LIBRARY(IRRLICHT_LIBRARY NAMES libIrrlicht.so Irrlicht
PATHS
/usr/local/lib
/usr/lib
+ /usr/lib64
)
endif()