cmake可见性和AppArmor示例
This commit is contained in:
parent
0eeb4a7bb6
commit
4b4b933e3d
19 changed files with 661 additions and 0 deletions
9
cmake/visibility/printer/public/printer/printer.h
Normal file
9
cmake/visibility/printer/public/printer/printer.h
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
#pragma once
|
||||
#include <string>
|
||||
#include <color/color.h> // 公开头引用了 color → color 必须是 PUBLIC 依赖
|
||||
// 注意:这里没有 timeutil.h,也没有 PRINTER_TIME_FORMAT
|
||||
|
||||
class Printer {
|
||||
public:
|
||||
void print(const std::string& msg, Color c);
|
||||
};
|
||||
12
cmake/visibility/printer/src/printer.cpp
Normal file
12
cmake/visibility/printer/src/printer.cpp
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
#include "printer/printer.h"
|
||||
#include "timeutil.h" // 只在实现里用 → timeutil 是 PRIVATE 依赖
|
||||
#include <iostream>
|
||||
|
||||
#ifndef PRINTER_TIME_FORMAT // 只在本 .cpp 里用的宏 → PRIVATE
|
||||
#define PRINTER_TIME_FORMAT "%H:%M:%S" // 没从 CMake 传进来时的兜底
|
||||
#endif
|
||||
|
||||
void Printer::print(const std::string& msg, Color c) {
|
||||
std::cout << timestamp(PRINTER_TIME_FORMAT) << " "
|
||||
<< colorCode(c) << msg << "\033[0m" << std::endl;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue