mirror of https://github.com/x64dbg/zydis
Added feature switch for decoder
This commit is contained in:
parent
610d08960b
commit
57059d4e0d
|
@ -21,6 +21,9 @@ option(ZYDIS_FEATURE_FLAGS
|
||||||
option(ZYDIS_FEATURE_CPUID
|
option(ZYDIS_FEATURE_CPUID
|
||||||
"Include information about CPUID feature-flags"
|
"Include information about CPUID feature-flags"
|
||||||
OFF)
|
OFF)
|
||||||
|
option(ZYDIS_FEATURE_DECODER
|
||||||
|
"Enable instruction decoding and formtting functionality"
|
||||||
|
ON)
|
||||||
option(ZYDIS_FEATURE_ENCODER
|
option(ZYDIS_FEATURE_ENCODER
|
||||||
"Enable instruction encoding functionality"
|
"Enable instruction encoding functionality"
|
||||||
OFF)
|
OFF)
|
||||||
|
@ -78,14 +81,17 @@ endif ()
|
||||||
if (ZYDIS_FEATURE_CPUID)
|
if (ZYDIS_FEATURE_CPUID)
|
||||||
target_compile_definitions("Zydis" PUBLIC "ZYDIS_ENABLE_FEATURE_CPUID")
|
target_compile_definitions("Zydis" PUBLIC "ZYDIS_ENABLE_FEATURE_CPUID")
|
||||||
endif ()
|
endif ()
|
||||||
|
if (ZYDIS_FEATURE_DECODER)
|
||||||
|
target_compile_definitions("Zydis" PUBLIC "ZYDIS_ENABLE_FEATURE_DECODER")
|
||||||
|
endif ()
|
||||||
|
if (ZYDIS_FEATURE_ENCODER)
|
||||||
|
target_compile_definitions("Zydis" PUBLIC "ZYDIS_ENABLE_FEATURE_ENCODER")
|
||||||
|
endif ()
|
||||||
|
|
||||||
target_sources("Zydis"
|
target_sources("Zydis"
|
||||||
PUBLIC
|
PUBLIC
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/CommonTypes.h"
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/CommonTypes.h"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Decoder.h"
|
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/DecoderTypes.h"
|
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Defines.h"
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Defines.h"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Formatter.h"
|
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Mnemonic.h"
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Mnemonic.h"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Register.h"
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Register.h"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/SharedTypes.h"
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/SharedTypes.h"
|
||||||
|
@ -93,19 +99,24 @@ target_sources("Zydis"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Utils.h"
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Utils.h"
|
||||||
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Zydis.h"
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Zydis.h"
|
||||||
PRIVATE
|
PRIVATE
|
||||||
"src/DecoderData.h"
|
|
||||||
"src/SharedData.h"
|
|
||||||
"src/Decoder.c"
|
|
||||||
"src/DecoderData.c"
|
|
||||||
"src/Formatter.c"
|
|
||||||
"src/Mnemonic.c"
|
"src/Mnemonic.c"
|
||||||
"src/Register.c"
|
"src/Register.c"
|
||||||
|
"src/SharedData.h"
|
||||||
"src/SharedData.c"
|
"src/SharedData.c"
|
||||||
"src/Utils.c"
|
"src/Utils.c"
|
||||||
"src/Zydis.c")
|
"src/Zydis.c")
|
||||||
|
|
||||||
if (BUILD_SHARED_LIBS AND WIN32)
|
if (ZYDIS_FEATURE_DECODER)
|
||||||
target_sources("Zydis" PRIVATE "src/VersionInfo.rc")
|
target_sources("Zydis"
|
||||||
|
PUBLIC
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Decoder.h"
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/DecoderTypes.h"
|
||||||
|
"${CMAKE_CURRENT_LIST_DIR}/include/Zydis/Formatter.h"
|
||||||
|
PRIVATE
|
||||||
|
"src/DecoderData.h"
|
||||||
|
"src/Decoder.c"
|
||||||
|
"src/DecoderData.c"
|
||||||
|
"src/Formatter.c")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
if (ZYDIS_FEATURE_ENCODER)
|
if (ZYDIS_FEATURE_ENCODER)
|
||||||
|
@ -118,6 +129,10 @@ if (ZYDIS_FEATURE_ENCODER)
|
||||||
"src/EncoderData.c")
|
"src/EncoderData.c")
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
if (BUILD_SHARED_LIBS AND WIN32)
|
||||||
|
target_sources("Zydis" PRIVATE "src/VersionInfo.rc")
|
||||||
|
endif ()
|
||||||
|
|
||||||
# TODO: Install CMake config.
|
# TODO: Install CMake config.
|
||||||
install(TARGETS "Zydis"
|
install(TARGETS "Zydis"
|
||||||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
||||||
|
@ -130,6 +145,7 @@ install(DIRECTORY "include" DESTINATION ${CMAKE_INSTALL_INCLUDEDIR})
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
|
|
||||||
if (ZYDIS_BUILD_EXAMPLES)
|
if (ZYDIS_BUILD_EXAMPLES)
|
||||||
|
if (ZYDIS_FEATURE_DECODER)
|
||||||
add_executable("FormatterHooks"
|
add_executable("FormatterHooks"
|
||||||
"examples/FormatterHooks.c"
|
"examples/FormatterHooks.c"
|
||||||
"examples/FormatHelper.h")
|
"examples/FormatHelper.h")
|
||||||
|
@ -137,12 +153,14 @@ if (ZYDIS_BUILD_EXAMPLES)
|
||||||
set_target_properties("FormatterHooks" PROPERTIES FOLDER "Examples/Formatter")
|
set_target_properties("FormatterHooks" PROPERTIES FOLDER "Examples/Formatter")
|
||||||
target_compile_definitions("FormatterHooks" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
target_compile_definitions("FormatterHooks" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
||||||
endif ()
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
# Tools #
|
# Tools #
|
||||||
# =============================================================================================== #
|
# =============================================================================================== #
|
||||||
|
|
||||||
if (ZYDIS_BUILD_TOOLS)
|
if (ZYDIS_BUILD_TOOLS)
|
||||||
|
if (ZYDIS_FEATURE_DECODER)
|
||||||
add_executable("ZydisDisasm" "tools/ZydisDisasm.c")
|
add_executable("ZydisDisasm" "tools/ZydisDisasm.c")
|
||||||
target_link_libraries("ZydisDisasm" "Zydis")
|
target_link_libraries("ZydisDisasm" "Zydis")
|
||||||
set_target_properties ("ZydisDisasm" PROPERTIES FOLDER "Tools")
|
set_target_properties ("ZydisDisasm" PROPERTIES FOLDER "Tools")
|
||||||
|
@ -158,3 +176,4 @@ if (ZYDIS_BUILD_TOOLS)
|
||||||
set_target_properties("PerfTest" PROPERTIES FOLDER "Tools")
|
set_target_properties("PerfTest" PROPERTIES FOLDER "Tools")
|
||||||
target_compile_definitions("PerfTest" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
target_compile_definitions("PerfTest" PRIVATE "_CRT_SECURE_NO_WARNINGS")
|
||||||
endif ()
|
endif ()
|
||||||
|
endif ()
|
||||||
|
|
Loading…
Reference in New Issue