diff --git a/CMakeLists.txt b/CMakeLists.txt index e2e72fed0..314be5f4b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -95,6 +95,23 @@ if(MSVC) SET(LIBRARY_OUTPUT_PATH ${PROJECT_BINARY_DIR}) endif() +# This forces the MSVC runtime to be statically linked + +if(MSVC) + foreach(flag_var CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO) + string(REGEX REPLACE "/MD" "/MT" ${flag_var} "${${flag_var}}") + string(REGEX REPLACE "/MDd" "/MTd" ${flag_var} "${${flag_var}}") + endforeach(flag_var) + set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG}" CACHE STRING "MSVC C Debug MT flags " FORCE) + set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG}" CACHE STRING "MSVC CXX Debug MT flags " FORCE) + set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}" CACHE STRING "MSVC C Release MT flags " FORCE) + set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE}" CACHE STRING "MSVC CXX Release MT flags " FORCE) + set(CMAKE_C_FLAGS_MINSIZEREL "${CMAKE_C_FLAGS_MINSIZEREL}" CACHE STRING "MSVC C Debug MT flags " FORCE) + set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL}" CACHE STRING "MSVC C Release MT flags " FORCE) + set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO}" CACHE STRING "MSVC CXX Debug MT flags " FORCE) + set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" CACHE STRING "MSVC CXX Release MT flags " FORCE) +endif() + # config.h definition for installable headers check_include_files(limits.h FREERDP_HAVE_LIMITS_H) check_include_files(stdint.h FREERDP_HAVE_STDINT_H) @@ -164,6 +181,7 @@ include_directories(${CMAKE_SOURCE_DIR}/include) # Configure files configure_file(${CMAKE_CURRENT_SOURCE_DIR}/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/config.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/winpr/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/winpr/config.h) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/include/freerdp/config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/freerdp/config.h) # Generate pkg-config diff --git a/cmake/ConfigOptions.cmake b/cmake/ConfigOptions.cmake index 2c4df7b35..ef7c0ad6b 100644 --- a/cmake/ConfigOptions.cmake +++ b/cmake/ConfigOptions.cmake @@ -10,6 +10,10 @@ if(APPLE) option(WITH_CLANG "Build using clang" OFF) endif() +if(MSVC) + option(WITH_NATIVE_SSPI "Use native SSPI modules" ON) +endif() + option(WITH_CLIENT "Build client binaries" ON) option(WITH_SERVER "Build server binaries" OFF) option(WITH_CHANNELS "Build virtual channel plugins" ON) diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt index fce03ec18..f592d95d9 100644 --- a/include/CMakeLists.txt +++ b/include/CMakeLists.txt @@ -18,7 +18,7 @@ # limitations under the License. file(GLOB HEADERS "freerdp/*.h") -install_files(/include/freerdp FILES ${HEADERS}) +install(FILES ${HEADERS} DESTINATION include/freerdp) install(DIRECTORY freerdp/utils DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h") install(DIRECTORY freerdp/channels DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h") @@ -33,4 +33,4 @@ install(DIRECTORY freerdp/auth DESTINATION include/freerdp FILES_MATCHING PATTER install(DIRECTORY freerdp/server DESTINATION include/freerdp FILES_MATCHING PATTERN "*.h") file(GLOB HEADERS "winpr/*.h") -install_files(/include/winpr FILES ${HEADERS}) +install(FILES ${HEADERS} DESTINATION include/winpr) diff --git a/include/winpr/config.h.in b/include/winpr/config.h.in new file mode 100644 index 000000000..5cd3bc731 --- /dev/null +++ b/include/winpr/config.h.in @@ -0,0 +1,32 @@ +/** + * WinPR: Windows Portable Runtime + * config.h definitions for installable headers + * + * Copyright 2012 Marc-Andre Moreau + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +#ifndef WINPR_CONFIG_H +#define WINPR_CONFIG_H + +/* + * This generated config.h header is meant for installation, which is why + * all definitions MUST be prefixed to avoid conflicting with third-party + * libraries. Only add configurable definitions which really must be used + * from installable headers, such as the base type definition types. + */ + +#cmakedefine WITH_NATIVE_SSPI + +#endif /* WINPR_CONFIG_H */ diff --git a/include/winpr/sspi.h b/include/winpr/sspi.h index e6d94af81..0c4bd9fb2 100644 --- a/include/winpr/sspi.h +++ b/include/winpr/sspi.h @@ -20,7 +20,7 @@ #ifndef WINPR_SSPI_H #define WINPR_SSPI_H -#include "config.h" +#include #include #include diff --git a/libfreerdp-core/timezone.c b/libfreerdp-core/timezone.c index 9a4c7d566..3fa484931 100644 --- a/libfreerdp-core/timezone.c +++ b/libfreerdp-core/timezone.c @@ -142,8 +142,12 @@ void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings) * Though MS-RDPBCGR specifies bias as unsigned, two's complement * (a negative integer) works fine for zones east of UTC. */ - if (clientTimeZone->bias <= 720) bias = -(clientTimeZone->bias); - else bias = 1440 - clientTimeZone->bias; + + if (clientTimeZone->bias <= 720) + bias = -1 * clientTimeZone->bias; + else + bias = 1440 - clientTimeZone->bias; + stream_write_uint32(s, bias); /* Bias */ /* standardName (64 bytes) */ @@ -155,10 +159,12 @@ void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings) bias, clientTimeZone->standardName, clientTimeZone->daylightName); sbias = clientTimeZone->standardBias - clientTimeZone->bias; + if (sbias < 0) bias2c = (uint32) sbias; else bias2c = ~((uint32) sbias) + 1; + /* Note that StandardBias is ignored if no valid standardDate is provided. */ stream_write_uint32(s, bias2c); /* StandardBias */ DEBUG_TIMEZONE("StandardBias=%d", bias2c); @@ -170,10 +176,12 @@ void rdp_write_client_time_zone(STREAM* s, rdpSettings* settings) rdp_write_system_time(s, &clientTimeZone->daylightDate); /* DaylightDate */ sbias = clientTimeZone->daylightBias - clientTimeZone->bias; + if (sbias < 0) bias2c = (uint32) sbias; else bias2c = ~((uint32) sbias) + 1; + /* Note that DaylightBias is ignored if no valid daylightDate is provided. */ stream_write_uint32(s, bias2c); /* DaylightBias */ DEBUG_TIMEZONE("DaylightBias=%d", bias2c);