Skip to content

Commit

Permalink
windows support
Browse files Browse the repository at this point in the history
  • Loading branch information
Dane Springmeyer committed May 22, 2014
1 parent 002ccdc commit 64f8fb4
Show file tree
Hide file tree
Showing 5 changed files with 90 additions and 33 deletions.
12 changes: 10 additions & 2 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,22 @@

platform:
- x64
- x86

configuration:
- Debug
- Release

install:
- SET PATH=c:\python27;%PATH%
- SET PATH=C:\Program Files (x86)\MSBuild\12.0\bin\;%PATH%
- git clone --depth 1 https://chromium.googlesource.com/external/gyp.git gyp
- git clone --quiet --depth 1 https://chromium.googlesource.com/external/gyp.git gyp
# note windows requires --generator-output to be absolute
- python gyp/gyp_main.py variant.gyp --depth=. -f msvs -G msvs_version=2013
- msbuild variant.sln /clp:Verbosity=minimal /nologo /p:Configuration=Release;Platform=x86
- set MSBUILD_PLATFORM=%platform%
- if "%MSBUILD_PLATFORM%" == "x86" set MSBUILD_PLATFORM=Win32
- msbuild variant.sln /clp:Verbosity=minimal /nologo /p:Configuration=%configuration%;Platform=%MSBUILD_PLATFORM%
- .\"%configuration%"\tests.exe

build: OFF

Expand Down
63 changes: 63 additions & 0 deletions common.gypi
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
{
"conditions": [
["OS=='win'", {
"target_defaults": {
"default_configuration": "Release_x64",
"msbuild_toolset%":"CTP_Nov2013",
"configurations": {
"Debug_Win32": {
"msvs_configuration_platform": "Win32",
"defines": [ "DEBUG"]
},
"Debug_x64": {
"msvs_configuration_platform": "x64",
"defines": [ "DEBUG"]
},
"Release_Win32": {
"msvs_configuration_platform": "Win32",
"defines": [ "DNEBUG"]
},
"Release_x64": {
"msvs_configuration_platform": "x64",
"defines": [ "DNEBUG"]
}
}
}
}, {
"target_defaults": {
"default_configuration": "Release",
"xcode_settings": {
"CLANG_CXX_LIBRARY": "libc++",
"CLANG_CXX_LANGUAGE_STANDARD":"c++11",
"GCC_VERSION": "com.apple.compilers.llvm.clang.1_0",
},
"cflags_cc": ["-std=c++11"],
"configurations": {
"Debug": {
"defines": [
"DEBUG"
],
"xcode_settings": {
"GCC_OPTIMIZATION_LEVEL": "0",
"GCC_GENERATE_DEBUGGING_SYMBOLS": "YES",
"OTHER_CPLUSPLUSFLAGS": [ "-Wall", "-Wextra", "-pedantic", "-g", "-O0" ]
}
},
"Release": {
"defines": [
"NDEBUG"
],
"xcode_settings": {
"GCC_OPTIMIZATION_LEVEL": "3",
"GCC_GENERATE_DEBUGGING_SYMBOLS": "NO",
"DEAD_CODE_STRIPPING": "YES",
"GCC_INLINES_ARE_PRIVATE_EXTERN": "YES",
"OTHER_CPLUSPLUSFLAGS": [ "-Wall", "-Wextra", "-pedantic", "-O3" ]
}
}
}
}
}]
]
}

4 changes: 1 addition & 3 deletions recursive_wrapper.hpp
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
#ifndef UTIL_VARIANT_RECURSIVE_WRAPPER_HPP
#define UTIL_VARIANT_RECURSIVE_WRAPPER_HPP

#include <boost/checked_delete.hpp>

namespace util {

template <typename T>
Expand Down Expand Up @@ -78,7 +76,7 @@ class recursive_wrapper
template <typename T>
recursive_wrapper<T>::~recursive_wrapper()
{
boost::checked_delete(p_);
delete p_;
}

template <typename T>
Expand Down
28 changes: 3 additions & 25 deletions variant.gyp
Original file line number Diff line number Diff line change
@@ -1,29 +1,7 @@
{
"target_defaults": {
"default_configuration": "Release",
"cflags_cc" : ["-std=c++11"],
"xcode_settings": {
"CLANG_CXX_LIBRARY": "libc++",
"CLANG_CXX_LANGUAGE_STANDARD":"c++11",
"GCC_VERSION": "com.apple.compilers.llvm.clang.1_0",
},
"configurations": {
"Debug": {
"cflags": [ "-g", "-O0" ],
"defines": [ "DEBUG" ],
"xcode_settings": {
"OTHER_CPLUSPLUSFLAGS": [ "-Wall", "-Wextra", "-pedantic", "-g", "-O0" ]
}
},
"Release": {
"cflags": [ "-O3" ],
"defines": [ "NDEBUG" ],
"xcode_settings": {
"OTHER_CPLUSPLUSFLAGS": [ "-Wall", "-Wextra", "-pedantic", "-O3" ]
}
}
}
},
"includes": [
"common.gypi"
],
"targets": [
{
"target_name": "tests",
Expand Down
16 changes: 13 additions & 3 deletions variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,20 @@
#include <iosfwd>

#include "recursive_wrapper.hpp"
#ifdef NDEBUG
#define VARIANT_INLINE inline __attribute__((always_inline))

#ifdef _MSC_VER
// http://msdn.microsoft.com/en-us/library/z8y1yy88.aspx
#ifdef NDEBUG
#define VARIANT_INLINE __forceinline
#else
#define VARIANT_INLINE __declspec(noinline)
#endif
#else
#define VARIANT_INLINE __attribute__((noinline))
#ifdef NDEBUG
#define VARIANT_INLINE inline __attribute__((always_inline))
#else
#define VARIANT_INLINE __attribute__((noinline))
#endif
#endif

#define VARIANT_MAJOR_VERSION 0
Expand Down

0 comments on commit 64f8fb4

Please sign in to comment.