Skip to content

Instantly share code, notes, and snippets.

@melak47
melak47 / find_vc.cmake
Created May 1, 2023 12:49
automatic vsdevcmd cmake toolchain
find_program(CL cl REQUIRED)
find_program(AR lib REQUIRED)
find_program(MT mt REQUIRED)
find_program(RC rc REQUIRED)
set(LIB $ENV{LIB})
string(REPLACE "\\" "\\\\" LIB "${LIB}")
set(INCLUDE $ENV{INCLUDE})
string(REPLACE "\\" "\\\\" INCLUDE "${INCLUDE}")
#include <iostream>
#include <vector>
// FFmpeg
extern "C" {
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavutil/avutil.h>
#include <libavutil/pixdesc.h>
#include <libavutil/imgutils.h>
#include <libswscale/swscale.h>
@melak47
melak47 / type_name.cpp
Created June 14, 2019 12:56
Obtain type name as constexpr string
#include <string_view>
#include <stdexcept>
namespace detail {
template<typename T>
constexpr const char* type_name() {
#if defined(__GNUC__) || defined(__clang__)
return __PRETTY_FUNCTION__;
#elif defined(_MSC_VER)
return __FUNCSIG__;