Toolchain-cctools.cmake 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. # Usage:
  2. # cmake .. -DCCTOOLS_PREFIX=/path/to/cctools -DCCTOOLS_ARCH=arch -DCCTOOLS_PLATFORM=platform \
  3. # -DRT=/path/to/cctools/darwin/libclang_rt.{ios, iossim, osx, tvos, tvossim}.a -DCMAKE_TOOLCHAIN_FILE=../cmake/Toolchain-cctools.cmake
  4. # Download precompiled cctools at https://github.com/supertuxkart/dependencies/releases/download/preview/cctools.tar.xz
  5. # Compiled in Ubuntu 18.04
  6. # the name of the target operating system
  7. SET(CMAKE_SYSTEM_NAME Darwin)
  8. # which compilers to use for C and C++
  9. string(TOLOWER "${CCTOOLS_PLATFORM}" platform_lower)
  10. set(CLANG_ARCH ${CCTOOLS_ARCH})
  11. if(CCTOOLS_ARCH MATCHES ^arm)
  12. set(CLANG_ARCH arm)
  13. else()
  14. set(CLANG_ARCH ${CCTOOLS_ARCH})
  15. endif()
  16. SET(CMAKE_C_COMPILER ${CCTOOLS_PREFIX}/bin/${CCTOOLS_ARCH}-${platform_lower}-clang)
  17. SET(CMAKE_CXX_COMPILER ${CCTOOLS_PREFIX}/bin/${CCTOOLS_ARCH}-${platform_lower}-clang++)
  18. SET(CMAKE_RANLIB ${CCTOOLS_PREFIX}/bin/${CLANG_ARCH}-apple-darwin11-ranlib)
  19. SET(CMAKE_AR ${CCTOOLS_PREFIX}/bin/${CLANG_ARCH}-apple-darwin11-ar)
  20. SET(CMAKE_INSTALL_NAME_TOOL ${CCTOOLS_PREFIX}/bin/${CLANG_ARCH}-apple-darwin11-install_name_tool)
  21. SET(CMAKE_SYSTEM_PROCESSOR ${CCTOOLS_ARCH})
  22. SET(CMAKE_MACOSX_RPATH TRUE)
  23. SET(CMAKE_EXE_LINKER_FLAGS ${RT})
  24. # here is the target environment located
  25. SET(CMAKE_FIND_ROOT_PATH ${PROJECT_SOURCE_DIR}/dependencies-${platform_lower} ${CCTOOLS_PREFIX}/sdk/${CCTOOLS_PLATFORM}.sdk)
  26. # adjust the default behaviour of the FIND_XXX() commands:
  27. # search headers and libraries in the target environment, search
  28. # programs in the host environment
  29. set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
  30. set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ALWAYS)
  31. set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
  32. # fix statically linking because of order
  33. if (NOT CCTOOLS_PLATFORM MATCHES MacOSX)
  34. set(CURL_LIBRARY "${PROJECT_SOURCE_DIR}/dependencies-${platform_lower}/lib/libcurl.a;${PROJECT_SOURCE_DIR}/dependencies-${platform_lower}/lib/libmbedtls.a;${PROJECT_SOURCE_DIR}/dependencies-${platform_lower}/lib/libmbedx509.a")
  35. endif()
  36. set(USE_CRYPTO_OPENSSL FALSE CACHE BOOL "")
  37. if (NOT CCTOOLS_PLATFORM MATCHES MacOSX)
  38. set(USE_WIIUSE FALSE CACHE BOOL "")
  39. set(USE_SQLITE3 FALSE CACHE BOOL "")
  40. set(IOS TRUE CACHE BOOL "")
  41. endif()