From cd623c47f71aa8e3b025e843ce1d9cbb1251bbe6 Mon Sep 17 00:00:00 2001 From: Juan Cruz Viotti Date: Tue, 21 Jan 2025 14:13:08 -0400 Subject: [PATCH] Upgrade Noa to the latest version (#1461) Signed-off-by: Juan Cruz Viotti --- DEPENDENCIES | 2 +- cmake/FindNoa.cmake | 1 + vendor/noa/CMakeLists.txt | 1 - vendor/noa/cmake/{noa => }/noa.cmake | 2 +- vendor/noa/cmake/noa/defaults.cmake | 44 +++++++++++++------------- vendor/noa/cmake/noa/shim.cmake | 2 +- vendor/noa/cmake/noa/variables.cmake | 6 ++-- vendor/noa/src/flat_map/CMakeLists.txt | 2 -- vendor/noa/src/hash/CMakeLists.txt | 2 -- vendor/noa/src/regex/CMakeLists.txt | 2 -- 10 files changed, 29 insertions(+), 35 deletions(-) rename vendor/noa/cmake/{noa => }/noa.cmake (93%) diff --git a/DEPENDENCIES b/DEPENDENCIES index 5c5c8f0fe..ecb9c8670 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -1,5 +1,5 @@ vendorpull https://github.com/sourcemeta/vendorpull 70342aaf458e6cb80baeb5b718901075fc42ede6 -noa https://github.com/sourcemeta/noa a8d36453236abc365f08a76a486f92c84f976fd9 +noa https://github.com/sourcemeta/noa dee6c859895baf918fe3ecca22e4e7a262c5d500 jsontestsuite https://github.com/nst/JSONTestSuite d64aefb55228d9584d3e5b2433f720ea8fd00c82 jsonschema-2020-12 https://github.com/json-schema-org/json-schema-spec 769daad75a9553562333a8937a187741cb708c72 jsonschema-2019-09 https://github.com/json-schema-org/json-schema-spec 41014ea723120ce70b314d72f863c6929d9f3cfd diff --git a/cmake/FindNoa.cmake b/cmake/FindNoa.cmake index 8e1fc3b8d..57eef05cf 100644 --- a/cmake/FindNoa.cmake +++ b/cmake/FindNoa.cmake @@ -8,5 +8,6 @@ if(NOT Noa_FOUND) set(NOA_GOOGLETEST ${JSONTOOLKIT_TESTS} CACHE BOOL "GoogleTest") set(NOA_GOOGLEBENCHMARK ${JSONTOOLKIT_BENCHMARK} CACHE BOOL "GoogleBenchmark") add_subdirectory("${PROJECT_SOURCE_DIR}/vendor/noa") + include("${PROJECT_SOURCE_DIR}/vendor/noa/cmake/noa.cmake") set(Noa_FOUND ON) endif() diff --git a/vendor/noa/CMakeLists.txt b/vendor/noa/CMakeLists.txt index 45ec12874..a2dd5e34a 100644 --- a/vendor/noa/CMakeLists.txt +++ b/vendor/noa/CMakeLists.txt @@ -2,7 +2,6 @@ cmake_minimum_required(VERSION 3.16) project(noa VERSION 0.0.0 LANGUAGES CXX DESCRIPTION "A set of re-usable and opinionated utilities for Sourcemeta projects") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") -list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/noa") include(noa) # Options diff --git a/vendor/noa/cmake/noa/noa.cmake b/vendor/noa/cmake/noa.cmake similarity index 93% rename from vendor/noa/cmake/noa/noa.cmake rename to vendor/noa/cmake/noa.cmake index b794fd4dd..a2c4717fa 100644 --- a/vendor/noa/cmake/noa/noa.cmake +++ b/vendor/noa/cmake/noa.cmake @@ -1,4 +1,4 @@ -set(NOA_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}") +set(NOA_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/noa") include("${NOA_DIRECTORY}/shim.cmake") include("${NOA_DIRECTORY}/variables.cmake") include("${NOA_DIRECTORY}/defaults.cmake") diff --git a/vendor/noa/cmake/noa/defaults.cmake b/vendor/noa/cmake/noa/defaults.cmake index d942923c0..06ea6eb31 100644 --- a/vendor/noa/cmake/noa/defaults.cmake +++ b/vendor/noa/cmake/noa/defaults.cmake @@ -1,56 +1,56 @@ # Standards (sane modern defaults) if("CXX" IN_LIST NOA_LANGUAGES) - set(CMAKE_CXX_STANDARD 20 PARENT_SCOPE) + set(CMAKE_CXX_STANDARD 20) endif() if("C" IN_LIST NOA_LANGUAGES) - set(CMAKE_C_STANDARD 11 PARENT_SCOPE) + set(CMAKE_C_STANDARD 11) endif() if("OBJCXX" IN_LIST NOA_LANGUAGES) - set(CMAKE_OBJCXX_STANDARD "${CMAKE_CXX_STANDARD}" PARENT_SCOPE) + set(CMAKE_OBJCXX_STANDARD "${CMAKE_CXX_STANDARD}") endif() # Hide symbols from shared libraries by default # In certain compilers, like GCC and Clang, # symbols are visible by default. -set(CMAKE_VISIBILITY_INLINES_HIDDEN YES PARENT_SCOPE) +set(CMAKE_VISIBILITY_INLINES_HIDDEN YES) if("CXX" IN_LIST NOA_LANGUAGES) - set(CMAKE_CXX_VISIBILITY_PRESET hidden PARENT_SCOPE) + set(CMAKE_CXX_VISIBILITY_PRESET hidden) endif() if("C" IN_LIST NOA_LANGUAGES) - set(CMAKE_C_VISIBILITY_PRESET hidden PARENT_SCOPE) + set(CMAKE_C_VISIBILITY_PRESET hidden) endif() if("OBJCXX" IN_LIST NOA_LANGUAGES) - set(CMAKE_OBJCXX_VISIBILITY_PRESET hidden PARENT_SCOPE) + set(CMAKE_OBJCXX_VISIBILITY_PRESET hidden) endif() # By default, stay within ISO C++ if("CXX" IN_LIST NOA_LANGUAGES) - set(CMAKE_CXX_STANDARD_REQUIRED ON PARENT_SCOPE) - set(CMAKE_CXX_EXTENSIONS OFF PARENT_SCOPE) + set(CMAKE_CXX_STANDARD_REQUIRED ON) + set(CMAKE_CXX_EXTENSIONS OFF) endif() if("C" IN_LIST NOA_LANGUAGES) - set(CMAKE_C_STANDARD_REQUIRED ON PARENT_SCOPE) - set(CMAKE_C_EXTENSIONS OFF PARENT_SCOPE) + set(CMAKE_C_STANDARD_REQUIRED ON) + set(CMAKE_C_EXTENSIONS OFF) endif() if("OBJCXX" IN_LIST NOA_LANGUAGES) - set(CMAKE_OBJCXX_STANDARD_REQUIRED ON PARENT_SCOPE) - set(CMAKE_OBJCXX_EXTENSIONS OFF PARENT_SCOPE) + set(CMAKE_OBJCXX_STANDARD_REQUIRED ON) + set(CMAKE_OBJCXX_EXTENSIONS OFF) endif() # Export compile commands by default. # It is very useful for IDE integration, linting, etc -set(CMAKE_EXPORT_COMPILE_COMMANDS ON PARENT_SCOPE) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) # Prevent DT_RPATH/DT_RUNPATH problem # This problem is not present on Apple platforms. # See https://www.youtube.com/watch?v=m0DwB4OvDXk if(NOT APPLE) - set(CMAKE_INSTALL_RPATH $ORIGIN PARENT_SCOPE) + set(CMAKE_INSTALL_RPATH $ORIGIN) endif() # Delay GoogleTest discovery until before running the tests # See https://discourse.cmake.org/t/default-value-for-new-discovery-mode-option-for-gtest-discover-tests/1422 -set(CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE PRE_TEST PARENT_SCOPE) +set(CMAKE_GTEST_DISCOVER_TESTS_DISCOVERY_MODE PRE_TEST) # Always use folders in IDE # See https://cmake.org/cmake/help/latest/prop_gbl/USE_FOLDERS.html @@ -81,15 +81,15 @@ endif() if(NOA_COMPILER_GCC AND CMAKE_BUILD_TYPE STREQUAL "Release" AND NOT BUILD_SHARED_LIBS) message(STATUS "Enabling Fat LTO") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -ffat-lto-objects" PARENT_SCOPE) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto" PARENT_SCOPE) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -flto" PARENT_SCOPE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -ffat-lto-objects") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -flto") endif() # TODO: Make this work on Linux on LLVM if(NOA_COMPILER_LLVM AND CMAKE_BUILD_TYPE STREQUAL "Release" AND NOT BUILD_SHARED_LIBS AND APPLE) message(STATUS "Enabling Fat LTO") - set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto=full" PARENT_SCOPE) - set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto=full" PARENT_SCOPE) - set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -flto=full" PARENT_SCOPE) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto=full") + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto=full") + set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -flto=full") endif() diff --git a/vendor/noa/cmake/noa/shim.cmake b/vendor/noa/cmake/noa/shim.cmake index f5668919b..e2b632551 100644 --- a/vendor/noa/cmake/noa/shim.cmake +++ b/vendor/noa/cmake/noa/shim.cmake @@ -1,5 +1,5 @@ # The PROJECT_IS_TOP_LEVEL handy variable is only # available on CMake >=3.21. if(NOT DEFINED PROJECT_IS_TOP_LEVEL AND "${CMAKE_PROJECT_NAME}" STREQUAL "${PROJECT_NAME}") - set(PROJECT_IS_TOP_LEVEL YES PARENT_SCOPE) + set(PROJECT_IS_TOP_LEVEL YES) endif() diff --git a/vendor/noa/cmake/noa/variables.cmake b/vendor/noa/cmake/noa/variables.cmake index dff65711f..d29489856 100644 --- a/vendor/noa/cmake/noa/variables.cmake +++ b/vendor/noa/cmake/noa/variables.cmake @@ -4,9 +4,9 @@ get_property(NOA_LANGUAGES GLOBAL PROPERTY ENABLED_LANGUAGES) # Compiler detection (C++) # TODO: Detect compilers on programming languages other than C++ if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" OR CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang") - set(NOA_COMPILER_LLVM ON PARENT_SCOPE) + set(NOA_COMPILER_LLVM ON) elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU") - set(NOA_COMPILER_GCC ON PARENT_SCOPE) + set(NOA_COMPILER_GCC ON) elseif(MSVC) - set(NOA_COMPILER_MSVC ON PARENT_SCOPE) + set(NOA_COMPILER_MSVC ON) endif() diff --git a/vendor/noa/src/flat_map/CMakeLists.txt b/vendor/noa/src/flat_map/CMakeLists.txt index 37e01dd22..82cb687ae 100644 --- a/vendor/noa/src/flat_map/CMakeLists.txt +++ b/vendor/noa/src/flat_map/CMakeLists.txt @@ -1,5 +1,3 @@ -include(noa) - noa_library(NAMESPACE sourcemeta PROJECT noa NAME flat_map FOLDER "Noa/Flat Map") if(NOA_INSTALL) diff --git a/vendor/noa/src/hash/CMakeLists.txt b/vendor/noa/src/hash/CMakeLists.txt index 28748a3dd..3ea7ba243 100644 --- a/vendor/noa/src/hash/CMakeLists.txt +++ b/vendor/noa/src/hash/CMakeLists.txt @@ -1,5 +1,3 @@ -include(noa) - noa_library(NAMESPACE sourcemeta PROJECT noa NAME hash FOLDER "Noa/Hash") if(NOA_INSTALL) diff --git a/vendor/noa/src/regex/CMakeLists.txt b/vendor/noa/src/regex/CMakeLists.txt index 9a5c81685..c7af5b74f 100644 --- a/vendor/noa/src/regex/CMakeLists.txt +++ b/vendor/noa/src/regex/CMakeLists.txt @@ -1,5 +1,3 @@ -include(noa) - noa_library(NAMESPACE sourcemeta PROJECT noa NAME regex FOLDER "Noa/Regex")