From 88a95ebf3758fb71d40b481dfb278c4ad3fa4435 Mon Sep 17 00:00:00 2001 From: Harrand Date: Thu, 31 Oct 2024 20:19:13 +0000 Subject: [PATCH] [test] get all tests working again --- cmake/build_config.cmake | 6 +++--- cmake/topaz.cmake | 6 ++++++ include/tz/main.hpp | 4 ++++ test/tz/gpu_resource_test.cpp | 3 ++- test/tz/vector_test.cpp | 6 +++--- 5 files changed, 18 insertions(+), 7 deletions(-) diff --git a/cmake/build_config.cmake b/cmake/build_config.cmake index a3127fd7fd..da581b8ab4 100644 --- a/cmake/build_config.cmake +++ b/cmake/build_config.cmake @@ -28,15 +28,15 @@ endfunction() function(configure_debug) # TODO - target_compile_definitions(topaz PUBLIC -DTOPAZ_DEBUG=1) + target_compile_definitions(topaz PUBLIC -DTOPAZ_DEBUG=1 -DTOPAZ_SHIPPING=0) endfunction() function(configure_release) # TODO - target_compile_definitions(topaz PUBLIC -DTOPAZ_DEBUG=0) + target_compile_definitions(topaz PUBLIC -DTOPAZ_DEBUG=0 -DTOPAZ_SHIPPING=1) endfunction() function(configure_profile) # TODO - target_compile_definitions(topaz PUBLIC -DTOPAZ_DEBUG=0) + target_compile_definitions(topaz PUBLIC -DTOPAZ_DEBUG=0 -DTOPAZ_SHIPPING=0) endfunction() diff --git a/cmake/topaz.cmake b/cmake/topaz.cmake index 1264a62bdc..d8f31487f5 100644 --- a/cmake/topaz.cmake +++ b/cmake/topaz.cmake @@ -43,9 +43,15 @@ function(topaz_add_executable) ${ARGN} ) + if(${CMAKE_BUILD_TYPE} MATCHES "release") add_executable(${TOPAZ_ADD_EXECUTABLE_TARGET} WIN32 ${TOPAZ_ADD_EXECUTABLE_SOURCES} ) + else() + add_executable(${TOPAZ_ADD_EXECUTABLE_TARGET} + ${TOPAZ_ADD_EXECUTABLE_SOURCES} + ) + endif() topaz_add_shader( TARGET ${TOPAZ_ADD_EXECUTABLE_TARGET} SHADERS diff --git a/include/tz/main.hpp b/include/tz/main.hpp index e35d5077a7..bf3663aacf 100644 --- a/include/tz/main.hpp +++ b/include/tz/main.hpp @@ -1,7 +1,11 @@ #ifndef TZMAIN_HPP #ifdef _WIN32 +#if TOPAZ_SHIPPING #define NOMINMAX #include #define tz_main() WINAPI wWinMain([[maybe_unused]] HINSTANCE, [[maybe_unused]] HINSTANCE,[[maybe_unused]] LPWSTR, [[maybe_unused]] _In_ int) +#else + #define tz_main() main() +#endif #endif #endif // TZMAIN_HPP \ No newline at end of file diff --git a/test/tz/gpu_resource_test.cpp b/test/tz/gpu_resource_test.cpp index aacca4e8e3..7bd53fc812 100644 --- a/test/tz/gpu_resource_test.cpp +++ b/test/tz/gpu_resource_test.cpp @@ -10,12 +10,13 @@ int tz_main() tz::gpu::hardware gpu = tz::gpu::find_best_hardware(); tz_must(tz::gpu::use_hardware(gpu)); + std::array empty_imgdata; tz::gpu::resource_handle img = tz_must(tz::gpu::create_image ({ .width = 80u, .height = 80u, .type = tz::gpu::image_type::rgba, - .data = {} + .data = empty_imgdata })); int data = 5; diff --git a/test/tz/vector_test.cpp b/test/tz/vector_test.cpp index 02dcd26454..0e03e80e6d 100644 --- a/test/tz/vector_test.cpp +++ b/test/tz/vector_test.cpp @@ -21,9 +21,9 @@ void test_constructor() tz_assert(zero_vec == vec_t(arr0), "zero() failed. Expected: {{0.0f, ...}}"); // Test constructor with variadic arguments - vec_t variadic_vec(static_cast(1.5f)); - tz_assert((variadic_vec == vec_t{static_cast(1.5f)}), - "variadic constructor failed. Expected: {{1.5f}}"); + vec_t variadic_vec(static_cast(1.5f), static_cast(1.0f)); + tz_assert((variadic_vec == vec_t{static_cast(1.5f), static_cast(1.0f)}), + "variadic constructor failed. Expected: {{1.5f, 1.0f}}"); // Test array constructor std::array arr;