diff --git a/cpp/examples/CMakeLists.txt b/cpp/examples/CMakeLists.txt index 548a39f..cea3aca 100644 --- a/cpp/examples/CMakeLists.txt +++ b/cpp/examples/CMakeLists.txt @@ -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) diff --git a/cpp/include/idevice++.hpp b/cpp/include/idevice++.hpp index dbd8736..b16217e 100644 --- a/cpp/include/idevice++.hpp +++ b/cpp/include/idevice++.hpp @@ -8,6 +8,14 @@ #include #include +#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 {