From 8bae6243f281b6c2413c5dde8018e49494022a8e Mon Sep 17 00:00:00 2001 From: Jose Date: Thu, 23 Jan 2025 19:06:37 +0100 Subject: [PATCH] iOS test builds --- config/Make.project.rules | 2 +- config/Make.rules.Darwin | 48 +++++++- config/Make.xcodesdk.rules | 109 ------------------ cpp/config/Make.rules | 5 +- cpp/config/Make.xcodesdk.rules | 80 ------------- cpp/test/IceSSL/configuration/Makefile.mk | 4 - .../project.pbxproj | 30 ++--- 7 files changed, 64 insertions(+), 214 deletions(-) delete mode 100644 config/Make.xcodesdk.rules delete mode 100644 cpp/config/Make.xcodesdk.rules diff --git a/config/Make.project.rules b/config/Make.project.rules index 06ecea144fe..141aabf249f 100644 --- a/config/Make.project.rules +++ b/config/Make.project.rules @@ -373,7 +373,7 @@ endif # # We define a secondary target for component[platform-config]. This is necessary -# to allow dependencies to be used as prerequesties. For example, objects for +# to allow dependencies to be used as prerequisites. For example, objects for # IceSSL[osx-shared] depend on Ice[osx-shared], see make-objects. # .PHONY: $5 diff --git a/config/Make.rules.Darwin b/config/Make.rules.Darwin index dc81aa794a0..86a3431a34e 100644 --- a/config/Make.rules.Darwin +++ b/config/Make.rules.Darwin @@ -19,7 +19,9 @@ iphoneos_configs = %static iphoneos_targetdir = /iphoneos # TODO: disable all install for this platform iphoneos_installdir = /iphoneos -iphoneos_components = $(xcframeworks) +iphoneos_components = $(xcframeworks) $(iostest_components) +iphoneos_targetrule = $(iostest_targetrule) +iphoneos_excludes = $(iostest_excludes) iphonesimulator_ar = libtool iphonesimulator_cc = xcrun -sdk iphonesimulator clang @@ -30,7 +32,10 @@ iphonesimulator_configs = %static iphonesimulator_targetdir = /iphonesimulator # TODO: disable all install for this platform iphonesimulator_installdir = /iphonesimulator -iphonesimulator_components = $(xcframeworks) +iphonesimulator_components = $(xcframeworks) $(iostest_components) +iphonesimulator_targetrule = $(iostest_targetrule) +iphonesimulator_excludes = $(iostest_excludes) + ifneq ($(shell command -v brew 2> /dev/null),) MCPP_HOME ?= $(shell brew --prefix mcpp) @@ -113,3 +118,42 @@ icestormadmin[macosx]_system_libs := -ledit -lncurses Glacier2CryptPermissionsVerifier[macosx]_system_libs := $(Ice[macosx]_system_libs) Glacier2CryptPermissionsVerifier[iphoneos]_system_libs := $(Ice[iphoneos]_system_libs) Glacier2CryptPermissionsVerifier[iphonesimulator]_system_libs := $(Ice[iphonesimulator]_system_libs) + +is-iostest-program = $(and $(filter-out macosx,$2),$(filter test/%,$1)) +iostest_targetrule = $(if $(is-iostest-program),iostest,) + +iostest_components = TestCommon \ + test/Ice/% \ + test/IceSSL/% \ + test/IceDiscovery/% \ + test/IceLocatorDiscovery/% + +iostest_excludes = $(addprefix test/Ice/,\ + background \ + faultTolerance \ + gc \ + logger \ + properties \ + services \ + stringConverter \ + threadPoolPriority) + + +# +# Rule to build an iOS bundle for testing (this is used for packaging client/server programs) +# +define make-iostest-program +$2/$1.bundle/Info.plist: + $(Q)if [ ! -f $2/$1.bundle/Info.plist ] ; \ + then \ + $(MKDIR) -p $2/$1.bundle ; \ + sed "s/NAME/$1/" test/ios/bundles/BundleInfo.plist > $2/$1.bundle/Info.plist ; \ + fi + +$2/$1.bundle/$1.dylib: $5 $2/$1.bundle/Info.plist $(foreach d,$6,$($d_targets)) + $(E) "Linking [$8-$9] $$@" + $(Q)$(RM) $2/$1.bundle/$1.dylib + $(Q)$(or $($8_cxx),$(platform_cxx)) -bundle $(LDFLAGS) -o $2/$1.bundle/$1.dylib $5 $(strip $7) +endef + +get-iostest-program-targets = $2/$1.bundle/$1.dylib $2/$1.bundle/Info.plist diff --git a/config/Make.xcodesdk.rules b/config/Make.xcodesdk.rules deleted file mode 100644 index f0a62fd890c..00000000000 --- a/config/Make.xcodesdk.rules +++ /dev/null @@ -1,109 +0,0 @@ -# Copyright (c) ZeroC, Inc. - -# -# Xcode configuration to build Xcode sdks for Ice. -# -xcodesdk_objdir = static -xcodesdk_cppflags = $(static_cppflags) -xcodesdk_ldflags = $(static_ldflags) - -# -# $(call make-xcodesdk,$1=translator) -# -define make-xcodesdk -$(install_sdkdir)/%.sdk/SDKSettings.plist $(top_srcdir)/sdk/%.sdk/SDKSettings.plist: \ - $(top_srcdir)/config/%-SDKSettings.plist - $(Q)$(MKDIR) -p $$(@D) - $(Q)$(INSTALL) $$< $$@ - -srcs all:: $$(foreach p,$$(platforms),$(top_srcdir)/sdk/$$p.sdk/SDKSettings.plist) - -install:: $$(foreach p,$$(platforms),$(install_sdkdir)/$$p.sdk/SDKSettings.plist) - -endef - -# -# $(call make-xcodesdk-component-with-config,$1=project,$2=component,$3=platform,$4=config,$5=comp[platform-config]) -# -define make-xcodesdk-component-with-config - -ifneq ($(filter-out $(sdk_includedirs),$3-$2),) -sdk_includedirs += $3-$2 - -$$(eval $$(call install-data-files,$$(wildcard $$($2_includedir)/*.h),include,\ - $(top_srcdir)/sdk/$3.sdk/usr/include,$5)) -$$(eval $$(call install-data-files,$$(filter include/generated/%,$$($2_generated_headers)),include/generated,\ - $(top_srcdir)/sdk/$3.sdk/usr/include,$5)) - -$$(eval $$(call install-data-files,$$(wildcard $$($2_includedir)/*.h),include,\ - $(install_sdkdir)/$3.sdk/usr/include,$5_install)) -$$(eval $$(call install-data-files,$$(filter include/generated/%,$$($2_generated_headers)),include/generated,\ - $(install_sdkdir)/$3.sdk/usr/include,$5_install)) -endif - -endef - -# -# $(call make-xcode-project-with-config,$1=project,$2=platform,$3=config) -# -define make-xcode-project-with-config - -$1/.translator-$2-$3.dep: $$($$($1_slicecompiler)_path) - $(Q)if [ -f $1/.translator-$2-$3.dep ]; \ - then \ - xcodebuild -sdk $2 \ - -project "$1/$$(call $1_project,$2,$3)" \ - -configuration "$$(call $1_configuration,$2,$3)" \ - -scheme "$$(call $1_scheme,$2,$3)" \ - $(if $(V),,-quiet) SYMROOT=./build-$2-$3 OBJROOT=./objs-$2-$3 \ - clean; \ - fi - touch $1/.translator-$2-$3.dep - -$1[$2-$3]: $$($1_dependencies) $1/.translator-$2-$3.dep - $(E) "Running xcodebuild for $1 scheme=\"$$(call $1_scheme,$2,$3)\"" - $(Q)xcodebuild -sdk $2 \ - -project "$1/$$(call $1_project,$2,$3)" \ - -configuration "$$(call $1_configuration,$2,$3)" \ - -scheme "$$(call $1_scheme,$2,$3)" \ - $(if $(ICE_BIN_DIST),HEADER_SEARCH_PATHS=../../Ice\ ../../include\ $(sdkdir)/$2.sdk/usr/include \ - LIBRARY_SEARCH_PATHS=$(sdkdir)/$2.sdk/usr/lib) \ - $(if $(V),,-quiet) SYMROOT=./build-$2-$3 OBJROOT=./objs-$2-$3 \ - $(if $(PLATFORM_NAME),iphonesimulator,-arch `uname -m`) \ - build - -$1[$2-$3]_clean: - $(E) "Cleaning $1" - $(Q)xcodebuild -sdk $2 \ - -project "$1/$$(call $1_project,$2,$3)" \ - -configuration "$$(call $1_configuration,$2,$3)" \ - -scheme "$$(call $1_scheme,$2,$3)" \ - $(if $(V),,-quiet) SYMROOT=./build-$2-$3 OBJROOT=./objs-$2-$3 \ - clean - -$1:: $1[$2-$3] -$1_clean:: $1[$2-$3]_clean - -endef - -# -# $(call make-xcode-project,$1=project) -# -define make-xcode-project -# -# Define per- rules for this component. -# -$$(foreach p,$$(filter $(platforms),$$($1_platforms)),\ - $$(foreach c,$$(filter $$(or $$($$p_configs),%),$$(filter $(configs),$$($1_configs))),\ - $$(if $$(filter $(SKIP),$1[$$p-$$c]),,\ - $$(eval $$(call make-xcode-project-with-config,$1,$$p,$$c,$1[$$p-$$c]))))) - -$1:: -$1_clean:: -$1_distclean:: - $(Q)$(RM) -r $1/build - -all:: $1 -clean:: $1_clean -distclean:: $1_distclean -endef diff --git a/cpp/config/Make.rules b/cpp/config/Make.rules index 58ecae9c723..b4e2f225aa9 100644 --- a/cpp/config/Make.rules +++ b/cpp/config/Make.rules @@ -8,7 +8,6 @@ default-configs = shared -include $(lang_srcdir)/config/Make.rules.$(os) ifeq ($(os),Darwin) -include $(lang_srcdir)/config/Make.xcodesdk.rules include $(lang_srcdir)/config/Make.xcframework.rules endif @@ -110,8 +109,8 @@ $1[static]_cppflags += -DICE_STATIC_LIBS $(if $(IceBT_system_libs),-DICE_HAS $1[static]_dependencies := $(if $(IceBT_system_libs),IceBT) # Dependencies and target dirs for Xcode SDK test projects -$1[iphoneos-xcodesdk]_targetdir := test/ios/bundles/Bundles-iphoneos/$(subst /,_,$1) -$1[iphonesimulator-xcodesdk]_targetdir := test/ios/bundles/Bundles-iphonesimulator/$(subst /,_,$1) +$1[iphoneos-static]_targetdir := test/ios/bundles/Bundles-iphoneos/$(subst /,_,$1) +$1[iphonesimulator-static]_targetdir := test/ios/bundles/Bundles-iphonesimulator/$(subst /,_,$1) $(create-test-project) endef diff --git a/cpp/config/Make.xcodesdk.rules b/cpp/config/Make.xcodesdk.rules deleted file mode 100644 index dfac151d8a2..00000000000 --- a/cpp/config/Make.xcodesdk.rules +++ /dev/null @@ -1,80 +0,0 @@ -# Copyright (c) ZeroC, Inc. - -include $(top_srcdir)/config/Make.xcodesdk.rules - -supported-configs += xcodesdk - -is-iostest-program = $(and $(filter-out macosx,$2),$(filter test/%,$1)) - -# -# Xcode configuration to build Xcode sdks for Ice. -# -xcodesdk_targetdir = $(if $(filter %/build,$5),xcodesdk,$(if $(is-iostest-program),,$(if $(filter all cpp obj%c,$(ICE_BIN_DIST)),,../)../sdk/$2.sdk/usr/lib)) -xcodesdk_installdir = $(if $(filter %/build,$5),xcodesdk,$(if $(is-iostest-program),,../sdk/$2.sdk/usr/lib)) -xcodesdk_targetrule = $(if $(is-iostest-program),iostest,$(if $(filter-out program,$($1_target)),static)) - -xcodesdk_components = Ice Glacier2 IceStorm IceGrid IceDiscovery IceLocatorDiscovery IceIAP TestCommon -xcodesdk_projects = test/Ice/% test/IceSSL/configuration -xcodesdk_excludes = $(addprefix test/Ice/,background \ - faultTolerance \ - gc \ - logger \ - properties \ - stringConverter \ - threadPoolPriority) - -# -# Rule to build an iOS bundle for testing (this is used for packaging client/server programs) -# -define make-iostest-program -$2/$1.bundle/Info.plist: - $(Q)if [ ! -f $2/$1.bundle/Info.plist ] ; \ - then \ - $(MKDIR) -p $2/$1.bundle ; \ - sed "s/NAME/$1/" test/ios/bundles/BundleInfo.plist > $2/$1.bundle/Info.plist ; \ - fi - -$2/$1.bundle/$1.dylib: $5 $2/$1.bundle/Info.plist $(foreach d,$6,$($d_targets)) - $(E) "Linking [$8-$9] $$@" - $(Q)$(RM) $2/$1.bundle/$1.dylib - $(Q)$(or $($8_cxx),$(platform_cxx)) -bundle $(LDFLAGS) -o $2/$1.bundle/$1.dylib $5 $(strip $7) -endef - -get-iostest-program-targets = $2/$1.bundle/$1.dylib $2/$1.bundle/Info.plist - -make-iostest-library = $(make-static-library) -get-iostest-library-targets = $(get-static-library-targets) - -ifneq ($(findstring xcodesdk,$(configs)),) -$(eval $(call make-xcodesdk,bin/slice2cpp)) -component_with_config_extensions := make-cpp-xcodesdk-component-with-config -endif - -# -# $(call make-xcodesdk-component-with-config,$1=project,$2=component,$3=platform,$4=config,$5=comp[platform-config]) -# -define make-cpp-xcodesdk-component-with-config -ifneq ($(filter src/%,$1),) - -$(make-xcodesdk-component-with-config) -ifneq ($$(and $(filter Ice,$2),$(filter-out $(sdk_includedirs),$3-IceUtil)),) -sdk_includedirs += $3-IceUtil -$$(eval $$(call install-data-files,$$(wildcard include/IceUtil/*.h),include,\ - $(top_srcdir)/sdk/$3.sdk/usr/include,$5)) -$$(eval $$(call install-data-files,$$(wildcard include/IceUtil/*.h),include,\ - $(install_sdkdir)/$3.sdk/usr/include,$5_install)) -endif - -ifneq ($$(and $(filter Ice,$2),$(filter-out $(sdk_includedirs),$3-Ice/SSL)),) -sdk_includedirs += $3-Ice/SSL -$$(eval $$(call install-data-files,$$(wildcard include/Ice/SSL/*.h),include,\ - $(top_srcdir)/sdk/$3.sdk/usr/include,$5)) -$$(eval $$(call install-data-files,$$(wildcard include/Ice/SSL/*.h),include,\ - $(install_sdkdir)/$3.sdk/usr/include,$5_install)) -endif - -$5_clean:: - $(Q)$(RM) -r $(top_srcdir)/sdk/$3.sdk/usr/include/$2 - -endif -endef diff --git a/cpp/test/IceSSL/configuration/Makefile.mk b/cpp/test/IceSSL/configuration/Makefile.mk index 8483670299c..f845c8980e6 100644 --- a/cpp/test/IceSSL/configuration/Makefile.mk +++ b/cpp/test/IceSSL/configuration/Makefile.mk @@ -16,8 +16,4 @@ ifeq ($(os),Linux) $(project)_cppflags += $(if $(filter yes,$(OPTIMIZE)),-fno-var-tracking-assignments) endif -# Need to load certificates with functions from src/IceSSL/SSLUtil.h -$(test)[iphoneos]_cppflags := -Isrc -$(test)[iphonesimulator]_cppflags := -Isrc - tests += $(project) diff --git a/cpp/test/ios/controller/C++ Test Controller.xcodeproj/project.pbxproj b/cpp/test/ios/controller/C++ Test Controller.xcodeproj/project.pbxproj index d5d00e7e26e..ab78802a517 100644 --- a/cpp/test/ios/controller/C++ Test Controller.xcodeproj/project.pbxproj +++ b/cpp/test/ios/controller/C++ Test Controller.xcodeproj/project.pbxproj @@ -371,21 +371,20 @@ DEVELOPMENT_TEAM = U4TBVKNQ7F; ENABLE_BITCODE = NO; GCC_INLINES_ARE_PRIVATE_EXTERN = NO; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - ); + GCC_PREPROCESSOR_DEFINITIONS = "DEBUG=1"; GCC_SYMBOLS_PRIVATE_EXTERN = NO; HEADER_SEARCH_PATHS = ( ../../include, - "../../../../sdk/$(PLATFORM_NAME).sdk/usr/include", + ../../../include, + ../../../include/generated, ); INFOPLIST_FILE = Bundle/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; - LIBRARY_SEARCH_PATHS = "../../../../sdk/$(PLATFORM_NAME).sdk/usr/lib"; + LIBRARY_SEARCH_PATHS = "../../../lib/$(PLATFORM_NAME)"; MACOSX_DEPLOYMENT_TARGET = 10.12; MTL_ENABLE_DEBUG_INFO = YES; OTHER_LDFLAGS = ( - "-L../../Common/build/$(PLATFORM_NAME)/xcodesdk", + "-L../../Common/build/$(PLATFORM_NAME)/static", "-lTestCommon", "-lIceDiscovery", "-lIce", @@ -411,15 +410,16 @@ GCC_SYMBOLS_PRIVATE_EXTERN = NO; HEADER_SEARCH_PATHS = ( ../../include, - "../../../../sdk/$(PLATFORM_NAME).sdk/usr/include", + ../../../include, + ../../../include/generated, ); INFOPLIST_FILE = Bundle/Info.plist; INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Bundles"; - LIBRARY_SEARCH_PATHS = "../../../../sdk/$(PLATFORM_NAME).sdk/usr/lib"; + LIBRARY_SEARCH_PATHS = "../../../lib/$(PLATFORM_NAME)"; MACOSX_DEPLOYMENT_TARGET = 10.12; MTL_ENABLE_DEBUG_INFO = NO; OTHER_LDFLAGS = ( - "-L../../Common/build/$(PLATFORM_NAME)/xcodesdk", + "-L../../Common/build/$(PLATFORM_NAME)/static", "-lTestCommon", "-lIceDiscovery", "-lIce", @@ -447,10 +447,10 @@ "$(inherited)", "@executable_path/Frameworks", ); - LIBRARY_SEARCH_PATHS = "../../../../sdk/$(PLATFORM_NAME).sdk/usr/lib"; + LIBRARY_SEARCH_PATHS = "../../../lib/$(PLATFORM_NAME)"; OTHER_CFLAGS = "-fobjc-arc-exceptions"; OTHER_LDFLAGS = ( - "-L../../Common/build/$(PLATFORM_NAME)/xcodesdk", + "-L../../Common/build/$(PLATFORM_NAME)/static", "-lTestCommon", "-lIce", "-lIceDiscovery", @@ -477,10 +477,10 @@ "$(inherited)", "@executable_path/Frameworks", ); - LIBRARY_SEARCH_PATHS = "../../../../sdk/$(PLATFORM_NAME).sdk/usr/lib"; + LIBRARY_SEARCH_PATHS = "../../../lib/$(PLATFORM_NAME)"; OTHER_CFLAGS = "-fobjc-arc-exceptions"; OTHER_LDFLAGS = ( - "-L../../Common/build/$(PLATFORM_NAME)/xcodesdk", + "-L../../Common/build/$(PLATFORM_NAME)/static", "-lTestCommon", "-lIce", "-lIceDiscovery", @@ -499,7 +499,7 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "c++20"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES; @@ -552,7 +552,7 @@ ALWAYS_SEARCH_USER_PATHS = NO; CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; CLANG_ANALYZER_NONNULL = YES; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LANGUAGE_STANDARD = "c++20"; CLANG_CXX_LIBRARY = "libc++"; CLANG_ENABLE_MODULES = YES; CLANG_ENABLE_OBJC_ARC = YES;