Skip to content

Instantly share code, notes, and snippets.

View leha-bot's full-sized avatar
🐝
"Then" (c). I may be slow to respond, sorry about this.

Alex leha-bot

🐝
"Then" (c). I may be slow to respond, sorry about this.
View GitHub Profile

13 valuable things I learned using CMake

Author : Dua Guillaume
Date : 04-26-2020

Requirement : A first experience with CMake

Intro

As a modern C++ specialist, my job is to focus on software development, from a performance and quality perspective.

1>------ Сборка начата: проект: OpenAL, Конфигурация: Debug Win32 ------
1>Оптимизирующий компилятор Microsoft (R) C/C++ версии 19.16.27034 для x86
1>(C) Корпорация Майкрософт (Microsoft Corporation). Все права защищены.
1>
1>cl /c /I"D:\progs\utils\vcpkg\buildtrees\openal-soft\src\078ba947e7-94fd0db62c\include" /I"C:\Program Files (x86)\Windows Kits\10\Include\10.0.18362.0\um" /I"D:\progs\utils\vcpkg\buildtrees\openal-soft\x86-windows-dbg" /I"D:\progs\utils\vcpkg\buildtrees\openal-soft\src\078ba947e7-94fd0db62c" /I"D:\progs\utils\vcpkg\buildtrees\openal-soft\src\078ba947e7-94fd0db62c\alc" /I"D:\progs\utils\vcpkg\buildtrees\openal-soft\src\078ba947e7-94fd0db62c\common" /Z7 /W4 /WX- /diagnostics:classic /MP /Od /Ob0 /Oy- /D WIN32 /D _WINDOWS /D _DEBUG /D AL_BUILD_LIBRARY /D AL_ALEXT_PROTOTYPES /D _WIN32 /D _WIN32_WINNT=0x0502 /D _CRT_SECURE_NO_WARNINGS /D NOMINMAX /D "CMAKE_INTDIR=\"Debug\"" /D OpenAL_EXPORTS /D _WINDLL /D _MBCS /P /C /Gm- /EHsc /RTC1 /MDd /GS /arch:SSE2 /fp:precise /permissive- /Zc:wchar_t /
HMODULE hUser = GetModuleHandleA("user32.dll");
if (hUser)
{
pfnSetWindowCompositionAttribute setWindowCompositionAttribute = (pfnSetWindowCompositionAttribute)GetProcAddress(hUser, "SetWindowCompositionAttribute");
if (setWindowCompositionAttribute)
{
ACCENT_POLICY accent = { ACCENT_ENABLE_BLURBEHIND, 0, 0, 0 };
WINDOWCOMPOSITIONATTRIBDATA data;
data.Attrib = WCA_ACCENT_POLICY;
data.pvData = &accent;
class line_iterator_view {
const char *line_beg;
const char *line_end;
const char *current;
const char *current_eol;
// Передвигает наш итератор на след. позицию.
void advance_to_next_eol()
{
current_eol = strchr(current, '\n');
SYNTAXFILE* StackLoadSyntaxFile(STACKSYNTAXFILE *hStack, SYNTAXFILE *lpSyntaxFile)
{
HANDLE hFile;
DELIMITERINFO *lpDelimElement=NULL;
WORDINFO *lpWordElement=NULL;
QUOTEINFO *lpQuoteElement=NULL;
WILDCARDINFO *lpWildElement=NULL;
FOLDINFO *lpFoldInfo=NULL;
SKIPINFO *lpSkipInfo=NULL;
STACKVAR *lpVarStack;
@leha-bot
leha-bot / gist:396942f860f60b5f3565ea2441646dba
Created January 13, 2019 23:09 — forked from riverar/gist:fd6525579d6bbafc6e48
C# structures to implement "Aero Glass" blur on Windows 10
[DllImport("user32.dll")]
internal static extern int SetWindowCompositionAttribute(IntPtr hwnd, ref WindowCompositionAttributeData data);
[StructLayout(LayoutKind.Sequential)]
internal struct WindowCompositionAttributeData
{
public WindowCompositionAttribute Attribute;
public IntPtr Data;
public int SizeOfData;
}
// CaptureStackBackTrace
// http://msdn.microsoft.com/en-us/library/windows/desktop/bb204633(v=vs.85).aspx
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
//////////////////////////////////////////////////////////////
void capture() {
const ULONG framesToSkip = 0;
const ULONG framesToCapture = 64;
class utf8_text_view {
const char *text;
size_t bytes_count;
public:
friend class iterator;
class iterator {
const utf8_text_view &parent;
size_t offset;
public:
#include <iostream>
#include <stdio.h> // snprintf
#include <windows.h>
/// @example Termux Battery Info JSON Format
/// health - "COLD" | "DEAD" | "GOOD" | "OVERHEAT" | "OVER_VOLTAGE" |
/// "UNKNOWN" | "UNSPECIFIED_FAILURE" | integer
/// percentage - integer
/// plugged - "UNPLUGGED" | "PLUGGED_AC" | "PLUGGED_USB" |
/// "PLUGGED_WIRELESS" | "PLUGGED_".integer
@leha-bot
leha-bot / test.sh
Created April 6, 2018 07:53 — forked from arq5x/test.sh
Compress and then Decompress a string with zlib.
# compile
$ g++ zlib-example.cpp -lz -o zlib-example
# run
$ ./zlib-example
Uncompressed size is: 36
Uncompressed string is: Hello Hello Hello Hello Hello Hello!
----------