From ec3883181b77bc55a5cc68d4ce9254eebedc6849 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Wed, 10 Mar 2021 11:36:19 -0800 Subject: [PATCH] Adds x86-64 host performance warning Lets users know that x86-64 isn't our optimal target but can still be used if passed in a new cmake argument. Easy enough just pass in -DENABLE_X86_HOST_DEBUG=True to cmake. Closes #776 --- .github/workflows/ccpp.yml | 2 +- CMakeLists.txt | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ccpp.yml b/.github/workflows/ccpp.yml index f11b02017..7f46aec65 100644 --- a/.github/workflows/ccpp.yml +++ b/.github/workflows/ccpp.yml @@ -45,7 +45,7 @@ jobs: # Note the current convention is to use the -S and -B options here to specify source # and build directories, but this is only available with CMake 3.13 and higher. # The CMake binaries on the Github Actions machines are (as of this writing) 3.12 - run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -G Ninja -DENABLE_LTO=False -DENABLE_ASSERTIONS=True + run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -G Ninja -DENABLE_LTO=False -DENABLE_ASSERTIONS=True -DENABLE_X86_HOST_DEBUG=True - name: Build working-directory: ${{runner.workspace}}/build diff --git a/CMakeLists.txt b/CMakeLists.txt index bd6ae463f..1e0a88903 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -83,6 +83,14 @@ set (CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -fomit-frame-pointer") set (CMAKE_LINKER_FLAGS_RELEASE "${CMAKE_LINKER_FLAGS_RELEASE} -fomit-frame-pointer") if (CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64") + option(ENABLE_X86_HOST_DEBUG "Enables compiling on x86_64 host" FALSE) + if (NOT ENABLE_X86_HOST_DEBUG) + message(FATAL_ERROR + " Be warned: FEX isn't optimized for x86_64 hosts!\n" + " Support for x86_64 hosts is only for debugging and convenience!\n" + " Don't expect amazing performance or optimal code generation!\n" + " Pass -DENABLE_X86_HOST_DEBUG=True to bypass this message!") + endif() set(_M_X86_64 1) add_definitions(-D_M_X86_64=1) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mcx16")