Skip to content

Commit

Permalink
CMAKE_CROSSCOMPILING_EMULATOR and misc. fixes (AcademySoftwareFoundat…
Browse files Browse the repository at this point in the history
…ion#1106)

* Various fixes.

* Fix a few formatting problems.
* Fix for -Wformat-security warnings in internal_win32_file_impl.h for mingw and also for security.
* In unpack.c: Add missing <stdbool.h> include.
* Swap intrinsic include check. On mingw both files are present but intrin.h should be used.
* Disable a warning only for MSVC.
* Remove useless export on defaulted destructor. Mingw doesn't like it.
* Add CMAKE_CROSSCOMPILING_EMULATOR for all tests. This allows running tests on a platform like mingw.

Signed-off-by: Patrick Northon <northon_patrick3@yahoo.ca>

* Add comment about CMAKE_CROSSCOMPILING_EMULATOR.

Signed-off-by: Patrick Northon <northon_patrick3@yahoo.ca>

* * Remove changes from internal_coding.h.
* Remove commented-out add_test lines.

Signed-off-by: Patrick Northon <northon_patrick3@yahoo.ca>
  • Loading branch information
patlefort authored and cary-ilm committed Jul 28, 2021
1 parent ca2e994 commit cb5c3a3
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
5 changes: 4 additions & 1 deletion src/lib/Iex/IexThrowErrnoExc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@

#ifdef _WIN32
#include <windows.h>
#pragma warning (disable : 4996)
#endif

#ifdef _MSC_VER
#pragma warning (disable : 4996)
#endif

IEX_INTERNAL_NAMESPACE_SOURCE_ENTER
Expand Down
1 change: 0 additions & 1 deletion src/lib/OpenEXR/ImfKeyCode.h
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,6 @@ class IMF_EXPORT_TYPE KeyCode

IMF_EXPORT
KeyCode (const KeyCode &other);
IMF_EXPORT
~KeyCode() = default;
IMF_EXPORT
KeyCode & operator = (const KeyCode &other);
Expand Down
4 changes: 2 additions & 2 deletions src/lib/OpenEXRCore/decoding.c
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ default_decompress_chunk (exr_decode_pipeline_t* decode)
return pctxt->print_error (
pctxt,
rv,
"Unable to decompress sample table %lu -> %lu",
"Unable to decompress sample table %llu -> %zu",
decode->chunk.sample_count_table_size,
sampsize);
}
Expand All @@ -328,7 +328,7 @@ default_decompress_chunk (exr_decode_pipeline_t* decode)
return pctxt->print_error (
pctxt,
rv,
"Unable to decompress image data %lu -> %lu",
"Unable to decompress image data %llu -> %llu",
decode->chunk.packed_size,
decode->chunk.unpacked_size);
}
Expand Down
4 changes: 2 additions & 2 deletions src/lib/OpenEXRCore/internal_win32_file_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -61,9 +61,9 @@ print_error_helper (

if (error_cb)
error_cb (
(exr_const_context_t) pf, errcode, (const char*) lpDisplayBuf);
(exr_const_context_t) pf, errcode, "%s", (const char*) lpDisplayBuf);
else
pf->print_error (pf, errcode, (const char*) lpDisplayBuf);
pf->print_error (pf, errcode, "%s", (const char*) lpDisplayBuf);

LocalFree (lpMsgBuf);
LocalFree (lpDisplayBuf);
Expand Down
1 change: 1 addition & 0 deletions src/lib/OpenEXRCore/unpack.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
#include "openexr_attr.h"

#include <string.h>
#include <stdbool.h>

#if defined(__x86_64__) || defined(_M_X64)
# ifndef _WIN32
Expand Down
4 changes: 3 additions & 1 deletion src/test/IexTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,6 @@ set_target_properties(IexTest PROPERTIES
if(WIN32 AND BUILD_SHARED_LIBS)
target_compile_definitions(IexTest PRIVATE OPENEXR_DLL)
endif()
add_test(NAME OpenEXR.Iex COMMAND $<TARGET_FILE:IexTest>)

# CMAKE_CROSSCOMPILING_EMULATOR is necessary to support cross-compiling (ex: to win32 from mingw and running tests with wine)
add_test(NAME OpenEXR.Iex COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:IexTest>)
4 changes: 2 additions & 2 deletions src/test/OpenEXRCoreTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,10 @@ if(WIN32 AND (BUILD_SHARED_LIBS OR OPENEXR_BUILD_BOTH_STATIC_SHARED))
target_compile_definitions(CorePerfTest PRIVATE OPENEXR_DLL)
endif()

#add_test(NAME OpenEXR.Core COMMAND $<TARGET_FILE:OpenEXRCoreTest>)
function(DEFINE_OPENEXRCORE_TESTS)
foreach(curtest IN LISTS ARGN)
add_test(NAME OpenEXRCore.${curtest} COMMAND $<TARGET_FILE:OpenEXRCoreTest> ${curtest})
# CMAKE_CROSSCOMPILING_EMULATOR is necessary to support cross-compiling (ex: to win32 from mingw and running tests with wine)
add_test(NAME OpenEXRCore.${curtest} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:OpenEXRCoreTest> ${curtest})
endforeach()
endfunction()

Expand Down
5 changes: 2 additions & 3 deletions src/test/OpenEXRFuzzTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ if(OPENEXR_RUN_FUZZ_TESTS)

function(DEFINE_OPENEXR_FUZZ_TESTS)
foreach(curtest IN LISTS ARGN)
add_test(NAME OpenEXR.Fuzz.${curtest} COMMAND $<TARGET_FILE:OpenEXRFuzzTest> ${curtest})
# CMAKE_CROSSCOMPILING_EMULATOR is necessary to support cross-compiling (ex: to win32 from mingw and running tests with wine)
add_test(NAME OpenEXR.Fuzz.${curtest} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:OpenEXRFuzzTest> ${curtest})
set_tests_properties(OpenEXR.Fuzz.${curtest} PROPERTIES TIMEOUT 36000)
endforeach()
endfunction()
Expand All @@ -28,8 +29,6 @@ endfunction()
testFuzzDeepScanLines
testFuzzDeepTiles
)
#add_test(NAME OpenEXR.Fuzz COMMAND $<TARGET_FILE:OpenEXRFuzzTest>)
#set_tests_properties(OpenEXR.Fuzz PROPERTIES TIMEOUT 36000)

add_custom_target(fuzz $<TARGET_FILE:OpenEXRFuzzTest>)
add_dependencies(fuzz OpenEXRFuzzTest)
Expand Down
8 changes: 2 additions & 6 deletions src/test/OpenEXRTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,14 +74,10 @@ if(WIN32 AND BUILD_SHARED_LIBS)
target_compile_definitions(OpenEXRTest PRIVATE OPENEXR_DLL)
endif()

#add_test(NAME OpenEXR.Core COMMAND $<TARGET_FILE:OpenEXRTest> core)
#add_test(NAME OpenEXR.Basic COMMAND $<TARGET_FILE:OpenEXRTest> basic)
#add_test(NAME OpenEXR.Deep COMMAND $<TARGET_FILE:OpenEXRTest> deep)
#add_test(NAME OpenEXR.Multi COMMAND $<TARGET_FILE:OpenEXRTest> multi)

function(DEFINE_OPENEXR_TESTS)
foreach(curtest IN LISTS ARGN)
add_test(NAME OpenEXR.${curtest} COMMAND $<TARGET_FILE:OpenEXRTest> ${curtest})
# CMAKE_CROSSCOMPILING_EMULATOR is necessary to support cross-compiling (ex: to win32 from mingw and running tests with wine)
add_test(NAME OpenEXR.${curtest} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:OpenEXRTest> ${curtest})
endforeach()
endfunction()

Expand Down
4 changes: 2 additions & 2 deletions src/test/OpenEXRUtilTest/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,10 @@ endif()

function(DEFINE_OPENEXR_UTIL_TESTS)
foreach(curtest IN LISTS ARGN)
add_test(NAME OpenEXRUtil.${curtest} COMMAND $<TARGET_FILE:OpenEXRUtilTest> ${curtest})
# CMAKE_CROSSCOMPILING_EMULATOR is necessary to support cross-compiling (ex: to win32 from mingw and running tests with wine)
add_test(NAME OpenEXRUtil.${curtest} COMMAND ${CMAKE_CROSSCOMPILING_EMULATOR} $<TARGET_FILE:OpenEXRUtilTest> ${curtest})
endforeach()
endfunction()
#add_test(NAME OpenEXR.OpenEXRUtil COMMAND $<TARGET_FILE:OpenEXRUtilTest>)

define_openexr_util_tests(
testFlatImage
Expand Down

0 comments on commit cb5c3a3

Please sign in to comment.