From 4daf12644a0436aca6ff3535b62de5154b52b092 Mon Sep 17 00:00:00 2001 From: Georg Hagen Date: Sat, 3 Aug 2024 11:37:54 +0200 Subject: [PATCH 1/9] Fix typo --- cmake/Filter.cmake | 3 +-- openVulkanoCpp/AR/ArSession.hpp | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/cmake/Filter.cmake b/cmake/Filter.cmake index d030112..cb942a4 100644 --- a/cmake/Filter.cmake +++ b/cmake/Filter.cmake @@ -1,5 +1,4 @@ function(FilterPlatformPaths sourcesVar) - if (IOS) list(FILTER ${sourcesVar} EXCLUDE REGEX ".*GLFW.*") list(FILTER ${sourcesVar} EXCLUDE REGEX ".*[\\/]Host[\\/]MacOS[\\/].*") @@ -8,7 +7,7 @@ function(FilterPlatformPaths sourcesVar) list(FILTER ${sourcesVar} EXCLUDE REGEX ".*[\\/]AR[\\/]Provider[\\/]ArKit[\\/].*") endif () if (NOT APPLE) - list(FILTER ${sourcesVar} EXCLUDE REGEX ".*[\\/]Host[\\/]Apple[\\/].*") + list(FILTER ${sourcesVar} EXCLUDE REGEX ".*[\\/]Host[\\/]Apple[\\/].*") endif () if (NOT LINUX) list(FILTER ${sourcesVar} EXCLUDE REGEX ".*[\\/]Host[\\/]Linux[\\/].*") diff --git a/openVulkanoCpp/AR/ArSession.hpp b/openVulkanoCpp/AR/ArSession.hpp index fc32621..1cf1101 100644 --- a/openVulkanoCpp/AR/ArSession.hpp +++ b/openVulkanoCpp/AR/ArSession.hpp @@ -52,7 +52,7 @@ namespace OpenVulkano::AR public: ArSessionCapabilities() = default; - ArSessionCapabilities(const ArType type, const ArSessionType sessionType, const bool uncompressed, const bool depthSupported, const bool supportsExposureLocking, const bool suppoertWhitebalanceLocking, const bool hasFlash) + ArSessionCapabilities(const ArType type, const ArSessionType sessionType, const bool uncompressed, const bool depthSupported, const bool supportsExposureLocking, const bool supportsWhitebalanceLocking, const bool hasFlash) : type(type), sessionType(sessionType), uncompressed(uncompressed), depthSupported(depthSupported), supportsExposureLocking(supportsExposureLocking), supportsWhitebalanceLocking(supportsWhitebalanceLocking), hasFlashlight(hasFlash) {} From 836fabb4941c2307ebe3671b741ea75cf350746b Mon Sep 17 00:00:00 2001 From: Georg Hagen Date: Sat, 3 Aug 2024 11:58:18 +0200 Subject: [PATCH 2/9] Fix issues with none existing resources in apple BundledResourceLoader --- openVulkanoCpp/Host/Apple/BundledResoureLoaderIos.mm | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/openVulkanoCpp/Host/Apple/BundledResoureLoaderIos.mm b/openVulkanoCpp/Host/Apple/BundledResoureLoaderIos.mm index a6e04ec..603dacb 100644 --- a/openVulkanoCpp/Host/Apple/BundledResoureLoaderIos.mm +++ b/openVulkanoCpp/Host/Apple/BundledResoureLoaderIos.mm @@ -22,9 +22,10 @@ namespace OpenVulkano { auto [fileName, fileType] = Utils::SplitAtLastOccurrence(resourceName, '.'); NSString* filePath = [[NSBundle mainBundle] pathForResource:[NSString stringWithUTF8String:fileName.c_str()] ofType:[NSString stringWithUTF8String:fileType.c_str()]]; - return Utils::ReadFile(std::string([filePath UTF8String])); + if (filePath) + return Utils::ReadFile(std::string([filePath UTF8String])); } Logger::FILESYS->warn("Failed to find resource: '{}' in bundle", resourceName); - return {0}; + return {}; } } From e8d5b16356bd603870eb4788d06abec95427aa6e Mon Sep 17 00:00:00 2001 From: Georg Hagen Date: Sat, 3 Aug 2024 15:09:39 +0200 Subject: [PATCH 3/9] Link libjpeg-turbo on iOS against prebuilt lib This needs to be fixed at some point, see #99 --- 3rdParty/CMakeLists.txt | 2 +- 3rdParty/libjpeg-turbo/CMakeLists.txt | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/3rdParty/CMakeLists.txt b/3rdParty/CMakeLists.txt index d345507..976fbb5 100644 --- a/3rdParty/CMakeLists.txt +++ b/3rdParty/CMakeLists.txt @@ -22,7 +22,7 @@ add_subdirectory(rapidyaml) add_subdirectory(libarchive) add_subdirectory(boost) add_subdirectory(units) +add_subdirectory(libjpeg-turbo) if (NOT IOS) - add_subdirectory(libjpeg-turbo) add_subdirectory(curl) endif() diff --git a/3rdParty/libjpeg-turbo/CMakeLists.txt b/3rdParty/libjpeg-turbo/CMakeLists.txt index 361be53..5a87a88 100644 --- a/3rdParty/libjpeg-turbo/CMakeLists.txt +++ b/3rdParty/libjpeg-turbo/CMakeLists.txt @@ -31,6 +31,11 @@ endif () function(LinkLibJpegTurbo TARGET) + if (IOS) + target_link_libraries(${TARGET} PRIVATE "/opt/libjpeg-turbo-ios/lib/libturbojpeg.a") + target_include_directories(${TARGET} PRIVATE "/opt/libjpeg-turbo-ios/include") + return() + endif () if (libjpeg-turbo_BUILT) FindCmakeConfigDirs("${CMAKE_BINARY_DIR}/deps_ljt/INSTALL/" CMAKE_PREFIX_PATH) endif() From ccc234b699e908ddfff7f322cd000db333eec13f Mon Sep 17 00:00:00 2001 From: Georg Hagen Date: Sat, 3 Aug 2024 18:57:43 +0200 Subject: [PATCH 4/9] Add example app runner for iOS --- cmake/AppleHelper.cmake | 14 ++-- examples/ExampleAppList.hpp | 23 +++++++ examples/Host/iOS/ExampleViewController.h | 19 ++++++ examples/Host/iOS/ExampleViewController.mm | 75 ++++++++++++++++++++++ examples/Host/iOS/main.mm | 57 ++++++++++++++++ examples/main.cpp | 28 +++----- 6 files changed, 192 insertions(+), 24 deletions(-) create mode 100644 examples/ExampleAppList.hpp create mode 100644 examples/Host/iOS/ExampleViewController.h create mode 100644 examples/Host/iOS/ExampleViewController.mm create mode 100644 examples/Host/iOS/main.mm diff --git a/cmake/AppleHelper.cmake b/cmake/AppleHelper.cmake index c38f88f..b331843 100644 --- a/cmake/AppleHelper.cmake +++ b/cmake/AppleHelper.cmake @@ -4,16 +4,20 @@ function(LinkAppleFrameworks TARGET) PUBLIC "-framework Foundation" PUBLIC "-framework CoreImage" PUBLIC "-framework CoreVideo" + PUBLIC "-framework CoreGraphics" PUBLIC "-framework Metal" PUBLIC "-framework MetalPerformanceShaders" + PUBLIC "-framework MetalKit" + PUBLIC "-framework IOSurface" + PUBLIC "-framework QuartzCore" PUBLIC "-lstdc++" PUBLIC c++ PUBLIC c ) if(IOS) - target_link_libraries(${TARGET} PUBLIC "-framework ARKit") - endif() + target_link_libraries(${TARGET} PUBLIC "-framework ARKit") + endif() # Locate system libraries on iOS find_library(UIKIT UIKit) @@ -30,10 +34,10 @@ function(LinkAppleFrameworks TARGET) target_link_libraries(${TARGET} PUBLIC ${UIKIT}) target_link_libraries(${TARGET} PUBLIC ${MOBILECORESERVICES}) else() - target_link_libraries(${TARGET} PUBLIC ${APPKIT}) - target_link_libraries(${TARGET} PUBLIC ${IOSURFACE}) - target_link_libraries(${TARGET} PUBLIC ${QUARTZ}) + target_link_libraries(${TARGET} PUBLIC ${APPKIT}) + target_link_libraries(${TARGET} PUBLIC ${QUARTZ}) endif() + target_link_libraries(${TARGET} PUBLIC ${IOSURFACE}) target_link_libraries(${TARGET} PUBLIC ${FOUNDATION}) target_link_libraries(${TARGET} PUBLIC ${CFNETWORK}) target_link_libraries(${TARGET} PUBLIC ${SYSTEMCONFIGURATION}) diff --git a/examples/ExampleAppList.hpp b/examples/ExampleAppList.hpp new file mode 100644 index 0000000..3308eb3 --- /dev/null +++ b/examples/ExampleAppList.hpp @@ -0,0 +1,23 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#include "ExampleApps/CubesExampleApp.hpp" +#include "ExampleApps/MovingCubeApp.hpp" +#include "ExampleApps/TexturedCubeExampleApp.hpp" +#include "ExampleApps/BillboardExampleApp.hpp" +#include + +namespace OpenVulkano +{ + const std::vector> EXAMPLE_APPS = { + { "Cubes Example App", &CubesExampleApp::Create }, + { "Moving Cube Example App", &MovingCubeApp::Create }, + { "Textured Cube Example App", &TexturedCubeExampleApp::Create }, + { "Billboard Example App", &BillboardExampleApp::Create } + }; +} diff --git a/examples/Host/iOS/ExampleViewController.h b/examples/Host/iOS/ExampleViewController.h new file mode 100644 index 0000000..de2621c --- /dev/null +++ b/examples/Host/iOS/ExampleViewController.h @@ -0,0 +1,19 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#pragma once + +#import +#import +#import "Host/iOS/OpenVulkanoViewController.h" + +@interface MainMenuViewController : UIViewController +@end + +@interface ExampleViewController : OpenVulkanoViewController +@property(nonatomic, strong)OpenVulkanoView* renderView; +@property size_t exampleId; +@end diff --git a/examples/Host/iOS/ExampleViewController.mm b/examples/Host/iOS/ExampleViewController.mm new file mode 100644 index 0000000..350c9c6 --- /dev/null +++ b/examples/Host/iOS/ExampleViewController.mm @@ -0,0 +1,75 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#import "ExampleViewController.h" + +#include "../../ExampleAppList.hpp" + +@implementation MainMenuViewController +- (void)viewDidLoad { + [super viewDidLoad]; + + self.view.backgroundColor = [UIColor whiteColor]; + + CGFloat buttonHeight = 50; + CGFloat buttonSpacing = 10; + CGFloat topMargin = 50; + + int i = 0; + for (const auto& app : OpenVulkano::EXAMPLE_APPS) + { + UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem]; + button.frame = CGRectMake(20, + topMargin + i * (buttonHeight + buttonSpacing), + self.view.bounds.size.width - 40, + buttonHeight); + [button setTitle:[NSString stringWithUTF8String:app.first] forState:UIControlStateNormal]; + button.tag = i; + [button addTarget:self action:@selector(buttonPressed:) forControlEvents:UIControlEventTouchUpInside]; + [self.view addSubview:button]; + i++; + } + + self.view.frame = [UIScreen mainScreen].bounds; + self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; +} + +- (void)buttonPressed:(UIButton *)sender { + ExampleViewController* example = [[ExampleViewController alloc] init]; + example.exampleId = sender.tag; + example.modalPresentationStyle = UIModalPresentationFullScreen; + [self presentViewController:example animated:true completion:nil]; +} + +- (void)viewDidLayoutSubviews { + [super viewDidLayoutSubviews]; + self.view.frame = self.view.superview.bounds; +} +@end + +@implementation ExampleViewController +- (void)viewDidLoad { + self.renderView = [[OpenVulkanoView alloc] initWithFrame:self.view.frame]; + self.openVulkanoView = self.renderView; + [self.view addSubview:self.renderView]; + [super viewDidLoad]; + + self.view.frame = [UIScreen mainScreen].bounds; + self.view.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight; +} + +- (void)viewDidLayoutSubviews { + [super viewDidLayoutSubviews]; + self.view.frame = self.view.superview.bounds; + self.renderView.frame = self.view.frame; +} + +- (BOOL)prefersStatusBarHidden { return true; } + +- (void *)makeGraphicsApp { + return OpenVulkano::EXAMPLE_APPS[self.exampleId].second(); +} +@end diff --git a/examples/Host/iOS/main.mm b/examples/Host/iOS/main.mm new file mode 100644 index 0000000..8bfea05 --- /dev/null +++ b/examples/Host/iOS/main.mm @@ -0,0 +1,57 @@ +/* + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at https://mozilla.org/MPL/2.0/. + */ + +#import +#import +#import "ExampleViewController.h" +#import "Host/iOS/OpenVulkanoAppDelegate.h" + +#include "Base/Logger.hpp" + +@interface SceneDelegate : UIResponder +@end + +@implementation SceneDelegate +@synthesize window = _window; +- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions { + if ([scene isKindOfClass:[UIWindowScene class]]) { + UIWindowScene* wScene = (UIWindowScene*)scene; + self.window = [[UIWindow alloc] initWithWindowScene:wScene]; + + MainMenuViewController* rootViewController = [[MainMenuViewController alloc] init]; + UINavigationController* navigationController = [[UINavigationController alloc] initWithRootViewController:rootViewController]; + + self.window.rootViewController = navigationController; + [self.window makeKeyAndVisible]; + } +} +@end + +@interface AppDelegate : OpenVulkanoAppDelegate +@end + +@implementation AppDelegate +- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { + // Override point for customization after application launch. + return YES; +} + +- (UISceneConfiguration *)application:(UIApplication *)application configurationForConnectingSceneSession:(UISceneSession *)connectingSceneSession options:(UISceneConnectionOptions *)options { + UISceneConfiguration *configuration = [[UISceneConfiguration alloc] initWithName:nil sessionRole:UIWindowSceneSessionRoleApplication]; + configuration.delegateClass = SceneDelegate.class; + return configuration; +} +@end + +int main(int argCount, char** args) +{ + using namespace OpenVulkano; + Logger::SetupLogger(); + @autoreleasepool + { + return UIApplicationMain(argCount, args, nil, NSStringFromClass([AppDelegate class])); + } +} diff --git a/examples/main.cpp b/examples/main.cpp index 388087e..002e431 100644 --- a/examples/main.cpp +++ b/examples/main.cpp @@ -5,10 +5,7 @@ */ #include "Host/GraphicsAppManager.hpp" -#include "ExampleApps/CubesExampleApp.hpp" -#include "ExampleApps/MovingCubeApp.hpp" -#include "ExampleApps/TexturedCubeExampleApp.hpp" -#include "ExampleApps/BillboardExampleApp.hpp" +#include "ExampleAppList.hpp" #include #include @@ -22,12 +19,11 @@ using namespace OpenVulkano; int main(int argc, char** argv) { - std::vector examples = { - "Cubes Example App", - "Moving Cube Example App", - "Textured Cube Example App", - "Billboard Example App" - }; + std::vector examples; + for (const auto& e : EXAMPLE_APPS) + { + examples.emplace_back(e.first); + } int selectedExample = 0; ftxui::MenuOption option; @@ -37,15 +33,9 @@ int main(int argc, char** argv) screen.Loop(menu); - std::unique_ptr app; - switch (selectedExample) - { - case 0: app = CubesExampleApp::CreateUnique(); break; - case 1: app = MovingCubeApp::CreateUnique(); break; - case 2: app = TexturedCubeExampleApp::CreateUnique(); break; - case 3: app = BillboardExampleApp::CreateUnique(); break; - default: throw std::runtime_error("Invalid menu selection!"); break; - } + if (selectedExample >= examples.size()) throw std::runtime_error("Invalid menu selection!"); + + std::unique_ptr app( EXAMPLE_APPS[selectedExample].second() ); GraphicsAppManager manager(app.get()); manager.Run(); From de066231055c69b2010438f48231c599765d14f6 Mon Sep 17 00:00:00 2001 From: Georg Hagen Date: Sat, 3 Aug 2024 19:16:46 +0200 Subject: [PATCH 5/9] Update texture sampler config handling --- openVulkanoCpp/Scene/Textrue.cpp | 5 +++-- openVulkanoCpp/Scene/Texture.hpp | 4 ++-- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/openVulkanoCpp/Scene/Textrue.cpp b/openVulkanoCpp/Scene/Textrue.cpp index 8f74300..389e328 100644 --- a/openVulkanoCpp/Scene/Textrue.cpp +++ b/openVulkanoCpp/Scene/Textrue.cpp @@ -8,7 +8,7 @@ namespace OpenVulkano::Scene { - Texture Texture::PLACEHOLDER = Texture(SamplerConfig::DEFAULT, true); + Texture Texture::PLACEHOLDER = Texture(&SamplerConfig::NEAREST, true); void Texture::MakePlaceholder(uint32_t width, uint32_t height, Math::Vector4uc color1, Math::Vector4uc color2) { @@ -25,5 +25,6 @@ namespace OpenVulkano::Scene resolution = {width, height, 1}; size = sizeof(Math::Vector4uc) * width * height; format = DataFormat::B8G8R8A8_UNORM; + m_samplerConfig = &SamplerConfig::NEAREST; } -} \ No newline at end of file +} diff --git a/openVulkanoCpp/Scene/Texture.hpp b/openVulkanoCpp/Scene/Texture.hpp index 41b854d..e65a1ce 100644 --- a/openVulkanoCpp/Scene/Texture.hpp +++ b/openVulkanoCpp/Scene/Texture.hpp @@ -34,10 +34,10 @@ namespace OpenVulkano::Scene Math::Vector3ui resolution = {0,0,0}; DataFormat format = DataFormat::B8G8R8A8_UNORM; UpdateFrequency updateFrequency = UpdateFrequency::Never; - const SamplerConfig& m_samplerConfig; + const SamplerConfig* m_samplerConfig; bool updated = true; - Texture(const SamplerConfig& samplerConfig = SamplerConfig::DEFAULT, bool placeholder = false) + Texture(const SamplerConfig* samplerConfig = &SamplerConfig::DEFAULT, bool placeholder = false) : m_samplerConfig(samplerConfig) { if (placeholder) MakePlaceholder(); } From dfd0cd0d673d6576dd32f986b7fb4bea09350124 Mon Sep 17 00:00:00 2001 From: Georg Hagen Date: Sat, 3 Aug 2024 19:17:00 +0200 Subject: [PATCH 6/9] Build for iOS --- .gitea/workflows/build_pc.yml | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/.gitea/workflows/build_pc.yml b/.gitea/workflows/build_pc.yml index 69f5f05..f3c685d 100644 --- a/.gitea/workflows/build_pc.yml +++ b/.gitea/workflows/build_pc.yml @@ -43,3 +43,18 @@ jobs: run: ctest -C ${{env.BUILD_TYPE}} #TODO archive executables + + + build_iOS: + name: Build iOS + runs-on: mac_arm + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + submodules: true + - name: Configure CMake + run: mkdir build && cd build && cmake .. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain/ios.toolchain.cmake -DPLATFORM=OS64 + - name: Build & Archive + run: xcodebuild -project ${{github.workspace}}/cmake-build/iOS/MadVoxel_Scan.xcodeproj -scheme MadVoxel_Scan -configuration Release -archivePath ${{github.workspace}}/cmake-build/iOS/app.xcarchive -sdk iphoneos archive \ No newline at end of file From 7918b912116c30f8acaa83b57d61a051831c4f0b Mon Sep 17 00:00:00 2001 From: Georg Hagen Date: Sat, 3 Aug 2024 19:34:15 +0200 Subject: [PATCH 7/9] Fix crash --- examples/ExampleApps/BillboardExampleApp.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/ExampleApps/BillboardExampleApp.cpp b/examples/ExampleApps/BillboardExampleApp.cpp index f839f66..3c98ba6 100644 --- a/examples/ExampleApps/BillboardExampleApp.cpp +++ b/examples/ExampleApps/BillboardExampleApp.cpp @@ -52,7 +52,7 @@ namespace OpenVulkano m_quadBillboardShader.AddShaderProgram(OpenVulkano::ShaderProgramType::VERTEX, "Shader/billboardFromSinglePoint"); m_quadBillboardShader.AddShaderProgram(OpenVulkano::ShaderProgramType::GEOMETRY, "Shader/billboardFromSinglePoint"); - m_quadBillboardShader.AddShaderProgram(OpenVulkano::ShaderProgramType::FRAGMENT, "Shader/basicTexture"); + m_quadBillboardShader.AddShaderProgram(OpenVulkano::ShaderProgramType::FRAGMENT, "Shader/basic"); m_quadBillboardShader.AddVertexInputDescription(OpenVulkano::Vertex::GetVertexInputDescription()); m_quadBillboardShader.AddDescriptorSetLayoutBinding(Texture::DESCRIPTOR_SET_LAYOUT_BINDING); m_quadBillboardShader.AddDescriptorSetLayoutBinding(UniformBuffer::DESCRIPTOR_SET_LAYOUT_BINDING); From d0643946ccfc3eb060ef126f075c321c4443795c Mon Sep 17 00:00:00 2001 From: Georg Hagen Date: Sat, 3 Aug 2024 19:34:37 +0200 Subject: [PATCH 8/9] Update CMake for iOS build --- CMakeLists.txt | 40 +++++++++++++++++++++++++++------------- 1 file changed, 27 insertions(+), 13 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b7aebc2..cbc96f4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -41,20 +41,26 @@ configure_file(${CMAKE_CURRENT_SOURCE_DIR}/cmake/TryCompileShaders.cmake.in ${CM execute_process(COMMAND ${BASH_EXECUTABLE} CompileShaders.sh "${SHADER_OUTPUT_DEST}" WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/Scripts) file(GLOB GENERATED_SHADER_SOURCES "${SHADER_OUTPUT_DEST}/*") +set(MAIN_FILE examples/main.cpp) +if (IOS) + set(MAIN_FILE examples/Host/iOS/main.mm) +endif () + +file(GLOB_RECURSE sources CONFIGURE_DEPENDS "openVulkanoCpp/*.h" "openVulkanoCpp/*.c" "openVulkanoCpp/*.hpp" "openVulkanoCpp/*.cpp" "examples/*.hpp" "examples/*.cpp") + if(APPLE) - file(GLOB_RECURSE sources CONFIGURE_DEPENDS "openVulkanoCpp/*.mm" "openVulkanoCpp/*.m" "openVulkanoCpp/*.c" "openVulkanoCpp/*.cpp" "examples/*.hpp" "examples/*.cpp") - add_executable(openVulkanoCpp examples/main.cpp ${resources} ${GENERATED_SHADER_SOURCES}) -else() - file(GLOB_RECURSE sources CONFIGURE_DEPENDS "openVulkanoCpp/*.h" "openVulkanoCpp/*.c" "openVulkanoCpp/*.hpp" "openVulkanoCpp/*.cpp" "examples/*.hpp" "examples/*.cpp") - file(GLOB SHADER_SRC_FILES ${ROOT_FOLDER}/openVulkanoCpp/Shader/*) - list(FILTER SHADER_SRC_FILES EXCLUDE REGEX ".*\\.(hpp|cpp)$") - add_executable(openVulkanoCpp examples/main.cpp ${SHADER_SRC_FILES} ${GENERATED_SHADER_SOURCES}) - if (MSVC) - set_property(GLOBAL PROPERTY USE_FOLDERS ON) - source_group("Shaders" FILES ${SHADER_SRC_FILES}) - endif() + file(GLOB_RECURSE sources_obj CONFIGURE_DEPENDS "openVulkanoCpp/*.mm" "openVulkanoCpp/*.m" "examples/*.m" "examples/*.mm") + list(APPEND sources ${sources_obj}) endif() +file(GLOB SHADER_SRC_FILES ${ROOT_FOLDER}/openVulkanoCpp/Shader/*) +list(FILTER SHADER_SRC_FILES EXCLUDE REGEX ".*\\.(hpp|cpp)$") + +add_executable(openVulkanoCpp ${MAIN_FILE} ${SHADER_SRC_FILES} ${GENERATED_SHADER_SOURCES}) + +set_property(GLOBAL PROPERTY USE_FOLDERS ON) +source_group("Shaders" FILES ${SHADER_SRC_FILES}) + FilterPlatformPaths(sources) SetWarningSettings(openVulkanoCpp) set_property(TARGET openVulkanoCpp PROPERTY CXX_STANDARD 20) @@ -69,7 +75,13 @@ if(IOS) set(MACOSX_BUNDLE_GUI_IDENTIFIER ${APP_BUNDLE_IDENTIFIER}) set(MACOSX_BUNDLE_BUNDLE_NAME ${APP_BUNDLE_IDENTIFIER}) - set(CMAKE_OSX_DEPLOYMENT_TARGET "14.1") # The used ARKit features are only available starting with iOS 14 + set(CMAKE_OSX_DEPLOYMENT_TARGET "16") # The used ARKit features are only available starting with iOS 16 + + set(CMAKE_XCODE_EMBED_FRAMEWORKS ON) + + set_target_properties(openVulkanoCpp PROPERTIES + XCODE_ATTRIBUTE_DEVELOPMENT_TEAM "466MGSD624" + ) endif() if(APPLE) LinkAppleFrameworks(openVulkanoCpp) @@ -107,7 +119,9 @@ endif() list(APPEND CMAKE_PREFIX_PATH ${CMAKE_BINARY_DIR}/deps/INSTALL) target_link_libraries(openVulkanoCpp PRIVATE magic_enum yaml-cpp fmt spdlog glm pugixml stb eigen utf8cpp imgui_internal TracyClient stud-uuid ryml unordered_dense Boost::regex units) -LinkCurl(openVulkanoCpp) +if (NOT IOS) + LinkCurl(openVulkanoCpp) +endif() add_compile_definitions(LIBARCHIVE_STATIC) add_compile_definitions(NOMINMAX) From d3f26c34cc87c7f58cb1840b4f247646534df39c Mon Sep 17 00:00:00 2001 From: Georg Hagen Date: Sat, 3 Aug 2024 21:27:56 +0200 Subject: [PATCH 9/9] Fix build server config --- .gitea/workflows/build_pc.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/build_pc.yml b/.gitea/workflows/build_pc.yml index f3c685d..adc7430 100644 --- a/.gitea/workflows/build_pc.yml +++ b/.gitea/workflows/build_pc.yml @@ -55,6 +55,6 @@ jobs: with: submodules: true - name: Configure CMake - run: mkdir build && cd build && cmake .. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../cmake/toolchain/ios.toolchain.cmake -DPLATFORM=OS64 + run: mkdir cmake-build && mkdir cmake-build/iOS && cd cmake-build/iOS && cmake ../.. -G Xcode -DCMAKE_TOOLCHAIN_FILE=../../cmake/toolchain/ios.toolchain.cmake -DPLATFORM=OS64 -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} - name: Build & Archive - run: xcodebuild -project ${{github.workspace}}/cmake-build/iOS/MadVoxel_Scan.xcodeproj -scheme MadVoxel_Scan -configuration Release -archivePath ${{github.workspace}}/cmake-build/iOS/app.xcarchive -sdk iphoneos archive \ No newline at end of file + run: xcodebuild -project ${{github.workspace}}/cmake-build/iOS/openVulkanoCpp.xcodeproj -scheme openVulkanoCpp -configuration ${{env.BUILD_TYPE}} -archivePath ${{github.workspace}}/cmake-build/iOS/app.xcarchive -sdk iphoneos archive \ No newline at end of file