Update README installation and usage instructions and fix a cmake issue
This commit is contained in:
parent
55b5d8a488
commit
29912bd494
@ -25,7 +25,7 @@ target_include_directories(
|
||||
cpptrace
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include/>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/cpptrace/cpptrace>
|
||||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/cpptrace/>
|
||||
)
|
||||
|
||||
# TODO
|
||||
@ -102,16 +102,18 @@ function(check_support var source includes libraries definitions)
|
||||
set(${var} ${${var}} PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
check_support(HAS_UNWIND has_unwind.cpp "" "" "")
|
||||
check_support(HAS_EXECINFO has_execinfo.cpp "" "" "")
|
||||
check_support(HAS_BACKTRACE has_backtrace.cpp "" "backtrace" "${CPPTRACE_BACKTRACE_PATH_DEFINITION}")
|
||||
check_support(HAS_CXXABI has_cxxabi.cpp "" "" "")
|
||||
if(NOT MSVC)
|
||||
set(STACKTRACE_LINK_LIB "stdc++_libbacktrace")
|
||||
else()
|
||||
set(STACKTRACE_LINK_LIB "")
|
||||
if(NOT MSVC) # No need to bother checking in msvc, but do check in minngw
|
||||
check_support(HAS_UNWIND has_unwind.cpp "" "" "")
|
||||
check_support(HAS_EXECINFO has_execinfo.cpp "" "" "")
|
||||
check_support(HAS_BACKTRACE has_backtrace.cpp "" "backtrace" "${CPPTRACE_BACKTRACE_PATH_DEFINITION}")
|
||||
check_support(HAS_CXXABI has_cxxabi.cpp "" "" "")
|
||||
if(NOT MSVC)
|
||||
set(STACKTRACE_LINK_LIB "stdc++_libbacktrace")
|
||||
else()
|
||||
set(STACKTRACE_LINK_LIB "")
|
||||
endif()
|
||||
check_support(HAS_STACKTRACE has_stacktrace.cpp "" "${STACKTRACE_LINK_LIB}" "")
|
||||
endif()
|
||||
check_support(HAS_STACKTRACE has_stacktrace.cpp "" "${STACKTRACE_LINK_LIB}" "")
|
||||
|
||||
# =============================================== Autoconfig full dump ===============================================
|
||||
# If nothing is specified, attempt to use libbacktrace's full dump
|
||||
|
||||
52
README.md
52
README.md
@ -45,6 +45,8 @@ target_link_libraries(your_target PRIVATE cpptrace)
|
||||
|
||||
It's as easy as that. Cpptrace will automatically configure itself for your system.
|
||||
|
||||
Be sure to configure with `-DCMAKE_BUILD_TYPE=Debug`.
|
||||
|
||||

|
||||
|
||||
## Other Installation Mechanisms
|
||||
@ -57,12 +59,33 @@ git clone https://github.com/jeremy-rifkin/cpptrace.git
|
||||
mkdir cpptrace/build
|
||||
cd cpptrace/build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=On
|
||||
make
|
||||
make -j
|
||||
sudo make install
|
||||
```
|
||||
|
||||
Using through cmake:
|
||||
```cmake
|
||||
include(CMakeFindDependencyMacro)
|
||||
find_dependency(cpptrace REQUIRED)
|
||||
target_link_libraries(<your target> cpptrace)
|
||||
```
|
||||
Be sure to configure with `-DCMAKE_BUILD_TYPE=Debug`.
|
||||
|
||||
Or compile with `-lcpptrace`:
|
||||
|
||||
```sh
|
||||
g++ main.cpp -o main -g -Wall -lcpptrace
|
||||
./main
|
||||
```
|
||||
|
||||
If you get an error along the lines of
|
||||
```
|
||||
error while loading shared libraries: libcpptrace.so: cannot open shared object file: No such file or directory
|
||||
```
|
||||
You may have to run `sudo /sbin/ldconfig` so the system finds libcpptrace.so (I had to do this on Ubuntu).
|
||||
|
||||
<details>
|
||||
<summary>Or on windows</summary>
|
||||
<summary>System-wide install on windows</summary>
|
||||
|
||||
```ps1
|
||||
git clone https://github.com/jeremy-rifkin/cpptrace.git
|
||||
@ -78,6 +101,31 @@ Note: You'll need to run as an administrator in a developer powershell, or use v
|
||||
studio to get the correct environment variables set.
|
||||
</details>
|
||||
|
||||
### Local User Installation
|
||||
|
||||
To install just for the local user (or any custom prefix):
|
||||
|
||||
```sh
|
||||
git clone https://github.com/jeremy-rifkin/cpptrace.git
|
||||
# optional: git checkout <HASH or TAG>
|
||||
mkdir cpptrace/build
|
||||
cd cpptrace/build
|
||||
cmake .. -DCMAKE_BUILD_TYPE=Release -DBUILD_SHARED_LIBS=On -DCMAKE_INSTALL_PREFIX=$HOME/wherever
|
||||
make -j
|
||||
sudo make install
|
||||
```
|
||||
|
||||
Using through cmake:
|
||||
```cmake
|
||||
find_package(cpptrace REQUIRED PATHS $ENV{HOME}/wherever)
|
||||
target_link_libraries(<your target> cpptrace::cpptrace)
|
||||
```
|
||||
|
||||
Using manually:
|
||||
```
|
||||
g++ main.cpp -o main -g -Wall -I$HOME/wherever/include -L$HOME/wherever/lib -lcpptrace
|
||||
```
|
||||
|
||||
### Package Managers
|
||||
|
||||
TODO
|
||||
|
||||
Loading…
Reference in New Issue
Block a user