Skip to content

Commit

Permalink
Update cmake some more. (#208)
Browse files Browse the repository at this point in the history
* cmake: Update librdr.

* cmake: Update libomnithread.

* cmake: Update libudt4.

* cmake: Update libudtcloud.

* cmake: Update libzip32.

* cmake: Update libzipunzip.

* cmake: Update repeater.

* cmake: Update vncviewer.

* cmake: Update winvnc.

* cmake: Update uvnc_settings.

* cmake: Update main CMakeLists.txt.

* cmake: Remove unneeded libuvncsettings.

* cmake: Add createpassword.

* cmake: Add testauth.

* cmake: Add uvnckeyboardhelper.

* cmake: Add MSLogonACL.

* cmake: Add vnchooks.

* cmake: Add logging.

* cmake: Add logmessages.

* cmake: Add authadmin.

* cmake: Add authSSP.

* cmake: Add ldapauth.

* cmake: Add ldapauth9x.

* cmake: Add ldapauthnt4.

* cmake: Add workgrpdomnt4.

* cmake: Add setcad.

* cmake: Add setpasswd.

* cmake: Add SecureVNCPlugin (disabled).

* cmake: Add option to compile with Address Santitizer.

* cmake: Copy mingw runtime dlls to the install directory.

* cmake: Update readme.txt.
  • Loading branch information
bernhardu authored Aug 19, 2024
1 parent 562a0ce commit 6592ed9
Show file tree
Hide file tree
Showing 29 changed files with 652 additions and 110 deletions.
44 changes: 41 additions & 3 deletions cmake/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,55 @@ cmake_minimum_required(VERSION 3.5.0)
project(UltraVNC LANGUAGES C CXX RC)

set(CMAKE_CXX_STANDARD 14)
set(CMAKE_C_FLAGS "-Wno-write-strings")
set(CMAKE_CXX_FLAGS "-Wno-write-strings -Wno-conversion-null")
if (MINGW)
set(CMAKE_C_FLAGS "-Wno-write-strings")
set(CMAKE_CXX_FLAGS "-Wno-write-strings -Wno-conversion-null")
endif()
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC")
add_compile_definitions("_CRT_SECURE_NO_WARNINGS")
add_compile_definitions("_WINSOCK_DEPRECATED_NO_WARNINGS")
add_compile_definitions("NOMINMAX")
set(CMAKE_MFC_FLAG 2)
endif()
if( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64" )
add_compile_definitions("_X64")
endif()

option(asan "Build with address sanitizer enabled.")
if (asan)
add_compile_options(-fsanitize=address)
add_link_options(-fsanitize=address)
install(FILES "c:/Program Files/Microsoft Visual Studio/2022/Community/VC/Tools/MSVC/14.40.33807/bin/Hostx64/x64/clang_rt.asan_dynamic-x86_64.dll" DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL)
endif()

if (MINGW)
install(FILES /usr/lib/gcc/x86_64-w64-mingw32/13-win32/libstdc++-6.dll DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL)
install(FILES /usr/lib/gcc/x86_64-w64-mingw32/13-win32/libgcc_s_seh-1.dll DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL)
endif()

add_subdirectory(authadmin)
add_subdirectory(authSSP)
add_subdirectory(createpassword)
add_subdirectory(ldapauth)
add_subdirectory(ldapauth9x)
add_subdirectory(ldapauthnt4)
add_subdirectory(libomnithread)
add_subdirectory(librdr)
add_subdirectory(libudt4)
add_subdirectory(libudtcloud)
add_subdirectory(libuvncsettings)
add_subdirectory(libzip32)
add_subdirectory(libzipunzip)
add_subdirectory(logging)
add_subdirectory(logmessages)
add_subdirectory(MSLogonACL)
add_subdirectory(repeater)
#add_subdirectory(SecureVNCPlugin) # Not publicly available.
add_subdirectory(setcad)
add_subdirectory(setpasswd)
add_subdirectory(testauth)
add_subdirectory(uvnc_settings)
add_subdirectory(uvnckeyboardhelper)
add_subdirectory(vnchooks)
add_subdirectory(vncviewer)
add_subdirectory(winvnc)
add_subdirectory(workgrpdomnt4)
25 changes: 25 additions & 0 deletions cmake/MSLogonACL/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

project(MSLogonACL LANGUAGES CXX RC)

set(${PROJECT_NAME}_SOURCES
MSLogonACL.cpp
vncExportACL.cpp
vncImportACL.cpp
)
add_executable(${PROJECT_NAME})
foreach(file ${${PROJECT_NAME}_SOURCES})
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/ms-logon/MSLogonACL/${file}")
endforeach(file)
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/ms-logon/MSLogonACL/MSLogonACL.rc")
set_source_files_properties(${CMAKE_SOURCE_DIR}/../addon/ms-logon/MSLogonACL/MSLogonACL.rc LANGUAGE RC)
target_compile_definitions(${PROJECT_NAME} PRIVATE UNICODE=1 _UNICODE=1)
if (MINGW)
target_link_options(${PROJECT_NAME} PRIVATE "-municode")
endif()
target_link_libraries(${PROJECT_NAME}
netapi32
)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL)
endif()
31 changes: 31 additions & 0 deletions cmake/SecureVNCPlugin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@

project(SecureVNCPlugin LANGUAGES CXX RC)

find_package(OpenSSL REQUIRED)

set(${PROJECT_NAME}_SOURCES
Base64.cpp
CryptUtils.cpp
Dialogs.cpp
dllmain.cpp
IntegratedSecureVNCPluginObject.cpp
MultithreadedPlugin.cpp
SecureVNCPlugin.cpp
SecureVNCPluginObject.cpp
stdafx.cpp
Utils.cpp
)
add_library(${PROJECT_NAME} SHARED)
foreach(file ${${PROJECT_NAME}_SOURCES})
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../DSMPlugin/SecureVNC/SecureVNCPlugin/${file}")
endforeach(file)
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../DSMPlugin/SecureVNC/SecureVNCPlugin/SecureVNCPlugin.rc")
set_source_files_properties(${CMAKE_SOURCE_DIR}/../DSMPlugin/SecureVNC/SecureVNCPlugin/SecureVNCPlugin.rc LANGUAGE RC)
target_compile_definitions(${PROJECT_NAME} PRIVATE WIN32 NDEBUG _WINDOWS _USRDLL SECUREVNCPLUGIN_EXPORTS)
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
target_link_libraries(${PROJECT_NAME} PRIVATE OpenSSL::SSL)
target_link_libraries(${PROJECT_NAME} PRIVATE OpenSSL::Crypto)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL)
endif()
30 changes: 30 additions & 0 deletions cmake/authSSP/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

project(authSSP LANGUAGES CXX RC)

set(${PROJECT_NAME}_SOURCES
authSSP.cpp
EventLogging.cpp
GenClientServerContext.cpp
vncAccessControl.cpp
vncSecurityEditor.cpp
vncSSP.cpp
)
add_library(${PROJECT_NAME} SHARED)
foreach(file ${${PROJECT_NAME}_SOURCES})
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/ms-logon/authSSP/${file}")
endforeach(file)
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/ms-logon/authSSP/authSSP.rc")
set_source_files_properties(${CMAKE_SOURCE_DIR}/../addon/ms-logon/authSSP/authSSP.rc LANGUAGE RC)
target_compile_definitions(${PROJECT_NAME} PRIVATE NDEBUG WIN32 _WINDOWS AUTHSSP_EXPORTS UNICODE=1 _UNICODE=1)
if (MINGW)
target_link_options(${PROJECT_NAME} PRIVATE "-municode")
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
target_link_libraries(${PROJECT_NAME}
aclui
comctl32
)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL)
endif()
21 changes: 21 additions & 0 deletions cmake/authadmin/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

project(authadmin LANGUAGES CXX RC)

set(${PROJECT_NAME}_SOURCES
authadmin.cpp
)
add_library(${PROJECT_NAME} SHARED)
foreach(file ${${PROJECT_NAME}_SOURCES})
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/ms-logon/authadm/${file}")
endforeach(file)
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/ms-logon/authadm/authadmin.rc")
set_source_files_properties(${CMAKE_SOURCE_DIR}/../addon/ms-logon/authadm/authadmin.rc LANGUAGE RC)
target_compile_definitions(${PROJECT_NAME} PRIVATE WIN32 NDEBUG _WINDOWS AUTHADMIN_EXPORTS)
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
target_link_libraries(${PROJECT_NAME}
netapi32
)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL)
endif()
15 changes: 15 additions & 0 deletions cmake/createpassword/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@

project(createpassword LANGUAGES CXX RC)

set(${PROJECT_NAME}_SOURCES
createpassword.cpp
../../setpasswd/setpasswd/inifile.cpp
)
add_executable(${PROJECT_NAME})
foreach(file ${${PROJECT_NAME}_SOURCES})
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../winvnc/createpassword/${file}")
endforeach(file)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL)
endif()
25 changes: 25 additions & 0 deletions cmake/ldapauth/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

project(ldapauth LANGUAGES CXX RC)

set(${PROJECT_NAME}_SOURCES
ldapAuth.cpp
)
add_library(${PROJECT_NAME} SHARED)
foreach(file ${${PROJECT_NAME}_SOURCES})
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/ms-logon/ldapauth/${file}")
endforeach(file)
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/ms-logon/ldapauth/ldapAuth.rc")
set_source_files_properties(${CMAKE_SOURCE_DIR}/../addon/ms-logon/ldapauth/ldapAuth.rc LANGUAGE RC)
target_compile_definitions(${PROJECT_NAME} PRIVATE NDEBUG WIN32 _WINDOWS LDAPAUTH_EXPORTS UNICODE=1 _UNICODE=1)
if (MINGW)
target_link_options(${PROJECT_NAME} PRIVATE "-municode")
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
target_link_libraries(${PROJECT_NAME}
activeds
adsiid
)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL)
endif()
25 changes: 25 additions & 0 deletions cmake/ldapauth9x/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@

project(ldapauth9x LANGUAGES CXX RC)

set(${PROJECT_NAME}_SOURCES
ldapAuth9x.cpp
)
add_library(${PROJECT_NAME} SHARED)
foreach(file ${${PROJECT_NAME}_SOURCES})
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/ms-logon/ldapauth9x/${file}")
endforeach(file)
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/ms-logon/ldapauth9x/ldapAuth9x.rc")
set_source_files_properties(${CMAKE_SOURCE_DIR}/../addon/ms-logon/ldapauth9x/ldapAuth9x.rc LANGUAGE RC)
target_compile_definitions(${PROJECT_NAME} PRIVATE NDEBUG WIN32 _WINDOWS LDAPAUTH9X_EXPORTS UNICODE=1 _UNICODE=1)
if (MINGW)
target_link_options(${PROJECT_NAME} PRIVATE "-municode")
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
target_link_libraries(${PROJECT_NAME}
activeds
adsiid
)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL)
endif()
26 changes: 26 additions & 0 deletions cmake/ldapauthnt4/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

project(ldapauthnt4 LANGUAGES CXX RC)

set(${PROJECT_NAME}_SOURCES
ldapAuthnt4.cpp
)
add_library(${PROJECT_NAME} SHARED)
foreach(file ${${PROJECT_NAME}_SOURCES})
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/ms-logon/ldapauthNT4/${file}")
endforeach(file)
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/ms-logon/ldapauthNT4/ldapAuthnt4.rc")
set_source_files_properties(${CMAKE_SOURCE_DIR}/../addon/ms-logon/ldapauthNT4/ldapAuthnt4.rc LANGUAGE RC)
target_compile_definitions(${PROJECT_NAME} PRIVATE NDEBUG WIN32 _WINDOWS LDAPAUTHNT4_EXPORTS UNICODE=1 _UNICODE=1)
if (MINGW)
target_link_options(${PROJECT_NAME} PRIVATE "-municode")
endif()
set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "")
target_link_libraries(${PROJECT_NAME}
activeds
adsiid
netapi32
)
install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc)
if (MSVC)
install(FILES $<TARGET_PDB_FILE:${PROJECT_NAME}> DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL)
endif()
11 changes: 7 additions & 4 deletions cmake/libomnithread/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@

set(LIBOMNITHREAD_SOURCES
project(libomnithread LANGUAGES CXX RC)

set(${PROJECT_NAME}_SOURCES
nt.cpp
)
add_library(libomnithread STATIC)
foreach(file ${LIBOMNITHREAD_SOURCES})
target_sources(libomnithread PRIVATE "${CMAKE_SOURCE_DIR}/../omnithread/${file}")
add_library(${PROJECT_NAME} STATIC)
foreach(file ${${PROJECT_NAME}_SOURCES})
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../omnithread/${file}")
endforeach(file)
target_compile_definitions(${PROJECT_NAME} PRIVATE NDEBUG WIN32 _WINDOWS __NT__ _WINSTATIC __WIN32__ _WIN32_WINNT=0x400)
22 changes: 16 additions & 6 deletions cmake/librdr/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,19 +1,29 @@

project(librdr LANGUAGES CXX RC)

find_package(ZLIB REQUIRED)
find_package(zstd CONFIG REQUIRED)
find_package(LibLZMA REQUIRED)

set(LIBRDR_SOURCES
set(${PROJECT_NAME}_SOURCES
FdInStream.cxx
FdOutStream.cxx
InStream.cxx
NullOutStream.cxx
ZlibInStream.cxx
ZlibOutStream.cxx
ZstdInStream.cxx
ZstdOutStream.cxx
xzInStream.cxx
xzOutStream.cxx
)
add_library(librdr STATIC)
target_compile_definitions(librdr PRIVATE _VCPKG)
foreach(file ${LIBRDR_SOURCES})
target_sources(librdr PRIVATE "${CMAKE_SOURCE_DIR}/../rdr/${file}")
add_library(${PROJECT_NAME} STATIC)
target_compile_definitions(${PROJECT_NAME} PRIVATE _XZ _VCPKG)
foreach(file ${${PROJECT_NAME}_SOURCES})
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../rdr/${file}")
endforeach(file)
target_link_libraries(librdr
target_link_libraries(${PROJECT_NAME}
PRIVATE ZLIB::ZLIB
PRIVATE zstd::libzstd
PRIVATE LibLZMA::LibLZMA
)
14 changes: 8 additions & 6 deletions cmake/libudt4/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@

set(LIBUDT4_SOURCES
project(libudt4 LANGUAGES CXX RC)

set(${PROJECT_NAME}_SOURCES
src/api.cpp
src/buffer.cpp
src/cache.cpp
Expand All @@ -14,12 +16,12 @@ set(LIBUDT4_SOURCES
src/queue.cpp
src/window.cpp
)
add_library(libudt4 STATIC)
target_include_directories(libudt4 PRIVATE "${CMAKE_SOURCE_DIR}/../udt4")
foreach(file ${LIBUDT4_SOURCES})
target_sources(libudt4 PRIVATE "${CMAKE_SOURCE_DIR}/../udt4/${file}")
add_library(${PROJECT_NAME} STATIC)
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../udt4")
foreach(file ${${PROJECT_NAME}_SOURCES})
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../udt4/${file}")
endforeach(file)
target_link_libraries(libudt4
target_link_libraries(${PROJECT_NAME}
ws2_32
wsock32
)
16 changes: 9 additions & 7 deletions cmake/libudtcloud/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,17 @@

set(LIBUDTCLOUD_SOURCES
project(libudtcloud LANGUAGES CXX RC)

set(${PROJECT_NAME}_SOURCES
proxy/Cloudthread.cpp
proxy/proxy.cpp
proxy/ringbuffer.cpp
)
add_library(libudtcloud STATIC)
target_include_directories(libudtcloud PRIVATE "${CMAKE_SOURCE_DIR}/../UdtCloudlib")
target_include_directories(libudtcloud PRIVATE "${CMAKE_SOURCE_DIR}/../UdtCloudlib/proxy")
foreach(file ${LIBUDTCLOUD_SOURCES})
target_sources(libudtcloud PRIVATE "${CMAKE_SOURCE_DIR}/../UdtCloudlib/${file}")
add_library(${PROJECT_NAME} STATIC)
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../UdtCloudlib")
target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../UdtCloudlib/proxy")
foreach(file ${${PROJECT_NAME}_SOURCES})
target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../UdtCloudlib/${file}")
endforeach(file)
target_link_libraries(libudtcloud
target_link_libraries(${PROJECT_NAME}
libudt4
)
18 changes: 0 additions & 18 deletions cmake/libuvncsettings/CMakeLists.txt

This file was deleted.

Loading

0 comments on commit 6592ed9

Please sign in to comment.