2023-07-15 14:29:14 +02:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
|
2023-12-23 21:09:41 +01:00
|
|
|
include(ImHexPlugin)
|
|
|
|
find_package(CoreClrEmbed)
|
|
|
|
|
|
|
|
add_imhex_plugin(
|
|
|
|
NAME
|
|
|
|
script_loader
|
|
|
|
|
|
|
|
SOURCES
|
|
|
|
source/plugin_script_loader.cpp
|
|
|
|
|
|
|
|
INCLUDES
|
|
|
|
include
|
2023-12-26 00:22:47 +01:00
|
|
|
|
|
|
|
LIBRARIES
|
|
|
|
ui
|
2023-12-23 21:09:41 +01:00
|
|
|
)
|
|
|
|
|
|
|
|
if (CoreClrEmbed_FOUND)
|
|
|
|
add_library(nethost SHARED IMPORTED)
|
|
|
|
target_include_directories(nethost INTERFACE "${CoreClrEmbed_INCLUDE_DIRS}")
|
|
|
|
get_filename_component(CoreClrEmbed_FOLDER ${CoreClrEmbed_SHARED_LIBRARIES} DIRECTORY)
|
|
|
|
set_target_properties(nethost
|
|
|
|
PROPERTIES
|
|
|
|
IMPORTED_IMPLIB ${CoreClrEmbed_SHARED_LIBRARIES}
|
|
|
|
IMPORTED_LOCATION ${CoreClrEmbed_LIBRARIES}
|
|
|
|
BUILD_RPATH ${CoreClrEmbed_FOLDER}
|
|
|
|
INSTALL_RPATH ${CoreClrEmbed_FOLDER})
|
|
|
|
|
|
|
|
target_link_directories(script_loader PRIVATE ${CoreClrEmbed_FOLDER})
|
|
|
|
target_include_directories(script_loader PRIVATE ${CoreClrEmbed_INCLUDE_DIRS})
|
|
|
|
target_compile_definitions(script_loader PRIVATE DOTNET_PLUGINS=1)
|
|
|
|
target_sources(script_loader PRIVATE
|
|
|
|
source/loaders/dotnet/dotnet_loader.cpp
|
|
|
|
|
|
|
|
source/script_api/v1/mem.cpp
|
|
|
|
source/script_api/v1/bookmarks.cpp
|
|
|
|
source/script_api/v1/ui.cpp
|
2023-07-15 14:29:14 +02:00
|
|
|
)
|
|
|
|
|
2023-12-23 21:09:41 +01:00
|
|
|
set(EXTRA_BUNDLE_LIBRARY_PATHS "${CoreClrEmbed_FOLDER}" PARENT_SCOPE)
|
2023-07-15 14:29:14 +02:00
|
|
|
|
2023-12-23 21:09:41 +01:00
|
|
|
if (IMHEX_BUNDLE_DOTNET)
|
|
|
|
install(FILES ${CoreClrEmbed_SHARED_LIBRARIES} DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
2023-07-15 14:29:14 +02:00
|
|
|
endif ()
|
|
|
|
|
2023-12-23 21:09:41 +01:00
|
|
|
add_subdirectory(dotnet)
|
|
|
|
add_dependencies(script_loader AssemblyLoader)
|
|
|
|
|
2023-07-27 00:53:04 +02:00
|
|
|
endif ()
|