2021-10-03 17:14:44 +03:00
|
|
|
# CMake setup for Unicorn 2.
|
|
|
|
# By Huitao Chen & Nguyen Anh Quynh, 2019-2020
|
2020-05-01 15:18:07 +03:00
|
|
|
|
2019-09-08 11:42:43 +03:00
|
|
|
cmake_minimum_required(VERSION 3.1)
|
2021-10-03 17:14:44 +03:00
|
|
|
|
2022-08-19 07:59:32 +03:00
|
|
|
# Only required for MSVC, but we can't know the compiler at this point because we haven't
|
|
|
|
# called enable_language() or project(), and if we did that it would lock in the old
|
|
|
|
# policy. Setting these policies is harmless for non-MSVC though, so just enable them
|
|
|
|
# always.
|
|
|
|
if(CMAKE_VERSION VERSION_GREATER_EQUAL "3.15")
|
|
|
|
# Set explicitly the policies we want rather than raising the base to the current
|
|
|
|
# version. This prevents unintended behavior changes as CMake evolves and provides a
|
|
|
|
# consistent experience across different CMake versions.
|
|
|
|
# CMP0091: prevent msvcrt flags being added to default CMAKE_<LANG>_FLAGS_<CONFIG>
|
|
|
|
cmake_policy(SET CMP0091 NEW)
|
|
|
|
# CMP0092: prevent warning flags being added to default CMAKE_<LANG>_FLAGS for MSVC
|
|
|
|
cmake_policy(SET CMP0092 NEW)
|
2022-04-16 14:40:04 +03:00
|
|
|
endif()
|
|
|
|
|
2023-03-31 19:31:02 +03:00
|
|
|
option(ZIG_BUILD "Enable zig build" OFF)
|
|
|
|
if(ZIG_BUILD)
|
|
|
|
include(cmake/zig.cmake)
|
|
|
|
endif()
|
|
|
|
|
2021-10-03 17:14:44 +03:00
|
|
|
# Workaround to fix wrong compiler on macos.
|
2022-01-18 22:38:10 +03:00
|
|
|
if(APPLE AND NOT CMAKE_C_COMPILER)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(CMAKE_C_COMPILER "/usr/bin/cc")
|
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
|
|
|
|
# Detect if unicorn is compiled as the top-level project
|
|
|
|
set(PROJECT_IS_TOP_LEVEL OFF)
|
|
|
|
if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
2022-01-19 00:23:38 +03:00
|
|
|
set(PROJECT_IS_TOP_LEVEL ON)
|
2022-04-16 14:40:04 +03:00
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
# Enable folder support
|
2022-01-19 00:23:38 +03:00
|
|
|
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
|
2022-01-18 22:38:10 +03:00
|
|
|
endif()
|
|
|
|
|
2019-09-08 11:42:43 +03:00
|
|
|
project(unicorn C)
|
|
|
|
|
2022-08-19 07:59:32 +03:00
|
|
|
# We depend on the availability of the CMAKE_MSVC_RUNTIME_LIBRARY, which is only
|
|
|
|
# available in CMake 3.15 and above (see also the comments above in regards to policy
|
|
|
|
# CMP0091).
|
|
|
|
if(MSVC AND CMAKE_VERSION VERSION_LESS "3.15")
|
|
|
|
message(FATAL_ERROR "Please update CMake to 3.15 or greater.")
|
|
|
|
endif()
|
|
|
|
|
2022-04-16 14:40:04 +03:00
|
|
|
# mainline qemu mostly just uses compiler default
|
|
|
|
set(CMAKE_C_STANDARD 11)
|
|
|
|
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_VERSION_MAJOR 2)
|
2019-09-08 11:42:43 +03:00
|
|
|
set(UNICORN_VERSION_MINOR 0)
|
2023-02-04 08:00:58 +03:00
|
|
|
set(UNICORN_VERSION_PATCH 2)
|
2019-09-08 11:42:43 +03:00
|
|
|
|
2023-03-31 19:31:02 +03:00
|
|
|
include(cmake/bundle_static.cmake)
|
2022-04-04 01:26:00 +03:00
|
|
|
|
2022-04-30 01:25:27 +03:00
|
|
|
# Even though we generate shared lib and static archive at the same time, we still support
|
|
|
|
# using unicorn as a subdirectory so we have to respect BUILD_SHARED_LIBS.
|
|
|
|
#
|
|
|
|
# Also we would like users to link a native cmake target, instead of a custom target for better
|
|
|
|
# compatability.
|
2022-01-18 22:38:10 +03:00
|
|
|
option(BUILD_SHARED_LIBS "Build shared instead of static library" ${PROJECT_IS_TOP_LEVEL})
|
|
|
|
option(UNICORN_FUZZ "Enable fuzzing" OFF)
|
|
|
|
option(UNICORN_BUILD_TESTS "Build unicorn tests" ${PROJECT_IS_TOP_LEVEL})
|
|
|
|
option(UNICORN_INSTALL "Enable unicorn installation" ${PROJECT_IS_TOP_LEVEL})
|
2022-04-30 00:11:34 +03:00
|
|
|
set(UNICORN_ARCH "x86;arm;aarch64;riscv;mips;sparc;m68k;ppc;s390x;tricore" CACHE STRING "Enabled unicorn architectures")
|
2022-01-18 21:35:43 +03:00
|
|
|
option(UNICORN_TRACER "Trace unicorn execution" OFF)
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
foreach(ARCH_LOOP ${UNICORN_ARCH})
|
|
|
|
string(TOUPPER "${ARCH_LOOP}" ARCH_LOOP)
|
2019-09-08 11:42:43 +03:00
|
|
|
set(UNICORN_HAS_${ARCH_LOOP} TRUE)
|
2022-01-18 22:38:10 +03:00
|
|
|
endforeach()
|
2019-09-08 11:42:43 +03:00
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
include_directories(
|
2021-10-03 17:14:44 +03:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/msvc
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
include_directories(
|
|
|
|
${CMAKE_BINARY_DIR}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include_directories(
|
2021-10-03 17:14:44 +03:00
|
|
|
glib_compat
|
2019-09-08 11:42:43 +03:00
|
|
|
qemu
|
|
|
|
qemu/include
|
|
|
|
include
|
2021-10-03 17:14:44 +03:00
|
|
|
qemu/tcg
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
|
2023-12-28 18:14:10 +03:00
|
|
|
# Some distributions on some rare architecures don't auto link atomic for us and
|
|
|
|
# we do this manually by adding flags.
|
|
|
|
set(ATOMIC_LINKAGE_FIX FALSE)
|
2019-09-08 11:42:43 +03:00
|
|
|
if(MSVC)
|
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(MSVC_FLAG -D__x86_64__)
|
2019-09-08 11:42:43 +03:00
|
|
|
elseif(CMAKE_SIZEOF_VOID_P EQUAL 4)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(MSVC_FLAG -D__i386__)
|
2019-09-08 11:42:43 +03:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "Neither WIN64 or WIN32!")
|
|
|
|
endif()
|
2022-04-16 14:40:04 +03:00
|
|
|
|
2019-09-08 11:42:43 +03:00
|
|
|
add_compile_options(
|
|
|
|
-Dinline=__inline
|
|
|
|
-D__func__=__FUNCTION__
|
|
|
|
-D_CRT_SECURE_NO_WARNINGS
|
|
|
|
-DWIN32_LEAN_AND_MEAN
|
|
|
|
${MSVC_FLAG}
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/qemu/tcg/i386
|
|
|
|
)
|
2022-04-16 14:40:04 +03:00
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
# Disable some warnings
|
2022-04-16 14:40:04 +03:00
|
|
|
add_compile_options($<$<COMPILE_LANGUAGE:C>:/wd4018>)
|
|
|
|
add_compile_options($<$<COMPILE_LANGUAGE:C>:/wd4098>)
|
|
|
|
add_compile_options($<$<COMPILE_LANGUAGE:C>:/wd4244>)
|
|
|
|
add_compile_options($<$<COMPILE_LANGUAGE:C>:/wd4267>)
|
|
|
|
|
|
|
|
# handle msvcrt setting being passed in CMAKE_C_FLAGS
|
|
|
|
if(DEFINED CMAKE_MSVC_RUNTIME_LIBRARY)
|
|
|
|
# do not support other methods of setting this (it would be more conformant, tho)
|
|
|
|
message(FATAL_ERROR "please set msvcrt via CMAKE_C_FLAGS")
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-04-16 14:40:04 +03:00
|
|
|
if(CMAKE_C_FLAGS MATCHES "[/-]MTd")
|
|
|
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebug")
|
|
|
|
elseif(CMAKE_C_FLAGS MATCHES "[/-]MDd")
|
|
|
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDebugDLL")
|
|
|
|
elseif(CMAKE_C_FLAGS MATCHES "[/-]MT")
|
|
|
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded")
|
|
|
|
elseif(CMAKE_C_FLAGS MATCHES "[/-]MD")
|
|
|
|
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreadedDLL")
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-04-16 14:40:04 +03:00
|
|
|
|
|
|
|
# prevent the arg from occurring more than once (not a big deal, just to keep tidy)
|
|
|
|
string(REGEX REPLACE "[/-]M[TD]d?" "" CMAKE_C_FLAGS ${CMAKE_C_FLAGS})
|
2019-09-08 11:42:43 +03:00
|
|
|
else()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(MINGW)
|
2021-10-03 17:14:44 +03:00
|
|
|
execute_process(COMMAND ${CMAKE_C_COMPILER} -dumpmachine
|
|
|
|
OUTPUT_VARIABLE UC_COMPILER_VERSION)
|
|
|
|
|
|
|
|
string(FIND "${UC_COMPILER_VERSION}" "i686" UC_RET)
|
2022-01-18 22:38:10 +03:00
|
|
|
if(${UC_RET} GREATER_EQUAL "0")
|
2020-04-29 03:47:48 +03:00
|
|
|
set(UNICORN_TARGET_ARCH "i386")
|
2022-04-24 01:10:12 +03:00
|
|
|
set(UNICORN_CFLAGS -m32 -static-libgcc) # Workaround for github action bugs
|
2021-10-03 17:14:44 +03:00
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m32")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m32")
|
|
|
|
else()
|
2020-04-29 03:47:48 +03:00
|
|
|
set(UNICORN_TARGET_ARCH "i386")
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_CFLAGS -m64 -mcx16)
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m64")
|
2020-04-29 03:47:48 +03:00
|
|
|
endif()
|
2021-10-05 23:42:44 +03:00
|
|
|
elseif(ANDROID_ABI)
|
|
|
|
string(FIND "${ANDROID_ABI}" "arm64" UC_RET)
|
2021-10-16 21:43:34 +03:00
|
|
|
file(WRITE ${CMAKE_BINARY_DIR}/adb.sh "#!/bin/bash\n\n# Auto-generated by CMakeLists.txt\n\nadb shell mkdir -p /data/local/tmp/build\n")
|
2021-10-05 23:42:44 +03:00
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
if(${UC_RET} GREATER_EQUAL "0")
|
2021-10-05 23:42:44 +03:00
|
|
|
set(UNICORN_TARGET_ARCH "aarch64")
|
|
|
|
else()
|
|
|
|
string(FIND "${ANDROID_ABI}" "armeabi" UC_RET)
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
if(${UC_RET} GREATER_EQUAL "0")
|
2021-10-05 23:42:44 +03:00
|
|
|
set(UNICORN_TARGET_ARCH "arm")
|
|
|
|
else()
|
|
|
|
set(UNICORN_TARGET_ARCH "i386")
|
|
|
|
endif()
|
|
|
|
endif()
|
2021-10-03 17:14:44 +03:00
|
|
|
else()
|
|
|
|
execute_process(COMMAND ${CMAKE_C_COMPILER} -dM -E -
|
|
|
|
INPUT_FILE /dev/null
|
|
|
|
OUTPUT_VARIABLE UC_COMPILER_MACRO)
|
|
|
|
|
|
|
|
while(TRUE)
|
|
|
|
string(FIND "${UC_COMPILER_MACRO}" "__x86_64__" UC_RET)
|
2022-01-18 22:38:10 +03:00
|
|
|
if(${UC_RET} GREATER_EQUAL "0")
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TARGET_ARCH "i386")
|
|
|
|
string(FIND "${UC_COMPILER_MACRO}" "__ILP32__" UC_RET)
|
2022-01-18 22:38:10 +03:00
|
|
|
if(${UC_RET} GREATER_EQUAL "0")
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_CFLAGS -mx32)
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -mx32")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -mx32")
|
|
|
|
else()
|
|
|
|
set(UNICORN_CFLAGS -m64 -mcx16)
|
|
|
|
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -m64")
|
|
|
|
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -m64")
|
|
|
|
endif()
|
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
string(FIND "${UC_COMPILER_MACRO}" "__i386__" UC_RET)
|
2022-01-18 22:38:10 +03:00
|
|
|
if(${UC_RET} GREATER_EQUAL "0")
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TARGET_ARCH "i386")
|
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
string(FIND "${UC_COMPILER_MACRO}" "__arm__" UC_RET)
|
2022-01-18 22:38:10 +03:00
|
|
|
if(${UC_RET} GREATER_EQUAL "0")
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TARGET_ARCH "arm")
|
2023-12-28 18:14:10 +03:00
|
|
|
set(ATOMIC_LINKAGE_FIX TRUE)
|
2021-10-03 17:14:44 +03:00
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
string(FIND "${UC_COMPILER_MACRO}" "__aarch64__" UC_RET)
|
2022-01-18 22:38:10 +03:00
|
|
|
if(${UC_RET} GREATER_EQUAL "0")
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TARGET_ARCH "aarch64")
|
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
string(FIND "${UC_COMPILER_MACRO}" "__mips__" UC_RET)
|
2022-01-18 22:38:10 +03:00
|
|
|
if(${UC_RET} GREATER_EQUAL "0")
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TARGET_ARCH "mips")
|
2023-12-28 18:14:10 +03:00
|
|
|
set(ATOMIC_LINKAGE_FIX TRUE)
|
2021-10-03 17:14:44 +03:00
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
string(FIND "${UC_COMPILER_MACRO}" "__sparc__" UC_RET)
|
2022-01-18 22:38:10 +03:00
|
|
|
if(${UC_RET} GREATER_EQUAL "0")
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TARGET_ARCH "sparc")
|
2023-12-28 18:14:10 +03:00
|
|
|
set(ATOMIC_LINKAGE_FIX TRUE)
|
2021-10-03 17:14:44 +03:00
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
string(FIND "${UC_COMPILER_MACRO}" "__ia64__" UC_RET)
|
2022-01-18 22:38:10 +03:00
|
|
|
if(${UC_RET} GREATER_EQUAL "0")
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TARGET_ARCH "ia64")
|
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
string(FIND "${UC_COMPILER_MACRO}" "_ARCH_PPC" UC_RET)
|
2022-01-18 22:38:10 +03:00
|
|
|
if(${UC_RET} GREATER_EQUAL "0")
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TARGET_ARCH "ppc")
|
2023-12-28 18:14:10 +03:00
|
|
|
set(ATOMIC_LINKAGE_FIX TRUE)
|
2021-10-03 17:14:44 +03:00
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
string(FIND "${UC_COMPILER_MACRO}" "__riscv" UC_RET)
|
2022-01-18 22:38:10 +03:00
|
|
|
if(${UC_RET} GREATER_EQUAL "0")
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TARGET_ARCH "riscv")
|
2023-12-28 18:14:10 +03:00
|
|
|
set(ATOMIC_LINKAGE_FIX TRUE)
|
2021-10-03 17:14:44 +03:00
|
|
|
break()
|
|
|
|
endif()
|
|
|
|
string(FIND "${UC_COMPILER_MACRO}" "__s390__" UC_RET)
|
2022-01-18 22:38:10 +03:00
|
|
|
if(${UC_RET} GREATER_EQUAL "0")
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TARGET_ARCH "s390")
|
2023-12-28 18:14:10 +03:00
|
|
|
set(ATOMIC_LINKAGE_FIX TRUE)
|
2021-10-03 17:14:44 +03:00
|
|
|
break()
|
|
|
|
endif()
|
2022-04-30 00:11:34 +03:00
|
|
|
string(FIND ${UC_COMPILER_MACRO} "__tricore__" UC_RET)
|
|
|
|
if (${UC_RET} GREATER_EQUAL "0")
|
|
|
|
set(UNICORN_TARGET_ARCH "tricore")
|
|
|
|
break()
|
|
|
|
endif()
|
2021-10-03 17:14:44 +03:00
|
|
|
message(FATAL_ERROR "Unknown host compiler: ${CMAKE_C_COMPILER}.")
|
|
|
|
endwhile(TRUE)
|
|
|
|
endif()
|
2020-04-29 03:47:48 +03:00
|
|
|
|
2019-09-08 11:42:43 +03:00
|
|
|
set(EXTRA_CFLAGS "--extra-cflags=")
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_X86)
|
|
|
|
set(EXTRA_CFLAGS "${EXTRA_CFLAGS}-DUNICORN_HAS_X86 ")
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_ARM)
|
2022-02-12 16:15:54 +03:00
|
|
|
set(EXTRA_CFLAGS "${EXTRA_CFLAGS}-DUNICORN_HAS_ARM ")
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_AARCH64)
|
2022-02-12 16:15:54 +03:00
|
|
|
set(EXTRA_CFLAGS "${EXTRA_CFLAGS}-DUNICORN_HAS_ARM64 ")
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_M68K)
|
|
|
|
set(EXTRA_CFLAGS "${EXTRA_CFLAGS}-DUNICORN_HAS_M68K ")
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_MIPS)
|
|
|
|
set(EXTRA_CFLAGS "${EXTRA_CFLAGS}-DUNICORN_HAS_MIPS -DUNICORN_HAS_MIPSEL -DUNICORN_HAS_MIPS64 -DUNICORN_HAS_MIPS64EL ")
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_SPARC)
|
|
|
|
set(EXTRA_CFLAGS "${EXTRA_CFLAGS}-DUNICORN_HAS_SPARC ")
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_PPC)
|
|
|
|
set(EXTRA_CFLAGS "${EXTRA_CFLAGS}-DUNICORN_HAS_PPC ")
|
2021-10-03 17:14:44 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_RISCV)
|
|
|
|
set(EXTRA_CFLAGS "${EXTRA_CFLAGS}-DUNICORN_HAS_RISCV ")
|
2021-10-03 17:14:44 +03:00
|
|
|
endif()
|
2021-12-05 23:19:37 +03:00
|
|
|
if (UNICORN_HAS_S390X)
|
|
|
|
set (EXTRA_CFLAGS "${EXTRA_CFLAGS}-DUNICORN_HAS_S390X ")
|
|
|
|
endif()
|
2022-04-30 00:11:34 +03:00
|
|
|
if (UNICORN_HAS_TRICORE)
|
|
|
|
set (EXTRA_CFLAGS "${EXTRA_CFLAGS}-DUNICORN_HAS_TRICORE ")
|
|
|
|
endif()
|
2021-10-03 17:14:44 +03:00
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
set(EXTRA_CFLAGS "${EXTRA_CFLAGS}-fPIC")
|
2021-10-05 23:42:44 +03:00
|
|
|
if(ANDROID_ABI)
|
2022-01-18 22:38:10 +03:00
|
|
|
set(EXTRA_CFLAGS "${EXTRA_CFLAGS} --target=${CMAKE_C_COMPILER_TARGET}")
|
|
|
|
set(EXTRA_CFLAGS "${EXTRA_CFLAGS} --sysroot=${CMAKE_SYSROOT}")
|
2021-10-05 23:42:44 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_FUZZ)
|
|
|
|
set(EXTRA_CFLAGS "${EXTRA_CFLAGS} ${CMAKE_C_FLAGS}")
|
2021-10-06 16:46:25 +03:00
|
|
|
endif()
|
2022-01-18 21:35:43 +03:00
|
|
|
if(UNICORN_TRACER)
|
|
|
|
set (EXTRA_CFLAGS "${EXTRA_CFLAGS} -DUNICORN_TRACER")
|
|
|
|
endif()
|
2023-12-28 19:55:32 +03:00
|
|
|
if (ATOMIC_LINKAGE_FIX)
|
|
|
|
set (EXTRA_CFLAGS "${EXTRA_CFLAGS} -latomic")
|
|
|
|
endif()
|
2024-03-08 12:28:46 +03:00
|
|
|
if (CMAKE_OSX_SYSROOT)
|
|
|
|
# https://github.com/unicorn-engine/unicorn/issues/1917
|
|
|
|
set (EXTRA_CFLAGS "${EXTRA_CFLAGS} -isysroot ${CMAKE_OSX_SYSROOT} ")
|
|
|
|
endif()
|
2019-09-08 11:42:43 +03:00
|
|
|
|
|
|
|
set(TARGET_LIST "--target-list=")
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_X86)
|
|
|
|
set(TARGET_LIST "${TARGET_LIST}x86_64-softmmu, ")
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_ARM)
|
2022-02-12 16:15:54 +03:00
|
|
|
set(TARGET_LIST "${TARGET_LIST}arm-softmmu, ")
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_AARCH64)
|
2022-02-12 16:15:54 +03:00
|
|
|
set(TARGET_LIST "${TARGET_LIST}aarch64-softmmu, ")
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_M68K)
|
|
|
|
set(TARGET_LIST "${TARGET_LIST}m68k-softmmu, ")
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_MIPS)
|
|
|
|
set(TARGET_LIST "${TARGET_LIST}mips-softmmu, mipsel-softmmu, mips64-softmmu, mips64el-softmmu, ")
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_SPARC)
|
|
|
|
set(TARGET_LIST "${TARGET_LIST}sparc-softmmu, sparc64-softmmu, ")
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_PPC)
|
|
|
|
set(TARGET_LIST "${TARGET_LIST}ppc-softmmu, ppc64-softmmu, ")
|
2021-10-03 17:14:44 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_RISCV)
|
|
|
|
set(TARGET_LIST "${TARGET_LIST}riscv32-softmmu, riscv64-softmmu, ")
|
2021-10-03 17:14:44 +03:00
|
|
|
endif()
|
2022-01-19 22:09:25 +03:00
|
|
|
if(UNICORN_HAS_S390X)
|
|
|
|
set(TARGET_LIST "${TARGET_LIST}s390x-softmmu, ")
|
2021-12-05 23:19:37 +03:00
|
|
|
endif()
|
2022-04-30 00:11:34 +03:00
|
|
|
if (UNICORN_HAS_TRICORE)
|
|
|
|
set (TARGET_LIST "${TARGET_LIST}tricore-softmmu, ")
|
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
set(TARGET_LIST "${TARGET_LIST} ")
|
2019-09-08 11:42:43 +03:00
|
|
|
|
2020-05-01 15:18:07 +03:00
|
|
|
# GEN config-host.mak & target directories
|
2019-09-08 11:42:43 +03:00
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/configure
|
2021-10-03 17:14:44 +03:00
|
|
|
--cc=${CMAKE_C_COMPILER}
|
2019-09-08 11:42:43 +03:00
|
|
|
${EXTRA_CFLAGS}
|
|
|
|
${TARGET_LIST}
|
2020-06-06 07:54:06 +03:00
|
|
|
WORKING_DIRECTORY ${CMAKE_BINARY_DIR}
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/create_config
|
|
|
|
INPUT_FILE ${CMAKE_BINARY_DIR}/config-host.mak
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/config-host.h
|
|
|
|
)
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_X86)
|
2019-09-08 11:42:43 +03:00
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/create_config
|
|
|
|
INPUT_FILE ${CMAKE_BINARY_DIR}/x86_64-softmmu/config-target.mak
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/x86_64-softmmu/config-target.h
|
|
|
|
)
|
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_ARM)
|
2019-09-08 11:42:43 +03:00
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/create_config
|
|
|
|
INPUT_FILE ${CMAKE_BINARY_DIR}/arm-softmmu/config-target.mak
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/arm-softmmu/config-target.h
|
|
|
|
)
|
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_AARCH64)
|
2019-09-08 11:42:43 +03:00
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/create_config
|
|
|
|
INPUT_FILE ${CMAKE_BINARY_DIR}/aarch64-softmmu/config-target.mak
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/aarch64-softmmu/config-target.h
|
|
|
|
)
|
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_M68K)
|
2019-09-08 11:42:43 +03:00
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/create_config
|
|
|
|
INPUT_FILE ${CMAKE_BINARY_DIR}/m68k-softmmu/config-target.mak
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/m68k-softmmu/config-target.h
|
|
|
|
)
|
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_MIPS)
|
2019-09-08 11:42:43 +03:00
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/create_config
|
|
|
|
INPUT_FILE ${CMAKE_BINARY_DIR}/mips-softmmu/config-target.mak
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/mips-softmmu/config-target.h
|
|
|
|
)
|
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/create_config
|
|
|
|
INPUT_FILE ${CMAKE_BINARY_DIR}/mipsel-softmmu/config-target.mak
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/mipsel-softmmu/config-target.h
|
|
|
|
)
|
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/create_config
|
|
|
|
INPUT_FILE ${CMAKE_BINARY_DIR}/mips64-softmmu/config-target.mak
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/mips64-softmmu/config-target.h
|
|
|
|
)
|
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/create_config
|
|
|
|
INPUT_FILE ${CMAKE_BINARY_DIR}/mips64el-softmmu/config-target.mak
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/mips64el-softmmu/config-target.h
|
|
|
|
)
|
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_SPARC)
|
2019-09-08 11:42:43 +03:00
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/create_config
|
|
|
|
INPUT_FILE ${CMAKE_BINARY_DIR}/sparc-softmmu/config-target.mak
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/sparc-softmmu/config-target.h
|
|
|
|
)
|
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/create_config
|
|
|
|
INPUT_FILE ${CMAKE_BINARY_DIR}/sparc64-softmmu/config-target.mak
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/sparc64-softmmu/config-target.h
|
|
|
|
)
|
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_PPC)
|
2021-10-03 17:14:44 +03:00
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/create_config
|
|
|
|
INPUT_FILE ${CMAKE_BINARY_DIR}/ppc-softmmu/config-target.mak
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/ppc-softmmu/config-target.h
|
|
|
|
)
|
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/create_config
|
|
|
|
INPUT_FILE ${CMAKE_BINARY_DIR}/ppc64-softmmu/config-target.mak
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/ppc64-softmmu/config-target.h
|
|
|
|
)
|
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_RISCV)
|
2021-10-03 17:14:44 +03:00
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/create_config
|
|
|
|
INPUT_FILE ${CMAKE_BINARY_DIR}/riscv32-softmmu/config-target.mak
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/riscv32-softmmu/config-target.h
|
|
|
|
)
|
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/create_config
|
|
|
|
INPUT_FILE ${CMAKE_BINARY_DIR}/riscv64-softmmu/config-target.mak
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/riscv64-softmmu/config-target.h
|
|
|
|
)
|
|
|
|
endif()
|
2021-12-05 23:19:37 +03:00
|
|
|
if (UNICORN_HAS_S390X)
|
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/create_config
|
|
|
|
INPUT_FILE ${CMAKE_BINARY_DIR}/s390x-softmmu/config-target.mak
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/s390x-softmmu/config-target.h
|
|
|
|
)
|
|
|
|
endif()
|
2022-04-30 00:11:34 +03:00
|
|
|
if (UNICORN_HAS_TRICORE)
|
|
|
|
execute_process(COMMAND sh ${CMAKE_CURRENT_SOURCE_DIR}/qemu/scripts/create_config
|
|
|
|
INPUT_FILE ${CMAKE_BINARY_DIR}/tricore-softmmu/config-target.mak
|
|
|
|
OUTPUT_FILE ${CMAKE_BINARY_DIR}/tricore-softmmu/config-target.h
|
|
|
|
)
|
|
|
|
endif()
|
2019-09-08 11:42:43 +03:00
|
|
|
add_compile_options(
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_CFLAGS}
|
2020-04-29 03:47:48 +03:00
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/qemu/tcg/${UNICORN_TARGET_ARCH}
|
2019-09-08 11:42:43 +03:00
|
|
|
-D_GNU_SOURCE
|
|
|
|
-D_FILE_OFFSET_BITS=64
|
|
|
|
-D_LARGEFILE_SOURCE
|
2021-10-03 17:14:44 +03:00
|
|
|
-Wall
|
|
|
|
-fPIC
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
2023-12-28 18:14:10 +03:00
|
|
|
if (ATOMIC_LINKAGE_FIX)
|
|
|
|
add_compile_options(
|
|
|
|
-latomic
|
|
|
|
)
|
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(APPLE)
|
2021-10-03 17:14:44 +03:00
|
|
|
# This warning is disabled by default for gcc and doesn't cause any bug.
|
|
|
|
add_compile_options(
|
|
|
|
-Wno-missing-braces
|
|
|
|
)
|
|
|
|
endif()
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
|
|
|
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_ARCH_COMMON
|
2019-09-08 11:42:43 +03:00
|
|
|
qemu/exec.c
|
2021-10-03 17:14:44 +03:00
|
|
|
qemu/exec-vary.c
|
|
|
|
|
|
|
|
qemu/softmmu/cpus.c
|
|
|
|
qemu/softmmu/ioport.c
|
|
|
|
qemu/softmmu/memory.c
|
|
|
|
qemu/softmmu/memory_mapping.c
|
|
|
|
|
2019-09-08 11:42:43 +03:00
|
|
|
qemu/fpu/softfloat.c
|
2021-10-03 17:14:44 +03:00
|
|
|
|
2019-09-08 11:42:43 +03:00
|
|
|
qemu/tcg/optimize.c
|
|
|
|
qemu/tcg/tcg.c
|
2021-10-03 17:14:44 +03:00
|
|
|
qemu/tcg/tcg-op.c
|
|
|
|
qemu/tcg/tcg-op-gvec.c
|
|
|
|
qemu/tcg/tcg-op-vec.c
|
|
|
|
|
|
|
|
qemu/accel/tcg/cpu-exec.c
|
|
|
|
qemu/accel/tcg/cpu-exec-common.c
|
|
|
|
qemu/accel/tcg/cputlb.c
|
|
|
|
qemu/accel/tcg/tcg-all.c
|
|
|
|
qemu/accel/tcg/tcg-runtime.c
|
|
|
|
qemu/accel/tcg/tcg-runtime-gvec.c
|
|
|
|
qemu/accel/tcg/translate-all.c
|
|
|
|
qemu/accel/tcg/translator.c
|
2022-10-05 17:53:24 +03:00
|
|
|
|
|
|
|
qemu/softmmu/unicorn_vtlb.c
|
2021-10-03 17:14:44 +03:00
|
|
|
)
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_X86)
|
|
|
|
add_library(x86_64-softmmu STATIC
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_ARCH_COMMON}
|
|
|
|
|
|
|
|
qemu/hw/i386/x86.c
|
|
|
|
|
|
|
|
qemu/target/i386/arch_memory_mapping.c
|
|
|
|
qemu/target/i386/bpt_helper.c
|
|
|
|
qemu/target/i386/cc_helper.c
|
|
|
|
qemu/target/i386/cpu.c
|
|
|
|
qemu/target/i386/excp_helper.c
|
|
|
|
qemu/target/i386/fpu_helper.c
|
|
|
|
qemu/target/i386/helper.c
|
|
|
|
qemu/target/i386/int_helper.c
|
|
|
|
qemu/target/i386/machine.c
|
|
|
|
qemu/target/i386/mem_helper.c
|
|
|
|
qemu/target/i386/misc_helper.c
|
|
|
|
qemu/target/i386/mpx_helper.c
|
|
|
|
qemu/target/i386/seg_helper.c
|
|
|
|
qemu/target/i386/smm_helper.c
|
|
|
|
qemu/target/i386/svm_helper.c
|
|
|
|
qemu/target/i386/translate.c
|
|
|
|
qemu/target/i386/xsave_helper.c
|
|
|
|
qemu/target/i386/unicorn.c
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
target_compile_options(x86_64-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
2020-06-02 11:04:33 +03:00
|
|
|
/FIx86_64.h
|
2021-10-03 17:14:44 +03:00
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/msvc/x86_64-softmmu
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/i386
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_options(x86_64-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
-include x86_64.h
|
|
|
|
-I${CMAKE_BINARY_DIR}/x86_64-softmmu
|
2021-10-03 17:14:44 +03:00
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/i386
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
2021-10-05 13:47:27 +03:00
|
|
|
|
|
|
|
# Log and pow
|
2022-01-18 22:38:10 +03:00
|
|
|
target_link_libraries(x86_64-softmmu PRIVATE m)
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 21:35:43 +03:00
|
|
|
|
|
|
|
if(UNICORN_TRACER)
|
|
|
|
target_compile_options(x86_64-softmmu PRIVATE -DUNICORN_TRACER)
|
|
|
|
endif()
|
|
|
|
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_ARM)
|
|
|
|
add_library(arm-softmmu STATIC
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_ARCH_COMMON}
|
|
|
|
|
|
|
|
qemu/target/arm/cpu.c
|
|
|
|
qemu/target/arm/crypto_helper.c
|
|
|
|
qemu/target/arm/debug_helper.c
|
|
|
|
qemu/target/arm/helper.c
|
|
|
|
qemu/target/arm/iwmmxt_helper.c
|
|
|
|
qemu/target/arm/m_helper.c
|
|
|
|
qemu/target/arm/neon_helper.c
|
|
|
|
qemu/target/arm/op_helper.c
|
|
|
|
qemu/target/arm/psci.c
|
|
|
|
qemu/target/arm/tlb_helper.c
|
|
|
|
qemu/target/arm/translate.c
|
|
|
|
qemu/target/arm/vec_helper.c
|
|
|
|
qemu/target/arm/vfp_helper.c
|
|
|
|
qemu/target/arm/unicorn_arm.c
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
target_compile_options(arm-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
2020-06-02 11:04:33 +03:00
|
|
|
/FIarm.h
|
2021-10-03 17:14:44 +03:00
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/msvc/arm-softmmu
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/arm
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_options(arm-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
-include arm.h
|
|
|
|
-I${CMAKE_BINARY_DIR}/arm-softmmu
|
2021-10-03 17:14:44 +03:00
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/arm
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-01-18 21:35:43 +03:00
|
|
|
if(UNICORN_TRACER)
|
|
|
|
target_compile_options(arm-softmmu PRIVATE -DUNICORN_TRACER)
|
|
|
|
endif()
|
|
|
|
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_AARCH64)
|
|
|
|
add_library(aarch64-softmmu STATIC
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_ARCH_COMMON}
|
|
|
|
|
|
|
|
qemu/target/arm/cpu64.c
|
|
|
|
qemu/target/arm/cpu.c
|
|
|
|
qemu/target/arm/crypto_helper.c
|
|
|
|
qemu/target/arm/debug_helper.c
|
|
|
|
qemu/target/arm/helper-a64.c
|
|
|
|
qemu/target/arm/helper.c
|
|
|
|
qemu/target/arm/iwmmxt_helper.c
|
|
|
|
qemu/target/arm/m_helper.c
|
|
|
|
qemu/target/arm/neon_helper.c
|
|
|
|
qemu/target/arm/op_helper.c
|
|
|
|
qemu/target/arm/pauth_helper.c
|
|
|
|
qemu/target/arm/psci.c
|
|
|
|
qemu/target/arm/sve_helper.c
|
|
|
|
qemu/target/arm/tlb_helper.c
|
|
|
|
qemu/target/arm/translate-a64.c
|
|
|
|
qemu/target/arm/translate.c
|
|
|
|
qemu/target/arm/translate-sve.c
|
|
|
|
qemu/target/arm/vec_helper.c
|
|
|
|
qemu/target/arm/vfp_helper.c
|
|
|
|
qemu/target/arm/unicorn_aarch64.c
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
target_compile_options(aarch64-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
2020-06-02 11:04:33 +03:00
|
|
|
/FIaarch64.h
|
2021-10-03 17:14:44 +03:00
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/msvc/aarch64-softmmu
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/arm
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_options(aarch64-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
-include aarch64.h
|
|
|
|
-I${CMAKE_BINARY_DIR}/aarch64-softmmu
|
2021-10-03 17:14:44 +03:00
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/arm
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-01-18 21:35:43 +03:00
|
|
|
if(UNICORN_TRACER)
|
|
|
|
target_compile_options(aarch64-softmmu PRIVATE -DUNICORN_TRACER)
|
|
|
|
endif()
|
|
|
|
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_M68K)
|
|
|
|
add_library(m68k-softmmu STATIC
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_ARCH_COMMON}
|
|
|
|
|
|
|
|
qemu/target/m68k/cpu.c
|
|
|
|
qemu/target/m68k/fpu_helper.c
|
|
|
|
qemu/target/m68k/helper.c
|
|
|
|
qemu/target/m68k/op_helper.c
|
|
|
|
qemu/target/m68k/softfloat.c
|
|
|
|
qemu/target/m68k/translate.c
|
|
|
|
qemu/target/m68k/unicorn.c
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
target_compile_options(m68k-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
2020-06-02 11:04:33 +03:00
|
|
|
/FIm68k.h
|
2021-10-03 17:14:44 +03:00
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/msvc/m68k-softmmu
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/m68k
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_options(m68k-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
-include m68k.h
|
|
|
|
-I${CMAKE_BINARY_DIR}/m68k-softmmu
|
2021-10-03 17:14:44 +03:00
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/m68k
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
endif()
|
2022-01-18 21:35:43 +03:00
|
|
|
|
|
|
|
if(UNICORN_TRACER)
|
|
|
|
target_compile_options(m68k-softmmu PRIVATE -DUNICORN_TRACER)
|
|
|
|
endif()
|
|
|
|
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_MIPS)
|
|
|
|
add_library(mips-softmmu STATIC
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_ARCH_COMMON}
|
|
|
|
|
|
|
|
qemu/target/mips/cp0_helper.c
|
|
|
|
qemu/target/mips/cp0_timer.c
|
|
|
|
qemu/target/mips/cpu.c
|
|
|
|
qemu/target/mips/dsp_helper.c
|
|
|
|
qemu/target/mips/fpu_helper.c
|
|
|
|
qemu/target/mips/helper.c
|
|
|
|
qemu/target/mips/lmi_helper.c
|
|
|
|
qemu/target/mips/msa_helper.c
|
|
|
|
qemu/target/mips/op_helper.c
|
|
|
|
qemu/target/mips/translate.c
|
|
|
|
qemu/target/mips/unicorn.c
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
target_compile_options(mips-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
2020-06-02 11:04:33 +03:00
|
|
|
/FImips.h
|
2021-10-03 17:14:44 +03:00
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/msvc/mips-softmmu
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/mips
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_options(mips-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
-include mips.h
|
|
|
|
-I${CMAKE_BINARY_DIR}/mips-softmmu
|
2021-10-03 17:14:44 +03:00
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/mips
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-01-18 21:35:43 +03:00
|
|
|
if(UNICORN_TRACER)
|
|
|
|
target_compile_options(mips-softmmu PRIVATE -DUNICORN_TRACER)
|
|
|
|
endif()
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
add_library(mipsel-softmmu STATIC
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_ARCH_COMMON}
|
|
|
|
|
|
|
|
qemu/target/mips/cp0_helper.c
|
|
|
|
qemu/target/mips/cp0_timer.c
|
|
|
|
qemu/target/mips/cpu.c
|
|
|
|
qemu/target/mips/dsp_helper.c
|
|
|
|
qemu/target/mips/fpu_helper.c
|
|
|
|
qemu/target/mips/helper.c
|
|
|
|
qemu/target/mips/lmi_helper.c
|
|
|
|
qemu/target/mips/msa_helper.c
|
|
|
|
qemu/target/mips/op_helper.c
|
|
|
|
qemu/target/mips/translate.c
|
|
|
|
qemu/target/mips/unicorn.c
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
target_compile_options(mipsel-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
2020-06-02 11:04:33 +03:00
|
|
|
/FImipsel.h
|
2021-10-03 17:14:44 +03:00
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/msvc/mipsel-softmmu
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/mips
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_options(mipsel-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
-include mipsel.h
|
|
|
|
-I${CMAKE_BINARY_DIR}/mipsel-softmmu
|
2021-10-03 17:14:44 +03:00
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/mips
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-01-18 21:35:43 +03:00
|
|
|
if(UNICORN_TRACER)
|
|
|
|
target_compile_options(mipsel-softmmu PRIVATE -DUNICORN_TRACER)
|
|
|
|
endif()
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
add_library(mips64-softmmu STATIC
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_ARCH_COMMON}
|
|
|
|
|
|
|
|
qemu/target/mips/cp0_helper.c
|
|
|
|
qemu/target/mips/cp0_timer.c
|
|
|
|
qemu/target/mips/cpu.c
|
|
|
|
qemu/target/mips/dsp_helper.c
|
|
|
|
qemu/target/mips/fpu_helper.c
|
|
|
|
qemu/target/mips/helper.c
|
|
|
|
qemu/target/mips/lmi_helper.c
|
|
|
|
qemu/target/mips/msa_helper.c
|
|
|
|
qemu/target/mips/op_helper.c
|
|
|
|
qemu/target/mips/translate.c
|
|
|
|
qemu/target/mips/unicorn.c
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
target_compile_options(mips64-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
2020-06-02 11:04:33 +03:00
|
|
|
/FImips64.h
|
2021-10-03 17:14:44 +03:00
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/msvc/mips64-softmmu
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/mips
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_options(mips64-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
-include mips64.h
|
|
|
|
-I${CMAKE_BINARY_DIR}/mips64-softmmu
|
2021-10-03 17:14:44 +03:00
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/mips
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-01-18 21:35:43 +03:00
|
|
|
if(UNICORN_TRACER)
|
|
|
|
target_compile_options(mips64-softmmu PRIVATE -DUNICORN_TRACER)
|
|
|
|
endif()
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
add_library(mips64el-softmmu STATIC
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_ARCH_COMMON}
|
|
|
|
|
|
|
|
qemu/target/mips/cp0_helper.c
|
|
|
|
qemu/target/mips/cp0_timer.c
|
|
|
|
qemu/target/mips/cpu.c
|
|
|
|
qemu/target/mips/dsp_helper.c
|
|
|
|
qemu/target/mips/fpu_helper.c
|
|
|
|
qemu/target/mips/helper.c
|
|
|
|
qemu/target/mips/lmi_helper.c
|
|
|
|
qemu/target/mips/msa_helper.c
|
|
|
|
qemu/target/mips/op_helper.c
|
|
|
|
qemu/target/mips/translate.c
|
|
|
|
qemu/target/mips/unicorn.c
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
target_compile_options(mips64el-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
2020-06-02 11:04:33 +03:00
|
|
|
/FImips64el.h
|
2021-10-03 17:14:44 +03:00
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/msvc/mips64el-softmmu
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/mips
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_options(mips64el-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
-include mips64el.h
|
|
|
|
-I${CMAKE_BINARY_DIR}/mips64el-softmmu
|
2021-10-03 17:14:44 +03:00
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/mips
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
endif()
|
2022-01-18 21:35:43 +03:00
|
|
|
|
|
|
|
if(UNICORN_TRACER)
|
|
|
|
target_compile_options(mips64el-softmmu PRIVATE -DUNICORN_TRACER)
|
|
|
|
endif()
|
|
|
|
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_SPARC)
|
|
|
|
add_library(sparc-softmmu STATIC
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_ARCH_COMMON}
|
|
|
|
|
|
|
|
qemu/target/sparc/cc_helper.c
|
|
|
|
qemu/target/sparc/cpu.c
|
|
|
|
qemu/target/sparc/fop_helper.c
|
|
|
|
qemu/target/sparc/helper.c
|
|
|
|
qemu/target/sparc/int32_helper.c
|
|
|
|
qemu/target/sparc/ldst_helper.c
|
|
|
|
qemu/target/sparc/mmu_helper.c
|
|
|
|
qemu/target/sparc/translate.c
|
|
|
|
qemu/target/sparc/win_helper.c
|
|
|
|
qemu/target/sparc/unicorn.c
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
target_compile_options(sparc-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
2020-06-02 11:04:33 +03:00
|
|
|
/FIsparc.h
|
2021-10-03 17:14:44 +03:00
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/msvc/sparc-softmmu
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/sparc
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_options(sparc-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
-include sparc.h
|
|
|
|
-I${CMAKE_BINARY_DIR}/sparc-softmmu
|
2021-10-03 17:14:44 +03:00
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/sparc
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-01-18 21:35:43 +03:00
|
|
|
if(UNICORN_TRACER)
|
|
|
|
target_compile_options(sparc-softmmu PRIVATE -DUNICORN_TRACER)
|
|
|
|
endif()
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
add_library(sparc64-softmmu STATIC
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_ARCH_COMMON}
|
|
|
|
|
|
|
|
qemu/target/sparc/cc_helper.c
|
|
|
|
qemu/target/sparc/cpu.c
|
|
|
|
qemu/target/sparc/fop_helper.c
|
|
|
|
qemu/target/sparc/helper.c
|
|
|
|
qemu/target/sparc/int64_helper.c
|
|
|
|
qemu/target/sparc/ldst_helper.c
|
|
|
|
qemu/target/sparc/mmu_helper.c
|
|
|
|
qemu/target/sparc/translate.c
|
|
|
|
qemu/target/sparc/vis_helper.c
|
|
|
|
qemu/target/sparc/win_helper.c
|
|
|
|
qemu/target/sparc/unicorn64.c
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
target_compile_options(sparc64-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
2020-06-02 11:04:33 +03:00
|
|
|
/FIsparc64.h
|
2021-10-03 17:14:44 +03:00
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/msvc/sparc64-softmmu
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/sparc
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_options(sparc64-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
-include sparc64.h
|
|
|
|
-I${CMAKE_BINARY_DIR}/sparc64-softmmu
|
2021-10-03 17:14:44 +03:00
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/sparc
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
endif()
|
2022-01-18 21:35:43 +03:00
|
|
|
|
|
|
|
if(UNICORN_TRACER)
|
|
|
|
target_compile_options(sparc64-softmmu PRIVATE -DUNICORN_TRACER)
|
|
|
|
endif()
|
|
|
|
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_PPC)
|
|
|
|
add_library(ppc-softmmu STATIC
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_ARCH_COMMON}
|
|
|
|
|
|
|
|
qemu/hw/ppc/ppc.c
|
|
|
|
qemu/hw/ppc/ppc_booke.c
|
|
|
|
|
|
|
|
qemu/libdecnumber/decContext.c
|
|
|
|
qemu/libdecnumber/decNumber.c
|
|
|
|
qemu/libdecnumber/dpd/decimal128.c
|
|
|
|
qemu/libdecnumber/dpd/decimal32.c
|
|
|
|
qemu/libdecnumber/dpd/decimal64.c
|
|
|
|
|
|
|
|
qemu/target/ppc/cpu.c
|
|
|
|
qemu/target/ppc/cpu-models.c
|
|
|
|
qemu/target/ppc/dfp_helper.c
|
|
|
|
qemu/target/ppc/excp_helper.c
|
|
|
|
qemu/target/ppc/fpu_helper.c
|
|
|
|
qemu/target/ppc/int_helper.c
|
|
|
|
qemu/target/ppc/machine.c
|
|
|
|
qemu/target/ppc/mem_helper.c
|
|
|
|
qemu/target/ppc/misc_helper.c
|
|
|
|
qemu/target/ppc/mmu-hash32.c
|
|
|
|
qemu/target/ppc/mmu_helper.c
|
|
|
|
qemu/target/ppc/timebase_helper.c
|
|
|
|
qemu/target/ppc/translate.c
|
|
|
|
qemu/target/ppc/unicorn.c
|
|
|
|
)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
target_compile_options(ppc-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
/FIppc.h
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/msvc/ppc-softmmu
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/ppc
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_options(ppc-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
-include ppc.h
|
|
|
|
-I${CMAKE_BINARY_DIR}/ppc-softmmu
|
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/ppc
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-01-18 21:35:43 +03:00
|
|
|
if(UNICORN_TRACER)
|
|
|
|
target_compile_options(ppc-softmmu PRIVATE -DUNICORN_TRACER)
|
|
|
|
endif()
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
add_library(ppc64-softmmu STATIC
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_ARCH_COMMON}
|
|
|
|
|
|
|
|
qemu/hw/ppc/ppc.c
|
|
|
|
qemu/hw/ppc/ppc_booke.c
|
|
|
|
|
|
|
|
qemu/libdecnumber/decContext.c
|
|
|
|
qemu/libdecnumber/decNumber.c
|
|
|
|
qemu/libdecnumber/dpd/decimal128.c
|
|
|
|
qemu/libdecnumber/dpd/decimal32.c
|
|
|
|
qemu/libdecnumber/dpd/decimal64.c
|
|
|
|
|
|
|
|
qemu/target/ppc/compat.c
|
|
|
|
qemu/target/ppc/cpu.c
|
|
|
|
qemu/target/ppc/cpu-models.c
|
|
|
|
qemu/target/ppc/dfp_helper.c
|
|
|
|
qemu/target/ppc/excp_helper.c
|
|
|
|
qemu/target/ppc/fpu_helper.c
|
|
|
|
qemu/target/ppc/int_helper.c
|
|
|
|
qemu/target/ppc/machine.c
|
|
|
|
qemu/target/ppc/mem_helper.c
|
|
|
|
qemu/target/ppc/misc_helper.c
|
|
|
|
qemu/target/ppc/mmu-book3s-v3.c
|
|
|
|
qemu/target/ppc/mmu-hash32.c
|
|
|
|
qemu/target/ppc/mmu-hash64.c
|
|
|
|
qemu/target/ppc/mmu_helper.c
|
|
|
|
qemu/target/ppc/mmu-radix64.c
|
|
|
|
qemu/target/ppc/timebase_helper.c
|
|
|
|
qemu/target/ppc/translate.c
|
|
|
|
qemu/target/ppc/unicorn.c
|
|
|
|
)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
target_compile_options(ppc64-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
/FIppc64.h
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/msvc/ppc64-softmmu
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/ppc
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_options(ppc64-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
-include ppc64.h
|
|
|
|
-I${CMAKE_BINARY_DIR}/ppc64-softmmu
|
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/ppc
|
|
|
|
)
|
|
|
|
endif()
|
2022-01-18 21:35:43 +03:00
|
|
|
|
|
|
|
if(UNICORN_TRACER)
|
|
|
|
target_compile_options(ppc64-softmmu PRIVATE -DUNICORN_TRACER)
|
|
|
|
endif()
|
|
|
|
|
2021-10-03 17:14:44 +03:00
|
|
|
endif()
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_RISCV)
|
|
|
|
add_library(riscv32-softmmu STATIC
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_ARCH_COMMON}
|
|
|
|
|
|
|
|
qemu/target/riscv/cpu.c
|
|
|
|
qemu/target/riscv/cpu_helper.c
|
|
|
|
qemu/target/riscv/csr.c
|
|
|
|
qemu/target/riscv/fpu_helper.c
|
|
|
|
qemu/target/riscv/op_helper.c
|
|
|
|
qemu/target/riscv/pmp.c
|
|
|
|
qemu/target/riscv/translate.c
|
|
|
|
qemu/target/riscv/unicorn.c
|
|
|
|
)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
target_compile_options(riscv32-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
/FIriscv32.h
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/msvc/riscv32-softmmu
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/riscv
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_options(riscv32-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
-include riscv32.h
|
|
|
|
-I${CMAKE_BINARY_DIR}/riscv32-softmmu
|
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/riscv
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-01-18 21:35:43 +03:00
|
|
|
if(UNICORN_TRACER)
|
|
|
|
target_compile_options(riscv32-softmmu PRIVATE -DUNICORN_TRACER)
|
|
|
|
endif()
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
add_library(riscv64-softmmu STATIC
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_ARCH_COMMON}
|
|
|
|
|
|
|
|
qemu/target/riscv/cpu.c
|
|
|
|
qemu/target/riscv/cpu_helper.c
|
|
|
|
qemu/target/riscv/csr.c
|
|
|
|
qemu/target/riscv/fpu_helper.c
|
|
|
|
qemu/target/riscv/op_helper.c
|
|
|
|
qemu/target/riscv/pmp.c
|
|
|
|
qemu/target/riscv/translate.c
|
|
|
|
qemu/target/riscv/unicorn.c
|
|
|
|
)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
target_compile_options(riscv64-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
/FIriscv64.h
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/msvc/riscv64-softmmu
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/riscv
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_options(riscv64-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
-include riscv64.h
|
|
|
|
-I${CMAKE_BINARY_DIR}/riscv64-softmmu
|
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/riscv
|
|
|
|
)
|
|
|
|
endif()
|
2022-01-18 21:35:43 +03:00
|
|
|
|
|
|
|
if(UNICORN_TRACER)
|
|
|
|
target_compile_options(riscv64-softmmu PRIVATE -DUNICORN_TRACER)
|
|
|
|
endif()
|
|
|
|
|
2021-10-03 17:14:44 +03:00
|
|
|
endif()
|
|
|
|
|
2021-12-05 23:19:37 +03:00
|
|
|
if (UNICORN_HAS_S390X)
|
2022-01-20 00:32:00 +03:00
|
|
|
add_library(s390x-softmmu STATIC
|
2021-12-05 23:19:37 +03:00
|
|
|
${UNICORN_ARCH_COMMON}
|
|
|
|
|
|
|
|
qemu/hw/s390x/s390-skeys.c
|
|
|
|
|
|
|
|
qemu/target/s390x/cc_helper.c
|
|
|
|
qemu/target/s390x/cpu.c
|
|
|
|
qemu/target/s390x/cpu_features.c
|
|
|
|
qemu/target/s390x/cpu_models.c
|
|
|
|
qemu/target/s390x/crypto_helper.c
|
|
|
|
qemu/target/s390x/excp_helper.c
|
|
|
|
qemu/target/s390x/fpu_helper.c
|
|
|
|
qemu/target/s390x/helper.c
|
|
|
|
qemu/target/s390x/interrupt.c
|
|
|
|
qemu/target/s390x/int_helper.c
|
|
|
|
qemu/target/s390x/ioinst.c
|
|
|
|
qemu/target/s390x/mem_helper.c
|
|
|
|
qemu/target/s390x/misc_helper.c
|
|
|
|
qemu/target/s390x/mmu_helper.c
|
|
|
|
qemu/target/s390x/sigp.c
|
|
|
|
qemu/target/s390x/tcg-stub.c
|
|
|
|
qemu/target/s390x/translate.c
|
|
|
|
qemu/target/s390x/vec_fpu_helper.c
|
|
|
|
qemu/target/s390x/vec_helper.c
|
|
|
|
qemu/target/s390x/vec_int_helper.c
|
|
|
|
qemu/target/s390x/vec_string_helper.c
|
|
|
|
qemu/target/s390x/unicorn.c
|
|
|
|
)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
target_compile_options(s390x-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
/FIs390x.h
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/msvc/s390x-softmmu
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/s390x
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_options(s390x-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
-include s390x.h
|
|
|
|
-I${CMAKE_BINARY_DIR}/s390x-softmmu
|
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/s390x
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2021-10-03 17:14:44 +03:00
|
|
|
|
2022-04-30 00:11:34 +03:00
|
|
|
if (UNICORN_HAS_TRICORE)
|
|
|
|
add_library(tricore-softmmu STATIC
|
|
|
|
${UNICORN_ARCH_COMMON}
|
|
|
|
|
|
|
|
qemu/target/tricore/cpu.c
|
|
|
|
qemu/target/tricore/fpu_helper.c
|
|
|
|
qemu/target/tricore/helper.c
|
|
|
|
qemu/target/tricore/op_helper.c
|
|
|
|
qemu/target/tricore/translate.c
|
|
|
|
qemu/target/tricore/unicorn.c
|
|
|
|
)
|
|
|
|
|
|
|
|
if(MSVC)
|
|
|
|
target_compile_options(tricore-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
/FItricore.h
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/msvc/tricore-softmmu
|
|
|
|
/I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/tricore
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
target_compile_options(tricore-softmmu PRIVATE
|
|
|
|
-DNEED_CPU_H
|
|
|
|
-include tricore.h
|
|
|
|
-I${CMAKE_BINARY_DIR}/tricore-softmmu
|
|
|
|
-I${CMAKE_CURRENT_SOURCE_DIR}/qemu/target/tricore
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_SRCS
|
|
|
|
uc.c
|
|
|
|
|
|
|
|
qemu/softmmu/vl.c
|
|
|
|
|
|
|
|
qemu/hw/core/cpu.c
|
|
|
|
)
|
|
|
|
|
|
|
|
set(UNICORN_COMMON_SRCS
|
|
|
|
|
2019-09-08 11:42:43 +03:00
|
|
|
list.c
|
2021-10-03 17:14:44 +03:00
|
|
|
|
|
|
|
glib_compat/glib_compat.c
|
|
|
|
glib_compat/gtestutils.c
|
|
|
|
glib_compat/garray.c
|
|
|
|
glib_compat/gtree.c
|
|
|
|
glib_compat/grand.c
|
|
|
|
glib_compat/glist.c
|
|
|
|
glib_compat/gmem.c
|
|
|
|
glib_compat/gpattern.c
|
|
|
|
glib_compat/gslice.c
|
|
|
|
|
2019-09-08 11:42:43 +03:00
|
|
|
qemu/util/bitmap.c
|
|
|
|
qemu/util/bitops.c
|
|
|
|
qemu/util/crc32c.c
|
|
|
|
qemu/util/cutils.c
|
|
|
|
qemu/util/getauxval.c
|
2021-10-03 17:14:44 +03:00
|
|
|
qemu/util/guest-random.c
|
2019-09-08 11:42:43 +03:00
|
|
|
qemu/util/host-utils.c
|
2021-10-03 17:14:44 +03:00
|
|
|
qemu/util/osdep.c
|
|
|
|
qemu/util/qdist.c
|
|
|
|
qemu/util/qemu-timer.c
|
2019-09-08 11:42:43 +03:00
|
|
|
qemu/util/qemu-timer-common.c
|
2021-10-03 17:14:44 +03:00
|
|
|
qemu/util/range.c
|
|
|
|
qemu/util/qht.c
|
|
|
|
qemu/util/pagesize.c
|
|
|
|
qemu/util/cacheinfo.c
|
|
|
|
|
|
|
|
qemu/crypto/aes.c
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
|
|
|
|
2021-10-03 17:14:44 +03:00
|
|
|
# A workaround to avoid circle dependency between unicorn and *-softmmu
|
2022-01-18 22:38:10 +03:00
|
|
|
if(MSVC)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_COMMON_SRCS
|
|
|
|
${UNICORN_COMMON_SRCS}
|
2019-09-08 11:42:43 +03:00
|
|
|
qemu/util/oslib-win32.c
|
|
|
|
qemu/util/qemu-thread-win32.c
|
|
|
|
)
|
2022-01-18 22:38:10 +03:00
|
|
|
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
|
|
|
|
if(MSVC_VERSION LESS 1600 AND MSVC_IDE)
|
2021-05-16 16:36:33 +03:00
|
|
|
add_custom_command(OUTPUT "${CMAKE_CURRENT_SOURCE_DIR}/build/setjmp-wrapper-win32.dir/setjmp-wrapper-win32.obj"
|
|
|
|
COMMAND ml64 /c /nologo /Fo"${CMAKE_CURRENT_SOURCE_DIR}/build/setjmp-wrapper-win32.dir/setjmp-wrapper-win32.obj" /W3 /errorReport:prompt /Ta"${CMAKE_CURRENT_SOURCE_DIR}/qemu/util/setjmp-wrapper-win32.asm"
|
|
|
|
DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/qemu/util/setjmp-wrapper-win32.asm"
|
|
|
|
)
|
|
|
|
set(UNICORN_SRCS ${UNICORN_SRCS} "${CMAKE_CURRENT_SOURCE_DIR}/build/setjmp-wrapper-win32.dir/setjmp-wrapper-win32.obj")
|
|
|
|
else()
|
|
|
|
enable_language(ASM_MASM)
|
|
|
|
endif()
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_COMMON_SRCS ${UNICORN_COMMON_SRCS} qemu/util/setjmp-wrapper-win32.asm)
|
2022-05-03 01:01:30 +03:00
|
|
|
set_property(SOURCE qemu/util/setjmp-wrapper-win32.asm PROPERTY LANGUAGE ASM_MASM)
|
2020-09-21 21:02:43 +03:00
|
|
|
endif()
|
2019-09-08 11:42:43 +03:00
|
|
|
else()
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_COMMON_SRCS
|
|
|
|
${UNICORN_COMMON_SRCS}
|
2019-09-08 11:42:43 +03:00
|
|
|
qemu/util/oslib-posix.c
|
|
|
|
qemu/util/qemu-thread-posix.c
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
add_library(unicorn-common STATIC
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_COMMON_SRCS}
|
|
|
|
)
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
if(NOT MSVC AND NOT ANDROID_ABI)
|
|
|
|
target_link_libraries(unicorn-common PRIVATE pthread)
|
2021-10-03 17:14:44 +03:00
|
|
|
endif()
|
|
|
|
|
2022-04-30 01:25:27 +03:00
|
|
|
add_library(unicorn ${UNICORN_SRCS})
|
|
|
|
# For static archive
|
2022-04-12 19:49:15 +03:00
|
|
|
if (BUILD_SHARED_LIBS)
|
2022-04-30 01:25:27 +03:00
|
|
|
add_library(unicorn_static STATIC ${UNICORN_SRCS})
|
2022-04-12 19:49:15 +03:00
|
|
|
endif()
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
if(BUILD_SHARED_LIBS)
|
|
|
|
if(ANDROID_ABI)
|
2021-10-16 21:35:23 +03:00
|
|
|
file(APPEND ${CMAKE_BINARY_DIR}/adb.sh "adb push ./libunicorn.so /data/local/tmp/build/\n")
|
|
|
|
endif()
|
2021-10-03 17:14:44 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
set(UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} unicorn-common)
|
2023-12-28 18:14:10 +03:00
|
|
|
if (ATOMIC_LINKAGE_FIX)
|
|
|
|
set(UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} -latomic)
|
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_X86)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} -DUNICORN_HAS_X86)
|
|
|
|
set(UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} x86_64-softmmu)
|
2022-11-29 19:00:51 +03:00
|
|
|
set(UNICORN_SAMPLE_FILE ${UNICORN_SAMPLE_FILE} sample_x86 sample_x86_32_gdt_and_seg_regs sample_batch_reg mem_apis shellcode sample_mmu)
|
2022-01-19 00:23:38 +03:00
|
|
|
target_link_libraries(x86_64-softmmu PRIVATE unicorn-common)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_x86)
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_ARM)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} -DUNICORN_HAS_ARM)
|
2022-02-12 16:15:54 +03:00
|
|
|
set(UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} arm-softmmu)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_SAMPLE_FILE ${UNICORN_SAMPLE_FILE} sample_arm)
|
2022-01-19 00:23:38 +03:00
|
|
|
target_link_libraries(arm-softmmu PRIVATE unicorn-common)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_arm)
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_AARCH64)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} -DUNICORN_HAS_ARM64)
|
2022-02-12 16:15:54 +03:00
|
|
|
set(UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} aarch64-softmmu)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_SAMPLE_FILE ${UNICORN_SAMPLE_FILE} sample_arm64)
|
2022-01-19 00:23:38 +03:00
|
|
|
target_link_libraries(aarch64-softmmu PRIVATE unicorn-common)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_arm64)
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_M68K)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} -DUNICORN_HAS_M68K)
|
|
|
|
set(UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} m68k-softmmu)
|
|
|
|
set(UNICORN_SAMPLE_FILE ${UNICORN_SAMPLE_FILE} sample_m68k)
|
2022-01-19 00:23:38 +03:00
|
|
|
target_link_libraries(m68k-softmmu PRIVATE unicorn-common)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_m68k)
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_MIPS)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} -DUNICORN_HAS_MIPS -DUNICORN_HAS_MIPSEL -DUNICORN_HAS_MIPS64 -DUNICORN_HAS_MIPS64EL)
|
|
|
|
set(UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} mips-softmmu mipsel-softmmu mips64-softmmu mips64el-softmmu)
|
|
|
|
set(UNICORN_SAMPLE_FILE ${UNICORN_SAMPLE_FILE} sample_mips)
|
2022-01-19 00:23:38 +03:00
|
|
|
target_link_libraries(mips-softmmu PRIVATE unicorn-common)
|
|
|
|
target_link_libraries(mipsel-softmmu PRIVATE unicorn-common)
|
|
|
|
target_link_libraries(mips64-softmmu PRIVATE unicorn-common)
|
|
|
|
target_link_libraries(mips64el-softmmu PRIVATE unicorn-common)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_mips)
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_SPARC)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} -DUNICORN_HAS_SPARC)
|
|
|
|
set(UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} sparc-softmmu sparc64-softmmu)
|
|
|
|
set(UNICORN_SAMPLE_FILE ${UNICORN_SAMPLE_FILE} sample_sparc)
|
2022-01-19 00:23:38 +03:00
|
|
|
target_link_libraries(sparc-softmmu PRIVATE unicorn-common)
|
|
|
|
target_link_libraries(sparc64-softmmu PRIVATE unicorn-common)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_sparc)
|
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_PPC)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} -DUNICORN_HAS_PPC)
|
|
|
|
set(UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} ppc-softmmu ppc64-softmmu)
|
|
|
|
set(UNICORN_SAMPLE_FILE ${UNICORN_SAMPLE_FILE} sample_ppc)
|
2022-01-19 00:23:38 +03:00
|
|
|
target_link_libraries(ppc-softmmu PRIVATE unicorn-common)
|
|
|
|
target_link_libraries(ppc64-softmmu PRIVATE unicorn-common)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_ppc)
|
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_HAS_RISCV)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} -DUNICORN_HAS_RISCV)
|
|
|
|
set(UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} riscv32-softmmu riscv64-softmmu)
|
|
|
|
set(UNICORN_SAMPLE_FILE ${UNICORN_SAMPLE_FILE} sample_riscv)
|
2022-01-19 00:23:38 +03:00
|
|
|
target_link_libraries(riscv32-softmmu PRIVATE unicorn-common)
|
|
|
|
target_link_libraries(riscv64-softmmu PRIVATE unicorn-common)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_riscv)
|
2019-09-08 11:42:43 +03:00
|
|
|
endif()
|
2021-12-05 23:19:37 +03:00
|
|
|
if (UNICORN_HAS_S390X)
|
|
|
|
set(UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} -DUNICORN_HAS_S390X)
|
|
|
|
set(UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} s390x-softmmu)
|
|
|
|
set(UNICORN_SAMPLE_FILE ${UNICORN_SAMPLE_FILE} sample_s390x)
|
2022-04-17 17:16:11 +03:00
|
|
|
target_link_libraries(s390x-softmmu PRIVATE unicorn-common)
|
2021-12-05 23:19:37 +03:00
|
|
|
set(UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_s390x)
|
|
|
|
endif()
|
2022-04-30 00:11:34 +03:00
|
|
|
if (UNICORN_HAS_TRICORE)
|
|
|
|
set(UNICORN_COMPILE_OPTIONS ${UNICORN_COMPILE_OPTIONS} -DUNICORN_HAS_TRICORE)
|
|
|
|
set(UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} tricore-softmmu)
|
|
|
|
set(UNICORN_SAMPLE_FILE ${UNICORN_SAMPLE_FILE} sample_tricore)
|
|
|
|
target_link_libraries(tricore-softmmu unicorn-common)
|
|
|
|
set(UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_tricore)
|
|
|
|
endif()
|
2019-09-08 11:42:43 +03:00
|
|
|
|
2021-10-20 22:27:22 +03:00
|
|
|
# Extra tests
|
|
|
|
set(UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_mem)
|
2021-11-01 02:39:36 +03:00
|
|
|
set(UNICORN_TEST_FILE ${UNICORN_TEST_FILE} test_ctl)
|
|
|
|
set(UNICORN_SAMPLE_FILE ${UNICORN_SAMPLE_FILE} sample_ctl)
|
2021-10-20 22:27:22 +03:00
|
|
|
|
2022-01-18 21:35:43 +03:00
|
|
|
if(UNICORN_TRACER)
|
|
|
|
target_compile_options(unicorn-common PRIVATE -DUNICORN_TRACER)
|
|
|
|
target_compile_options(unicorn PRIVATE -DUNICORN_TRACER)
|
|
|
|
endif()
|
|
|
|
|
2022-04-16 14:40:04 +03:00
|
|
|
target_compile_options(unicorn-common PRIVATE
|
2022-01-18 21:35:43 +03:00
|
|
|
${UNICORN_COMPILE_OPTIONS}
|
|
|
|
)
|
|
|
|
|
2022-04-30 01:25:27 +03:00
|
|
|
target_compile_options(unicorn PRIVATE
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_COMPILE_OPTIONS}
|
2020-05-31 19:00:07 +03:00
|
|
|
)
|
2019-09-08 11:42:43 +03:00
|
|
|
|
2022-04-30 01:25:27 +03:00
|
|
|
# For static archive
|
|
|
|
if (BUILD_SHARED_LIBS)
|
|
|
|
target_compile_options(unicorn_static PRIVATE
|
|
|
|
${UNICORN_COMPILE_OPTIONS}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
if(MINGW)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} pthread)
|
|
|
|
endif()
|
|
|
|
|
2023-12-28 18:18:13 +03:00
|
|
|
if(ATOMIC_LINKAGE_FIX)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(UNICORN_LINK_LIBRARIES ${UNICORN_LINK_LIBRARIES} atomic)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(MSVC)
|
2022-01-18 22:38:10 +03:00
|
|
|
if(BUILD_SHARED_LIBS)
|
2022-04-30 01:25:27 +03:00
|
|
|
target_compile_options(unicorn PRIVATE
|
2021-10-03 17:14:44 +03:00
|
|
|
-DUNICORN_SHARED
|
|
|
|
)
|
2022-04-30 01:25:27 +03:00
|
|
|
|
|
|
|
# For static archive
|
|
|
|
target_link_libraries(unicorn_static PRIVATE
|
|
|
|
${UNICORN_LINK_LIBRARIES}
|
|
|
|
)
|
2020-05-31 19:00:07 +03:00
|
|
|
endif()
|
|
|
|
|
2022-04-30 01:25:27 +03:00
|
|
|
target_link_libraries(unicorn PRIVATE
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_LINK_LIBRARIES}
|
2019-09-08 11:42:43 +03:00
|
|
|
)
|
2021-11-07 23:07:53 +03:00
|
|
|
|
2022-04-30 01:25:27 +03:00
|
|
|
set_target_properties(unicorn PROPERTIES
|
2021-11-07 23:07:53 +03:00
|
|
|
VERSION "${UNICORN_VERSION_MAJOR}.${UNICORN_VERSION_MINOR}"
|
|
|
|
)
|
2019-09-08 11:42:43 +03:00
|
|
|
else()
|
2022-04-30 01:25:27 +03:00
|
|
|
target_link_libraries(unicorn PRIVATE
|
2021-10-03 17:14:44 +03:00
|
|
|
${UNICORN_LINK_LIBRARIES}
|
|
|
|
m
|
|
|
|
)
|
2022-04-12 19:49:15 +03:00
|
|
|
|
2022-04-30 01:25:27 +03:00
|
|
|
target_link_libraries(unicorn PUBLIC
|
2022-04-12 19:49:15 +03:00
|
|
|
m
|
|
|
|
)
|
|
|
|
|
2022-04-30 01:25:27 +03:00
|
|
|
# For static archive
|
|
|
|
if (BUILD_SHARED_LIBS)
|
|
|
|
target_link_libraries(unicorn_static PUBLIC
|
|
|
|
m
|
|
|
|
)
|
|
|
|
|
|
|
|
target_link_libraries(unicorn_static PRIVATE
|
|
|
|
${UNICORN_LINK_LIBRARIES}
|
|
|
|
m
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
set_target_properties(unicorn PROPERTIES
|
2019-09-08 11:42:43 +03:00
|
|
|
VERSION ${UNICORN_VERSION_MAJOR}
|
|
|
|
SOVERSION ${UNICORN_VERSION_MAJOR}
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2021-10-03 17:14:44 +03:00
|
|
|
if(MSVC)
|
|
|
|
set(SAMPLES_LIB
|
|
|
|
unicorn
|
|
|
|
)
|
2021-10-05 23:42:44 +03:00
|
|
|
elseif(NOT ANDROID_ABI)
|
2021-10-03 17:14:44 +03:00
|
|
|
set(SAMPLES_LIB
|
|
|
|
unicorn
|
|
|
|
pthread
|
|
|
|
)
|
2021-10-05 23:42:44 +03:00
|
|
|
else()
|
|
|
|
set(SAMPLES_LIB
|
|
|
|
unicorn
|
|
|
|
)
|
2021-10-03 17:14:44 +03:00
|
|
|
endif()
|
2019-09-08 11:42:43 +03:00
|
|
|
|
2023-12-28 18:38:33 +03:00
|
|
|
if(ATOMIC_LINKAGE_FIX)
|
|
|
|
set(SAMPLES_LIB
|
|
|
|
${SAMPLES_LIB}
|
|
|
|
atomic
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
2022-04-30 01:25:27 +03:00
|
|
|
target_include_directories(unicorn PUBLIC
|
2022-04-12 19:49:15 +03:00
|
|
|
include
|
|
|
|
)
|
|
|
|
|
2022-04-30 01:25:27 +03:00
|
|
|
# For static archive
|
|
|
|
if (BUILD_SHARED_LIBS)
|
|
|
|
target_include_directories(unicorn_static PUBLIC
|
2022-05-23 23:29:07 +03:00
|
|
|
include
|
2022-04-30 01:25:27 +03:00
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
# Black magic for generating static archives...
|
|
|
|
if (BUILD_SHARED_LIBS)
|
2022-05-02 18:51:03 +03:00
|
|
|
if (MSVC)
|
|
|
|
# Avoid the import lib built by MVSC clash with our archive.
|
2022-05-03 00:34:08 +03:00
|
|
|
set_target_properties(unicorn PROPERTIES ARCHIVE_OUTPUT_NAME "unicorn-import")
|
2022-05-02 18:51:03 +03:00
|
|
|
endif()
|
2022-04-30 01:25:27 +03:00
|
|
|
bundle_static_library(unicorn_static unicorn_archive unicorn)
|
|
|
|
else()
|
|
|
|
# Rename the "static" lib to avoid filename clash.
|
|
|
|
set_target_properties(unicorn PROPERTIES OUTPUT_NAME "unicorn-static")
|
|
|
|
bundle_static_library(unicorn unicorn_archive unicorn)
|
2022-04-12 19:49:15 +03:00
|
|
|
endif()
|
2021-10-06 13:06:59 +03:00
|
|
|
|
2021-10-06 17:24:52 +03:00
|
|
|
if(UNICORN_FUZZ)
|
2022-02-12 16:17:33 +03:00
|
|
|
set(UNICORN_FUZZ_SUFFIX "arm_arm;arm_armbe;arm_thumb;arm64_arm;arm64_armbe;m68k_be;mips_32be;mips_32le;sparc_32be;x86_16;x86_32;x86_64;s390x_be")
|
2022-01-18 23:37:32 +03:00
|
|
|
if (NOT APPLE)
|
|
|
|
set(SAMPLES_LIB ${SAMPLES_LIB} rt)
|
|
|
|
endif()
|
2021-10-06 17:24:52 +03:00
|
|
|
foreach(SUFFIX ${UNICORN_FUZZ_SUFFIX})
|
|
|
|
add_executable(fuzz_emu_${SUFFIX}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/fuzz/fuzz_emu_${SUFFIX}.c
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/fuzz/onedir.c
|
|
|
|
)
|
2022-01-18 22:38:10 +03:00
|
|
|
target_link_libraries(fuzz_emu_${SUFFIX} PRIVATE
|
2021-10-06 17:24:52 +03:00
|
|
|
${SAMPLES_LIB}
|
|
|
|
)
|
|
|
|
endforeach()
|
2022-01-18 22:38:10 +03:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if(UNICORN_BUILD_TESTS)
|
|
|
|
enable_testing()
|
2021-10-06 17:24:52 +03:00
|
|
|
foreach(SAMPLE_FILE ${UNICORN_SAMPLE_FILE})
|
2021-10-16 21:35:23 +03:00
|
|
|
add_executable(${SAMPLE_FILE}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/samples/${SAMPLE_FILE}.c
|
|
|
|
)
|
2022-01-18 22:38:10 +03:00
|
|
|
target_link_libraries(${SAMPLE_FILE} PRIVATE
|
2021-10-16 21:35:23 +03:00
|
|
|
${SAMPLES_LIB}
|
|
|
|
)
|
2022-01-18 22:38:10 +03:00
|
|
|
endforeach()
|
2021-03-30 18:32:56 +03:00
|
|
|
|
2021-10-16 21:35:23 +03:00
|
|
|
foreach(TEST_FILE ${UNICORN_TEST_FILE})
|
|
|
|
add_executable(${TEST_FILE}
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/tests/unit/${TEST_FILE}.c
|
|
|
|
)
|
2022-08-19 04:29:24 +03:00
|
|
|
target_compile_options(${TEST_FILE} PRIVATE
|
|
|
|
${UNICORN_COMPILE_OPTIONS}
|
|
|
|
)
|
2022-01-18 22:38:10 +03:00
|
|
|
target_link_libraries(${TEST_FILE} PRIVATE
|
2021-10-16 21:35:23 +03:00
|
|
|
${SAMPLES_LIB}
|
|
|
|
)
|
|
|
|
add_test(${TEST_FILE} ${TEST_FILE})
|
2022-01-18 22:38:10 +03:00
|
|
|
if(ANDROID_ABI)
|
2021-10-16 21:35:23 +03:00
|
|
|
file(APPEND ${CMAKE_BINARY_DIR}/adb.sh "adb push ${TEST_FILE} /data/local/tmp/build/\n")
|
|
|
|
file(APPEND ${CMAKE_BINARY_DIR}/adb.sh "adb shell \"chmod +x /data/local/tmp/build/${TEST_FILE}\"\n")
|
|
|
|
file(APPEND ${CMAKE_BINARY_DIR}/adb.sh "adb shell \'LD_LIBRARY_PATH=/data/local/tmp/build:$LD_LIBRARY_PATH /data/local/tmp/build/${TEST_FILE}\' || exit -1\n")
|
|
|
|
endif()
|
2022-08-14 16:42:37 +03:00
|
|
|
if (UNICORN_TARGET_ARCH STREQUAL "aarch64" OR UNICORN_TARGET_ARCH STREQUAL "ppc")
|
|
|
|
target_compile_definitions(${TEST_FILE} PRIVATE TARGET_READ_INLINED)
|
|
|
|
endif()
|
2022-01-18 22:38:10 +03:00
|
|
|
endforeach()
|
2021-10-06 13:06:59 +03:00
|
|
|
endif()
|
2019-09-08 11:42:43 +03:00
|
|
|
|
2022-04-04 01:26:00 +03:00
|
|
|
|
2022-01-18 22:38:10 +03:00
|
|
|
if(UNICORN_INSTALL AND NOT MSVC)
|
2019-09-08 11:42:43 +03:00
|
|
|
include("GNUInstallDirs")
|
|
|
|
file(GLOB UNICORN_HEADERS ${CMAKE_CURRENT_SOURCE_DIR}/include/unicorn/*.h)
|
2022-04-12 19:49:15 +03:00
|
|
|
if (BUILD_SHARED_LIBS)
|
|
|
|
install(TARGETS unicorn
|
|
|
|
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}
|
|
|
|
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
|
|
|
|
)
|
|
|
|
endif()
|
2022-04-30 01:25:27 +03:00
|
|
|
install(FILES $<TARGET_FILE:unicorn_archive> DESTINATION ${CMAKE_INSTALL_LIBDIR})
|
2019-09-08 11:42:43 +03:00
|
|
|
install(FILES ${UNICORN_HEADERS} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/unicorn)
|
2023-12-28 18:18:13 +03:00
|
|
|
if (ATOMIC_LINKAGE_FIX)
|
|
|
|
set(ATOMIC_LINK_PKG_CONFIG " -latomic")
|
|
|
|
else()
|
|
|
|
set(ATOMIC_LINK_PKG_CONFIG "")
|
|
|
|
endif()
|
2019-09-08 11:42:43 +03:00
|
|
|
file(WRITE ${CMAKE_BINARY_DIR}/unicorn.pc "Name: unicorn\n\
|
|
|
|
Description: Unicorn emulator engine\n\
|
|
|
|
Version: ${UNICORN_VERSION_MAJOR}.${UNICORN_VERSION_MINOR}.${UNICORN_VERSION_PATCH}\n\
|
|
|
|
libdir=${CMAKE_INSTALL_FULL_LIBDIR}\n\
|
|
|
|
includedir=${CMAKE_INSTALL_FULL_INCLUDEDIR}\n\
|
2022-04-16 16:57:54 +03:00
|
|
|
Libs: -L\$\{libdir\} -lunicorn\n\
|
2023-12-28 18:18:13 +03:00
|
|
|
Libs.private: -lpthread -lm${ATOMIC_LINK_PKG_CONFIG}\n\
|
2019-09-08 11:42:43 +03:00
|
|
|
Cflags: -I\$\{includedir\}\n"
|
|
|
|
)
|
|
|
|
install(FILES ${CMAKE_BINARY_DIR}/unicorn.pc DESTINATION ${CMAKE_INSTALL_LIBDIR}/pkgconfig)
|
|
|
|
endif()
|