| 1 | From a4c4e4f3c410834c3e56f644841f5bcbb084225c Mon Sep 17 00:00:00 2001
|
| 2 | From: Liliana Marie Prikler <[email protected]>
|
| 3 | Date: Fri, 28 Jun 2024 11:15:16 +0200
|
| 4 | Subject: [PATCH] clasp: Hide Event_t<T>::id_s.
|
| 5 |
|
| 6 | This patch helps build clingo with non-local clasp while keeping the
|
| 7 | event system working as intended.
|
| 8 | ---
|
| 9 | clasp/util/misc_types.h | 2 ++
|
| 10 | src/CMakeLists.txt | 2 +-
|
| 11 | 2 files changed, 3 insertions(+), 1 deletion(-)
|
| 12 |
|
| 13 | diff --git a/clasp/util/misc_types.h b/clasp/util/misc_types.h
|
| 14 | index 3677873..09c2075 100644
|
| 15 | |
| 16 | |
| 17 | @@ -432,7 +432,9 @@ struct Event_t : Event {
|
| 18 | Event_t(Subsystem sys, Verbosity verb) : Event(sys, id_s, verb) {}
|
| 19 | static const uint32 id_s;
|
| 20 | };
|
| 21 | +#if _BUILDING_CLASP_
|
| 22 | template <class T> const uint32 Event_t<T>::id_s = Event::nextId();
|
| 23 | +#endif
|
| 24 |
|
| 25 | template <class ToType, class EvType> const ToType* event_cast(const EvType& ev) { return ev.id == ToType::id_s ? static_cast<const ToType*>(&ev) : 0; }
|
| 26 |
|
| 27 | diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
|
| 28 | index 8439d12..4f55990 100644
|
| 29 | |
| 30 | |
| 31 | @@ -123,6 +123,7 @@ source_group("${ide_header}\\mt" FILES ${header_mt})
|
| 32 | endif()
|
| 33 |
|
| 34 | add_library(libclasp ${header} ${header_util} ${header_cli} ${header_mt} ${src})
|
| 35 | +target_compile_definitions(libclasp PRIVATE _BUILDING_CLASP_)
|
| 36 | if (CLASP_BUILD_WITH_THREADS)
|
| 37 | target_link_libraries(libclasp PUBLIC Threads::Threads)
|
| 38 | target_compile_options(libclasp PRIVATE
|
| 39 | --
|
| 40 | 2.45.1
|
| 41 |
|