From a60b3c540b1eb9a97d091e916d8abb4b75614ac8 Mon Sep 17 00:00:00 2001 From: Selva Nair Date: Fri, 5 Aug 2022 21:49:58 -0400 Subject: [PATCH] Enable MSVC build of libopenvpn_plap.dll Signed-off-by: Selva Nair --- CMakeLists.txt | 46 +++++++++++++++++++++++++++++++++++++++- plap/openvpn-plap-res.rc | 2 +- plap/openvpn_plap.def | 5 +++++ 3 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 plap/openvpn_plap.def diff --git a/CMakeLists.txt b/CMakeLists.txt index 822879f..fa02acb 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,9 +95,53 @@ if (${CLI_OVPN3}) ENABLE_OVPN3) endif () +if (NOT PROJECT_NAME_PLAP) + set(PROJECT_NAME_PLAP "libopenvpn_plap") +endif() + +add_library(${PROJECT_NAME_PLAP} SHARED + localization.c + manage.c + misc.c + openvpn.c + openvpn_config.c + options.c + proxy.c + pkcs11.c + registry.c + config_parser.c + plap/ui_glue.c + plap/stub.c + plap/plap_common.c + plap/plap_provider.c + plap/plap_connection.c + plap/plap_dll.c + plap/openvpn_plap.def + plap/openvpn-plap-res.rc) + +target_link_libraries(${PROJECT_NAME_PLAP} PRIVATE + ws2_32.lib + Comctl32.lib + Winhttp.lib + Crypt32.lib + Ole32.lib + Shlwapi.lib + Secur32.lib + Gdi32.lib + Cryptui.lib + Rpcrt4.lib) + +set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /MANIFEST:NO") +target_include_directories(${PROJECT_NAME_PLAP} PRIVATE ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) +target_compile_definitions(${PROJECT_NAME_PLAP} PRIVATE + _UNICODE + UNICODE + WIN32_LEAN_AND_MEAN + HAVE_CONFIG_H) + if(MSVC) # work around msvc generator Debug/Release directory ugliness, doesn't apply for Ninja - set_target_properties(${PROJECT_NAME} PROPERTIES + set_target_properties(${PROJECT_NAME} ${PROJECT_NAME_PLAP} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<0:> LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<0:> ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/$<0:>) diff --git a/plap/openvpn-plap-res.rc b/plap/openvpn-plap-res.rc index 6d78ec5..1dc7726 100644 --- a/plap/openvpn-plap-res.rc +++ b/plap/openvpn-plap-res.rc @@ -32,7 +32,7 @@ #pragma code_page(65001) /* Manifest for version 6 common controls */ -CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "openvpn-plap.manifest" +ISOLATIONAWARE_MANIFEST_RESOURCE_ID RT_MANIFEST "openvpn-plap.manifest" /* Application Icons */ ID_ICO_APP ICON DISCARDABLE "../res/openvpn-gui.ico" diff --git a/plap/openvpn_plap.def b/plap/openvpn_plap.def new file mode 100644 index 0000000..ca729b2 --- /dev/null +++ b/plap/openvpn_plap.def @@ -0,0 +1,5 @@ +LIBRARY libopenvpn_plap.dll + +EXPORTS + DllCanUnloadNow PRIVATE + DllGetClassObject PRIVATE