Skip to content

Instantly share code, notes, and snippets.

@tsaiid
Created January 28, 2015 06:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tsaiid/b9877f834c06657497ff to your computer and use it in GitHub Desktop.
Save tsaiid/b9877f834c06657497ff to your computer and use it in GitHub Desktop.
diff --git a/ext/CMakeLists.txt b/ext/CMakeLists.txt
index d7f0ca2..752a173 100644
--- a/ext/CMakeLists.txt
+++ b/ext/CMakeLists.txt
@@ -4,7 +4,7 @@
# This package is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# found in the file COPYING that should have accompanied this file.
-#
+#
# This package is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
@@ -56,16 +56,16 @@ set(cryptopp_src
# if 64-bit windows, compile asm file.
if (CMAKE_CL_64)
- list(APPEND cryptopp_src ${cryptopp_dir}/x64dll.asm ${cryptopp_dir}/x64masm.asm)
-
+ list(APPEND cryptopp_src $(IntDir)x64dll.obj $(IntDir)x64masm.obj)
+
add_custom_command(OUTPUT $(IntDir)x64dll.obj
- COMMAND ml64.exe /c /nologo /Fo$(IntDir)x64dll.obj /Zi
+ COMMAND ml64.exe /c /nologo /Fo$(IntDir)x64dll.obj /Zi
"${CMAKE_CURRENT_SOURCE_DIR}/${cryptopp_dir}/x64dll.asm"
MAIN_DEPENDENCY ${cryptopp_dir}/x64dll.asm
VERBATIM)
-
+
add_custom_command(OUTPUT $(IntDir)x64masm.obj
- COMMAND ml64.exe /c /nologo /Fo$(IntDir)x64masm.obj /Zi
+ COMMAND ml64.exe /c /nologo /Fo$(IntDir)x64masm.obj /Zi
"${CMAKE_CURRENT_SOURCE_DIR}/${cryptopp_dir}/x64masm.asm"
MAIN_DEPENDENCY ${cryptopp_dir}/x64masm.asm
VERBATIM)
@@ -74,7 +74,7 @@ endif()
if (UNIX)
add_definitions(-DCRYPTOPP_DISABLE_ASM)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O2 -pipe")
-
+
if (APPLE)
if (DARWIN_VERSION GREATER 10)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-tautological-compare")
diff --git a/ext/toolchain/commands1.py b/ext/toolchain/commands1.py
index d0b0960..6670caa 100644
--- a/ext/toolchain/commands1.py
+++ b/ext/toolchain/commands1.py
@@ -262,7 +262,11 @@ class InternalCommands:
3 : Generator('Visual Studio 9 2008'),
4 : Generator('Visual Studio 9 2008 Win64'),
5 : Generator('Visual Studio 8 2005'),
- 6 : Generator('Visual Studio 8 2005 Win64')
+ 6 : Generator('Visual Studio 8 2005 Win64'),
+ 7 : Generator('Visual Studio 11'),
+ 8 : Generator('Visual Studio 11 Win64'),
+ 9 : Generator('Visual Studio 12'),
+ 10 : Generator('Visual Studio 12 Win64'),
}
unix_generators = {
@@ -960,7 +964,9 @@ class InternalCommands:
if generator.startswith('Visual Studio'):
# special case for version 10, use new /target:clean
- if generator.startswith('Visual Studio 10'):
+ if generator.startswith('Visual Studio 10') or \
+ generator.startswith('Visual Studio 11') or \
+ generator.startswith('Visual Studio 12'):
for target in targets:
self.run_vcbuild(generator, target, self.sln_filepath(), '/target:clean')
@@ -1756,6 +1762,10 @@ class InternalCommands:
value,type = _winreg.QueryValueEx(key, '9.0')
elif generator.startswith('Visual Studio 10'):
value,type = _winreg.QueryValueEx(key, '10.0')
+ elif generator.startswith('Visual Studio 11'):
+ value,type = _winreg.QueryValueEx(key, '11.0')
+ elif generator.startswith('Visual Studio 12'):
+ value,type = _winreg.QueryValueEx(key, '12.0')
else:
raise Exception('Cannot determine vcvarsall.bat location for: ' + generator)
@@ -1770,6 +1780,24 @@ class InternalCommands:
return path
+ def get_msbuild(self):
+ import _winreg
+
+ msbuild = u""
+ for version in ('12.0', '4.0', '3.5', '2.0'):
+ key_name = r'SOFTWARE\Microsoft\MSBuild\ToolsVersions\%s' % version
+ try:
+ key = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, key_name)
+ value,type = _winreg.QueryValueEx(key, 'MSBuildToolsPath')
+ msbuild = os.path.join(value, u"MSBuild.exe")
+ if os.path.exists(msbuild):
+ return msbuild
+ except:
+ pass
+
+ raise Exception("MSBuild not found.")
+
+
def run_vcbuild(self, generator, mode, solution, args='', dir='', config32='Win32'):
import platform
@@ -1798,12 +1826,14 @@ class InternalCommands:
else:
config = 'Debug'
- if generator.startswith('Visual Studio 10'):
+ if generator.startswith('Visual Studio 10') or \
+ generator.startswith('Visual Studio 11') or \
+ generator.startswith('Visual Studio 12'):
cmd = ('@echo off\n'
'call "%s" %s \n'
'cd "%s"\n'
- 'msbuild /nologo %s /p:Configuration="%s" /p:Platform="%s" "%s"'
- ) % (self.get_vcvarsall(generator), vcvars_platform, dir, args, config, config_platform, solution)
+ '"%s" /nologo %s /p:Configuration="%s" /p:Platform="%s" "%s"'
+ ) % (self.get_vcvarsall(generator), vcvars_platform, dir, self.get_msbuild(), args, config, config_platform, solution)
else:
config = config + '|' + config_platform
cmd = ('@echo off\n'
diff --git a/src/lib/arch/win32/ArchNetworkWinsock.h b/src/lib/arch/win32/ArchNetworkWinsock.h
index 110b94e..80f5c6c 100644
--- a/src/lib/arch/win32/ArchNetworkWinsock.h
+++ b/src/lib/arch/win32/ArchNetworkWinsock.h
@@ -99,7 +99,7 @@ private:
void throwNameError(int);
private:
- typedef std::list<WSAEVENT> EventList;
+ typedef std::list<WSAEVENT*> EventList;
ArchMutex m_mutex;
EventList m_unblockEvents;
diff --git a/src/lib/arch/win32/ArchTaskBarWindows.cpp b/src/lib/arch/win32/ArchTaskBarWindows.cpp
index 021c022..fd00901 100644
--- a/src/lib/arch/win32/ArchTaskBarWindows.cpp
+++ b/src/lib/arch/win32/ArchTaskBarWindows.cpp
@@ -333,7 +333,17 @@ ArchTaskBarWindows::processDialogs(MSG* msg)
ARCH->lockMutex(m_mutex);
// remove removed dialogs
- m_dialogs.erase(false);
+ for (Dialogs::iterator index = m_dialogs.begin();
+ index != m_dialogs.end();) {
+ if (!index->second) {
+ Dialogs::iterator remove = index;
+ ++index;
+ m_dialogs.erase(remove);
+ }
+ else {
+ ++index;
+ }
+ }
// merge added dialogs into the dialog list
for (Dialogs::const_iterator index = m_addedDialogs.begin();
@@ -417,11 +427,11 @@ ArchTaskBarWindows::staticWndProc(HWND hwnd, UINT msg,
createInfo = reinterpret_cast<CREATESTRUCT*>(lParam);
self = reinterpret_cast<ArchTaskBarWindows*>(
createInfo->lpCreateParams);
- SetWindowLong(hwnd, 0, reinterpret_cast<LONG>(self));
+ SetWindowLongPtr(hwnd, 0, reinterpret_cast<LONG_PTR>(self));
}
else {
// get the extra window data and forward the call
- LONG data = GetWindowLong(hwnd, 0);
+ LONG_PTR data = GetWindowLongPtr(hwnd, 0);
if (data != 0) {
self = reinterpret_cast<ArchTaskBarWindows*>(
reinterpret_cast<void*>(data));
@@ -507,4 +517,4 @@ ArchTaskBarWindows::threadEntry(void* self)
HINSTANCE ArchTaskBarWindows::instanceWin32()
{
return ArchMiscWindows::instanceWin32();
-}
\ No newline at end of file
+}
diff --git a/src/lib/common/common.h b/src/lib/common/common.h
index 6ddf365..09a1e36 100644
--- a/src/lib/common/common.h
+++ b/src/lib/common/common.h
@@ -91,8 +91,11 @@
// VC++ specific
#if (_MSC_VER >= 1200)
- // work around for statement scoping bug
-# define for if (false) { } else for
+
+# if (_MSC_VER < 1300)
+ // work around for statement scoping bug
+# define for if (false) { } else for
+# endif
// turn off bonehead warnings
# pragma warning(disable: 4786) // identifier truncated in debug info
@@ -137,8 +140,12 @@
#include <stddef.h>
// if not c++0x, future proof code by allowing use of nullptr
-#ifndef nullptr
-# define nullptr NULL
+#if __cplusplus <= 199711L
+# if !defined(_MSC_VER) || (_MSC_VER < 1300)
+# ifndef nullptr
+# define nullptr NULL
+# endif
+# endif
#endif
// make assert available since we use it a lot
diff --git a/src/lib/platform/MSWindowsScreen.cpp b/src/lib/platform/MSWindowsScreen.cpp
index bcd960c..b78a817 100644
--- a/src/lib/platform/MSWindowsScreen.cpp
+++ b/src/lib/platform/MSWindowsScreen.cpp
@@ -43,7 +43,6 @@
#include "base/TMethodJob.h"
#include <string.h>
-#include <pbt.h>
#include <Shlobj.h>
#include <comutil.h>
#include <algorithm>
diff --git a/src/test/CMakeLists.txt b/src/test/CMakeLists.txt
index 140c069..1df2399 100644
--- a/src/test/CMakeLists.txt
+++ b/src/test/CMakeLists.txt
@@ -19,10 +19,14 @@ include_directories(
../../ext/gtest-1.6.0/include
../../ext/gmock-1.6.0
../../ext/gmock-1.6.0/include)
-
+
add_library(gtest STATIC ../../ext/gtest-1.6.0/src/gtest-all.cc)
add_library(gmock STATIC ../../ext/gmock-1.6.0/src/gmock-all.cc)
+if(MSVC11)
+ add_definitions(-D_VARIADIC_MAX=10)
+endif()
+
if (UNIX)
# ignore warnings in gtest and gmock
set_target_properties(gtest PROPERTIES COMPILE_FLAGS "-w")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment