winpr: get rid of config.h include in installable headers
authorMarc-André Moreau <marcandre.moreau@gmail.com>
Mon, 13 Aug 2012 00:43:24 +0000 (20:43 -0400)
committerMarc-André Moreau <marcandre.moreau@gmail.com>
Mon, 13 Aug 2012 00:43:24 +0000 (20:43 -0400)
CMakeLists.txt
cmake/ConfigOptions.cmake
include/CMakeLists.txt
include/winpr/config.h.in [new file with mode: 0644]
include/winpr/sspi.h
libfreerdp-core/timezone.c

index e2e72fe..314be5f 100644 (file)
@@ -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
index 2c4df7b..ef7c0ad 100644 (file)
@@ -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)
index fce03ec..f592d95 100644 (file)
@@ -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 (file)
index 0000000..5cd3bc7
--- /dev/null
@@ -0,0 +1,32 @@
+/**
+ * WinPR: Windows Portable Runtime
+ * config.h definitions for installable headers
+ *
+ * Copyright 2012 Marc-Andre Moreau <marcandre.moreau@gmail.com>
+ *
+ * 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 */
index e6d94af..0c4bd9f 100644 (file)
@@ -20,7 +20,7 @@
 #ifndef WINPR_SSPI_H
 #define WINPR_SSPI_H
 
-#include "config.h"
+#include <winpr/config.h>
 
 #include <wchar.h>
 #include <winpr/winpr.h>
index 9a4c7d5..3fa4849 100644 (file)
@@ -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);