build: Use custom jthread implementation if standard one is not available
This commit is contained in:
parent
eefdbe7ef1
commit
407ec1ceb6
9
.gitmodules
vendored
9
.gitmodules
vendored
@ -18,13 +18,18 @@
|
||||
path = lib/external/capstone
|
||||
url = https://github.com/capstone-engine/capstone
|
||||
ignore = dirty
|
||||
[submodule "lib/external/jthread/jthread"]
|
||||
path = lib/external/jthread/jthread
|
||||
url = https://github.com/josuttis/jthread
|
||||
ignore = dirty
|
||||
|
||||
[submodule "lib/external/libromfs"]
|
||||
path = lib/external/libromfs
|
||||
url = https://github.com/WerWolv/libromfs
|
||||
ignore = dirty
|
||||
[submodule "lib/external/pattern_language"]
|
||||
path = lib/external/pattern_language
|
||||
url = https://github.com/WerWolv/PatternLanguage
|
||||
[submodule "lib/external/libwolv"]
|
||||
path = lib/external/libwolv
|
||||
url = https://github.com/WerWolv/libwolv
|
||||
url = https://github.com/WerWolv/libwolv
|
||||
|
||||
|
@ -382,7 +382,7 @@ function(detectBadClone)
|
||||
|
||||
file (GLOB EXTERNAL_DIRS "lib/external/*")
|
||||
foreach (EXTERNAL_DIR ${EXTERNAL_DIRS})
|
||||
file(GLOB RESULT "${EXTERNAL_DIR}/*")
|
||||
file(GLOB_RECURSE RESULT "${EXTERNAL_DIR}/*")
|
||||
list(LENGTH RESULT ENTRY_COUNT)
|
||||
if(ENTRY_COUNT LESS_EQUAL 1)
|
||||
message(FATAL_ERROR "External dependency ${EXTERNAL_DIR} is empty!\nMake sure to correctly clone ImHex using the --recurse-submodules git option or initialize the submodules manually.")
|
||||
@ -570,6 +570,18 @@ macro(addBundledLibraries)
|
||||
pkg_check_modules(miniaudio REQUIRED IMPORTED_TARGET miniaudio)
|
||||
endif()
|
||||
|
||||
if (NOT USE_SYSTEM_JTHREAD)
|
||||
add_subdirectory(${EXTERN_LIBS_FOLDER}/jthread EXCLUDE_FROM_ALL)
|
||||
set(JTHREAD_LIBRARIES jthread)
|
||||
else()
|
||||
find_path(JOSUTTIS_JTHREAD_INCLUDE_DIRS "condition_variable_any2.hpp")
|
||||
include_directories(${JOSUTTIS_JTHREAD_INCLUDE_DIRS})
|
||||
|
||||
add_library(jthread INTERFACE)
|
||||
target_include_directories(jthread INTERFACE ${JOSUTTIS_JTHREAD_INCLUDE_DIRS})
|
||||
set(JTHREAD_LIBRARIES jthread)
|
||||
endif()
|
||||
|
||||
if (NOT USE_SYSTEM_CAPSTONE)
|
||||
set(CAPSTONE_BUILD_STATIC_RUNTIME OFF CACHE BOOL "Disable shared library building")
|
||||
set(CAPSTONE_BUILD_SHARED OFF CACHE BOOL "Disable shared library building")
|
||||
|
1
dist/web/Dockerfile
vendored
1
dist/web/Dockerfile
vendored
@ -36,7 +36,6 @@ mkdir -p $VCPKG_DEFAULT_BINARY_CACHE
|
||||
|
||||
/vcpkg/vcpkg install --triplet=wasm32-emscripten libmagic
|
||||
/vcpkg/vcpkg install --triplet=wasm32-emscripten freetype
|
||||
/vcpkg/vcpkg install --triplet=wasm32-emscripten josuttis-jthread
|
||||
/vcpkg/vcpkg install --triplet=wasm32-emscripten mbedtls
|
||||
EOF
|
||||
|
||||
|
6
lib/external/jthread/CMakeLists.txt
vendored
Normal file
6
lib/external/jthread/CMakeLists.txt
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.16)
|
||||
|
||||
project(jthread)
|
||||
|
||||
add_library(jthread INTERFACE)
|
||||
target_include_directories(jthread INTERFACE includes)
|
7
lib/external/jthread/includes/jthread.hpp
vendored
Normal file
7
lib/external/jthread/includes/jthread.hpp
vendored
Normal file
@ -0,0 +1,7 @@
|
||||
#pragma once
|
||||
|
||||
#if __has_include(<jthread>)
|
||||
#include <jthread>
|
||||
#else
|
||||
#include "../jthread/source/jthread.hpp"
|
||||
#endif
|
1
lib/external/jthread/jthread
vendored
Submodule
1
lib/external/jthread/jthread
vendored
Submodule
@ -0,0 +1 @@
|
||||
Subproject commit 0fa8d394254886c555d6faccd0a3de819b7d47f8
|
@ -95,7 +95,7 @@ elseif (APPLE)
|
||||
endif ()
|
||||
|
||||
target_link_libraries(libimhex PRIVATE ${FMT_LIBRARIES})
|
||||
target_link_libraries(libimhex PUBLIC dl imgui ${NFD_LIBRARIES} magic ${CAPSTONE_LIBRARIES} LLVMDemangle microtar ${NLOHMANN_JSON_LIBRARIES} ${YARA_LIBRARIES} ${MBEDTLS_LIBRARIES} ${LIBBACKTRACE_LIBRARIES} plcli libpl libpl-gen ${MINIAUDIO_LIBRARIES} libwolv-utils libwolv-io libwolv-hash libwolv-net libwolv-containers)
|
||||
target_link_libraries(libimhex PUBLIC dl imgui ${NFD_LIBRARIES} magic ${CAPSTONE_LIBRARIES} LLVMDemangle microtar ${NLOHMANN_JSON_LIBRARIES} ${YARA_LIBRARIES} ${MBEDTLS_LIBRARIES} ${LIBBACKTRACE_LIBRARIES} plcli libpl libpl-gen ${MINIAUDIO_LIBRARIES} ${JTHREAD_LIBRARIES} libwolv-utils libwolv-io libwolv-hash libwolv-net libwolv-containers)
|
||||
|
||||
set_property(TARGET libimhex PROPERTY INTERPROCEDURAL_OPTIMIZATION FALSE)
|
||||
|
||||
|
@ -17,9 +17,7 @@
|
||||
#include <utility>
|
||||
#include <vector>
|
||||
|
||||
#if defined(OS_WEB)
|
||||
#include <jthread.hpp>
|
||||
#endif
|
||||
|
||||
#include <nlohmann/json.hpp>
|
||||
|
||||
|
@ -12,9 +12,7 @@
|
||||
#include <list>
|
||||
#include <condition_variable>
|
||||
|
||||
#if defined(OS_WEB)
|
||||
#include <jthread.hpp>
|
||||
#endif
|
||||
|
||||
namespace hex {
|
||||
|
||||
|
@ -8,9 +8,9 @@
|
||||
|
||||
#include <filesystem>
|
||||
#include <thread>
|
||||
#include <jthread.hpp>
|
||||
|
||||
#if defined(OS_WEB)
|
||||
#include <jthread.hpp>
|
||||
#include <emscripten.h>
|
||||
#endif
|
||||
|
||||
|
@ -6,6 +6,7 @@
|
||||
|
||||
#include <mutex>
|
||||
#include <thread>
|
||||
#include <jthread.hpp>
|
||||
#include <vector>
|
||||
|
||||
namespace hex::plugin::windows {
|
||||
|
Loading…
Reference in New Issue
Block a user