mirror of https://github.com/WerWolv/ImHex.git
build: Update ImHex-Rust-Plugin-Template on release
This commit is contained in:
parent
1eb9858f62
commit
33a0ee37fa
|
@ -125,6 +125,17 @@ jobs:
|
|||
owner: WerWolv
|
||||
event_type: update_submodule
|
||||
|
||||
- name: ✉️ Update Rust Plugin Template
|
||||
uses: mvasigh/dispatch-action@main
|
||||
env:
|
||||
RELEASE_TOKEN: ${{ secrets.RELEASE_TOKEN }}
|
||||
if: "${{ env.RELEASE_TOKEN != '' }}"
|
||||
with:
|
||||
token: ${{ secrets.RELEASE_TOKEN }}
|
||||
repo: ImHex-Rust-Plugin-Template
|
||||
owner: WerWolv
|
||||
event_type: update_submodule
|
||||
|
||||
release-windows:
|
||||
name: Release Windows
|
||||
needs: release-common
|
||||
|
|
|
@ -12,5 +12,3 @@ imgui.ini
|
|||
plugins/.rustc_info.json
|
||||
|
||||
**/target
|
||||
|
||||
plugins/example_rust/Cargo.lock
|
||||
|
|
|
@ -1,30 +0,0 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
# Change this to the name of your plugin #
|
||||
project(example_cpp)
|
||||
|
||||
# Add your source files here #
|
||||
add_library(${PROJECT_NAME} SHARED
|
||||
source/plugin_example.cpp
|
||||
)
|
||||
|
||||
# Add additional include directories here #
|
||||
target_include_directories(${PROJECT_NAME} PRIVATE include)
|
||||
# Add additional libraries here #
|
||||
target_link_libraries(${PROJECT_NAME} PRIVATE libimhex)
|
||||
|
||||
|
||||
|
||||
# ---- No need to change anything from here downwards unless you know what you're doing ---- #
|
||||
|
||||
set(CMAKE_CXX_STANDARD 20)
|
||||
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
||||
set(CMAKE_SHARED_LIBRARY_SUFFIX ".hexplug")
|
||||
|
||||
if (WIN32)
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wl,--allow-multiple-definition -fvisibility=hidden")
|
||||
endif()
|
||||
|
||||
add_compile_definitions(IMHEX_PROJECT_NAME="${PROJECT_NAME}")
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
setupCompilerWarnings(${PROJECT_NAME})
|
|
@ -1,21 +0,0 @@
|
|||
#include <hex/plugin.hpp>
|
||||
#include <hex/api/content_registry.hpp>
|
||||
#include <hex/ui/view.hpp>
|
||||
|
||||
class ViewExample : public hex::View {
|
||||
public:
|
||||
ViewExample() : hex::View("Example") { }
|
||||
~ViewExample() override { }
|
||||
|
||||
void drawContent() override {
|
||||
if (ImGui::Begin("Example")) {
|
||||
ImGui::TextUnformatted("Custom plugin window");
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
};
|
||||
|
||||
IMHEX_PLUGIN_SETUP("Example C++", "WerWolv", "Example C++ plugin used as template for plugin devs") {
|
||||
|
||||
hex::ContentRegistry::Views::add<ViewExample>();
|
||||
}
|
|
@ -1,42 +0,0 @@
|
|||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
# Change this to the name of your plugin #
|
||||
project(example_rust)
|
||||
|
||||
# ---- No need to change anything from here downwards unless you know what you're doing ---- #
|
||||
|
||||
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
|
||||
set(CARGO_CMD ${RUST_PATH}cargo build)
|
||||
set(TARGET_DIR "debug")
|
||||
else ()
|
||||
set(CARGO_CMD ${RUST_PATH}cargo build --release)
|
||||
set(TARGET_DIR "release")
|
||||
endif ()
|
||||
|
||||
if (WIN32)
|
||||
set(PLUGIN_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_DIR}/${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
else ()
|
||||
set(PLUGIN_OUTPUT_PATH "${CMAKE_CURRENT_BINARY_DIR}/${TARGET_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${PROJECT_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}")
|
||||
endif ()
|
||||
|
||||
get_target_property(LIBIMHEX_SOURCE_DIRECTORY libimhex SOURCE_DIR)
|
||||
|
||||
add_custom_target(${PROJECT_NAME} ALL
|
||||
COMMAND ${CMAKE_COMMAND} -E env
|
||||
CARGO_TARGET_DIR=${CMAKE_CURRENT_BINARY_DIR}
|
||||
LIBIMHEX_SOURCE_DIRECTORY=${LIBIMHEX_SOURCE_DIRECTORY}
|
||||
LIBIMHEX_OUTPUT_DIRECTORY=$<TARGET_FILE_DIR:libimhex>
|
||||
CXX_COMPILER=${CMAKE_CXX_COMPILER}
|
||||
IMHEX_VERSION=${IMHEX_VERSION_STRING}
|
||||
${CARGO_CMD}
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${PLUGIN_OUTPUT_PATH} "${CMAKE_CURRENT_BINARY_DIR}/../${PROJECT_NAME}.hexplug"
|
||||
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
|
||||
VERBATIM
|
||||
USES_TERMINAL
|
||||
)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES LOCATION ${CMAKE_CURRENT_BINARY_DIR})
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES RUST_PROJECT 1)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES LINKER_LANGUAGE Rust)
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
||||
|
||||
add_compile_definitions(IMHEX_PROJECT_NAME="${PROJECT_NAME}")
|
|
@ -1,15 +0,0 @@
|
|||
[package]
|
||||
name = "example_rust"
|
||||
version = "0.1.0"
|
||||
authors = ["WerWolv <hey@werwolv.net>"]
|
||||
edition = "2018"
|
||||
|
||||
[lib]
|
||||
crate-type = ["cdylib"]
|
||||
path = "source/plugin_example.rs"
|
||||
|
||||
[dependencies]
|
||||
hex = { package = "libimhex-rs", path = "../../lib/libimhex-rs" }
|
||||
|
||||
[profile.release]
|
||||
lto = true
|
|
@ -1,5 +0,0 @@
|
|||
extern crate hex;
|
||||
|
||||
#[hex::plugin_setup("Example Rust", "WerWolv", "Example Rust plugin used as template for plugin devs")]
|
||||
fn init() {}
|
||||
|
Loading…
Reference in New Issue