2 Commits

Author SHA1 Message Date
dd15bb2205 updated build system 2024-07-27 15:54:01 -05:00
4b53b5544f updated build system 2024-07-27 15:53:45 -05:00
11 changed files with 93 additions and 63 deletions

View File

@ -122,6 +122,7 @@ endif()
-DPROJECT_COPYRIGHT=${PROJECT_COPYRIGHT} -DPROJECT_COPYRIGHT=${PROJECT_COPYRIGHT}
-DPROJECT_DESC=${PROJECT_DESC} -DPROJECT_DESC=${PROJECT_DESC}
-DPROJECT_DIST_DIR=${PROJECT_DIST_DIR} -DPROJECT_DIST_DIR=${PROJECT_DIST_DIR}
-DPROJECT_ENABLE_BACKWARD_CPP=${PROJECT_ENABLE_BACKWARD_CPP}
-DPROJECT_ENABLE_BOOST=${PROJECT_ENABLE_BOOST} -DPROJECT_ENABLE_BOOST=${PROJECT_ENABLE_BOOST}
-DPROJECT_ENABLE_CPP_HTTPLIB=${PROJECT_ENABLE_CPP_HTTPLIB} -DPROJECT_ENABLE_CPP_HTTPLIB=${PROJECT_ENABLE_CPP_HTTPLIB}
-DPROJECT_ENABLE_CURL=${PROJECT_ENABLE_CURL} -DPROJECT_ENABLE_CURL=${PROJECT_ENABLE_CURL}

View File

@ -6,6 +6,7 @@ include(cmake/libraries/openssl.cmake)
include(cmake/libraries/boost.cmake) include(cmake/libraries/boost.cmake)
include(cmake/libraries/backward_cpp.cmake)
include(cmake/libraries/cpp_httplib.cmake) include(cmake/libraries/cpp_httplib.cmake)
include(cmake/libraries/curl.cmake) include(cmake/libraries/curl.cmake)
include(cmake/libraries/fuse.cmake) include(cmake/libraries/fuse.cmake)

View File

@ -0,0 +1,7 @@
if(PROJECT_ENABLE_BACKWARD_CPP AND PROJECT_BUILD)
add_definitions(-DPROJECT_ENABLE_BACKWARD_CPP)
if(PROJECT_IS_MINGW)
link_libraries(msvcr90)
endif()
endif()

View File

@ -1,3 +1,4 @@
option(PROJECT_ENABLE_BACKWARD_CPP "Enable backward-cpp" ON)
option(PROJECT_ENABLE_BOOST "Enable boost libraries" ON) option(PROJECT_ENABLE_BOOST "Enable boost libraries" ON)
option(PROJECT_ENABLE_CPP_HTTPLIB "Enable cpp-httplib" ON) option(PROJECT_ENABLE_CPP_HTTPLIB "Enable cpp-httplib" ON)
option(PROJECT_ENABLE_CURL "Enable curl library" ON) option(PROJECT_ENABLE_CURL "Enable curl library" ON)

View File

@ -19,6 +19,7 @@ PROJECT_APP_LIST=(${PROJECT_NAME})
PROJECT_PRIVATE_KEY=${DEVELOPER_PRIVATE_KEY} PROJECT_PRIVATE_KEY=${DEVELOPER_PRIVATE_KEY}
PROJECT_PUBLIC_KEY=${DEVELOPER_PUBLIC_KEY} PROJECT_PUBLIC_KEY=${DEVELOPER_PUBLIC_KEY}
PROJECT_ENABLE_BACKWARD_CPP=ON
PROJECT_ENABLE_BOOST=ON PROJECT_ENABLE_BOOST=ON
PROJECT_ENABLE_CPP_HTTPLIB=ON PROJECT_ENABLE_CPP_HTTPLIB=ON
PROJECT_ENABLE_CURL=ON PROJECT_ENABLE_CURL=ON
@ -33,6 +34,7 @@ PROJECT_ENABLE_STDUUID=ON
PROJECT_ENABLE_TESTING=ON PROJECT_ENABLE_TESTING=ON
PROJECT_ENABLE_WINFSP=ON PROJECT_ENABLE_WINFSP=ON
PROJECT_KEEP_BACKWARD_CPP=1
PROJECT_STATIC_LINK=ON PROJECT_STATIC_LINK=ON
PROJECT_MINGW64_COPY_DEPENDENCIES+=() PROJECT_MINGW64_COPY_DEPENDENCIES+=()

View File

@ -19,7 +19,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#if !defined(PROJECT_STATIC_LINK) #if defined(PROJECT_ENABLE_BACKWARD_CPP)
#include "backward.hpp" #include "backward.hpp"
#endif #endif
@ -32,7 +32,7 @@
using namespace repertory; using namespace repertory;
auto main(int argc, char **argv) -> int { auto main(int argc, char **argv) -> int {
#if !defined(PROJECT_STATIC_LINK) #if defined(PROJECT_ENABLE_BACKWARD_CPP)
static backward::SignalHandling sh; static backward::SignalHandling sh;
#endif #endif

View File

@ -19,7 +19,7 @@
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE. SOFTWARE.
*/ */
#if !defined(PROJECT_STATIC_LINK) #if defined(PROJECT_ENABLE_BACKWARD_CPP)
#include "backward.hpp" #include "backward.hpp"
#endif #endif
@ -36,7 +36,7 @@ std::size_t PROVIDER_INDEX{0U};
#endif // _WIN32 #endif // _WIN32
auto main(int argc, char **argv) -> int { auto main(int argc, char **argv) -> int {
#if !defined(PROJECT_STATIC_LINK) #if defined(PROJECT_ENABLE_BACKWARD_CPP)
static backward::SignalHandling sh; static backward::SignalHandling sh;
#endif #endif

View File

@ -202,6 +202,7 @@ fi
if [ "${PROJECT_STATIC_LINK}" == "ON" ]; then if [ "${PROJECT_STATIC_LINK}" == "ON" ]; then
PROJECT_BUILD_SHARED_LIBS=OFF PROJECT_BUILD_SHARED_LIBS=OFF
PROJECT_ENABLE_BACKWARD_CPP=OFF
else else
PROJECT_BUILD_SHARED_LIBS=ON PROJECT_BUILD_SHARED_LIBS=ON
fi fi

View File

@ -1,6 +1,7 @@
#!/bin/bash #!/bin/bash
PROJECT_LIBRARIES=( PROJECT_LIBRARIES=(
BACKWARD_CPP
BOOST BOOST
CPP_HTTPLIB CPP_HTTPLIB
CURL CURL
@ -17,6 +18,7 @@ PROJECT_LIBRARIES=(
) )
declare -A PROJECT_CLEANUP declare -A PROJECT_CLEANUP
PROJECT_CLEANUP[BACKWARD_CPP]="include/backward.hpp:src/backward.cpp"
PROJECT_CLEANUP[BOOST]="boost_*" PROJECT_CLEANUP[BOOST]="boost_*"
PROJECT_CLEANUP[CPP_HTTPLIB]="cpp-httplib-*" PROJECT_CLEANUP[CPP_HTTPLIB]="cpp-httplib-*"
PROJECT_CLEANUP[CURL]="curl-*" PROJECT_CLEANUP[CURL]="curl-*"

View File

@ -1,3 +1,4 @@
#if defined(PROJECT_ENABLE_BACKWARD_CPP)
/* /*
* backward.hpp * backward.hpp
* Copyright 2013 Google Inc. All Rights Reserved. * Copyright 2013 Google Inc. All Rights Reserved.
@ -81,17 +82,17 @@
#include <cstdio> #include <cstdio>
#include <cstdlib> #include <cstdlib>
#include <cstring> #include <cstring>
#include <exception>
#include <fstream> #include <fstream>
#include <iomanip> #include <iomanip>
#include <iostream> #include <iostream>
#include <iterator>
#include <limits> #include <limits>
#include <new> #include <new>
#include <sstream> #include <sstream>
#include <streambuf> #include <streambuf>
#include <string> #include <string>
#include <vector> #include <vector>
#include <exception>
#include <iterator>
#if defined(BACKWARD_SYSTEM_LINUX) #if defined(BACKWARD_SYSTEM_LINUX)
@ -507,11 +508,17 @@ typedef pdb_symbol current;
namespace details { namespace details {
template <typename T> struct rm_ptr { typedef T type; }; template <typename T> struct rm_ptr {
typedef T type;
};
template <typename T> struct rm_ptr<T *> { typedef T type; }; template <typename T> struct rm_ptr<T *> {
typedef T type;
};
template <typename T> struct rm_ptr<const T *> { typedef const T type; }; template <typename T> struct rm_ptr<const T *> {
typedef const T type;
};
template <typename R, typename T, R (*F)(T)> struct deleter { template <typename R, typename T, R (*F)(T)> struct deleter {
template <typename U> void operator()(U &ptr) const { (*F)(ptr); } template <typename U> void operator()(U &ptr) const { (*F)(ptr); }
@ -1252,7 +1259,8 @@ template <typename TAG> class TraceResolverImpl;
#ifdef BACKWARD_SYSTEM_UNKNOWN #ifdef BACKWARD_SYSTEM_UNKNOWN
template <> class TraceResolverImpl<system_tag::unknown_tag> template <>
class TraceResolverImpl<system_tag::unknown_tag>
: public TraceResolverImplBase {}; : public TraceResolverImplBase {};
#endif #endif
@ -3349,7 +3357,8 @@ private:
char **srcfiles = 0; char **srcfiles = 0;
Dwarf_Signed file_count = 0; Dwarf_Signed file_count = 0;
if (dwarf_srcfiles(cu_die, &srcfiles, &file_count, &error) == DW_DLV_OK) { if (dwarf_srcfiles(cu_die, &srcfiles, &file_count, &error) == DW_DLV_OK) {
if (file_count > 0 && file_index <= static_cast<Dwarf_Unsigned>(file_count)) { if (file_count > 0 &&
file_index <= static_cast<Dwarf_Unsigned>(file_count)) {
file = std::string(srcfiles[file_index - 1]); file = std::string(srcfiles[file_index - 1]);
} }
@ -3605,7 +3614,8 @@ public:
} }
}; };
template <> class TraceResolverImpl<system_tag::windows_tag> template <>
class TraceResolverImpl<system_tag::windows_tag>
: public TraceResolverImplBase { : public TraceResolverImplBase {
public: public:
TraceResolverImpl() { TraceResolverImpl() {
@ -3619,13 +3629,13 @@ public:
DWORD symOptions = SymGetOptions(); DWORD symOptions = SymGetOptions();
symOptions |= SYMOPT_LOAD_LINES | SYMOPT_UNDNAME; symOptions |= SYMOPT_LOAD_LINES | SYMOPT_UNDNAME;
SymSetOptions(symOptions); SymSetOptions(symOptions);
EnumProcessModules(process, &module_handles[0], EnumProcessModules(
static_cast<DWORD>(module_handles.size() * sizeof(HMODULE)), process, &module_handles[0],
&cbNeeded); static_cast<DWORD>(module_handles.size() * sizeof(HMODULE)), &cbNeeded);
module_handles.resize(cbNeeded / sizeof(HMODULE)); module_handles.resize(cbNeeded / sizeof(HMODULE));
EnumProcessModules(process, &module_handles[0], EnumProcessModules(
static_cast<DWORD>(module_handles.size() * sizeof(HMODULE)), process, &module_handles[0],
&cbNeeded); static_cast<DWORD>(module_handles.size() * sizeof(HMODULE)), &cbNeeded);
std::transform(module_handles.begin(), module_handles.end(), std::transform(module_handles.begin(), module_handles.end(),
std::back_inserter(modules), get_mod_info(process)); std::back_inserter(modules), get_mod_info(process));
void *base = modules[0].base_address; void *base = modules[0].base_address;
@ -3809,9 +3819,10 @@ public:
} }
#endif #endif
// Allow adding to paths gotten from BACKWARD_CXX_SOURCE_PREFIXES after loading the // Allow adding to paths gotten from BACKWARD_CXX_SOURCE_PREFIXES after
// library; this can be useful when the library is loaded when the locations are unknown // loading the library; this can be useful when the library is loaded when the
// Warning: Because this edits the static paths variable, it is *not* intrinsiclly thread safe // locations are unknown Warning: Because this edits the static paths
// variable, it is *not* intrinsiclly thread safe
static void add_paths_to_env_variable_impl(const std::string &to_add) { static void add_paths_to_env_variable_impl(const std::string &to_add) {
get_mutable_paths_from_env_variable().push_back(to_add); get_mutable_paths_from_env_variable().push_back(to_add);
} }
@ -3830,7 +3841,8 @@ private:
} }
static std::vector<std::string> &get_mutable_paths_from_env_variable() { static std::vector<std::string> &get_mutable_paths_from_env_variable() {
static volatile std::vector<std::string> paths = get_paths_from_env_variable_impl(); static volatile std::vector<std::string> paths =
get_paths_from_env_variable_impl();
return const_cast<std::vector<std::string> &>(paths); return const_cast<std::vector<std::string> &>(paths);
} }
@ -4494,3 +4506,4 @@ public:
} // namespace backward } // namespace backward
#endif /* H_GUARD */ #endif /* H_GUARD */
#endif // defined(PROJECT_ENABLE_BACKWARD_CPP)

View File

@ -1,3 +1,4 @@
#if defined(PROJECT_ENABLE_BACKWARD_CPP)
// Pick your poison. // Pick your poison.
// //
// On GNU/Linux, you have few choices to get the most out of your stack trace. // On GNU/Linux, you have few choices to get the most out of your stack trace.
@ -40,3 +41,4 @@ namespace backward {
backward::SignalHandling sh; backward::SignalHandling sh;
} // namespace backward } // namespace backward
#endif // defined(PROJECT_ENABLE_BACKWARD_CPP)