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>
This commit is contained in:
Philip Top 2023-01-21 09:12:10 -08:00 committed by GitHub
parent a227cd10fc
commit 3cd730b18b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 110 deletions

View File

@ -40,8 +40,6 @@
{macros_hpp}
{slim_windows_h_hpp}
{validators_hpp_filesystem}
{encoding_includes}

View File

@ -19,14 +19,28 @@
#include <vector>
// [CLI11:public_includes:end]
#ifdef _WIN32
#include "SlimWindowsH.hpp"
#endif // _WIN32
// [CLI11:argv_inl_includes:verbatim]
#if defined(_WIN32)
#include <processenv.h>
#if !(defined(_AMD64_) || defined(_X86_) || defined(_ARM_))
#if defined(__amd64__) || defined(__amd64) || defined(__x86_64__) || defined(__x86_64) || defined(_M_X64) || \
defined(_M_AMD64)
#define _AMD64_
#elif defined(i386) || defined(__i386) || defined(__i386__) || defined(__i386__) || defined(_M_IX86)
#define _X86_
#elif defined(__arm__) || defined(_M_ARM) || defined(_M_ARMT)
#define _ARM_
#endif
#endif
#define NOMINMAX
// first
#include <windef.h>
// second
#include <winbase.h>
// third
#include <processthreadsapi.h>
#include <shellapi.h>
#undef NOMINMAX
#elif defined(__APPLE__)
#include <crt_externs.h>
#endif

View File

@ -1,101 +0,0 @@
// Copyright (c) 2017-2023, University of Cincinnati, developed by Henry Schreiner
// under NSF AWARD 1414736 and by the respective contributors.
// All rights reserved.
//
// SPDX-License-Identifier: BSD-3-Clause
#pragma once
// [CLI11:slim_windows_h_hpp:verbatim]
#ifdef _WIN32
// The most slimmed-down version of Windows.h.
#define WIN32_LEAN_AND_MEAN
#define WIN32_EXTRA_LEAN
// Enable components based on necessity.
#define NOGDICAPMASKS
#define NOVIRTUALKEYCODES
#define NOWINMESSAGES
#define NOWINSTYLES
#define NOSYSMETRICS
#define NOMENUS
#define NOICONS
#define NOKEYSTATES
#define NOSYSCOMMANDS
#define NORASTEROPS
#define NOSHOWWINDOW
#define OEMRESOURCE
#define NOATOM
#define NOCLIPBOARD
#define NOCOLOR
#define NOCTLMGR
#define NODRAWTEXT
#define NOGDI
#define NOKERNEL
#define NOUSER
#define NONLS
#define NOMB
#define NOMEMMGR
#define NOMETAFILE
#define NOMINMAX
#define NOMSG
#define NOOPENFILE
#define NOSCROLL
#define NOSERVICE
#define NOSOUND
#define NOTEXTMETRIC
#define NOWH
#define NOWINOFFSETS
#define NOCOMM
#define NOKANJI
#define NOHELP
#define NOPROFILER
#define NODEFERWINDOWPOS
#define NOMCX
#include "Windows.h"
#undef WIN32_LEAN_AND_MEAN
#undef WIN32_EXTRA_LEAN
#undef NOGDICAPMASKS
#undef NOVIRTUALKEYCODES
#undef NOWINMESSAGES
#undef NOWINSTYLES
#undef NOSYSMETRICS
#undef NOMENUS
#undef NOICONS
#undef NOKEYSTATES
#undef NOSYSCOMMANDS
#undef NORASTEROPS
#undef NOSHOWWINDOW
#undef OEMRESOURCE
#undef NOATOM
#undef NOCLIPBOARD
#undef NOCOLOR
#undef NOCTLMGR
#undef NODRAWTEXT
#undef NOGDI
#undef NOKERNEL
#undef NOUSER
#undef NONLS
#undef NOMB
#undef NOMEMMGR
#undef NOMETAFILE
#undef NOMINMAX
#undef NOMSG
#undef NOOPENFILE
#undef NOSCROLL
#undef NOSERVICE
#undef NOSOUND
#undef NOTEXTMETRIC
#undef NOWH
#undef NOWINOFFSETS
#undef NOCOMM
#undef NOKANJI
#undef NOHELP
#undef NOPROFILER
#undef NODEFERWINDOWPOS
#undef NOMCX
#endif // _WIN32
// [CLI11:slim_windows_h_hpp:end]

View File

@ -28,8 +28,7 @@ set(CLI11_impl_headers
${CLI11_implLoc}/StringTools_inl.hpp
${CLI11_implLoc}/Validators_inl.hpp
${CLI11_implLoc}/Encoding_inl.hpp
${CLI11_implLoc}/Argv_inl.hpp
${CLI11_implLoc}/SlimWindowsH.hpp)
${CLI11_implLoc}/Argv_inl.hpp)
set(CLI11_library_headers ${CLI11_headerLoc}/CLI.hpp ${CLI11_headerLoc}/Timer.hpp)