Commit 3cd730b18b563fdd48cd95dfb0174551aa18c3b3
Committed by
GitHub
1 parent
a227cd10
fix: windows.h include (#832)
* remove the windows.h includes so it doesn't conflict with other windows applications. Or at least minimizes the potential conflicts * style: pre-commit.ci fixes * fix ordering of windows includes * style: pre-commit.ci fixes Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Showing
4 changed files
with
20 additions
and
110 deletions
CLI11.hpp.in
include/CLI/impl/Argv_inl.hpp
| ... | ... | @@ -19,14 +19,28 @@ |
| 19 | 19 | #include <vector> |
| 20 | 20 | // [CLI11:public_includes:end] |
| 21 | 21 | |
| 22 | -#ifdef _WIN32 | |
| 23 | -#include "SlimWindowsH.hpp" | |
| 24 | -#endif // _WIN32 | |
| 25 | - | |
| 26 | 22 | // [CLI11:argv_inl_includes:verbatim] |
| 27 | 23 | #if defined(_WIN32) |
| 28 | -#include <processenv.h> | |
| 24 | +#if !(defined(_AMD64_) || defined(_X86_) || defined(_ARM_)) | |
| 25 | +#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || \ | |
| 26 | + defined(_M_AMD64) | |
| 27 | +#define _AMD64_ | |
| 28 | +#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(__i386__) || defined(_M_IX86) | |
| 29 | +#define _X86_ | |
| 30 | +#elif defined(__arm__) || defined(_M_ARM) || defined(_M_ARMT) | |
| 31 | +#define _ARM_ | |
| 32 | +#endif | |
| 33 | +#endif | |
| 34 | +#define NOMINMAX | |
| 35 | +// first | |
| 36 | +#include <windef.h> | |
| 37 | +// second | |
| 38 | +#include <winbase.h> | |
| 39 | +// third | |
| 40 | +#include <processthreadsapi.h> | |
| 29 | 41 | #include <shellapi.h> |
| 42 | + | |
| 43 | +#undef NOMINMAX | |
| 30 | 44 | #elif defined(__APPLE__) |
| 31 | 45 | #include <crt_externs.h> |
| 32 | 46 | #endif | ... | ... |
include/CLI/impl/SlimWindowsH.hpp deleted
| 1 | -// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner | |
| 2 | -// under NSF AWARD 1414736 and by the respective contributors. | |
| 3 | -// All rights reserved. | |
| 4 | -// | |
| 5 | -// SPDX-License-Identifier: BSD-3-Clause | |
| 6 | - | |
| 7 | -#pragma once | |
| 8 | -// [CLI11:slim_windows_h_hpp:verbatim] | |
| 9 | -#ifdef _WIN32 | |
| 10 | -// The most slimmed-down version of Windows.h. | |
| 11 | -#define WIN32_LEAN_AND_MEAN | |
| 12 | -#define WIN32_EXTRA_LEAN | |
| 13 | - | |
| 14 | -// Enable components based on necessity. | |
| 15 | -#define NOGDICAPMASKS | |
| 16 | -#define NOVIRTUALKEYCODES | |
| 17 | -#define NOWINMESSAGES | |
| 18 | -#define NOWINSTYLES | |
| 19 | -#define NOSYSMETRICS | |
| 20 | -#define NOMENUS | |
| 21 | -#define NOICONS | |
| 22 | -#define NOKEYSTATES | |
| 23 | -#define NOSYSCOMMANDS | |
| 24 | -#define NORASTEROPS | |
| 25 | -#define NOSHOWWINDOW | |
| 26 | -#define OEMRESOURCE | |
| 27 | -#define NOATOM | |
| 28 | -#define NOCLIPBOARD | |
| 29 | -#define NOCOLOR | |
| 30 | -#define NOCTLMGR | |
| 31 | -#define NODRAWTEXT | |
| 32 | -#define NOGDI | |
| 33 | -#define NOKERNEL | |
| 34 | -#define NOUSER | |
| 35 | -#define NONLS | |
| 36 | -#define NOMB | |
| 37 | -#define NOMEMMGR | |
| 38 | -#define NOMETAFILE | |
| 39 | -#define NOMINMAX | |
| 40 | -#define NOMSG | |
| 41 | -#define NOOPENFILE | |
| 42 | -#define NOSCROLL | |
| 43 | -#define NOSERVICE | |
| 44 | -#define NOSOUND | |
| 45 | -#define NOTEXTMETRIC | |
| 46 | -#define NOWH | |
| 47 | -#define NOWINOFFSETS | |
| 48 | -#define NOCOMM | |
| 49 | -#define NOKANJI | |
| 50 | -#define NOHELP | |
| 51 | -#define NOPROFILER | |
| 52 | -#define NODEFERWINDOWPOS | |
| 53 | -#define NOMCX | |
| 54 | - | |
| 55 | -#include "Windows.h" | |
| 56 | - | |
| 57 | -#undef WIN32_LEAN_AND_MEAN | |
| 58 | -#undef WIN32_EXTRA_LEAN | |
| 59 | - | |
| 60 | -#undef NOGDICAPMASKS | |
| 61 | -#undef NOVIRTUALKEYCODES | |
| 62 | -#undef NOWINMESSAGES | |
| 63 | -#undef NOWINSTYLES | |
| 64 | -#undef NOSYSMETRICS | |
| 65 | -#undef NOMENUS | |
| 66 | -#undef NOICONS | |
| 67 | -#undef NOKEYSTATES | |
| 68 | -#undef NOSYSCOMMANDS | |
| 69 | -#undef NORASTEROPS | |
| 70 | -#undef NOSHOWWINDOW | |
| 71 | -#undef OEMRESOURCE | |
| 72 | -#undef NOATOM | |
| 73 | -#undef NOCLIPBOARD | |
| 74 | -#undef NOCOLOR | |
| 75 | -#undef NOCTLMGR | |
| 76 | -#undef NODRAWTEXT | |
| 77 | -#undef NOGDI | |
| 78 | -#undef NOKERNEL | |
| 79 | -#undef NOUSER | |
| 80 | -#undef NONLS | |
| 81 | -#undef NOMB | |
| 82 | -#undef NOMEMMGR | |
| 83 | -#undef NOMETAFILE | |
| 84 | -#undef NOMINMAX | |
| 85 | -#undef NOMSG | |
| 86 | -#undef NOOPENFILE | |
| 87 | -#undef NOSCROLL | |
| 88 | -#undef NOSERVICE | |
| 89 | -#undef NOSOUND | |
| 90 | -#undef NOTEXTMETRIC | |
| 91 | -#undef NOWH | |
| 92 | -#undef NOWINOFFSETS | |
| 93 | -#undef NOCOMM | |
| 94 | -#undef NOKANJI | |
| 95 | -#undef NOHELP | |
| 96 | -#undef NOPROFILER | |
| 97 | -#undef NODEFERWINDOWPOS | |
| 98 | -#undef NOMCX | |
| 99 | - | |
| 100 | -#endif // _WIN32 | |
| 101 | -// [CLI11:slim_windows_h_hpp:end] |
src/CMakeLists.txt
| ... | ... | @@ -28,8 +28,7 @@ set(CLI11_impl_headers |
| 28 | 28 | ${CLI11_implLoc}/StringTools_inl.hpp |
| 29 | 29 | ${CLI11_implLoc}/Validators_inl.hpp |
| 30 | 30 | ${CLI11_implLoc}/Encoding_inl.hpp |
| 31 | - ${CLI11_implLoc}/Argv_inl.hpp | |
| 32 | - ${CLI11_implLoc}/SlimWindowsH.hpp) | |
| 31 | + ${CLI11_implLoc}/Argv_inl.hpp) | |
| 33 | 32 | |
| 34 | 33 | set(CLI11_library_headers ${CLI11_headerLoc}/CLI.hpp ${CLI11_headerLoc}/Timer.hpp) |
| 35 | 34 | ... | ... |