diff options
| -rw-r--r-- | .codespellrc | 1 | ||||
| -rw-r--r-- | .gitlab/ci/configure_macos_arm64_ninja.cmake | 1 | ||||
| -rw-r--r-- | .gitlab/ci/configure_macos_x86_64_makefiles.cmake | 1 | ||||
| -rw-r--r-- | .gitlab/ci/configure_macos_x86_64_ninja.cmake | 1 | ||||
| -rw-r--r-- | Modules/FindOpenAL.cmake | 22 | ||||
| -rw-r--r-- | Source/CMakeVersion.cmake | 2 | ||||
| -rw-r--r-- | Source/cmGlobalNinjaGenerator.cxx | 15 | ||||
| -rw-r--r-- | Source/cmGlobalNinjaGenerator.h | 12 | ||||
| -rw-r--r-- | Source/cmLocalNinjaGenerator.cxx | 26 | ||||
| -rw-r--r-- | Source/cmNinjaTypes.h | 3 | ||||
| -rw-r--r-- | Tests/FindOpenAL/Test/CMakeLists.txt | 6 | ||||
| -rw-r--r-- | Tests/FindOpenAL/Test/main.cxx | 9 |
12 files changed, 49 insertions, 50 deletions
diff --git a/.codespellrc b/.codespellrc index a8be487..0abd94e 100644 --- a/.codespellrc +++ b/.codespellrc @@ -1,7 +1,6 @@ [codespell] check-filenames = check-hidden = -count = # Disable warnings about binary files quiet-level = 2 builtin = clear,rare,en-GB_to_en-US diff --git a/.gitlab/ci/configure_macos_arm64_ninja.cmake b/.gitlab/ci/configure_macos_arm64_ninja.cmake index f59b43c..f2068a1 100644 --- a/.gitlab/ci/configure_macos_arm64_ninja.cmake +++ b/.gitlab/ci/configure_macos_arm64_ninja.cmake @@ -1,3 +1,4 @@ +set(CMake_TEST_FindOpenAL "ON" CACHE BOOL "") set(CMake_TEST_FindOpenMP "ON" CACHE BOOL "") set(CMake_TEST_FindOpenMP_C "ON" CACHE BOOL "") set(CMake_TEST_FindOpenMP_CXX "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_macos_x86_64_makefiles.cmake b/.gitlab/ci/configure_macos_x86_64_makefiles.cmake index 3c5d8fe..5d1620d 100644 --- a/.gitlab/ci/configure_macos_x86_64_makefiles.cmake +++ b/.gitlab/ci/configure_macos_x86_64_makefiles.cmake @@ -1,3 +1,4 @@ +set(CMake_TEST_FindOpenAL "ON" CACHE BOOL "") set(CMake_TEST_FindOpenMP "ON" CACHE BOOL "") set(CMake_TEST_FindOpenMP_C "ON" CACHE BOOL "") set(CMake_TEST_FindOpenMP_CXX "ON" CACHE BOOL "") diff --git a/.gitlab/ci/configure_macos_x86_64_ninja.cmake b/.gitlab/ci/configure_macos_x86_64_ninja.cmake index 3c5d8fe..5d1620d 100644 --- a/.gitlab/ci/configure_macos_x86_64_ninja.cmake +++ b/.gitlab/ci/configure_macos_x86_64_ninja.cmake @@ -1,3 +1,4 @@ +set(CMake_TEST_FindOpenAL "ON" CACHE BOOL "") set(CMake_TEST_FindOpenMP "ON" CACHE BOOL "") set(CMake_TEST_FindOpenMP_C "ON" CACHE BOOL "") set(CMake_TEST_FindOpenMP_CXX "ON" CACHE BOOL "") diff --git a/Modules/FindOpenAL.cmake b/Modules/FindOpenAL.cmake index 53aafdc..3d58569 100644 --- a/Modules/FindOpenAL.cmake +++ b/Modules/FindOpenAL.cmake @@ -105,18 +105,16 @@ find_package_handle_standard_args( mark_as_advanced(OPENAL_LIBRARY OPENAL_INCLUDE_DIR) -if(OPENAL_INCLUDE_DIR AND OPENAL_LIBRARY) - if(NOT TARGET OpenAL::OpenAL) - if(EXISTS "${OPENAL_LIBRARY}") - add_library(OpenAL::OpenAL UNKNOWN IMPORTED) - set_target_properties(OpenAL::OpenAL PROPERTIES - IMPORTED_LOCATION "${OPENAL_LIBRARY}") - else() - add_library(OpenAL::OpenAL INTERFACE IMPORTED) - set_target_properties(OpenAL::OpenAL PROPERTIES - IMPORTED_LIBNAME "${OPENAL_LIBRARY}") - endif() +if(OPENAL_FOUND AND NOT TARGET OpenAL::OpenAL) + if(OPENAL_LIBRARY MATCHES "/([^/]+)\\.framework$") + add_library(OpenAL::OpenAL INTERFACE IMPORTED) set_target_properties(OpenAL::OpenAL PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${OPENAL_INCLUDE_DIR}") + INTERFACE_LINK_LIBRARIES "${OPENAL_LIBRARY}") + else() + add_library(OpenAL::OpenAL UNKNOWN IMPORTED) + set_target_properties(OpenAL::OpenAL PROPERTIES + IMPORTED_LOCATION "${OPENAL_LIBRARY}") endif() + set_target_properties(OpenAL::OpenAL PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${OPENAL_INCLUDE_DIR}") endif() diff --git a/Source/CMakeVersion.cmake b/Source/CMakeVersion.cmake index c227ee0..281a8a9 100644 --- a/Source/CMakeVersion.cmake +++ b/Source/CMakeVersion.cmake @@ -1,7 +1,7 @@ # CMake version number components. set(CMake_VERSION_MAJOR 3) set(CMake_VERSION_MINOR 26) -set(CMake_VERSION_PATCH 20230329) +set(CMake_VERSION_PATCH 20230330) #set(CMake_VERSION_RC 0) set(CMake_VERSION_IS_DIRTY 0) diff --git a/Source/cmGlobalNinjaGenerator.cxx b/Source/cmGlobalNinjaGenerator.cxx index 052f2e9..0c28776 100644 --- a/Source/cmGlobalNinjaGenerator.cxx +++ b/Source/cmGlobalNinjaGenerator.cxx @@ -1369,17 +1369,7 @@ void cmGlobalNinjaGenerator::AppendTargetDepends( } void cmGlobalNinjaGenerator::AppendTargetDependsClosure( - cmGeneratorTarget const* target, cmNinjaDeps& outputs, - const std::string& config, const std::string& fileConfig, bool genexOutput) -{ - cmNinjaOuts outs; - this->AppendTargetDependsClosure(target, outs, config, fileConfig, - genexOutput, true); - cm::append(outputs, outs); -} - -void cmGlobalNinjaGenerator::AppendTargetDependsClosure( - cmGeneratorTarget const* target, cmNinjaOuts& outputs, + cmGeneratorTarget const* target, std::unordered_set<std::string>& outputs, const std::string& config, const std::string& fileConfig, bool genexOutput, bool omit_self) { @@ -1400,7 +1390,8 @@ void cmGlobalNinjaGenerator::AppendTargetDependsClosure( // relevant for filling the cache entries properly isolated and a global // result set that is relevant for the result of the top level call to // AppendTargetDependsClosure. - cmNinjaOuts this_outs; // this will be the new cache entry + std::unordered_set<std::string> + this_outs; // this will be the new cache entry for (auto const& dep_target : this->GetTargetDirectDepends(target)) { if (!dep_target->IsInBuildSystem()) { diff --git a/Source/cmGlobalNinjaGenerator.h b/Source/cmGlobalNinjaGenerator.h index 55fdbf0..bd54168 100644 --- a/Source/cmGlobalNinjaGenerator.h +++ b/Source/cmGlobalNinjaGenerator.h @@ -351,15 +351,10 @@ public: const std::string& fileConfig, cmNinjaTargetDepends depends); void AppendTargetDependsClosure(cmGeneratorTarget const* target, - cmNinjaDeps& outputs, + std::unordered_set<std::string>& outputs, const std::string& config, const std::string& fileConfig, - bool genexOutput); - void AppendTargetDependsClosure(cmGeneratorTarget const* target, - cmNinjaOuts& outputs, - const std::string& config, - const std::string& fileConfig, - bool genexOutput, bool omit_self); + bool genexOutput, bool omit_self = true); void AppendDirectoryForConfig(const std::string& prefix, const std::string& config, @@ -617,7 +612,8 @@ private: bool GenexOutput; }; - std::map<TargetDependsClosureKey, cmNinjaOuts> TargetDependsClosures; + std::map<TargetDependsClosureKey, std::unordered_set<std::string>> + TargetDependsClosures; TargetAliasMap TargetAliases; diff --git a/Source/cmLocalNinjaGenerator.cxx b/Source/cmLocalNinjaGenerator.cxx index 305dab3..d0bd375 100644 --- a/Source/cmLocalNinjaGenerator.cxx +++ b/Source/cmLocalNinjaGenerator.cxx @@ -5,11 +5,11 @@ #include <algorithm> #include <cassert> #include <cstdio> -#include <iterator> #include <memory> #include <sstream> #include <utility> +#include <cm/unordered_set> #include <cmext/string_view> #include "cmsys/FStream.hxx" @@ -26,6 +26,7 @@ #include "cmMakefile.h" #include "cmMessageType.h" #include "cmNinjaTargetGenerator.h" +#include "cmNinjaTypes.h" #include "cmPolicies.h" #include "cmRulePlaceholderExpander.h" #include "cmSourceFile.h" @@ -601,7 +602,7 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( continue; } - cmNinjaDeps orderOnlyDeps; + std::unordered_set<std::string> orderOnlyDeps; if (!cc->GetDependsExplicitOnly()) { // A custom command may appear on multiple targets. However, some build @@ -617,19 +618,15 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( assert(j != targets.end()); this->GetGlobalNinjaGenerator()->AppendTargetDependsClosure( *j, orderOnlyDeps, ccg.GetOutputConfig(), fileConfig, ccgs.size() > 1); - std::sort(orderOnlyDeps.begin(), orderOnlyDeps.end()); ++j; for (; j != targets.end(); ++j) { - std::vector<std::string> jDeps; - std::vector<std::string> depsIntersection; + std::unordered_set<std::string> jDeps; this->GetGlobalNinjaGenerator()->AppendTargetDependsClosure( *j, jDeps, ccg.GetOutputConfig(), fileConfig, ccgs.size() > 1); - std::sort(jDeps.begin(), jDeps.end()); - std::set_intersection(orderOnlyDeps.begin(), orderOnlyDeps.end(), - jDeps.begin(), jDeps.end(), - std::back_inserter(depsIntersection)); - orderOnlyDeps = depsIntersection; + cm::erase_if(orderOnlyDeps, [&jDeps](std::string const& dep) { + return jDeps.find(dep) == jDeps.end(); + }); } } @@ -658,13 +655,17 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( std::vector<std::string> cmdLines; this->AppendCustomCommandLines(ccg, cmdLines); + cmNinjaDeps sortedOrderOnlyDeps(orderOnlyDeps.begin(), + orderOnlyDeps.end()); + std::sort(sortedOrderOnlyDeps.begin(), sortedOrderOnlyDeps.end()); + if (cmdLines.empty()) { cmNinjaBuild build("phony"); build.Comment = cmStrCat("Phony custom command for ", mainOutput); build.Outputs = std::move(ccOutputs.ExplicitOuts); build.WorkDirOuts = std::move(ccOutputs.WorkDirOuts); build.ExplicitDeps = std::move(ninjaDeps); - build.OrderOnlyDeps = orderOnlyDeps; + build.OrderOnlyDeps = std::move(sortedOrderOnlyDeps); gg->WriteBuild(this->GetImplFileStream(fileConfig), build); } else { std::string customStep = cmSystemTools::GetFilenameName(mainOutput); @@ -710,7 +711,8 @@ void cmLocalNinjaGenerator::WriteCustomCommandBuildStatement( this->ConstructComment(ccg), comment, depfile, cc->GetJobPool(), cc->GetUsesTerminal(), /*restat*/ !symbolic || !byproducts.empty(), fileConfig, - std::move(ccOutputs), std::move(ninjaDeps), std::move(orderOnlyDeps)); + std::move(ccOutputs), std::move(ninjaDeps), + std::move(sortedOrderOnlyDeps)); } } } diff --git a/Source/cmNinjaTypes.h b/Source/cmNinjaTypes.h index c8a411e..b77e0b5 100644 --- a/Source/cmNinjaTypes.h +++ b/Source/cmNinjaTypes.h @@ -5,8 +5,8 @@ #include "cmConfigure.h" // IWYU pragma: keep #include <map> -#include <set> #include <string> +#include <unordered_set> #include <utility> #include <vector> @@ -17,7 +17,6 @@ enum cmNinjaTargetDepends }; using cmNinjaDeps = std::vector<std::string>; -using cmNinjaOuts = std::set<std::string>; using cmNinjaVars = std::map<std::string, std::string>; class cmNinjaRule diff --git a/Tests/FindOpenAL/Test/CMakeLists.txt b/Tests/FindOpenAL/Test/CMakeLists.txt index fa3e263..6479df6 100644 --- a/Tests/FindOpenAL/Test/CMakeLists.txt +++ b/Tests/FindOpenAL/Test/CMakeLists.txt @@ -12,3 +12,9 @@ add_executable(test_var main.cxx) target_include_directories(test_var PRIVATE ${OPENAL_INCLUDE_DIR}) target_link_libraries(test_var PRIVATE ${OPENAL_LIBRARY}) add_test(NAME test_var COMMAND test_var) + +# OpenAL has been deprecated on macOS since Catalina (10.15) +if(APPLE) + target_compile_options(test_tgt PRIVATE "-Wno-deprecated-declarations") + target_compile_options(test_var PRIVATE "-Wno-deprecated-declarations") +endif() diff --git a/Tests/FindOpenAL/Test/main.cxx b/Tests/FindOpenAL/Test/main.cxx index bb45faf..1396c60 100644 --- a/Tests/FindOpenAL/Test/main.cxx +++ b/Tests/FindOpenAL/Test/main.cxx @@ -1,5 +1,10 @@ -#include <AL/al.h> -#include <AL/alc.h> +#ifdef __APPLE__ +# include "OpenAL/al.h" +# include "OpenAL/alc.h" +#else +# include <AL/al.h> +# include <AL/alc.h> +#endif #include <stdio.h> int main() |
