CMakeLists: Add DYNARMIC_FRONTENDS option

Allows library user to select which frontends to enable
This commit is contained in:
MerryMage 2020-04-18 10:34:02 +01:00
parent a59eedade1
commit 7c917f1c12
3 changed files with 186 additions and 156 deletions

View file

@ -8,10 +8,16 @@ if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(MASTER_PROJECT ON) set(MASTER_PROJECT ON)
endif() endif()
# CMake policites
if(POLICY CMP0077)
cmake_policy(SET CMP0077 NEW) # CMake 3.13 - option() honors normal variables
endif()
# Dynarmic project options # Dynarmic project options
option(DYNARMIC_ENABLE_CPU_FEATURE_DETECTION "Turning this off causes dynarmic to assume the host CPU doesn't support anything later than SSE3" ON) option(DYNARMIC_ENABLE_CPU_FEATURE_DETECTION "Turning this off causes dynarmic to assume the host CPU doesn't support anything later than SSE3" ON)
option(DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT "Enables support for systems that require W^X" OFF) option(DYNARMIC_ENABLE_NO_EXECUTE_SUPPORT "Enables support for systems that require W^X" OFF)
option(DYNARMIC_FATAL_ERRORS "Errors are fatal" OFF) option(DYNARMIC_FATAL_ERRORS "Errors are fatal" OFF)
option(DYNARMIC_FRONTENDS "Selects which frontends to enable" "A32;A64")
option(DYNARMIC_TESTS "Build tests" ${MASTER_PROJECT}) option(DYNARMIC_TESTS "Build tests" ${MASTER_PROJECT})
option(DYNARMIC_TESTS_USE_UNICORN "Enable fuzzing tests against unicorn" OFF) option(DYNARMIC_TESTS_USE_UNICORN "Enable fuzzing tests against unicorn" OFF)
option(DYNARMIC_USE_LLVM "Support disassembly of jitted x86_64 code using LLVM" OFF) option(DYNARMIC_USE_LLVM "Support disassembly of jitted x86_64 code using LLVM" OFF)

View file

@ -69,6 +69,38 @@ add_library(dynarmic
common/u128.cpp common/u128.cpp
common/u128.h common/u128.h
common/variant_util.h common/variant_util.h
frontend/A32/types.cpp
frontend/A32/types.h
frontend/A64/types.cpp
frontend/A64/types.h
frontend/decoder/decoder_detail.h
frontend/decoder/matcher.h
frontend/imm.h
frontend/ir/basic_block.cpp
frontend/ir/basic_block.h
frontend/ir/cond.h
frontend/ir/ir_emitter.cpp
frontend/ir/ir_emitter.h
frontend/ir/location_descriptor.cpp
frontend/ir/location_descriptor.h
frontend/ir/microinstruction.cpp
frontend/ir/microinstruction.h
frontend/ir/opcodes.cpp
frontend/ir/opcodes.h
frontend/ir/opcodes.inc
frontend/ir/terminal.h
frontend/ir/type.cpp
frontend/ir/type.h
frontend/ir/value.cpp
frontend/ir/value.h
ir_opt/constant_propagation_pass.cpp
ir_opt/dead_code_elimination_pass.cpp
ir_opt/passes.h
ir_opt/verification_pass.cpp
)
if ("A32" IN_LIST DYNARMIC_FRONTENDS)
target_sources(dynarmic PRIVATE
frontend/A32/decoder/arm.h frontend/A32/decoder/arm.h
frontend/A32/decoder/arm.inc frontend/A32/decoder/arm.inc
frontend/A32/decoder/thumb16.h frontend/A32/decoder/thumb16.h
@ -112,8 +144,13 @@ add_library(dynarmic
frontend/A32/translate/translate.h frontend/A32/translate/translate.h
frontend/A32/translate/translate_arm.cpp frontend/A32/translate/translate_arm.cpp
frontend/A32/translate/translate_thumb.cpp frontend/A32/translate/translate_thumb.cpp
frontend/A32/types.cpp ir_opt/a32_constant_memory_reads_pass.cpp
frontend/A32/types.h ir_opt/a32_get_set_elimination_pass.cpp
)
endif()
if ("A64" IN_LIST DYNARMIC_FRONTENDS)
target_sources(dynarmic PRIVATE
frontend/A64/decoder/a64.h frontend/A64/decoder/a64.h
frontend/A64/decoder/a64.inc frontend/A64/decoder/a64.inc
frontend/A64/ir_emitter.cpp frontend/A64/ir_emitter.cpp
@ -180,52 +217,14 @@ add_library(dynarmic
frontend/A64/translate/impl/system_flag_manipulation.cpp frontend/A64/translate/impl/system_flag_manipulation.cpp
frontend/A64/translate/translate.cpp frontend/A64/translate/translate.cpp
frontend/A64/translate/translate.h frontend/A64/translate/translate.h
frontend/A64/types.cpp
frontend/A64/types.h
frontend/decoder/decoder_detail.h
frontend/decoder/matcher.h
frontend/imm.h
frontend/ir/basic_block.cpp
frontend/ir/basic_block.h
frontend/ir/cond.h
frontend/ir/ir_emitter.cpp
frontend/ir/ir_emitter.h
frontend/ir/location_descriptor.cpp
frontend/ir/location_descriptor.h
frontend/ir/microinstruction.cpp
frontend/ir/microinstruction.h
frontend/ir/opcodes.cpp
frontend/ir/opcodes.h
frontend/ir/opcodes.inc
frontend/ir/terminal.h
frontend/ir/type.cpp
frontend/ir/type.h
frontend/ir/value.cpp
frontend/ir/value.h
ir_opt/a32_constant_memory_reads_pass.cpp
ir_opt/a32_get_set_elimination_pass.cpp
ir_opt/a64_callback_config_pass.cpp ir_opt/a64_callback_config_pass.cpp
ir_opt/a64_get_set_elimination_pass.cpp ir_opt/a64_get_set_elimination_pass.cpp
ir_opt/a64_merge_interpret_blocks.cpp ir_opt/a64_merge_interpret_blocks.cpp
ir_opt/constant_propagation_pass.cpp )
ir_opt/dead_code_elimination_pass.cpp endif()
ir_opt/passes.h
ir_opt/verification_pass.cpp
)
if (ARCHITECTURE_x86_64) if (ARCHITECTURE_x86_64)
target_sources(dynarmic PRIVATE target_sources(dynarmic PRIVATE
backend/x64/a32_emit_x64.cpp
backend/x64/a32_emit_x64.h
backend/x64/a32_interface.cpp
backend/x64/a32_jitstate.cpp
backend/x64/a32_jitstate.h
backend/x64/a64_emit_x64.cpp
backend/x64/a64_emit_x64.h
backend/x64/a64_exclusive_monitor.cpp
backend/x64/a64_interface.cpp
backend/x64/a64_jitstate.cpp
backend/x64/a64_jitstate.h
backend/x64/abi.cpp backend/x64/abi.cpp
backend/x64/abi.h backend/x64/abi.h
backend/x64/block_of_code.cpp backend/x64/block_of_code.cpp
@ -259,6 +258,27 @@ if (ARCHITECTURE_x86_64)
backend/x64/reg_alloc.h backend/x64/reg_alloc.h
) )
if ("A32" IN_LIST DYNARMIC_FRONTENDS)
target_sources(dynarmic PRIVATE
backend/x64/a32_emit_x64.cpp
backend/x64/a32_emit_x64.h
backend/x64/a32_interface.cpp
backend/x64/a32_jitstate.cpp
backend/x64/a32_jitstate.h
)
endif()
if ("A64" IN_LIST DYNARMIC_FRONTENDS)
target_sources(dynarmic PRIVATE
backend/x64/a64_emit_x64.cpp
backend/x64/a64_emit_x64.h
backend/x64/a64_exclusive_monitor.cpp
backend/x64/a64_interface.cpp
backend/x64/a64_jitstate.cpp
backend/x64/a64_jitstate.h
)
endif()
if (WIN32) if (WIN32)
target_sources(dynarmic PRIVATE backend/x64/exception_handler_windows.cpp) target_sources(dynarmic PRIVATE backend/x64/exception_handler_windows.cpp)
elseif (APPLE) elseif (APPLE)

View file

@ -1,3 +1,7 @@
if ((NOT "A32" IN_LIST DYNARMIC_FRONTENDS) OR (NOT "A64" IN_LIST DYNARMIC_FRONTENDS))
return()
endif()
add_executable(dynarmic_tests add_executable(dynarmic_tests
A32/test_arm_disassembler.cpp A32/test_arm_disassembler.cpp
A32/test_arm_instructions.cpp A32/test_arm_instructions.cpp