Remove the CMake/Scons compile-time check for IEEE 754 compliance

Now handled by a static assertion.
This commit is contained in:
Charles Dang 2018-05-21 14:38:16 +11:00
parent fee407ee04
commit 7904debd14
4 changed files with 2 additions and 45 deletions

View file

@ -1,4 +1,4 @@

# set minimum version
cmake_minimum_required(VERSION 2.8.5)
@ -59,19 +59,6 @@ option(ENABLE_NLS "Enable building of translations" ${ENABLE_GAME})
option(ENABLE_OMP "Enables OpenMP, and has additional dependencies" OFF)
option(ENABLE_HISTORY "Enable using GNU history for history in lua console" ON)
if(NOT CMAKE_CROSSCOMPILING)
try_run(IEEE754_TEST_RETURN_CODE IEEE754_TEST_COMPILED ${CMAKE_BINARY_DIR} ${CMAKE_SOURCE_DIR}/src/compile_time_tests/ieee_754.cpp
CMAKE_FLAGS "-DCMAKE_CXX_STANDARD=11" COMPILE_OUTPUT_VARIABLE IEEE754_TEST_COMPILE_OUTPUT)
if(NOT IEEE754_TEST_COMPILED)
message(WARNING "Failed to compile the IEEE 754 test. Skipping it.")
message(${IEEE754_TEST_COMPILE_OUTPUT})
elseif(NOT IEEE754_TEST_RETURN_CODE EQUAL 0)
message(FATAL_ERROR "Your platform does not represent floating point numbers in the IEEE 754 format.")
endif()
else()
message(WARNING "You are cross-compiling. Skipping IEEE 754 test.")
endif()
if(ENABLE_GAME OR ENABLE_TESTS)
find_package(SDL2 2.0.4 REQUIRED)
endif(ENABLE_GAME OR ENABLE_TESTS)

View file

@ -307,7 +307,7 @@ def Warning(message):
from metasconf import init_metasconf
configure_args = dict(
custom_tests = init_metasconf(env, ["ieee_754", "cplusplus", "python_devel", "sdl", "boost", "cairo", "pango", "pkgconfig", "gettext_tool", "lua"]),
custom_tests = init_metasconf(env, ["cplusplus", "python_devel", "sdl", "boost", "cairo", "pango", "pkgconfig", "gettext_tool", "lua"]),
config_h = "$build_dir/config.h",
log_file="$build_dir/config.log", conf_dir="$build_dir/sconf_temp")
@ -337,13 +337,6 @@ if env["prereqs"]:
conf.CheckLib("m")
conf.CheckFunc("round")
def CheckIEEE754(conf):
if not env["host"]:
return conf.CheckIEEE754()
else:
Warning("You are cross-compiling. Skipping IEEE 754 test.")
return True
def CheckAsio(conf):
if env["PLATFORM"] == 'win32':
conf.env.Append(LIBS = ["libws2_32"])
@ -362,7 +355,6 @@ if env["prereqs"]:
conf.CheckSDL("SDL2_image", header_file = "SDL_image")
have_server_prereqs = (\
CheckIEEE754(conf) & \
conf.CheckCPlusPlus(gcc_version = "4.8") & \
conf.CheckLib("libcrypto") & \
conf.CheckBoost("iostreams", require_version = boost_version) & \

View file

@ -1,11 +0,0 @@
import os.path
from SCons.Script import File
def CheckIEEE754(context):
context.Message("Checking if floating point numbers are in the IEEE 754 format... ")
test_file = File(os.path.join("src", "compile_time_tests", "ieee_754.cpp")).get_contents().decode("utf-8")
ret, _ = context.TryRun(test_file, ".cpp")
context.Result(ret)
return ret
config_checks = { "CheckIEEE754" : CheckIEEE754 }

View file

@ -1,11 +0,0 @@
#include <limits>
// This test verifies that floating point numbers are represented in the IEEE 754 format.
// Wesnoth requires that.
int main()
{
// Return code zero means success.
// Thus, check that the bit representation is *not* what IEEE 754 specifies.
bool match = std::numeric_limits<double>::is_iec559;
return !match;
}