Define u types for Windows in ++ library

This commit is contained in:
Jackson Coxson
2025-08-12 13:36:33 -06:00
parent bc5b15bd39
commit d59d16696c
2 changed files with 18 additions and 2 deletions

View File

@@ -8,7 +8,11 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
# Set the paths
set(HEADER_FILE ${CMAKE_SOURCE_DIR}/../../ffi/idevice.h)
set(STATIC_LIB ${CMAKE_SOURCE_DIR}/../../target/release/libidevice_ffi.a)
if (MSVC)
set(STATIC_LIB ${CMAKE_SOURCE_DIR}/../../target/release/idevice_ffi.lib)
else()
set(STATIC_LIB ${CMAKE_SOURCE_DIR}/../../target/release/libidevice_ffi.a)
endif()
set(EXAMPLES_DIR ${CMAKE_SOURCE_DIR}/../examples)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
@@ -17,7 +21,11 @@ set(IDEVICE_FFI_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/../../ffi) # ffi/
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -Wpedantic")
if (MSVC)
add_compile_options(/W4 /permissive- /EHsc)
else()
add_compile_options(-Wall -Wextra -Wpedantic)
endif()
# Find all C++ example files
file(GLOB EXAMPLE_SOURCES ${EXAMPLES_DIR}/*.cpp)

View File

@@ -8,6 +8,14 @@
#include <optional>
#include <string>
#if defined(_WIN32) && !defined(__MINGW32__)
// MSVC doesn't have BSD u_int* types
using u_int8_t = std::uint8_t;
using u_int16_t = std::uint16_t;
using u_int32_t = std::uint32_t;
using u_int64_t = std::uint64_t;
#endif
namespace IdeviceFFI {
class Idevice {