diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5945ebed4..a217deac4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -60,16 +60,18 @@ jobs: mkdir -p build cd build - cmake -G "Ninja" \ - -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ - -DCMAKE_INSTALL_PREFIX="$PWD/install" \ - -DIMHEX_GENERATE_PACKAGE=ON \ - -DIMHEX_USE_DEFAULT_BUILD_SETTINGS=ON \ - -DIMHEX_PATTERNS_PULL_MASTER=ON \ - -DIMHEX_COMMIT_HASH_SHORT="${GITHUB_SHA::7}" \ - -DIMHEX_COMMIT_HASH_LONG="${GITHUB_SHA}" \ - -DIMHEX_COMMIT_BRANCH="${GITHUB_REF##*/}" \ - -DUSE_SYSTEM_CAPSTONE=ON \ + cmake -G "Ninja" \ + -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} \ + -DCMAKE_INSTALL_PREFIX="$PWD/install" \ + -DIMHEX_GENERATE_PACKAGE=ON \ + -DIMHEX_USE_DEFAULT_BUILD_SETTINGS=ON \ + -DIMHEX_PATTERNS_PULL_MASTER=ON \ + -DIMHEX_COMMIT_HASH_SHORT="${GITHUB_SHA::7}" \ + -DIMHEX_COMMIT_HASH_LONG="${GITHUB_SHA}" \ + -DIMHEX_COMMIT_BRANCH="${GITHUB_REF##*/}" \ + -DUSE_SYSTEM_CAPSTONE=ON \ + -DIMHEX_GENERATE_PDBS=ON \ + -DIMHEX_REPLACE_DWARF_WITH_PDB=ON \ -DDOTNET_EXECUTABLE="C:/Program Files/dotnet/dotnet.exe" \ .. diff --git a/CMakeLists.txt b/CMakeLists.txt index df22e8663..ab6b99a9d 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,13 +1,13 @@ cmake_minimum_required(VERSION 3.20) # Options -option(IMHEX_PLUGINS_IN_SHARE "Put the plugins in share/imhex/plugins instead of lib[..]/imhex/plugins" OFF) +option(IMHEX_PLUGINS_IN_SHARE "Put the plugins in share/imhex/plugins instead of lib[..]/imhex/plugins (Linux only)" OFF) option(IMHEX_STRIP_RELEASE "Strip the release builds" ON) option(IMHEX_OFFLINE_BUILD "Enable offline build" OFF) option(IMHEX_IGNORE_BAD_CLONE "Disable the bad clone prevention checks" OFF) option(IMHEX_PATTERNS_PULL_MASTER "Download latest files from master branch of the ImHex-Patterns repo" OFF) option(IMHEX_IGNORE_BAD_COMPILER "Allow compiling with an unsupported compiler" OFF) -option(IMHEX_USE_GTK_FILE_PICKER "Use GTK file picker instead of xdg-desktop-portals" OFF) +option(IMHEX_USE_GTK_FILE_PICKER "Use GTK file picker instead of xdg-desktop-portals (Linux only)" OFF) option(IMHEX_DISABLE_STACKTRACE "Disables support for printing stack traces" OFF) option(IMHEX_BUNDLE_DOTNET "Bundle .NET runtime" ON) option(IMHEX_ENABLE_LTO "Enables Link Time Optimizations if possible" OFF) @@ -16,7 +16,8 @@ option(IMHEX_STRICT_WARNINGS "Enable most available warnings and treat them as e option(IMHEX_STATIC_LINK_PLUGINS "Statically link all plugins into the main executable" OFF) option(IMHEX_GENERATE_PACKAGE "Specify if a native package should be built. (Windows and MacOS only)" OFF) option(IMHEX_ENABLE_UNITY_BUILD "Enables building ImHex as a unity build." OFF) -option(IMHEX_GENERATE_PDBS "Enable generating PDB files in non-debug builds" ON) +option(IMHEX_GENERATE_PDBS "Enable generating PDB files in non-debug builds (Windows only)" OFF) +option(IMHEX_REPLACE_DWARF_WITH_PDB "Remove DWARF information from binaries when generating PDBS (Windows only)" OFF) option(IMHEX_ENABLE_STD_ASSERTS "Enable debug asserts in the C++ std library. (Breaks Plugin ABI!)" OFF) # Basic compiler and cmake configurations diff --git a/cmake/build_helpers.cmake b/cmake/build_helpers.cmake index d290bd366..d034367eb 100644 --- a/cmake/build_helpers.cmake +++ b/cmake/build_helpers.cmake @@ -678,13 +678,19 @@ function(generatePDBs) set(GENERATED_PDB plugins/${PDB}) endif () + if (IMHEX_REPLACE_DWARF_WITH_PDB) + set(PDB_OUTPUT_PATH ${CMAKE_BINARY_DIR}/${GENERATED_PDB}) + else () + set(PDB_OUTPUT_PATH) + endif() + add_custom_target(${PDB}_pdb DEPENDS ${CMAKE_BINARY_DIR}/${GENERATED_PDB}.pdb) add_custom_command(OUTPUT ${CMAKE_BINARY_DIR}/${GENERATED_PDB}.pdb WORKING_DIRECTORY ${CMAKE_BINARY_DIR} COMMAND ( ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/${GENERATED_PDB}.pdb && - ${cv2pdb_SOURCE_DIR}/cv2pdb64.exe $ ${CMAKE_BINARY_DIR}/${GENERATED_PDB} && + ${cv2pdb_SOURCE_DIR}/cv2pdb64.exe $ ${PDB_OUTPUT_PATH} && ${CMAKE_COMMAND} -E remove -f ${CMAKE_BINARY_DIR}/${GENERATED_PDB} ) || (exit 0) COMMAND_EXPAND_LISTS) @@ -705,9 +711,9 @@ function(generateSDKDirectory) set(SDK_PATH "share/imhex/sdk") endif() - install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/libimhex DESTINATION "${SDK_PATH}/lib") - install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/external DESTINATION "${SDK_PATH}/lib") - install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/third_party/imgui DESTINATION "${SDK_PATH}/lib/third_party") + install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/libimhex DESTINATION "${SDK_PATH}/lib" PATTERN "**/source/*" EXCLUDE) + install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/external DESTINATION "${SDK_PATH}/lib" PATTERN "**/source/*" EXCLUDE) + install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/third_party/imgui DESTINATION "${SDK_PATH}/lib/third_party" PATTERN "**/source/*" EXCLUDE) if (NOT USE_SYSTEM_FMT) install(DIRECTORY ${CMAKE_SOURCE_DIR}/lib/third_party/fmt DESTINATION "${SDK_PATH}/lib/third_party") endif() @@ -719,8 +725,6 @@ function(generateSDKDirectory) install(FILES ${CMAKE_SOURCE_DIR}/cmake/build_helpers.cmake DESTINATION "${SDK_PATH}/cmake") install(DIRECTORY ${CMAKE_SOURCE_DIR}/cmake/sdk/ DESTINATION "${SDK_PATH}") install(TARGETS libimhex ARCHIVE DESTINATION "${SDK_PATH}/lib") - install(TARGETS libimhex RUNTIME DESTINATION "${SDK_PATH}/lib") - install(TARGETS libimhex LIBRARY DESTINATION "${SDK_PATH}/lib") endfunction() function(addIncludesFromLibrary target library) diff --git a/cmake/sdk/CMakeLists.txt b/cmake/sdk/CMakeLists.txt index 6806d6e71..d1f00d008 100644 --- a/cmake/sdk/CMakeLists.txt +++ b/cmake/sdk/CMakeLists.txt @@ -43,15 +43,16 @@ add_subdirectory(lib/libimhex) if (WIN32) set_target_properties(libimhex PROPERTIES - IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex.dll" + IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/../libimhex.dll" IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/lib/liblibimhex.dll.a" INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex/include") elseif (APPLE) + file(GLOB LIBIMHEX_DYLIB "${CMAKE_CURRENT_SOURCE_DIR}/../../Frameworks/libimhex.*.dylib") set_target_properties(libimhex PROPERTIES - IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex.dylib" + IMPORTED_LOCATION "${LIBIMHEX_DYLIB}" INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex/include") else() set_target_properties(libimhex PROPERTIES - IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex.so" + IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/../libimhex.so" INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex/include") endif()