From 4df907ef1089f192a8d860ed2ffb3bc59f28c588 Mon Sep 17 00:00:00 2001 From: peri4 Date: Sat, 5 Sep 2026 23:09:38 +0300 Subject: [PATCH] CMake - add all flags to pip_defs.h Introspection - revert *_p files, because they are external API for introspection, not internal --- CMakeLists.txt | 14 +++++++++---- libs/main/core/piobject.h | 2 +- .../piintrospection_server_p.cpp | 20 ++++++++----------- .../introspection/piintrospection_server_p.h | 2 -- .../piintrospection_threads_p.cpp | 3 --- .../introspection/piintrospection_threads_p.h | 8 ++------ 6 files changed, 21 insertions(+), 28 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a6d1b7bb..b7adb693 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -90,7 +90,7 @@ macro(pip_resolve_feature_flags) endforeach() foreach(_f ${PIP_FEATURE_FLAGS}) if(${_f}) - add_definitions(-D${_f}) + add_definitions(-D${_f}) endif() endforeach() endmacro() @@ -381,12 +381,17 @@ if(INTROSPECTION) add_definitions(-DPIP_INTROSPECTION) set(_PIP_DEFS "PIP_INTROSPECTION") endif() +foreach(_f ${PIP_FEATURE_FLAGS}) + if(${_f}) + list(APPEND _PIP_DEFS "${_f}") + endif() +endforeach() if ((NOT DEFINED _PIP_SAVED_DEFS) OR (NOT "x${_PIP_SAVED_DEFS}" STREQUAL "x${_PIP_DEFS}")) set(_PIP_SAVED_DEFS "${_PIP_DEFS}" CACHE STRING "pip_defs" FORCE) file(WRITE ${_PIP_DEFS_FILE} "// This file was generated by PIP CMake, don`t edit it!\n") - if (NOT "x${_PIP_DEFS}" STREQUAL "x") - file(APPEND ${_PIP_DEFS_FILE} "#ifndef ${_PIP_DEFS}\n# define ${_PIP_DEFS}\n#endif\n") - endif() + foreach(_d ${_PIP_DEFS}) + file(APPEND ${_PIP_DEFS_FILE} "#ifndef ${_d}\n# define ${_d}\n#endif\n") + endforeach() endif() list(APPEND HDRS ${_PIP_DEFS_FILE}) @@ -949,6 +954,7 @@ message(" std::iostream: ${PIP_STD_IOSTREAM}") message(" ICU strings : ${PIP_ICU}") message(" Introspection: ${PIP_INTROSPECTION}") message(" Coverage : ${PIP_COVERAGE}") +message("") message(" Feature flags:") set(_max_flag_len 0) foreach(_f ${PIP_FEATURE_FLAGS}) diff --git a/libs/main/core/piobject.h b/libs/main/core/piobject.h index a3fcf44e..616b02a3 100644 --- a/libs/main/core/piobject.h +++ b/libs/main/core/piobject.h @@ -56,8 +56,8 @@ class PIP_EXPORT PIObject { #ifdef PIP_INTROSPECTION friend PIP_EXPORT void dumpApplication(bool); - friend class PIIntrospection; #endif + friend class PIIntrospection; typedef PIObject __PIObject__; typedef void __Parent__; diff --git a/libs/main/introspection/piintrospection_server_p.cpp b/libs/main/introspection/piintrospection_server_p.cpp index e7cc7946..613b3e28 100644 --- a/libs/main/introspection/piintrospection_server_p.cpp +++ b/libs/main/introspection/piintrospection_server_p.cpp @@ -19,12 +19,10 @@ #include "piintrospection_server_p.h" -#ifdef PIP_INTROSPECTION - -# include "pichunkstream.h" -# include "piinit.h" -# include "piobject.h" -# include "pisysteminfo.h" +#include "pichunkstream.h" +#include "piinit.h" +#include "piobject.h" +#include "pisysteminfo.h" const uint PIIntrospection::sign = 0x0F1C2B3A; @@ -113,9 +111,9 @@ PIByteArray PIIntrospection::packContainers() { PIByteArray ret; PIVector data; PIIntrospectionContainers * p = 0; -# ifdef PIP_INTROSPECTION +#ifdef PIP_INTROSPECTION p = PIINTROSPECTION_CONTAINERS->p; -# endif +#endif if (p) { data = p->getInfo(); } @@ -133,9 +131,9 @@ void PIIntrospection::unpackContainers(PIByteArray & ba, PIVectorp; -# endif +#endif if (p) { p->mutex.lock(); PIMap & tm(p->threads); @@ -172,5 +170,3 @@ void PIIntrospection::unpackObjects(PIByteArray & ba, PIVector> objects; } - -#endif // PIP_INTROSPECTION diff --git a/libs/main/introspection/piintrospection_server_p.h b/libs/main/introspection/piintrospection_server_p.h index 228eb128..2f3ecc9c 100644 --- a/libs/main/introspection/piintrospection_server_p.h +++ b/libs/main/introspection/piintrospection_server_p.h @@ -27,7 +27,6 @@ #include "piintrospection_threads_p.h" #include "pisystemmonitor.h" -#ifdef PIP_INTROSPECTION class PIP_EXPORT PIIntrospection { public: @@ -169,5 +168,4 @@ BINARY_STREAM_READ(PIIntrospection::ObjectInfo) { return s; } -#endif // PIP_INTROSPECTION #endif // PIINTROSPECTION_SERVER_P_H diff --git a/libs/main/introspection/piintrospection_threads_p.cpp b/libs/main/introspection/piintrospection_threads_p.cpp index a6188aa9..b7b8fbd1 100644 --- a/libs/main/introspection/piintrospection_threads_p.cpp +++ b/libs/main/introspection/piintrospection_threads_p.cpp @@ -19,7 +19,6 @@ #include "piintrospection_threads_p.h" -#ifdef PIP_INTROSPECTION PIIntrospectionThreads::ThreadInfo::ThreadInfo() { id = delay = 0; @@ -79,5 +78,3 @@ void PIIntrospectionThreads::threadRunDone(PIThread * t, ullong us) { ThreadInfo & ti(threads[t]); ti.run_us = (ti.run_us * 0.8) + (us * 0.2); /// WARNING } - -#endif // PIP_INTROSPECTION diff --git a/libs/main/introspection/piintrospection_threads_p.h b/libs/main/introspection/piintrospection_threads_p.h index fd6b6e25..b371343f 100644 --- a/libs/main/introspection/piintrospection_threads_p.h +++ b/libs/main/introspection/piintrospection_threads_p.h @@ -21,11 +21,8 @@ #define PIINTROSPECTION_THREADS_P_H #include "pibase.h" - -#ifdef PIP_INTROSPECTION - -# include "pimap.h" -# include "pithread.h" +#include "pimap.h" +#include "pithread.h" class PIP_EXPORT PIIntrospectionThreads { @@ -72,5 +69,4 @@ BINARY_STREAM_READ(PIIntrospectionThreads::ThreadInfo) { return s; } -#endif // PIP_INTROSPECTION #endif // PIINTROSPECTION_THREADS_P_H