Skip to content

Commit

Permalink
Fix warnings in tools for MinGW (#428)
Browse files Browse the repository at this point in the history
  • Loading branch information
JPeterMugaas authored Dec 30, 2023
1 parent 187f6d6 commit a3d032b
Show file tree
Hide file tree
Showing 8 changed files with 53 additions and 6 deletions.
21 changes: 15 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -370,17 +370,20 @@ install(FILES "${CMAKE_CURRENT_BINARY_DIR}/DirectXTex.pc"
DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)

#--- Command-line tools
if(BUILD_TOOLS AND BUILD_DX11 AND WIN32)
set(TOOL_EXES texassemble texconv texdiag)
set(TOOL_EXES "")

if(BUILD_TOOLS AND WIN32)
add_executable(texassemble
Texassemble/texassemble.cpp
Texassemble/texassemble.rc
Texassemble/settings.manifest
Texassemble/AnimatedGif.cpp)
target_link_libraries(texassemble PRIVATE ${PROJECT_NAME} ole32.lib version.lib)
source_group(texassemble REGULAR_EXPRESSION Texassemble/*.*)
list(APPEND TOOL_EXES texassemble)
endif()

if(BUILD_TOOLS AND BUILD_DX11 AND WIN32)
add_executable(texconv
Texconv/texconv.cpp
Texconv/texconv.rc
Expand All @@ -389,18 +392,24 @@ if(BUILD_TOOLS AND BUILD_DX11 AND WIN32)
Texconv/PortablePixMap.cpp)
target_link_libraries(texconv PRIVATE ${PROJECT_NAME} ole32.lib shell32.lib version.lib)
source_group(texconv REGULAR_EXPRESSION Texconv/*.*)
list(APPEND TOOL_EXES texconv)

if(BC_USE_OPENMP)
target_link_libraries(texconv PRIVATE OpenMP::OpenMP_CXX)
endif()
endif()

if(BUILD_TOOLS AND WIN32)
add_executable(texdiag
Texdiag/texdiag.cpp
Texdiag/texdiag.rc
Texdiag/settings.manifest)
target_link_libraries(texdiag PRIVATE ${PROJECT_NAME} ole32.lib version.lib)
source_group(texdiag REGULAR_EXPRESSION Texdiag/*.*)
list(APPEND TOOL_EXES texdiag)
endif()

if(BC_USE_OPENMP)
target_link_libraries(texconv PRIVATE OpenMP::OpenMP_CXX)
endif()

if(BUILD_TOOLS AND WIN32)
if(ENABLE_OPENEXR_SUPPORT)
foreach(t IN LISTS TOOL_EXES)
target_include_directories(${t} PRIVATE Auxiliary)
Expand Down
4 changes: 4 additions & 0 deletions DirectXTex/DirectXTex.h
Original file line number Diff line number Diff line change
Expand Up @@ -1011,12 +1011,16 @@ namespace DirectX
#pragma clang diagnostic ignored "-Wswitch-enum"
#endif

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4619 4616 4061)
#endif

#include "DirectXTex.inl"

#ifdef _MSC_VER
#pragma warning(pop)
#endif

#ifdef __clang__
#pragma clang diagnostic pop
Expand Down
6 changes: 6 additions & 0 deletions Texassemble/AnimatedGif.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@
// http://go.microsoft.com/fwlink/?LinkId=248926
//--------------------------------------------------------------------------------------

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4005)
#endif
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#define NODRAWTEXT
#define NOGDI
#define NOMCX
#define NOSERVICE
#define NOHELP
#ifdef _MSC_VER
#pragma warning(pop)
#endif

#include <cstddef>
#include <iterator>
Expand All @@ -35,7 +39,9 @@

#include <wincodec.h>

#ifdef _MSC_VER
#pragma warning(disable : 4619 4616 26812)
#endif

#include "DirectXTex.h"

Expand Down
6 changes: 6 additions & 0 deletions Texassemble/texassemble.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@
// http://go.microsoft.com/fwlink/?LinkId=248926
//--------------------------------------------------------------------------------------

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4005)
#endif
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#define NODRAWTEXT
#define NOGDI
#define NOMCX
#define NOSERVICE
#define NOHELP
#ifdef _MSC_VER
#pragma warning(pop)
#endif

#if __cplusplus < 201703L
#error Requires C++17 (and /Zc:__cplusplus with MSVC)
Expand Down Expand Up @@ -52,7 +56,9 @@
#include <DirectXPackedVector.h>
#include <wincodec.h>

#ifdef _MSC_VER
#pragma warning(disable : 4619 4616 26812)
#endif

#include "DirectXTex.h"

Expand Down
4 changes: 4 additions & 0 deletions Texconv/ExtendedBMP.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@
// http://go.microsoft.com/fwlink/?LinkId=248926
//--------------------------------------------------------------------------------------

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4005)
#endif
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#define NODRAWTEXT
#define NOMCX
#define NOSERVICE
#define NOHELP
#ifdef _MSC_VER
#pragma warning(pop)
#endif

#include <Windows.h>

Expand Down
4 changes: 4 additions & 0 deletions Texconv/PortablePixMap.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@
// http://go.microsoft.com/fwlink/?LinkId=248926
//--------------------------------------------------------------------------------------

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4005)
#endif
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#define NODRAWTEXT
#define NOMCX
#define NOSERVICE
#define NOHELP
#ifdef _MSC_VER
#pragma warning(pop)
#endif

#include <Windows.h>

Expand Down
8 changes: 8 additions & 0 deletions Texconv/texconv.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,19 @@
// http://go.microsoft.com/fwlink/?LinkId=248926
//--------------------------------------------------------------------------------------

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4005)
#endif
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#define NODRAWTEXT
#define NOMCX
#define NOSERVICE
#define NOHELP
#ifdef _MSC_VER
#pragma warning(pop)
#endif

#include <ShlObj.h>

Expand Down Expand Up @@ -52,7 +56,9 @@

#include <wincodec.h>

#ifdef _MSC_VER
#pragma warning(disable : 4619 4616 26812)
#endif

#include "DirectXTex.h"

Expand Down Expand Up @@ -525,7 +531,9 @@ HRESULT __cdecl SaveToPortablePixMapHDR(
//////////////////////////////////////////////////////////////////////////////
//////////////////////////////////////////////////////////////////////////////

#ifdef _MSC_VER
#pragma warning( disable : 4616 6211 )
#endif

namespace
{
Expand Down
6 changes: 6 additions & 0 deletions Texdiag/texdiag.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,20 @@
// http://go.microsoft.com/fwlink/?LinkId=248926
//--------------------------------------------------------------------------------------

#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4005)
#endif
#define WIN32_LEAN_AND_MEAN
#define NOMINMAX
#define NODRAWTEXT
#define NOGDI
#define NOMCX
#define NOSERVICE
#define NOHELP
#ifdef _MSC_VER
#pragma warning(pop)
#endif

#if __cplusplus < 201703L
#error Requires C++17 (and /Zc:__cplusplus with MSVC)
Expand Down Expand Up @@ -46,7 +50,9 @@

#include <dxgiformat.h>

#ifdef _MSC_VER
#pragma warning(disable : 4619 4616 26812)
#endif

#include "DirectXTex.h"

Expand Down

0 comments on commit a3d032b

Please sign in to comment.