Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .derivedData/Logs/Launch/LogStoreManifest.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>logFormatVersion</key>
<integer>11</integer>
<key>logs</key>
<dict/>
</dict>
</plist>
10 changes: 10 additions & 0 deletions .derivedData/Logs/Localization/LogStoreManifest.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>logFormatVersion</key>
<integer>11</integer>
<key>logs</key>
<dict/>
</dict>
</plist>
10 changes: 10 additions & 0 deletions .derivedData/Logs/Package/LogStoreManifest.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>logFormatVersion</key>
<integer>11</integer>
<key>logs</key>
<dict/>
</dict>
</plist>
10 changes: 10 additions & 0 deletions .derivedData/Logs/Test/LogStoreManifest.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>logFormatVersion</key>
<integer>11</integer>
<key>logs</key>
<dict/>
</dict>
</plist>
17 changes: 16 additions & 1 deletion Modules/glslang/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,32 @@ let package = Package(
.library(
name: "glslang",
targets: ["glslang"]
),
.library(
name: "SPIRVCompiler",
targets: ["SPIRVCompiler"]
)
],
targets: [
.target(
name: "glslang",
path: ".",
path: "Sources",
sources: glslangSources,
publicHeadersPath: ".",
cxxSettings: [
.define("ENABLE_OPT", to: "0"),
]
),
.target(
name: "SPIRVCompiler",
dependencies: [
"glslang"
],
path: "SPIRVCompiler",
cxxSettings: [
.headerSearchPath("../Sources/glslang/Include/"),
.headerSearchPath("../Sources/glslang/SPIRV/")
]
)
],
cxxLanguageStandard: .cxx17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
// Created by v.prusakov on 3/11/23.
//

#include "spirv_compiler.h"
#include "include/spirv_compiler.h"

#include <glslang/Include/ResourceLimits.h>
#include <glslang/Include/Types.h>
#include <glslang/Public/ShaderLang.h>
#include <SPIRV/GlslangToSpv.h>
#include "glslang/Include/ResourceLimits.h"
#include "glslang/Include/Types.h"
#include "glslang/Public/ShaderLang.h"
#include "SPIRV/GlslangToSpv.h"

const TBuiltInResource DefaultTBuiltInResource = {
/* .MaxLights = */ 32,
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 5 additions & 1 deletion Modules/libpng/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ let package = Package(
publicHeadersPath: "include",
cSettings: [
.define("PNG_ARM_NEON_OPT", to: useNeon ? "2" : "0")
])
],
linkerSettings: [
.linkedFramework("z", .when(platforms: [.linux]))
]
)
]
)
15 changes: 11 additions & 4 deletions Modules/msdf-atlas-gen/Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,20 @@ let package = Package(
],
products: [
.library(
name: "MSDFAtlasGen",
targets: ["MSDFAtlasGen"]
name: "AtlasFontGenerator",
targets: ["AtlasFontGenerator"]
)
],
targets: [
.target(
name: "MSDFGen",
name: "AtlasFontGenerator",
dependencies: [
"MSDFAtlasGen",
],
path: "AtlasFontGenerator"
),
.target(
name: "msdfgen",
dependencies: [
"freetype",
"tinyxml"
Expand All @@ -35,7 +42,7 @@ let package = Package(
.target(
name: "MSDFAtlasGen",
dependencies: [
"MSDFGen"
"msdfgen"
],
path: "msdf-atlas-gen",
publicHeadersPath: ".",
Expand Down
63 changes: 30 additions & 33 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ import Glibc
import WinSDK
#endif

let isVulkanEnabled = false
let isVulkanEnabled = true
#endif

let applePlatforms: [Platform] = [.iOS, .macOS, .tvOS, .watchOS, .visionOS]
Expand Down Expand Up @@ -92,7 +92,9 @@ var swiftSettings: [SwiftSetting] = [
if isVulkanEnabled {
swiftSettings.append(.define("VULKAN"))
} else {
#if canImport(Metal)
swiftSettings.append(.define("METAL"))
#endif
}

let editorTarget: Target = .executableTarget(
Expand Down Expand Up @@ -129,18 +131,21 @@ var adaEngineDependencies: [Target.Dependency] = [
.product(name: "Collections", package: "swift-collections"),
.product(name: "BitCollections", package: "swift-collections"),
.product(name: "Logging", package: "swift-log"),
.product(name: "AtlasFontGenerator", package: "msdf-atlas-gen"),
.product(name: "SPIRVCompiler", package: "glslang"),
"miniaudio",
"AtlasFontGenerator",
"Yams",
"libpng",
"SPIRV-Cross",
"SPIRVCompiler",
"box2d",
"AdaEngineMacros"
]

#if os(Linux)
adaEngineDependencies += ["X11"]
adaEngineDependencies += [
"Wayland",
// "OpenGL"
]
#endif

let adaEngineTarget: Target = .target(
Expand All @@ -155,7 +160,8 @@ let adaEngineTarget: Target = .target(
.copy("Assets/Images")
],
cSettings: [
.define("GL_SILENCE_DEPRECATION")
.define("GL_SILENCE_DEPRECATION", .when(platforms: applePlatforms)),
.define("GL_GLEXT_PROTOTYPES", .when(platforms: [.android, .linux, .windows])),
],
swiftSettings: adaEngineSwiftSettings,
plugins: commonPlugins
Expand Down Expand Up @@ -200,38 +206,25 @@ var targets: [Target] = [

// MARK: Extra

#if os(Android) || os(Linux)
#if os(Linux)
targets += [
.systemLibrary(
name: "X11",
pkgConfig: "x11",
providers: [
.apt(["libx11-dev"])
]),
]
#endif

// MARK: - CXX Internal Targets

targets += [
.target(
name: "AtlasFontGenerator",
dependencies: [
.product(name: "MSDFAtlasGen", package: "msdf-atlas-gen")
],
publicHeadersPath: "include"
name: "Wayland",
pkgConfig: "wayland-client",
providers: [.apt(["libwayland-dev"])]
),
.target(
name: "SPIRVCompiler",
dependencies: [
"glslang"
],
publicHeadersPath: ".",
linkerSettings: [
.linkedLibrary("m", .when(platforms: [.linux]))
]
)
// .systemLibrary(
// name: "X11",
// pkgConfig: "x11",
// providers: [.apt(["libx11-dev"])]
// ),
// .systemLibrary(
// name: "OpenGL",
// pkgConfig: "gl",
// providers: [.apt(["libglu1-mesa-dev", "mesa-common-dev"])]
// ),
]
#endif

// MARK: - Tests

Expand Down Expand Up @@ -315,6 +308,10 @@ if isVulkanEnabled {

// Windows
.define("VK_USE_PLATFORM_WIN32_KHR", .when(platforms: [.windows])),

// Linux
.define("VK_USE_PLATFORM_XCB_KHR", .when(platforms: [.linux])),
.define("VK_USE_PLATFORM_WAYLAND_KHR", .when(platforms: [.linux])),
]
),
.systemLibrary(
Expand Down
7 changes: 7 additions & 0 deletions Sources/AdaEngine/Application/AppCreate/AppContext.swift
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ public final class AppContext<T: App> {
private var application: Application!

init() throws {
#if METAL
/// By default, the render backend is set to Vulkan.
/// But if the Metal backend is available, it will be used instead.
RenderEngine.configurations.renderBackend = .metal
#endif

self.app = T.init()

let argc = CommandLine.argc
Expand Down Expand Up @@ -46,6 +52,7 @@ public final class AppContext<T: App> {
}

@_spi(Internal)
@MainActor
public func setup() async throws {
try ResourceManager.initialize()
try AudioServer.initialize()
Expand Down
18 changes: 9 additions & 9 deletions Sources/AdaEngine/Application/Application.swift
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,6 @@
/// To get access to the application instance, use static property `shared`
@MainActor
open class Application {

// MARK: - Public

/// Contains application instance if application created from ``App``.
@MainActor public internal(set) static var shared: Application!

Expand All @@ -38,10 +35,14 @@ open class Application {
return .android
#endif
}

public class var windowManagerClass: UIWindowManager.Type {
UIWindowManager.self
}

@_spi(Internal)
@MainActor @preconcurrency
public var windowManager: UIWindowManager = UIWindowManager()
@preconcurrency
public let windowManager: UIWindowManager

/// Contains world which can render on screen.
public let renderWorld = RenderWorld()
Expand All @@ -51,7 +52,9 @@ open class Application {
public init(
argc: Int32,
argv: UnsafeMutablePointer<UnsafeMutablePointer<CChar>?>
) throws { }
) throws {
self.windowManager = Self.windowManagerClass.init()
}

/// Call this method to start main loop.
func run() throws {
Expand All @@ -61,21 +64,18 @@ open class Application {
// MARK: - Public methods

/// Call this method to terminate app execution with 0 status code.
@MainActor
open func terminate() {
exit(EXIT_SUCCESS)
}

/// Method to open url.
@MainActor
@discardableResult
open func openURL(_ url: URL) -> Bool {
assertionFailure("Not implemented")
return false
}

/// Call this method to show specific alert.
@MainActor
open func showAlert(_ alert: Alert) {
assertionFailure("Not implemented")
}
Expand Down
Loading