From a5d661e303de3dcbd7a39bee0f554a63738cf1fd Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 9 Apr 2024 11:03:12 +0200 Subject: [PATCH 01/18] Update ccpp.yml - Add windows clang build step - Help to evaluate https://github.com/assimp/assimp/issues/5519 --- .github/workflows/ccpp.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index db152b813..e7edddc74 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -19,6 +19,10 @@ jobs: name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, ubuntu-latest-clang++] # For Windows msvc, for Linux and macOS let's use the clang compiler, use gcc for Linux. include: + - name: windows-latest-clang.exe + os: windows-latest + cxx: clang++.exe + cc: clang.exe - name: windows-latest-cl.exe os: windows-latest cxx: cl.exe From af31856221cc568cea6a6699382223971892f3cf Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 9 Apr 2024 11:14:55 +0200 Subject: [PATCH 02/18] Update ccpp.yml - Build the viewer onl< with msvc --- .github/workflows/ccpp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index e7edddc74..88670d21c 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -66,13 +66,13 @@ jobs: ${{ runner.os }}-DX_SDK - name: Download DXSetup - if: contains(matrix.name, 'windows') && steps.dxcache.outputs.cache-hit != 'true' + if: contains(matrix.name, 'windows-latest-cl') && steps.dxcache.outputs.cache-hit != 'true' run: | curl -s -o DXSDK_Jun10.exe --location https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe cmd.exe /c start /wait .\DXSDK_Jun10.exe /U /O /F /S /P "${{ github.workspace }}\DX_SDK" - name: Set Windows specific CMake arguments - if: contains(matrix.name, 'windows') + if: contains(matrix.name, 'windows-latest-cl') id: windows_extra_cmake_args run: echo "::set-output name=args::-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1 -DASSIMP_BUILD_ZLIB=1" From b2437e5b591784c0388a03357a8cd8e5590a9659 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 9 Apr 2024 13:06:26 +0200 Subject: [PATCH 03/18] Update ccpp.yml --- .github/workflows/ccpp.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index 88670d21c..aea7d122a 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -16,7 +16,7 @@ jobs: strategy: fail-fast: false matrix: - name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, ubuntu-latest-clang++] + name: [ubuntu-latest-g++, macos-latest-clang++, windows-latest-cl.exe, windows-latest-clang.exe, ubuntu-latest-clang++] # For Windows msvc, for Linux and macOS let's use the clang compiler, use gcc for Linux. include: - name: windows-latest-clang.exe From efc046752c44c26e36631541dc0b0db5eceb25f0 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 9 Apr 2024 14:56:23 +0200 Subject: [PATCH 04/18] Update ccpp.yml: Fix the filter --- .github/workflows/ccpp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index aea7d122a..603d5e8b8 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -66,13 +66,13 @@ jobs: ${{ runner.os }}-DX_SDK - name: Download DXSetup - if: contains(matrix.name, 'windows-latest-cl') && steps.dxcache.outputs.cache-hit != 'true' + if: contains(matrix.name, 'windows-latest-cl.exe') && steps.dxcache.outputs.cache-hit != 'true' run: | curl -s -o DXSDK_Jun10.exe --location https://download.microsoft.com/download/A/E/7/AE743F1F-632B-4809-87A9-AA1BB3458E31/DXSDK_Jun10.exe cmd.exe /c start /wait .\DXSDK_Jun10.exe /U /O /F /S /P "${{ github.workspace }}\DX_SDK" - name: Set Windows specific CMake arguments - if: contains(matrix.name, 'windows-latest-cl') + if: contains(matrix.name, 'windows-latest-cl.exe') id: windows_extra_cmake_args run: echo "::set-output name=args::-DASSIMP_BUILD_ASSIMP_TOOLS=1 -DASSIMP_BUILD_ASSIMP_VIEW=1 -DASSIMP_BUILD_ZLIB=1" From ecd144b63ed08b2fed2de90ca6e37bd04fdc5695 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 9 Apr 2024 19:13:25 +0100 Subject: [PATCH 05/18] Update UnitTestFileGenerator.h --- test/unit/UnitTestFileGenerator.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/test/unit/UnitTestFileGenerator.h b/test/unit/UnitTestFileGenerator.h index 93007bad9..46d2113ab 100644 --- a/test/unit/UnitTestFileGenerator.h +++ b/test/unit/UnitTestFileGenerator.h @@ -54,14 +54,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include inline FILE* MakeTmpFile(char* tmplate) { - auto pathtemplate = _mktemp(tmplate); + auto pathtemplate = _mktemp_s(tmplate, std::strlen(tmplate)); EXPECT_NE(pathtemplate, nullptr); if(pathtemplate == nullptr) { return nullptr; } - auto* fs = std::fopen(pathtemplate, "w+"); - EXPECT_NE(fs, nullptr); + FILE *fs = nullptr; + auto err = fopen_s(&fs, pathtemplate, "w+"); + EXPECT_EQ(err, 0); return fs; } #elif defined(__GNUC__) || defined(__clang__) From 1587c61ee7afc68a1737593e8e40ec7a33c9b621 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 9 Apr 2024 19:31:45 +0100 Subject: [PATCH 06/18] Update UnitTestFileGenerator.h --- test/unit/UnitTestFileGenerator.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/unit/UnitTestFileGenerator.h b/test/unit/UnitTestFileGenerator.h index 46d2113ab..f14bc8607 100644 --- a/test/unit/UnitTestFileGenerator.h +++ b/test/unit/UnitTestFileGenerator.h @@ -54,14 +54,14 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include inline FILE* MakeTmpFile(char* tmplate) { - auto pathtemplate = _mktemp_s(tmplate, std::strlen(tmplate)); - EXPECT_NE(pathtemplate, nullptr); - if(pathtemplate == nullptr) + auto err = _mktemp_s(tmplate, std::strlen(tmplate)); + EXPECT_NE(tmplate, nullptr); + if(tmplate == nullptr) { return nullptr; } FILE *fs = nullptr; - auto err = fopen_s(&fs, pathtemplate, "w+"); + auto err = fopen_s(&fs, tmplate, "w+"); EXPECT_EQ(err, 0); return fs; } From c7409775942606dec60cdd5e0fe47b16ebce4d32 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 9 Apr 2024 19:37:35 +0100 Subject: [PATCH 07/18] Update UnitTestFileGenerator.h --- test/unit/UnitTestFileGenerator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/UnitTestFileGenerator.h b/test/unit/UnitTestFileGenerator.h index f14bc8607..6c5a8346d 100644 --- a/test/unit/UnitTestFileGenerator.h +++ b/test/unit/UnitTestFileGenerator.h @@ -61,7 +61,7 @@ inline FILE* MakeTmpFile(char* tmplate) return nullptr; } FILE *fs = nullptr; - auto err = fopen_s(&fs, tmplate, "w+"); + err = fopen_s(&fs, tmplate, "w+"); EXPECT_EQ(err, 0); return fs; } From 0142bc35f7d64c8ffc556f08a13956ec2410ab07 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 9 Apr 2024 21:00:07 +0200 Subject: [PATCH 08/18] Update UnitTestFileGenerator.h --- test/unit/UnitTestFileGenerator.h | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/test/unit/UnitTestFileGenerator.h b/test/unit/UnitTestFileGenerator.h index 6c5a8346d..c0d863557 100644 --- a/test/unit/UnitTestFileGenerator.h +++ b/test/unit/UnitTestFileGenerator.h @@ -54,15 +54,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include inline FILE* MakeTmpFile(char* tmplate) { - auto err = _mktemp_s(tmplate, std::strlen(tmplate)); - EXPECT_NE(tmplate, nullptr); - if(tmplate == nullptr) + auto pathtemplate = _mktemp(tmplate); + EXPECT_NE(pathtemplate, nullptr); + if(pathtemplate == nullptr) { return nullptr; } - FILE *fs = nullptr; - err = fopen_s(&fs, tmplate, "w+"); - EXPECT_EQ(err, 0); + auto* fs = std::fopen(pathtemplate, "w+"); + EXPECT_NE(fs, nullptr); return fs; + return fs; } #elif defined(__GNUC__) || defined(__clang__) From f8b3023db34dc964c2dddd489b0988d122594231 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 9 Apr 2024 21:09:02 +0200 Subject: [PATCH 09/18] Update UnitTestFileGenerator.h --- test/unit/UnitTestFileGenerator.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/test/unit/UnitTestFileGenerator.h b/test/unit/UnitTestFileGenerator.h index c0d863557..fcf31ef9f 100644 --- a/test/unit/UnitTestFileGenerator.h +++ b/test/unit/UnitTestFileGenerator.h @@ -3,7 +3,7 @@ Open Asset Import Library (assimp) --------------------------------------------------------------------------- -Copyright (c) 2006-2020, assimp team +Copyright (c) 2006-2024, assimp team All rights reserved. @@ -51,6 +51,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #endif #if defined(_MSC_VER) +#define _CRT_SECURE_NO_WARNINGS #include inline FILE* MakeTmpFile(char* tmplate) { From 200e34f0caf05040e1a9a1e42cf86a9b25034862 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 9 Apr 2024 21:15:15 +0200 Subject: [PATCH 10/18] Update UnitTestFileGenerator.h --- test/unit/UnitTestFileGenerator.h | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/test/unit/UnitTestFileGenerator.h b/test/unit/UnitTestFileGenerator.h index fcf31ef9f..c5eb23ea8 100644 --- a/test/unit/UnitTestFileGenerator.h +++ b/test/unit/UnitTestFileGenerator.h @@ -45,13 +45,15 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include #if defined(_MSC_VER) || defined(__MINGW64__) || defined(__MINGW32__) -#define TMP_PATH "./" +# define TMP_PATH "./" #elif defined(__GNUC__) || defined(__clang__) -#define TMP_PATH "/tmp/" +# define TMP_PATH "/tmp/" #endif #if defined(_MSC_VER) -#define _CRT_SECURE_NO_WARNINGS +# ifndef _CRT_SECURE_NO_WARNINGS +# define _CRT_SECURE_NO_WARNINGS +# endif #include inline FILE* MakeTmpFile(char* tmplate) { From a53bca85cbacaf3cadbaf6a398d213f1044aab13 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 18 Apr 2024 11:44:33 +0200 Subject: [PATCH 11/18] Use save mktemp on windows --- test/unit/UnitTestFileGenerator.h | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/test/unit/UnitTestFileGenerator.h b/test/unit/UnitTestFileGenerator.h index c5eb23ea8..13b4fc2f0 100644 --- a/test/unit/UnitTestFileGenerator.h +++ b/test/unit/UnitTestFileGenerator.h @@ -55,12 +55,12 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # define _CRT_SECURE_NO_WARNINGS # endif #include -inline FILE* MakeTmpFile(char* tmplate) -{ - auto pathtemplate = _mktemp(tmplate); +inline FILE* MakeTmpFile(char* tmplate) { + auto pathtemplate = template; + int err = _mktemp_s(pathtemplate, std::strlen(pathtemplate)); + EXPECT_EQ(err, 0); EXPECT_NE(pathtemplate, nullptr); - if(pathtemplate == nullptr) - { + if(pathtemplate == nullptr) { return nullptr; } auto* fs = std::fopen(pathtemplate, "w+"); @@ -69,12 +69,10 @@ inline FILE* MakeTmpFile(char* tmplate) return fs; } #elif defined(__GNUC__) || defined(__clang__) -inline FILE* MakeTmpFile(char* tmplate) -{ +inline FILE* MakeTmpFile(char* tmplate) { auto fd = mkstemp(tmplate); EXPECT_NE(-1, fd); - if(fd == -1) - { + if(fd == -1) { return nullptr; } auto fs = fdopen(fd, "w+"); From 718c517dcda922b8e0c836d26876a159264cac04 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Thu, 18 Apr 2024 14:54:25 +0200 Subject: [PATCH 12/18] Update UnitTestFileGenerator.h --- test/unit/UnitTestFileGenerator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/unit/UnitTestFileGenerator.h b/test/unit/UnitTestFileGenerator.h index 13b4fc2f0..dc0f4f7c3 100644 --- a/test/unit/UnitTestFileGenerator.h +++ b/test/unit/UnitTestFileGenerator.h @@ -56,7 +56,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # endif #include inline FILE* MakeTmpFile(char* tmplate) { - auto pathtemplate = template; + char *pathtemplate = tmplate; int err = _mktemp_s(pathtemplate, std::strlen(pathtemplate)); EXPECT_EQ(err, 0); EXPECT_NE(pathtemplate, nullptr); From 7c81fa89e7ad7beaeeb9d2ee9351e25d300d81e2 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 10 Sep 2024 19:10:15 +0200 Subject: [PATCH 13/18] Update zutil.c Disable warning. --- contrib/zlib/zutil.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/contrib/zlib/zutil.c b/contrib/zlib/zutil.c index 9543ae825..6a5a032e1 100644 --- a/contrib/zlib/zutil.c +++ b/contrib/zlib/zutil.c @@ -23,6 +23,8 @@ z_const char * const z_errmsg[10] = { (z_const char *)"" }; +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-non-prototype" const char * ZEXPORT zlibVersion() { @@ -321,6 +323,7 @@ void ZLIB_INTERNAL zcfree(opaque, ptr) (void)opaque; free(ptr); } +#pragma clang diagnostic pop #endif /* MY_ZCALLOC */ From 3a3964835882ae7415751a86a5f668938c132acb Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 10 Sep 2024 19:16:31 +0200 Subject: [PATCH 14/18] Update gzclose.c Fix compiler warning --- contrib/zlib/gzclose.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/contrib/zlib/gzclose.c b/contrib/zlib/gzclose.c index caeb99a31..238e9ded4 100644 --- a/contrib/zlib/gzclose.c +++ b/contrib/zlib/gzclose.c @@ -5,6 +5,9 @@ #include "gzguts.h" +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-non-prototype" + /* gzclose() is in a separate file so that it is linked in only if it is used. That way the other gzclose functions can be used instead to avoid linking in unneeded compression or decompression routines. */ @@ -23,3 +26,6 @@ int ZEXPORT gzclose(file) return gzclose_r(file); #endif } + +#pragma clang diagnostic pop + From 8bd943abc6654385919345261091a6d6be241fce Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 10 Sep 2024 19:37:01 +0200 Subject: [PATCH 15/18] Update CMakeLists.txt --- code/CMakeLists.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index e18c7c489..7a646fc84 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -1397,6 +1397,7 @@ IF (ASSIMP_WARNINGS_AS_ERRORS) -Wno-undefined-func-template -Wno-declaration-after-statement -Wno-deprecated-declarations + -Wdeprecated-non-prototype ) ELSE() TARGET_COMPILE_OPTIONS(assimp PRIVATE /W4 /WX) From 26df0b50e5668a0442cedaacdcecc06a90309f97 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 10 Sep 2024 20:30:43 +0200 Subject: [PATCH 16/18] Use correct warning switch off --- code/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/code/CMakeLists.txt b/code/CMakeLists.txt index 7a646fc84..8c1f79589 100644 --- a/code/CMakeLists.txt +++ b/code/CMakeLists.txt @@ -1346,7 +1346,6 @@ add_compile_options( IF (ASSIMP_WARNINGS_AS_ERRORS) MESSAGE(STATUS "Treating all warnings as errors (for assimp library only)") IF (MSVC) - IF(CMAKE_CXX_COMPILER_ID MATCHES "Clang" ) # clang-cl TARGET_COMPILE_OPTIONS(assimp PRIVATE -Wall -Werror -Wno-microsoft-enum-value @@ -1397,7 +1396,7 @@ IF (ASSIMP_WARNINGS_AS_ERRORS) -Wno-undefined-func-template -Wno-declaration-after-statement -Wno-deprecated-declarations - -Wdeprecated-non-prototype + -Wno-deprecated-non-prototype ) ELSE() TARGET_COMPILE_OPTIONS(assimp PRIVATE /W4 /WX) From 3036de89d325d85fdc1bac7e86f2937b464f4e26 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 10 Sep 2024 20:59:51 +0200 Subject: [PATCH 17/18] Update utIOStreamBuffer.cpp --- test/unit/utIOStreamBuffer.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/test/unit/utIOStreamBuffer.cpp b/test/unit/utIOStreamBuffer.cpp index 381716040..4d98c7d20 100644 --- a/test/unit/utIOStreamBuffer.cpp +++ b/test/unit/utIOStreamBuffer.cpp @@ -5,8 +5,6 @@ Open Asset Import Library (assimp) Copyright (c) 2006-2024, assimp team - - All rights reserved. Redistribution and use of this software in source and binary forms, @@ -86,7 +84,7 @@ TEST_F( IOStreamBufferTest, open_close_Test ) { const auto dataCount = dataSize / sizeof(*data); char fname[]={ "octest.XXXXXX" }; - auto* fs = MakeTmpFile(fname); + FILE *fsm = fopen(fname, "w+"); ASSERT_NE(nullptr, fs); auto written = std::fwrite( data, sizeof(*data), dataCount, fs ); From 65672a02b8d2a7ae736a9949fb41c8ba24cae499 Mon Sep 17 00:00:00 2001 From: Kim Kulling Date: Tue, 10 Sep 2024 21:57:58 +0200 Subject: [PATCH 18/18] Update utIOStreamBuffer.cpp --- test/unit/utIOStreamBuffer.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/unit/utIOStreamBuffer.cpp b/test/unit/utIOStreamBuffer.cpp index 4d98c7d20..aa3041cd0 100644 --- a/test/unit/utIOStreamBuffer.cpp +++ b/test/unit/utIOStreamBuffer.cpp @@ -84,10 +84,10 @@ TEST_F( IOStreamBufferTest, open_close_Test ) { const auto dataCount = dataSize / sizeof(*data); char fname[]={ "octest.XXXXXX" }; - FILE *fsm = fopen(fname, "w+"); + auto* fs = MakeTmpFile(fname); ASSERT_NE(nullptr, fs); - auto written = std::fwrite( data, sizeof(*data), dataCount, fs ); + auto written = std::fwrite(data, sizeof(*data), dataCount, fs); EXPECT_NE( 0U, written ); auto flushResult = std::fflush( fs ); ASSERT_EQ(0, flushResult);