mirror of
https://github.com/pound-emu/ballistic.git
synced 2026-01-31 01:15:21 +01:00
This program takes a 32-bit hexidecimal representing an ARM instruction and prints its corresponding mnemonic. This program will be used in tandem with a python fuzzing script to verify the decoder table generated by tools/generate_a64_table.py. Signed-off-by: Ronald Caesar <github43132@proton.me>
77 lines
2.5 KiB
CMake
77 lines
2.5 KiB
CMake
cmake_minimum_required(VERSION 3.25)
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
set(CMAKE_C_STANDARD_REQUIRED ON)
|
|
set(CMAKE_C_EXTENSIONS OFF) # Strict ISO C
|
|
|
|
if(NOT CMAKE_BUILD_TYPE)
|
|
set(CMAKE_BUILD_TYPE Debug)
|
|
endif()
|
|
|
|
project(Ballistic LANGUAGES C VERSION 0.1.0)
|
|
|
|
|
|
# option(BALLISTIC_ENABLE_CPU_FEATURE_DETECTION "Makes Ballistic able to detect CPU features of the host" ON)
|
|
option(BALLISTIC_ENABLE_LINK_TIME_OPTIMIZATION "Enables LTO for Ballistic (improves performance)" ON)
|
|
option(BALLISTIC_ENABLE_BUILD_TESTS "Enables Ballistic tests" ON)
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Compile Ballistic
|
|
# -----------------------------------------------------------------------------
|
|
add_library(Ballistic STATIC
|
|
src/decoder.c
|
|
src/decoder_table_gen.c
|
|
)
|
|
|
|
target_include_directories(Ballistic PRIVATE src)
|
|
|
|
if(BALLISTIC_ENABLE_LINK_TIME_OPTIMIZATION)
|
|
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION ON)
|
|
endif()
|
|
|
|
if (MSVC)
|
|
add_compile_options(/W4 /WX)
|
|
else()
|
|
add_compile_options(
|
|
-Wall -Wextra -Wpedantic -Werror
|
|
-Wconversion -Wsign-conversion -Wshadow
|
|
-Wstrict-prototypes -Wmissing-prototypes
|
|
-fno-strict-aliasing # Prevent common C aliasing UB
|
|
-fstack-protector-strong
|
|
)
|
|
endif()
|
|
|
|
# Debugging and Sanitizers (Catch UB/Segfaults early)
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
add_compile_options(-g -fno-omit-frame-pointer)
|
|
endif()
|
|
|
|
if(WIN32)
|
|
# Disable some Windows SDK deprecation warnings
|
|
target_compile_options(Ballistic PRIVATE -DNOMINMAX -DWIN32_LEAN_AND_MEAN)
|
|
target_compile_definitions(Ballistic PRIVATE _CRT_SECURE_NO_WARNINGS)
|
|
endif()
|
|
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Compile Tools
|
|
# -----------------------------------------------------------------------------
|
|
set (DECODER_CLI_NAME "decoder_cli")
|
|
add_executable(${DECODER_CLI_NAME} tools/decoder_cli.c)
|
|
target_link_libraries(${DECODER_CLI_NAME} PRIVATE ${PROJECT_NAME})
|
|
target_include_directories(${DECODER_CLI_NAME} PRIVATE src)
|
|
|
|
# -----------------------------------------------------------------------------
|
|
# Compile Tests
|
|
# -----------------------------------------------------------------------------
|
|
if (BALLISTIC_ENABLE_BUILD_TESTS)
|
|
set(TESTS_NAME "ballistic_tests")
|
|
enable_testing()
|
|
add_executable(${TESTS_NAME} tests/test_decoder.c)
|
|
target_link_libraries(${TESTS_NAME} PRIVATE ${PROJECT_NAME})
|
|
target_include_directories(${TESTS_NAME} PRIVATE src)
|
|
add_test(NAME DecoderTest COMMAND ${TESTS_NAME})
|
|
endif()
|
|
|
|
|