Skip to content

Commit

Permalink
Fix additional issues affecting Windows.
Browse files Browse the repository at this point in the history
* Sucessful import of OpenVDB & Ptex.
* Resolve errors for imports that include <version>, by bringing that file
  into this package under MicrosoftSTL, no longer forcing the Microsoft
  requirement that the C++ 20 language standard must be utilized in order
  to include it.

Signed-off-by: furby™ <[email protected]>
  • Loading branch information
furby-tm committed Sep 13, 2024
1 parent 0d9d49f commit a3bc7ae
Show file tree
Hide file tree
Showing 114 changed files with 2,837 additions and 764 deletions.
33 changes: 0 additions & 33 deletions Package.resolved

This file was deleted.

37 changes: 27 additions & 10 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ let package = Package(
dependencies: [
.target(name: "OneTBB"),
],
publicHeadersPath: ".",
cxxSettings: [
.define("_XOPEN_SOURCE", to: "1", .when(platforms: Arch.OS.apple.platform)),
.define("_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH", .when(platforms: [.windows])),
Expand All @@ -55,9 +54,8 @@ let package = Package(
.target(name: "OneTBB"),
.target(name: "TBBMallocProxy"),
],
exclude: [],
publicHeadersPath: ".",
cxxSettings: [
.headerSearchPath("include/TBBMalloc"),
.define("_XOPEN_SOURCE", to: "1", .when(platforms: Arch.OS.apple.platform)),
.define("__TBBMALLOC_BUILD", to: "1"),
.define("_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH", .when(platforms: [.windows])),
Expand All @@ -67,7 +65,9 @@ let package = Package(

.target(
name: "OneTBB",
publicHeadersPath: "include",
dependencies: [
.target(name: "MicrosoftSTL", condition: .when(platforms: Arch.OS.windows.platform)),
],
cxxSettings: [
.define("_XOPEN_SOURCE", to: "1", .when(platforms: Arch.OS.apple.platform)),
.define("TBB_ALLOCATOR_TRAITS_BROKEN", to: "1", .when(platforms: Arch.OS.linux.platform)),
Expand Down Expand Up @@ -263,9 +263,13 @@ let package = Package(
]
),

.target(name: "Apple"),

.target(
name: "Apple",
publicHeadersPath: "include"
name: "MicrosoftSTL",
cxxSettings: [
.define("_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH", .when(platforms: [.windows])),
]
),

.target(
Expand Down Expand Up @@ -524,6 +528,7 @@ let package = Package(
.target(name: "Imath"),
.target(name: "OpenEXR"),
.target(name: "PyBind11", condition: .when(platforms: Arch.OS.nixnodroid.platform)),
.target(name: "MicrosoftSTL", condition: .when(platforms: Arch.OS.windows.platform)),
],
exclude: getConfig(for: .oiio).exclude,
publicHeadersPath: "include",
Expand Down Expand Up @@ -618,7 +623,8 @@ let package = Package(
publicHeadersPath: "include",
cxxSettings: [
.define("_ALLOW_COMPILER_AND_STL_VERSION_MISMATCH", .when(platforms: [.windows])),
.define("PTEX_EXPORTS", .when(platforms: [.windows]))
.define("PTEX_EXPORTS", .when(platforms: [.windows])),
.define("PTEX_PLATFORM_WINDOWS", .when(platforms: [.windows])),
]
),

Expand Down Expand Up @@ -697,6 +703,7 @@ let package = Package(
.target(name: "Imath"),
.target(name: "OpenEXR"),
.target(name: "ZLibDataCompression"),
.target(name: "any"),
Arch.OS.python(),
Arch.OS.boost()
],
Expand Down Expand Up @@ -1240,6 +1247,10 @@ func getConfig(for target: PkgTarget) -> TargetInfo
name: "Apple",
targets: ["Apple"]
),
.library(
name: "MicrosoftSTL",
targets: ["MicrosoftSTL"]
),
.library(
name: "DEFLATE",
targets: ["DEFLATE"]
Expand Down Expand Up @@ -1591,9 +1602,15 @@ enum Arch
{
#if os(macOS) || os(visionOS) || os(iOS) || os(tvOS) || os(watchOS)
.product(name: "Python", package: "MetaversePythonFramework", condition: .when(platforms: Arch.OS.apple.platform))
#elseif os(Windows) || os(Cygwin) || os(WASI) || os(Android)
// python is disabled on Windows, Cygwin, and WASI
// just return ZStandard for fast package resolution,
#elseif os(Windows) || os(Cygwin)
// python is disabled on both Windows, Cygwin here
// just return the STL for fast package resolution,
// things get very slow to resolve if this is optional
// or if we try to add arrays together.
.target(name: "MicrosoftSTL")
#elseif os(WASI)
// python is disabled on WebAssembly, for now just
// just return the Zstd for fast package resolution,
// things get very slow to resolve if this is optional
// or if we try to add arrays together.
.target(name: "ZStandard")
Expand Down
12 changes: 2 additions & 10 deletions Sources/MetaversalDemo/Creator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,8 @@ import OpenImageIO
import OpenSubdiv
import OpenTime
import OpenTimelineIO
#if os(macOS) || os(visionOS) || os(iOS) || os(tvOS) || os(watchOS)
// windows doesn't like the
// mismatched std.version
// coming in from TBB from
// the OpenVDB import.
import OpenVDB
#endif // os(macOS) || os(visionOS) || os(iOS) || os(tvOS) || os(watchOS)
#if !os(Windows)
import Ptex
#endif // !os(Windows)
import OpenVDB
import Ptex
#if canImport(Python) && (os(macOS) || os(visionOS) || os(iOS) || os(tvOS) || os(watchOS))
import PyBundle
import Python
Expand Down
3 changes: 3 additions & 0 deletions Sources/MicrosoftSTL/MicrosoftSTL.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#include <MicrosoftSTL/STLVersion.h>

int __wabi_microsoftStl__;
16 changes: 16 additions & 0 deletions Sources/MicrosoftSTL/include/MicrosoftSTL/MicrosoftSTL.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef __WABI_MICROSOFT_STL_H__
#define __WABI_MICROSOFT_STL_H__

#if defined(_WIN32)
// otherwise, MicrosoftSTL completely fails when
// we are using anything below C++20, and that's
// just rediculous, specifically for the include
// of the STL's <version> header anywhere within
// MetaverseKit due to a modulemap requiring the
// C++20 language standard for that header, this
// workaround replaces every: #include <version>
// with: #include <MicrosoftSTL/STLVersion.h>
# include <MicrosoftSTL/STLVersion.h>
#endif // defined(_WIN32)

#endif // __WABI_MICROSOFT_STL_H__
Loading

0 comments on commit a3bc7ae

Please sign in to comment.