Skip to content

Commit

Permalink
fix: Standard magic file not getting bundled into executable correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
WerWolv committed Jun 29, 2024
1 parent cbf4152 commit b94a428
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
4 changes: 4 additions & 0 deletions cmake/modules/ImHexPlugin.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,10 @@ macro(add_imhex_plugin)
endmacro()

macro(add_romfs_resource input output)
if (NOT EXISTS ${input})
message(WARNING "Resource file ${input} does not exist")
endif()

configure_file(${input} ${CMAKE_CURRENT_BINARY_DIR}/romfs/${output} COPYONLY)

list(APPEND LIBROMFS_RESOURCE_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/romfs)
Expand Down
10 changes: 5 additions & 5 deletions plugins/builtin/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ cmake_minimum_required(VERSION 3.16)

include(ImHexPlugin)

find_file(DEFAULT_MAGIC_FILE_PATH magic.mgc HINTS ${LIBMAGIC_INCLUDE_DIR}/../share/misc)
if (EXISTS ${DEFAULT_MAGIC_FILE_PATH})
add_romfs_resource(${DEFAULT_MAGIC_FILE_PATH} always_auto_extract/magic/magic.mgc)
endif ()

add_imhex_plugin(
NAME
builtin
Expand Down Expand Up @@ -122,11 +127,6 @@ add_imhex_plugin(
LLVMDemangle
)

find_file(DEFAULT_MAGIC_FILE_PATH magic.mgc HINTS ${LIBMAGIC_INCLUDE_DIR}/../share/misc)
if (DEFAULT_MAGIC_FILE_PATH)
add_romfs_resource(${DEFAULT_MAGIC_FILE_PATH} always_auto_extract/magic/magic.mgc)
endif ()

if (WIN32)
target_link_libraries(builtin PRIVATE setupapi)
endif ()

0 comments on commit b94a428

Please sign in to comment.