2023-12-22 23:39:38 +01:00
|
|
|
cmake_minimum_required(VERSION 3.20)
|
|
|
|
project(ImHexSDK)
|
|
|
|
|
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_CURRENT_SOURCE_DIR}/cmake/modules")
|
2024-01-29 22:57:39 +01:00
|
|
|
set(CMAKE_POSITION_INDEPENDENT_CODE ON CACHE BOOL "" FORCE)
|
2023-12-22 23:39:38 +01:00
|
|
|
include("${CMAKE_CURRENT_SOURCE_DIR}/cmake/build_helpers.cmake")
|
|
|
|
|
|
|
|
set(IMHEX_BASE_FOLDER ${CMAKE_CURRENT_SOURCE_DIR} PARENT_SCOPE)
|
|
|
|
include(ImHexPlugin)
|
|
|
|
|
|
|
|
function(add_subdirectory_if_exists folder)
|
|
|
|
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${folder}/CMakeLists.txt")
|
2024-01-04 11:34:56 +01:00
|
|
|
add_subdirectory("${folder}" EXCLUDE_FROM_ALL)
|
2023-12-22 23:39:38 +01:00
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
2024-01-04 10:25:29 +01:00
|
|
|
set(IMHEX_EXTERNAL_PLUGIN_BUILD ON PARENT_SCOPE)
|
2024-01-04 10:39:07 +01:00
|
|
|
set(IMHEX_EXTERNAL_PLUGIN_BUILD ON)
|
2023-12-22 23:39:38 +01:00
|
|
|
add_custom_target(imhex_all)
|
|
|
|
|
2024-01-04 11:34:56 +01:00
|
|
|
add_subdirectory(lib/third_party/imgui EXCLUDE_FROM_ALL)
|
2023-12-22 23:39:38 +01:00
|
|
|
|
2024-01-04 10:25:29 +01:00
|
|
|
set(FMT_INSTALL OFF CACHE BOOL "" FORCE)
|
|
|
|
add_subdirectory_if_exists(lib/third_party/fmt)
|
2024-01-25 10:32:53 +01:00
|
|
|
set(FMT_LIBRARIES fmt::fmt-header-only PARENT_SCOPE)
|
2024-01-22 23:35:00 +01:00
|
|
|
set(FMT_LIBRARIES fmt::fmt-header-only)
|
2024-01-04 00:37:56 +01:00
|
|
|
|
2024-01-04 10:25:29 +01:00
|
|
|
add_subdirectory_if_exists(lib/third_party/nlohmann_json)
|
2024-01-25 10:32:53 +01:00
|
|
|
set(NLOHMANN_JSON_LIBRARIES nlohmann_json PARENT_SCOPE)
|
2024-01-22 23:35:00 +01:00
|
|
|
set(NLOHMANN_JSON_LIBRARIES nlohmann_json)
|
2024-01-04 10:25:29 +01:00
|
|
|
|
2024-01-04 11:34:56 +01:00
|
|
|
add_subdirectory(lib/external/libwolv EXCLUDE_FROM_ALL)
|
2023-12-22 23:39:38 +01:00
|
|
|
|
2024-01-04 11:34:56 +01:00
|
|
|
set(LIBPL_ENABLE_CLI OFF CACHE BOOL "" FORCE)
|
|
|
|
add_subdirectory(lib/external/pattern_language EXCLUDE_FROM_ALL)
|
2023-12-22 23:39:38 +01:00
|
|
|
|
2024-01-26 12:36:07 +01:00
|
|
|
find_package(CURL REQUIRED)
|
|
|
|
find_package(mbedTLS 3.4.0 REQUIRED)
|
|
|
|
set(CURL_LIBRARIES ${CURL_LIBRARIES} PARENT_SCOPE)
|
|
|
|
set(MBEDTLS_LIBRARIES ${MBEDTLS_LIBRARIES} PARENT_SCOPE)
|
|
|
|
|
2023-12-22 23:39:38 +01:00
|
|
|
add_subdirectory(lib/libimhex)
|
|
|
|
|
|
|
|
if (WIN32)
|
|
|
|
set_target_properties(libimhex PROPERTIES
|
2024-01-30 21:19:04 +01:00
|
|
|
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/../libimhex.dll"
|
2024-04-27 20:19:26 +02:00
|
|
|
IMPORTED_IMPLIB "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex.dll.a"
|
2023-12-22 23:39:38 +01:00
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex/include")
|
|
|
|
elseif (APPLE)
|
2024-01-30 21:19:04 +01:00
|
|
|
file(GLOB LIBIMHEX_DYLIB "${CMAKE_CURRENT_SOURCE_DIR}/../../Frameworks/libimhex.*.dylib")
|
2023-12-22 23:39:38 +01:00
|
|
|
set_target_properties(libimhex PROPERTIES
|
2024-01-30 21:19:04 +01:00
|
|
|
IMPORTED_LOCATION "${LIBIMHEX_DYLIB}"
|
2023-12-22 23:39:38 +01:00
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex/include")
|
|
|
|
else()
|
|
|
|
set_target_properties(libimhex PROPERTIES
|
2024-01-30 21:19:04 +01:00
|
|
|
IMPORTED_LOCATION "${CMAKE_CURRENT_SOURCE_DIR}/../libimhex.so"
|
2023-12-22 23:39:38 +01:00
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${CMAKE_CURRENT_SOURCE_DIR}/lib/libimhex/include")
|
|
|
|
endif()
|