Skip to content

Instantly share code, notes, and snippets.

#!/bin/env sh
buildifier
RETVAL=$?
if [ $RETVAL -ne 0 ]
then
exit 1
fi
## Bootstrapping
set VISUAL_STUDIO_VER=14
set CMAKE_GENERATOR="Visual Studio %VISUAL_STUDIO_VER% 2015 Win64"
set MSBUILD_VERSION=%VISUAL_STUDIO_VER%.0
rem Find msbuild path
for /f "usebackq skip=2 tokens=3*" %%A in (`reg.exe query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\MSBuild\ToolsVersions\%MSBUILD_VERSION%" /v "MSBuildToolsPath" `) do (
@abergmeier
abergmeier / gist:9913924
Created April 1, 2014 13:24
Build performance

i7: Building idtech4.5: real 3m10.353s user 19m45.920s sys 0m45.130s

@abergmeier
abergmeier / gist:9488990
Created March 11, 2014 16:08
pkgconfig for use with distutils.setup
def pkgconfig(*packages, **kw):
flag_map = {
'-I': 'include_dirs',
'-L': 'library_dirs',
'-l': 'libraries'}
env = os.environ.copy()
# possible narrowing of PkgConfig environment variables
for token in check_output(['pkg-config', '--libs', '--cflags', ' '.join(packages)], env=env).split():
@abergmeier
abergmeier / gist:9135888
Last active August 29, 2015 13:56
Extended equality operator for std::optional.
// TODO: Probably necessary to wrap U in decay.
template< class T, class U >
constexpr typename std::enable_if<!std::is_base_of<std::optional<T>, std::optional<U>>::value, bool>::type
operator==( const std::optional<T>& opt, U&& value ) {
return opt == static_cast<const U&>( value );
}
template< class T, class U >
constexpr typename std::enable_if<!std::is_base_of<std::optional<T>, std::optional<U>>::value, bool>::type
@abergmeier
abergmeier / future
Created February 3, 2014 12:35
N3784+
namespace std {
template< class T >
class continuator;
template< class T >
class shared_continuator;
template< class Type >
continuator async_cast(std::future<Type> fut) noexcept;
@abergmeier
abergmeier / gist:6778064
Last active September 27, 2020 08:46
Initial for hiding implementation.
#pragma once
#include <type_traits>
#include <cstddef>
#include <cassert>
#include <memory>
namespace ab {
template< typename T, std::size_t Bytes >
struct fits_in_storage : public std::integral_constant<bool, sizeof(typename std::aligned_storage<Bytes, 1>::type) >= sizeof(typename std::aligned_storage<sizeof(T), std::alignment_of<T>::value>::type)>