Take advantage of CMAKE_SYSROOT available in the newer CMake.
Use CMAKE_SYSROOT to manage the sysroot automatically when cross-compiling instead of adding the '--sysroot' flag manually everywhere. We only need to add it manually in places where CMake does not, like in our custom GCC/Clang response file for PCH. Differentiate between setting up header search path for system headers and for application headers so that GCC/Clang may suppress compilation warnings from the former, if any.
This commit is contained in:
Родитель
2738ca2546
Коммит
ffd24cafa1
|
@ -236,6 +236,10 @@ else ()
|
|||
endif ()
|
||||
endif ()
|
||||
set (COMPILER_FLAGS "${COMPILER_32BIT_FLAG} ${CMAKE_REQUIRED_FLAGS}")
|
||||
# FIXME: For yet an unknown reason, CMake seems to fail to setup the sysroot as expected here, so we have to set it manually
|
||||
if (ANDROID)
|
||||
set (COMPILER_FLAGS "${COMPILER_FLAGS} --sysroot=\"${CMAKE_SYSROOT}\"")
|
||||
endif ()
|
||||
while (NOT URHO3D_COMPILE_RESULT)
|
||||
try_compile (URHO3D_COMPILE_RESULT ${CMAKE_BINARY_DIR} ${CMAKE_CURRENT_LIST_DIR}/CheckUrho3DLibrary.cpp
|
||||
CMAKE_FLAGS -DCOMPILE_DEFINITIONS:STRING=${COMPILER_FLAGS} -DLINK_LIBRARIES:STRING=${URHO3D_LIBRARIES} -DINCLUDE_DIRECTORIES:STRING=${URHO3D_INCLUDE_DIRS} ${COMPILER_STATIC_DEFINE} ${COMPILER_STATIC_RUNTIME_FLAGS}
|
||||
|
|
|
@ -88,11 +88,11 @@ include (CheckCompilerToolchain)
|
|||
# Extra linker flags for linking against indirect dependencies (linking shared lib with dependencies)
|
||||
if (RPI)
|
||||
# Extra linker flags for Raspbian because it installs VideoCore libraries in the "/opt/vc/lib" directory (no harm in doing so for other distros)
|
||||
set (INDIRECT_DEPS_EXE_LINKER_FLAGS "${INDIRECT_DEPS_EXE_LINKER_FLAGS} -Wl,-rpath-link,\"${RPI_SYSROOT}/opt/vc/lib\"") # RPI_SYSROOT is empty when not cross-compiling
|
||||
set (INDIRECT_DEPS_EXE_LINKER_FLAGS "${INDIRECT_DEPS_EXE_LINKER_FLAGS} -Wl,-rpath-link,\"${CMAKE_SYSROOT}/opt/vc/lib\"") # CMAKE_SYSROOT is empty when not cross-compiling
|
||||
endif ()
|
||||
if (ARM AND CMAKE_SYSTEM_NAME STREQUAL Linux AND CMAKE_CROSSCOMPILING)
|
||||
# Cannot do this in the toolchain file because CMAKE_LIBRARY_ARCHITECTURE is not yet defined when CMake is processing toolchain file
|
||||
set (INDIRECT_DEPS_EXE_LINKER_FLAGS "${INDIRECT_DEPS_EXE_LINKER_FLAGS} -Wl,-rpath-link,\"${ARM_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}\":\"${ARM_SYSROOT}/lib/${CMAKE_LIBRARY_ARCHITECTURE}\"")
|
||||
set (INDIRECT_DEPS_EXE_LINKER_FLAGS "${INDIRECT_DEPS_EXE_LINKER_FLAGS} -Wl,-rpath-link,\"${CMAKE_SYSROOT}/usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}\":\"${CMAKE_SYSROOT}/lib/${CMAKE_LIBRARY_ARCHITECTURE}\"")
|
||||
endif ()
|
||||
set (CMAKE_REQUIRED_FLAGS "${INDIRECT_DEPS_EXE_LINKER_FLAGS} ${CMAKE_REQUIRED_FLAGS}")
|
||||
set (CMAKE_EXE_LINKER_FLAGS "${INDIRECT_DEPS_EXE_LINKER_FLAGS} ${CMAKE_EXE_LINKER_FLAGS}")
|
||||
|
@ -119,7 +119,7 @@ endif ()
|
|||
if (RPI)
|
||||
# TODO: this logic is earmarked to be moved into SDL's CMakeLists.txt when refactoring the library dependency handling
|
||||
find_package (VideoCore REQUIRED)
|
||||
include_directories (${VIDEOCORE_INCLUDE_DIRS})
|
||||
include_directories (SYSTEM ${VIDEOCORE_INCLUDE_DIRS})
|
||||
link_directories (${VIDEOCORE_LIBRARY_DIRS})
|
||||
endif ()
|
||||
if (CMAKE_PROJECT_NAME STREQUAL Urho3D)
|
||||
|
@ -323,8 +323,7 @@ if (URHO3D_LUAJIT)
|
|||
endif ()
|
||||
|
||||
# Union all the sysroot variables into one so it can be referred to generically later
|
||||
# TODO: to be replaced with CMAKE_SYSROOT later if it is more beneficial
|
||||
set (SYSROOT ${ANDROID_SYSROOT} ${RPI_SYSROOT} ${ARM_SYSROOT} ${MINGW_SYSROOT} ${IOS_SYSROOT} ${EMSCRIPTEN_SYSROOT} CACHE INTERNAL "Path to system root of the cross-compiling target") # SYSROOT is empty for native build
|
||||
set (SYSROOT ${CMAKE_SYSROOT} ${MINGW_SYSROOT} ${IOS_SYSROOT} ${EMSCRIPTEN_SYSROOT} CACHE INTERNAL "Path to system root of the cross-compiling target") # SYSROOT is empty for native build
|
||||
|
||||
# Clang tools building
|
||||
if (URHO3D_CLANG_TOOLS OR URHO3D_BINDINGS)
|
||||
|
@ -422,7 +421,7 @@ if (WIN32 AND NOT CMAKE_PROJECT_NAME MATCHES ^Urho3D-ExternalProject-)
|
|||
endif ()
|
||||
find_package (DirectX REQUIRED ${DIRECTX_REQUIRED_COMPONENTS} OPTIONAL_COMPONENTS ${DIRECTX_OPTIONAL_COMPONENTS})
|
||||
if (DIRECTX_FOUND)
|
||||
include_directories (${DIRECTX_INCLUDE_DIRS}) # These variables may be empty when WinSDK or MinGW is being used
|
||||
include_directories (SYSTEM ${DIRECTX_INCLUDE_DIRS}) # These variables may be empty when WinSDK or MinGW is being used
|
||||
link_directories (${DIRECTX_LIBRARY_DIRS})
|
||||
endif ()
|
||||
endif ()
|
||||
|
@ -902,12 +901,15 @@ macro (enable_pch HEADER_PATHNAME)
|
|||
string (REPLACE ";" " -D" COMPILE_DEFINITIONS "-D${COMPILE_DEFINITIONS}")
|
||||
string (REPLACE "\"" "\\\"" COMPILE_DEFINITIONS ${COMPILE_DEFINITIONS})
|
||||
string (REPLACE ";" "\" -I\"" INCLUDE_DIRECTORIES "-I\"${INCLUDE_DIRECTORIES}\"")
|
||||
if (CMAKE_SYSROOT)
|
||||
set (SYSROOT_FLAGS "--sysroot=\"${CMAKE_SYSROOT}\"")
|
||||
endif ()
|
||||
# Make sure the precompiled headers are not stale by creating custom rules to re-compile the header as necessary
|
||||
file (MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${PCH_FILENAME})
|
||||
foreach (CONFIG ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE}) # These two vars are mutually exclusive
|
||||
# Generate *.rsp containing configuration specific compiler flags
|
||||
string (TOUPPER ${CONFIG} UPPERCASE_CONFIG)
|
||||
file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp.new "${COMPILE_DEFINITIONS} ${CLANG_${LANG}_FLAGS} ${CMAKE_${LANG}_FLAGS} ${CMAKE_${LANG}_FLAGS_${UPPERCASE_CONFIG}} ${COMPILER_EXPORT_FLAGS} ${INCLUDE_DIRECTORIES} -c -x ${LANG_H}")
|
||||
file (WRITE ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp.new "${COMPILE_DEFINITIONS} ${SYSROOT_FLAGS} ${CLANG_${LANG}_FLAGS} ${CMAKE_${LANG}_FLAGS} ${CMAKE_${LANG}_FLAGS_${UPPERCASE_CONFIG}} ${COMPILER_EXPORT_FLAGS} ${INCLUDE_DIRECTORIES} -c -x ${LANG_H}")
|
||||
execute_process (COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp.new ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp)
|
||||
file (REMOVE ${CMAKE_CURRENT_BINARY_DIR}/${HEADER_FILENAME}.${CONFIG}.pch.rsp.new)
|
||||
# Determine the dependency list
|
||||
|
|
|
@ -1319,6 +1319,10 @@ else()
|
|||
set( ANDROID_CXX_FLAGS "--sysroot=${ANDROID_SYSROOT}" )
|
||||
endif()
|
||||
|
||||
# Urho3D: take advantage of CMAKE_SYSROOT variable for setting up of sysroot
|
||||
set( CMAKE_SYSROOT ${ANDROID_SYSROOT} )
|
||||
unset( ANDROID_CXX_FLAGS )
|
||||
|
||||
# NDK flags
|
||||
if (ARM64_V8A )
|
||||
set( ANDROID_CXX_FLAGS "${ANDROID_CXX_FLAGS} -funwind-tables" )
|
||||
|
@ -1664,7 +1668,8 @@ set( BUILD_ANDROID True )
|
|||
|
||||
# where is the target environment
|
||||
# Urho3D: bug fix - should just add paths that look like a system root
|
||||
set( CMAKE_FIND_ROOT_PATH ${ANDROID_TOOLCHAIN_ROOT} ${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME} ${ANDROID_SYSROOT} )
|
||||
# Urho3D: we don't even need it now because setting CMAKE_SYSROOT will also do this for us
|
||||
#set( CMAKE_FIND_ROOT_PATH ${ANDROID_TOOLCHAIN_ROOT} ${ANDROID_TOOLCHAIN_ROOT}/${ANDROID_TOOLCHAIN_MACHINE_NAME} ${ANDROID_SYSROOT} )
|
||||
|
||||
# only search for libraries and includes in the ndk toolchain
|
||||
set( CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY )
|
||||
|
|
|
@ -94,14 +94,7 @@ if (NOT ARM_SYSROOT)
|
|||
set (ARM_PREFIX ${ARM_PREFIX} CACHE STRING "Prefix path to ARM cross-compiler tools (ARM on Linux cross-compiling build only)" FORCE)
|
||||
set (ARM_SYSROOT ${ARM_SYSROOT} CACHE PATH "Path to ARM system root (ARM on Linux cross-compiling build only)" FORCE)
|
||||
endif ()
|
||||
set (CMAKE_FIND_ROOT_PATH ${ARM_SYSROOT})
|
||||
|
||||
# cache flags (use the same trick found in android.toolchain.cmake)
|
||||
set (CMAKE_C_FLAGS "" CACHE STRING "C compiler flags")
|
||||
set (CMAKE_CXX_FLAGS "" CACHE STRING "C++ compiler flags")
|
||||
# finish flags
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=${ARM_SYSROOT}")
|
||||
set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} --sysroot=${ARM_SYSROOT}")
|
||||
set (CMAKE_SYSROOT ${ARM_SYSROOT})
|
||||
|
||||
# only search libraries, and headers in the target directories
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
|
|
@ -98,7 +98,7 @@ if (NOT RPI_SYSROOT OR NOT VIDEOCORE_INCLUDE_DIRS OR NOT VIDEOCORE_LIBRARIES)
|
|||
set (RPI_PREFIX ${RPI_PREFIX} CACHE STRING "Prefix path to Raspberry Pi cross-compiler tools (RPI cross-compiling build only)" FORCE)
|
||||
set (RPI_SYSROOT ${RPI_SYSROOT} CACHE PATH "Path to Raspberry Pi system root (RPI cross-compiling build only)" FORCE)
|
||||
endif ()
|
||||
set (CMAKE_FIND_ROOT_PATH ${RPI_SYSROOT})
|
||||
set (CMAKE_SYSROOT ${RPI_SYSROOT})
|
||||
|
||||
# only search libraries, and headers in the target directories
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
|
|
|
@ -55,8 +55,7 @@ endif ()
|
|||
|
||||
# LLVM/Clang is assumed to be installed in a system-wide location when not explicitily defined using env-var
|
||||
if (DEFINED ENV{LLVM_CLANG_ROOT})
|
||||
link_directories ($ENV{LLVM_CLANG_ROOT}/lib)
|
||||
include_directories ($ENV{LLVM_CLANG_ROOT}/include)
|
||||
set (CMAKE_SYSROOT $ENV{LLVM_CLANG_ROOT})
|
||||
endif ()
|
||||
execute_process (COMMAND ${LLVM_CONFIG} --bindir OUTPUT_VARIABLE LLVM_BINDIR OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET)
|
||||
|
||||
|
|
|
@ -29,10 +29,6 @@ define_source_files (GLOB_CPP_PATTERNS src/*.c GLOB_H_PATTERNS src/*.h EXCLUDE_P
|
|||
# Define dependency libs
|
||||
if (READLINE_FOUND)
|
||||
add_definitions (-DLUA_USE_READLINE)
|
||||
# FIXME: temporary quick fix
|
||||
if (RPI AND CMAKE_CROSSCOMPILING)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=\"${SYSROOT}\"")
|
||||
endif ()
|
||||
list (APPEND INCLUDE_DIRS ${READLINE_INCLUDE_DIRS})
|
||||
list (APPEND LIBS ${READLINE_LIBRARIES})
|
||||
endif ()
|
||||
|
|
|
@ -977,7 +977,7 @@ elseif(UNIX) # Urho3D - at this point both UNIX and UNIX_SYS should be equiva
|
|||
find_path (UDEV_H_INCLUDE_DIRS libudev.h)
|
||||
if (UDEV_H_INCLUDE_DIRS)
|
||||
set (HAVE_LIBUDEV_H TRUE)
|
||||
include_directories (${UDEV_H_INCLUDE_DIRS})
|
||||
include_directories (SYSTEM ${UDEV_H_INCLUDE_DIRS})
|
||||
# TODO: find the shared library and store the result in the SDL_UDEV_DYNAMIC variable
|
||||
endif ()
|
||||
|
||||
|
@ -992,7 +992,7 @@ elseif(UNIX) # Urho3D - at this point both UNIX and UNIX_SYS should be equiva
|
|||
find_path (DBUS_ARCH_DEPS_H_INCLUDE_DIRS NAMES dbus/dbus-arch-deps.h PATHS ${DBUS_INC_SEARCH_PATH} /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/dbus-1.0/include)
|
||||
if (DBUS_H_INCLUDE_DIRS AND DBUS_H_INCLUDE_DIRS AND DBUS_ARCH_DEPS_H_INCLUDE_DIRS)
|
||||
set(HAVE_DBUS_DBUS_H TRUE)
|
||||
include_directories (${DBUS_H_INCLUDE_DIRS} ${DBUS_ARCH_DEPS_H_INCLUDE_DIRS})
|
||||
include_directories (SYSTEM ${DBUS_H_INCLUDE_DIRS} ${DBUS_ARCH_DEPS_H_INCLUDE_DIRS})
|
||||
list(APPEND EXTRA_LIBS dbus-1)
|
||||
endif ()
|
||||
|
||||
|
@ -1007,7 +1007,7 @@ elseif(UNIX) # Urho3D - at this point both UNIX and UNIX_SYS should be equiva
|
|||
find_path (GLIB_CONFIG_H_INCLUDE_DIRS NAMES glibconfig.h PATHS ${GLIB_INC_SEARCH_PATH} /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}/glib-2.0/include)
|
||||
if (IBUS_H_INCLUDE_DIRS AND GLIB_H_INCLUDE_DIRS AND GLIB_CONFIG_H_INCLUDE_DIRS)
|
||||
set(HAVE_IBUS_IBUS_H TRUE)
|
||||
include_directories(${IBUS_H_INCLUDE_DIRS} ${GLIB_H_INCLUDE_DIRS} ${GLIB_CONFIG_H_INCLUDE_DIRS})
|
||||
include_directories(SYSTEM ${IBUS_H_INCLUDE_DIRS} ${GLIB_H_INCLUDE_DIRS} ${GLIB_CONFIG_H_INCLUDE_DIRS})
|
||||
list(APPEND EXTRA_LIBS ibus-1.0)
|
||||
set (SDL_USE_IME 1)
|
||||
endif ()
|
||||
|
@ -1016,7 +1016,7 @@ elseif(UNIX) # Urho3D - at this point both UNIX and UNIX_SYS should be equiva
|
|||
find_path (FCITX_H_INCLUDE_DIRS fcitx/frontend.h)
|
||||
if (FCITX_H_INCLUDE_DIRS)
|
||||
set (HAVE_FCITX_FRONTEND_H TRUE)
|
||||
include_directories (${FCITX_H_INCLUDE_DIRS})
|
||||
include_directories (SYSTEM ${FCITX_H_INCLUDE_DIRS})
|
||||
set (SDL_USE_IME 1)
|
||||
endif ()
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ macro(CheckOSS)
|
|||
# Urho3D - bug fix - should use different variables for different checks, however, we replace the whole checks with find_package() approach for consistency sake
|
||||
find_package (OSS)
|
||||
if(OSS_FOUND)
|
||||
include_directories (${OSS_INCLUDE_DIRS})
|
||||
include_directories (SYSTEM ${OSS_INCLUDE_DIRS})
|
||||
if (OSS_LIBRARIES)
|
||||
get_filename_component(NAME_WE ${OSS_LIBRARIES} NAME_WE)
|
||||
string (REGEX REPLACE ^lib "" NAME_WE "${NAME_WE}") # Stringify for string replacement
|
||||
|
@ -140,7 +140,7 @@ macro(CheckALSA)
|
|||
get_filename_component (ALSA_INCLUDE_DIRS ${ALSA_INCLUDE_DIRS} PATH)
|
||||
endif ()
|
||||
if(ALSA_FOUND)
|
||||
include_directories (${ALSA_INCLUDE_DIRS})
|
||||
include_directories (SYSTEM ${ALSA_INCLUDE_DIRS})
|
||||
set(HAVE_ALSA TRUE)
|
||||
file(GLOB ALSA_SOURCES ${SDL2_SOURCE_DIR}/src/audio/alsa/*.c)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${ALSA_SOURCES})
|
||||
|
@ -171,7 +171,7 @@ macro(CheckPulseAudio)
|
|||
# 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
|
||||
find_package (PulseAudio)
|
||||
if(PULSEAUDIO_FOUND)
|
||||
include_directories (${PULSEAUDIO_INCLUDE_DIRS})
|
||||
include_directories (SYSTEM ${PULSEAUDIO_INCLUDE_DIRS})
|
||||
set(HAVE_PULSEAUDIO TRUE)
|
||||
file(GLOB PULSEAUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/pulseaudio/*.c)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${PULSEAUDIO_SOURCES})
|
||||
|
@ -203,7 +203,7 @@ macro(CheckESD)
|
|||
# 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
|
||||
find_package (Esound)
|
||||
if(ESOUND_FOUND)
|
||||
include_directories (${ESOUND_INCLUDE_DIRS})
|
||||
include_directories (SYSTEM ${ESOUND_INCLUDE_DIRS})
|
||||
set(HAVE_ESD TRUE)
|
||||
file(GLOB ESD_SOURCES ${SDL2_SOURCE_DIR}/src/audio/esd/*.c)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${ESD_SOURCES})
|
||||
|
@ -234,7 +234,7 @@ macro(CheckARTS)
|
|||
# Urho3D - bug fix - do not use (host) arts-config tool for detection as it only works for host environment and not for rooted environment when cross-compiling
|
||||
find_package (aRts)
|
||||
if(ARTS_FOUND)
|
||||
include_directories (${ARTS_INCLUDE_DIRS})
|
||||
include_directories (SYSTEM ${ARTS_INCLUDE_DIRS})
|
||||
file(GLOB ARTS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/arts/*.c)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${ARTS_SOURCES})
|
||||
set(SDL_AUDIO_DRIVER_ARTS 1)
|
||||
|
@ -265,7 +265,7 @@ macro(CheckNAS)
|
|||
# Urho3D - bug fix - do not use check_include_file() for detection as it only works for host environment and not for rooted environment when cross-compiling
|
||||
find_package (NetworkAudioSystem)
|
||||
if(NAS_FOUND)
|
||||
include_directories (${NAS_INCLUDE_DIRS})
|
||||
include_directories (SYSTEM ${NAS_INCLUDE_DIRS})
|
||||
set(HAVE_NAS TRUE)
|
||||
file(GLOB NAS_SOURCES ${SDL2_SOURCE_DIR}/src/audio/nas/*.c)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${NAS_SOURCES})
|
||||
|
@ -296,7 +296,7 @@ macro(CheckSNDIO)
|
|||
# Urho3D - bug fix - do not use check_include_file() for detection as it only works for host environment and not for rooted environment when cross-compiling
|
||||
find_package (RoarAudio)
|
||||
if(SNDIO_FOUND)
|
||||
include_directories (${SNDIO_INCLUDE_DIRS})
|
||||
include_directories (SYSTEM ${SNDIO_INCLUDE_DIRS})
|
||||
set(HAVE_SNDIO TRUE)
|
||||
file(GLOB SNDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/sndio/*.c)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${SNDIO_SOURCES})
|
||||
|
@ -327,7 +327,7 @@ macro(CheckFusionSound)
|
|||
# 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
|
||||
find_package (FusionSound 1.0.0)
|
||||
if(FUSIONSOUND_FOUND)
|
||||
include_directories (${FUSIONSOUND_INCLUDE_DIRS})
|
||||
include_directories (SYSTEM ${FUSIONSOUND_INCLUDE_DIRS})
|
||||
set(HAVE_FUSIONSOUND TRUE)
|
||||
file(GLOB FUSIONSOUND_SOURCES ${SDL2_SOURCE_DIR}/src/audio/fusionsound/*.c)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${FUSIONSOUND_SOURCES})
|
||||
|
@ -554,7 +554,7 @@ macro(CheckMir)
|
|||
# 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
|
||||
find_package (Mir)
|
||||
if (MIR_FOUND)
|
||||
include_directories (${MIR_INCLUDE_DIRS})
|
||||
include_directories (SYSTEM ${MIR_INCLUDE_DIRS})
|
||||
set(HAVE_VIDEO_MIR TRUE)
|
||||
set(HAVE_SDL_VIDEO TRUE)
|
||||
|
||||
|
@ -611,7 +611,7 @@ macro(CheckWayland)
|
|||
# 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
|
||||
find_package (Wayland)
|
||||
if(WAYLAND_FOUND)
|
||||
include_directories (${WAYLAND_INCLUDE_DIRS})
|
||||
include_directories (SYSTEM ${WAYLAND_INCLUDE_DIRS})
|
||||
set(HAVE_VIDEO_WAYLAND TRUE)
|
||||
set(HAVE_SDL_VIDEO TRUE)
|
||||
|
||||
|
@ -669,7 +669,7 @@ macro(CheckDirectFB)
|
|||
# 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
|
||||
find_package (DirectFB 1.0.0)
|
||||
if(DIRECTFB_FOUND)
|
||||
include_directories (${DIRECTFB_INCLUDE_DIRS})
|
||||
include_directories (SYSTEM ${DIRECTFB_INCLUDE_DIRS})
|
||||
set(HAVE_VIDEO_DIRECTFB TRUE)
|
||||
file(GLOB DIRECTFB_SOURCES ${SDL2_SOURCE_DIR}/src/video/directfb/*.c)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${DIRECTFB_SOURCES})
|
||||
|
@ -736,10 +736,6 @@ endmacro(CheckVivante)
|
|||
# Urho3D - rename the macro to be generic OpenGL check and make it also work for OSX platform
|
||||
macro(CheckOpenGL)
|
||||
if(VIDEO_OPENGL)
|
||||
# Urho3D - bug fix - when cross-compiling the headers are rooted, either use "--sysroot" option or use CMAKE_REQUIRED_INCLUDES (e.g. on RPI) to cater for it
|
||||
if (CMAKE_CROSSCOMPILING AND SYSROOT AND NOT CMAKE_REQUIRED_INCLUDES)
|
||||
set (CMAKE_REQUIRED_FLAGS "--sysroot=\"${SYSROOT}\" ${ORIG_CMAKE_REQUIRED_FLAGS}")
|
||||
endif ()
|
||||
if (APPLE)
|
||||
check_c_source_compiles ("
|
||||
#include <OpenGL/OpenGL.h>
|
||||
|
@ -762,7 +758,6 @@ macro(CheckOpenGL)
|
|||
endif ()
|
||||
set(SDL_VIDEO_RENDER_OGL 1)
|
||||
endif()
|
||||
set (CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
@ -771,10 +766,6 @@ endmacro()
|
|||
# Urho3D - rename the macro to be generic OpenGLES check and make it also work for iOS platform
|
||||
macro(CheckOpenGLES)
|
||||
if(VIDEO_OPENGLES)
|
||||
# Urho3D - bug fix - when cross-compiling the headers are rooted, either use "--sysroot" option or use CMAKE_REQUIRED_INCLUDES (e.g. on RPI) to cater for it
|
||||
if (CMAKE_CROSSCOMPILING AND SYSROOT AND NOT CMAKE_REQUIRED_INCLUDES)
|
||||
set (CMAKE_REQUIRED_FLAGS "--sysroot=\"${SYSROOT}\" ${ORIG_CMAKE_REQUIRED_FLAGS}")
|
||||
endif ()
|
||||
check_c_source_compiles("
|
||||
#define EGL_API_FB
|
||||
#include <EGL/egl.h>
|
||||
|
@ -800,7 +791,6 @@ macro(CheckOpenGLES)
|
|||
set(SDL_VIDEO_OPENGL_ES2 1)
|
||||
set(SDL_VIDEO_RENDER_OGL_ES2 1)
|
||||
endif()
|
||||
set (CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
|
@ -808,59 +798,11 @@ endmacro()
|
|||
# - nada
|
||||
# Optional:
|
||||
# - THREADS opt
|
||||
# Sets:
|
||||
# PTHREAD_CFLAGS
|
||||
# PTHREAD_LIBS
|
||||
macro(CheckPTHREAD)
|
||||
if(PTHREADS)
|
||||
# Urho3D - TODO - below hardcoding is ugly and should be refactored/removed, however, we/I don't have all the necessary means to verify the changes
|
||||
if(LINUX)
|
||||
set(PTHREAD_CFLAGS "-D_REENTRANT")
|
||||
set(PTHREAD_LDFLAGS "-pthread")
|
||||
elseif(BSDI)
|
||||
set(PTHREAD_CFLAGS "-D_REENTRANT -D_THREAD_SAFE")
|
||||
set(PTHREAD_LDFLAGS "")
|
||||
elseif(DARWIN)
|
||||
set(PTHREAD_CFLAGS "-D_THREAD_SAFE")
|
||||
# causes Carbon.p complaints?
|
||||
# set(PTHREAD_CFLAGS "-D_REENTRANT -D_THREAD_SAFE")
|
||||
set(PTHREAD_LDFLAGS "")
|
||||
elseif(FREEBSD)
|
||||
set(PTHREAD_CFLAGS "-D_REENTRANT -D_THREAD_SAFE")
|
||||
set(PTHREAD_LDFLAGS "-pthread")
|
||||
elseif(NETBSD)
|
||||
set(PTHREAD_CFLAGS "-D_REENTRANT -D_THREAD_SAFE")
|
||||
set(PTHREAD_LDFLAGS "-lpthread")
|
||||
elseif(OPENBSD)
|
||||
set(PTHREAD_CFLAGS "-D_REENTRANT")
|
||||
set(PTHREAD_LDFLAGS "-pthread")
|
||||
elseif(SOLARIS)
|
||||
set(PTHREAD_CFLAGS "-D_REENTRANT")
|
||||
set(PTHREAD_LDFLAGS "-pthread -lposix4")
|
||||
elseif(SYSV5)
|
||||
set(PTHREAD_CFLAGS "-D_REENTRANT -Kthread")
|
||||
set(PTHREAD_LDFLAGS "")
|
||||
elseif(AIX)
|
||||
set(PTHREAD_CFLAGS "-D_REENTRANT -mthreads")
|
||||
set(PTHREAD_LDFLAGS "-pthread")
|
||||
elseif(HPUX)
|
||||
set(PTHREAD_CFLAGS "-D_REENTRANT")
|
||||
set(PTHREAD_LDFLAGS "-L/usr/lib -pthread")
|
||||
elseif(HAIKU)
|
||||
set(PTHREAD_CFLAGS "-D_REENTRANT")
|
||||
set(PTHREAD_LDFLAGS "")
|
||||
else()
|
||||
set(PTHREAD_CFLAGS "-D_REENTRANT")
|
||||
set(PTHREAD_LDFLAGS "-lpthread")
|
||||
endif()
|
||||
|
||||
# Run some tests
|
||||
set(CMAKE_REQUIRED_FLAGS "${PTHREAD_CFLAGS} ${PTHREAD_LDFLAGS} ${ORIG_CMAKE_REQUIRED_FLAGS}")
|
||||
# Urho3D - bug fix - when cross-compiling the headers are rooted, either use "--sysroot" option or use CMAKE_REQUIRED_INCLUDES (e.g. on RPI) to cater for it
|
||||
# Urho3D - remove hardcoding of pthread-related compiler and linker flags for each platform
|
||||
set(CMAKE_REQUIRED_FLAGS "-pthread ${ORIG_CMAKE_REQUIRED_FLAGS}") # Android does not need this flag but it does no harm (i.e. appears to be no-op on Android)
|
||||
if(CMAKE_CROSSCOMPILING)
|
||||
if (SYSROOT AND NOT CMAKE_REQUIRED_INCLUDES)
|
||||
set (CMAKE_REQUIRED_FLAGS "--sysroot=\"${SYSROOT}\" ${ORIG_CMAKE_REQUIRED_FLAGS}")
|
||||
endif ()
|
||||
check_c_source_compiles("
|
||||
#include <pthread.h>
|
||||
int main(int argc, char** argv) {
|
||||
|
@ -879,9 +821,8 @@ macro(CheckPTHREAD)
|
|||
endif()
|
||||
if(HAVE_PTHREADS)
|
||||
set(SDL_THREAD_PTHREAD 1)
|
||||
# Urho3D - we configure to use "-pthread" compiler flags globally (when it is supported) and expect the respective compiler toolchain to do the right things automatically
|
||||
set(SDL_CFLAGS "${SDL_CFLAGS} ${PTHREAD_CFLAGS}")
|
||||
list(APPEND SDL_LIBS ${PTHREAD_LDFLAGS})
|
||||
# Urho3D - we configure to use "-pthread" compiler flags globally and expect the respective compiler toolchain to do the right things automatically
|
||||
set(SDL_CFLAGS "${SDL_CFLAGS} -pthread")
|
||||
|
||||
check_c_source_compiles("
|
||||
#include <pthread.h>
|
||||
|
@ -1091,14 +1032,10 @@ endmacro()
|
|||
# - n/a
|
||||
macro(CheckRPI)
|
||||
if(VIDEO_RPI)
|
||||
# Urho3D - bug fix - when cross-compiling the headers are rooted
|
||||
set(CMAKE_REQUIRED_FLAGS "${VIDEO_RPI_INCLUDE_FLAGS} ${ORIG_CMAKE_REQUIRED_FLAGS}")
|
||||
# Urho3D - bug fix - commented out CMAKE_REQUIRED_LIBRARIES as it actually causes the detection to fail
|
||||
check_c_source_compiles("
|
||||
#include <bcm_host.h>
|
||||
int main(int argc, char **argv) {}" HAVE_VIDEO_RPI)
|
||||
set(CMAKE_REQUIRED_FLAGS ${ORIG_CMAKE_REQUIRED_FLAGS})
|
||||
|
||||
if(SDL_VIDEO AND HAVE_VIDEO_RPI)
|
||||
set(HAVE_SDL_VIDEO TRUE)
|
||||
set(SDL_VIDEO_DRIVER_RPI 1)
|
||||
|
|
|
@ -60,10 +60,6 @@ if (NOT IOS AND NOT WEB)
|
|||
set (LIBS dl)
|
||||
if (READLINE_FOUND)
|
||||
add_definitions (-DHAVE_READLINE)
|
||||
# FIXME: temporary quick fix
|
||||
if (RPI AND CMAKE_CROSSCOMPILING)
|
||||
set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} --sysroot=\"${SYSROOT}\"")
|
||||
endif ()
|
||||
list (APPEND INCLUDE_DIRS ${READLINE_INCLUDE_DIRS})
|
||||
list (APPEND LIBS ${READLINE_LIBRARIES})
|
||||
endif ()
|
||||
|
|
Загрузка…
Ссылка в новой задаче