From f18b607bcaea7546155f7ad16c7176ed9bd0495b Mon Sep 17 00:00:00 2001 From: Jackson Coxson Date: Mon, 25 Aug 2025 21:26:10 -0600 Subject: [PATCH] Add visual studio solution to idevice++ --- .gitignore | 4 + cpp/sln/idevice++.sln | 37 ++++ cpp/sln/idevice++.vcxproj | 340 ++++++++++++++++++++++++++++++ cpp/sln/idevice++.vcxproj.filters | 120 +++++++++++ cpp/vs_build_rust.bat | 62 ++++++ 5 files changed, 563 insertions(+) create mode 100644 cpp/sln/idevice++.sln create mode 100644 cpp/sln/idevice++.vcxproj create mode 100644 cpp/sln/idevice++.vcxproj.filters create mode 100644 cpp/vs_build_rust.bat diff --git a/.gitignore b/.gitignore index e03e4e3..8874511 100644 --- a/.gitignore +++ b/.gitignore @@ -18,3 +18,7 @@ bundle.zip /swift/.build /swift/.swiftpm xcuserdata + +._* +*.vcxproj.user +.vs diff --git a/cpp/sln/idevice++.sln b/cpp/sln/idevice++.sln new file mode 100644 index 0000000..2debadb --- /dev/null +++ b/cpp/sln/idevice++.sln @@ -0,0 +1,37 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.14.36327.8 d17.14 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "idevice++", "idevice++.vcxproj", "{EBC5A8CF-BC80-454B-95B5-F2D14770A41D}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {EBC5A8CF-BC80-454B-95B5-F2D14770A41D}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {EBC5A8CF-BC80-454B-95B5-F2D14770A41D}.Debug|ARM64.Build.0 = Debug|ARM64 + {EBC5A8CF-BC80-454B-95B5-F2D14770A41D}.Debug|x64.ActiveCfg = Debug|x64 + {EBC5A8CF-BC80-454B-95B5-F2D14770A41D}.Debug|x64.Build.0 = Debug|x64 + {EBC5A8CF-BC80-454B-95B5-F2D14770A41D}.Debug|x86.ActiveCfg = Debug|Win32 + {EBC5A8CF-BC80-454B-95B5-F2D14770A41D}.Debug|x86.Build.0 = Debug|Win32 + {EBC5A8CF-BC80-454B-95B5-F2D14770A41D}.Release|ARM64.ActiveCfg = Release|ARM64 + {EBC5A8CF-BC80-454B-95B5-F2D14770A41D}.Release|ARM64.Build.0 = Release|ARM64 + {EBC5A8CF-BC80-454B-95B5-F2D14770A41D}.Release|x64.ActiveCfg = Release|x64 + {EBC5A8CF-BC80-454B-95B5-F2D14770A41D}.Release|x64.Build.0 = Release|x64 + {EBC5A8CF-BC80-454B-95B5-F2D14770A41D}.Release|x86.ActiveCfg = Release|Win32 + {EBC5A8CF-BC80-454B-95B5-F2D14770A41D}.Release|x86.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {9A195DE0-F99B-4101-80B4-C1CFC7BFC06F} + EndGlobalSection +EndGlobal diff --git a/cpp/sln/idevice++.vcxproj b/cpp/sln/idevice++.vcxproj new file mode 100644 index 0000000..9b28b3a --- /dev/null +++ b/cpp/sln/idevice++.vcxproj @@ -0,0 +1,340 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + Debug + ARM64 + + + Release + ARM64 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 17.0 + Win32Proj + {ebc5a8cf-bc80-454b-95b5-f2d14770a41d} + idevice + 10.0 + + + + StaticLibrary + true + v143 + Unicode + + + StaticLibrary + false + v143 + true + Unicode + + + StaticLibrary + true + v143 + Unicode + + + StaticLibrary + false + v143 + true + Unicode + + + StaticLibrary + true + v143 + Unicode + + + StaticLibrary + false + v143 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\include; + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\include; + $(SolutionDir)Build\64\$(Configuration)\ + $(SolutionDir)Build\64\$(Configuration)\Temp\$(ProjectName)\ + + + $(VC_IncludePath);$(WindowsSDK_IncludePath); + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\ + $(SolutionDir)Build\64\$(Configuration)\ + $(SolutionDir)Build\64\$(Configuration)\Temp\$(ProjectName)\ + + + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\include; + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\include; + $(SolutionDir)Build\aarch64\$(Configuration)\ + $(SolutionDir)Build\aarch64\$(Configuration)\Temp\$(ProjectName)\ + + + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\ + $(SolutionDir)Build\aarch64\$(Configuration)\ + $(SolutionDir)Build\aarch64\$(Configuration)\Temp\$(ProjectName)\ + + + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\include; + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\include; + $(SolutionDir)Build\32\$(Configuration)\ + $(SolutionDir)Build\32\$(Configuration)\Temp\$(ProjectName)\ + + + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(ProjectDir)..\ + $(SolutionDir)Build\32\$(Configuration)\ + $(SolutionDir)Build\32\$(Configuration)\Temp\$(ProjectName)\ + + + + Level3 + true + WIN32;_DEBUG;_LIB;%(PreprocessorDefinitions) + true + $(ProjectDir)..\include;$(ProjectDir)..\..\ffi + + + stdcpp20 + + + + + true + + + call "$(ProjectDir)vs_build_rust.bat" $(Platform) $(OutDir) + + + idevice_ffi.lib + $(OutDir) + + + + + Level3 + true + true + true + WIN32;NDEBUG;_LIB;%(PreprocessorDefinitions) + true + + + + + $(ProjectDir)..\include;$(ProjectDir)..\..\ffi + stdcpp20 + + + + + true + + + call "$(ProjectDir)vs_build_rust.bat" $(Platform) $(OutDir) + + + idevice_ffi.lib + $(OutDir) + + + + + Level3 + true + _DEBUG;_LIB;%(PreprocessorDefinitions) + true + + + + + $(ProjectDir)..\include;$(ProjectDir)..\..\ffi + stdcpp20 + + + + + true + + + call "$(ProjectDir)..\vs_build_rust.bat" "$(Platform)" "$(OutDir)" + + + call "$(ProjectDir)vs_build_rust.bat" $(Platform) $(OutDir) + + + idevice_ffi.lib + $(OutDir) + + + + + Level3 + true + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions) + true + + + + + $(ProjectDir)..\include;$(ProjectDir)..\..\ffi + stdcpp20 + + + + + true + + + call "$(ProjectDir)..\vs_build_rust.bat" "$(Platform)" "$(OutDir)" + + + call "$(ProjectDir)vs_build_rust.bat" $(Platform) $(OutDir) + + + idevice_ffi.lib + $(OutDir) + + + + + Level3 + true + _DEBUG;_LIB;%(PreprocessorDefinitions) + true + + + + + $(ProjectDir)..\include;$(ProjectDir)..\..\ffi + stdcpp20 + + + + + true + + + call "$(ProjectDir)vs_build_rust.bat" $(Platform) $(OutDir) + + + idevice_ffi.lib + $(OutDir) + + + + + Level3 + true + true + true + NDEBUG;_LIB;%(PreprocessorDefinitions) + true + + + + + $(ProjectDir)..\include;$(ProjectDir)..\..\ffi + stdcpp20 + + + + + true + + + call "$(ProjectDir)vs_build_rust.bat" $(Platform) $(OutDir) + + + idevice_ffi.lib + $(OutDir) + + + + + + \ No newline at end of file diff --git a/cpp/sln/idevice++.vcxproj.filters b/cpp/sln/idevice++.vcxproj.filters new file mode 100644 index 0000000..2f6b401 --- /dev/null +++ b/cpp/sln/idevice++.vcxproj.filters @@ -0,0 +1,120 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + {b4e9aee7-7e94-4e5f-b443-09677e8d69c2} + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Header Files\idevice++ + + + Header Files\idevice++ + + + Header Files\idevice++ + + + Header Files\idevice++ + + + Header Files\idevice++ + + + Header Files\idevice++ + + + Header Files\idevice++ + + + Header Files\idevice++ + + + Header Files\idevice++ + + + Header Files\idevice++ + + + Header Files\idevice++ + + + Header Files\idevice++ + + + Header Files\idevice++ + + + Header Files\idevice++ + + + Header Files\idevice++ + + + Header Files\idevice++ + + + Header Files\idevice++ + + + \ No newline at end of file diff --git a/cpp/vs_build_rust.bat b/cpp/vs_build_rust.bat new file mode 100644 index 0000000..438fd9e --- /dev/null +++ b/cpp/vs_build_rust.bat @@ -0,0 +1,62 @@ +@echo off +setlocal + +REM --- Configuration --- +SET "CRATE_NAME=idevice_ffi" +SET "RUST_PROJECT_PATH=%~dp0..\ffi" + +echo "--- Rust Build Script Started ---" +echo "Rust Project Path: %RUST_PROJECT_PATH%" +echo "Visual Studio Platform: %1" + +REM --- Header File Copy --- +xcopy /Y "%RUST_PROJECT_PATH%\idevice.h" "%~dp0\include\" + +REM --- Locate Cargo --- +REM Check if cargo is in the PATH. +where cargo >nul 2>nul +if %errorlevel% neq 0 ( + echo Error: cargo.exe not found in PATH. + echo Please ensure the Rust toolchain is installed and configured. + exit /b 1 +) + +REM --- Determine Rust Target --- +SET "RUST_TARGET=" +IF /I "%~1" == "x64" ( + SET "RUST_TARGET=x86_64-pc-windows-msvc" +) +IF /I "%~1" == "ARM64" ( + SET "RUST_TARGET=aarch64-pc-windows-msvc" +) + +IF NOT DEFINED RUST_TARGET ( + echo Error: Unsupported Visual Studio platform '%~1'. + echo This script supports 'x64' and 'ARM64'. + exit /b 1 +) + +echo "Building for Rust target: %RUST_TARGET%" + +REM --- Run Cargo Build --- +SET "STATIC_LIB_NAME=%CRATE_NAME%.lib" +SET "BUILT_LIB_PATH=%RUST_PROJECT_PATH%\..\target\%RUST_TARGET%\release\%STATIC_LIB_NAME%" + +REM Change to the Rust project directory and run the build. +pushd "%RUST_PROJECT_PATH%" +cargo build --release --target %RUST_TARGET% --features ring,full --no-default-features +if %errorlevel% neq 0 ( + echo Error: Cargo build failed. + popd + exit /b 1 +) +popd + +echo "Cargo build successful." + +REM --- Copy Artifacts --- +echo "Copying '%BUILT_LIB_PATH%' to '%2'" +xcopy /Y "%BUILT_LIB_PATH%" "%2" + +echo "--- Rust Build Script Finished ---" +exit /b 0