Using parent scope is not good enough when multiple targets referencing a same resource directory are not located inside a same parent scope.
Using internal cache fixes this.
The new toolchain file requires Android NDK r12b and above. Default to use 'arm-linux-androideabi-clang' toolchain and LLVM libc++ STL runtime.
Align all the compiler and linker flags according to new ndk-build configuration in Android NDK r12b, i.e. no more '-f[no-]strict-aliasing' and '-f[no-]omit-frame-pointer', but more stringent warnings check.
Improve over the old toolchain file where most of the options are now changeable after the initial configuration. The exceptions are ANDROID_NDK and ANDROID_TOOLCHAIN_NAME due to limitation of CMake.
Close#1441.
Other changes in this commit includes:
- Fix Android sample launcher app to support shared C++ STL runtime library.
- Remove temporary fix in FindUrho3D module as it is not required anymore with our new toolchain file.
- Fix Log::WriteRaw() method to pass the parameters correctly to __android_log_print() function.
- Fix enable_pch() macro to emit -fPIC compiler flags correctly based on target's POSITION_INDEPENDENT_CODE property.
- Fix linker flags for ld.bfd where it needs help to find the location of the rooted shared libraries. The flags are not required for ld.gold but they do no harm for gold linker.
- Enhance the CheckCompilerToolchain module to auto-detect if the NEON SIMD is enabled or not for Android build (based on the chosen ANDROID_ABI).
When in try_compile() mode, quickly obtain the previously cached values stored in the (inner scope) environment variables and bypass all the checks (which are already done when the toolchain file is being processed at the start of CMake run).
Due to the CMake try_compile() limitation, initial build option values (i.e. not env-vars) were not visible to all the CMake checks during inital configuration, preventing the build option from functioning as expected.
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.
Somehow after bumping up the CMake minimum version, CMake configures Xcode to work "better" with xcpretty that now the warnings are piping through the xcpretty's filter. Unfortunately when performing CI build, this is undesirable because not only now the log size is swelling, the build is slower too.
Some cross-compiling build tree configuration needs native compiler toolchain for host tool building via ExternalProject_Add(). This additional check ensures the native compiler toolchain is available up front before the build tree is even generated. Close#1300.
The 'grep' command on macOS is from BSD which requires different option than Linux one to enable extended or Perl-compatible regex parsing.
[skip appveyor] [ci only: OSX]
Remove hardcoding of indirect dependency libraries list in the FindUrho3D.cmake module. Instead we now rely on the linker to find those indirect dependencies automatically with our hint via "-runpath-link" linker flag, especially when cross-compiling.
Also setup GLESv2 (and GLESv1_CM) for Raspberry-Pi in the same manner as generic ARM and Android platforms.
When cross-compiling we have already defined '--sysroot' to find the direct library dependencies. However when a shared library has its own dependencies (DT_NEEDED) then we need to supply extra linker flags to help the linker to find those indirect library dependecies in the sysroot.
Actually we also had this problem for 32-bit ARM cross-compiling, but we cheated in the earlier CI build jobs by using Linaro/Raspbian compiler toolchain. Somehow the Raspbian's linker simply "ignores" those indirect library dependencies or it uses other mean to locate them (but I doubt that), and so it does not have linker issues with libreadline.so (depends on tinfo), libGLESv2.so (depends on glapi), etc. The other ARM compiler toolchains from Linaro seem to be more strict in this regard. Most likely the raspbian's linker is a gold linker.
This commit could also potentially fix a known issue in our FindUrho3D.cmake module where we have to hardcode the library dependencies that libUrho3D.so in turn depends on (to be investigated later).
A new issue or PR will be submitted to Emscripten upstream to have this bug fixed properly. Until such time we can do a emcc version check to skip this workaround when it is not required anymore.
Also add new compiler flag for Clang to suppress the unused '-mno-sse' warnings.
This is a regression issue. We used to configure it globally before moving it to setup_target() macro. There is a pro and con on where to configure the memory linker flag. If we do it globally then we cannot alter the total memory size per target application (if a project has multiple targets). However, since there is a bug in its current implementation in the setup_target() macro, the logic is moved back again to global section a quick fix for this bug. This means we could not have alternative memory size in any of the sample targets, which we do not do anymore after the default memory size has been increased to 128 MB.
For CI - switch all the Android CI jobs to use Clang compiler toolchian instead of GCC compiler toolchain. The old GCC 4.9 is not able to handle C++11 standard for AS wrapper. Besides, the latest change log in Android NDK has marked GCC as deprecated and recommended developers to migrate to Clang.
Add a new build option "ARM_ABI_FLAGS" for supplying additional ABI compiler flags when targeting generic arm.
Fix Linux build from using OpenGLES instead of GLEW, fix RPI build from using wrong OpenGLES library, fix iOS build from using arm-specific compiler flags directly which would cause problem in universal binary build containing iphonesimulator archs as well.
And other minor refactoring.
We do not support disabling PCH per compilation unit anymore so we do not need to use custom compiler flags per compilation unit. Using this kind of configuration would result in unwanted target rebuild when the list of compilation unit gets changed due to new/deleted source files for the target in question.
-Has been tested by running Urho3DPlayer with the 12_PhysicsStressTest script
(the file copied in place of NinjaSnowWar.as requested)
-built with "-std=gnu++14 -I/usr/include/boost" for the CMAKE_CXX_FLAGS
and "-I/usr/include/boost" for the CMAKE_C_FLAGS.
** /usr/include/boost contains a simlink pointing to itself so that boost/
preprocessor____ can be found
-Networking still doesn't work, so NinjaSnowWar shouldn't work
-Debug builds did not work for me: see http://urho3d.prophpbb.com/topic2151.html
-Defining FORCE_AS_PORTABLE can be used to force it to use the generic build
with, for example, a gcc build (which should allow more apples-to-apples
testing of the efficiency of the bindings)
-Discussion of this work originally at http://urho3d.prophpbb.com/topic2044.html
This should fix 2 things: 1) long running glew compilation being killed by Travis CI due to absent of output; 2) long running universal binary for Urho3D library target on iOS build overshoot the build time limit.
- Fix the regex to get the shared library soname correctly.
- Use the GCC_ATOMIC and CLOCK_GETTIME whenever they are available.
- Reorganize the if-else block in the SDL CMakeLists.txt to prevent Unix-like platforms (e.g. Android) from entering the block meant for genuine Unix/Linux.
- and more.
- Revert back commits from PR #191. The media keys support on Linux/x11 platform will be reinvestigated later.
- Add additional include dir for RPI platform. This change is to keep the original SDL/src/video/raspberry/SDL_rpivideo.h header file happy. Previously we were using a slightly altered header file.
- Merge changes from SDL's android-project template.
- Add new source files for Android platform into SDL's CMakeLists.txt. Use new SDL hint to separate mouse and touch events on Android platform. Strangely though a similar hint does not exist on iOS platform, so we retain our local changes to suppress emulated events on iOS platform.
- Adjust OSX and iOS linker flags to include more frameworks.
- Turn ARC on when compiling Objective-C on iOS platform.
- Enable SDL_WINDOW_ALLOW_HIGHDPI on all Apple platforms. Replace all the SDL_WindowGetSize() call with SDL_GL_GetDrawableSize() call in all the graphics backend implementation classes. The former now returns the number in screen coordinates while the latter returns the number in pixels suitable for setting up the glViewport.
- Always use fullscreen mode for iOS platform. Revert back local changes in SDL src/video/uikit/SDL_uikitviewcontroller.m.
Set the iOS initial device orientation and status bar flag to match with what will be set programatically later to avoid unwanted artifacts during app launches. Also set the new iOS key "UIRequiresFullScreen" to opt out from iOS 9 Slide-Over and Split-View. User making non-gaming apps using Urho3D may want to remove this iOS key though.
[ci skip]
The wait_for_block() was originally needed for iOS platform as it used to install very slowly (exceeds 10 minutes) due to configuration mistake. It should install just in a few minutes now.
The auto-discovered variables are removed as build options from cmake-gui when it is invoked by Urho3D downstream projects.
Still, ensure the auto-discovered variables prevail over conflicting values potentially specified by user manually or via CLI.