1
0
mirror of synced 2024-11-12 02:00:52 +01:00

build: Link libraries to relevant projects

This commit is contained in:
WerWolv 2021-12-14 20:16:59 +01:00
parent e25d98ef63
commit 78b3f5aef1
5 changed files with 19 additions and 21 deletions

View File

@ -18,8 +18,6 @@ set(PLUGINS
# example_rust
)
findLibraries()
detectOS()
detectArch()

View File

@ -27,22 +27,13 @@ macro(addVersionDefines)
set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DRELEASE -DIMHEX_VERSION=\"\\\"${PROJECT_VERSION}-ReleaseMinimumSize\"\\\"")
endmacro()
macro(findLibraries)
macro(configurePython)
set(CMAKE_FIND_PACKAGE_SORT_ORDER NATURAL)
set(CMAKE_FIND_PACKAGE_SORT_DIRECTION DEC)
# Enforce that we use non system Python 3 on macOS.
set(Python_FIND_FRAMEWORK NEVER)
# Find packages
find_package(PkgConfig REQUIRED)
find_package(mbedTLS 2.26.0 REQUIRED)
pkg_search_module(CAPSTONE 4.0.2 REQUIRED capstone)
find_package(OpenGL REQUIRED)
find_package(Python COMPONENTS Development REQUIRED)
if(Python_VERSION LESS 3)
message(STATUS ${PYTHON_VERSION_MAJOR_MINOR})
@ -59,13 +50,6 @@ macro(findLibraries)
list(JOIN PYTHON_VERSION_MAJOR_MINOR "." PYTHON_VERSION_MAJOR_MINOR)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${CMAKE_C_FLAGS} -DPYTHON_VERSION_MAJOR_MINOR=\"\\\"${PYTHON_VERSION_MAJOR_MINOR}\"\\\"")
pkg_search_module(MAGIC libmagic>=5.39)
if(NOT MAGIC_FOUND)
find_library(MAGIC 5.39 magic REQUIRED)
else()
set(MAGIC_INCLUDE_DIRS ${MAGIC_INCLUDEDIR})
endif()
endmacro()
# Detect current OS / System

View File

@ -5,6 +5,7 @@ set(CMAKE_CXX_STANDARD 17)
find_package(PkgConfig REQUIRED)
find_package(Freetype REQUIRED)
find_package(OpenGL REQUIRED)
pkg_search_module(GLFW REQUIRED glfw3)
if (UNIX)

View File

@ -52,10 +52,12 @@ add_library(${PROJECT_NAME} SHARED
# Add additional include directories here #
target_include_directories(${PROJECT_NAME} PRIVATE include)
# Add additional libraries here #
target_link_libraries(${PROJECT_NAME} PRIVATE libimhex LLVMDemangle)
find_package(PkgConfig REQUIRED)
pkg_search_module(CAPSTONE 4.0.2 REQUIRED capstone)
target_link_libraries(${PROJECT_NAME} PRIVATE libimhex LLVMDemangle capstone)
# ---- No need to change anything from here downwards unless you know what you're doing ---- #

View File

@ -13,6 +13,9 @@ set(CMAKE_USE_MBEDTLS ON)
set(BUILD_CURL_EXE OFF)
set(FPHSA_NAME_MISMATCHED ON CACHE BOOL "")
# Find packages
find_package(PkgConfig REQUIRED)
if(NOT USE_SYSTEM_NLOHMANN_JSON)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/../../external/nlohmann_json ${CMAKE_CURRENT_BINARY_DIR}/external/nlohmann_json)
set(NLOHMANN_JSON_LIBRARIES nlohmann_json)
@ -52,6 +55,16 @@ else()
pkg_check_modules(YARA REQUIRED IMPORTED_TARGET yara)
endif()
find_package(mbedTLS 2.26.0 REQUIRED)
configurePython()
pkg_search_module(MAGIC libmagic>=5.39)
if(NOT MAGIC_FOUND)
find_library(MAGIC 5.39 magic REQUIRED)
else()
set(MAGIC_INCLUDE_DIRS ${MAGIC_INCLUDEDIR})
endif()
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
if (WIN32)