2020-12-22 18:10:01 +01:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
|
|
|
project(libimhex)
|
|
|
|
|
|
|
|
set(CMAKE_CXX_STANDARD 20)
|
|
|
|
|
2021-04-18 20:24:42 +02:00
|
|
|
set(BUILD_SHARED_LIBS OFF)
|
2020-12-27 14:12:53 +01:00
|
|
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/ImGui ${CMAKE_CURRENT_BINARY_DIR}/external/ImGui)
|
2021-05-23 12:16:14 +02:00
|
|
|
|
2021-05-23 14:16:38 +02:00
|
|
|
if(NOT USE_SYSTEM_NLOHMANN_JSON)
|
2021-05-23 12:16:14 +02:00
|
|
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/nlohmann_json ${CMAKE_CURRENT_BINARY_DIR}/external/nlohmann_json)
|
2021-05-23 14:16:38 +02:00
|
|
|
else()
|
|
|
|
find_package(nlohmann_json REQUIRED)
|
2021-05-23 12:16:14 +02:00
|
|
|
endif()
|
|
|
|
|
2021-04-20 22:11:50 +02:00
|
|
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/nativefiledialog ${CMAKE_CURRENT_BINARY_DIR}/external/nativefiledialog EXCLUDE_FROM_ALL)
|
2021-05-23 14:16:38 +02:00
|
|
|
if(NOT USE_SYSTEM_FMT)
|
|
|
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/fmt ${CMAKE_CURRENT_BINARY_DIR}/external/fmt)
|
|
|
|
else()
|
|
|
|
find_package(fmt REQUIRED)
|
|
|
|
endif()
|
2021-05-23 12:16:14 +02:00
|
|
|
|
2021-03-01 08:56:49 +01:00
|
|
|
set(XDGPP_INCLUDE_DIRS "${CMAKE_CURRENT_SOURCE_DIR}/../../external/xdgpp")
|
2021-04-18 20:24:42 +02:00
|
|
|
set(CMAKE_USE_MBEDTLS ON)
|
|
|
|
set(BUILD_CURL_EXE OFF)
|
|
|
|
set(FPHSA_NAME_MISMATCHED ON CACHE BOOL "")
|
2021-05-23 14:16:38 +02:00
|
|
|
|
|
|
|
if(NOT USE_SYSTEM_CURL)
|
|
|
|
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/curl ${CMAKE_CURRENT_BINARY_DIR}/external/curl EXCLUDE_FROM_ALL)
|
|
|
|
set_target_properties(libcurl PROPERTIES POSITION_INDEPENDENT_CODE ON)
|
|
|
|
else()
|
|
|
|
find_package(PkgConfig REQUIRED)
|
|
|
|
pkg_check_modules(LIBCURL REQUIRED IMPORTED_TARGET libcurl)
|
|
|
|
endif()
|
2020-12-22 18:10:01 +01:00
|
|
|
|
2021-01-12 23:28:41 +01:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
|
|
|
|
|
2021-01-12 23:49:51 +01:00
|
|
|
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
|
|
|
|
2021-03-01 08:56:49 +01:00
|
|
|
set(LIBIMHEX_SOURCES
|
|
|
|
source/api/event.cpp
|
|
|
|
source/api/imhex_api.cpp
|
|
|
|
source/api/content_registry.cpp
|
|
|
|
|
|
|
|
source/helpers/utils.cpp
|
|
|
|
source/helpers/shared_data.cpp
|
|
|
|
source/helpers/crypto.cpp
|
|
|
|
source/helpers/lang.cpp
|
2021-04-18 20:24:42 +02:00
|
|
|
source/helpers/net.cpp
|
2021-03-01 08:56:49 +01:00
|
|
|
|
|
|
|
source/lang/pattern_language.cpp
|
|
|
|
source/lang/preprocessor.cpp
|
|
|
|
source/lang/lexer.cpp
|
|
|
|
source/lang/parser.cpp
|
|
|
|
source/lang/validator.cpp
|
|
|
|
source/lang/evaluator.cpp
|
|
|
|
source/providers/provider.cpp
|
2021-02-03 11:54:41 +01:00
|
|
|
|
2021-03-01 08:56:49 +01:00
|
|
|
source/views/view.cpp
|
|
|
|
)
|
2020-12-27 14:12:53 +01:00
|
|
|
|
2021-03-01 08:56:49 +01:00
|
|
|
if (APPLE)
|
|
|
|
set(OSX_11_0_SDK_PATH /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk)
|
|
|
|
if (NOT CMAKE_OSX_SYSROOT)
|
|
|
|
if (IS_DIRECTORY ${OSX_11_0_SDK_PATH})
|
|
|
|
set(CMAKE_OSX_SYSROOT ${OSX_11_0_SDK_PATH})
|
|
|
|
else ()
|
|
|
|
message(WARNING "CMAKE_OSX_SYSROOT not set and macOS 10.9 SDK not found! Using default one.")
|
|
|
|
endif ()
|
|
|
|
endif ()
|
2021-01-11 23:54:12 +01:00
|
|
|
|
2021-03-01 08:56:49 +01:00
|
|
|
set(LIBIMHEX_SOURCES ${LIBIMHEX_SOURCES} source/helpers/utils_mac.mm)
|
|
|
|
endif ()
|
2020-12-27 14:12:53 +01:00
|
|
|
|
2021-03-01 08:56:49 +01:00
|
|
|
add_library(libimhex SHARED ${LIBIMHEX_SOURCES})
|
2020-12-22 18:10:01 +01:00
|
|
|
|
2021-03-01 08:56:49 +01:00
|
|
|
target_include_directories(libimhex PUBLIC include ${MBEDTLS_INCLUDE_DIR} ${XDGPP_INCLUDE_DIRS})
|
2021-05-23 14:16:38 +02:00
|
|
|
|
|
|
|
if (USE_SYSTEM_FMT)
|
|
|
|
target_include_directories(libimhex PUBLIC include ${FMT_INCLUDE_DIRS})
|
|
|
|
endif()
|
|
|
|
if (USE_SYSTEM_CURL)
|
|
|
|
target_include_directories(libimhex PUBLIC include ${CURL_INCLUDE_DIRS})
|
|
|
|
endif()
|
|
|
|
|
2021-02-07 22:57:34 +01:00
|
|
|
target_link_directories(libimhex PUBLIC ${MBEDTLS_LIBRARY_DIR})
|
2021-02-03 11:54:41 +01:00
|
|
|
|
2021-04-18 20:24:42 +02:00
|
|
|
if (APPLE)
|
2021-03-01 08:56:49 +01:00
|
|
|
find_library(FOUNDATION NAMES Foundation)
|
2021-04-18 20:24:42 +02:00
|
|
|
target_link_libraries(libimhex PUBLIC imgui nlohmann_json mbedcrypto ${FOUNDATION} nfd fmt-header-only libcurl)
|
|
|
|
else ()
|
2021-05-23 14:16:38 +02:00
|
|
|
target_link_libraries(libimhex PUBLIC imgui nlohmann_json mbedcrypto nfd)
|
|
|
|
|
|
|
|
if (NOT USE_SYSTEM_FMT)
|
|
|
|
target_link_libraries(libimhex PUBLIC fmt-header-only)
|
|
|
|
else()
|
|
|
|
target_link_libraries(libimhex PUBLIC fmt)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if (NOT USE_SYSTEM_CURL)
|
|
|
|
target_link_libraries(libimhex PUBLIC libcurl)
|
|
|
|
else()
|
|
|
|
target_link_libraries(libimhex PUBLIC curl)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
endif ()
|