From 6592ed9efa91f7f17528016584d5eca4b696caed Mon Sep 17 00:00:00 2001 From: bernhardu Date: Mon, 19 Aug 2024 21:53:50 +0200 Subject: [PATCH] Update cmake some more. (#208) * 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. --- cmake/CMakeLists.txt | 44 +++++++- cmake/MSLogonACL/CMakeLists.txt | 25 +++++ cmake/SecureVNCPlugin/CMakeLists.txt | 31 ++++++ cmake/authSSP/CMakeLists.txt | 30 ++++++ cmake/authadmin/CMakeLists.txt | 21 ++++ cmake/createpassword/CMakeLists.txt | 15 +++ cmake/ldapauth/CMakeLists.txt | 25 +++++ cmake/ldapauth9x/CMakeLists.txt | 25 +++++ cmake/ldapauthnt4/CMakeLists.txt | 26 +++++ cmake/libomnithread/CMakeLists.txt | 11 +- cmake/librdr/CMakeLists.txt | 22 ++-- cmake/libudt4/CMakeLists.txt | 14 +-- cmake/libudtcloud/CMakeLists.txt | 16 +-- cmake/libuvncsettings/CMakeLists.txt | 18 ---- cmake/libzip32/CMakeLists.txt | 12 ++- cmake/libzipunzip/CMakeLists.txt | 12 ++- cmake/logging/CMakeLists.txt | 18 ++++ cmake/logmessages/CMakeLists.txt | 46 +++++++++ cmake/readme.txt | 130 +++++++++++++++++++++++- cmake/repeater/CMakeLists.txt | 19 ++-- cmake/setcad/CMakeLists.txt | 21 ++++ cmake/setpasswd/CMakeLists.txt | 19 ++++ cmake/testauth/CMakeLists.txt | 14 +++ cmake/uvnc_settings/CMakeLists.txt | 26 ++--- cmake/uvnckeyboardhelper/CMakeLists.txt | 16 +++ cmake/vnchooks/CMakeLists.txt | 18 ++++ cmake/vncviewer/CMakeLists.txt | 31 +++--- cmake/winvnc/CMakeLists.txt | 36 +++---- cmake/workgrpdomnt4/CMakeLists.txt | 21 ++++ 29 files changed, 652 insertions(+), 110 deletions(-) create mode 100644 cmake/MSLogonACL/CMakeLists.txt create mode 100644 cmake/SecureVNCPlugin/CMakeLists.txt create mode 100644 cmake/authSSP/CMakeLists.txt create mode 100644 cmake/authadmin/CMakeLists.txt create mode 100644 cmake/createpassword/CMakeLists.txt create mode 100644 cmake/ldapauth/CMakeLists.txt create mode 100644 cmake/ldapauth9x/CMakeLists.txt create mode 100644 cmake/ldapauthnt4/CMakeLists.txt delete mode 100644 cmake/libuvncsettings/CMakeLists.txt create mode 100644 cmake/logging/CMakeLists.txt create mode 100644 cmake/logmessages/CMakeLists.txt create mode 100644 cmake/setcad/CMakeLists.txt create mode 100644 cmake/setpasswd/CMakeLists.txt create mode 100644 cmake/testauth/CMakeLists.txt create mode 100644 cmake/uvnckeyboardhelper/CMakeLists.txt create mode 100644 cmake/vnchooks/CMakeLists.txt create mode 100644 cmake/workgrpdomnt4/CMakeLists.txt diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt index bd25eb51c..51275de81 100644 --- a/cmake/CMakeLists.txt +++ b/cmake/CMakeLists.txt @@ -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) diff --git a/cmake/MSLogonACL/CMakeLists.txt b/cmake/MSLogonACL/CMakeLists.txt new file mode 100644 index 000000000..2d0dc09a0 --- /dev/null +++ b/cmake/MSLogonACL/CMakeLists.txt @@ -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 $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/SecureVNCPlugin/CMakeLists.txt b/cmake/SecureVNCPlugin/CMakeLists.txt new file mode 100644 index 000000000..f9509048a --- /dev/null +++ b/cmake/SecureVNCPlugin/CMakeLists.txt @@ -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 $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/authSSP/CMakeLists.txt b/cmake/authSSP/CMakeLists.txt new file mode 100644 index 000000000..67588aeec --- /dev/null +++ b/cmake/authSSP/CMakeLists.txt @@ -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 $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/authadmin/CMakeLists.txt b/cmake/authadmin/CMakeLists.txt new file mode 100644 index 000000000..093289257 --- /dev/null +++ b/cmake/authadmin/CMakeLists.txt @@ -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 $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/createpassword/CMakeLists.txt b/cmake/createpassword/CMakeLists.txt new file mode 100644 index 000000000..426e9ad5e --- /dev/null +++ b/cmake/createpassword/CMakeLists.txt @@ -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 $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/ldapauth/CMakeLists.txt b/cmake/ldapauth/CMakeLists.txt new file mode 100644 index 000000000..e7d83cd47 --- /dev/null +++ b/cmake/ldapauth/CMakeLists.txt @@ -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 $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/ldapauth9x/CMakeLists.txt b/cmake/ldapauth9x/CMakeLists.txt new file mode 100644 index 000000000..f13036745 --- /dev/null +++ b/cmake/ldapauth9x/CMakeLists.txt @@ -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 $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/ldapauthnt4/CMakeLists.txt b/cmake/ldapauthnt4/CMakeLists.txt new file mode 100644 index 000000000..f964f6c4f --- /dev/null +++ b/cmake/ldapauthnt4/CMakeLists.txt @@ -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 $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/libomnithread/CMakeLists.txt b/cmake/libomnithread/CMakeLists.txt index dfa124fb9..3e8e1ecdf 100644 --- a/cmake/libomnithread/CMakeLists.txt +++ b/cmake/libomnithread/CMakeLists.txt @@ -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) diff --git a/cmake/librdr/CMakeLists.txt b/cmake/librdr/CMakeLists.txt index 9181d6bef..272d6c3c4 100644 --- a/cmake/librdr/CMakeLists.txt +++ b/cmake/librdr/CMakeLists.txt @@ -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 ) diff --git a/cmake/libudt4/CMakeLists.txt b/cmake/libudt4/CMakeLists.txt index 4b5e27bd7..60c725ce7 100644 --- a/cmake/libudt4/CMakeLists.txt +++ b/cmake/libudt4/CMakeLists.txt @@ -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 @@ -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 ) diff --git a/cmake/libudtcloud/CMakeLists.txt b/cmake/libudtcloud/CMakeLists.txt index d81097364..29476dae7 100644 --- a/cmake/libudtcloud/CMakeLists.txt +++ b/cmake/libudtcloud/CMakeLists.txt @@ -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 ) diff --git a/cmake/libuvncsettings/CMakeLists.txt b/cmake/libuvncsettings/CMakeLists.txt deleted file mode 100644 index c1e6b407e..000000000 --- a/cmake/libuvncsettings/CMakeLists.txt +++ /dev/null @@ -1,18 +0,0 @@ - -set(LIBUVNCSETTINGS_SOURCES - capture.cpp - connections.cpp - filetransfer.cpp - firewall.cpp - log.cpp - misc.cpp - network.cpp - security.cpp - service.cpp -) -add_library(libuvncsettings STATIC) -target_include_directories(libuvncsettings PRIVATE "${CMAKE_SOURCE_DIR}/../DSMPlugin") -target_include_directories(libuvncsettings PRIVATE "${CMAKE_SOURCE_DIR}/../omnithread") -foreach(file ${LIBUVNCSETTINGS_SOURCES}) - target_sources(libuvncsettings PRIVATE "${CMAKE_SOURCE_DIR}/../uvnc_settings/uvnc_settings/${file}") -endforeach(file) diff --git a/cmake/libzip32/CMakeLists.txt b/cmake/libzip32/CMakeLists.txt index 7b3f8d3ab..5633b63b7 100644 --- a/cmake/libzip32/CMakeLists.txt +++ b/cmake/libzip32/CMakeLists.txt @@ -1,5 +1,7 @@ -set(LIBZIP32_SOURCES +project(libzip32 LANGUAGES CXX RC) + +set(${PROJECT_NAME}_SOURCES api.c crypt.c deflate.c @@ -15,8 +17,8 @@ set(LIBZIP32_SOURCES zipfile.c zipup.c ) -add_library(libzip32 STATIC) -foreach(file ${LIBZIP32_SOURCES}) - target_sources(libzip32 PRIVATE "${CMAKE_SOURCE_DIR}/../zipunzip_src/zip20/${file}") +add_library(${PROJECT_NAME} STATIC) +foreach(file ${${PROJECT_NAME}_SOURCES}) + target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../zipunzip_src/zip20/${file}") endforeach(file) -target_compile_definitions(libzip32 PRIVATE NO_ASM WINDLL MSDOS USE_ZIPMAIN ZIPLIB USE_MINGW_GLOBBING) +target_compile_definitions(${PROJECT_NAME} PRIVATE NDEBUG _WINDOWS WIN32 NO_ASM WINDLL MSDOS USE_ZIPMAIN ZIPLIB) diff --git a/cmake/libzipunzip/CMakeLists.txt b/cmake/libzipunzip/CMakeLists.txt index cc1af8f16..75a643280 100644 --- a/cmake/libzipunzip/CMakeLists.txt +++ b/cmake/libzipunzip/CMakeLists.txt @@ -1,5 +1,7 @@ -set(LIBZIPUNZIP_SOURCES +project(libzipunzip LANGUAGES CXX RC) + +set(${PROJECT_NAME}_SOURCES api.c crc32.c crctab.c @@ -18,8 +20,8 @@ set(LIBZIPUNZIP_SOURCES windll/windll.c zipinfo.c ) -add_library(libzipunzip STATIC) -foreach(file ${LIBZIPUNZIP_SOURCES}) - target_sources(libzipunzip PRIVATE "${CMAKE_SOURCE_DIR}/../zipunzip_src/unzip/${file}") +add_library(${PROJECT_NAME} STATIC) +foreach(file ${${PROJECT_NAME}_SOURCES}) + target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../zipunzip_src/unzip/${file}") endforeach(file) -target_compile_definitions(libzipunzip PRIVATE WINDLL DLL UNZIPLIB USE_EF_UT_TIME) +target_compile_definitions(${PROJECT_NAME} PRIVATE NDEBUG _WINDOWS WIN32 WINDLL DLL UNZIPLIB USE_EF_UT_TIME) diff --git a/cmake/logging/CMakeLists.txt b/cmake/logging/CMakeLists.txt new file mode 100644 index 000000000..0c78ed4a7 --- /dev/null +++ b/cmake/logging/CMakeLists.txt @@ -0,0 +1,18 @@ + +project(logging LANGUAGES CXX RC) + +set(${PROJECT_NAME}_SOURCES + logging.cpp +) +add_library(${PROJECT_NAME} SHARED) +foreach(file ${${PROJECT_NAME}_SOURCES}) + target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/ms-logon/logging/${file}") +endforeach(file) +target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/ms-logon/logging/logging.rc") +set_source_files_properties(${CMAKE_SOURCE_DIR}/../addon/ms-logon/logging/logging.rc LANGUAGE RC) +target_compile_definitions(${PROJECT_NAME} PRIVATE WIN32 NDEBUG _WINDOWS LOGGING_EXPORTS) +set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc) +if (MSVC) + install(FILES $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/logmessages/CMakeLists.txt b/cmake/logmessages/CMakeLists.txt new file mode 100644 index 000000000..a68fd40f4 --- /dev/null +++ b/cmake/logmessages/CMakeLists.txt @@ -0,0 +1,46 @@ + +project(logmessages LANGUAGES CXX RC) + +if("${CMAKE_MC_COMPILER}" STREQUAL "" AND NOT "${CMAKE_RC_COMPILER}" STREQUAL "") + string(REGEX REPLACE "windres$" "windmc" CMAKE_MC_COMPILER ${CMAKE_RC_COMPILER}) + string(REGEX REPLACE "rc.exe$" "mc.exe" CMAKE_MC_COMPILER ${CMAKE_MC_COMPILER}) +endif() +message(STATUS "Found resource compiler: ${CMAKE_RC_COMPILER}") +message(STATUS "Found message compiler: ${CMAKE_MC_COMPILER}") + +set(${PROJECT_NAME}_MESSAGES + messages.mc +) +add_library(${PROJECT_NAME} SHARED) +foreach(file ${${PROJECT_NAME}_MESSAGES}) + set(file "${CMAKE_SOURCE_DIR}/../addon/eventMessageLogger/${file}") + target_sources(${PROJECT_NAME} PRIVATE "${file}") + get_filename_component(header ${file} NAME) + string(REGEX REPLACE "\.mc$" ".h" header ${header}) + set_source_files_properties(${header} PROPERTIES GENERATED TRUE) + add_custom_command( + OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/MSG00001.bin + BYPRODUCTS ${CMAKE_CURRENT_BINARY_DIR}/${header} + DEPENDS ${file} + COMMAND ${CMAKE_MC_COMPILER} + ARGS + -h ${CMAKE_CURRENT_BINARY_DIR} + -r ${CMAKE_CURRENT_BINARY_DIR} + ${file} + VERBATIM + ) + target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}") +endforeach(file) +target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/eventMessageLogger/messages.rc") +set_source_files_properties(${CMAKE_SOURCE_DIR}/../addon/eventMessageLogger/messages.rc LANGUAGE RC) +set_source_files_properties(${CMAKE_SOURCE_DIR}/../addon/eventMessageLogger/messages.rc OBJECT_DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/MSG00001.bin) +target_compile_definitions(${PROJECT_NAME} PRIVATE WIN32;NDEBUG;_WINDOWS;_USRDLL;LOGMESSAGES_EXPORTS) +set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") +set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE "CXX" ) +if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC" OR "${CMAKE_CXX_COMPILER_FRONTEND_VARIANT}" STREQUAL "MSVC") + target_link_options(${PROJECT_NAME} PRIVATE "/NOENTRY") +endif() +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc) +if (MSVC) + install(FILES $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/readme.txt b/cmake/readme.txt index a1e9a29e0..06916afd3 100644 --- a/cmake/readme.txt +++ b/cmake/readme.txt @@ -1,11 +1,11 @@ +###################### -# Trixie/unstable amd64 qemu VM 2024-07-28 +# Debian Trixie/unstable amd64 qemu VM 2024-07-28 apt install git curl zip unzip tar build-essential cmake ninja-build mingw-w64 nasm pkg-config ccache - mkdir $HOME/source cd $HOME/source git clone https://github.com/microsoft/vcpkg.git @@ -19,13 +19,13 @@ vcpkg --version - export PATH=/usr/lib/ccache:$PATH vcpkg install zlib:x64-mingw-static vcpkg install zstd:x64-mingw-static vcpkg install libjpeg-turbo:x64-mingw-static - +vcpkg install liblzma:x64-mingw-static +vcpkg install openssl:x64-mingw-static @@ -43,6 +43,128 @@ cmake \ -DCMAKE_BUILD_TYPE=RelWithDebInfo \ ../UltraVNC/cmake cmake --build . -j +cmake --build . --target install +#make clean cp -a /usr/lib/gcc/x86_64-w64-mingw32/13-win32/libstdc++-6.dll . cp -a /usr/lib/gcc/x86_64-w64-mingw32/13-win32/libgcc_s_seh-1.dll . + + + + + +###################### + +# Windows with cmake, generate Visual Studio project files + +# Install git +# Install Visual Studio Community 2022 (with MFC components to avoid errors about missing afxres.h) + +# Open git bash + +mkdir c:/source +cd c:/source +git clone https://github.com/microsoft/vcpkg.git +cd vcpkg + + +# Developer Command Prompt for VS + +cd /d c:\source\vcpkg +bootstrap-vcpkg.bat -disableMetrics +set VCPKG_ROOT=c:\source\vcpkg +set PATH=%VCPKG_ROOT%;%PATH% + +vcpkg --version + + +# If you get this message: +# vcpkg could not locate a manifest (vcpkg.json); +# https://superuser.com/questions/1829880/vcpkg-could-not-locate-a-manifest-vcpkg-json +doskey vcpkg= + +vcpkg install zlib:x64-windows-static +vcpkg install zstd:x64-windows-static +vcpkg install libjpeg-turbo:x64-windows-static +vcpkg install liblzma:x64-windows-static +vcpkg install openssl:x64-windows-static + +vcpkg integrate install + + +cd /d c:\source +git clone https://github.com/ultravnc/UltraVNC.git + +mkdir obj && cd obj +cmake ^ + -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake ^ + -DVCPKG_TARGET_TRIPLET=x64-windows-static ^ + ..\UltraVNC\cmake +set CL=/MP +cmake --build . --parallel --config=RelWithDebInfo + + + + +###################### + +# Windows with cmake, using ninja build system, and address santitizer enabled + +# x64 Native Tools Command Prompt for VS 2022 + +# Same steps before the cmake invocation as above + +cd /d c:\source +mkdir obj_ninja && cd obj_ninja +cmake ^ + -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake ^ + -DVCPKG_TARGET_TRIPLET=x64-windows-static ^ + -G Ninja ^ + -Dasan=TRUE ^ + ..\UltraVNC\cmake +cmake --build . --parallel --config=RelWithDebInfo +cmake --build . --target install --config=RelWithDebInfo +copy "%VCToolsInstallDir%\bin\Hostx64\x64\clang_rt.asan_dynamic-x86_64.dll" ultravnc\ +#ninja clean + + + + +###################### + +# Windows with cmake, using LLVM compiler + +# x64 Native Tools Command Prompt for VS 2022 + +# Same steps before the cmake invocation as above + +cd /d c:\source +mkdir obj_ninja_llvm && cd obj_ninja_llvm +cmake ^ + -DCMAKE_TOOLCHAIN_FILE=%VCPKG_ROOT%\scripts\buildsystems\vcpkg.cmake ^ + -DVCPKG_TARGET_TRIPLET=x64-windows-static ^ + -T ClangCL ^ + ..\UltraVNC\cmake +cmake --build . --parallel --config=RelWithDebInfo +#ninja clean + + + + +###################### + +# Windows with regular Visual Studio project files + +# Install Plattformtoolset matching to the project files, currently v142 + +set _P=^ + /p:Platform=x64 ^ + /p:Configuration=Release ^ + /p:Plattformtoolset=v143 ^ + /p:BuildInParallel=true -maxcpucount:16 /p:CL_MPCount=16 ^ + /t:Clean;Build +set CL=/MP + +cd /d C:\source\UltraVNC +msbuild %_P% winvnc\winvnc.sln +msbuild %_P% vncviewer\vncviewer.sln diff --git a/cmake/repeater/CMakeLists.txt b/cmake/repeater/CMakeLists.txt index 711c82933..26c596b06 100644 --- a/cmake/repeater/CMakeLists.txt +++ b/cmake/repeater/CMakeLists.txt @@ -1,5 +1,7 @@ -set(REPEATER_SOURCES +project(repeater LANGUAGES CXX RC) + +set(${PROJECT_NAME}_SOURCES gui.cpp lists_functions.cpp mode12_listener.cpp @@ -16,14 +18,17 @@ set(REPEATER_SOURCES webgui/webutils.c webgui/wsfdata.c ) -add_executable(repeater) -foreach(file ${REPEATER_SOURCES}) - target_sources(repeater PRIVATE "${CMAKE_SOURCE_DIR}/../repeater/${file}") +add_executable(${PROJECT_NAME} WIN32) +foreach(file ${${PROJECT_NAME}_SOURCES}) + target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../repeater/${file}") endforeach(file) -target_sources(repeater PRIVATE "${CMAKE_SOURCE_DIR}/../repeater/resources.rc") +target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../repeater/resources.rc") set_source_files_properties(${CMAKE_SOURCE_DIR}/../repeater/resources.rc LANGUAGE RC) -set_source_files_properties(${CMAKE_SOURCE_DIR}/../repeater/resources.rc PROPERTIES COMPILE_FLAGS "-Ocoff") -target_link_libraries(repeater +target_link_libraries(${PROJECT_NAME} winmm ws2_32 ) +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc) +if (MSVC) + install(FILES $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/setcad/CMakeLists.txt b/cmake/setcad/CMakeLists.txt new file mode 100644 index 000000000..ca22d5049 --- /dev/null +++ b/cmake/setcad/CMakeLists.txt @@ -0,0 +1,21 @@ + +project(setcad LANGUAGES CXX RC) + +set(${PROJECT_NAME}_SOURCES + setcad.cpp + stdafx.cpp +) +add_executable(${PROJECT_NAME}) +foreach(file ${${PROJECT_NAME}_SOURCES}) + target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../setcad/setcad/${file}") +endforeach(file) +target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../setcad/setcad/setcad.rc") +set_source_files_properties(${CMAKE_SOURCE_DIR}/../setcad/setcad/setcad.rc LANGUAGE RC) +target_compile_definitions(${PROJECT_NAME} PRIVATE WIN32 NDEBUG _CONSOLE UNICODE=1 _UNICODE=1) +if (MINGW) + target_link_options(${PROJECT_NAME} PRIVATE "-municode") +endif() +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc) +if (MSVC) + install(FILES $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/setpasswd/CMakeLists.txt b/cmake/setpasswd/CMakeLists.txt new file mode 100644 index 000000000..384e2e8db --- /dev/null +++ b/cmake/setpasswd/CMakeLists.txt @@ -0,0 +1,19 @@ + +project(setpasswd LANGUAGES CXX RC) + +set(${PROJECT_NAME}_SOURCES + inifile.cpp + setpasswd.cpp + stdafx.cpp +) +add_executable(${PROJECT_NAME}) +foreach(file ${${PROJECT_NAME}_SOURCES}) + target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../setpasswd/setpasswd/${file}") +endforeach(file) +target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../setpasswd/setpasswd/setpasswd.rc") +set_source_files_properties(${CMAKE_SOURCE_DIR}/../setpasswd/setpasswd/setpasswd.rc LANGUAGE RC) +target_compile_definitions(${PROJECT_NAME} PRIVATE WIN32 NDEBUG _CONSOLE) +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc) +if (MSVC) + install(FILES $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/testauth/CMakeLists.txt b/cmake/testauth/CMakeLists.txt new file mode 100644 index 000000000..b92b34b39 --- /dev/null +++ b/cmake/testauth/CMakeLists.txt @@ -0,0 +1,14 @@ + +project(testauth LANGUAGES CXX RC) + +set(${PROJECT_NAME}_SOURCES + ntlogon.cpp +) +add_executable(${PROJECT_NAME}) +foreach(file ${${PROJECT_NAME}_SOURCES}) + target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/ms-logon/testauth/${file}") +endforeach(file) +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc) +if (MSVC) + install(FILES $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/uvnc_settings/CMakeLists.txt b/cmake/uvnc_settings/CMakeLists.txt index 26813d82c..e0c9154e4 100644 --- a/cmake/uvnc_settings/CMakeLists.txt +++ b/cmake/uvnc_settings/CMakeLists.txt @@ -1,5 +1,7 @@ -set(VNCVIEWER_SOURCES +project(uvnc_settings LANGUAGES CXX RC) + +set(${PROJECT_NAME}_SOURCES capture.cpp connections.cpp createsfx2.cpp @@ -20,20 +22,20 @@ set(VNCVIEWER_SOURCES vncOSVersion.cpp vncsetauth.cpp ) -add_executable(uvnc_settings) -target_include_directories(uvnc_settings PRIVATE "${CMAKE_SOURCE_DIR}/../DSMPlugin") -target_include_directories(uvnc_settings PRIVATE "${CMAKE_SOURCE_DIR}/../omnithread") -foreach(file ${VNCVIEWER_SOURCES}) - target_sources(uvnc_settings PRIVATE "${CMAKE_SOURCE_DIR}/../uvnc_settings/uvnc_settings/${file}") +add_executable(${PROJECT_NAME} WIN32) +target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../DSMPlugin") +target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../omnithread") +foreach(file ${${PROJECT_NAME}_SOURCES}) + target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../uvnc_settings/uvnc_settings/${file}") endforeach(file) -target_sources(uvnc_settings PRIVATE "${CMAKE_SOURCE_DIR}/../uvnc_settings/uvnc_settings/uvnc_settings.rc") +target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../uvnc_settings/uvnc_settings/uvnc_settings.rc") set_source_files_properties(${CMAKE_SOURCE_DIR}/../uvnc_settings/uvnc_settings/uvnc_settings.rc LANGUAGE RC) -set_source_files_properties(${CMAKE_SOURCE_DIR}/../uvnc_settings/uvnc_settings/uvnc_settings.rc PROPERTIES COMPILE_FLAGS "-Ocoff") -if( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" ) - target_compile_definitions(uvnc_settings PRIVATE _X64) -endif() -target_link_libraries(uvnc_settings +target_link_libraries(${PROJECT_NAME} libomnithread comctl32 version ) +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc) +if (MSVC) + install(FILES $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/uvnckeyboardhelper/CMakeLists.txt b/cmake/uvnckeyboardhelper/CMakeLists.txt new file mode 100644 index 000000000..f66da4aa6 --- /dev/null +++ b/cmake/uvnckeyboardhelper/CMakeLists.txt @@ -0,0 +1,16 @@ + +project(uvnckeyboardhelper LANGUAGES CXX RC) + +set(${PROJECT_NAME}_SOURCES + uvnckeyboardhelper.cpp +) +add_executable(${PROJECT_NAME} WIN32) +foreach(file ${${PROJECT_NAME}_SOURCES}) + target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../uvnckeyboardhelper/uvnckeyboardhelper/${file}") +endforeach(file) +target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../uvnckeyboardhelper/uvnckeyboardhelper/uvnckeyboardhelper.rc") +set_source_files_properties(${CMAKE_SOURCE_DIR}/../uvnckeyboardhelper/uvnckeyboardhelper/uvnckeyboardhelper.rc LANGUAGE RC) +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc) +if (MSVC) + install(FILES $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/vnchooks/CMakeLists.txt b/cmake/vnchooks/CMakeLists.txt new file mode 100644 index 000000000..5203ec83d --- /dev/null +++ b/cmake/vnchooks/CMakeLists.txt @@ -0,0 +1,18 @@ + +project(vnchooks LANGUAGES CXX RC) + +set(${PROJECT_NAME}_SOURCES + VNCHooks.cpp +) +add_library(${PROJECT_NAME} SHARED) +foreach(file ${${PROJECT_NAME}_SOURCES}) + target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../winvnc/vnchooks/${file}") +endforeach(file) +target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../winvnc/vnchooks/vnchooks.rc") +set_source_files_properties(${CMAKE_SOURCE_DIR}/../winvnc/vnchooks/vnchooks.rc LANGUAGE RC) +target_compile_definitions(${PROJECT_NAME} PRIVATE NDEBUG __WIN32__ WIN32 _WINDOWS _USRDLL VNCHOOKS_EXPORTS _WIN32_WINNT=0x400) +set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc) +if (MSVC) + install(FILES $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/vncviewer/CMakeLists.txt b/cmake/vncviewer/CMakeLists.txt index 042da554b..14c7c8c50 100644 --- a/cmake/vncviewer/CMakeLists.txt +++ b/cmake/vncviewer/CMakeLists.txt @@ -1,11 +1,13 @@ + project(vncviewer LANGUAGES C CXX RC) find_package(JPEG REQUIRED) find_package(libjpeg-turbo CONFIG REQUIRED) find_package(ZLIB REQUIRED) find_package(zstd CONFIG REQUIRED) +find_package(LibLZMA REQUIRED) -set(VNCVIEWER_SOURCES +set(${PROJECT_NAME}_SOURCES ../DSMPlugin/DSMPlugin.cpp ../ZipUnZip32/ZipUnzip32.cpp ../common/Clipboard.cpp @@ -47,7 +49,6 @@ set(VNCVIEWER_SOURCES Log.cpp LowLevelHook.cpp MRU.cpp - MessBox.cpp InfoBox.cpp SessionDialog.cpp SessionDialogTabs.cpp @@ -68,25 +69,21 @@ set(VNCVIEWER_SOURCES xz.cpp zrle.cpp ) -add_executable(vncviewer) -target_include_directories(vncviewer PRIVATE "${CMAKE_SOURCE_DIR}/..") -target_include_directories(vncviewer PRIVATE "${CMAKE_SOURCE_DIR}/../omnithread") -foreach(file ${VNCVIEWER_SOURCES}) - target_sources(vncviewer PRIVATE "${CMAKE_SOURCE_DIR}/../vncviewer/${file}") +add_executable(${PROJECT_NAME} WIN32) +target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/..") +target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../omnithread") +foreach(file ${${PROJECT_NAME}_SOURCES}) + target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../vncviewer/${file}") endforeach(file) -target_sources(vncviewer PRIVATE "${CMAKE_SOURCE_DIR}/../vncviewer/res/vncviewer.rc") +target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../vncviewer/res/vncviewer.rc") set_source_files_properties(${CMAKE_SOURCE_DIR}/../vncviewer/res/vncviewer.rc LANGUAGE RC) -set_source_files_properties(${CMAKE_SOURCE_DIR}/../vncviewer/res/vncviewer.rc PROPERTIES COMPILE_FLAGS "-Ocoff") -if( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" ) - target_compile_definitions(vncviewer PRIVATE _X64 _VIEWER _VCPKG) -else() - target_compile_definitions(vncviewer PRIVATE _VIEWER _VCPKG) -endif() -target_link_libraries(vncviewer +target_compile_definitions(${PROJECT_NAME} PRIVATE NDEBUG WIN32 _WINDOWS __NT__ _WINSTATIC __WIN32__ _VIEWER _XZ _CLOUD _VCPKG NOMINMAX) +target_link_libraries(${PROJECT_NAME} PRIVATE JPEG::JPEG PRIVATE $,libjpeg-turbo::turbojpeg,libjpeg-turbo::turbojpeg-static> PRIVATE ZLIB::ZLIB PRIVATE zstd::libzstd + PRIVATE LibLZMA::LibLZMA libomnithread librdr libudtcloud @@ -105,3 +102,7 @@ target_link_libraries(vncviewer winmm ws2_32 ) +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc) +if (MSVC) + install(FILES $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/winvnc/CMakeLists.txt b/cmake/winvnc/CMakeLists.txt index eaa845276..931c644cd 100644 --- a/cmake/winvnc/CMakeLists.txt +++ b/cmake/winvnc/CMakeLists.txt @@ -1,11 +1,13 @@ + project(winvnc LANGUAGES C CXX RC) find_package(JPEG REQUIRED) find_package(libjpeg-turbo CONFIG REQUIRED) find_package(ZLIB REQUIRED) find_package(zstd CONFIG REQUIRED) +find_package(LibLZMA REQUIRED) -set(WINVNC_SOURCES +set(${PROJECT_NAME}_SOURCES ../../DSMPlugin/DSMPlugin.cpp ../../ZipUnZip32/ZipUnzip32.cpp ../../common/Clipboard.cpp @@ -41,7 +43,6 @@ set(WINVNC_SOURCES rfbRegion_X11.cxx rfbRegion_win32.cpp rfbUpdateTracker.cpp - service.cpp stdhdrs.cpp translate.cpp uvncUiAccess.cpp @@ -88,31 +89,26 @@ set(WINVNC_SOURCES vsocket.cpp winvnc.cpp ) -add_executable(winvnc) -target_include_directories(winvnc PRIVATE "${CMAKE_SOURCE_DIR}/..") -target_include_directories(winvnc PRIVATE "${CMAKE_SOURCE_DIR}/../common") -target_include_directories(winvnc PRIVATE "${CMAKE_SOURCE_DIR}/../omnithread") -target_include_directories(winvnc PRIVATE "${CMAKE_SOURCE_DIR}/../winvnc") -foreach(file ${WINVNC_SOURCES}) - target_sources(winvnc PRIVATE "${CMAKE_SOURCE_DIR}/../winvnc/winvnc/${file}") +add_executable(${PROJECT_NAME} WIN32) +target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/..") +target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../common") +target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../omnithread") +target_include_directories(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../winvnc") +foreach(file ${${PROJECT_NAME}_SOURCES}) + target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../winvnc/winvnc/${file}") endforeach(file) -target_sources(winvnc PRIVATE "${CMAKE_SOURCE_DIR}/../winvnc/winvnc/winvnc.rc") +target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../winvnc/winvnc/winvnc.rc") set_source_files_properties(${CMAKE_SOURCE_DIR}/../winvnc/winvnc/winvnc.rc LANGUAGE RC) -set_source_files_properties(${CMAKE_SOURCE_DIR}/../winvnc/winvnc/winvnc.rc PROPERTIES COMPILE_FLAGS "-Ocoff") -if( ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" ) - target_compile_definitions(winvnc PRIVATE _X64 _WIN32_WINNT=0x601 _VCPKG) -else() - target_compile_definitions(winvnc PRIVATE _WIN32_WINNT=0x601 _VCPKG) -endif() -target_link_libraries(winvnc +target_compile_definitions(${PROJECT_NAME} PRIVATE NDEBUG __x86__ __WIN32__ WIN32 _WINDOWS XMD_H _WINSTATIC _RDPMODE _XZ _VCPKG) +target_link_libraries(${PROJECT_NAME} PRIVATE JPEG::JPEG PRIVATE $,libjpeg-turbo::turbojpeg,libjpeg-turbo::turbojpeg-static> PRIVATE ZLIB::ZLIB PRIVATE zstd::libzstd + PRIVATE LibLZMA::LibLZMA libomnithread librdr libudtcloud - libuvncsettings libzip32 libzipunzip comctl32 @@ -126,3 +122,7 @@ target_link_libraries(winvnc ws2_32 wtsapi32 ) +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc) +if (MSVC) + install(FILES $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif() diff --git a/cmake/workgrpdomnt4/CMakeLists.txt b/cmake/workgrpdomnt4/CMakeLists.txt new file mode 100644 index 000000000..4504762a6 --- /dev/null +++ b/cmake/workgrpdomnt4/CMakeLists.txt @@ -0,0 +1,21 @@ + +project(workgrpdomnt4 LANGUAGES CXX RC) + +set(${PROJECT_NAME}_SOURCES + workgrpdomnt4.cpp +) +add_library(${PROJECT_NAME} SHARED) +foreach(file ${${PROJECT_NAME}_SOURCES}) + target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/ms-logon/workgrpdomnt4/${file}") +endforeach(file) +target_sources(${PROJECT_NAME} PRIVATE "${CMAKE_SOURCE_DIR}/../addon/ms-logon/workgrpdomnt4/workgrpdomnt4.rc") +set_source_files_properties(${CMAKE_SOURCE_DIR}/../addon/ms-logon/workgrpdomnt4/workgrpdomnt4.rc LANGUAGE RC) +target_compile_definitions(${PROJECT_NAME} PRIVATE WIN32 NDEBUG _WINDOWS WORKGRPDOMNT4_EXPORTS) +if (MINGW) + target_link_options(${PROJECT_NAME} PRIVATE "-municode") +endif() +set_target_properties(${PROJECT_NAME} PROPERTIES PREFIX "") +install(TARGETS ${PROJECT_NAME} RUNTIME DESTINATION ${CMAKE_BINARY_DIR}/ultravnc) +if (MSVC) + install(FILES $ DESTINATION ${CMAKE_BINARY_DIR}/ultravnc OPTIONAL) +endif()