From 36350b7de849300bd3d72a05d8bf890ca405a014 Mon Sep 17 00:00:00 2001 From: Peter Dimov Date: Fri, 4 Jun 2021 20:47:52 +0300 Subject: [PATCH 1/3] Add a Boost-friendly subproject case to CMakeLists --- CMakeLists.txt | 52 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 52 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 71e7722e0..9afee7ff9 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,3 +1,53 @@ +if(NOT CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) + +# Generated by `boostdep --cmake compute` +# Copyright 2020, 2021 Peter Dimov +# Distributed under the Boost Software License, Version 1.0. +# https://www.boost.org/LICENSE_1_0.txt + +cmake_minimum_required(VERSION 3.5...3.20) + +project(boost_compute VERSION "${BOOST_SUPERPROJECT_VERSION}" LANGUAGES CXX) + +add_library(boost_compute INTERFACE) +add_library(Boost::compute ALIAS boost_compute) + +target_include_directories(boost_compute INTERFACE include) + +target_link_libraries(boost_compute + INTERFACE + Boost::algorithm + Boost::array + Boost::assert + Boost::atomic + Boost::chrono + Boost::config + Boost::core + Boost::filesystem + Boost::function + Boost::function_types + Boost::fusion + Boost::iterator + Boost::lexical_cast + Boost::mpl + Boost::optional + Boost::preprocessor + Boost::property_tree + Boost::proto + Boost::range + Boost::smart_ptr + Boost::static_assert + Boost::thread + Boost::throw_exception + Boost::tuple + Boost::type_traits + Boost::typeof + Boost::utility + Boost::uuid +) + +else() + # --------------------------------------------------------------------------- # Copyright (c) 2013 Kyle Lutz # @@ -127,3 +177,5 @@ install( # install header files install(DIRECTORY include/boost DESTINATION include/compute) + +endif() From d3c6fda1490c0f6909a2e6b53fcdbca547792fbc Mon Sep 17 00:00:00 2001 From: Daryus Medora <21352998+dmedora@users.noreply.github.com> Date: Tue, 23 Apr 2024 16:57:16 -0400 Subject: [PATCH 2/3] alert if appdata/home path cannot be found --- include/boost/compute/detail/path.hpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/include/boost/compute/detail/path.hpp b/include/boost/compute/detail/path.hpp index d9c5afd18..4c3b409e5 100644 --- a/include/boost/compute/detail/path.hpp +++ b/include/boost/compute/detail/path.hpp @@ -30,13 +30,20 @@ static const std::string& path_delim() // Path to appdata folder. inline const std::string& appdata_path() { + const char *home_path; #ifdef _WIN32 - static const std::string appdata = detail::getenv("APPDATA") - + path_delim() + "boost_compute"; + home_path = detail::getenv("HOME"); + if (home_path == nullptr) { + std::cerr << "ERROR: Unable to find APPDATA environment variable." << std::endl; + } #else - static const std::string appdata = detail::getenv("HOME") - + path_delim() + ".boost_compute"; + home_path = detail::getenv("HOME"); + if (home_path == nullptr) { + std::cerr << "ERROR: Unable to find APPDATA environment variable." << std::endl; + } #endif + static const std::string appdata = home_path + + path_delim() + ".boost_compute"; return appdata; } From 72f67db2b59218112fef695c43b44e40773df1bb Mon Sep 17 00:00:00 2001 From: Daryus Medora <21352998+dmedora@users.noreply.github.com> Date: Wed, 24 Apr 2024 10:07:46 -0400 Subject: [PATCH 3/3] updated var names --- include/boost/compute/detail/path.hpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/include/boost/compute/detail/path.hpp b/include/boost/compute/detail/path.hpp index 4c3b409e5..91c5891c5 100644 --- a/include/boost/compute/detail/path.hpp +++ b/include/boost/compute/detail/path.hpp @@ -30,19 +30,19 @@ static const std::string& path_delim() // Path to appdata folder. inline const std::string& appdata_path() { - const char *home_path; + const char *user_path; #ifdef _WIN32 - home_path = detail::getenv("HOME"); - if (home_path == nullptr) { + user_path = detail::getenv("APPDATA"); + if (user_path == nullptr) { std::cerr << "ERROR: Unable to find APPDATA environment variable." << std::endl; } #else - home_path = detail::getenv("HOME"); - if (home_path == nullptr) { - std::cerr << "ERROR: Unable to find APPDATA environment variable." << std::endl; + user_path = detail::getenv("HOME"); + if (user_path == nullptr) { + std::cerr << "ERROR: Unable to find HOME environment variable." << std::endl; } #endif - static const std::string appdata = home_path + static const std::string appdata = user_path + path_delim() + ".boost_compute"; return appdata; }