cmake_gcc.sh 2.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. #!/usr/bin/env bash
  2. #
  3. # Copyright (c) 2008-2013 the Urho3D project.
  4. #
  5. # Permission is hereby granted, free of charge, to any person obtaining a copy
  6. # of this software and associated documentation files (the "Software"), to deal
  7. # in the Software without restriction, including without limitation the rights
  8. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  9. # copies of the Software, and to permit persons to whom the Software is
  10. # furnished to do so, subject to the following conditions:
  11. #
  12. # The above copyright notice and this permission notice shall be included in
  13. # all copies or substantial portions of the Software.
  14. #
  15. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. # THE SOFTWARE.
  22. #
  23. # Ensure we are in project root directory
  24. cd $( dirname $0 )
  25. SOURCE=`pwd`/Source
  26. # Define helpers
  27. . ./.bash_helpers.sh
  28. # Detect CMake toolchains directory
  29. TOOLCHAINS=$SOURCE/CMake/Toolchains
  30. [ ! -d $TOOLCHAINS -a -d $URHO3D_HOME/Source/CMake/Toolchains ] && TOOLCHAINS=$URHO3D_HOME/Source/CMake/Toolchains
  31. # Add support for Eclipse IDE
  32. IFS=#
  33. GENERATOR="Unix Makefiles"
  34. [[ $1 =~ ^eclipse$ ]] && GENERATOR="Eclipse CDT4 - Unix Makefiles" && shift && xmlstarlet --version >/dev/null 2>&1 && HAS_XMLSTARLET=1
  35. # Add support for both native and cross-compiling build for Raspberry Pi
  36. [[ $( uname -m ) =~ ^armv6 ]] && PLATFORM="-DRASPI=1"
  37. # Create project with the respective CMake generators
  38. OPT=-Wno-dev # \todo suppress policy warning (for 2.8.12 early adopters), remove this option when CMake minimum version is 2.8.12
  39. [ $ANDROID_NDK ] && msg "Android build" && cmake -E make_directory android-Build && cmake -E chdir android-Build cmake $OPT -G $GENERATOR -DANDROID=1 -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAINS/android.toolchain.cmake -DLIBRARY_OUTPUT_PATH_ROOT=. $@ $SOURCE && post_cmake android-Build
  40. [ $RASPI_TOOL ] && msg "Raspberry Pi build" && cmake -E make_directory raspi-Build && cmake -E chdir raspi-Build cmake $OPT -G $GENERATOR -DRASPI=1 -DCMAKE_TOOLCHAIN_FILE=$TOOLCHAINS/raspberrypi.toolchain.cmake $@ $SOURCE && post_cmake raspi-Build
  41. msg "Native build" && cmake -E make_directory Build && cmake -E chdir Build cmake $OPT -G $GENERATOR $PLATFORM $@ $SOURCE && post_cmake Build
  42. unset IFS
  43. # Create symbolic links in the build directories
  44. if [ $ANDROID_NDK ]; then
  45. for dir in CoreData Data; do
  46. cmake -E create_symlink ../../../Bin/$dir Source/Android/assets/$dir
  47. done
  48. for f in AndroidManifest.xml build.xml src res assets; do
  49. cmake -E create_symlink ../Source/Android/$f android-Build/$f
  50. done
  51. fi
  52. exit 0
  53. # vi: set ts=4 sw=4 expandtab: