diff --git a/.gitmodules b/.gitmodules index 4c388b1..be52a84 100644 --- a/.gitmodules +++ b/.gitmodules @@ -25,3 +25,6 @@ [submodule "external/slang"] path = external/slang url = https://github.com/shader-slang/slang.git +[submodule "external/xtool"] + path = external/xtool + url = https://github.com/xtool-org/xtool.git diff --git a/external/xtool b/external/xtool new file mode 160000 index 0000000..22655f3 --- /dev/null +++ b/external/xtool @@ -0,0 +1 @@ +Subproject commit 22655f3e70b87bef9be736e9625984e21bf8c697 diff --git a/fpc/Makefile b/fpc/Makefile index 1e0e231..b691661 100644 --- a/fpc/Makefile +++ b/fpc/Makefile @@ -24,7 +24,7 @@ install: ../build/tools/fpc libfpcbuild.a libfpc.so libtier0.so libtier1.a libti build/fpc build mv build/fpc_temp build/fpc mv build/libfpc_temp.so build/libfpc.so - build/fpc build + build/fpc build -fpcdebug mv build/fpc_temp build/fpc mv build/libfpc_temp.so build/libfpc.so diff --git a/fpc/apple/build.cpp b/fpc/apple/build.cpp index 2b259c8..f04fa37 100644 --- a/fpc/apple/build.cpp +++ b/fpc/apple/build.cpp @@ -7,7 +7,7 @@ ADD_DEPENDENCY_BUILD_FILE(tier1, "../../tier1/build.cpp"); -DECLARE_BUILD_STAGE(xtool_backend) +DECLARE_BUILD_STAGE(xtool) { if (!linker->IsLibraryExists("swiftCore")) { @@ -16,32 +16,35 @@ DECLARE_BUILD_STAGE(xtool_backend) } - ISwiftCompiler *swiftcompiler = NULL; - if (swiftcompiler == NULL) - { - CreateInterfaceFn pLibFPCFactory = Sys_GetFactory("fpc"); - swiftcompiler = (ISwiftCompiler*)pLibFPCFactory(SWIFT_COMPILER_INTERFACE_VERSION, NULL); + CUtlString outputProject = CUtlString("fpcxtool/.build/%s/debug/libfpcxtool.a",Target_t::HostTarget().GetTriplet().GetString()); + V_printf("SWIFT %s\n", outputProject.GetString()); - if (swiftcompiler == NULL) - return 0; - } + CUtlVector args = {"build"}; + runner->Run("swift","fpcxtool", args); + runner->Wait(); - SwiftProject_t compileProject = {}; - LinkProject_t ldProject = {}; - - compileProject.m_szName = "xtool"; - compileProject.files = { - "xtool/sign.swift" - }; - - ldProject = swiftcompiler->Compile(&compileProject); - ldProject.linkType = ELINK_STATIC_LIBRARY; - - CUtlString outputProject = linker->Link(&ldProject); - - - ADD_OUTPUT_OBJECT("xtool", outputProject) + ADD_OUTPUT_OBJECT("xtool", outputProject); return 0; }; +DECLARE_BUILD_STAGE(xtool_cpp) +{ + CProject_t compileProject = {}; + LinkProject_t ldProject = {}; + CUtlString szOutputProject = ""; + + compileProject.m_szName = "xtool"; + compileProject.files = { + "fpcxtool/sign.cpp" + }; + compileProject.includeDirectories = {"../public","../../public"}; + compileProject.bFPIC = true; + ldProject = ccompiler->Compile(&compileProject); + + ldProject.linkType = ELINK_DYNAMIC_LIBRARY; + ldProject.libraryObjects.AppendTail(GET_PROJECT_LIBRARY(xtool, "xtool")); + szOutputProject = linker->Link(&ldProject); + ADD_OUTPUT_OBJECT("xtool", szOutputProject); + return 0; +} diff --git a/fpc/apple/fpcxtool/Package.resolved b/fpc/apple/fpcxtool/Package.resolved new file mode 100644 index 0000000..5d0ec78 --- /dev/null +++ b/fpc/apple/fpcxtool/Package.resolved @@ -0,0 +1,447 @@ +{ + "originHash" : "1b40ee21cafb6201503d43773a417fca9894828946ab37ff5dc543cfd8b2565c", + "pins" : [ + { + "identity" : "aexml", + "kind" : "remoteSourceControl", + "location" : "https://github.com/tadija/AEXML.git", + "state" : { + "revision" : "db806756c989760b35108146381535aec231092b", + "version" : "4.7.0" + } + }, + { + "identity" : "async-http-client", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-server/async-http-client.git", + "state" : { + "revision" : "5dd84c7bb48b348751d7bbe7ba94a17bafdcef37", + "version" : "1.30.2" + } + }, + { + "identity" : "bigint", + "kind" : "remoteSourceControl", + "location" : "https://github.com/attaswift/BigInt", + "state" : { + "revision" : "e07e00fa1fd435143a2dcf8b7eec9a7710b2fdfe", + "version" : "5.7.0" + } + }, + { + "identity" : "combine-schedulers", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/combine-schedulers", + "state" : { + "revision" : "fd16d76fd8b9a976d88bfb6cacc05ca8d19c91b6", + "version" : "1.1.0" + } + }, + { + "identity" : "jsonutilities", + "kind" : "remoteSourceControl", + "location" : "https://github.com/yonaskolb/JSONUtilities.git", + "state" : { + "revision" : "128d2ffc22467f69569ef8ff971683e2393191a0", + "version" : "4.2.0" + } + }, + { + "identity" : "opencombine", + "kind" : "remoteSourceControl", + "location" : "https://github.com/OpenCombine/OpenCombine.git", + "state" : { + "revision" : "8576f0d579b27020beccbccc3ea6844f3ddfc2c2", + "version" : "0.14.0" + } + }, + { + "identity" : "pathkit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/kylef/PathKit.git", + "state" : { + "revision" : "3bfd2737b700b9a36565a8c94f4ad2b050a5e574", + "version" : "1.0.1" + } + }, + { + "identity" : "rainbow", + "kind" : "remoteSourceControl", + "location" : "https://github.com/onevcat/Rainbow.git", + "state" : { + "revision" : "cdf146ae671b2624917648b61c908d1244b98ca1", + "version" : "4.2.1" + } + }, + { + "identity" : "spectre", + "kind" : "remoteSourceControl", + "location" : "https://github.com/kylef/Spectre.git", + "state" : { + "revision" : "26cc5e9ae0947092c7139ef7ba612e34646086c7", + "version" : "0.10.1" + } + }, + { + "identity" : "swift-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-algorithms.git", + "state" : { + "revision" : "87e50f483c54e6efd60e885f7f5aa946cee68023", + "version" : "1.2.1" + } + }, + { + "identity" : "swift-argument-parser", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-argument-parser", + "state" : { + "revision" : "c5d11a805e765f52ba34ec7284bd4fcd6ba68615", + "version" : "1.7.0" + } + }, + { + "identity" : "swift-asn1", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-asn1.git", + "state" : { + "revision" : "810496cf121e525d660cd0ea89a758740476b85f", + "version" : "1.5.1" + } + }, + { + "identity" : "swift-async-algorithms", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-async-algorithms.git", + "state" : { + "revision" : "6c050d5ef8e1aa6342528460db614e9770d7f804", + "version" : "1.1.1" + } + }, + { + "identity" : "swift-atomics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-atomics.git", + "state" : { + "revision" : "b601256eab081c0f92f059e12818ac1d4f178ff7", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-certificates", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-certificates", + "state" : { + "revision" : "133a347911b6ad0fc8fe3bf46ca90c66cff97130", + "version" : "1.17.0" + } + }, + { + "identity" : "swift-clocks", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/swift-clocks", + "state" : { + "revision" : "cc46202b53476d64e824e0b6612da09d84ffde8e", + "version" : "1.0.6" + } + }, + { + "identity" : "swift-collections", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-collections", + "state" : { + "revision" : "7b847a3b7008b2dc2f47ca3110d8c782fb2e5c7e", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-concurrency-extras", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/swift-concurrency-extras", + "state" : { + "revision" : "5a3825302b1a0d744183200915a47b508c828e6f", + "version" : "1.3.2" + } + }, + { + "identity" : "swift-crypto", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-crypto", + "state" : { + "revision" : "95ba0316a9b733e92bb6b071255ff46263bbe7dc", + "version" : "3.15.1" + } + }, + { + "identity" : "swift-dependencies", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/swift-dependencies", + "state" : { + "revision" : "a10f9feeb214bc72b5337b6ef6d5a029360db4cc", + "version" : "1.10.0" + } + }, + { + "identity" : "swift-distributed-tracing", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-distributed-tracing.git", + "state" : { + "revision" : "baa932c1336f7894145cbaafcd34ce2dd0b77c97", + "version" : "1.3.1" + } + }, + { + "identity" : "swift-http-structured-headers", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-structured-headers.git", + "state" : { + "revision" : "76d7627bd88b47bf5a0f8497dd244885960dde0b", + "version" : "1.6.0" + } + }, + { + "identity" : "swift-http-types", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-http-types", + "state" : { + "revision" : "45eb0224913ea070ec4fba17291b9e7ecf4749ca", + "version" : "1.5.1" + } + }, + { + "identity" : "swift-log", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-log.git", + "state" : { + "revision" : "bc386b95f2a16ccd0150a8235e7c69eab2b866ca", + "version" : "1.8.0" + } + }, + { + "identity" : "swift-nio", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio", + "state" : { + "revision" : "a1605a3303a28e14d822dec8aaa53da8a9490461", + "version" : "2.92.0" + } + }, + { + "identity" : "swift-nio-extras", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-extras.git", + "state" : { + "revision" : "1c90641b02b6ab47c6d0db2063a12198b04e83e2", + "version" : "1.31.2" + } + }, + { + "identity" : "swift-nio-http2", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-http2.git", + "state" : { + "revision" : "c2ba4cfbb83f307c66f5a6df6bb43e3c88dfbf80", + "version" : "1.39.0" + } + }, + { + "identity" : "swift-nio-ssl", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-ssl.git", + "state" : { + "revision" : "173cc69a058623525a58ae6710e2f5727c663793", + "version" : "2.36.0" + } + }, + { + "identity" : "swift-nio-transport-services", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-nio-transport-services.git", + "state" : { + "revision" : "60c3e187154421171721c1a38e800b390680fb5d", + "version" : "1.26.0" + } + }, + { + "identity" : "swift-numerics", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-numerics.git", + "state" : { + "revision" : "0c0290ff6b24942dadb83a929ffaaa1481df04a2", + "version" : "1.1.1" + } + }, + { + "identity" : "swift-openapi-async-http-client", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-server/swift-openapi-async-http-client", + "state" : { + "revision" : "4828c3aa33784185d8f99f5c27844fcfb1436b3d", + "version" : "1.3.0" + } + }, + { + "identity" : "swift-openapi-runtime", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-openapi-runtime", + "state" : { + "revision" : "7cdf33371bf89b23b9cf4fd3ce8d3c825c28fbe8", + "version" : "1.9.0" + } + }, + { + "identity" : "swift-openapi-urlsession", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-openapi-urlsession", + "state" : { + "revision" : "279aa6b77be6aa842a4bf3c45fa79fa15edf3e07", + "version" : "1.2.0" + } + }, + { + "identity" : "swift-service-context", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-service-context.git", + "state" : { + "revision" : "1983448fefc717a2bc2ebde5490fe99873c5b8a6", + "version" : "1.2.1" + } + }, + { + "identity" : "swift-service-lifecycle", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swift-server/swift-service-lifecycle.git", + "state" : { + "revision" : "1de37290c0ab3c5a96028e0f02911b672fd42348", + "version" : "2.9.1" + } + }, + { + "identity" : "swift-syntax", + "kind" : "remoteSourceControl", + "location" : "https://github.com/swiftlang/swift-syntax", + "state" : { + "revision" : "4799286537280063c85a32f09884cfbca301b1a1", + "version" : "602.0.0" + } + }, + { + "identity" : "swift-system", + "kind" : "remoteSourceControl", + "location" : "https://github.com/apple/swift-system", + "state" : { + "revision" : "395a77f0aa927f0ff73941d7ac35f2b46d47c9db", + "version" : "1.6.3" + } + }, + { + "identity" : "swiftcli", + "kind" : "remoteSourceControl", + "location" : "https://github.com/jakeheis/SwiftCLI.git", + "state" : { + "revision" : "2e949055d9797c1a6bddcda0e58dada16cc8e970", + "version" : "6.0.3" + } + }, + { + "identity" : "swiftymobiledevice", + "kind" : "remoteSourceControl", + "location" : "https://github.com/xtool-org/SwiftyMobileDevice", + "state" : { + "revision" : "280d0dc8153469944491aee2f19af29e9c7a77f0", + "version" : "1.5.0" + } + }, + { + "identity" : "unxip", + "kind" : "remoteSourceControl", + "location" : "https://github.com/saagarjha/unxip", + "state" : { + "revision" : "03c32d6b4e7d8a9fb58747e5f8b83397da8bf5ba", + "version" : "3.2.0" + } + }, + { + "identity" : "version", + "kind" : "remoteSourceControl", + "location" : "https://github.com/mxcl/Version", + "state" : { + "revision" : "67ce582bb9de70e1eb2ee41fd71aad3b5f86d97b", + "version" : "2.2.0" + } + }, + { + "identity" : "websocket-kit", + "kind" : "remoteSourceControl", + "location" : "https://github.com/vapor/websocket-kit.git", + "state" : { + "revision" : "8666c92dbbb3c8eefc8008c9c8dcf50bfd302167", + "version" : "2.16.1" + } + }, + { + "identity" : "xcodegen", + "kind" : "remoteSourceControl", + "location" : "https://github.com/yonaskolb/XcodeGen", + "state" : { + "revision" : "21ac9944b0ab546a07422dbed86f33dd2ebd76f8", + "version" : "2.44.1" + } + }, + { + "identity" : "xcodeproj", + "kind" : "remoteSourceControl", + "location" : "https://github.com/tuist/XcodeProj.git", + "state" : { + "revision" : "b1caa062d4aaab3e3d2bed5fe0ac5f8ce9bf84f4", + "version" : "8.27.7" + } + }, + { + "identity" : "xctest-dynamic-overlay", + "kind" : "remoteSourceControl", + "location" : "https://github.com/pointfreeco/xctest-dynamic-overlay", + "state" : { + "revision" : "31073495cae9caf243c440eac94b3ab067e3d7bc", + "version" : "1.8.0" + } + }, + { + "identity" : "xtool", + "kind" : "remoteSourceControl", + "location" : "https://github.com/xtool-org/xtool", + "state" : { + "revision" : "22655f3e70b87bef9be736e9625984e21bf8c697", + "version" : "1.16.1" + } + }, + { + "identity" : "xtool-core", + "kind" : "remoteSourceControl", + "location" : "https://github.com/xtool-org/xtool-core", + "state" : { + "revision" : "d412ac768d1e73d16ad7ccc6805f12fc701709f6", + "version" : "1.4.0" + } + }, + { + "identity" : "yams", + "kind" : "remoteSourceControl", + "location" : "https://github.com/jpsim/Yams", + "state" : { + "revision" : "3d6871d5b4a5cd519adf233fbb576e0a2af71c17", + "version" : "5.4.0" + } + }, + { + "identity" : "zsign", + "kind" : "remoteSourceControl", + "location" : "https://github.com/xtool-org/zsign", + "state" : { + "revision" : "6c4a9f52dd8bf374aa938ef9c17d5f261f2c333a", + "version" : "1.7.0" + } + } + ], + "version" : 3 +} diff --git a/fpc/apple/fpcxtool/Package.swift b/fpc/apple/fpcxtool/Package.swift new file mode 100644 index 0000000..af7da63 --- /dev/null +++ b/fpc/apple/fpcxtool/Package.swift @@ -0,0 +1,30 @@ + +// swift-tools-version:6.2 +import PackageDescription + +let package = Package( + name: "fpcxtool", + platforms: [ + .macOS(.v12) + ], + products: [ + .library( + name: "fpcxtool", + type: .static, + targets: ["fpcxtool"] + ), + ], + dependencies: [ + .package(url: "https://github.com/xtool-org/xtool", "1.16.1" ..< "1.17.0"), + ], + targets: [ + .target( + name: "fpcxtool", + dependencies: [ + .product(name: "XKit", package: "xtool") + ], + path: "swift" + ) + ] +) + diff --git a/fpc/apple/fpcxtool/sign.cpp b/fpc/apple/fpcxtool/sign.cpp new file mode 100644 index 0000000..2e4fed5 --- /dev/null +++ b/fpc/apple/fpcxtool/sign.cpp @@ -0,0 +1,14 @@ + +#include "deploy.h" + +extern "C" void FPC_XToolSign( const char *szIpa ); + +class CXToolDevice: public IDeployDevice +{ +public: + virtual const char *GetName() override; + virtual void *Install( const char *szPath ) override; + void *pDeviceHandle; +}; + + diff --git a/fpc/apple/fpcxtool/swift/sign.swift b/fpc/apple/fpcxtool/swift/sign.swift new file mode 100644 index 0000000..fdcea8e --- /dev/null +++ b/fpc/apple/fpcxtool/swift/sign.swift @@ -0,0 +1,19 @@ +import XKit + +@_cdecl("FPCXToolAuth") +func FPCXToolAuth() +{ + +} + +@_cdecl("FPCXToolSign") +func FPCXToolSign() +{ + +} + +@_cdecl("FPCXToolInstall") +func FPCXToolInstall( _ appDir: UnsafePointer ) +{ + +} diff --git a/fpc/apple/xtool/sign.cpp b/fpc/apple/xtool/sign.cpp deleted file mode 100644 index e69de29..0000000 diff --git a/fpc/apple/xtool/sign.swift b/fpc/apple/xtool/sign.swift deleted file mode 100644 index e69de29..0000000 diff --git a/fpc/build.cpp b/fpc/build.cpp index 700c178..d371bf5 100644 --- a/fpc/build.cpp +++ b/fpc/build.cpp @@ -25,6 +25,7 @@ CUtlVector g_libFpcFiles = { "library/builder.cpp", "library/runner.cpp", "library/winerunner.cpp", + "library/deploy.cpp", "library/c.cpp", "library/ld.cpp", @@ -109,6 +110,7 @@ DECLARE_BUILD_STAGE(fpc) compileProject.m_szName = "fpc"; compileProject.files = g_fpcFiles; + compileProject.bFPIC = true; compileProject.includeDirectories = g_IncludeDirectories; ldProject = ccompiler->Compile(&compileProject); ldProject.libraryObjects = { diff --git a/fpc/library/deploy.cpp b/fpc/library/deploy.cpp new file mode 100644 index 0000000..0e1bb2b --- /dev/null +++ b/fpc/library/deploy.cpp @@ -0,0 +1,40 @@ +#include "deploy.h" + + +class CDeployDeviceManager: public IDeployDeviceManager +{ +public: + virtual void AddDevice( IDeployDevice *pDevice ) override; + virtual IDeployDevice *FindDeviceByName( const char *szDeviceName ) override; + virtual const CUtlVector &ListDevices() override; +private: + CUtlVector m_devices; +}; + +static CDeployDeviceManager s_deviceManager; + +void CDeployDeviceManager::AddDevice( IDeployDevice *pDevice ) +{ + m_devices.AppendTail(pDevice); +} + +IDeployDevice *CDeployDeviceManager::FindDeviceByName( const char *szDeviceName ) +{ + for ( auto device: m_devices ) + { + if ( !V_strcmp(device->GetName(), szDeviceName) ) + return device; + } + return NULL; +} + +const CUtlVector &CDeployDeviceManager::ListDevices() +{ + return m_devices; +} + + +IDeployDeviceManager *DeployDeviceManager() +{ + return &s_deviceManager; +} diff --git a/fpc/main.cpp b/fpc/main.cpp index ccf68a9..5cc7176 100644 --- a/fpc/main.cpp +++ b/fpc/main.cpp @@ -155,5 +155,10 @@ findbuild: CommandLine()->CreateCommandLine(c, v); if (CommandLine()->CheckParam("build")) return build(); + const char *szDeployDevice = CommandLine()->ParamValue("deploy"); + if (szDeployDevice) + { + + } return 0; }; diff --git a/fpc/public/deploy.h b/fpc/public/deploy.h index e69de29..9cb4f7e 100644 --- a/fpc/public/deploy.h +++ b/fpc/public/deploy.h @@ -0,0 +1,25 @@ +#ifndef DEPLOY_H +#define DEPLOY_H + +#include "tier0/platform.h" +#include "tier1/utlstring.h" + +abstract_class IDeployDevice +{ +public: + virtual const char *GetName() = 0; + virtual void *Install( const char *szPath ) = 0; +}; + +abstract_class IDeployDeviceManager +{ +public: + virtual void AddDevice( IDeployDevice *pDevice ) = 0; + virtual IDeployDevice *FindDeviceByName( const char *szDeviceName ) = 0; + virtual const CUtlVector &ListDevices() = 0; +}; + +IDeployDeviceManager *DeployDeviceManager(); + + +#endif