Initial commit of BudgetPro
This commit is contained in:
@@ -0,0 +1,107 @@
|
||||
# amalgamate(把工程整合为一个h+一个cpp)
|
||||
|
||||
amalgamate工具可以把一个工程所有的cpp文件合并为一个超大的cpp文件,把所有h文件合并为一个头文件,这样整个工程只有1个h文件和1个cpp文件,直接引入工程即可使用,对于那种无需编译为库的情况非常方便
|
||||
|
||||
SARibbon借助[https://github.com/vinniefalco/Amalgamate.git](https://github.com/vinniefalco/Amalgamate.git) 这个工具,实现工程文件的合并
|
||||
|
||||
使用说明:
|
||||
|
||||
```
|
||||
NAME
|
||||
|
||||
amalgamate - produce an amalgamation of C/C++ source files.
|
||||
|
||||
SYNOPSIS
|
||||
|
||||
amalgamate [-s]
|
||||
[-w {wildcards}]
|
||||
[-f {file|macro}]...
|
||||
[-p {file|macro}]...
|
||||
[-d {name}={file}]...
|
||||
[-i {dir}]...
|
||||
{inputFile} {outputFile}
|
||||
|
||||
DESCRIPTION
|
||||
|
||||
Produces an amalgamation of {inputFile} by replacing #include statements with
|
||||
the contents of the file they refer to. This replacement will only occur if
|
||||
the file was located in the same directory, or one of the additional include
|
||||
paths added with the -i option.
|
||||
|
||||
Files included in angle brackets (system includes) are only inlined if the
|
||||
-s option is specified.
|
||||
|
||||
If an #include line contains a macro instead of a string literal, the list
|
||||
of definitions provided through the -d option is consulted to convert the
|
||||
macro into a string.
|
||||
|
||||
A file will only be inlined once, with subsequent #include lines for the same
|
||||
file silently ignored, unless the -f option is specified for the file.
|
||||
|
||||
OPTIONS
|
||||
|
||||
-s Process #include lines containing angle brackets (i.e.
|
||||
system includes). Normally these are not inlined.
|
||||
|
||||
-w {wildcards} Specify a comma separated list of file name patterns to
|
||||
match when deciding to inline (assuming the file can be
|
||||
located). The default setting is "*.cpp;*.c;*.h;*.mm;*.m".
|
||||
|
||||
-f {file|macro} Force reinclusion of the specified file or macro on
|
||||
all appearances in #include lines.
|
||||
|
||||
-p {file|macro} Prevent reinclusion of the specified file or macro on
|
||||
subsequent appearances in #include lines.
|
||||
|
||||
-d {name}={file} Use {file} for macro {name} if it appears in an #include
|
||||
line.
|
||||
|
||||
-i {dir} Additionally look in the specified directory for files when
|
||||
processing #include lines.
|
||||
|
||||
-v Verbose output mode
|
||||
```
|
||||
|
||||
# 编译amalgamate
|
||||
|
||||
从[https://github.com/vinniefalco/Amalgamate.git](https://github.com/vinniefalco/Amalgamate.git)把工程克隆下来,直接用vs进行编译即可,编译完会生成`Amalgamate.exe`
|
||||
|
||||
# 定义合并模板
|
||||
|
||||
合并需要定义模板,模板有h和cpp两个,合并模板的定义需要简单说一下,理论上只要h和cpp两个模板,但实际定义了4个文件
|
||||
|
||||
SARibbon项目定义的头文件合并模板位于:[SARibbonAmalgamTemplate.h](./amalgamate/SARibbonAmalgamTemplate.h)
|
||||
|
||||
模板里面要把所有的头文件都包含,合并的过程中会逐个查找头文件并把它合并到一个头文件中
|
||||
|
||||
头文件相对简单,cpp文件的合并比较复杂,cpp文件也包含头文件,如果不做特殊处理,会把cpp文件的头文件也合并进来,这样得到的cpp文件并不是我们想要的,因此amalgamate提供了`@remap`标记,被这个标记过的头文件,相当于加入了一个忽略库中,不会在合并cpp文件过程中重复查找
|
||||
|
||||
因此SARibbon项目的合并cpp模板[SARibbonAmalgamTemplate.cpp](./amalgamate/SARibbonAmalgamTemplate.cpp)有如下一句话
|
||||
|
||||
```
|
||||
/*@remap "SARibbonAmalgamTemplatePublicHeaders.h" "SARibbon.h" */
|
||||
#include "SARibbonAmalgamTemplateHeaderGlue.h"
|
||||
```
|
||||
|
||||
这句话代表`SARibbonAmalgamTemplatePublicHeaders.h`里面的内容已经加入了`SARibbon.h`里面了,在合并cpp文件遇到include这里面的内容不用理会
|
||||
|
||||
为此,头文件模板并不是把所有相关的头文件列举,而是
|
||||
|
||||
```cpp
|
||||
#include "SARibbonAmalgamTemplatePublicHeaders.h"
|
||||
```
|
||||
|
||||
`SARibbonAmalgamTemplatePublicHeaders.h`这里定义了所有的SARibbon的头文件
|
||||
|
||||
另外还有一个关键的头文件是`SARibbonAmalgamTemplateHeaderGlue.h`,这个头文件只有如下两行:
|
||||
|
||||
```cpp
|
||||
// This file provides an extra level of indirection for the @remap in the template
|
||||
#include "SARibbonAmalgamTemplatePublicHeaders.h"
|
||||
```
|
||||
|
||||
目的就是为了给cpp文件的`@remap`标记用
|
||||
|
||||
# 把SARibbon项目合并为一个h文件和一个cpp文件
|
||||
|
||||
windows下直接运行`Amalgamate.sh`即可
|
||||
@@ -0,0 +1,10 @@
|
||||
#!/bin/bash
|
||||
|
||||
DEST=../src
|
||||
OPTS='-i "../src/SARibbonBar" -i "../src/SARibbonBar/colorWidgets" -w "*.cpp;*.h;*.hpp" -s'
|
||||
./Amalgamate.exe $OPTS ./amalgamate/SARibbonAmalgamTemplate.h $DEST/SARibbon.h
|
||||
./Amalgamate.exe $OPTS ./amalgamate/SARibbonAmalgamTemplate.cpp $DEST/SARibbon.cpp
|
||||
# 使用read命令达到类似bat中的pause命令效果
|
||||
echo 按任意键继续
|
||||
read -n 1
|
||||
echo 继续运行
|
||||
@@ -0,0 +1,69 @@
|
||||
//定义此宏,将SA_RIBBON_EXPORT定义为空
|
||||
#ifndef SA_RIBBON_BAR_NO_EXPORT
|
||||
#define SA_RIBBON_BAR_NO_EXPORT
|
||||
#endif
|
||||
//定义此宏,将SA_COLOR_WIDGETS_API定义为空
|
||||
#ifndef SA_COLOR_WIDGETS_NO_DLL
|
||||
#define SA_COLOR_WIDGETS_NO_DLL
|
||||
#endif
|
||||
|
||||
/*@remap "SARibbonAmalgamTemplatePublicHeaders.h" "SARibbon.h" */
|
||||
#include "SARibbonAmalgamTemplateHeaderGlue.h"
|
||||
|
||||
// disable warnings about unsafe standard library calls
|
||||
#ifdef _MSC_VER
|
||||
#pragma push_macro ("_CRT_SECURE_NO_WARNINGS")
|
||||
#ifndef _CRT_SECURE_NO_WARNINGS
|
||||
#define _CRT_SECURE_NO_WARNINGS
|
||||
#endif
|
||||
#pragma warning (push)
|
||||
#pragma warning (disable: 4996) // deprecated POSIX names
|
||||
#endif
|
||||
|
||||
#include "../../src/SARibbonBar/colorWidgets/SAColorMenu.cpp"
|
||||
#include "../../src/SARibbonBar/colorWidgets/SAColorGridWidget.cpp"
|
||||
#include "../../src/SARibbonBar/colorWidgets/SAColorPaletteGridWidget.cpp"
|
||||
#include "../../src/SARibbonBar/colorWidgets/SAColorToolButton.cpp"
|
||||
//sa ribbon
|
||||
#include "../../src/SARibbonBar/SAFramelessHelper.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonApplicationButton.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonSystemButtonBar.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonToolButton.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonColorToolButton.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonLineWidgetContainer.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonActionsManager.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonLineEdit.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonCheckBox.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonComboBox.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonButtonGroupWidget.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonStackedWidget.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonSeparatorWidget.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonCtrlContainer.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonQuickAccessBar.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonTabBar.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonControlButton.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonMenu.cpp"
|
||||
|
||||
#include "../../src/SARibbonBar/SARibbonPannelOptionButton.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonPannelItem.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonPannelLayout.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonPannel.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonCategory.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonCategoryLayout.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonContextCategory.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonGalleryItem.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonGalleryGroup.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonGallery.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonBar.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonElementFactory.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonElementManager.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonCustomizeData.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonCustomizeWidget.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonCustomizeDialog.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonMainWindow.cpp"
|
||||
#include "../../src/SARibbonBar/SARibbonWidget.cpp"
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning (pop)
|
||||
#pragma pop_macro ("_CRT_SECURE_NO_WARNINGS")
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
#ifndef SA_RIBBON_H
|
||||
#define SA_RIBBON_H
|
||||
//定义此宏,将SA_RIBBON_EXPORT定义为空
|
||||
#ifndef SA_RIBBON_BAR_NO_EXPORT
|
||||
#define SA_RIBBON_BAR_NO_EXPORT
|
||||
#endif
|
||||
//定义此宏,将SA_COLOR_WIDGETS_API定义为空
|
||||
#ifndef SA_COLOR_WIDGETS_NO_DLL
|
||||
#define SA_COLOR_WIDGETS_NO_DLL
|
||||
#endif
|
||||
|
||||
#include "SARibbonAmalgamTemplatePublicHeaders.h"
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,2 @@
|
||||
// This file provides an extra level of indirection for the @remap in the template
|
||||
#include "SARibbonAmalgamTemplatePublicHeaders.h"
|
||||
@@ -0,0 +1,47 @@
|
||||
//Global
|
||||
#include "../../src/SARibbonBar/colorWidgets/SAColorWidgetsGlobal.h"
|
||||
#include "../../src/SARibbonBar/SARibbonBarVersionInfo.h"
|
||||
#include "../../src/SARibbonBar/SARibbonGlobal.h"
|
||||
//color widget
|
||||
#include "../../src/SARibbonBar/colorWidgets/SAColorMenu.h"
|
||||
#include "../../src/SARibbonBar/colorWidgets/SAColorGridWidget.h"
|
||||
#include "../../src/SARibbonBar/colorWidgets/SAColorPaletteGridWidget.h"
|
||||
#include "../../src/SARibbonBar/colorWidgets/SAColorToolButton.h"
|
||||
//sa ribbon
|
||||
#include "../../src/SARibbonBar/SAFramelessHelper.h"
|
||||
#include "../../src/SARibbonBar/SARibbonApplicationButton.h"
|
||||
#include "../../src/SARibbonBar/SARibbonSystemButtonBar.h"
|
||||
#include "../../src/SARibbonBar/SARibbonToolButton.h"
|
||||
#include "../../src/SARibbonBar/SARibbonColorToolButton.h"
|
||||
#include "../../src/SARibbonBar/SARibbonLineWidgetContainer.h"
|
||||
#include "../../src/SARibbonBar/SARibbonActionsManager.h"
|
||||
#include "../../src/SARibbonBar/SARibbonLineEdit.h"
|
||||
#include "../../src/SARibbonBar/SARibbonCheckBox.h"
|
||||
#include "../../src/SARibbonBar/SARibbonComboBox.h"
|
||||
#include "../../src/SARibbonBar/SARibbonButtonGroupWidget.h"
|
||||
#include "../../src/SARibbonBar/SARibbonStackedWidget.h"
|
||||
#include "../../src/SARibbonBar/SARibbonSeparatorWidget.h"
|
||||
#include "../../src/SARibbonBar/SARibbonCtrlContainer.h"
|
||||
#include "../../src/SARibbonBar/SARibbonQuickAccessBar.h"
|
||||
#include "../../src/SARibbonBar/SARibbonTabBar.h"
|
||||
#include "../../src/SARibbonBar/SARibbonControlButton.h"
|
||||
#include "../../src/SARibbonBar/SARibbonMenu.h"
|
||||
|
||||
#include "../../src/SARibbonBar/SARibbonPannelOptionButton.h"
|
||||
#include "../../src/SARibbonBar/SARibbonPannelItem.h"
|
||||
#include "../../src/SARibbonBar/SARibbonPannelLayout.h"
|
||||
#include "../../src/SARibbonBar/SARibbonPannel.h"
|
||||
#include "../../src/SARibbonBar/SARibbonCategory.h"
|
||||
#include "../../src/SARibbonBar/SARibbonCategoryLayout.h"
|
||||
#include "../../src/SARibbonBar/SARibbonContextCategory.h"
|
||||
#include "../../src/SARibbonBar/SARibbonGalleryItem.h"
|
||||
#include "../../src/SARibbonBar/SARibbonGalleryGroup.h"
|
||||
#include "../../src/SARibbonBar/SARibbonGallery.h"
|
||||
#include "../../src/SARibbonBar/SARibbonBar.h"
|
||||
#include "../../src/SARibbonBar/SARibbonElementFactory.h"
|
||||
#include "../../src/SARibbonBar/SARibbonElementManager.h"
|
||||
#include "../../src/SARibbonBar/SARibbonCustomizeData.h"
|
||||
#include "../../src/SARibbonBar/SARibbonCustomizeWidget.h"
|
||||
#include "../../src/SARibbonBar/SARibbonCustomizeDialog.h"
|
||||
#include "../../src/SARibbonBar/SARibbonMainWindow.h"
|
||||
#include "../../src/SARibbonBar/SARibbonWidget.h"
|
||||
Reference in New Issue
Block a user