diff options
author | ShadowNinja <shadowninja@minetest.net> | 2015-02-27 18:05:29 -0500 |
---|---|---|
committer | ShadowNinja <shadowninja@minetest.net> | 2015-03-27 15:00:48 -0400 |
commit | 93fcab952b28f4db39d9326b83f14cbd86c0cf17 (patch) | |
tree | 4a2f0fcf7341c596f50ec24ff0a5a81d43d17ccd /cmake | |
parent | 284fefb0c32e8222fadd78eeec6e7e718fe25668 (diff) | |
download | minetest-93fcab952b28f4db39d9326b83f14cbd86c0cf17.tar.gz minetest-93fcab952b28f4db39d9326b83f14cbd86c0cf17.tar.bz2 minetest-93fcab952b28f4db39d9326b83f14cbd86c0cf17.zip |
Clean up and tweak build system
* Combine client and server man pages.
* Update unit test options and available databases in man page.
* Add `--worldname` to man page.
* Fix a bunch of places where `"Minetest"` was used directly instead of `PROJECT_NAME`.
* Disable server build by default on all operating systems.
* Make `ENABLE_FREETYPE` not fail if FreeType isn't found.
* Enable LevelDB, Redis, and FreeType detection by default.
* Remove the `VERSION_PATCH_ORIG` hack.
* Add option to search for and use system JSONCPP.
* Remove broken LuaJIT version detection.
* Rename `DISABLE_LUAJIT` to `ENABLE_LUAJIT`.
* Rename `minetest_*` variables in `version.{h,cpp}` to `g_*`.
* Clean up style of CMake files.
Diffstat (limited to 'cmake')
-rw-r--r-- | cmake/Modules/FindCURL.cmake | 58 | ||||
-rw-r--r-- | cmake/Modules/FindGettextLib.cmake | 105 | ||||
-rw-r--r-- | cmake/Modules/FindIrrlicht.cmake | 49 | ||||
-rw-r--r-- | cmake/Modules/FindJson.cmake | 37 | ||||
-rw-r--r-- | cmake/Modules/FindLua.cmake | 25 | ||||
-rw-r--r-- | cmake/Modules/FindOpenGLES2.cmake | 186 | ||||
-rw-r--r-- | cmake/Modules/GenerateVersion.cmake | 5 | ||||
-rw-r--r-- | cmake/Modules/misc.cmake | 21 |
8 files changed, 215 insertions, 271 deletions
diff --git a/cmake/Modules/FindCURL.cmake b/cmake/Modules/FindCURL.cmake index 975b8088c..2ec866ef9 100644 --- a/cmake/Modules/FindCURL.cmake +++ b/cmake/Modules/FindCURL.cmake @@ -1,47 +1,19 @@ -# - Find curl -# Find the native CURL headers and libraries. -# -# CURL_INCLUDE_DIR - where to find curl/curl.h, etc. -# CURL_LIBRARY - List of libraries when using curl. -# CURL_FOUND - True if curl found. +mark_as_advanced(CURL_LIBRARY CURL_INCLUDE_DIR) -if( UNIX ) - FIND_PATH(CURL_INCLUDE_DIR NAMES curl.h - PATHS - /usr/local/include/curl - /usr/include/curl - ) +find_library(CURL_LIBRARY NAMES curl) +find_path(CURL_INCLUDE_DIR NAMES curl/curl.h) - FIND_LIBRARY(CURL_LIBRARY NAMES curl - PATHS - /usr/local/lib - /usr/lib - ) -else( UNIX ) - FIND_PATH(CURL_INCLUDE_DIR NAMES curl/curl.h) # Look for the header file. - FIND_LIBRARY(CURL_LIBRARY NAMES curl) # Look for the library. - FIND_FILE(CURL_DLL NAMES libcurl.dll - PATHS - "c:/windows/system32" - DOC "Path of the cURL dll (for installation)") - INCLUDE(FindPackageHandleStandardArgs) # handle the QUIETLY and REQUIRED arguments and set CURL_FOUND to TRUE if - FIND_PACKAGE_HANDLE_STANDARD_ARGS(CURL DEFAULT_MSG CURL_LIBRARY CURL_INCLUDE_DIR) # all listed variables are TRUE -endif( UNIX ) +set(CURL_REQUIRED_VARS CURL_LIBRARY CURL_INCLUDE_DIR) -if( WIN32 ) - if( CURL_LIBRARY AND CURL_INCLUDE_DIR AND CURL_DLL ) # libcurl.dll is required on Windows - SET(CURL_FOUND TRUE) - else( CURL_LIBRARY AND CURL_INCLUDE_DIR AND CURL_DLL ) - SET(CURL_FOUND FALSE) - endif( CURL_LIBRARY AND CURL_INCLUDE_DIR AND CURL_DLL ) -else ( WIN32 ) - if( CURL_LIBRARY AND CURL_INCLUDE_DIR ) - SET(CURL_FOUND TRUE) - else( CURL_LIBRARY AND CURL_INCLUDE_DIR ) - SET(CURL_FOUND FALSE) - endif( CURL_LIBRARY AND CURL_INCLUDE_DIR ) -endif ( WIN32 ) +if(WIN32) + find_file(CURL_DLL NAMES libcurl-4.dll + PATHS + "C:/Windows/System32" + DOC "Path to the cURL DLL (for installation)") + mark_as_advanced(CURL_DLL) + set(CURL_REQUIRED_VARS ${CURL_REQUIRED_VARS} CURL_DLL) +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(CURL DEFAULT_MSG ${CURL_REQUIRED_VARS}) -MESSAGE(STATUS "CURL_INCLUDE_DIR = ${CURL_INCLUDE_DIR}") -MESSAGE(STATUS "CURL_LIBRARY = ${CURL_LIBRARY}") -MESSAGE(STATUS "CURL_DLL = ${CURL_DLL}") diff --git a/cmake/Modules/FindGettextLib.cmake b/cmake/Modules/FindGettextLib.cmake index 5c992f0fa..cb1ce7b91 100644 --- a/cmake/Modules/FindGettextLib.cmake +++ b/cmake/Modules/FindGettextLib.cmake @@ -1,85 +1,78 @@ -# Package finder for gettext libs and include files -SET(CUSTOM_GETTEXT_PATH "${PROJECT_SOURCE_DIR}/../../gettext" +set(CUSTOM_GETTEXT_PATH "${PROJECT_SOURCE_DIR}/../../gettext" CACHE FILEPATH "path to custom gettext") -# by default -SET(GETTEXT_FOUND FALSE) - -FIND_PATH(GETTEXT_INCLUDE_DIR +find_path(GETTEXT_INCLUDE_DIR NAMES libintl.h PATHS "${CUSTOM_GETTEXT_PATH}/include" - DOC "gettext include directory") + DOC "GetText include directory") -FIND_PROGRAM(GETTEXT_MSGFMT +find_program(GETTEXT_MSGFMT NAMES msgfmt PATHS "${CUSTOM_GETTEXT_PATH}/bin" - DOC "path to msgfmt") + DOC "Path to msgfmt") + +set(GETTEXT_REQUIRED_VARS GETTEXT_INCLUDE_DIR GETTEXT_MSGFMT) if(APPLE) - FIND_LIBRARY(GETTEXT_LIBRARY + find_library(GETTEXT_LIBRARY NAMES libintl.a PATHS "${CUSTOM_GETTEXT_PATH}/lib" - DOC "gettext *intl*.lib") + DOC "GetText library") - FIND_LIBRARY(ICONV_LIBRARY + find_library(ICONV_LIBRARY NAMES libiconv.dylib PATHS "/usr/lib" - DOC "iconv lib") + DOC "IConv library") + set(GETTEXT_REQUIRED_VARS ${GETTEXT_REQUIRED_VARS} GETTEXT_LIBRARY ICONV_LIBRARY) endif(APPLE) -# modern Linux, as well as Mac, seem to not need require special linking -# they do not because gettext is part of glibc -# TODO check the requirements on other BSDs and older Linux -IF (WIN32) - IF(MSVC) - SET(GETTEXT_LIB_NAMES +# 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 + else() + set(GETTEXT_LIB_NAMES libintl.dll.a intl.dll.a libintl3.dll.a intl3.dll.a) - ENDIF() - FIND_LIBRARY(GETTEXT_LIBRARY + endif() + find_library(GETTEXT_LIBRARY NAMES ${GETTEXT_LIB_NAMES} PATHS "${CUSTOM_GETTEXT_PATH}/lib" - DOC "gettext *intl*.lib") - FIND_FILE(GETTEXT_DLL + 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 + find_file(GETTEXT_ICONV_DLL NAMES libiconv2.dll PATHS "${CUSTOM_GETTEXT_PATH}/bin" "${CUSTOM_GETTEXT_PATH}/lib" DOC "gettext *iconv*.lib") -ENDIF(WIN32) + set(GETTEXT_REQUIRED_VARS ${GETTEXT_REQUIRED_VARS} GETTEXT_DLL GETTEXT_ICONV_DLL) +endif(WIN32) + + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(GetText DEFAULT_MSG ${GETTEXT_REQUIRED_VARS}) + + +if(GETTEXT_FOUND) + # BSD variants require special linkage as they don't use glibc + if(${CMAKE_SYSTEM_NAME} MATCHES "BSD") + set(GETTEXT_LIBRARY "intl") + endif() -IF(GETTEXT_INCLUDE_DIR AND GETTEXT_MSGFMT) - IF (WIN32) - # in the Win32 case check also for the extra linking requirements - IF(GETTEXT_LIBRARY AND GETTEXT_DLL AND GETTEXT_ICONV_DLL) - SET(GETTEXT_FOUND TRUE) - ENDIF() - ELSE(WIN32) - # *BSD variants require special linkage as they don't use glibc - IF(${CMAKE_SYSTEM_NAME} MATCHES "BSD") - SET(GETTEXT_LIBRARY "intl") - ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "BSD") - SET(GETTEXT_FOUND TRUE) - ENDIF(WIN32) -ENDIF() + set(GETTEXT_PO_PATH ${CMAKE_SOURCE_DIR}/po) + set(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale/<locale>/LC_MESSAGES) + 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() -IF(GETTEXT_FOUND) - SET(GETTEXT_PO_PATH ${CMAKE_SOURCE_DIR}/po) - SET(GETTEXT_MO_BUILD_PATH ${CMAKE_BINARY_DIR}/locale/<locale>/LC_MESSAGES) - 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(SET_MO_PATHS) -ELSE() - SET(GETTEXT_INCLUDE_DIR "") - SET(GETTEXT_LIBRARY "") -ENDIF() diff --git a/cmake/Modules/FindIrrlicht.cmake b/cmake/Modules/FindIrrlicht.cmake index a84765d4e..8dda15722 100644 --- a/cmake/Modules/FindIrrlicht.cmake +++ b/cmake/Modules/FindIrrlicht.cmake @@ -1,7 +1,8 @@ -#FindIrrlicht.cmake +mark_as_advanced(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR IRRLICHT_DLL) set(IRRLICHT_SOURCE_DIR "" CACHE PATH "Path to irrlicht source directory (optional)") + # Find include directory if(NOT IRRLICHT_SOURCE_DIR STREQUAL "") @@ -24,65 +25,47 @@ if(NOT IRRLICHT_SOURCE_DIR STREQUAL "") set(IRRLICHT_LIBRARY_NAMES libIrrlicht.a) endif() - FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h + find_path(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h PATHS ${IRRLICHT_SOURCE_DIR_INCLUDE} NO_DEFAULT_PATH ) - FIND_LIBRARY(IRRLICHT_LIBRARY NAMES ${IRRLICHT_LIBRARY_NAMES} + find_library(IRRLICHT_LIBRARY NAMES ${IRRLICHT_LIBRARY_NAMES} PATHS ${IRRLICHT_SOURCE_DIR_LIBS} NO_DEFAULT_PATH ) else() - - FIND_PATH(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h + find_path(IRRLICHT_INCLUDE_DIR NAMES irrlicht.h PATHS /usr/local/include/irrlicht /usr/include/irrlicht ) - FIND_LIBRARY(IRRLICHT_LIBRARY NAMES libIrrlicht.so libIrrlicht.a Irrlicht + find_library(IRRLICHT_LIBRARY NAMES libIrrlicht.so libIrrlicht.a Irrlicht PATHS /usr/local/lib /usr/lib ) endif() -MESSAGE(STATUS "IRRLICHT_SOURCE_DIR = ${IRRLICHT_SOURCE_DIR}") -MESSAGE(STATUS "IRRLICHT_INCLUDE_DIR = ${IRRLICHT_INCLUDE_DIR}") -MESSAGE(STATUS "IRRLICHT_LIBRARY = ${IRRLICHT_LIBRARY}") -# On windows, find the dll for installation +# On Windows, find the DLL for installation if(WIN32) if(MSVC) - FIND_FILE(IRRLICHT_DLL NAMES Irrlicht.dll - PATHS - "${IRRLICHT_SOURCE_DIR}/bin/Win32-VisualStudio" - DOC "Path of the Irrlicht dll (for installation)" - ) + set(IRRLICHT_COMPILER "VisualStudio") else() - FIND_FILE(IRRLICHT_DLL NAMES Irrlicht.dll - PATHS - "${IRRLICHT_SOURCE_DIR}/bin/Win32-gcc" - DOC "Path of the Irrlicht dll (for installation)" - ) + set(IRRLICHT_COMPILER "gcc") endif() - MESSAGE(STATUS "IRRLICHT_DLL = ${IRRLICHT_DLL}") + find_file(IRRLICHT_DLL NAMES Irrlicht.dll + PATHS + "${IRRLICHT_SOURCE_DIR}/bin/Win32-${IRRLICHT_COMPILER}" + DOC "Path of the Irrlicht dll (for installation)" + ) endif(WIN32) -# handle the QUIETLY and REQUIRED arguments and set IRRLICHT_FOUND to TRUE if -# all listed variables are TRUE -INCLUDE(FindPackageHandleStandardArgs) -FIND_PACKAGE_HANDLE_STANDARD_ARGS(Irrlicht DEFAULT_MSG IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR) - -IF(IRRLICHT_FOUND) - SET(IRRLICHT_LIBRARIES ${IRRLICHT_LIBRARY}) -ELSE(IRRLICHT_FOUND) - SET(IRRLICHT_LIBRARIES) -ENDIF(IRRLICHT_FOUND) - -MARK_AS_ADVANCED(IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR IRRLICHT_DLL) +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(Irrlicht DEFAULT_MSG IRRLICHT_LIBRARY IRRLICHT_INCLUDE_DIR) diff --git a/cmake/Modules/FindJson.cmake b/cmake/Modules/FindJson.cmake index a9178a225..8e355b93f 100644 --- a/cmake/Modules/FindJson.cmake +++ b/cmake/Modules/FindJson.cmake @@ -1,18 +1,27 @@ -# Look for json, use our own if not found +# Look for JSONCPP if asked to. +# We use a bundled version by default because some distros ship versions of +# JSONCPP that cause segfaults and other memory errors when we link with them. +# See https://github.com/minetest/minetest/issues/1793 -#FIND_PATH(JSON_INCLUDE_DIR json.h) +mark_as_advanced(JSON_LIBRARY JSON_INCLUDE_DIR) +option(ENABLE_SYSTEM_JSONCPP "Enable using a system-wide JSONCPP. May cause segfaults and other memory errors!" FALSE) -#FIND_LIBRARY(JSON_LIBRARY NAMES jsoncpp) +if(ENABLE_SYSTEM_JSONCPP) + find_library(JSON_LIBRARY NAMES jsoncpp) + find_path(JSON_INCLUDE_DIR json/features.h) -#IF(JSON_LIBRARY AND JSON_INCLUDE_DIR) -# SET( JSON_FOUND TRUE ) -#ENDIF(JSON_LIBRARY AND JSON_INCLUDE_DIR) + include(FindPackageHandleStandardArgs) + find_package_handle_standard_args(JSONCPP DEFAULT_MSG JSON_LIBRARY JSON_INCLUDE_DIR) + + if(JSONCPP_FOUND) + message(STATUS "Using system JSONCPP library.") + endif() +endif() + +if(NOT JSONCPP_FOUND) + message(STATUS "Using bundled JSONCPP library.") + set(JSON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/json) + set(JSON_LIBRARY jsoncpp) + add_subdirectory(json) +endif() -#IF(JSON_FOUND) -# MESSAGE(STATUS "Found system jsoncpp header file in ${JSON_INCLUDE_DIR}") -# MESSAGE(STATUS "Found system jsoncpp library ${JSON_LIBRARY}") -#ELSE(JSON_FOUND) - SET(JSON_INCLUDE_DIR ${PROJECT_SOURCE_DIR}/json) - SET(JSON_LIBRARY jsoncpp) - MESSAGE(STATUS "Using project jsoncpp library") -#ENDIF(JSON_FOUND) diff --git a/cmake/Modules/FindLua.cmake b/cmake/Modules/FindLua.cmake new file mode 100644 index 000000000..479dfcf41 --- /dev/null +++ b/cmake/Modules/FindLua.cmake @@ -0,0 +1,25 @@ + +option(ENABLE_LUAJIT "Enable LuaJIT support" TRUE) +mark_as_advanced(LUA_LIBRARY LUA_INCLUDE_DIR) +set(USE_LUAJIT FALSE) + +if(ENABLE_LUAJIT) + find_library(LUA_LIBRARY luajit + NAMES luajit-5.1) + find_path(LUA_INCLUDE_DIR luajit.h + NAMES luajit.h + PATH_SUFFIXES luajit-2.0) + if(LUA_LIBRARY AND LUA_INCLUDE_DIR) + set(USE_LUAJIT TRUE) + endif() +else() + message (STATUS "LuaJIT detection disabled! (ENABLE_LUAJIT=0)") +endif() + +if(NOT USE_LUAJIT) + message(STATUS "LuaJIT not found, using bundled Lua.") + set(LUA_LIBRARY "lua") + set(LUA_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/lua/src") + add_subdirectory(lua) +endif() + diff --git a/cmake/Modules/FindOpenGLES2.cmake b/cmake/Modules/FindOpenGLES2.cmake index 42d31c898..96e5789e6 100644 --- a/cmake/Modules/FindOpenGLES2.cmake +++ b/cmake/Modules/FindOpenGLES2.cmake @@ -16,115 +16,97 @@ # EGL_INCLUDE_DIR - the EGL include directory # EGL_LIBRARIES - Link these to use EGL -# win32, apple, android NOT TESED -# linux tested and works - -IF (WIN32) - IF (CYGWIN) - - FIND_PATH(OPENGLES2_INCLUDE_DIR GLES2/gl2.h ) - - FIND_LIBRARY(OPENGLES2_gl_LIBRARY libGLESv2 ) - - ELSE (CYGWIN) - - IF(BORLAND) - SET (OPENGLES2_gl_LIBRARY import32 CACHE STRING "OpenGL ES 2.x library for win32") - ELSE(BORLAND) - # todo - # SET (OPENGLES_gl_LIBRARY ${SOURCE_DIR}/Dependencies/lib/release/libGLESv2.lib CACHE STRING "OpenGL ES 2.x library for win32" - ENDIF(BORLAND) - - ENDIF (CYGWIN) - -ELSE (WIN32) - - IF (APPLE) - +# Win32, Apple, and Android are not tested! +# Linux tested and works + +if(WIN32) + if(CYGWIN) + find_path(OPENGLES2_INCLUDE_DIR GLES2/gl2.h) + find_library(OPENGLES2_LIBRARY libGLESv2) + else() + if(BORLAND) + set(OPENGLES2_LIBRARY import32 CACHE STRING "OpenGL ES 2.x library for Win32") + else() + # TODO + # set(OPENGLES_LIBRARY ${SOURCE_DIR}/Dependencies/lib/release/libGLESv2.lib CACHE STRING "OpenGL ES 2.x library for win32" + else() + endif() +elseif(APPLE) create_search_paths(/Developer/Platforms) findpkg_framework(OpenGLES2) - set(OPENGLES2_gl_LIBRARY "-framework OpenGLES") - - ELSE(APPLE) - - FIND_PATH(OPENGLES2_INCLUDE_DIR GLES2/gl2.h - /usr/openwin/share/include - /opt/graphics/OpenGL/include /usr/X11R6/include - /usr/include - ) - - FIND_LIBRARY(OPENGLES2_gl_LIBRARY - NAMES GLESv2 - PATHS /opt/graphics/OpenGL/lib - /usr/openwin/lib - /usr/shlib /usr/X11R6/lib - /usr/lib - ) - - IF (NOT BUILD_ANDROID) - FIND_PATH(EGL_INCLUDE_DIR EGL/egl.h - /usr/openwin/share/include - /opt/graphics/OpenGL/include /usr/X11R6/include - /usr/include + set(OPENGLES2_LIBRARY "-framework OpenGLES") +else() + find_path(OPENGLES2_INCLUDE_DIR GLES2/gl2.h + PATHS /usr/openwin/share/include + /opt/graphics/OpenGL/include + /usr/X11R6/include + /usr/include + ) + + find_library(OPENGLES2_LIBRARY + NAMES GLESv2 + PATHS /opt/graphics/OpenGL/lib + /usr/openwin/lib + /usr/shlib /usr/X11R6/lib + /usr/lib + ) + + if(NOT BUILD_ANDROID) + find_path(EGL_INCLUDE_DIR EGL/egl.h + PATHS /usr/openwin/share/include + /opt/graphics/OpenGL/include + /usr/X11R6/include + /usr/include ) - FIND_LIBRARY(EGL_egl_LIBRARY - NAMES EGL - PATHS /opt/graphics/OpenGL/lib + find_library(EGL_LIBRARY + NAMES EGL + PATHS /opt/graphics/OpenGL/lib /usr/openwin/lib - /usr/shlib /usr/X11R6/lib + /usr/shlib + /usr/X11R6/lib /usr/lib ) - # On Unix OpenGL most certainly always requires X11. - # Feel free to tighten up these conditions if you don't - # think this is always true. - # It's not true on OSX. - - IF (OPENGLES2_gl_LIBRARY) - IF(NOT X11_FOUND) - INCLUDE(FindX11) - ENDIF(NOT X11_FOUND) - IF (X11_FOUND) - IF (NOT APPLE) - SET (OPENGLES2_LIBRARIES ${X11_LIBRARIES}) - ENDIF (NOT APPLE) - ENDIF (X11_FOUND) - ENDIF (OPENGLES2_gl_LIBRARY) - ENDIF () - - ENDIF(APPLE) -ENDIF (WIN32) - -#SET( OPENGLES2_LIBRARIES ${OPENGLES2_gl_LIBRARY} ${OPENGLES2_LIBRARIES}) - -IF (BUILD_ANDROID) - IF(OPENGLES2_gl_LIBRARY) - SET( OPENGLES2_LIBRARIES ${OPENGLES2_gl_LIBRARY} ${OPENGLES2_LIBRARIES}) - SET( EGL_LIBRARIES) - SET( OPENGLES2_FOUND "YES" ) - ENDIF(OPENGLES2_gl_LIBRARY) -ELSE () - - SET( OPENGLES2_LIBRARIES ${OPENGLES2_gl_LIBRARY} ${OPENGLES2_LIBRARIES}) - - IF(OPENGLES2_gl_LIBRARY AND EGL_egl_LIBRARY) - SET( OPENGLES2_LIBRARIES ${OPENGLES2_gl_LIBRARY} ${OPENGLES2_LIBRARIES}) - SET( EGL_LIBRARIES ${EGL_egl_LIBRARY} ${EGL_LIBRARIES}) - SET( OPENGLES2_FOUND "YES" ) - ENDIF(OPENGLES2_gl_LIBRARY AND EGL_egl_LIBRARY) - -ENDIF () - -MARK_AS_ADVANCED( - OPENGLES2_INCLUDE_DIR - OPENGLES2_gl_LIBRARY - EGL_INCLUDE_DIR - EGL_egl_LIBRARY + # On Unix OpenGL usually requires X11. + # It doesn't require X11 on OSX. + + if(OPENGLES2_LIBRARY) + if(NOT X11_FOUND) + include(FindX11) + endif() + if(X11_FOUND) + set(OPENGLES2_LIBRARIES ${X11_LIBRARIES}) + endif() + endif() + endif() +endif() + +set(OPENGLES2_LIBRARIES ${OPENGLES2_LIBRARIES} ${OPENGLES2_LIBRARY}) + +if(BUILD_ANDROID) + if(OPENGLES2_LIBRARY) + set(EGL_LIBRARIES) + set(OPENGLES2_FOUND TRUE) + endif() +else() + if(OPENGLES2_LIBRARY AND EGL_LIBRARY) + set(OPENGLES2_LIBRARIES ${OPENGLES2_LIBRARY} ${OPENGLES2_LIBRARIES}) + set(EGL_LIBRARIES ${EGL_LIBRARY} ${EGL_LIBRARIES}) + set(OPENGLES2_FOUND TRUE) + endif() +endif() + +mark_as_advanced( + OPENGLES2_INCLUDE_DIR + OPENGLES2_LIBRARY + EGL_INCLUDE_DIR + EGL_LIBRARY ) -IF(OPENGLES2_FOUND) - MESSAGE(STATUS "Found system opengles2 library ${OPENGLES2_LIBRARIES}") -ELSE () - SET(OPENGLES2_LIBRARIES "") -ENDIF () +if(OPENGLES2_FOUND) + message(STATUS "Found system OpenGL ES 2 library: ${OPENGLES2_LIBRARIES}") +else() + set(OPENGLES2_LIBRARIES "") +endif() + diff --git a/cmake/Modules/GenerateVersion.cmake b/cmake/Modules/GenerateVersion.cmake index 4a7f183da..76a0a90c6 100644 --- a/cmake/Modules/GenerateVersion.cmake +++ b/cmake/Modules/GenerateVersion.cmake @@ -2,14 +2,14 @@ if(VERSION_EXTRA) set(VERSION_GITHASH "${VERSION_STRING}") -else(VERSION_EXTRA) +else() execute_process(COMMAND git describe --always --tag --dirty WORKING_DIRECTORY "${GENERATE_VERSION_SOURCE_DIR}" OUTPUT_VARIABLE VERSION_GITHASH OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET) if(VERSION_GITHASH) - message(STATUS "*** Detected git version ${VERSION_GITHASH} ***") + message(STATUS "*** Detected Git version ${VERSION_GITHASH} ***") else() set(VERSION_GITHASH "${VERSION_STRING}") endif() @@ -18,3 +18,4 @@ endif() configure_file( ${GENERATE_VERSION_SOURCE_DIR}/cmake_config_githash.h.in ${GENERATE_VERSION_BINARY_DIR}/cmake_config_githash.h) + diff --git a/cmake/Modules/misc.cmake b/cmake/Modules/misc.cmake deleted file mode 100644 index 0bd2e3fce..000000000 --- a/cmake/Modules/misc.cmake +++ /dev/null @@ -1,21 +0,0 @@ -# -# Random macros -# - -# Not used ATM - -MACRO (GETDATETIME RESULT) - IF (WIN32) - EXECUTE_PROCESS(COMMAND "cmd" /C echo %date% %time% OUTPUT_VARIABLE ${RESULT}) - string(REGEX REPLACE "\n" "" ${RESULT} "${${RESULT}}") - ELSEIF(UNIX) - EXECUTE_PROCESS(COMMAND "date" "+%Y-%m-%d_%H:%M:%S" OUTPUT_VARIABLE ${RESULT}) - string(REGEX REPLACE "\n" "" ${RESULT} "${${RESULT}}") - ELSE (WIN32) - MESSAGE(SEND_ERROR "date not implemented") - SET(${RESULT} "Unknown") - ENDIF (WIN32) - - string(REGEX REPLACE " " "_" ${RESULT} "${${RESULT}}") -ENDMACRO (GETDATETIME) - |