All Projects → ruslo → Leathers

ruslo / Leathers

Licence: bsd-2-clause
🚀 Warning suppression library (C++)

Labels

Projects that are alternatives of or similar to Leathers

Kaidan
[Replaced by https://invent.kde.org/network/kaidan] Kaidan, a simple and user-friendly Jabber/XMPP client for every device and platform.
Stars: ✭ 67 (-14.1%)
Mutual labels:  cmake
Hacktoberfest2020
Contribute for hacktoberfest 2020
Stars: ✭ 72 (-7.69%)
Mutual labels:  cmake
Cmake.vim
🔨 CMake functionality within Vim.
Stars: ✭ 76 (-2.56%)
Mutual labels:  cmake
Hazelcast Cpp Client
Hazelcast IMDG C++ Client
Stars: ✭ 67 (-14.1%)
Mutual labels:  cmake
Magnum Bootstrap
Bootstrap projects for Magnum C++11/C++14 graphics engine
Stars: ✭ 69 (-11.54%)
Mutual labels:  cmake
Gpu Icp Slam
Stars: ✭ 73 (-6.41%)
Mutual labels:  cmake
Vs.language.cmake
Syntax highlighting for Cmake in Visual Studio Code
Stars: ✭ 64 (-17.95%)
Mutual labels:  cmake
Cotire
CMake module to speed up builds.
Stars: ✭ 1,212 (+1453.85%)
Mutual labels:  cmake
Ncnn Benchmark
The benchmark of ncnn that is a high-performance neural network inference framework optimized for the mobile platform
Stars: ✭ 70 (-10.26%)
Mutual labels:  cmake
Openssl Cmake
Build OpenSSL with CMake on MacOS, Win32, Win64 and cross compile for Android, IOS
Stars: ✭ 76 (-2.56%)
Mutual labels:  cmake
Nitroshare Desktop
Network file transfer application for Windows, OS X, & Linux
Stars: ✭ 1,150 (+1374.36%)
Mutual labels:  cmake
Didi challenge ros
Roslaunch to visualize a rosbag file from Udacity (DiDi Challenge)
Stars: ✭ 69 (-11.54%)
Mutual labels:  cmake
Fcnpc
FCNPC - Fully Controllable NPC
Stars: ✭ 73 (-6.41%)
Mutual labels:  cmake
Spirit
Atomistic Spin Simulation Framework
Stars: ✭ 67 (-14.1%)
Mutual labels:  cmake
Helloworld
A C++ Hello World project, using CMake, and GitHub Actions
Stars: ✭ 77 (-1.28%)
Mutual labels:  cmake
Magnum Plugins
Plugins for the Magnum C++11/C++14 graphics engine
Stars: ✭ 66 (-15.38%)
Mutual labels:  cmake
Burst
То, чего нет в Бусте
Stars: ✭ 72 (-7.69%)
Mutual labels:  cmake
Hpp Skel
Skeleton for C++ header-only libraries
Stars: ✭ 78 (+0%)
Mutual labels:  cmake
Findtbb
CMake find module for Intel Threading Building Blocks
Stars: ✭ 77 (-1.28%)
Mutual labels:  cmake
Cmake Modules
CMake modules for some scientific libraries
Stars: ✭ 75 (-3.85%)
Mutual labels:  cmake

leathers

This C++ header only library helps to save some space while ignoring compiler warnings by pragma pop/push mechanism.

Example

Some mix-compiler code:

#if defined(BOOST_MSVC)
# pragma warning(push)
# pragma warning(disable : 4511 4512)
#elif defined(BOOST_CLANG)
# pragma clang diagnostic push
# pragma clang diagnostic ignored "-Wexit-time-destructors"
#endif
// some code
#if defined(BOOST_MSVC)
# pragma warning(pop)
#elif defined(BOOST_CLANG)
# pragma clang diagnostic pop
#endif

12 lines of code for 2 compilers to ignore warning in 1 line.

Using this library:

#include <leathers/push>
#include <leathers/exit-time-destructors>
// some code
#include <leathers/pop>

3 lines of code for any number of compilers to ignore warning in 1 line.

Example (all)

Suppressing warnings in third party libraries:

#include <leathers/push>
#include <leathers/all>
# include <third_party/library1/headerA>
# include <third_party/library2/headerB>
#include <leathers/pop>

Usage (manual install)

  • Install boost (predef library)
  • Add Source directory to compiler include option: -I${LEATHERS_ROOT}/Source
> cat foo.cpp
#include <cstdio> // std::printf

int main() {
  const char* fmt = "%d";

#include <leathers/push>
#include <leathers/format>
  std::printf(fmt, 1);
#include <leathers/pop>
}
> clang++ -I${BOOST_ROOT}/include -I${LEATHERS_ROOT}/Source -Weverything foo.cpp

Usage (CMake, hunter package manager)

Leathers can be installed using hunter package manager:

> cat CMakeLists.txt
cmake_minimum_required(VERSION 3.0)
project(Foo)

include(HunterGate.cmake)
hunter_add_package(Leathers)

find_package(Leathers CONFIG REQUIRED)

set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything -Werror")

add_executable(foo foo.cpp)
target_link_libraries(foo leathers)
> cat foo.cpp
#include <cstdio> // std::printf

int main() {
  const char* fmt = "%d";

#include <leathers/push>
#include <leathers/format>
  std::printf(fmt, 1);
#include <leathers/pop>
}
> cmake -H. -B_builds -DHUNTER_STATUS_DEBUG=ON
> cmake --build _builds

Note that boost installed automatically

CMake (companion function to generate warning flags)

This function can be used to generate cross-platform target flags and properties:

> cat CMakeLists.txt
cmake_minimum_required(VERSION 3.0)
project(Foo)

include(HunterGate.cmake)
hunter_add_package(Leathers)
hunter_add_package(Sugar)

find_package(Leathers CONFIG REQUIRED)
include(${SUGAR_ROOT}/cmake/Sugar)
include(sugar_generate_warning_flags)

sugar_generate_warning_flags(
    flags properties ENABLE ALL TREAT_AS_ERROR ALL CLEAR_GLOBAL
)

add_executable(foo foo.cpp)
target_link_libraries(foo leathers)

set_target_properties(
    foo PROPERTIES ${properties} COMPILE_OPTIONS "${flags}"
)
> cat foo.cpp
#include <cstdio> // std::printf

int main() {
  const char* fmt = "%d";

#include <leathers/push>
#include <leathers/format>
  std::printf(fmt, 1);
#include <leathers/pop>
}
> cmake -H. -B_builds -DHUNTER_STATUS_DEBUG=ON
> cmake --build _builds

Wiki

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].