2f9dea5cc3
590c10e37 fix typo 396715a89 use github action 69a25fd92 change build status to travis-ci.com a6a9dac91 meanings of the name 8d1e41b65 test_util.cpp supports OpenBSD 77ffe7173 Merge pull request #115 from Ryan-rsm-McKenzie/master a1da3403a fix build interface include directory e0136d4ef fix add_library call with INTERFACE 3071eee0c support slightly more modern cmake e626d6209 v5.991 a49c4bc11 disable XBYAK_CONSTEXPR for g++-5 -std=c++-14 70777a699 Merge branch 'atafra-old_mac_fix' into dev 6b81678d0 fixed compile error on some older macOS versions 2c3b43f15 refactor util 91784e2b8 test_util checks AMX and AVX_VNNI 70b70c557 update to v5.99 284cc5bed refactor 6b3eb9c1e default encoding is always evex f85b1100b refactor vnni 276d09bae Merge branch 'akharito-akharito/adl_support' into dev 50df86ce3 v5.98 97ce92d58 Merge branch 'akharito/adl_support' of https://github.com/akharito/xbyak into akharito-akharito/adl_support 1f119a04a support [scale * reg] 9ee1bef9a cpuid - check that GRT CPUID leaf 7 subleaf 0 should return EAX=1 be93adb2c add AVX VNNI instruction support 0c277240a add ADL CPUID a9a5cc2e2 Add option to choose VEX or EVEX encoding 29bfd25ba fix indent a0c49fa2e Merge branch 'atafra-mac_avx512_fix' into dev ea388b3c6 fixed incorrect detection of AVX-512 on macOS ed1b8186f Merge branch 'FEX-Emu-extended_features' into dev 3dacddfec Merge branch 'extended_features' of https://github.com/FEX-Emu/xbyak into FEX-Emu-extended_features 898f78ca3 Merge branch 'kariya-mitsuru-use-sh' 0b7f1411c Merge branch 'use-sh' of https://github.com/kariya-mitsuru/xbyak into kariya-mitsuru-use-sh 99e2b13b2 Fixes extended feature support checking b0a43c7e5 Use sh instead of tcsh for test scripts 87e8f41ae remove warning of _MSC_VER git-subtree-dir: externals/xbyak git-subtree-split: 590c10e3746978dbfcf102d6da933ac2659e4544
146 lines
5 KiB
CMake
146 lines
5 KiB
CMake
cmake_minimum_required(VERSION 3.8)
|
|
project(dynarmic C CXX)
|
|
|
|
# Determine if we're built as a subproject (using add_subdirectory)
|
|
# or if this is the master project.
|
|
set(MASTER_PROJECT OFF)
|
|
if (CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
|
|
set(MASTER_PROJECT ON)
|
|
endif()
|
|
|
|
# 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_NO_EXECUTE_SUPPORT "Enables support for systems that require W^X" OFF)
|
|
option(DYNARMIC_FATAL_ERRORS "Errors are fatal" OFF)
|
|
option(DYNARMIC_TESTS "Build tests" ${MASTER_PROJECT})
|
|
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_WARNINGS_AS_ERRORS "Warnings as errors" ${MASTER_PROJECT})
|
|
if (NOT DEFINED DYNARMIC_FRONTENDS)
|
|
set(DYNARMIC_FRONTENDS "A32;A64" CACHE STRING "Selects which frontends to enable")
|
|
endif()
|
|
|
|
# Default to a Release build
|
|
if (NOT CMAKE_BUILD_TYPE)
|
|
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
|
|
message(STATUS "Defaulting to a Release build")
|
|
endif()
|
|
|
|
# Set hard requirements for C++
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
set(CMAKE_CXX_EXTENSIONS OFF)
|
|
|
|
# Disable in-source builds
|
|
set(CMAKE_DISABLE_SOURCE_CHANGES ON)
|
|
set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
|
|
if ("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}")
|
|
message(SEND_ERROR "In-source builds are not allowed.")
|
|
endif()
|
|
|
|
# Add the module directory to the list of paths
|
|
list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules")
|
|
|
|
# Compiler flags
|
|
if (MSVC)
|
|
set(DYNARMIC_CXX_FLAGS
|
|
/std:c++latest # CMAKE_CXX_STANDARD has no effect on MSVC until CMake 3.10.
|
|
/experimental:external
|
|
/external:W0
|
|
/external:anglebrackets
|
|
/W4
|
|
/w44263 # Non-virtual member function hides base class virtual function
|
|
/w44265 # Class has virtual functions, but destructor is not virtual
|
|
/w44456 # Declaration of 'var' hides previous local declaration
|
|
/w44457 # Declaration of 'var' hides function parameter
|
|
/w44458 # Declaration of 'var' hides class member
|
|
/w44459 # Declaration of 'var' hides global definition
|
|
/w44946 # Reinterpret-cast between related types
|
|
/wd4592 # Symbol will be dynamically initialized (implementation limitation)
|
|
/permissive- # Stricter C++ standards conformance
|
|
/MP
|
|
/Zi
|
|
/Zo
|
|
/EHsc
|
|
/Zc:externConstexpr # Allows external linkage for variables declared "extern constexpr", as the standard permits.
|
|
/Zc:inline # Omits inline functions from object-file output.
|
|
/Zc:throwingNew # Assumes new (without std::nothrow) never returns null.
|
|
/volatile:iso # Use strict standard-abiding volatile semantics
|
|
/bigobj # Increase number of sections in .obj files
|
|
/DNOMINMAX)
|
|
|
|
if (DYNARMIC_WARNINGS_AS_ERRORS)
|
|
list(APPEND DYNARMIC_CXX_FLAGS
|
|
/WX)
|
|
endif()
|
|
|
|
if (CMAKE_VS_PLATFORM_TOOLSET MATCHES "LLVM-vs[0-9]+")
|
|
list(APPEND DYNARMIC_CXX_FLAGS
|
|
-Qunused-arguments
|
|
-Wno-missing-braces)
|
|
endif()
|
|
else()
|
|
set(DYNARMIC_CXX_FLAGS
|
|
-Wall
|
|
-Wextra
|
|
-Wcast-qual
|
|
-pedantic
|
|
-pedantic-errors
|
|
-Wno-missing-braces)
|
|
|
|
if (DYNARMIC_WARNINGS_AS_ERRORS)
|
|
list(APPEND DYNARMIC_CXX_FLAGS
|
|
-Werror)
|
|
endif()
|
|
|
|
if (DYNARMIC_FATAL_ERRORS)
|
|
list(APPEND DYNARMIC_CXX_FLAGS
|
|
-Wfatal-errors)
|
|
endif()
|
|
|
|
if (CMAKE_CXX_COMPILER_ID MATCHES "[Cc]lang")
|
|
# Bracket depth determines maximum size of a fold expression in Clang since 9c9974c3ccb6.
|
|
# And this in turns limits the size of a std::array.
|
|
list(APPEND DYNARMIC_CXX_FLAGS -fbracket-depth=1024)
|
|
endif()
|
|
endif()
|
|
|
|
# Arch detection
|
|
include(DetectArchitecture)
|
|
if (NOT DEFINED ARCHITECTURE)
|
|
message(FATAL_ERROR "Unsupported architecture encountered. Ending CMake generation.")
|
|
endif()
|
|
message(STATUS "Target architecture: ${ARCHITECTURE}")
|
|
|
|
# Include Boost
|
|
if (NOT TARGET boost)
|
|
if (NOT Boost_INCLUDE_DIRS)
|
|
find_package(Boost 1.57.0 REQUIRED)
|
|
endif()
|
|
add_library(boost INTERFACE)
|
|
target_include_directories(boost SYSTEM INTERFACE ${Boost_INCLUDE_DIRS})
|
|
endif()
|
|
|
|
# Enable unit-testing.
|
|
enable_testing(true)
|
|
|
|
# Include LLVM
|
|
if (DYNARMIC_USE_LLVM)
|
|
find_package(LLVM REQUIRED CONFIG)
|
|
include_directories(${LLVM_INCLUDE_DIRS})
|
|
add_definitions(-DDYNARMIC_USE_LLVM ${LLVM_DEFINITIONS})
|
|
llvm_map_components_to_libnames(llvm_libs armdesc armdisassembler aarch64desc aarch64disassembler x86desc x86disassembler)
|
|
endif()
|
|
|
|
if (DYNARMIC_TESTS_USE_UNICORN)
|
|
find_package(Unicorn REQUIRED)
|
|
endif()
|
|
|
|
# Pull in externals CMakeLists for libs where available
|
|
add_subdirectory(externals)
|
|
|
|
# Dynarmic project files
|
|
add_subdirectory(src)
|
|
if (DYNARMIC_TESTS)
|
|
add_subdirectory(tests)
|
|
endif()
|