From 70e3b4dd1a96e7d1ac27e79bdfbc251c8836af51 Mon Sep 17 00:00:00 2001 From: WerWolv Date: Thu, 4 Jan 2024 17:55:53 +0100 Subject: [PATCH] build: Cleanup build script a bit --- CMakeLists.txt | 5 +++-- cmake/build_helpers.cmake | 19 +++++-------------- .../builtin/source/content/data_inspector.cpp | 2 +- 3 files changed, 9 insertions(+), 17 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 086073f7f..f0b7c9532 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -43,8 +43,9 @@ detectBundledPlugins() # Add various defines detectOS() -detectArch() addDefines() + +# Configure packaging and install targets configurePackingResources() setUninstallTarget() addBundledLibraries() @@ -59,7 +60,7 @@ add_subdirectory(main) enable_testing() add_subdirectory(tests EXCLUDE_FROM_ALL) -# Configure packaging +# Configure more resources that will be added to the install package createPackage() generatePDBs() generateSDKDirectory() \ No newline at end of file diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index 66e371baf..a0be0157f 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -68,8 +68,10 @@ macro(detectOS) set(PLUGINS_INSTALL_LOCATION "share/imhex/plugins") else() set(PLUGINS_INSTALL_LOCATION "${CMAKE_INSTALL_LIBDIR}/imhex/plugins") - # Warning : Do not work with portable versions such as appimage (because the path is hardcoded) - add_compile_definitions(SYSTEM_PLUGINS_LOCATION="${CMAKE_INSTALL_FULL_LIBDIR}/imhex") # "plugins" will be appended from the app + + # Add System plugin location for plugins to be loaded from + # IMPORTANT: This does not work for Sandboxed or portable builds such as the Flatpak or AppImage release + add_compile_definitions(SYSTEM_PLUGINS_LOCATION="${CMAKE_INSTALL_FULL_LIBDIR}/imhex") endif() else () @@ -78,16 +80,6 @@ macro(detectOS) endmacro() -# Detect 32 vs. 64 bit system -macro(detectArch) - if(CMAKE_SIZEOF_VOID_P EQUAL 8) - add_compile_definitions(ARCH_64_BIT) - elseif(CMAKE_SIZEOF_VOID_P EQUAL 4) - add_compile_definitions(ARCH_32_BIT) - endif() -endmacro() - - macro(configurePackingResources) if (WIN32) if (NOT (CMAKE_BUILD_TYPE STREQUAL "Debug")) @@ -247,7 +239,6 @@ macro(createPackage) # Fix rpath add_custom_command(TARGET imhex_all POST_BUILD COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath "@executable_path/../Frameworks/" $) - # FIXME: Remove this once we move/integrate the plugins directory. add_custom_target(build-time-make-plugins-directory ALL COMMAND ${CMAKE_COMMAND} -E make_directory "${IMHEX_BUNDLE_PATH}/Contents/MacOS/plugins") add_custom_target(build-time-make-resources-directory ALL COMMAND ${CMAKE_COMMAND} -E make_directory "${IMHEX_BUNDLE_PATH}/Contents/Resources") @@ -282,7 +273,7 @@ macro(createPackage) endif() if (IMHEX_GENERATE_PACKAGE) - set (CPACK_BUNDLE_NAME "ImHex") + set(CPACK_BUNDLE_NAME "ImHex") include(CPack) endif() diff --git a/plugins/builtin/source/content/data_inspector.cpp b/plugins/builtin/source/content/data_inspector.cpp index c8ce55c36..e23362896 100644 --- a/plugins/builtin/source/content/data_inspector.cpp +++ b/plugins/builtin/source/content/data_inspector.cpp @@ -464,7 +464,7 @@ namespace hex::plugin::builtin { } ); -#if defined(OS_WINDOWS) && defined(ARCH_64_BIT) +#if defined(OS_WINDOWS) ContentRegistry::DataInspector::add("hex.builtin.inspector.time32", sizeof(u32), [](auto buffer, auto endian, auto style) { hex::unused(style);