mirror of
https://github.com/WerWolv/ImHex.git
synced 2026-03-28 07:47:03 -05:00
build: Fix MSVC builds
This commit is contained in:
@@ -19,9 +19,9 @@ option(IMHEX_ENABLE_UNITY_BUILD "Enables building ImHex as a unity build
|
||||
option(IMHEX_GENERATE_PDBS "Enable generating PDB files in non-debug builds (Windows only)" OFF)
|
||||
option(IMHEX_REPLACE_DWARF_WITH_PDB "Remove DWARF information from binaries when generating PDBS (Windows only)" OFF)
|
||||
option(IMHEX_ENABLE_STD_ASSERTS "Enable debug asserts in the C++ std library. (Breaks Plugin ABI!)" OFF)
|
||||
option(IMHEX_ENABLE_UNIT_TESTS "Enable building unit tests" OFF)
|
||||
option(IMHEX_ENABLE_PLUGIN_TESTS "Enable building plugin tests" OFF)
|
||||
option(IMHEX_ENABLE_IMGUI_TEST_ENGINE "Enable the ImGui Test Engine" OFF)
|
||||
option(IMHEX_ENABLE_UNIT_TESTS "Enable building unit tests" ON)
|
||||
option(IMHEX_ENABLE_PLUGIN_TESTS "Enable building plugin tests" ON)
|
||||
option(IMHEX_ENABLE_IMGUI_TEST_ENGINE "Enable the ImGui Test Engine" ON)
|
||||
option(IMHEX_ENABLE_PRECOMPILED_HEADERS "Enable precompiled headers" OFF)
|
||||
option(IMHEX_COMPRESS_DEBUG_INFO "Compress debug information" ON )
|
||||
option(IMHEX_ENABLE_CXX_MODULES "Enable C++20 Module compilation. Testing only!" OFF)
|
||||
|
||||
@@ -59,20 +59,9 @@ namespace hex::test {
|
||||
|
||||
class Tests {
|
||||
public:
|
||||
static auto addTest(const std::string &name, Function func, bool shouldFail) noexcept {
|
||||
s_tests.insert({
|
||||
name, {func, shouldFail}
|
||||
});
|
||||
static int addTest(const std::string &name, Function func, bool shouldFail) noexcept;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static auto &get() noexcept {
|
||||
return s_tests;
|
||||
}
|
||||
|
||||
private:
|
||||
static std::map<std::string, Test> s_tests;
|
||||
static std::map<std::string, Test> &get() noexcept;
|
||||
};
|
||||
|
||||
template<class F>
|
||||
|
||||
@@ -1,7 +1,19 @@
|
||||
#include <hex/test/tests.hpp>
|
||||
|
||||
namespace hex::test {
|
||||
std::map<std::string, Test> Tests::s_tests;
|
||||
|
||||
static std::map<std::string, Test> s_tests;
|
||||
int Tests::addTest(const std::string &name, Function func, bool shouldFail) noexcept {
|
||||
s_tests.insert({
|
||||
name, {func, shouldFail}
|
||||
});
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
std::map<std::string, Test> &Tests::get() noexcept {
|
||||
return s_tests;
|
||||
}
|
||||
|
||||
bool initPluginImpl(std::string name) {
|
||||
if (name != "Built-in") {
|
||||
|
||||
1
lib/third_party/imgui/imgui/CMakeLists.txt
vendored
1
lib/third_party/imgui/imgui/CMakeLists.txt
vendored
@@ -29,6 +29,7 @@ if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||
target_include_directories(imgui_imgui PUBLIC ${FREETYPE_INCLUDE_DIRS})
|
||||
target_link_directories(imgui_imgui PUBLIC ${FREETYPE_LIBRARY_DIRS})
|
||||
target_link_libraries(imgui_imgui PUBLIC ${FREETYPE_LIBRARIES})
|
||||
target_compile_definitions(imgui_imgui PRIVATE EXPORT_SYMBOLS=1)
|
||||
endif()
|
||||
|
||||
add_library(imgui_includes INTERFACE)
|
||||
|
||||
10
lib/third_party/imgui/imgui/include/imconfig.h
vendored
10
lib/third_party/imgui/imgui/include/imconfig.h
vendored
@@ -14,10 +14,6 @@
|
||||
|
||||
#pragma once
|
||||
|
||||
#if defined(IMGUI_TEST_ENGINE)
|
||||
#include "imgui_te_imconfig.h"
|
||||
#endif
|
||||
|
||||
#include <assert.h>
|
||||
|
||||
//---- Define assertion handler. Defaults to calling assert().
|
||||
@@ -165,4 +161,8 @@ namespace ImGui
|
||||
#define ImDrawIdx unsigned int
|
||||
#define IMGUI_DEBUG_TOOL_ITEM_PICKER_EX
|
||||
#define IMGUI_USE_WCHAR32
|
||||
#define IMGUI_USE_LEGACY_CRC32_ADLER 1
|
||||
#define IMGUI_USE_LEGACY_CRC32_ADLER 1
|
||||
|
||||
#if defined(IMGUI_TEST_ENGINE)
|
||||
#include "imgui_te_imconfig.h"
|
||||
#endif
|
||||
@@ -21,6 +21,11 @@ if (NOT IMHEX_EXTERNAL_PLUGIN_BUILD)
|
||||
)
|
||||
target_link_libraries(imgui_test_engine PRIVATE imgui_includes imgui_implot)
|
||||
target_compile_definitions(imgui_test_engine PUBLIC IMGUI_TEST_ENGINE=1)
|
||||
target_compile_definitions(imgui_test_engine PRIVATE EXPORT_SYMBOLS=1)
|
||||
|
||||
if (MSVC)
|
||||
target_compile_options(imgui_test_engine PUBLIC /wd4251)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
add_library(imgui_test_engine_includes INTERFACE)
|
||||
|
||||
@@ -62,6 +62,6 @@
|
||||
// - If a test is running, test name will be included in the log.
|
||||
// - Macro is calling IM_DEBUG_BREAK() inline to get debugger to break in the calling function (instead of a deeper callstack level).
|
||||
// - Macro is using comma operator instead of an if() to avoid "conditional expression is constant" warnings.
|
||||
extern void ImGuiTestEngine_AssertLog(const char* expr, const char* file, const char* func, int line);
|
||||
IMGUI_API extern void ImGuiTestEngine_AssertLog(const char* expr, const char* file, const char* func, int line);
|
||||
#define IM_TEST_ENGINE_ASSERT(_EXPR) do { if ((void)0, !(_EXPR)) { ImGuiTestEngine_AssertLog(#_EXPR, __FILE__, __func__, __LINE__); IM_DEBUG_BREAK(); } } while (0)
|
||||
// V_ASSERT_CONTRACT, assertMacro:IM_ASSERT
|
||||
|
||||
@@ -88,7 +88,6 @@ namespace hex {
|
||||
std::atomic<bool> m_wakeupFlag;
|
||||
std::condition_variable m_wakeupCondVar;
|
||||
|
||||
|
||||
gl::Shader m_postProcessingShader;
|
||||
};
|
||||
|
||||
|
||||
@@ -39,4 +39,9 @@ TEST_SEQUENCE("Providers/InvalidResize") {
|
||||
|
||||
TEST_ASSERT(!pr.resize(-1));
|
||||
TEST_SUCCESS();
|
||||
};
|
||||
|
||||
IMGUI_TEST_SEQUENCE("Category", "Name", ctx) {
|
||||
ctx->ItemClick("//Find###hex.builtin.view.find.name/Search");
|
||||
ctx->Yield(); // Takes one frame
|
||||
};
|
||||
Reference in New Issue
Block a user