mirror of
https://github.com/jkcoxson/idevice.git
synced 2026-03-02 06:26:15 +01:00
Add plist_ffi cpp sources
This commit is contained in:
3
.gitmodules
vendored
3
.gitmodules
vendored
@@ -1,3 +1,6 @@
|
|||||||
[submodule "ffi/libplist"]
|
[submodule "ffi/libplist"]
|
||||||
path = ffi/libplist
|
path = ffi/libplist
|
||||||
url = https://github.com/libimobiledevice/libplist.git
|
url = https://github.com/libimobiledevice/libplist.git
|
||||||
|
[submodule "cpp/plist_ffi"]
|
||||||
|
path = cpp/plist_ffi
|
||||||
|
url = https://github.com/jkcoxson/plist_ffi.git
|
||||||
|
|||||||
@@ -12,6 +12,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
|
|||||||
set(IDEVICE_CPP_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/../include) # public C++ headers
|
set(IDEVICE_CPP_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/../include) # public C++ headers
|
||||||
set(IDEVICE_CPP_SRC_DIR ${CMAKE_SOURCE_DIR}/../src) # C++ .cpp files
|
set(IDEVICE_CPP_SRC_DIR ${CMAKE_SOURCE_DIR}/../src) # C++ .cpp files
|
||||||
set(IDEVICE_FFI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/../../ffi) # Rust FFI headers (idevice.h)
|
set(IDEVICE_FFI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/../../ffi) # Rust FFI headers (idevice.h)
|
||||||
|
set(PLIST_CPP_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/../plist_ffi/cpp/include)
|
||||||
|
set(PLIST_CPP_SRC_DIR ${CMAKE_SOURCE_DIR}/../plist_ffi/cpp/src)
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
set(STATIC_LIB ${CMAKE_SOURCE_DIR}/../../target/release/idevice_ffi.lib)
|
set(STATIC_LIB ${CMAKE_SOURCE_DIR}/../../target/release/idevice_ffi.lib)
|
||||||
else()
|
else()
|
||||||
@@ -29,19 +31,23 @@ endif()
|
|||||||
|
|
||||||
# ---- Build the C++ wrapper library -----------------------------------------
|
# ---- Build the C++ wrapper library -----------------------------------------
|
||||||
|
|
||||||
# Collect your .cpps (prefer listing explicitly in real projects)
|
# Collect your .cpps
|
||||||
file(GLOB IDEVICE_CPP_SOURCES
|
file(GLOB IDEVICE_CPP_SOURCES
|
||||||
${IDEVICE_CPP_SRC_DIR}/*.cpp
|
${IDEVICE_CPP_SRC_DIR}/*.cpp
|
||||||
)
|
)
|
||||||
|
|
||||||
add_library(idevice_cpp STATIC ${IDEVICE_CPP_SOURCES})
|
file(GLOB PLIST_CPP_SOURCES
|
||||||
|
${PLIST_CPP_SRC_DIR}/*.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
add_library(idevice_cpp STATIC ${IDEVICE_CPP_SOURCES} ${PLIST_CPP_SOURCES})
|
||||||
|
|
||||||
# Public headers for consumers; FFI headers are needed by your .cpps only
|
|
||||||
target_include_directories(idevice_cpp
|
target_include_directories(idevice_cpp
|
||||||
PUBLIC
|
PUBLIC
|
||||||
${IDEVICE_CPP_INCLUDE_DIR}
|
${IDEVICE_CPP_INCLUDE_DIR}
|
||||||
PRIVATE
|
PRIVATE
|
||||||
${IDEVICE_FFI_INCLUDE_DIR}
|
${IDEVICE_FFI_INCLUDE_DIR}
|
||||||
|
${PLIST_CPP_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Link to the Rust static lib (+ system libs/frameworks). Mark as PUBLIC so dependents inherit.
|
# Link to the Rust static lib (+ system libs/frameworks). Mark as PUBLIC so dependents inherit.
|
||||||
@@ -68,15 +74,12 @@ if (APPLE)
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# Windows system libs often needed with Rust std/tokio/ring
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
target_link_libraries(idevice_cpp PUBLIC
|
target_link_libraries(idevice_cpp PUBLIC
|
||||||
ws2_32
|
ws2_32
|
||||||
userenv
|
userenv
|
||||||
ntdll
|
ntdll
|
||||||
bcrypt
|
bcrypt
|
||||||
# iphlpapi # uncomment if needed
|
|
||||||
# secur32 crypt32 ncrypt # if you switch TLS stacks
|
|
||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
@@ -95,6 +98,7 @@ foreach(EXAMPLE_FILE ${EXAMPLE_SOURCES})
|
|||||||
target_include_directories(${EXAMPLE_NAME} PRIVATE
|
target_include_directories(${EXAMPLE_NAME} PRIVATE
|
||||||
${IDEVICE_CPP_INCLUDE_DIR}
|
${IDEVICE_CPP_INCLUDE_DIR}
|
||||||
${IDEVICE_FFI_INCLUDE_DIR}
|
${IDEVICE_FFI_INCLUDE_DIR}
|
||||||
|
${PLIST_CPP_INCLUDE_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
# Link to your C++ wrapper (inherits Rust lib + frameworks/system libs)
|
# Link to your C++ wrapper (inherits Rust lib + frameworks/system libs)
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
// Jackson Coxson
|
// Jackson Coxson
|
||||||
|
|
||||||
|
#include "plist/Dictionary.h"
|
||||||
#include <idevice++/lockdown.hpp>
|
#include <idevice++/lockdown.hpp>
|
||||||
#include <idevice++/provider.hpp>
|
#include <idevice++/provider.hpp>
|
||||||
#include <idevice++/usbmuxd.hpp>
|
#include <idevice++/usbmuxd.hpp>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
#include <optional>
|
#include <optional>
|
||||||
|
#include <plist/plist++.h>
|
||||||
|
|
||||||
int main() {
|
int main() {
|
||||||
idevice_init_logger(Debug, Disabled, NULL);
|
idevice_init_logger(Debug, Disabled, NULL);
|
||||||
@@ -70,5 +72,6 @@ int main() {
|
|||||||
std::cerr << "get values failed: " << e.message << "\n";
|
std::cerr << "get values failed: " << e.message << "\n";
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
plist_free(*values);
|
PList::Dictionary res = PList::Dictionary(*values);
|
||||||
|
std::cout << res.ToXml();
|
||||||
}
|
}
|
||||||
|
|||||||
1
cpp/plist_ffi
Submodule
1
cpp/plist_ffi
Submodule
Submodule cpp/plist_ffi added at 44b0453270
Reference in New Issue
Block a user