Skip to content

Commit

Permalink
fix: windows.h include (#832)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
phlptp and pre-commit-ci[bot] authored Jan 21, 2023
1 parent a227cd1 commit 3cd730b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 110 deletions.
2 changes: 0 additions & 2 deletions CLI11.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,6 @@

{macros_hpp}

{slim_windows_h_hpp}

{validators_hpp_filesystem}

{encoding_includes}
Expand Down
24 changes: 19 additions & 5 deletions include/CLI/impl/Argv_inl.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
101 changes: 0 additions & 101 deletions include/CLI/impl/SlimWindowsH.hpp

This file was deleted.

3 changes: 1 addition & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 3cd730b

Please sign in to comment.