diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 6c2329a3f8616..16ce75c1f46a2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -49,18 +49,20 @@ jobs: -DCMAKE_BUILD_TYPE=Debug \ -DIMHEX_ENABLE_UNIT_TESTS=ON \ -DIMHEX_ENABLE_PLUGIN_TESTS=ON \ + -DIMHEX_PATTERNS_ENABLE_UNIT_TESTS=OFF \ + -DLIBPL_ENABLE_TESTS=OFF \ -DCMAKE_C_COMPILER_LAUNCHER=ccache \ -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ -DCMAKE_C_FLAGS="-fuse-ld=lld -fsanitize=address,leak,undefined -fno-sanitize-recover=all --coverage" \ -DCMAKE_CXX_FLAGS="-fuse-ld=lld -fsanitize=address,leak,undefined -fno-sanitize-recover=all --coverage" \ -DIMHEX_OFFLINE_BUILD=ON \ .. - make -j4 unit_tests + make -j4 unit_tests main - name: 🧪 Perform plcli Integration Tests run: | cd lib/external/pattern_language - python tests/integration/integration.py ../../../build/imhex --pl + python tests/integration/integration.py ../../../build/bin/imhex --pl - name: 🧪 Perform Unit Tests run: | @@ -82,6 +84,64 @@ jobs: token: ${{ secrets.CODECOV_TOKEN }} file: coverage_report.xml + tests-win: + name: 🧪 Unit Tests (windows) + runs-on: windows-2022 + defaults: + run: + shell: msys2 {0} + env: + CCACHE_DIR: "${{ github.workspace }}/.ccache" + steps: + - name: 🧰 Checkout + uses: actions/checkout@v4 + with: + submodules: recursive + + - name: 📜 Setup ccache + uses: hendrikmuhs/ccache-action@v1 + id: cache-ccache + with: + key: ${{ runner.os }}-ccache-${{ github.run_id }} + restore-keys: ${{ runner.os }}-ccache + max-size: 1G + + - name: 🟦 Install msys2 + uses: msys2/setup-msys2@v2 + with: + msystem: mingw64 + + - name: ⬇️ Install dependencies + run: | + set -x + dist/get_deps_msys2.sh + + # Windows cmake build + - name: 🛠️ Build + run: | + set -x + mkdir -p build + cd build + + cmake -G "Ninja" \ + -DCMAKE_BUILD_TYPE=Debug \ + -DCMAKE_INSTALL_PREFIX="$PWD/install" \ + -DIMHEX_USE_DEFAULT_BUILD_SETTINGS=ON \ + -DIMHEX_PATTERNS_PULL_MASTER=ON \ + -DUSE_SYSTEM_CAPSTONE=ON \ + -DIMHEX_ENABLE_UNIT_TESTS=ON \ + -DIMHEX_ENABLE_PLUGIN_TESTS=ON \ + -DIMHEX_PATTERNS_ENABLE_UNIT_TESTS=OFF \ + -DLIBPL_ENABLE_TESTS=OFF \ + -DIMHEX_OFFLINE_BUILD=ON \ + .. + ninja -j4 unit_tests + + - name: 🧪 Perform Unit Tests + run: | + cd build + ctest --output-on-failure + langs: name: 🧪 Langs runs-on: ubuntu-22.04 diff --git a/.gitignore b/.gitignore index 97ec6d6869e39..0bf523a7ecb29 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ .vscode/ +.devcontainer/ +.cache/ .idea/ .kdev4/ @@ -14,3 +16,4 @@ imgui.ini .DS_Store CMakeUserPresets.json Brewfile.lock.json +compile_commands.json diff --git a/CMakeLists.txt b/CMakeLists.txt index c3ad66f234536..90b027898a5fd 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -23,6 +23,15 @@ option(IMHEX_ENABLE_UNIT_TESTS "Enable building unit tests" option(IMHEX_ENABLE_PRECOMPILED_HEADERS "Enable precompiled headers" OFF) option(IMHEX_COMPRESS_DEBUG_INFO "Compress debug information" ON ) +# if enabled, add a unit_test custom target for all the unit tests to be registered against +if (IMHEX_ENABLE_UNIT_TESTS) + # should be first instance, but check anyway for consistency + if(NOT TARGET unit_tests) + enable_testing() + add_custom_target(unit_tests) + endif() +endif() + set(IMHEX_BASE_FOLDER "${CMAKE_CURRENT_SOURCE_DIR}") set(CMAKE_MODULE_PATH "${IMHEX_BASE_FOLDER}/cmake/modules") @@ -69,14 +78,16 @@ addBundledLibraries() add_subdirectory(lib/libimhex) add_subdirectory(main) -addPluginDirectories() # Add unit tests if (IMHEX_ENABLE_UNIT_TESTS) - enable_testing() add_subdirectory(tests EXCLUDE_FROM_ALL) endif () +# Do this after adding the tests, so that the plugins_test runner binary has +# a chance of being created before being referenced by plugin tests +addPluginDirectories() + # Configure more resources that will be added to the install package generatePDBs() generateSDKDirectory() diff --git a/CMakePresets.json b/CMakePresets.json index 83c9e53429b95..d10fafbbf7e2e 100644 --- a/CMakePresets.json +++ b/CMakePresets.json @@ -17,9 +17,14 @@ "CMAKE_BUILD_TYPE": "Debug", "CMAKE_C_COMPILER": "gcc", "CMAKE_CXX_COMPILER": "g++", + "CMAKE_EXPORT_COMPILE_COMMANDS": "ON", "IMHEX_PATTERNS_PULL_MASTER": "ON", "CMAKE_INSTALL_PREFIX": "./install", "USE_SYSTEM_CAPSTONE": "ON", + "IMHEX_ENABLE_UNIT_TESTS": "ON", + "IMHEX_ENABLE_PLUGIN_TESTS": "ON", + "LIBPL_ENABLE_TESTS": "ON", + "IMHEX_PATTERNS_ENABLE_UNIT_TESTS": "ON", "IMHEX_USE_DEFAULT_BUILD_SETTINGS": "ON" } }, @@ -52,7 +57,7 @@ "name": "x86_64", "description": "x86_64 build", "configurePreset": "x86_64", - "targets": [ "imhex_all" ] + "targets": [ "imhex_all", "unit_tests" ] } ], "testPresets": [ diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index 0136c120e5ad2..b4502e29aea72 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -387,8 +387,10 @@ function(configureProject) if (XCODE) # Support Xcode's multi configuration paradigm by placing built artifacts into separate directories set(IMHEX_MAIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Configs/$" PARENT_SCOPE) - else() + elseif(EMSCRIPTEN OR APPLE) set(IMHEX_MAIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" PARENT_SCOPE) + else() + set(IMHEX_MAIN_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" PARENT_SCOPE) endif() endfunction() @@ -500,16 +502,16 @@ function(downloadImHexPatternsFiles dest) # Maybe patterns are cloned to a subdirectory if (NOT EXISTS ${imhex_patterns_SOURCE_DIR}) - set(imhex_patterns_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ImHex-Patterns") + set(imhex_patterns_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/ImHex-Patterns") endif() # Or a sibling directory if (NOT EXISTS ${imhex_patterns_SOURCE_DIR}) - set(imhex_patterns_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../ImHex-Patterns") + set(imhex_patterns_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../ImHex-Patterns") endif() endif () - if (NOT EXISTS ${imhex_patterns_SOURCE_DIR}) + if (NOT EXISTS ${imhex_patterns_SOURCE_DIR}) message(WARNING "Failed to locate ImHex-Patterns repository, some resources will be missing during install!") elseif(XCODE) # The Xcode build has multiple configurations, which each need a copy of these files @@ -527,10 +529,24 @@ function(downloadImHexPatternsFiles dest) file(GENERATE OUTPUT "${dest}/${relativePath}" INPUT "${imhex_patterns_SOURCE_DIR}/${relativePath}") endforeach() else() + # Make sure the IMHEX_MAIN_OUTPUT_DIRECTORY exists, as CREATE_LINK doesn't create missing intermediate directories + file(MAKE_DIRECTORY "${IMHEX_MAIN_OUTPUT_DIRECTORY}") set(PATTERNS_FOLDERS_TO_INSTALL constants encodings includes patterns magic nodes) foreach (FOLDER ${PATTERNS_FOLDERS_TO_INSTALL}) + # Make the pattern files available to ImHex binaries started from the build directory + if (NOT IMHEX_OFFLINE_BUILD) + file(COPY "${imhex_patterns_SOURCE_DIR}/${FOLDER}" DESTINATION "${IMHEX_MAIN_OUTPUT_DIRECTORY}" PATTERN "**/_schema.json" EXCLUDE) + else() + # If it is an offline build, the imhex_patterns_SOURCE_DIR location is likely a git clone + # Create the directories as symbolic links, so that any changes get mirrored both ways + file(CREATE_LINK "${imhex_patterns_SOURCE_DIR}/${FOLDER}" "${IMHEX_MAIN_OUTPUT_DIRECTORY}/${FOLDER}" COPY_ON_ERROR SYMBOLIC) + endif() install(DIRECTORY "${imhex_patterns_SOURCE_DIR}/${FOLDER}" DESTINATION "${dest}" PATTERN "**/_schema.json" EXCLUDE) endforeach () + # Register ImHex-Patterns, if manually cloned + if(IMHEX_OFFLINE_BUILD AND EXISTS ${imhex_patterns_SOURCE_DIR}/CMakeLists.txt AND IMHEX_PATTERNS_ENABLE_UNIT_TESTS) + add_subdirectory(${imhex_patterns_SOURCE_DIR}) + endif() endif () endfunction() @@ -742,8 +758,8 @@ macro(addBundledLibraries) set_target_properties( libpl PROPERTIES - RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} - LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR} + RUNTIME_OUTPUT_DIRECTORY ${IMHEX_MAIN_OUTPUT_DIRECTORY} + LIBRARY_OUTPUT_DIRECTORY ${IMHEX_MAIN_OUTPUT_DIRECTORY} ) endif() enableUnityBuild(libpl) diff --git a/cmake/modules/ImHexPlugin.cmake b/cmake/modules/ImHexPlugin.cmake index b20b0e50ae3b3..e53a90e50637c 100644 --- a/cmake/modules/ImHexPlugin.cmake +++ b/cmake/modules/ImHexPlugin.cmake @@ -64,6 +64,8 @@ macro(add_imhex_plugin) # Set rpath of plugin libraries to the plugins folder if (APPLE) set_target_properties(${IMHEX_PLUGIN_NAME} PROPERTIES BUILD_RPATH "@executable_path/../Frameworks;@executable_path/plugins") + else() + set_target_properties(${IMHEX_PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${IMHEX_MAIN_OUTPUT_DIRECTORY}/plugins") endif() # Setup a romfs for the plugin @@ -124,8 +126,6 @@ macro(add_imhex_plugin) if (EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/tests/CMakeLists.txt AND IMHEX_ENABLE_UNIT_TESTS AND IMHEX_ENABLE_PLUGIN_TESTS) add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/tests) - target_link_libraries(${IMHEX_PLUGIN_NAME} PUBLIC ${IMHEX_PLUGIN_NAME}_tests) - target_compile_definitions(${IMHEX_PLUGIN_NAME}_tests PRIVATE IMHEX_PROJECT_NAME="${IMHEX_PLUGIN_NAME}-tests") endif() endmacro() diff --git a/dist/get_deps_msys2.sh b/dist/get_deps_msys2.sh index f4911848be484..d20a126498873 100755 --- a/dist/get_deps_msys2.sh +++ b/dist/get_deps_msys2.sh @@ -18,4 +18,5 @@ pacboy -S --needed --noconfirm \ bzip2:p \ xz:p \ zstd:p \ - lz4:p + lz4:p \ + gdb:p \ No newline at end of file diff --git a/lib/libimhex/CMakeLists.txt b/lib/libimhex/CMakeLists.txt index abcd9677faa54..5988ff2d5f2ec 100644 --- a/lib/libimhex/CMakeLists.txt +++ b/lib/libimhex/CMakeLists.txt @@ -151,5 +151,10 @@ set_property(TARGET libimhex PROPERTY INTERPROCEDURAL_OPTIMIZATION FALSE) add_dependencies(imhex_all libimhex) install(FILES "$" DESTINATION "${CMAKE_INSTALL_LIBDIR}" PERMISSIONS ${LIBRARY_PERMISSIONS}) -set_target_properties(libimhex PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +if(IMHEX_EXTERNAL_PLUGIN_BUILD) + set_target_properties(libimhex PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +else() + set_target_properties(libimhex PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${IMHEX_MAIN_OUTPUT_DIRECTORY}) + set_target_properties(libimhex PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${IMHEX_MAIN_OUTPUT_DIRECTORY}) +endif() set_target_properties(libimhex PROPERTIES PREFIX "") \ No newline at end of file diff --git a/main/forwarder/CMakeLists.txt b/main/forwarder/CMakeLists.txt index 9a04c35173e1f..94478a845660a 100644 --- a/main/forwarder/CMakeLists.txt +++ b/main/forwarder/CMakeLists.txt @@ -9,5 +9,5 @@ target_link_libraries(main-forwarder PRIVATE wolv::io ${FMT_LIBRARIES}) add_dependencies(imhex_all main-forwarder) set_target_properties(main-forwarder PROPERTIES OUTPUT_NAME "imhex" - RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/../.. + RUNTIME_OUTPUT_DIRECTORY ${IMHEX_MAIN_OUTPUT_DIRECTORY} ) \ No newline at end of file diff --git a/main/updater/CMakeLists.txt b/main/updater/CMakeLists.txt index 4e07614a7c9dd..6aa7843eedca0 100644 --- a/main/updater/CMakeLists.txt +++ b/main/updater/CMakeLists.txt @@ -1,4 +1,4 @@ -project(updater) +project(updater) add_executable(updater source/main.cpp @@ -11,7 +11,7 @@ add_dependencies(main updater) if (APPLE) set(OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/${BUNDLE_NAME}/Contents/MacOS") else () - set(OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") + set(OUTPUT_DIRECTORY "${IMHEX_MAIN_OUTPUT_DIRECTORY}") endif() set_target_properties(updater PROPERTIES diff --git a/plugins/builtin/source/content/views/view_hex_editor.cpp b/plugins/builtin/source/content/views/view_hex_editor.cpp index 3b5a8d152efa7..6b2bd6a1aac79 100644 --- a/plugins/builtin/source/content/views/view_hex_editor.cpp +++ b/plugins/builtin/source/content/views/view_hex_editor.cpp @@ -145,7 +145,7 @@ namespace hex::plugin::builtin { class PopupSelect : public ViewHexEditor::Popup { public: - + PopupSelect(u64 address, size_t size): m_region({address, size}) {} void draw(ViewHexEditor *editor) override { @@ -584,8 +584,6 @@ namespace hex::plugin::builtin { EventProviderChanged::unsubscribe(this); EventProviderOpened::unsubscribe(this); EventHighlightingChanged::unsubscribe(this); - - ContentRegistry::Settings::write("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.bytes_per_row", m_hexEditor.getBytesPerRow()); } void ViewHexEditor::drawPopup() { @@ -655,10 +653,16 @@ namespace hex::plugin::builtin { } void ViewHexEditor::drawContent() { + const auto prevBytesPerRow = m_hexEditor.getBytesPerRow(); + m_hexEditor.setProvider(ImHexApi::Provider::get()); m_hexEditor.draw(); + if(prevBytesPerRow != m_hexEditor.getBytesPerRow()) { + ContentRegistry::Settings::write("hex.builtin.setting.hex_editor", "hex.builtin.setting.hex_editor.bytes_per_row", m_hexEditor.getBytesPerRow()); + } + this->drawPopup(); } diff --git a/plugins/builtin/tests/CMakeLists.txt b/plugins/builtin/tests/CMakeLists.txt index 4c82cebd3a41a..c6fa043f2e62e 100644 --- a/plugins/builtin/tests/CMakeLists.txt +++ b/plugins/builtin/tests/CMakeLists.txt @@ -6,14 +6,21 @@ set(AVAILABLE_TESTS Providers/InvalidResize ) -add_library(${PROJECT_NAME} SHARED +add_library(${PROJECT_NAME} OBJECT source/main.cpp ) +# link into plugins_test, so that test registration works +target_link_libraries(plugins_test PUBLIC ${PROJECT_NAME}) + target_include_directories(${PROJECT_NAME} PUBLIC ${CMAKE_SOURCE_DIR}/plugins/builtin/include) target_link_libraries(${PROJECT_NAME} PRIVATE libimhex) foreach (test IN LISTS AVAILABLE_TESTS) - add_test(NAME "Plugin_${IMHEX_PLUGIN_NAME}/${test}" COMMAND $ "${test}" WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) -endforeach () \ No newline at end of file + add_test(NAME "Plugin_${IMHEX_PLUGIN_NAME}/${test}" COMMAND $ "${test}" WORKING_DIRECTORY ${IMHEX_MAIN_OUTPUT_DIRECTORY}) +endforeach () + +# remember to add dependency on the plugin itself to the unit_test target, so that it also gets built +add_dependencies(unit_tests ${IMHEX_PLUGIN_NAME}) +target_compile_definitions(${PROJECT_NAME} PRIVATE IMHEX_PROJECT_NAME="${IMHEX_PLUGIN_NAME}-tests") \ No newline at end of file diff --git a/plugins/script_loader/support/c/CMakeLists.txt b/plugins/script_loader/support/c/CMakeLists.txt index 5c581faa966d2..202471c867bbc 100644 --- a/plugins/script_loader/support/c/CMakeLists.txt +++ b/plugins/script_loader/support/c/CMakeLists.txt @@ -1,6 +1,12 @@ project(c_api) -add_library(c_api OBJECT +if (IMHEX_STATIC_LINK_PLUGINS) + set(C_API_LIBRARY_TYPE STATIC) +else() + set(C_API_LIBRARY_TYPE OBJECT) +endif() + +add_library(c_api ${C_API_LIBRARY_TYPE} source/script_api/v1/bookmarks.cpp source/script_api/v1/logger.cpp source/script_api/v1/mem.cpp diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 81dade9b7415c..2e8dc46e621cf 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -1,9 +1,5 @@ -project(unit_tests) - -add_custom_target(unit_tests DEPENDS imhex_all helpers algorithms plugins) add_subdirectory(common) -target_compile_definitions(tests_common PUBLIC IMHEX_PROJECT_NAME="${PROJECT_NAME}") add_subdirectory(helpers) add_subdirectory(algorithms) diff --git a/tests/algorithms/CMakeLists.txt b/tests/algorithms/CMakeLists.txt index 3aa618f4874ec..b51fcce9d0729 100644 --- a/tests/algorithms/CMakeLists.txt +++ b/tests/algorithms/CMakeLists.txt @@ -39,9 +39,9 @@ add_executable(${PROJECT_NAME} target_include_directories(${PROJECT_NAME} PRIVATE include) target_link_libraries(${PROJECT_NAME} PRIVATE libimhex tests_common ${FMT_LIBRARIES}) -set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${IMHEX_MAIN_OUTPUT_DIRECTORY}) foreach (test IN LISTS AVAILABLE_TESTS) - add_test(NAME "${TEST_CATEGORY}/${test}" COMMAND ${PROJECT_NAME} "${test}" WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + add_test(NAME "${TEST_CATEGORY}/${test}" COMMAND ${PROJECT_NAME} "${test}" WORKING_DIRECTORY ${IMHEX_MAIN_OUTPUT_DIRECTORY}) endforeach () add_dependencies(unit_tests ${PROJECT_NAME}) diff --git a/tests/common/CMakeLists.txt b/tests/common/CMakeLists.txt index 98c922020faf6..7ef07891250a1 100644 --- a/tests/common/CMakeLists.txt +++ b/tests/common/CMakeLists.txt @@ -5,4 +5,8 @@ project(tests_common) add_library(tests_common STATIC source/main.cpp ) + target_link_libraries(tests_common PUBLIC libimhex ${FMT_LIBRARIES} libwolv) +add_dependencies(unit_tests ${PROJECT_NAME}) + +target_compile_definitions(tests_common PUBLIC IMHEX_PROJECT_NAME="${PROJECT_NAME}") \ No newline at end of file diff --git a/tests/common/source/main.cpp b/tests/common/source/main.cpp index 217e229baf0b5..e0403d557bf71 100644 --- a/tests/common/source/main.cpp +++ b/tests/common/source/main.cpp @@ -51,6 +51,9 @@ int main(int argc, char **argv) { hex::log::info("Failed!"); hex::TaskManager::exit(); + + hex::ImHexApi::System::impl::cleanup(); + hex::EventImHexClosing::post(); hex::EventManager::clear(); hex::PluginManager::unload(); diff --git a/tests/helpers/CMakeLists.txt b/tests/helpers/CMakeLists.txt index ef3809b7905ba..77ca24145dced 100644 --- a/tests/helpers/CMakeLists.txt +++ b/tests/helpers/CMakeLists.txt @@ -43,9 +43,9 @@ add_executable(${PROJECT_NAME} target_include_directories(${PROJECT_NAME} PRIVATE include) target_link_libraries(${PROJECT_NAME} PRIVATE libimhex tests_common ${FMT_LIBRARIES}) -set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${IMHEX_MAIN_OUTPUT_DIRECTORY}) foreach (test IN LISTS AVAILABLE_TESTS) - add_test(NAME "${TEST_CATEGORY}/${test}" COMMAND ${PROJECT_NAME} "${test}" WORKING_DIRECTORY ${CMAKE_BINARY_DIR}) + add_test(NAME "${TEST_CATEGORY}/${test}" COMMAND ${PROJECT_NAME} "${test}" WORKING_DIRECTORY ${IMHEX_MAIN_OUTPUT_DIRECTORY}) endforeach () add_dependencies(unit_tests ${PROJECT_NAME}) diff --git a/tests/plugins/CMakeLists.txt b/tests/plugins/CMakeLists.txt index 35b4da650ce8a..744d0d2b4e289 100644 --- a/tests/plugins/CMakeLists.txt +++ b/tests/plugins/CMakeLists.txt @@ -12,5 +12,5 @@ add_executable(${PROJECT_NAME} target_include_directories(${PROJECT_NAME} PRIVATE include) target_link_libraries(${PROJECT_NAME} PRIVATE libimhex tests_common ${FMT_LIBRARIES}) -set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}) +set_target_properties(${PROJECT_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${IMHEX_MAIN_OUTPUT_DIRECTORY}") add_dependencies(unit_tests ${PROJECT_NAME}) diff --git a/tests/plugins/source/plugins.cpp b/tests/plugins/source/plugins.cpp index d80268ce691e1..55a412d0c97b9 100644 --- a/tests/plugins/source/plugins.cpp +++ b/tests/plugins/source/plugins.cpp @@ -3,11 +3,14 @@ #include #include +#include + using namespace hex; class PluginLoader { public: PluginLoader() { + GImGui = ImGui::CreateContext(); for (const auto &dir : paths::Plugins.read()) { PluginManager::addLoadPath(dir); }