watchos_simulator.mk 3.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. ifeq ($(_THEOS_TARGET_LOADED),)
  2. _THEOS_TARGET_LOADED := 1
  3. THEOS_TARGET_NAME := watchos_simulator
  4. _THEOS_TARGET_CC := clang
  5. _THEOS_TARGET_CXX := clang++
  6. _THEOS_TARGET_ARG_ORDER := 2 3
  7. # A version specified as a target argument overrides all previous definitions.
  8. _SDKVERSION := $(or $(__THEOS_TARGET_ARG_$(word 1,$(_THEOS_TARGET_ARG_ORDER))),$(SDKVERSION))
  9. _THEOS_TARGET_SDK_VERSION := $(or $(_SDKVERSION),latest)
  10. _THEOS_TARGET_WATCHOS_DEPLOYMENT_VERSION := $(or $(__THEOS_TARGET_ARG_$(word 2,$(_THEOS_TARGET_ARG_ORDER))),$(TARGET_WATCHOS_DEPLOYMENT_VERSION),$(_THEOS_TARGET_SDK_VERSION))
  11. _THEOS_TARGET_INCLUDE_SDK_VERSION := $(or $(INCLUDE_SDKVERSION),latest)
  12. _SDK_DIR := $(THEOS_PLATFORM_SDK_ROOT)/Platforms/WatchSimulator.platform/Developer/SDKs
  13. _IOS_SDKS := $(sort $(patsubst $(_SDK_DIR)/WatchSimulator%.sdk,%,$(wildcard $(_SDK_DIR)/WatchSimulator*.sdk)))
  14. ifeq ($(words $(_IOS_SDKS)),0)
  15. before-all::
  16. @$(PRINT_FORMAT_ERROR) "You do not have an SDK in $(_SDK_DIR)." >&2; exit 1
  17. endif
  18. _LATEST_SDK := $(lastword $(_IOS_SDKS))
  19. ifeq ($(_THEOS_TARGET_SDK_VERSION),latest)
  20. override _THEOS_TARGET_SDK_VERSION := $(_LATEST_SDK)
  21. endif
  22. ifeq ($(_THEOS_TARGET_INCLUDE_SDK_VERSION),latest)
  23. override _THEOS_TARGET_INCLUDE_SDK_VERSION := $(_LATEST_SDK)
  24. endif
  25. ifeq ($(_THEOS_TARGET_WATCHOS_DEPLOYMENT_VERSION),latest)
  26. override _THEOS_TARGET_WATCHOS_DEPLOYMENT_VERSION := $(_LATEST_SDK)
  27. endif
  28. ifeq ($(SYSROOT),)
  29. SYSROOT ?= $(THEOS_PLATFORM_SDK_ROOT)/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator$(_THEOS_TARGET_SDK_VERSION).sdk
  30. ISYSROOT ?= $(THEOS_PLATFORM_SDK_ROOT)/Platforms/WatchSimulator.platform/Developer/SDKs/WatchSimulator$(_THEOS_TARGET_INCLUDE_SDK_VERSION).sdk
  31. else
  32. ISYSROOT ?= $(SYSROOT)
  33. endif
  34. TARGET_CC ?= xcrun -sdk watchsimulator $(_THEOS_TARGET_CC)
  35. TARGET_CXX ?= xcrun -sdk watchsimulator $(_THEOS_TARGET_CXX)
  36. TARGET_LD ?= xcrun -sdk watchsimulator $(_THEOS_TARGET_CXX)
  37. TARGET_STRIP ?= xcrun -sdk watchsimulator strip
  38. TARGET_STRIP_FLAGS ?= -x
  39. TARGET_CODESIGN_ALLOCATE ?= "$(shell xcrun -sdk watchsimulator -find codesign_allocate)"
  40. TARGET_CODESIGN ?=
  41. TARGET_CODESIGN_FLAGS ?=
  42. TARGET_PRIVATE_FRAMEWORK_PATH = $(SYSROOT)/System/Library/PrivateFrameworks
  43. TARGET_PRIVATE_FRAMEWORK_INCLUDE_PATH = $(ISYSROOT)/System/Library/PrivateFrameworks
  44. include $(THEOS_MAKE_PATH)/targets/_common/darwin.mk
  45. include $(THEOS_MAKE_PATH)/targets/_common/darwin_flat_bundle.mk
  46. ifeq ($(WATCHOS_SIMULATOR_ROOT),)
  47. internal-install::
  48. @$(PRINT_FORMAT_ERROR) "$(MAKE) install for the simulator requires that you set WATCHOS_SIMULATOR_ROOT to the root directory of the simulated OS." >&2
  49. @exit 1
  50. else
  51. internal-install:: stage
  52. install.mergeDir "$(THEOS_STAGING_DIR)" "$(WATCHOS_SIMULATOR_ROOT)"
  53. endif
  54. ARCHS ?= x86_64
  55. NEUTRAL_ARCH = x86_64
  56. _TARGET_VERSION_FLAG = -mwatchos-simulator-version-min=9.0
  57. _TARGET_OBJC_ABI_CFLAGS = -fobjc-abi-version=2 -fobjc-legacy-dispatch
  58. _TARGET_OBJC_ABI_LDFLAGS = -Xlinker -objc_abi_version -Xlinker 2
  59. MODULESFLAGS := -fmodules -fcxx-modules -fmodule-name=$(THEOS_CURRENT_INSTANCE)
  60. SDKFLAGS := -D__IPHONE_OS_VERSION_MIN_REQUIRED=__IPHONE_$(subst .,_,$(_THEOS_TARGET_WATCHOS_DEPLOYMENT_VERSION)) $(_TARGET_VERSION_FLAG)
  61. _THEOS_TARGET_CFLAGS := -isysroot $(ISYSROOT) $(SDKFLAGS) $(_TARGET_OBJC_ABI_CFLAGS) $(MODULESFLAGS)
  62. _THEOS_TARGET_LDFLAGS := -isysroot $(SYSROOT) $(SDKFLAGS) -multiply_defined suppress $(_TARGET_OBJC_ABI_LDFLAGS) -Xlinker -allow_simulator_linking_to_macosx_dylibs
  63. _THEOS_TARGET_DEFAULT_USE_SUBSTRATE := 0
  64. endif