1
0
mirror of https://github.com/SoftEtherVPN/SoftEtherVPN.git synced 2025-07-07 16:25:01 +03:00

CMake: add support for Windows (Visual C++ 2017 toolset)

This commit is contained in:
Davide Beatrici
2018-10-24 19:23:07 +02:00
parent 5fe90bb180
commit c1f522c10e
16 changed files with 381 additions and 172 deletions

View File

@ -1,18 +1,20 @@
# Creates wrapper scripts and installs them in the user's binaries directory, which is usually "/usr/local/bin".
# This is required because symlinks use the folder they are in as working directory.
macro(install_wrapper_script component target)
get_filename_component(file_name ${target} NAME)
if(UNIX)
# Creates wrapper scripts and installs them in the user's binaries directory, which is usually "/usr/local/bin".
# This is required because symlinks use the folder they are in as working directory.
macro(install_wrapper_script component target)
get_filename_component(file_name ${target} NAME)
file(WRITE ${CMAKE_SOURCE_DIR}/tmp/script/${file_name} "#!/bin/sh\n")
file(APPEND ${CMAKE_SOURCE_DIR}/tmp/script/${file_name} "${target} \"$@\"\n")
file(APPEND ${CMAKE_SOURCE_DIR}/tmp/script/${file_name} "exit $?\n")
file(WRITE ${CMAKE_SOURCE_DIR}/tmp/script/${file_name} "#!/bin/sh\n")
file(APPEND ${CMAKE_SOURCE_DIR}/tmp/script/${file_name} "${target} \"$@\"\n")
file(APPEND ${CMAKE_SOURCE_DIR}/tmp/script/${file_name} "exit $?\n")
install(FILES ${CMAKE_SOURCE_DIR}/tmp/script/${file_name}
COMPONENT ${component}
DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endmacro(install_wrapper_script)
install(FILES ${CMAKE_SOURCE_DIR}/tmp/script/${file_name}
COMPONENT ${component}
DESTINATION ${CMAKE_INSTALL_FULL_BINDIR}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endmacro(install_wrapper_script)
endif()
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
add_definitions(-D_DEBUG -DDEBUG)
@ -23,7 +25,10 @@ if(CMAKE_BUILD_TYPE STREQUAL "Release")
endif()
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
add_definitions(-DCPU_64)
set(COMPILER_ARCHITECTURE "x64")
add_definitions(-DCPU_64)
else()
set(COMPILER_ARCHITECTURE "x86")
endif()
add_definitions(-D_REENTRANT -DREENTRANT -D_THREAD_SAFE -D_THREADSAFE -DTHREAD_SAFE -DTHREADSAFE -D_FILE_OFFSET_BITS=64)
@ -32,7 +37,7 @@ add_definitions(-D_REENTRANT -DREENTRANT -D_THREAD_SAFE -D_THREADSAFE -DTHREAD_S
include_directories(.)
if(WIN32)
message(FATAL_ERROR "Windows compilation via CMake is currently not supported.")
add_definitions(-DWIN32 -D_WINDOWS -D_CRT_SECURE_NO_WARNINGS)
endif()
if(UNIX)
@ -103,11 +108,25 @@ add_custom_target(hamcore-archive-build
VERBATIM
)
# Print message after installing the targets
install(CODE "message(\"\n----------------------------------------------------------------------------------------------------------------------------\")")
install(CODE "message(\"Build completed successfully.\n\")")
install(CODE "message(\"Execute 'vpnserver start' to run the SoftEther VPN Server background service.\")")
install(CODE "message(\"Execute 'vpnbridge start' to run the SoftEther VPN Bridge background service.\")")
install(CODE "message(\"Execute 'vpnclient start' to run the SoftEther VPN Client background service.\")")
install(CODE "message(\"Execute 'vpncmd' to run the SoftEther VPN Command-Line Utility to configure VPN Server, VPN Bridge or VPN Client.\")")
install(CODE "message(\"----------------------------------------------------------------------------------------------------------------------------\n\")")
if(WIN32)
# PenCore
add_subdirectory(PenCore)
add_dependencies(hamcore-archive-build PenCore)
# vpnsmgr
add_subdirectory(vpnsmgr)
# vpncmgr
add_subdirectory(vpncmgr)
endif()
if(UNIX)
# Print message after installing the targets
install(CODE "message(\"\n----------------------------------------------------------------------------------------------------------------------------\")")
install(CODE "message(\"Build completed successfully.\n\")")
install(CODE "message(\"Execute 'vpnserver start' to run the SoftEther VPN Server background service.\")")
install(CODE "message(\"Execute 'vpnbridge start' to run the SoftEther VPN Bridge background service.\")")
install(CODE "message(\"Execute 'vpnclient start' to run the SoftEther VPN Client background service.\")")
install(CODE "message(\"Execute 'vpncmd' to run the SoftEther VPN Command-Line Utility to configure VPN Server, VPN Bridge or VPN Client.\")")
install(CODE "message(\"----------------------------------------------------------------------------------------------------------------------------\n\")")
endif()

View File

@ -1,7 +1,16 @@
file(GLOB SOURCES_CEDAR "*.c")
file(GLOB HEADERS_CEDAR "*.h")
add_library(cedar SHARED ${SOURCES_CEDAR} ${HEADERS_CEDAR})
if(WIN32)
enable_language(CXX)
file(GLOB SOURCES_CEDAR_CPP "*.cpp")
endif()
if(WIN32)
add_library(cedar STATIC ${SOURCES_CEDAR} ${SOURCES_CEDAR_CPP} ${HEADERS_CEDAR})
else()
add_library(cedar SHARED ${SOURCES_CEDAR} ${SOURCES_CEDAR_CPP} ${HEADERS_CEDAR})
endif()
set_target_properties(cedar
PROPERTIES
@ -10,13 +19,19 @@ set_target_properties(cedar
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
)
find_library(LIB_READLINE readline)
find_package(Curses REQUIRED)
if(WIN32)
target_include_directories(cedar PRIVATE winpcap)
endif()
target_link_libraries(cedar PRIVATE ${LIB_READLINE} ${CURSES_LIBRARIES})
if(UNIX)
find_library(LIB_READLINE readline)
find_package(Curses REQUIRED)
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
target_link_libraries(cedar PRIVATE mayaqua pcap)
target_link_libraries(cedar PRIVATE ${LIB_READLINE} ${CURSES_LIBRARIES})
if(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
target_link_libraries(cedar PRIVATE mayaqua pcap)
endif()
endif()
# Version
@ -55,8 +70,10 @@ message(STATUS "Build time: ${BUILD_HOUR}:${BUILD_MINUTE}:${BUILD_SECOND}")
add_definitions(-DBUILD_DATE_D=${BUILD_DAY} -DBUILD_DATE_M=${BUILD_MONTH} -DBUILD_DATE_Y=${BUILD_YEAR})
add_definitions(-DBUILD_DATE_HO=${BUILD_HOUR} -DBUILD_DATE_MI=${BUILD_MINUTE} -DBUILD_DATE_SE=${BUILD_SECOND})
install(TARGETS cedar
COMPONENT "common"
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
if(UNIX)
install(TARGETS cedar
COMPONENT "common"
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif()

1
src/Mayaqua/3rdparty/zlib vendored Submodule

View File

@ -1,7 +1,11 @@
file(GLOB SOURCES_MAYAQUA "*.c")
file(GLOB HEADERS_MAYAQUA "*.h")
add_library(mayaqua SHARED ${SOURCES_MAYAQUA} ${HEADERS_MAYAQUA})
if(WIN32)
add_library(mayaqua STATIC ${SOURCES_MAYAQUA} ${HEADERS_MAYAQUA})
else()
add_library(mayaqua SHARED ${SOURCES_MAYAQUA} ${HEADERS_MAYAQUA})
endif()
target_include_directories(mayaqua PUBLIC .)
@ -12,43 +16,72 @@ set_target_properties(mayaqua
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
)
find_package(OpenSSL REQUIRED)
find_package(Threads REQUIRED)
find_package(ZLIB REQUIRED)
if(WIN32)
add_subdirectory(3rdparty/zlib)
# In some cases libiconv is not included in libc
find_library(LIB_ICONV iconv)
target_include_directories(mayaqua PRIVATE win32_inc)
target_include_directories(mayaqua PRIVATE 3rdparty/zlib)
if(HAVE_SYS_AUXV)
add_subdirectory(cpu_features)
set_property(TARGET cpu_features PROPERTY POSITION_INDEPENDENT_CODE ON)
if(${COMPILER_ARCHITECTURE} STREQUAL "x64")
find_library(LIB_SSL
NAMES libssl ssleay32
HINTS "${CMAKE_SOURCE_DIR}/src/BuildFiles/Library/vs2017/x64_${CMAKE_BUILD_TYPE}"
)
find_library(LIB_CRYPTO
NAMES libcrypto libeay32
HINTS "${CMAKE_SOURCE_DIR}/src/BuildFiles/Library/vs2017/x64_${CMAKE_BUILD_TYPE}"
)
else()
find_library(LIB_SSL
NAMES libssl ssleay32
HINTS "${CMAKE_SOURCE_DIR}/src/BuildFiles/Library/vs2017/Win32_${CMAKE_BUILD_TYPE}"
)
find_library(LIB_CRYPTO
NAMES libcrypto libeay32
HINTS "${CMAKE_SOURCE_DIR}/src/BuildFiles/Library/vs2017/Win32_${CMAKE_BUILD_TYPE}"
)
endif()
target_link_libraries(mayaqua PRIVATE zlibstatic ${LIB_SSL} ${LIB_CRYPTO})
endif()
target_include_directories(mayaqua PRIVATE cpu_features/include)
if(UNIX)
find_package(OpenSSL REQUIRED)
find_package(Threads REQUIRED)
find_package(ZLIB REQUIRED)
target_link_libraries(mayaqua PRIVATE OpenSSL::SSL OpenSSL::Crypto Threads::Threads ZLIB::ZLIB)
# In some cases libiconv is not included in libc
find_library(LIB_ICONV iconv)
if(HAVE_SYS_AUXV)
target_link_libraries(mayaqua PRIVATE cpu_features)
else()
add_definitions(-DSKIP_CPU_FEATURES)
find_library(LIB_RT rt)
target_link_libraries(mayaqua PRIVATE OpenSSL::SSL OpenSSL::Crypto Threads::Threads ZLIB::ZLIB)
if(HAVE_SYS_AUXV)
add_subdirectory(3rdparty/cpu_features)
set_property(TARGET cpu_features PROPERTY POSITION_INDEPENDENT_CODE ON)
target_link_libraries(mayaqua PRIVATE cpu_features)
else()
add_definitions(-DSKIP_CPU_FEATURES)
endif()
if(LIB_RT)
target_link_libraries(mayaqua PRIVATE rt)
endif()
if(LIB_ICONV)
target_link_libraries(mayaqua PRIVATE ${LIB_ICONV})
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
target_link_libraries(mayaqua PRIVATE nsl socket)
endif()
install(TARGETS mayaqua
COMPONENT "common"
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
endif()
find_library(LIB_RT rt)
if(LIB_RT)
target_link_libraries(mayaqua PRIVATE ${LIB_RT})
endif()
if(LIB_ICONV)
target_link_libraries(mayaqua PRIVATE ${LIB_ICONV})
endif()
if(${CMAKE_SYSTEM_NAME} STREQUAL "SunOS")
target_link_libraries(mayaqua PRIVATE nsl socket)
endif()
install(TARGETS mayaqua
COMPONENT "common"
DESTINATION "${CMAKE_INSTALL_LIBDIR}"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)

View File

@ -0,0 +1,14 @@
if(NOT WIN32)
message(FATAL_ERROR "PenCore is needed only on Windows.")
endif()
add_library(PenCore SHARED pencore.c pencore.rc)
set_target_properties(PenCore
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/src/bin/hamcore"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/src/bin/hamcore"
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_SOURCE_DIR}/src/bin/hamcore"
)
target_link_libraries(PenCore cedar mayaqua)

View File

@ -1,4 +1,10 @@
add_executable(vpnbridge vpnbridge.c)
set(VPNBRIDGE_SOURCES vpnbridge.c)
if(WIN32)
set(VPNBRIDGE_SOURCES ${VPNBRIDGE_SOURCES} vpnbridge.rc)
endif()
add_executable(vpnbridge ${VPNBRIDGE_SOURCES})
set_target_properties(vpnbridge
PROPERTIES
@ -9,25 +15,27 @@ set_target_properties(vpnbridge
target_link_libraries(vpnbridge cedar mayaqua)
# Copy binary and "hamcore.se2" to /usr/lib(exec)/softether/, install launch script and systemd service
install(TARGETS vpnbridge
COMPONENT "vpnbridge"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnbridge"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES "${BUILD_DIRECTORY}/hamcore.se2"
COMPONENT "vpnbridge"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnbridge"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
install_wrapper_script("vpnbridge" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpnbridge/vpnbridge")
if(EXISTS "/lib/systemd/system")
configure_file(${CMAKE_SOURCE_DIR}/systemd/softether-vpnbridge.service ${CMAKE_BINARY_DIR}/systemd/softether-vpnbridge.service)
install(FILES ${CMAKE_BINARY_DIR}/systemd/softether-vpnbridge.service
if(UNIX)
# Copy binary and "hamcore.se2" to /usr/lib(exec)/softether/, install launch script and systemd service
install(TARGETS vpnbridge
COMPONENT "vpnbridge"
DESTINATION "/lib/systemd/system"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnbridge"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES "${BUILD_DIRECTORY}/hamcore.se2"
COMPONENT "vpnbridge"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnbridge"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
install_wrapper_script("vpnbridge" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpnbridge/vpnbridge")
if(EXISTS "/lib/systemd/system")
configure_file(${CMAKE_SOURCE_DIR}/systemd/softether-vpnbridge.service ${CMAKE_BINARY_DIR}/systemd/softether-vpnbridge.service)
install(FILES ${CMAKE_BINARY_DIR}/systemd/softether-vpnbridge.service
COMPONENT "vpnbridge"
DESTINATION "/lib/systemd/system"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif()
endif()

View File

@ -1,4 +1,10 @@
add_executable(vpnclient vpncsvc.c)
set(VPNCLIENT_SOURCES vpncsvc.c vpncsvc.h)
if(WIN32)
set(VPNCLIENT_SOURCES ${VPNCLIENT_SOURCES} vpnclient.rc)
endif()
add_executable(vpnclient ${VPNCLIENT_SOURCES})
set_target_properties(vpnclient
PROPERTIES
@ -9,25 +15,27 @@ set_target_properties(vpnclient
target_link_libraries(vpnclient cedar mayaqua)
# Copy binary and "hamcore.se2" to /usr/lib(exec)/softether/, install launch script and systemd service
install(TARGETS vpnclient
COMPONENT "vpnclient"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnclient"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES "${BUILD_DIRECTORY}/hamcore.se2"
COMPONENT "vpnclient"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnclient"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
install_wrapper_script("vpnclient" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpnclient/vpnclient")
if(EXISTS "/lib/systemd/system")
configure_file(${CMAKE_SOURCE_DIR}/systemd/softether-vpnclient.service ${CMAKE_BINARY_DIR}/systemd/softether-vpnclient.service)
install(FILES ${CMAKE_BINARY_DIR}/systemd/softether-vpnclient.service
if(UNIX)
# Copy binary and "hamcore.se2" to /usr/lib(exec)/softether/, install launch script and systemd service
install(TARGETS vpnclient
COMPONENT "vpnclient"
DESTINATION "/lib/systemd/system"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnclient"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES "${BUILD_DIRECTORY}/hamcore.se2"
COMPONENT "vpnclient"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnclient"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
install_wrapper_script("vpnclient" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpnclient/vpnclient")
if(EXISTS "/lib/systemd/system")
configure_file(${CMAKE_SOURCE_DIR}/systemd/softether-vpnclient.service ${CMAKE_BINARY_DIR}/systemd/softether-vpnclient.service)
install(FILES ${CMAKE_BINARY_DIR}/systemd/softether-vpnclient.service
COMPONENT "vpnclient"
DESTINATION "/lib/systemd/system"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif()
endif()

View File

@ -1,4 +1,10 @@
add_executable(vpncmd vpncmd.c)
set(VPNCMD_SOURCES vpncmd.c)
if(WIN32)
set(VPNCMD_SOURCES ${VPNCMD_SOURCES} vpncmd.rc)
endif()
add_executable(vpncmd ${VPNCMD_SOURCES})
set_target_properties(vpncmd
PROPERTIES
@ -9,17 +15,19 @@ set_target_properties(vpncmd
target_link_libraries(vpncmd cedar mayaqua)
# Copy binary and "hamcore.se2" to /usr/lib(exec)/softether/, install launch script
install(TARGETS vpncmd
COMPONENT "vpncmd"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpncmd"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
if(UNIX)
# Copy binary and "hamcore.se2" to /usr/lib(exec)/softether/, install launch script
install(TARGETS vpncmd
COMPONENT "vpncmd"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpncmd"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES "${BUILD_DIRECTORY}/hamcore.se2"
COMPONENT "vpncmd"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpncmd"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
install(FILES "${BUILD_DIRECTORY}/hamcore.se2"
COMPONENT "vpncmd"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpncmd"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
install_wrapper_script("vpncmd" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpncmd/vpncmd")
install_wrapper_script("vpncmd" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpncmd/vpncmd")
endif()

View File

@ -0,0 +1,22 @@
if(NOT WIN32)
message(FATAL_ERROR "VPN Client Manager is available only for Windows.")
endif()
set(VPNCMGR_SOURCES vpncmgr.c vpncmgr.rc)
if(${COMPILER_ARCHITECTURE} STREQUAL "x64")
set(VPNCMGR_SOURCES ${VPNCMGR_SOURCES} ${CMAKE_SOURCE_DIR}/src/BuildFiles/Manifests/x64_user.manifest)
else()
set(VPNCMGR_SOURCES ${VPNCMGR_SOURCES} ${CMAKE_SOURCE_DIR}/src/BuildFiles/Manifests/x86_user.manifest)
endif()
add_executable(vpncmgr WIN32 ${VPNCMGR_SOURCES})
set_target_properties(vpncmgr
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
)
target_link_libraries(vpncmgr cedar mayaqua)

View File

@ -1,4 +1,10 @@
add_executable(vpnserver vpnserver.c)
set(VPNSERVER_SOURCES vpnserver.c)
if(WIN32)
set(VPNSERVER_SOURCES ${VPNSERVER_SOURCES} vpnserver.rc)
endif()
add_executable(vpnserver ${VPNSERVER_SOURCES})
set_target_properties(vpnserver
PROPERTIES
@ -9,25 +15,27 @@ set_target_properties(vpnserver
target_link_libraries(vpnserver cedar mayaqua)
# Copy binary and "hamcore.se2" to /usr/lib(exec)/softether/, install launch script and systemd service
install(TARGETS vpnserver
COMPONENT "vpnserver"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnserver"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES "${BUILD_DIRECTORY}/hamcore.se2"
COMPONENT "vpnserver"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnserver"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
install_wrapper_script("vpnserver" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpnserver/vpnserver")
if(EXISTS "/lib/systemd/system")
configure_file(${CMAKE_SOURCE_DIR}/systemd/softether-vpnserver.service ${CMAKE_BINARY_DIR}/systemd/softether-vpnserver.service)
install(FILES ${CMAKE_BINARY_DIR}/systemd/softether-vpnserver.service
if(UNIX)
# Copy binary and "hamcore.se2" to /usr/lib(exec)/softether/, install launch script and systemd service
install(TARGETS vpnserver
COMPONENT "vpnserver"
DESTINATION "/lib/systemd/system"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnserver"
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE
)
install(FILES "${BUILD_DIRECTORY}/hamcore.se2"
COMPONENT "vpnserver"
DESTINATION "${CMAKE_INSTALL_LIBEXECDIR}/softether/vpnserver"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
install_wrapper_script("vpnserver" "${CMAKE_INSTALL_FULL_LIBEXECDIR}/softether/vpnserver/vpnserver")
if(EXISTS "/lib/systemd/system")
configure_file(${CMAKE_SOURCE_DIR}/systemd/softether-vpnserver.service ${CMAKE_BINARY_DIR}/systemd/softether-vpnserver.service)
install(FILES ${CMAKE_BINARY_DIR}/systemd/softether-vpnserver.service
COMPONENT "vpnserver"
DESTINATION "/lib/systemd/system"
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ
)
endif()
endif()

View File

@ -0,0 +1,22 @@
if(NOT WIN32)
message(FATAL_ERROR "VPN Server Manager is available only for Windows.")
endif()
set(VPNSMGR_SOURCES vpnsmgr.c vpnsmgr.rc)
if(${COMPILER_ARCHITECTURE} STREQUAL "x64")
set(VPNSMGR_SOURCES ${VPNSMGR_SOURCES} ${CMAKE_SOURCE_DIR}/src/BuildFiles/Manifests/x64_user.manifest)
else()
set(VPNSMGR_SOURCES ${VPNSMGR_SOURCES} ${CMAKE_SOURCE_DIR}/src/BuildFiles/Manifests/x86_user.manifest)
endif()
add_executable(vpnsmgr WIN32 ${VPNSMGR_SOURCES})
set_target_properties(vpnsmgr
PROPERTIES
ARCHIVE_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
LIBRARY_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
RUNTIME_OUTPUT_DIRECTORY "${BUILD_DIRECTORY}"
)
target_link_libraries(vpnsmgr cedar mayaqua)

View File

@ -1,4 +1,14 @@
add_executable(vpntest vpntest.c vpntest.h)
set(VPNTEST_SOURCES vpntest.c vpntest.h)
if(WIN32)
if(${COMPILER_ARCHITECTURE} STREQUAL "x64")
set(VPNTEST_SOURCES ${VPNTEST_SOURCES} ${CMAKE_SOURCE_DIR}/src/BuildFiles/Manifests/x64_user.manifest)
else()
set(VPNTEST_SOURCES ${VPNTEST_SOURCES} ${CMAKE_SOURCE_DIR}/src/BuildFiles/Manifests/x86_user.manifest)
endif()
endif()
add_executable(vpntest ${VPNTEST_SOURCES})
set_target_properties(vpntest
PROPERTIES