cmake_macosx.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. #
  2. # Copyright (c) 2008-2013 the Urho3D project.
  3. #
  4. # Permission is hereby granted, free of charge, to any person obtaining a copy
  5. # of this software and associated documentation files (the "Software"), to deal
  6. # in the Software without restriction, including without limitation the rights
  7. # to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. # copies of the Software, and to permit persons to whom the Software is
  9. # furnished to do so, subject to the following conditions:
  10. #
  11. # The above copyright notice and this permission notice shall be included in
  12. # all copies or substantial portions of the Software.
  13. #
  14. # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. # THE SOFTWARE.
  21. #
  22. # Ensure we are in project root directory
  23. cd $( dirname $0 )
  24. # Create out-of-source build directory
  25. SOURCE=`pwd`/Source
  26. BUILD=Build
  27. if [ "$1" == "-DIOS=1" ]; then
  28. BUILD=ios-Build
  29. fi
  30. cmake -E make_directory $BUILD
  31. # Create project with the Xcode generator
  32. OPT=-Wno-dev # \todo suppress policy warning (for 2.8.12 early adopters), remove this option when CMake minimum version is 2.8.12
  33. cmake -E chdir $BUILD cmake $OPT -G "Xcode" $@ $SOURCE
  34. # Temporary fix: can be removed when CMake minimum required has reached 2.8.12
  35. if [ "$1" == "-DIOS=1" -a -e $BUILD/CMakeScripts/XCODE_DEPEND_HELPER.make ]; then
  36. # Due to a bug in the CMake/Xcode generator (prior to version 2.8.12) where it has wrongly assumed the IOS bundle structure to be the same as MacOSX bundle structure,
  37. # below temporary fix is required in order to solve the auto-linking issue when dependent libraries are changed
  38. # Since version 2.8.12 CMake does not generate XCODE_DEPEND_HELPER.make script anymore, so we skip this fix when the script does not exist
  39. sed -i '' 's/\/Contents\/MacOS//g' $BUILD/CMakeScripts/XCODE_DEPEND_HELPER.make
  40. fi
  41. # Temporary fix: known CMake bug (still exists in 2.8.12)
  42. if [ "$1" == "-DIOS=1" ]; then
  43. # Due to a bug in the CMake/Xcode generator that prevents iOS targets (library and bundle) to be installed correctly
  44. # (see http://public.kitware.com/Bug/bug_relationship_graph.php?bug_id=12506&graph=dependency),
  45. # below temporary fix is required to work around the bug
  46. sed -i '' 's/$(EFFECTIVE_PLATFORM_NAME)//g' $BUILD/CMakeScripts/install_postBuildPhase.make*
  47. fi
  48. # vi: set ts=4 sw=4 expandtab: