|
|
@@ -46,15 +46,10 @@
|
|
|
# Urho3D - define target name
|
|
|
set (TARGET_NAME SDL)
|
|
|
|
|
|
-# Urho3D - commented out as we support both out-of- and in- source tree builds
|
|
|
-#if(${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
|
|
|
-# message(FATAL_ERROR "Prevented in-tree built. Please create a build directory outside of the SDL source code and call cmake from there")
|
|
|
-#endif()
|
|
|
-
|
|
|
-# Urho3D - commented out as we want SDL sub-library to remain within Urho3D "umbrella" project
|
|
|
-#cmake_minimum_required(VERSION 2.8)
|
|
|
-#project(SDL2 C)
|
|
|
-# Urho3D - instead, just enable the required language support and set the extra variables associated with project() command
|
|
|
+# Urho3D - commented out in-source tree build prevention as Urho3D supports both out-of-source and in-source tree builds
|
|
|
+
|
|
|
+# Urho3D - commented out setting SDL2 as project name as we want SDL sub-library to remain within Urho3D "umbrella" project
|
|
|
+# instead, just enable the required language support and set the extra variables associated with project() command
|
|
|
enable_language (C)
|
|
|
set (SDL2_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
|
|
|
set (SDL2_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR})
|
|
|
@@ -69,7 +64,6 @@ include(CheckTypeSize)
|
|
|
include(CheckStructHasMember)
|
|
|
include(CMakeDependentOption)
|
|
|
# Urho3D - bug fix - do not use pkg-config tool for detection as it only works for host environment and not for rooted environment when cross-compiling
|
|
|
-#include(FindPkgConfig)
|
|
|
# Urho3D - append SDL's CMake module directory into our global module search path
|
|
|
list (APPEND CMAKE_MODULE_PATH ${SDL2_SOURCE_DIR}/cmake)
|
|
|
include(${SDL2_SOURCE_DIR}/cmake/macros.cmake)
|
|
|
@@ -98,13 +92,11 @@ set(LT_REVISION "${SDL_INTERFACE_AGE}")
|
|
|
set(LT_RELEASE "${SDL_MAJOR_VERSION}.${SDL_MINOR_VERSION}")
|
|
|
set(LT_VERSION "${LT_MAJOR}.${LT_AGE}.${LT_REVISION}")
|
|
|
|
|
|
-# Urho3D - no debug print
|
|
|
-#message(STATUS "${LT_VERSION} :: ${LT_AGE} :: ${LT_REVISION} :: ${LT_CURRENT} :: ${LT_RELEASE}")
|
|
|
+# Urho3D - commented out debug print
|
|
|
|
|
|
# General settings & flags
|
|
|
# Urho3D - commented out LIBRARY_OUTPUT_DIRECTORY configuration so that it does not mess up with our global configuration setup
|
|
|
# Check for 64 or 32 bit
|
|
|
-set(SIZEOF_VOIDP ${CMAKE_SIZEOF_VOID_P})
|
|
|
# Urho3D - bug fix - using CMAKE_SIZEOF_VOID_P is not accurate in a situation where a multilib-capable compiler is chosen and user has opted to use non-native ABI; instead using URHO3D_64BIT build option as it also captures the user intention
|
|
|
if(URHO3D_64BIT)
|
|
|
set(ARCH_64 TRUE)
|
|
|
@@ -201,39 +193,7 @@ else()
|
|
|
set(OPT_DEF_ASM FALSE)
|
|
|
endif()
|
|
|
|
|
|
-# Default flags, if not set otherwise
|
|
|
-if("$ENV{CFLAGS}" STREQUAL "")
|
|
|
-# Urho3D - commented out as we have configured compiler flags as we want globally
|
|
|
-# if(USE_GCC OR USE_CLANG)
|
|
|
-# set(CMAKE_C_FLAGS "-g -O3")
|
|
|
-# endif()
|
|
|
-else()
|
|
|
-# set(CMAKE_C_FLAGS "$ENV{CFLAGS}")
|
|
|
- list(APPEND EXTRA_CFLAGS "$ENV{CFLAGS}")
|
|
|
-endif()
|
|
|
-if(NOT ("$ENV{CFLAGS}" STREQUAL "")) # Hackish, but does the trick on Win32
|
|
|
- list(APPEND EXTRA_LDFLAGS "$ENV{LDFLAGS}")
|
|
|
-endif()
|
|
|
-
|
|
|
-#if(MSVC)
|
|
|
-# option(FORCE_STATIC_VCRT "Force /MT for static VC runtimes" OFF)
|
|
|
-# if(FORCE_STATIC_VCRT)
|
|
|
-# foreach(flag_var
|
|
|
-# CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
|
|
-# CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
|
|
|
-# if(${flag_var} MATCHES "/MD")
|
|
|
-# string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}")
|
|
|
-# endif()
|
|
|
-# endforeach()
|
|
|
-# endif()
|
|
|
-#
|
|
|
-# # Make sure /RTC1 is disabled, otherwise it will use functions from the CRT
|
|
|
-# foreach(flag_var
|
|
|
-# CMAKE_C_FLAGS CMAKE_C_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE
|
|
|
-# CMAKE_C_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO)
|
|
|
-# string(REGEX REPLACE "/RTC(su|[1su])" "" ${flag_var} "${${flag_var}}")
|
|
|
-# endforeach(flag_var)
|
|
|
-#endif()
|
|
|
+# Urho3D - commented out compiler/linker flags setup as we have configured all our compiler/linker flags as we want globally
|
|
|
|
|
|
# Those are used for pkg-config and friends, so that the SDL2.pc, sdl2-config,
|
|
|
# etc. are created correctly.
|
|
|
@@ -245,8 +205,9 @@ set(SDL_CFLAGS "")
|
|
|
# restore back to that afterwards. For check_function_exists() to work in
|
|
|
# Emscripten, this value must be at its default value.
|
|
|
set(ORIG_CMAKE_REQUIRED_FLAGS ${CMAKE_REQUIRED_FLAGS})
|
|
|
-# Urho3D - safe the original CMake global settings
|
|
|
-set(ORIG_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
|
|
|
+# Urho3D - save the original CMake global settings, do not leave them to chances
|
|
|
+set (ORIG_CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES})
|
|
|
+set (ORIG_CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES})
|
|
|
|
|
|
if(CYGWIN)
|
|
|
# We build SDL on cygwin without the UNIX emulation layer
|
|
|
@@ -264,13 +225,12 @@ endif()
|
|
|
|
|
|
add_definitions(-DUSING_GENERATED_CONFIG_H)
|
|
|
# General includes
|
|
|
-# Urho3D - use 'generated' path suffix for generated config header file (need the suffix as we support both out-of-source in-source build tree)
|
|
|
+# Urho3D - use 'generated' path suffix for generated config header file, the suffic prevents overwriting the header file with the same name in the source tree in case of non out-of-source build tree is being used
|
|
|
set (INCLUDE_DIRS ${SDL2_BINARY_DIR}/include/generated ${SDL2_SOURCE_DIR}/include)
|
|
|
|
|
|
# All these ENABLED_BY_DEFAULT vars will default to ON if not specified, so
|
|
|
# you only need to have a platform override them if they are disabling.
|
|
|
-# Urho3D - it looks like a bug[?] because this variable is already initialized properly in "Compiler info" section above
|
|
|
-#set(OPT_DEF_ASM TRUE)
|
|
|
+# Urho3D - bug fix - commented out double initialization of the OPT_DEF_ASM variable, it has been initialized properly in "Compiler info" section above
|
|
|
if(EMSCRIPTEN)
|
|
|
# Set up default values for the currently supported set of subsystems:
|
|
|
# Emscripten/Javascript does not have assembly support, a dynamic library
|
|
|
@@ -302,6 +262,7 @@ foreach(_SUB ${SDL_SUBSYSTEMS})
|
|
|
option(SDL_${_OPT} "Enable the ${_SUB} subsystem" ${SDL_${_OPT}_ENABLED_BY_DEFAULT})
|
|
|
endforeach()
|
|
|
|
|
|
+# Urho3D - TODO - put all these options into SDL-specific namespace group, they are littering CMake-gui all over the place as it is now
|
|
|
option_string(ASSERTIONS "Enable internal sanity checks (auto/disabled/release/enabled/paranoid)" "auto")
|
|
|
#set_option(DEPENDENCY_TRACKING "Use gcc -MMD -MT dependency tracking" ON)
|
|
|
set_option(LIBC "Use the system C library" ${OPT_DEF_LIBC})
|
|
|
@@ -341,15 +302,13 @@ set_option(RPATH "Use an rpath when linking SDL" ${UNIX_SYS})
|
|
|
set_option(CLOCK_GETTIME "Use clock_gettime() instead of gettimeofday()" OFF)
|
|
|
set_option(INPUT_TSLIB "Use the Touchscreen library for input" ${UNIX_SYS})
|
|
|
set_option(VIDEO_X11 "Use X11 video driver" ${UNIX_SYS})
|
|
|
-# Urho3D - hide Wayland option for Android and RPI platforms
|
|
|
-dep_option(VIDEO_WAYLAND "Use Wayland video driver" ON "UNIX_SYS AND NOT ANDROID AND NOT RPI" OFF)
|
|
|
+dep_option(VIDEO_WAYLAND "Use Wayland video driver" ON UNIX_SYS OFF)
|
|
|
dep_option(WAYLAND_SHARED "Dynamically load Wayland support" ON "VIDEO_WAYLAND" OFF)
|
|
|
dep_option(VIDEO_WAYLAND_QT_TOUCH "QtWayland server support for Wayland video driver" ON "VIDEO_WAYLAND" OFF)
|
|
|
-# Urho3D - hide Mir option for Android and RPI platforms
|
|
|
-dep_option(VIDEO_MIR "Use Mir video driver" ON "UNIX_SYS AND NOT ANDROID AND NOT RPI" OFF)
|
|
|
+dep_option(VIDEO_MIR "Use Mir video driver" ON UNIX_SYS OFF)
|
|
|
dep_option(MIR_SHARED "Dynamically load Mir support" ON "VIDEO_MIR" OFF)
|
|
|
# Urho3D - only enable VIDEO_RPI on Raspberry-Pi platform
|
|
|
-dep_option(VIDEO_RPI "Use Raspberry Pi video driver" ON "RPI" OFF)
|
|
|
+dep_option(VIDEO_RPI "Use Raspberry Pi video driver" ON RPI OFF)
|
|
|
dep_option(X11_SHARED "Dynamically load X11 support" ON "VIDEO_X11" OFF)
|
|
|
set(SDL_X11_OPTIONS Xcursor Xinerama XInput Xrandr Xscrnsaver XShape Xvm)
|
|
|
foreach(_SUB ${SDL_X11_OPTIONS})
|
|
|
@@ -367,12 +326,12 @@ set(SDL_SHARED ${SDL_SHARED_ENABLED_BY_DEFAULT} CACHE BOOL "Build a shared versi
|
|
|
set(SDL_STATIC ON CACHE BOOL "Build a static version of the library")
|
|
|
|
|
|
# General source files
|
|
|
-# Urho3D - exclude source files from disabled subsystems
|
|
|
set (SOURCE_FILE_PATTERNS
|
|
|
${SDL2_SOURCE_DIR}/src/*.c
|
|
|
-# ${SDL2_SOURCE_DIR}/src/dynapi/*.c # Urho3D - disabled dynamic API
|
|
|
+# Urho3D - we always disable dynamic API, so commented out ${SDL2_SOURCE_DIR}/src/dynapi/*.c
|
|
|
${SDL2_SOURCE_DIR}/src/libm/*.c
|
|
|
${SDL2_SOURCE_DIR}/src/stdlib/*.c)
|
|
|
+# Urho3D - exclude source files from disabled subsystems
|
|
|
foreach (_SUB ATOMIC AUDIO CPUINFO EVENTS FILE RENDER THREADS TIMERS VIDEO)
|
|
|
string (TOLOWER ${_SUB} _DIR)
|
|
|
if (${SDL_${_SUB}})
|
|
|
@@ -437,12 +396,14 @@ if(USE_GCC OR USE_CLANG)
|
|
|
HAVE_GCC_PREFERRED_STACK_BOUNDARY)
|
|
|
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
|
|
|
|
|
|
-# Urho3D - we rely on GenerateExportHeader CMake module for configuring GCC/Clang visibility support
|
|
|
+# Urho3D - we rely on GenerateExportHeader CMake module for configuring GCC/Clang visibility attribute support
|
|
|
|
|
|
check_c_compiler_flag(-Wall HAVE_GCC_WALL)
|
|
|
if(HAVE_GCC_WALL)
|
|
|
list(APPEND EXTRA_CFLAGS "-Wall")
|
|
|
if(HAIKU)
|
|
|
+ # Urho3D - TODO - since we do not support HAIKU for now, we can leave the cflags configuration here
|
|
|
+ # However, when we do then it must be moved to our common module and/or just commented out
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-multichar")
|
|
|
endif()
|
|
|
endif()
|
|
|
@@ -468,7 +429,7 @@ if(ASSEMBLY)
|
|
|
|
|
|
# Urho3D - move the altivec, mmx, 3dnow, sse and sse2 checks to Urho3D common module which then configure the compiler flags globally
|
|
|
|
|
|
- # Urho3D - bug fix - do not use "-mfpmath=387" in EXTRA_CFLAGS, instead let the compiler to choose what's the best by itself (i.e. '387' for x86 and 'sse' for x86_64) and also to keep SDL library being built with the same option as all the other Urho3D software; besides the '387' is invalid when targeting arm64
|
|
|
+ # Urho3D - bug fix - do not use "-mfpmath=387" in EXTRA_CFLAGS, instead let the compiler to choose what's the best by itself (i.e. '387' for x86 and 'sse' for x86_64) and also to keep SDL library being built with the same option as Urho3D library and all the other 3rd-party sub-libraries; besides the '387' is invalid when targeting arm64
|
|
|
|
|
|
# Urho3D - commented out the HAVE_SSEMATH variable as it is not being used anywhere currently; furthermore compiler already emits __SSE_MATH__ or __SSE2_MATH__ as necessary on x86_64 ABI only; so instead of using HAVE_SSEMATH variable, we should actually use the __SSE_MATH__ or __SSE2_MATH__ compiler define if that is the original intention of having this variable
|
|
|
|
|
|
@@ -510,7 +471,26 @@ if(LIBC)
|
|
|
set(STDC_HEADERS 1)
|
|
|
else()
|
|
|
set(HAVE_LIBC TRUE)
|
|
|
+ # Urho3D - bug fix - starting since Raspbian Jessie the __USE_EXTERN_INLINE is defined in <features.h> causing stdlib.h to look for <bits/stdlib-bsearch.h> which is not in the system header search path on Raspberry-Pi platform
|
|
|
+ if (RPI)
|
|
|
+ find_path (STDLIB_BITS_INCLUDE_DIR NAMES bits/stdlib-bsearch.h PATH_SUFFIXES arm-linux-gnueabihf DOC "Raspberry-Pi stdlib's bits include directory")
|
|
|
+ if (STDLIB_BITS_INCLUDE_DIR)
|
|
|
+ include_directories (${STDLIB_BITS_INCLUDE_DIR})
|
|
|
+ endif ()
|
|
|
+ endif ()
|
|
|
+ # Urho3D - bug fix - when cross-compiling the headers are rooted, either use "--sysroot" compiler flag or use CMAKE_REQUIRED_INCLUDES (e.g. on RPI) to cater for it
|
|
|
+ set (CMAKE_REQUIRED_INCLUDES_SYS_TYPES_SAVED ${CMAKE_REQUIRED_INCLUDES})
|
|
|
+ if (CMAKE_CROSSCOMPILING AND NOT "${CMAKE_C_FLAGS} ${CMAKE_REQUIRED_FLAGS}" MATCHES sysroot)
|
|
|
+ find_path (SYS_TYPES_H_INCLUDE_DIRS NAMES sys/types.h)
|
|
|
+ if (SYS_TYPES_H_INCLUDE_DIRS)
|
|
|
+ # Assume the header search path has not been adjusted elsewhere yet, there is no harm anyway when a same entry is added twice into the list
|
|
|
+ list (APPEND CMAKE_REQUIRED_INCLUDES ${SYS_TYPES_H_INCLUDE_DIRS})
|
|
|
+ endif ()
|
|
|
+ endif ()
|
|
|
check_include_file(sys/types.h HAVE_SYS_TYPES_H)
|
|
|
+ set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SYS_TYPES_SAVED})
|
|
|
+ # Urho3D - no fix required - it seems all the compiler toolchains (native and X-compiling) that have been tested are able to find these headers correctly
|
|
|
+ # Android NDK is able to find these headers with the help of "--sysroot" compiler flags, while others like MinGW and Linaro GCC for RPI work out of box
|
|
|
foreach(_HEADER
|
|
|
stdio.h stdlib.h stddef.h stdarg.h malloc.h memory.h string.h
|
|
|
strings.h inttypes.h stdint.h ctype.h math.h iconv.h signal.h)
|
|
|
@@ -518,14 +498,16 @@ if(LIBC)
|
|
|
string(REPLACE "." "_" _HAVE_H ${_UPPER})
|
|
|
check_include_file("${_HEADER}" ${_HAVE_H})
|
|
|
endforeach()
|
|
|
-
|
|
|
- check_include_files("dlfcn.h;stdint.h;stddef.h;inttypes.h;stdlib.h;strings.h;string.h;float.h" STDC_HEADERS)
|
|
|
+ # Urho3D - bug fix - MinGW has standard-C headers, except dlfcn.h
|
|
|
+ set (CHECK_STDC_HEADERS stdint.h stddef.h inttypes.h stdlib.h strings.h string.h float.h)
|
|
|
+ if (NOT MINGW)
|
|
|
+ list (APPEND CHECK_STDC_HEADERS dlfcn.h)
|
|
|
+ endif ()
|
|
|
+ check_include_files("${CHECK_STDC_HEADERS}" STDC_HEADERS) # Stringify the INCLUDE list variable as this macro does not expect to receive a list
|
|
|
check_type_size("size_t" SIZEOF_SIZE_T)
|
|
|
check_symbol_exists(M_PI math.h HAVE_M_PI)
|
|
|
- # TODO: refine the mprotect check
|
|
|
- check_c_source_compiles("#include <sys/types.h>
|
|
|
- #include <sys/mman.h>
|
|
|
- int main() { }" HAVE_MPROTECT)
|
|
|
+ # Urho3D - for consistency sake use check_include_file() to check for HAVE_MPROTECT
|
|
|
+ check_include_file (sys/mman.h HAVE_MPROTECT)
|
|
|
foreach(_FN
|
|
|
strtod malloc calloc realloc free getenv setenv putenv unsetenv
|
|
|
qsort abs bcopy memset memcpy memmove memcmp strlen strlcpy strlcat
|
|
|
@@ -560,13 +542,13 @@ if(LIBC)
|
|
|
set(HAVE_ICONV 1)
|
|
|
endif()
|
|
|
|
|
|
- if(NOT APPLE)
|
|
|
- check_include_file(alloca.h HAVE_ALLOCA_H)
|
|
|
- check_function_exists(alloca HAVE_ALLOCA)
|
|
|
- else()
|
|
|
- set(HAVE_ALLOCA_H 1)
|
|
|
- set(HAVE_ALLOCA 1)
|
|
|
- endif()
|
|
|
+ # Urho3D - bug fix - cannot use check_function_exists() with alloca; with this bug fixed, the same check should work on Apple too so no more hardcoding
|
|
|
+ check_include_file(alloca.h HAVE_ALLOCA_H)
|
|
|
+ if (HAVE_ALLOCA_H)
|
|
|
+ check_c_source_compiles ("
|
|
|
+ #include <alloca.h>
|
|
|
+ int main(int argc, char** argv) { alloca(0); }" HAVE_ALLOCA)
|
|
|
+ endif ()
|
|
|
|
|
|
check_struct_has_member("struct sigaction" "sa_sigaction" "signal.h" HAVE_SA_SIGACTION)
|
|
|
endif()
|
|
|
@@ -644,8 +626,6 @@ if(ANDROID)
|
|
|
file(GLOB ANDROID_CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/android/*.c)
|
|
|
set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_CORE_SOURCES})
|
|
|
# Urho3D - bug fix - SDL_android_main.c will be added later when setting up actual Android targets
|
|
|
-# file(GLOB ANDROID_MAIN_SOURCES ${SDL2_SOURCE_DIR}/src/main/android/*.c)
|
|
|
-# set(SOURCE_FILES ${SOURCE_FILES} ${ANDROID_MAIN_SOURCES})
|
|
|
if(SDL_AUDIO)
|
|
|
set(SDL_AUDIO_DRIVER_ANDROID 1)
|
|
|
file(GLOB ANDROID_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/android/*.c)
|
|
|
@@ -770,7 +750,9 @@ elseif(UNIX AND NOT APPLE)
|
|
|
CheckVivante()
|
|
|
endif()
|
|
|
|
|
|
- if(LINUX)
|
|
|
+ # Urho3D - bug fix - CMake only supports 'Android' as a platform since 3.1.0, prior to that version the CMake/Android toolchain has to masquerade it as 'Linux' platform
|
|
|
+ # So, we have to make sure Linux input event handling is not being enabled for Android platform when older CMake is used
|
|
|
+ if(LINUX AND NOT ANDROID)
|
|
|
check_c_source_compiles("
|
|
|
#include <linux/input.h>
|
|
|
#ifndef EVIOCGNAME
|
|
|
@@ -807,34 +789,60 @@ elseif(UNIX AND NOT APPLE)
|
|
|
set(SDL_INPUT_LINUXKD 1)
|
|
|
endif()
|
|
|
|
|
|
- # Urho3D - bug fix - do not use check_include_file() command for detection as it only works for host environment and not for rooted environment when cross-compiling
|
|
|
- find_path (HAVE_LIBUDEV_H NAMES libudev.h)
|
|
|
- find_path (HAVE_DBUS_DBUS_H NAMES dbus/dbus.h PATH_SUFFIXES dbus-1.0)
|
|
|
- if (URHO3D_64BIT) # Cater for both 32/64bit Redhat-based and Debian-based distros
|
|
|
+ # Urho3D - bug fix - when cross-compiling the headers are rooted, either use "--sysroot" compiler flag or use CMAKE_REQUIRED_INCLUDES (e.g. on RPI) to cater for it
|
|
|
+ set (CMAKE_REQUIRED_INCLUDES_UDEV_DBUS_SAVED ${CMAKE_REQUIRED_INCLUDES})
|
|
|
+ if (CMAKE_CROSSCOMPILING AND NOT "${CMAKE_C_FLAGS} ${CMAKE_REQUIRED_FLAGS}" MATCHES sysroot)
|
|
|
+ find_path (UDEV_H_INCLUDE_DIRS libudev.h)
|
|
|
+ if (UDEV_H_INCLUDE_DIRS)
|
|
|
+ list (APPEND CMAKE_REQUIRED_INCLUDES ${UDEV_H_INCLUDE_DIRS} ${SYS_TYPES_H_INCLUDE_DIRS})
|
|
|
+ endif ()
|
|
|
+ endif ()
|
|
|
+ check_include_file("libudev.h" HAVE_LIBUDEV_H)
|
|
|
+ if (HAVE_LIBUDEV_H AND UDEV_H_INCLUDE_DIRS)
|
|
|
+ include_directories (${UDEV_H_INCLUDE_DIRS})
|
|
|
+ endif ()
|
|
|
+ # Urho3D - bug fix - dbus/dbus.h is installed under path suffix 'dbus-1.0', so the following find_path() is needed even when not cross-compiling
|
|
|
+ find_path (DBUS_H_INCLUDE_DIRS NAMES dbus/dbus.h PATH_SUFFIXES dbus-1.0)
|
|
|
+ # Cater for both 32/64bit Redhat-based/Debian-based distros and 32-bit Raspberry-Pi as dbus-arch-deps header search paths are a little bit unusual
|
|
|
+ # FIXME: Is there a better way than hardcoding these?
|
|
|
+ if (URHO3D_64BIT)
|
|
|
set (DBUS_INC_SEARCH_PATH /usr/lib64/dbus-1.0/include /usr/lib/x86_64-linux-gnu/dbus-1.0/include)
|
|
|
else ()
|
|
|
- set (DBUS_INC_SEARCH_PATH /usr/lib/dbus-1.0/include /usr/lib/i386-linux-gnu/dbus-1.0/include)
|
|
|
+ set (DBUS_INC_SEARCH_PATH /usr/lib/dbus-1.0/include /usr/lib/i386-linux-gnu/dbus-1.0/include /usr/lib/arm-linux-gnueabihf/dbus-1.0/include)
|
|
|
endif ()
|
|
|
- find_path (HAVE_DBUS_DBUS_ARCH_DEPS_H NAMES dbus/dbus-arch-deps.h PATHS ${DBUS_INC_SEARCH_PATH})
|
|
|
- if (HAVE_LIBUDEV_H AND HAVE_DBUS_DBUS_H AND HAVE_DBUS_DBUS_ARCH_DEPS_H)
|
|
|
- # All or nothing
|
|
|
- include_directories (${HAVE_LIBUDEV_H} ${HAVE_DBUS_DBUS_H} ${HAVE_DBUS_DBUS_ARCH_DEPS_H})
|
|
|
- else ()
|
|
|
- foreach (VAR HAVE_LIBUDEV_H HAVE_DBUS_DBUS_H HAVE_DBUS_DBUS_ARCH_DEPS_H)
|
|
|
- unset (${VAR} CACHE)
|
|
|
- unset (${VAR})
|
|
|
- endforeach()
|
|
|
+ find_path (DBUS_ARCH_DEPS_H_INCLUDE_DIRS NAMES dbus/dbus-arch-deps.h PATHS ${DBUS_INC_SEARCH_PATH})
|
|
|
+ set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_UDEV_DBUS_SAVED} ${DBUS_H_INCLUDE_DIRS} ${DBUS_ARCH_DEPS_H_INCLUDE_DIRS})
|
|
|
+ check_include_file("dbus/dbus.h" HAVE_DBUS_DBUS_H)
|
|
|
+ if (HAVE_DBUS_DBUS_H AND DBUS_H_INCLUDE_DIRS AND DBUS_ARCH_DEPS_H_INCLUDE_DIRS)
|
|
|
+ include_directories (${DBUS_H_INCLUDE_DIRS} ${DBUS_ARCH_DEPS_H_INCLUDE_DIRS})
|
|
|
endif ()
|
|
|
+ set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_UDEV_DBUS_SAVED})
|
|
|
+
|
|
|
+ # Urho3D - bug fix - moved below logic from generic Unix block to Linux-specific block; this also prevents Linux power management from being enabled for Android platform when CMake prior to 3.1.0 is used
|
|
|
+ if(SDL_POWER)
|
|
|
+ set(SDL_POWER_LINUX 1)
|
|
|
+ file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/linux/*.c)
|
|
|
+ set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES})
|
|
|
+ set(HAVE_SDL_POWER TRUE)
|
|
|
+ endif()
|
|
|
endif()
|
|
|
|
|
|
if(INPUT_TSLIB)
|
|
|
- check_c_source_compiles("
|
|
|
- #include \"tslib.h\"
|
|
|
- int main(int argc, char** argv) { }" HAVE_INPUT_TSLIB)
|
|
|
+ # Urho3D - bug fix - when cross-compiling the headers are rooted, either use "--sysroot" compiler flag or use CMAKE_REQUIRED_INCLUDES (e.g. on RPI) to cater for it
|
|
|
+ set (CMAKE_REQUIRED_INCLUDES_TSLIB_SAVED ${CMAKE_REQUIRED_INCLUDES})
|
|
|
+ if (CMAKE_CROSSCOMPILING AND NOT "${CMAKE_C_FLAGS} ${CMAKE_REQUIRED_FLAGS}" MATCHES sysroot)
|
|
|
+ find_path (TSLIB_H_INCLUDE_DIRS NAMES tslib.h)
|
|
|
+ if (TSLIB_H_INCLUDE_DIRS)
|
|
|
+ # Assume the header search path has not been adjusted elsewhere yet, there is no harm anyway when a same entry is added twice into the list
|
|
|
+ list (APPEND CMAKE_REQUIRED_INCLUDES ${TSLIB_H_INCLUDE_DIRS})
|
|
|
+ endif ()
|
|
|
+ endif ()
|
|
|
+ check_include_file (tslib.h HAVE_INPUT_TSLIB)
|
|
|
if(HAVE_INPUT_TSLIB)
|
|
|
set(SDL_INPUT_TSLIB 1)
|
|
|
list(APPEND EXTRA_LIBS ts)
|
|
|
endif()
|
|
|
+ set (CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_TSLIB_SAVED})
|
|
|
endif()
|
|
|
|
|
|
if(SDL_JOYSTICK)
|
|
|
@@ -862,19 +870,7 @@ elseif(UNIX AND NOT APPLE)
|
|
|
endif()
|
|
|
endif()
|
|
|
|
|
|
- check_include_file(linux/version.h HAVE_LINUX_VERSION_H)
|
|
|
- if(HAVE_LINUX_VERSION_H)
|
|
|
- set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -DHAVE_LINUX_VERSION_H")
|
|
|
- endif()
|
|
|
-
|
|
|
- if(SDL_POWER)
|
|
|
- if(LINUX)
|
|
|
- set(SDL_POWER_LINUX 1)
|
|
|
- file(GLOB POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/linux/*.c)
|
|
|
- set(SOURCE_FILES ${SOURCE_FILES} ${POWER_SOURCES})
|
|
|
- set(HAVE_SDL_POWER TRUE)
|
|
|
- endif()
|
|
|
- endif()
|
|
|
+ # Urho3D - commented out setting of HAVE_LINUX_VERSION_H compiler define via cflags as that define is not being used at all, besides we prefer add_definitions()
|
|
|
|
|
|
# Urho3D - bug fix - do not use Unix filesystem for Android platform
|
|
|
if(SDL_FILESYSTEM AND NOT ANDROID)
|
|
|
@@ -898,17 +894,22 @@ elseif(UNIX AND NOT APPLE)
|
|
|
elseif(SOLARIS)
|
|
|
set(SDL_RLD_FLAGS "-R\${libdir}")
|
|
|
endif()
|
|
|
- # Urho3D - commented out as we have configured our RPATH setup globally
|
|
|
- #set(CMAKE_BUILD_WITH_INSTALL_RPATH TRUE)
|
|
|
+ # Urho3D - commented out RPATH setup as we have configured ours globally
|
|
|
set(HAVE_RPATH TRUE)
|
|
|
endif()
|
|
|
|
|
|
elseif(WINDOWS)
|
|
|
- find_program(WINDRES windres)
|
|
|
+ # Urho3D - bug fix - when using MinGW in cross-compiling build, the windres tool is being prefixed as other GCC cross-compiling tools
|
|
|
+ if (MINGW)
|
|
|
+ if (CMAKE_CROSSCOMPILING)
|
|
|
+ set (WINDRES ${CMAKE_RC_COMPILER}) # The CMAKE_RC_COMPILER variable is already initialized in our CMake/MinGW toolchain file
|
|
|
+ else ()
|
|
|
+ find_program(WINDRES windres)
|
|
|
+ endif ()
|
|
|
+ endif ()
|
|
|
|
|
|
- check_c_source_compiles("
|
|
|
- #include <windows.h>
|
|
|
- int main(int argc, char **argv) { }" HAVE_WIN32_CC)
|
|
|
+ # Urho3D - replace the windows.h check by using check_include_file() instead of check_c_source_files()
|
|
|
+ check_include_file (windows.h HAVE_WIN32_CC)
|
|
|
|
|
|
file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/windows/*.c)
|
|
|
set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES})
|
|
|
@@ -927,16 +928,8 @@ elseif(WINDOWS)
|
|
|
set(CMAKE_REQUIRED_FLAGS "/I\"$ENV{DXSDK_DIR}\\Include\"")
|
|
|
endif()
|
|
|
|
|
|
- if(HAVE_WIN32_CC)
|
|
|
- # xinput.h may need windows.h, but doesn't include it itself.
|
|
|
- check_c_source_compiles("
|
|
|
- #include <windows.h>
|
|
|
- #include <xinput.h>
|
|
|
- int main(int argc, char **argv) { }" HAVE_XINPUT_H)
|
|
|
- else()
|
|
|
- check_include_file(xinput.h HAVE_XINPUT_H)
|
|
|
- endif()
|
|
|
-
|
|
|
+ # Urho3D - simplify the check for xinput.h
|
|
|
+ check_include_file(xinput.h HAVE_XINPUT_H)
|
|
|
check_include_file(d3d9.h HAVE_D3D_H)
|
|
|
check_include_file(d3d11_1.h HAVE_D3D11_H)
|
|
|
check_include_file(ddraw.h HAVE_DDRAW_H)
|
|
|
@@ -1319,9 +1312,7 @@ set(EXTRA_CFLAGS ${_EXTRA_CFLAGS})
|
|
|
|
|
|
# Compat helpers for the configuration files
|
|
|
if(NOT WINDOWS OR CYGWIN)
|
|
|
-# Urho3D - the script won't work on Linux too as it assumes hg to be the version source control which is not the case in our case
|
|
|
-# # TODO: we need a Windows script, too
|
|
|
-# execute_process(COMMAND sh ${SDL2_SOURCE_DIR}/build-scripts/updaterev.sh)
|
|
|
+# Urho3D - commeted out the call to updaterev.sh script as it won't work on any platform as it assumes hg to be the version source control which is not the case in our case
|
|
|
|
|
|
set(prefix ${CMAKE_INSTALL_PREFIX})
|
|
|
set(exec_prefix "\${prefix}")
|
|
|
@@ -1356,18 +1347,12 @@ if(NOT WINDOWS OR CYGWIN)
|
|
|
# MESSAGE(STATUS "SDL_STATIC_LIBS: ${SDL_STATIC_LIBS}")
|
|
|
|
|
|
# Urho3D - commented out pkg-config configuration file generation
|
|
|
-# configure_file("${SDL2_SOURCE_DIR}/sdl2.pc.in"
|
|
|
-# "${SDL2_BINARY_DIR}/sdl2.pc" @ONLY)
|
|
|
-# configure_file("${SDL2_SOURCE_DIR}/sdl2-config.in"
|
|
|
-# "${SDL2_BINARY_DIR}/sdl2-config")
|
|
|
-# configure_file("${SDL2_SOURCE_DIR}/sdl2-config.in"
|
|
|
-# "${SDL2_BINARY_DIR}/sdl2-config" @ONLY)
|
|
|
-# configure_file("${SDL2_SOURCE_DIR}/SDL2.spec.in"
|
|
|
-# "${SDL2_BINARY_DIR}/SDL2.spec" @ONLY)
|
|
|
endif()
|
|
|
|
|
|
# Urho3D - restore the original CMake global settings
|
|
|
-set(CMAKE_REQUIRED_INCLUDES ${ORIG_CMAKE_REQUIRED_INCLUDES})
|
|
|
+set (CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
|
|
|
+set (CMAKE_REQUIRED_INCLUDES ${ORIG_CMAKE_REQUIRED_INCLUDES})
|
|
|
+set (CMAKE_REQUIRED_LIBRARIES ${ORIG_CMAKE_REQUIRED_LIBRARIES})
|
|
|
|
|
|
# Urho3D - only echo the status once during initial configuration
|
|
|
if (NOT SDL_INFO_ECHOED_STATUS)
|