CMakeSwiftInformation.cmake 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. # Distributed under the OSI-approved BSD 3-Clause License. See accompanying
  2. # file Copyright.txt or https://cmake.org/licensing for details.
  3. if(UNIX)
  4. set(CMAKE_Swift_OUTPUT_EXTENSION .o)
  5. else()
  6. set(CMAKE_Swift_OUTPUT_EXTENSION .obj)
  7. endif()
  8. # Load compiler-specific information.
  9. if(CMAKE_Swift_COMPILER_ID)
  10. include(Compiler/${CMAKE_Swift_COMPILER_ID}-Swift OPTIONAL)
  11. if(CMAKE_SYSTEM_PROCESSOR)
  12. include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_ID}-Swift-${CMAKE_SYSTEM_PROCESSOR} OPTIONAL)
  13. endif()
  14. include(Platform/${CMAKE_EFFECTIVE_SYSTEM_NAME}-${CMAKE_Swift_COMPILER_ID}-Swift OPTIONAL)
  15. endif()
  16. set(CMAKE_INCLUDE_FLAG_Swift "-I ")
  17. set(CMAKE_Swift_COMPILE_OPTIONS_TARGET "-target ")
  18. set(CMAKE_Swift_COMPILER_ARG1 -frontend)
  19. set(CMAKE_Swift_DEFINE_FLAG -D)
  20. set(CMAKE_Swift_FRAMEWORK_SEARCH_FLAG "-F ")
  21. set(CMAKE_Swift_LIBRARY_PATH_FLAG "-L ")
  22. set(CMAKE_Swift_LIBRARY_PATH_TERMINATOR "")
  23. set(CMAKE_Swift_LINKER_WRAPPER_FLAG "-Xlinker" " ")
  24. set(CMAKE_Swift_RESPONSE_FILE_LINK_FLAG @)
  25. set(CMAKE_Swift_LINKER_PREFERENCE 50)
  26. set(CMAKE_Swift_LINKER_PREFERENCE_PROPAGATES 1)
  27. # NOTE(compnerd) use the short form for convenience and ease of search. They
  28. # are treated equivalent to their long form names as well as custom Swift
  29. # specific names.
  30. set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded -libc MT)
  31. set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL -libc MD)
  32. set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug -libc MTd)
  33. set(CMAKE_Swift_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL -libc MDd)
  34. set(CMAKE_Swift_FLAGS_DEBUG_INIT "-g")
  35. set(CMAKE_Swift_FLAGS_RELEASE_INIT "-O")
  36. set(CMAKE_Swift_FLAGS_RELWITHDEBINFO_INIT "-O -g")
  37. set(CMAKE_Swift_FLAGS_MINSIZEREL_INIT "-Osize")
  38. # NOTE(compnerd) we do not have an object compile rule since we build the objects as part of the link step
  39. if(NOT CMAKE_Swift_COMPILE_OBJECT)
  40. set(CMAKE_Swift_COMPILE_OBJECT ":")
  41. endif()
  42. if(NOT CMAKE_Swift_NUM_THREADS MATCHES "^[0-9]+$")
  43. cmake_host_system_information(RESULT CMAKE_Swift_NUM_THREADS QUERY NUMBER_OF_LOGICAL_CORES)
  44. endif()
  45. if(NOT CMAKE_Swift_CREATE_SHARED_LIBRARY)
  46. if(CMAKE_Swift_COMPILER_TARGET)
  47. set(CMAKE_Swift_CREATE_SHARED_LIBRARY "${CMAKE_Swift_COMPILER} -target <CMAKE_Swift_COMPILER_TARGET> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
  48. else()
  49. set(CMAKE_Swift_CREATE_SHARED_LIBRARY "${CMAKE_Swift_COMPILER} -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-library -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
  50. endif()
  51. endif()
  52. if(NOT CMAKE_Swift_CREATE_SHARED_MODULE)
  53. set(CMAKE_Swift_CREATE_SHARED_MODULE ${CMAKE_Swift_CREATE_SHARED_LIBRARY})
  54. endif()
  55. if(NOT CMAKE_Swift_LINK_EXECUTABLE)
  56. if(CMAKE_Swift_COMPILER_TARGET)
  57. set(CMAKE_Swift_LINK_EXECUTABLE "${CMAKE_Swift_COMPILER} -target <CMAKE_Swift_COMPILER_TARGET> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-executable -o <TARGET> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
  58. else()
  59. set(CMAKE_Swift_LINK_EXECUTABLE "${CMAKE_Swift_COMPILER} -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-executable -o <TARGET> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
  60. endif()
  61. endif()
  62. if(NOT CMAKE_Swift_CREATE_STATIC_LIBRARY)
  63. if(CMAKE_Swift_COMPILER_TARGET)
  64. set(CMAKE_Swift_CREATE_STATIC_LIBRARY "${CMAKE_Swift_COMPILER} -target <CMAKE_Swift_COMPILER_TARGET> -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-library -static -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
  65. else()
  66. set(CMAKE_Swift_CREATE_STATIC_LIBRARY "${CMAKE_Swift_COMPILER} -output-file-map <SWIFT_OUTPUT_FILE_MAP> -incremental -num-threads ${CMAKE_Swift_NUM_THREADS} -emit-library -static -o <TARGET> -module-name <SWIFT_MODULE_NAME> -module-link-name <SWIFT_LIBRARY_NAME> -emit-module -emit-module-path <SWIFT_MODULE> -emit-dependencies <DEFINES> <FLAGS> <INCLUDES> <SWIFT_SOURCES> <LINK_FLAGS> <LINK_LIBRARIES>")
  67. endif()
  68. set(CMAKE_Swift_ARCHIVE_CREATE "<CMAKE_AR> crs <TARGET> <OBJECTS>")
  69. set(CMAKE_Swift_ARCHIVE_FINISH "")
  70. endif()
  71. set(CMAKE_Swift_INFORMATION_LOADED 1)