From 99f13b99dc515733564f54feee2d83d53ad07c00 Mon Sep 17 00:00:00 2001 From: Ravenwater Date: Wed, 28 Aug 2024 12:00:14 -0400 Subject: [PATCH] Restructuring build process to isolate projects that depend on complex<> --- CMakeLists.txt | 6 ++++++ .../performance/complex/CMakeLists.txt | 17 ++++++---------- elastic/decimal/api/api.cpp | 20 +++++++++---------- playground/CMakeLists.txt | 15 +++++++------- static/fixpnt/binary/CMakeLists.txt | 15 ++++++-------- static/integer/decimal/CMakeLists.txt | 12 +++++------ tools/cmake.compiler.conditional | 12 ----------- tools/cmake/summary.cmake | 1 + 8 files changed, 42 insertions(+), 56 deletions(-) delete mode 100644 tools/cmake.compiler.conditional diff --git a/CMakeLists.txt b/CMakeLists.txt index 0a88c01e5..ea1082a90 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -89,6 +89,7 @@ option(BUILD_NUMBERS "Set to ON to build all the number syst option(BUILD_NUMERICS "Set to ON to build all the numeric components" OFF) option(BUILD_BENCHMARKS "Set to ON to build all the benchmark components" OFF) option(BUILD_MIXEDPRECISION_SDK "Set to ON to build the mixed-precision SDK" OFF) +option(BUILD_COMPLEX "Set to ON to build complex support components" OFF) # or, build individual components # utilities and educational examples @@ -606,6 +607,7 @@ if(BUILD_ALL) set(BUILD_NUMBERS ON) set(BUILD_MIXEDPRECISION_SDK ON) set(BUILD_APP_ENVIRONMENT ON) + set(BUILD_COMPLEX ON) # build the BLAS test/verification suites set(BUILD_LINEAR_ALGEBRA_BLAS ON) @@ -637,6 +639,10 @@ if(BUILD_DEMONSTRATION) set(BUILD_PLAYGROUND ON) endif(BUILD_DEMONSTRATION) +if(BUILD_COMPLEX) + +endif(BUILD_COMPLEX) + if(BUILD_NUMBERS) # build the different test/verification suites for each number system set(BUILD_NUMBER_INTERNALS ON) diff --git a/applications/performance/complex/CMakeLists.txt b/applications/performance/complex/CMakeLists.txt index d90b75a7c..806a061c5 100644 --- a/applications/performance/complex/CMakeLists.txt +++ b/applications/performance/complex/CMakeLists.txt @@ -1,14 +1,9 @@ file (GLOB SOURCES "./*.cpp") -# Compiler specific environments -# message(STATUS "CMAKE_CXX_COMPILER ID is -${CMAKE_CXX_COMPILER_ID}-") - # exclude AppleClang as XCode14 and Xcode15 have std::complex libs that do not support user defined types5 -if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") - message(STATUS "Ignoring complex tests for AppleClang") - -else() - message(STATUS "Adding complex test for all other non-AppleClang environments") - compile_all("true" "complex" "Applications/Performance/Complex" "${SOURCES}") - -endif() +if(BUILD_COMPLEX) + message(STATUS "Adding complex test for Application environment") + compile_all("true" "complex" "Complex/Applications/Performance" "${SOURCES}") +else(BUILD_COMPLEX) + message(STATUS "Ignoring complex tests for application/performance") +endif(BUILD_COMPLEX) diff --git a/elastic/decimal/api/api.cpp b/elastic/decimal/api/api.cpp index fcb4d0414..e40a50307 100644 --- a/elastic/decimal/api/api.cpp +++ b/elastic/decimal/api/api.cpp @@ -15,7 +15,7 @@ namespace sw::universal { static constexpr unsigned edecimal_TABLE_WIDTH = 15; // report edecimal binary operator error -void ReportBinaryedecimalError(const std::string& test_case, const std::string& op, const edecimal& lhs, const edecimal& rhs, const edecimal& dref, const long& ref) { +void ReportBinaryEdecimalError(const std::string& test_case, const std::string& op, const edecimal& lhs, const edecimal& rhs, const edecimal& dref, const long& ref) { std::cerr << test_case << " " << std::setprecision(20) << std::setw(edecimal_TABLE_WIDTH) << lhs @@ -29,7 +29,7 @@ void ReportBinaryedecimalError(const std::string& test_case, const std::string& } // report edecimal binary operator success -void ReportBinaryedecimalSuccess(const std::string& test_case, const std::string& op, const edecimal& lhs, const edecimal& rhs, const edecimal& dref, const long& ref) { +void ReportBinaryEdecimalSuccess(const std::string& test_case, const std::string& op, const edecimal& lhs, const edecimal& rhs, const edecimal& dref, const long& ref) { std::cerr << test_case << " " << std::setprecision(20) << std::setw(edecimal_TABLE_WIDTH) << lhs @@ -53,10 +53,10 @@ int VerifyAddition(long ub, bool bReportIndividualTestCases) { edecimal dref = d1 + d2; if (dref != ref) { ++nrOfFailedTests; - if (bReportIndividualTestCases) ReportBinaryedecimalError("FAIL", "add", d1, d2, dref, ref); + if (bReportIndividualTestCases) ReportBinaryEdecimalError("FAIL", "add", d1, d2, dref, ref); } else { - // if (bReportIndividualTestCases) ReportBinaryedecimalSuccess("SUCCESS", "add", d1, d2, dref, ref); + // if (bReportIndividualTestCases) ReportBinaryEdecimalSuccess("SUCCESS", "add", d1, d2, dref, ref); } } } @@ -74,10 +74,10 @@ int VerifySubtraction(long ub, bool bReportIndividualTestCases) { edecimal dref = d1 - d2; if (dref != ref) { ++nrOfFailedTests; - if (bReportIndividualTestCases) ReportBinaryedecimalError("FAIL", "sub", d1, d2, dref, ref); + if (bReportIndividualTestCases) ReportBinaryEdecimalError("FAIL", "sub", d1, d2, dref, ref); } else { - // if (bReportIndividualTestCases) ReportBinaryedecimalSuccess("SUCCESS", "seb", d1, d2, dref, ref); + // if (bReportIndividualTestCases) ReportBinaryEdecimalSuccess("SUCCESS", "seb", d1, d2, dref, ref); } } } @@ -95,10 +95,10 @@ int VerifyMultiplication(long ub, bool bReportIndividualTestCases) { edecimal dref = d1 * d2; if (dref != ref) { ++nrOfFailedTests; - if (bReportIndividualTestCases) ReportBinaryedecimalError("FAIL", "mul", d1, d2, dref, ref); + if (bReportIndividualTestCases) ReportBinaryEdecimalError("FAIL", "mul", d1, d2, dref, ref); } else { - // if (bReportIndividualTestCases) ReportBinaryedecimalSuccess("SUCCESS", "mul", d1, d2, dref, ref); + // if (bReportIndividualTestCases) ReportBinaryEdecimalSuccess("SUCCESS", "mul", d1, d2, dref, ref); } } } @@ -136,10 +136,10 @@ int VerifyDivision(long ub, bool bReportIndividualTestCases) { } if (dref != ref) { ++nrOfFailedTests; - if (bReportIndividualTestCases) ReportBinaryedecimalError("FAIL", "div", d1, d2, dref, ref); + if (bReportIndividualTestCases) ReportBinaryEdecimalError("FAIL", "div", d1, d2, dref, ref); } else { - //if (bReportIndividualTestCases) ReportBinaryedecimalSuccess("SUCCESS", "div", d1, d2, dref, ref); + //if (bReportIndividualTestCases) ReportBinaryEdecimalSuccess("SUCCESS", "div", d1, d2, dref, ref); } } } diff --git a/playground/CMakeLists.txt b/playground/CMakeLists.txt index 65ab9ae12..b7e25f116 100644 --- a/playground/CMakeLists.txt +++ b/playground/CMakeLists.txt @@ -13,12 +13,11 @@ set(REAL_SRCS efunc_posits.cpp compile_all("true" "playground" "Playground" "${REAL_SRCS}") -# exclude AppleClang as XCode14 and Xcode15 have std::complex libs that do not support user defined types5 -if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") - message(STATUS "Ignoring complex playground tests for AppleClang") +# NOTE: AppleClang as XCode14 and Xcode15 have std::complex libs that do not support user defined types5 +if(BUILD_COMPLEX) + message(STATUS "Adding playground complex test") + compile_all("true" "playground" "Complex/Playground" "${COMPLEX_SRCS}") -else() - message(STATUS "Adding complex test for all other non-AppleClang environments") - compile_all("true" "playground" "Playground" "${COMPLEX_SRCS}") - -endif() +else(BUILD_COMPLEX) + message(STATUS "Removing complex environment test from Playground") +endif(BUILD_COMPLEX) diff --git a/static/fixpnt/binary/CMakeLists.txt b/static/fixpnt/binary/CMakeLists.txt index 934cdca73..f3960966e 100644 --- a/static/fixpnt/binary/CMakeLists.txt +++ b/static/fixpnt/binary/CMakeLists.txt @@ -14,13 +14,10 @@ compile_all("true" "fixpnt" "Number Systems/static/fixed-point/binary/fixpnt/mat # Compiler specific environments message(STATUS "CMAKE_CXX_COMPILER ID is -${CMAKE_CXX_COMPILER_ID}-") -# exclude XCode15 -if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") - message(STATUS "Ignoring complex tests for AppleClang") - -else() - message(STATUS "Adding complex test for all other non-AppleClang environments") - compile_all("true" "fixpnt" "Number Systems/static/fixed-point/binary/fixpnt/complex" "${COMPLEX_SRC}") - -endif() +if(BUILD_COMPLEX) + message(STATUS "Adding complex test for fixpnt") + compile_all("true" "fixpnt" "Complex/Number System/static/fixed-point/binary/fixpnt/complex" "${COMPLEX_SRC}") +else(BUILD_COMPLEX) + message(STATUS "Removing complex environment regression suite for fixpnt") +endif(BUILD_COMPLEX) diff --git a/static/integer/decimal/CMakeLists.txt b/static/integer/decimal/CMakeLists.txt index 663ae26a2..662df8126 100644 --- a/static/integer/decimal/CMakeLists.txt +++ b/static/integer/decimal/CMakeLists.txt @@ -5,9 +5,9 @@ file(GLOB ARITHMETIC_SRC "arithmetic/*.cpp") file(GLOB MATH_SRC "math/*.cpp") file(GLOB PERFORMANCE_SRC "performance/*.cpp") -compile_all("true" "dint" "Number Systems/static/integer/decimal/integer/api" "${API_SRC}") -compile_all("true" "dint" "Number Systems/static/integer/decimal/integer/conversion" "${CONVERSION_SRC}") -compile_all("true" "dint" "Number Systems/static/integer/decimal/integer/logic" "${LOGIC_SRC}") -compile_all("true" "dint" "Number Systems/static/integer/decimal/integer/arithmetic" "${ARITHMETIC_SRC}") -compile_all("true" "dint" "Number Systems/static/integer/decimal/integer/math" "${MATH_SRC}") -compile_all("true" "dint" "Number Systems/static/integer/decimal/integer/performance" "${PERFORMANCE_SRC}") +compile_all("true" "dint" "Number Systems/static/integer/decimal/dint/api" "${API_SRC}") +compile_all("true" "dint" "Number Systems/static/integer/decimal/dint/conversion" "${CONVERSION_SRC}") +compile_all("true" "dint" "Number Systems/static/integer/decimal/dint/logic" "${LOGIC_SRC}") +compile_all("true" "dint" "Number Systems/static/integer/decimal/dint/arithmetic" "${ARITHMETIC_SRC}") +compile_all("true" "dint" "Number Systems/static/integer/decimal/dint/math" "${MATH_SRC}") +compile_all("true" "dint" "Number Systems/static/integer/decimal/dint/performance" "${PERFORMANCE_SRC}") diff --git a/tools/cmake.compiler.conditional b/tools/cmake.compiler.conditional deleted file mode 100644 index e4656dbca..000000000 --- a/tools/cmake.compiler.conditional +++ /dev/null @@ -1,12 +0,0 @@ -# Compiler specific environments -message(STATUS "CMAKE_CXX_COMPILER ID is -${CMAKE_CXX_COMPILER_ID}-") - -# exclude XCode15 -if(CMAKE_CXX_COMPILER_ID MATCHES "AppleClang") - message(STATUS "Ignoring complex tests for AppleClang") - -else() - message(STATUS "Adding complex test for all other non-AppleClang environments") - compile_all("true" "fixpnt" "Number Systems/static/fixed-point/binary/fixpnt/complex" "${COMPLEX_SRC}") - -endif() diff --git a/tools/cmake/summary.cmake b/tools/cmake/summary.cmake index a41394a2c..72143f30f 100644 --- a/tools/cmake/summary.cmake +++ b/tools/cmake/summary.cmake @@ -101,6 +101,7 @@ function(universal_print_configuration_summary) universal_status(" BUILD_NUMERICS : ${BUILD_NUMERICS}") universal_status(" BUILD_BENCHMARKS : ${BUILD_BENCHMARKS}") universal_status(" BUILD_MIXEDPRECISION_SDK : ${BUILD_MIXEDPRECISION_SDK}") + universal_status(" BUILD_COMPLEX : ${BUILD_COMPLEX}") universal_status("") universal_status(" BUILD_CMD_LINE_TOOLS : ${BUILD_CMD_LINE_TOOLS}") universal_status(" BUILD_EDUCATION : ${BUILD_EDUCATION}")