cmake_minimum_required(VERSION 3.10)
project(WireGuardJNI)

# Set the C standard and C++ standard (optional if needed)
set(CMAKE_C_STANDARD 99)
set(CMAKE_CXX_STANDARD 11)

# Specify where the JDK is located
set(JAVA_HOME "$ENV{JAVA_HOME}")
set(JNI_INCLUDE_DIR "${JAVA_HOME}/include")
set(JNI_INCLUDE_DIR2 "${JAVA_HOME}/include/win32")


# Include the JNI header files
include_directories(${JNI_INCLUDE_DIR} ${JNI_INCLUDE_DIR2})

# Add the source file that includes your JNI C wrapper code
add_library(wireguard_wrapper SHARED wireguard_wrapper.c)

#target_link_libraries(wireguard_wrapper PRIVATE Rpcrt4)
target_link_libraries(wireguard_wrapper ws2_32 rpcrt4)

# Optionally, you can specify output directory for the compiled library
set_target_properties(wireguard_wrapper PROPERTIES
        LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/lib"
        OUTPUT_NAME "wireguard_wrapper"
)
