2026-04-04 20:13:26 +02:00
|
|
|
# Require at least CMake version 3.16 for FetchContent and target_precompiled_headers
|
|
|
|
|
cmake_minimum_required(VERSION 3.16)
|
2020-05-02 13:29:52 -04:00
|
|
|
|
|
|
|
|
# Define the VTIL project
|
2020-11-02 23:33:36 +01:00
|
|
|
project(VTIL-Core)
|
2020-05-02 13:29:52 -04:00
|
|
|
|
2022-01-14 16:32:31 +01:00
|
|
|
# Detect if VTIL-Core is compiled as the root project
|
|
|
|
|
set(VTIL_ROOT_PROJECT OFF)
|
|
|
|
|
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
|
|
|
|
set(VTIL_ROOT_PROJECT ON)
|
2020-05-28 19:44:02 +02:00
|
|
|
|
2022-01-14 16:32:31 +01:00
|
|
|
# Enable solution folder support
|
|
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
|
option(VTIL_BUILD_TESTS "Build tests" ${VTIL_ROOT_PROJECT})
|
2026-04-04 20:13:26 +02:00
|
|
|
option(VTIL_UNITY_BUILD "Enable unity build for faster compilation" OFF)
|
|
|
|
|
option(VTIL_SANITIZE_THREADS "Enable ThreadSanitizer (Clang/GCC only)" OFF)
|
2020-05-02 13:29:52 -04:00
|
|
|
|
2020-11-02 23:33:36 +01:00
|
|
|
# Load the dependencies
|
|
|
|
|
set(CMAKE_FOLDER "VTIL-Core/Dependencies")
|
|
|
|
|
add_subdirectory(Dependencies)
|
2020-05-02 13:29:52 -04:00
|
|
|
|
|
|
|
|
# Include subprojects
|
2020-05-08 02:38:17 +02:00
|
|
|
# The dependency chain order is Common > Architecture + SymEx > Optimizer, so include in that order
|
2020-05-02 13:29:52 -04:00
|
|
|
#
|
2020-11-02 23:33:36 +01:00
|
|
|
set(CMAKE_FOLDER "VTIL-Core")
|
2020-05-02 13:29:52 -04:00
|
|
|
add_subdirectory(VTIL-Common)
|
2020-05-08 02:38:17 +02:00
|
|
|
add_subdirectory(VTIL-SymEx)
|
2020-05-02 13:29:52 -04:00
|
|
|
add_subdirectory(VTIL-Architecture)
|
2020-06-20 10:54:22 +02:00
|
|
|
add_subdirectory(VTIL-Compiler)
|
2020-05-24 12:52:23 -04:00
|
|
|
|
|
|
|
|
# After all other targets are defined, include the VTIL interface target
|
2020-06-21 23:19:12 +02:00
|
|
|
# Use this target in projects that use VTIL: https://github.com/vtil-project/VTIL-Samples
|
2020-05-24 12:52:23 -04:00
|
|
|
#
|
|
|
|
|
add_subdirectory(VTIL)
|
2020-05-28 19:44:02 +02:00
|
|
|
|
|
|
|
|
# Tests
|
|
|
|
|
if(VTIL_BUILD_TESTS)
|
|
|
|
|
add_subdirectory(VTIL-Tests)
|
2022-01-10 22:08:42 +01:00
|
|
|
enable_testing()
|
|
|
|
|
add_test(NAME VTIL-Tests COMMAND "$<TARGET_FILE:VTIL-Tests>")
|
2020-06-21 23:19:12 +02:00
|
|
|
endif()
|