mirror of
https://github.com/momo5502/emulator.git
synced 2026-01-10 16:16:16 +00:00
Support disabling rust code
This commit is contained in:
@@ -4,18 +4,13 @@ cmake_minimum_required(VERSION 3.26.4)
|
||||
|
||||
option(MOMO_ENABLE_SANITIZER "Enable sanitizer" OFF)
|
||||
option(MOMO_ENABLE_CLANG_TIDY "Enable clang-tidy checks" OFF)
|
||||
option(MOMO_ENABLE_RUST_CODE "Enable code parts written in rust" ON)
|
||||
option(MOMO_BUILD_AS_LIBRARY "Configure and Build the emulator as a shared library (without the samples and tests)" OFF)
|
||||
|
||||
set(MOMO_REFLECTION_LEVEL "0" CACHE STRING "Reflection level for the build")
|
||||
message(STATUS "Reflection level is set to: ${MOMO_REFLECTION_LEVEL}")
|
||||
add_compile_definitions(MOMO_REFLECTION_LEVEL=${MOMO_REFLECTION_LEVEL})
|
||||
|
||||
if(MOMO_BUILD_AS_LIBRARY)
|
||||
add_compile_definitions(MOMO_BUILD_AS_LIBRARY=1)
|
||||
else()
|
||||
add_compile_definitions(MOMO_BUILD_AS_LIBRARY=0)
|
||||
endif()
|
||||
|
||||
##########################################
|
||||
|
||||
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
|
||||
|
||||
@@ -51,6 +51,7 @@ Click <a href="https://docs.google.com/presentation/d/1pha4tFfDMpVzJ_ehJJ21SA_HA
|
||||
* Windows 64-bit (click [here](https://github.com/momo5502/emulator/milestone/1) for cross-platform status)
|
||||
* CMake
|
||||
* Git
|
||||
* Rust (pass `-DMOMO_ENABLE_RUST_CODE=0` to cmake to disable requirement)
|
||||
|
||||
### Getting Started
|
||||
|
||||
|
||||
@@ -25,6 +25,22 @@ set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
||||
|
||||
##########################################
|
||||
|
||||
if(MOMO_BUILD_AS_LIBRARY)
|
||||
add_compile_definitions(MOMO_BUILD_AS_LIBRARY=1)
|
||||
else()
|
||||
add_compile_definitions(MOMO_BUILD_AS_LIBRARY=0)
|
||||
endif()
|
||||
|
||||
##########################################
|
||||
|
||||
if(MOMO_ENABLE_RUST_CODE)
|
||||
add_compile_definitions(MOMO_ENABLE_RUST_CODE=1)
|
||||
else()
|
||||
add_compile_definitions(MOMO_ENABLE_RUST_CODE=0)
|
||||
endif()
|
||||
|
||||
##########################################
|
||||
|
||||
if(UNIX)
|
||||
momo_add_c_and_cxx_compile_options(
|
||||
-fvisibility=hidden
|
||||
|
||||
@@ -2,11 +2,14 @@ add_subdirectory(common)
|
||||
add_subdirectory(emulator)
|
||||
add_subdirectory(gdb-stub)
|
||||
add_subdirectory(unicorn-emulator)
|
||||
add_subdirectory(icicle-emulator)
|
||||
add_subdirectory(icicle)
|
||||
add_subdirectory(windows-emulator)
|
||||
add_subdirectory(windows-gdb-stub)
|
||||
|
||||
if (MOMO_ENABLE_RUST_CODE)
|
||||
add_subdirectory(icicle-emulator)
|
||||
add_subdirectory(icicle)
|
||||
endif()
|
||||
|
||||
if (NOT MOMO_BUILD_AS_LIBRARY)
|
||||
add_subdirectory(analyzer)
|
||||
add_subdirectory(fuzzing-engine)
|
||||
|
||||
@@ -16,8 +16,13 @@ endif()
|
||||
|
||||
target_link_libraries(windows-emulator PRIVATE
|
||||
unicorn-emulator
|
||||
)
|
||||
|
||||
if (MOMO_ENABLE_RUST_CODE)
|
||||
target_link_libraries(windows-emulator PRIVATE
|
||||
icicle-emulator
|
||||
)
|
||||
endif()
|
||||
|
||||
target_link_libraries(windows-emulator PUBLIC emulator)
|
||||
|
||||
|
||||
@@ -4,7 +4,10 @@
|
||||
#include "cpu_context.hpp"
|
||||
|
||||
#include <unicorn_x64_emulator.hpp>
|
||||
|
||||
#if MOMO_ENABLE_RUST_CODE
|
||||
#include <icicle_x64_emulator.hpp>
|
||||
#endif
|
||||
|
||||
#include <utils/io.hpp>
|
||||
#include <utils/finally.hpp>
|
||||
|
||||
Reference in New Issue
Block a user