[ox/std] Add option for building trace hook in shared library

This commit is contained in:
Gary Talent 2021-03-05 21:45:37 -06:00
parent c5773202b5
commit bcb8c108b2
3 changed files with 29 additions and 5 deletions

View File

@ -1,3 +1,15 @@
if(OX_USE_STDLIB AND OX_ENABLE_TRACEHOOK)
add_library(
OxTraceHook SHARED
tracehook.cpp
)
else()
add_library(
OxTraceHook
tracehook.cpp
)
endif()
add_library(
OxStd
assert.cpp
@ -26,7 +38,7 @@ if(NOT OX_BARE_METAL)
)
endif()
if(${OX_USE_STDLIB})
if(OX_USE_STDLIB)
target_compile_definitions(
OxStd PUBLIC
OX_USE_STDLIB
@ -36,6 +48,7 @@ endif()
target_link_libraries(
OxStd PUBLIC
$<$<CXX_COMPILER_ID:GNU>:gcc>
OxTraceHook
)
install(
@ -70,7 +83,7 @@ install(
include/ox/std
)
install(TARGETS OxStd
install(TARGETS OxStd OxTraceHook
LIBRARY DESTINATION lib/ox
ARCHIVE DESTINATION lib/ox
)

View File

@ -14,9 +14,7 @@
#include "trace.hpp"
extern "C"
void oxTraceHook([[maybe_unused]] const char *file, [[maybe_unused]] int line,
[[maybe_unused]] const char *ch, [[maybe_unused]] const char *msg) {
}
void oxTraceHook(const char *file, int line, const char *ch, const char *msg);
namespace ox::trace {

13
deps/ox/src/ox/std/tracehook.cpp vendored Normal file
View File

@ -0,0 +1,13 @@
/*
* Copyright 2015 - 2021 gary@drinkingtea.net
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
extern "C"
void oxTraceHook([[maybe_unused]] const char *file, [[maybe_unused]] int line,
[[maybe_unused]] const char *ch, [[maybe_unused]] const char *msg) {
}