From ab67c77d495c4e314d098f93b2427f18cfa69913 Mon Sep 17 00:00:00 2001 From: Mayuri <63649939+opensourcefuture@users.noreply.github.com> Date: Mon, 23 Aug 2021 17:12:25 +0800 Subject: [PATCH 01/82] Initial commit --- README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..de3f198 --- /dev/null +++ b/README.md @@ -0,0 +1 @@ +# CLearning \ No newline at end of file From 9d2c91be316ec0765bb17bb9b68ab9c2c3d97245 Mon Sep 17 00:00:00 2001 From: Mayuri <63649939+opensourcefuture@users.noreply.github.com> Date: Mon, 23 Aug 2021 17:13:17 +0800 Subject: [PATCH 02/82] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index de3f198..909d363 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# CLearning \ No newline at end of file +# Programme Learning From c87b22655ca3379d1dfdde94efc75504e72a94d1 Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Sun, 3 Oct 2021 19:51:40 +0800 Subject: [PATCH 03/82] =?UTF-8?q?=09=E6=96=B0=E6=96=87=E4=BB=B6=EF=BC=9A?= =?UTF-8?q?=20=20=201.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.c | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 1.c diff --git a/1.c b/1.c new file mode 100644 index 0000000..af96880 --- /dev/null +++ b/1.c @@ -0,0 +1,6 @@ +#include +#include +int main(){ + char *str ="123"; + printf("%s",str); +} From 1f62f48b27e03f84dbbe92c3326dfdccc28257ac Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Sun, 3 Oct 2021 20:15:30 +0800 Subject: [PATCH 04/82] =?UTF-8?q?=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20?= =?UTF-8?q?=20=201.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/1.c b/1.c index af96880..441c4d3 100644 --- a/1.c +++ b/1.c @@ -1,6 +1,11 @@ #include #include +#include int main(){ - char *str ="123"; - printf("%s",str); + char str1[20]="114514"; + char *str2 ="1919810"; + //char str3[]= *str2; + printf("%s\n%s\n",&str1,str2); + //strcpy(str1,str3); + //printf("strcpy(str1,str3):%s\n",str3) } From 36934be80dcaf95af5c31d9f854c90423af7adcf Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Sun, 3 Oct 2021 20:34:16 +0800 Subject: [PATCH 05/82] =?UTF-8?q?=09=E6=96=B0=E6=96=87=E4=BB=B6=EF=BC=9A?= =?UTF-8?q?=20=20=20baka.c=20=09=E5=88=A0=E9=99=A4=EF=BC=9A=20=20=20=20=20?= =?UTF-8?q?1.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- baka.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 baka.c diff --git a/baka.c b/baka.c new file mode 100644 index 0000000..b7c30e5 --- /dev/null +++ b/baka.c @@ -0,0 +1,21 @@ +#include +#include +#include +int baka(); +int main(){ + //char str1[20]="114514"; + //char *str2 ="1919810"; + //char str3[]= *str2; + //printf("%s\n%s\n",&str1,str2); + //strcpy(str1,str3); + //printf("strcpy(str1,str3):%s\n",str3) + baka(); +} + +int baka(){ + char saying1[99]="Baka,my Baka,I do love u so much. "; + char saying2[]="Pls take me away"; + strcat(saying1,saying2); + printf("%s!\n",&saying1); + return 0; +} From b7b48923067f47e3eb63db93896e8a26d7de7400 Mon Sep 17 00:00:00 2001 From: Mayuri <63649939+opensourcefuture@users.noreply.github.com> Date: Sun, 3 Oct 2021 20:37:20 +0800 Subject: [PATCH 06/82] Delete 1.c --- 1.c | 11 ----------- 1 file changed, 11 deletions(-) delete mode 100644 1.c diff --git a/1.c b/1.c deleted file mode 100644 index 441c4d3..0000000 --- a/1.c +++ /dev/null @@ -1,11 +0,0 @@ -#include -#include -#include -int main(){ - char str1[20]="114514"; - char *str2 ="1919810"; - //char str3[]= *str2; - printf("%s\n%s\n",&str1,str2); - //strcpy(str1,str3); - //printf("strcpy(str1,str3):%s\n",str3) -} From 5249ba88bd8143774710f6cb64a5f8b333e74831 Mon Sep 17 00:00:00 2001 From: Mayuri <63649939+opensourcefuture@users.noreply.github.com> Date: Sun, 3 Oct 2021 20:37:53 +0800 Subject: [PATCH 07/82] Update baka.c --- baka.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/baka.c b/baka.c index b7c30e5..0ba5904 100644 --- a/baka.c +++ b/baka.c @@ -4,11 +4,11 @@ int baka(); int main(){ //char str1[20]="114514"; - //char *str2 ="1919810"; + ////char *str2 ="1919810"; //char str3[]= *str2; //printf("%s\n%s\n",&str1,str2); - //strcpy(str1,str3); - //printf("strcpy(str1,str3):%s\n",str3) + ////strcpy(str1,str3); + ////printf("strcpy(str1,str3):%s\n",str3) baka(); } From 3de584bf8ede4d568770e59a17465fa25dbf5a26 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Fri, 15 Oct 2021 01:40:28 +0800 Subject: [PATCH 08/82] deleted: baka.c composition.c --- baka.c | 21 --------------------- 1 file changed, 21 deletions(-) delete mode 100644 baka.c diff --git a/baka.c b/baka.c deleted file mode 100644 index 0ba5904..0000000 --- a/baka.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include -#include -int baka(); -int main(){ - //char str1[20]="114514"; - ////char *str2 ="1919810"; - //char str3[]= *str2; - //printf("%s\n%s\n",&str1,str2); - ////strcpy(str1,str3); - ////printf("strcpy(str1,str3):%s\n",str3) - baka(); -} - -int baka(){ - char saying1[99]="Baka,my Baka,I do love u so much. "; - char saying2[]="Pls take me away"; - strcat(saying1,saying2); - printf("%s!\n",&saying1); - return 0; -} From 0554eaab7a8f681076a89e25d4f1cf9316fb9a96 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Fri, 15 Oct 2021 01:42:54 +0800 Subject: [PATCH 09/82] new file: composition.c --- composition.c | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 composition.c diff --git a/composition.c b/composition.c new file mode 100644 index 0000000..dcd1161 --- /dev/null +++ b/composition.c @@ -0,0 +1,36 @@ +#include +#include +#include +void write(); +int main(int argc,char *argv[]){ + //char str1[20]="114514"; + ////char *str2 ="1919810"; + //char str3[]= *str2; + //printf("%s\n%s\n",&str1,str2); + ////strcpy(str1,str3); + ////printf("strcpy(str1,str3):%s\n",str3) + // {'b','a','k','a','\0'}; + if ( argc == 1 ) + { + printf("please input name\n"); +// baka will be used as default"); + //char name[] = "baka"; + return 0; + } + /* else + { + char *name = argv[1]; + } + */ + char composition[99]; + //write(composition,name); + write(composition,argv[1]); + printf(composition); + return 0; +} + +void write(char saying1[],char name[]){ + sprintf(saying1,"%s,my %s,I do love u so much. ",name,name); + char saying2[]="Pls take me away"; + strcat(saying1,saying2); +} From 6917083a5e2c2d4846a7e0397fec16bb8a155fb8 Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Fri, 15 Oct 2021 19:19:55 +0800 Subject: [PATCH 10/82] =?UTF-8?q?=09=E6=96=B0=E6=96=87=E4=BB=B6=EF=BC=9A?= =?UTF-8?q?=20=20=201.c=20=09=E6=96=B0=E6=96=87=E4=BB=B6=EF=BC=9A=20=20=20?= =?UTF-8?q?2.c?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1.c | 21 +++++++++++++++++++++ 2.c | 20 ++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 1.c create mode 100644 2.c diff --git a/1.c b/1.c new file mode 100644 index 0000000..fff702c --- /dev/null +++ b/1.c @@ -0,0 +1,21 @@ +#include +#include +#include +int main(int argc,char *argv[]) +{ +// printf("%s\n",str(1)); + if (argc != 3) + { + printf("Plz input 2 str,and I will do a strcat\n"); + return 0; + } + printf("argv[1]=%s\nargv[2]=%s\n",argv[1],argv[2]); + printf("strcat(argv[1],argv[2])=%s\n\n",strcat(argv[1],argv[2])); + printf("strlen(argv[1])=%d\n",strlen(argv[1])); + printf("strlen(argv[2])=%d\n",strlen(argv[2])); + char str[strlen(argv[1])+1]; + printf("str[i]\ni=%d\n\n",sizeof(str)/sizeof(str[0])); + sprintf(str,"%s%s",argv[1],argv[2]); + printf("sprintf(str,\"%s%s\",argv[1],argv[2])\nstr=%s\n","%s","%s",str); + return 0; +} diff --git a/2.c b/2.c new file mode 100644 index 0000000..8cfda40 --- /dev/null +++ b/2.c @@ -0,0 +1,20 @@ +#include +#include +#include +int main() +{ + char a[4]="111",b[6]="222"; + char c[3] = {'3','3'}; + printf("a=%s\n",a); + printf("b=%s\n",b); + printf("c=%s\n",c); +// char c[] = strcat(a,b); + strcat(c,a); + c[4]='4'; + printf("strcat(a,b)=%s\n",strcat(a,b)); + printf("a'=%s\n",a); + printf("la=%lu\n",sizeof(a)/sizeof(a[0])); + printf("c'=%s\n",c); + return 0; +} + From 9dc1621bc8bf2ec5883de58970b4b35d84b63de5 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Fri, 15 Oct 2021 21:19:17 +0800 Subject: [PATCH 11/82] new file: .gitattributes new file: .gitignore --- .gitattributes | 1 + .gitignore | 3 +++ 2 files changed, 4 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..f0ef69f --- /dev/null +++ b/.gitattributes @@ -0,0 +1 @@ +*.pb linguist-language=cpp \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..ebb4657 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +desktop.ini +*.out +*.exe \ No newline at end of file From 02f39eaf71cabd4276c365f0ab7682762eaca0c1 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Sun, 17 Oct 2021 01:56:09 +0800 Subject: [PATCH 12/82] new file: helloworld/CMakeLists.txt new file: helloworld/cmkls.txt new file: helloworld/src/main.c --- helloworld/CMakeLists.txt | 8 +++++++ helloworld/cmkls.txt | 48 +++++++++++++++++++++++++++++++++++++++ helloworld/src/main.c | 5 ++++ 3 files changed, 61 insertions(+) create mode 100644 helloworld/CMakeLists.txt create mode 100644 helloworld/cmkls.txt create mode 100644 helloworld/src/main.c diff --git a/helloworld/CMakeLists.txt b/helloworld/CMakeLists.txt new file mode 100644 index 0000000..ed71760 --- /dev/null +++ b/helloworld/CMakeLists.txt @@ -0,0 +1,8 @@ +#cmake_minimum_required (VERSION 2.8) +project(helloworld) +#include_directories(include) +AUX_SOURCE_DIRECTORY(src DIR_SRCS) +set(SRCS ${DIR_SRCS}) +message(${DIR_SRCS}) +add_executable(helloworld ${SRCS}) + diff --git a/helloworld/cmkls.txt b/helloworld/cmkls.txt new file mode 100644 index 0000000..217bfaf --- /dev/null +++ b/helloworld/cmkls.txt @@ -0,0 +1,48 @@ +#cmake最小版本需求 +cmake_minimum_required(VERSION xxx) + +#设置此项目的名称 +project(xxx) + +#生成可执行文件target ,后面填写的是生成此可执行文件所依赖的源文件列表。 +add_executable(target target_source_codes) + +# 设置一个名字var_name 的变量,同时给此变量赋值为var_value +SET(var_name var_value) + +# 指定编译器 +# CMAKE_C_FLAGS_DEBUG ---- C 编译器 +# CMAKE_CXX_FLAGS_DEBUG ---- C++ 编译器 +# -std=c++11 使用 C++11 +# -g:只是编译器,在编译的时候,产生调试信息。 +# -Wall:生成所有警告信息。一下是具体的选项,可以单独使用 +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -g -wall ") + +#指定编译类型,debug 或者为 release +# debug 会生成相关调试信息,可以使用 GDB 进行 +# release 不会生成调试信息。当无法进行调试时查看此处是否设置为 debug. +set(CMAKE_BUILD_TYPE Debug) + +# 打印消息 +MESSAGE("MSG") + +#给变量var_name赋值为var_value,comment是此变量的注释,和SET 有类似的功效,用于给某变量设置默认值 +option(var_name "comment" var_value) + +# 添加include路径,也就是头文件路径 +include_directories(xxx) + +# 调用xxx子目录的CMakeLists.txt执行 +add_subdirectory(xxx) + +# 给编译器添加xxx参数 +add_compile_options(xxx) + +# 给编译器添加库目录, +link_directories(xxx) + +# 生成库文件,SHARED代表动态库,STATIC代表静态库, 最后一个参数代表此库的源文件列表 +add_library(lib_name SHARED or STATIC lib_source_code) + +# 给目标添加依赖库 +target_link_libraries(target_name lib_name ...) diff --git a/helloworld/src/main.c b/helloworld/src/main.c new file mode 100644 index 0000000..c238949 --- /dev/null +++ b/helloworld/src/main.c @@ -0,0 +1,5 @@ +#include +int main() +{ + printf("Hello World !\n"); +} From 0cbcf97aa3ddeda598e27448ad0168480aca5768 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Sun, 17 Oct 2021 08:35:54 +0800 Subject: [PATCH 13/82] modified: .gitignore modified: helloworld/CMakeLists.txt --- .gitignore | 6 +++++- helloworld/CMakeLists.txt | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index ebb4657..2c196bf 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ desktop.ini *.out -*.exe \ No newline at end of file +*.exe +CMakeCache.txt +CMakeFiles/ +Makefile +cmake_install.cmake diff --git a/helloworld/CMakeLists.txt b/helloworld/CMakeLists.txt index ed71760..c51b16b 100644 --- a/helloworld/CMakeLists.txt +++ b/helloworld/CMakeLists.txt @@ -3,6 +3,6 @@ project(helloworld) #include_directories(include) AUX_SOURCE_DIRECTORY(src DIR_SRCS) set(SRCS ${DIR_SRCS}) -message(${DIR_SRCS}) +#message(${DIR_SRCS}) add_executable(helloworld ${SRCS}) From 37a909b80ca86ccf47046281525f8523b7101962 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Sun, 17 Oct 2021 09:11:36 +0800 Subject: [PATCH 14/82] new file: ../CMakeLists.txt new file: ../include/a.h new file: ../src/a.c new file: ../src/main.c --- sqrt/CMakeLists.txt | 4 + sqrt/bin.dir/DependInfo.cmake | 20 ++++ sqrt/bin.dir/build.make | 129 ++++++++++++++++++++++++ sqrt/bin.dir/cmake_clean.cmake | 15 +++ sqrt/bin.dir/compiler_depend.make | 2 + sqrt/bin.dir/compiler_depend.ts | 2 + sqrt/bin.dir/depend.make | 2 + sqrt/bin.dir/flags.make | 10 ++ sqrt/bin.dir/includes_C.rsp | 1 + sqrt/bin.dir/link.txt | 3 + sqrt/bin.dir/linklibs.rsp | 1 + sqrt/bin.dir/objects.a | Bin 0 -> 2266 bytes sqrt/bin.dir/objects1.rsp | 1 + sqrt/bin.dir/progress.make | 4 + sqrt/bin.dir/src/a.obj | Bin 0 -> 784 bytes sqrt/bin.dir/src/a.obj.d | 10 ++ sqrt/bin.dir/src/main.obj | Bin 0 -> 1267 bytes sqrt/bin.dir/src/main.obj.d | 16 +++ sqrt/build/bin.dir/DependInfo.cmake | 20 ++++ sqrt/build/bin.dir/build.make | 129 ++++++++++++++++++++++++ sqrt/build/bin.dir/cmake_clean.cmake | 15 +++ sqrt/build/bin.dir/compiler_depend.make | 2 + sqrt/build/bin.dir/compiler_depend.ts | 2 + sqrt/build/bin.dir/depend.make | 2 + sqrt/build/bin.dir/flags.make | 10 ++ sqrt/build/bin.dir/includes_C.rsp | 1 + sqrt/build/bin.dir/link.txt | 3 + sqrt/build/bin.dir/linklibs.rsp | 1 + sqrt/build/bin.dir/objects.a | Bin 0 -> 2266 bytes sqrt/build/bin.dir/objects1.rsp | 1 + sqrt/build/bin.dir/progress.make | 4 + sqrt/build/bin.dir/src/a.obj | Bin 0 -> 784 bytes sqrt/build/bin.dir/src/a.obj.d | 10 ++ sqrt/build/bin.dir/src/main.obj | Bin 0 -> 1267 bytes sqrt/build/bin.dir/src/main.obj.d | 16 +++ sqrt/include/a.h | 7 ++ sqrt/src/a.c | 5 + sqrt/src/main.c | 11 ++ 38 files changed, 459 insertions(+) create mode 100644 sqrt/CMakeLists.txt create mode 100644 sqrt/bin.dir/DependInfo.cmake create mode 100644 sqrt/bin.dir/build.make create mode 100644 sqrt/bin.dir/cmake_clean.cmake create mode 100644 sqrt/bin.dir/compiler_depend.make create mode 100644 sqrt/bin.dir/compiler_depend.ts create mode 100644 sqrt/bin.dir/depend.make create mode 100644 sqrt/bin.dir/flags.make create mode 100644 sqrt/bin.dir/includes_C.rsp create mode 100644 sqrt/bin.dir/link.txt create mode 100644 sqrt/bin.dir/linklibs.rsp create mode 100644 sqrt/bin.dir/objects.a create mode 100644 sqrt/bin.dir/objects1.rsp create mode 100644 sqrt/bin.dir/progress.make create mode 100644 sqrt/bin.dir/src/a.obj create mode 100644 sqrt/bin.dir/src/a.obj.d create mode 100644 sqrt/bin.dir/src/main.obj create mode 100644 sqrt/bin.dir/src/main.obj.d create mode 100644 sqrt/build/bin.dir/DependInfo.cmake create mode 100644 sqrt/build/bin.dir/build.make create mode 100644 sqrt/build/bin.dir/cmake_clean.cmake create mode 100644 sqrt/build/bin.dir/compiler_depend.make create mode 100644 sqrt/build/bin.dir/compiler_depend.ts create mode 100644 sqrt/build/bin.dir/depend.make create mode 100644 sqrt/build/bin.dir/flags.make create mode 100644 sqrt/build/bin.dir/includes_C.rsp create mode 100644 sqrt/build/bin.dir/link.txt create mode 100644 sqrt/build/bin.dir/linklibs.rsp create mode 100644 sqrt/build/bin.dir/objects.a create mode 100644 sqrt/build/bin.dir/objects1.rsp create mode 100644 sqrt/build/bin.dir/progress.make create mode 100644 sqrt/build/bin.dir/src/a.obj create mode 100644 sqrt/build/bin.dir/src/a.obj.d create mode 100644 sqrt/build/bin.dir/src/main.obj create mode 100644 sqrt/build/bin.dir/src/main.obj.d create mode 100644 sqrt/include/a.h create mode 100644 sqrt/src/a.c create mode 100644 sqrt/src/main.c diff --git a/sqrt/CMakeLists.txt b/sqrt/CMakeLists.txt new file mode 100644 index 0000000..78db70f --- /dev/null +++ b/sqrt/CMakeLists.txt @@ -0,0 +1,4 @@ +PROJECT(test_math) +INCLUDE_DIRECTORIES(include) +AUX_SOURCE_DIRECTORY(src DIR_SRCS) +ADD_EXECUTABLE(../bin ${DIR_SRCS}) diff --git a/sqrt/bin.dir/DependInfo.cmake b/sqrt/bin.dir/DependInfo.cmake new file mode 100644 index 0000000..322272c --- /dev/null +++ b/sqrt/bin.dir/DependInfo.cmake @@ -0,0 +1,20 @@ + +# Consider dependencies only in project. +set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) + +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + ) + +# The set of dependency files which are needed: +set(CMAKE_DEPENDS_DEPENDENCY_FILES + "C:/Users/Administrator/PL/sqrt/src/a.c" "bin.dir/src/a.obj" "gcc" "bin.dir/src/a.obj.d" + "C:/Users/Administrator/PL/sqrt/src/main.c" "bin.dir/src/main.obj" "gcc" "bin.dir/src/main.obj.d" + ) + +# Targets to which this target links. +set(CMAKE_TARGET_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/sqrt/bin.dir/build.make b/sqrt/bin.dir/build.make new file mode 100644 index 0000000..fee2418 --- /dev/null +++ b/sqrt/bin.dir/build.make @@ -0,0 +1,129 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.21 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +SHELL = cmd.exe + +# The CMake executable. +CMAKE_COMMAND = "C:\Program Files\CMake\bin\cmake.exe" + +# The command to remove a file. +RM = "C:\Program Files\CMake\bin\cmake.exe" -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = C:\Users\Administrator\PL\sqrt + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = C:\Users\Administrator\PL\sqrt + +# Include any dependencies generated for this target. +include CMakeFiles/../bin.dir/depend.make +# Include any dependencies generated by the compiler for this target. +include CMakeFiles/../bin.dir/compiler_depend.make + +# Include the progress variables for this target. +include CMakeFiles/../bin.dir/progress.make + +# Include the compile flags for this target's objects. +include CMakeFiles/../bin.dir/flags.make + +CMakeFiles/../bin.dir/src/a.obj: CMakeFiles/../bin.dir/flags.make +CMakeFiles/../bin.dir/src/a.obj: CMakeFiles/../bin.dir/includes_C.rsp +CMakeFiles/../bin.dir/src/a.obj: src/a.c +CMakeFiles/../bin.dir/src/a.obj: CMakeFiles/../bin.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=C:\Users\Administrator\PL\sqrt\CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object CMakeFiles/../bin.dir/src/a.obj" + C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT CMakeFiles/../bin.dir/src/a.obj -MF CMakeFiles\..\bin.dir\src\a.obj.d -o CMakeFiles\..\bin.dir\src\a.obj -c C:\Users\Administrator\PL\sqrt\src\a.c + +CMakeFiles/../bin.dir/src/a.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/../bin.dir/src/a.i" + C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E C:\Users\Administrator\PL\sqrt\src\a.c > CMakeFiles\..\bin.dir\src\a.i + +CMakeFiles/../bin.dir/src/a.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/../bin.dir/src/a.s" + C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S C:\Users\Administrator\PL\sqrt\src\a.c -o CMakeFiles\..\bin.dir\src\a.s + +CMakeFiles/../bin.dir/src/main.obj: CMakeFiles/../bin.dir/flags.make +CMakeFiles/../bin.dir/src/main.obj: CMakeFiles/../bin.dir/includes_C.rsp +CMakeFiles/../bin.dir/src/main.obj: src/main.c +CMakeFiles/../bin.dir/src/main.obj: CMakeFiles/../bin.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=C:\Users\Administrator\PL\sqrt\CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building C object CMakeFiles/../bin.dir/src/main.obj" + C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT CMakeFiles/../bin.dir/src/main.obj -MF CMakeFiles\..\bin.dir\src\main.obj.d -o CMakeFiles\..\bin.dir\src\main.obj -c C:\Users\Administrator\PL\sqrt\src\main.c + +CMakeFiles/../bin.dir/src/main.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/../bin.dir/src/main.i" + C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E C:\Users\Administrator\PL\sqrt\src\main.c > CMakeFiles\..\bin.dir\src\main.i + +CMakeFiles/../bin.dir/src/main.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/../bin.dir/src/main.s" + C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S C:\Users\Administrator\PL\sqrt\src\main.c -o CMakeFiles\..\bin.dir\src\main.s + +# Object files for target ../bin +__/bin_OBJECTS = \ +"CMakeFiles/../bin.dir/src/a.obj" \ +"CMakeFiles/../bin.dir/src/main.obj" + +# External object files for target ../bin +__/bin_EXTERNAL_OBJECTS = + +../bin.exe: CMakeFiles/../bin.dir/src/a.obj +../bin.exe: CMakeFiles/../bin.dir/src/main.obj +../bin.exe: CMakeFiles/../bin.dir/build.make +../bin.exe: CMakeFiles/../bin.dir/linklibs.rsp +../bin.exe: CMakeFiles/../bin.dir/objects1.rsp +../bin.exe: CMakeFiles/../bin.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=C:\Users\Administrator\PL\sqrt\CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Linking C executable ..\bin.exe" + $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles\..\bin.dir\link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +CMakeFiles/../bin.dir/build: ../bin.exe +.PHONY : CMakeFiles/../bin.dir/build + +CMakeFiles/../bin.dir/clean: + $(CMAKE_COMMAND) -P CMakeFiles\..\bin.dir\cmake_clean.cmake +.PHONY : CMakeFiles/../bin.dir/clean + +CMakeFiles/../bin.dir/depend: + $(CMAKE_COMMAND) -E cmake_depends "MinGW Makefiles" C:\Users\Administrator\PL\sqrt C:\Users\Administrator\PL\sqrt C:\Users\Administrator\PL\sqrt C:\Users\Administrator\PL\sqrt C:\Users\Administrator\PL\sqrt\bin.dir\DependInfo.cmake --color=$(COLOR) +.PHONY : CMakeFiles/../bin.dir/depend + diff --git a/sqrt/bin.dir/cmake_clean.cmake b/sqrt/bin.dir/cmake_clean.cmake new file mode 100644 index 0000000..3d6bfe3 --- /dev/null +++ b/sqrt/bin.dir/cmake_clean.cmake @@ -0,0 +1,15 @@ +file(REMOVE_RECURSE + "../bin.exe" + "../bin.exe.manifest" + "../bin.pdb" + "CMakeFiles/../bin.dir/src/a.obj" + "CMakeFiles/../bin.dir/src/a.obj.d" + "CMakeFiles/../bin.dir/src/main.obj" + "CMakeFiles/../bin.dir/src/main.obj.d" + "lib../bin.dll.a" +) + +# Per-language clean rules from dependency scanning. +foreach(lang C) + include(CMakeFiles/../bin.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/sqrt/bin.dir/compiler_depend.make b/sqrt/bin.dir/compiler_depend.make new file mode 100644 index 0000000..9338eab --- /dev/null +++ b/sqrt/bin.dir/compiler_depend.make @@ -0,0 +1,2 @@ +# Empty compiler generated dependencies file for ../bin. +# This may be replaced when dependencies are built. diff --git a/sqrt/bin.dir/compiler_depend.ts b/sqrt/bin.dir/compiler_depend.ts new file mode 100644 index 0000000..e120a65 --- /dev/null +++ b/sqrt/bin.dir/compiler_depend.ts @@ -0,0 +1,2 @@ +# CMAKE generated file: DO NOT EDIT! +# Timestamp file for compiler generated dependencies management for ../bin. diff --git a/sqrt/bin.dir/depend.make b/sqrt/bin.dir/depend.make new file mode 100644 index 0000000..3f24db7 --- /dev/null +++ b/sqrt/bin.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for ../bin. +# This may be replaced when dependencies are built. diff --git a/sqrt/bin.dir/flags.make b/sqrt/bin.dir/flags.make new file mode 100644 index 0000000..3b217b6 --- /dev/null +++ b/sqrt/bin.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.21 + +# compile C with C:/ProgramData/chocolatey/bin/gcc.exe +C_DEFINES = + +C_INCLUDES = @CMakeFiles/../bin.dir/includes_C.rsp + +C_FLAGS = + diff --git a/sqrt/bin.dir/includes_C.rsp b/sqrt/bin.dir/includes_C.rsp new file mode 100644 index 0000000..a934c98 --- /dev/null +++ b/sqrt/bin.dir/includes_C.rsp @@ -0,0 +1 @@ +-IC:/Users/Administrator/PL/sqrt/include diff --git a/sqrt/bin.dir/link.txt b/sqrt/bin.dir/link.txt new file mode 100644 index 0000000..880af15 --- /dev/null +++ b/sqrt/bin.dir/link.txt @@ -0,0 +1,3 @@ +"C:\Program Files\CMake\bin\cmake.exe" -E rm -f CMakeFiles\..\bin.dir/objects.a +C:\ProgramData\chocolatey\bin\ar.exe qc CMakeFiles\..\bin.dir/objects.a @CMakeFiles\..\bin.dir\objects1.rsp +C:\ProgramData\chocolatey\bin\gcc.exe -Wl,--whole-archive CMakeFiles\..\bin.dir/objects.a -Wl,--no-whole-archive -o ..\bin.exe -Wl,--out-implib,lib..\bin.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles\..\bin.dir\linklibs.rsp diff --git a/sqrt/bin.dir/linklibs.rsp b/sqrt/bin.dir/linklibs.rsp new file mode 100644 index 0000000..8ed353a --- /dev/null +++ b/sqrt/bin.dir/linklibs.rsp @@ -0,0 +1 @@ + -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 diff --git a/sqrt/bin.dir/objects.a b/sqrt/bin.dir/objects.a new file mode 100644 index 0000000000000000000000000000000000000000..e3e48b344e3cc42aa10e1b85785086c47c25ae3b GIT binary patch literal 2266 zcmcgt&ubGw6rRndwWLBK)*pBpp<;w~yGhq=6p`2xyM+d#B@~pp-K0solBO})YV4s1 z1z`z={sBFE@Zec*(YD~R-ue#+9t2BIJrv`6v%AS|v%QG;U}xUE_wAe6nfboGeow3B zm+pr~sMlihs3eWXB~hYOWGQz`X8nWYDDOQkl%&}4LeFQ^TL8= zXe@GelO&m@kgL_sMp&6Qh^u=Go`;lV&*{9MBw|vibmNkMduL;L03&Wha^AA~40O|7 z^)ktDzKih(I0JdE;65Vq9mgdmzO#3|917*dF3d=DBfi z5=M+E?I?UZxdtPlinnNRZEel%BB9)LYIAASpG&d0Jl5gTIX24xEb$8Sy1BFu@gdl= zZQMLCT=W0n(p8w}&=1)dCk9;i=bR5NI|GbMD4V50 zQ8Ck0F|*NWGbK)&X$YpGikUi88gqxAaLGyoPoK2*r_2MTkp=K)Mo=?#(ny^EITKIk zc5D)hECVF&!7o8Z9~Z;Fn&?157$BcJ^u~DroIZxS$4Gqy9TvmUZ&T(zbYB(oi?Ye4 z$5|h?TCI<`7MN6YDZi{mraez;V})0xzLo z<-b!ayj@=FRx8AuT91oGnBh4JZMQj!hI-dT^iW}!dZLPHn; literal 0 HcmV?d00001 diff --git a/sqrt/bin.dir/objects1.rsp b/sqrt/bin.dir/objects1.rsp new file mode 100644 index 0000000..b4b3f2b --- /dev/null +++ b/sqrt/bin.dir/objects1.rsp @@ -0,0 +1 @@ +CMakeFiles/../bin.dir/src/a.obj CMakeFiles/../bin.dir/src/main.obj diff --git a/sqrt/bin.dir/progress.make b/sqrt/bin.dir/progress.make new file mode 100644 index 0000000..6a9dc74 --- /dev/null +++ b/sqrt/bin.dir/progress.make @@ -0,0 +1,4 @@ +CMAKE_PROGRESS_1 = 1 +CMAKE_PROGRESS_2 = 2 +CMAKE_PROGRESS_3 = 3 + diff --git a/sqrt/bin.dir/src/a.obj b/sqrt/bin.dir/src/a.obj new file mode 100644 index 0000000000000000000000000000000000000000..e3406ef922f0c4e8e62552303fd97d93b6be5995 GIT binary patch literal 784 zcmZ`%%}T>S5Z-lDDIz4ro2NYpD%iCxp@^r@QksK8K%^(BX`8lzQfm?+_8>w*@a6+} z_BjgnRRj;7`T*+8CV`}-AME_>d^^kRx4oBbf>=;O3NliN2%IpGab!y16sW($LZIWs zx)nV;u;tEXV-RaDI=;V|5mla%7iJsoLP?MBOwJpmWQfT+&j8*>%w<4E-l?9Pio6Bx zVy&NLT$`_7=Inc4_q*y28lYzxUwYc1!YsCE`Hpi~&gGmU4d>OTUlO6oYu*1fZ%$yu$P9dIk zR5|P9z^TTWqYhZNIQWc5X5A1b8}~PyW7aJI`O9x~IO?dYj@ZGs%=6+=fjPe*rOYEI z(ZvwH@k#WmI@F_odk7#QELha+aSovU9@YVJZU}jY061x&N8>*?oIaQz%=yX=d3mh* zcsw3|!qQMwE*`x<6Co139}ySI0a?fkVKEeb8WaV5d5|Zr;r2V=EAW)4VbMDcJweMJ zy6mygJW$rx)*jM$&M?=vl3VE%ZD-P2I+bkhT1Go*)wW^Zp3$&r`3+rd)hgRI-7J~a zTFbgiS5~BZlI+Wda2cL!@C1nh`Z`C?K*u;LgN|~v5Bdg2A5VP%2)00k-4hfB6yZL6 z8#lUmiZH7im2{&~gB8lZF(Gwfr(~E?#r3$l*)mL9cd-D|AkN%VjNmS`*h}ODrX~wF zhywN&=jlxRQ-zmsUS|J9!Qjs4_@)VaAPRW9ro}%=ydRu1a~|ImVMG+@bP{ic-vR~y zC!(;*@vOS-a|DQ{O*({b><`M>EkIAbW^2~VmiIeC&m-VS{7g%oPR9>5&Dd#bnpUc` XY|Yp$YxIp(XzIe0 literal 0 HcmV?d00001 diff --git a/sqrt/bin.dir/src/main.obj.d b/sqrt/bin.dir/src/main.obj.d new file mode 100644 index 0000000..e4e3a3e --- /dev/null +++ b/sqrt/bin.dir/src/main.obj.d @@ -0,0 +1,16 @@ +CMakeFiles/../bin.dir/src/main.obj: \ + C:\Users\Administrator\PL\sqrt\src\main.c \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\stdio.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\corecrt_stdio_config.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\corecrt.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\_mingw.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\_mingw_mac.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\_mingw_secapi.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\vadefs.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\sdks/_mingw_ddk.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\_mingw_off_t.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\swprintf.inl \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\sec_api\stdio_s.h \ + c:\users\administrator\pl\sqrt\include\a.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\math.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\crtdefs.h diff --git a/sqrt/build/bin.dir/DependInfo.cmake b/sqrt/build/bin.dir/DependInfo.cmake new file mode 100644 index 0000000..322272c --- /dev/null +++ b/sqrt/build/bin.dir/DependInfo.cmake @@ -0,0 +1,20 @@ + +# Consider dependencies only in project. +set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) + +# The set of languages for which implicit dependencies are needed: +set(CMAKE_DEPENDS_LANGUAGES + ) + +# The set of dependency files which are needed: +set(CMAKE_DEPENDS_DEPENDENCY_FILES + "C:/Users/Administrator/PL/sqrt/src/a.c" "bin.dir/src/a.obj" "gcc" "bin.dir/src/a.obj.d" + "C:/Users/Administrator/PL/sqrt/src/main.c" "bin.dir/src/main.obj" "gcc" "bin.dir/src/main.obj.d" + ) + +# Targets to which this target links. +set(CMAKE_TARGET_LINKED_INFO_FILES + ) + +# Fortran module output directory. +set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/sqrt/build/bin.dir/build.make b/sqrt/build/bin.dir/build.make new file mode 100644 index 0000000..fdaaac1 --- /dev/null +++ b/sqrt/build/bin.dir/build.make @@ -0,0 +1,129 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.21 + +# Delete rule output on recipe failure. +.DELETE_ON_ERROR: + +#============================================================================= +# Special targets provided by cmake. + +# Disable implicit rules so canonical targets will work. +.SUFFIXES: + +# Disable VCS-based implicit rules. +% : %,v + +# Disable VCS-based implicit rules. +% : RCS/% + +# Disable VCS-based implicit rules. +% : RCS/%,v + +# Disable VCS-based implicit rules. +% : SCCS/s.% + +# Disable VCS-based implicit rules. +% : s.% + +.SUFFIXES: .hpux_make_needs_suffix_list + +# Command-line flag to silence nested $(MAKE). +$(VERBOSE)MAKESILENT = -s + +#Suppress display of executed commands. +$(VERBOSE).SILENT: + +# A target that is always out of date. +cmake_force: +.PHONY : cmake_force + +#============================================================================= +# Set environment variables for the build. + +SHELL = cmd.exe + +# The CMake executable. +CMAKE_COMMAND = "C:\Program Files\CMake\bin\cmake.exe" + +# The command to remove a file. +RM = "C:\Program Files\CMake\bin\cmake.exe" -E rm -f + +# Escaping for special characters. +EQUALS = = + +# The top-level source directory on which CMake was run. +CMAKE_SOURCE_DIR = C:\Users\Administrator\PL\sqrt + +# The top-level build directory on which CMake was run. +CMAKE_BINARY_DIR = C:\Users\Administrator\PL\sqrt\build + +# Include any dependencies generated for this target. +include CMakeFiles/../bin.dir/depend.make +# Include any dependencies generated by the compiler for this target. +include CMakeFiles/../bin.dir/compiler_depend.make + +# Include the progress variables for this target. +include CMakeFiles/../bin.dir/progress.make + +# Include the compile flags for this target's objects. +include CMakeFiles/../bin.dir/flags.make + +CMakeFiles/../bin.dir/src/a.obj: CMakeFiles/../bin.dir/flags.make +CMakeFiles/../bin.dir/src/a.obj: CMakeFiles/../bin.dir/includes_C.rsp +CMakeFiles/../bin.dir/src/a.obj: ../src/a.c +CMakeFiles/../bin.dir/src/a.obj: CMakeFiles/../bin.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=C:\Users\Administrator\PL\sqrt\build\CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object CMakeFiles/../bin.dir/src/a.obj" + C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT CMakeFiles/../bin.dir/src/a.obj -MF CMakeFiles\..\bin.dir\src\a.obj.d -o CMakeFiles\..\bin.dir\src\a.obj -c C:\Users\Administrator\PL\sqrt\src\a.c + +CMakeFiles/../bin.dir/src/a.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/../bin.dir/src/a.i" + C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E C:\Users\Administrator\PL\sqrt\src\a.c > CMakeFiles\..\bin.dir\src\a.i + +CMakeFiles/../bin.dir/src/a.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/../bin.dir/src/a.s" + C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S C:\Users\Administrator\PL\sqrt\src\a.c -o CMakeFiles\..\bin.dir\src\a.s + +CMakeFiles/../bin.dir/src/main.obj: CMakeFiles/../bin.dir/flags.make +CMakeFiles/../bin.dir/src/main.obj: CMakeFiles/../bin.dir/includes_C.rsp +CMakeFiles/../bin.dir/src/main.obj: ../src/main.c +CMakeFiles/../bin.dir/src/main.obj: CMakeFiles/../bin.dir/compiler_depend.ts + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=C:\Users\Administrator\PL\sqrt\build\CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building C object CMakeFiles/../bin.dir/src/main.obj" + C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT CMakeFiles/../bin.dir/src/main.obj -MF CMakeFiles\..\bin.dir\src\main.obj.d -o CMakeFiles\..\bin.dir\src\main.obj -c C:\Users\Administrator\PL\sqrt\src\main.c + +CMakeFiles/../bin.dir/src/main.i: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/../bin.dir/src/main.i" + C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E C:\Users\Administrator\PL\sqrt\src\main.c > CMakeFiles\..\bin.dir\src\main.i + +CMakeFiles/../bin.dir/src/main.s: cmake_force + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/../bin.dir/src/main.s" + C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S C:\Users\Administrator\PL\sqrt\src\main.c -o CMakeFiles\..\bin.dir\src\main.s + +# Object files for target ../bin +__/bin_OBJECTS = \ +"CMakeFiles/../bin.dir/src/a.obj" \ +"CMakeFiles/../bin.dir/src/main.obj" + +# External object files for target ../bin +__/bin_EXTERNAL_OBJECTS = + +../bin.exe: CMakeFiles/../bin.dir/src/a.obj +../bin.exe: CMakeFiles/../bin.dir/src/main.obj +../bin.exe: CMakeFiles/../bin.dir/build.make +../bin.exe: CMakeFiles/../bin.dir/linklibs.rsp +../bin.exe: CMakeFiles/../bin.dir/objects1.rsp +../bin.exe: CMakeFiles/../bin.dir/link.txt + @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=C:\Users\Administrator\PL\sqrt\build\CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Linking C executable ..\bin.exe" + $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles\..\bin.dir\link.txt --verbose=$(VERBOSE) + +# Rule to build all files generated by this target. +CMakeFiles/../bin.dir/build: ../bin.exe +.PHONY : CMakeFiles/../bin.dir/build + +CMakeFiles/../bin.dir/clean: + $(CMAKE_COMMAND) -P CMakeFiles\..\bin.dir\cmake_clean.cmake +.PHONY : CMakeFiles/../bin.dir/clean + +CMakeFiles/../bin.dir/depend: + $(CMAKE_COMMAND) -E cmake_depends "MinGW Makefiles" C:\Users\Administrator\PL\sqrt C:\Users\Administrator\PL\sqrt C:\Users\Administrator\PL\sqrt\build C:\Users\Administrator\PL\sqrt\build C:\Users\Administrator\PL\sqrt\build\bin.dir\DependInfo.cmake --color=$(COLOR) +.PHONY : CMakeFiles/../bin.dir/depend + diff --git a/sqrt/build/bin.dir/cmake_clean.cmake b/sqrt/build/bin.dir/cmake_clean.cmake new file mode 100644 index 0000000..3d6bfe3 --- /dev/null +++ b/sqrt/build/bin.dir/cmake_clean.cmake @@ -0,0 +1,15 @@ +file(REMOVE_RECURSE + "../bin.exe" + "../bin.exe.manifest" + "../bin.pdb" + "CMakeFiles/../bin.dir/src/a.obj" + "CMakeFiles/../bin.dir/src/a.obj.d" + "CMakeFiles/../bin.dir/src/main.obj" + "CMakeFiles/../bin.dir/src/main.obj.d" + "lib../bin.dll.a" +) + +# Per-language clean rules from dependency scanning. +foreach(lang C) + include(CMakeFiles/../bin.dir/cmake_clean_${lang}.cmake OPTIONAL) +endforeach() diff --git a/sqrt/build/bin.dir/compiler_depend.make b/sqrt/build/bin.dir/compiler_depend.make new file mode 100644 index 0000000..9338eab --- /dev/null +++ b/sqrt/build/bin.dir/compiler_depend.make @@ -0,0 +1,2 @@ +# Empty compiler generated dependencies file for ../bin. +# This may be replaced when dependencies are built. diff --git a/sqrt/build/bin.dir/compiler_depend.ts b/sqrt/build/bin.dir/compiler_depend.ts new file mode 100644 index 0000000..e120a65 --- /dev/null +++ b/sqrt/build/bin.dir/compiler_depend.ts @@ -0,0 +1,2 @@ +# CMAKE generated file: DO NOT EDIT! +# Timestamp file for compiler generated dependencies management for ../bin. diff --git a/sqrt/build/bin.dir/depend.make b/sqrt/build/bin.dir/depend.make new file mode 100644 index 0000000..3f24db7 --- /dev/null +++ b/sqrt/build/bin.dir/depend.make @@ -0,0 +1,2 @@ +# Empty dependencies file for ../bin. +# This may be replaced when dependencies are built. diff --git a/sqrt/build/bin.dir/flags.make b/sqrt/build/bin.dir/flags.make new file mode 100644 index 0000000..3b217b6 --- /dev/null +++ b/sqrt/build/bin.dir/flags.make @@ -0,0 +1,10 @@ +# CMAKE generated file: DO NOT EDIT! +# Generated by "MinGW Makefiles" Generator, CMake Version 3.21 + +# compile C with C:/ProgramData/chocolatey/bin/gcc.exe +C_DEFINES = + +C_INCLUDES = @CMakeFiles/../bin.dir/includes_C.rsp + +C_FLAGS = + diff --git a/sqrt/build/bin.dir/includes_C.rsp b/sqrt/build/bin.dir/includes_C.rsp new file mode 100644 index 0000000..a934c98 --- /dev/null +++ b/sqrt/build/bin.dir/includes_C.rsp @@ -0,0 +1 @@ +-IC:/Users/Administrator/PL/sqrt/include diff --git a/sqrt/build/bin.dir/link.txt b/sqrt/build/bin.dir/link.txt new file mode 100644 index 0000000..880af15 --- /dev/null +++ b/sqrt/build/bin.dir/link.txt @@ -0,0 +1,3 @@ +"C:\Program Files\CMake\bin\cmake.exe" -E rm -f CMakeFiles\..\bin.dir/objects.a +C:\ProgramData\chocolatey\bin\ar.exe qc CMakeFiles\..\bin.dir/objects.a @CMakeFiles\..\bin.dir\objects1.rsp +C:\ProgramData\chocolatey\bin\gcc.exe -Wl,--whole-archive CMakeFiles\..\bin.dir/objects.a -Wl,--no-whole-archive -o ..\bin.exe -Wl,--out-implib,lib..\bin.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles\..\bin.dir\linklibs.rsp diff --git a/sqrt/build/bin.dir/linklibs.rsp b/sqrt/build/bin.dir/linklibs.rsp new file mode 100644 index 0000000..8ed353a --- /dev/null +++ b/sqrt/build/bin.dir/linklibs.rsp @@ -0,0 +1 @@ + -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 diff --git a/sqrt/build/bin.dir/objects.a b/sqrt/build/bin.dir/objects.a new file mode 100644 index 0000000000000000000000000000000000000000..d0d990e4468609b0b201348e9f67cd7081d8b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YVJZU}jY061x&N8>*?oIaQz%=yX=d3mh* zcsw3|!qQMwE*`x<6Co139}ySI0a?fkVKEeb8WaV5d5|Zr;r2V=EAW)4VbMDcJweMJ zy6mygJW$rx)*jM$&M?=vl3VE%ZD-P2I+bkhT1Go*)wW^Zp3$&r`3+rd)hgRI-7J~a zTFbgiS5~BZlI+Wda2cL!@C1nh`Z`C?K*u;LgN|~v5Bdg2A5VP%2)00k-4hfB6yZL6 z8#lUmiZH7im2{&~gB8lZF(Gwfr(~E?#r3$l*)mL9cd-D|AkN%VjNmS`*h}ODrX~wF zhywN&=jlxRQ-zmsUS|J9!Qjs4_@)VaAPRW9ro}%=ydRu1a~|ImVMG+@bP{ic-vR~y zC!(;*@vOS-a|DQ{O*({b><`M>EkIAbW^2~VmiIeC&m-VS{7g%oPR9>5&Dd#bnpUc` XY|Yp$YxIp(XzIe0 literal 0 HcmV?d00001 diff --git a/sqrt/build/bin.dir/src/main.obj.d b/sqrt/build/bin.dir/src/main.obj.d new file mode 100644 index 0000000..e4e3a3e --- /dev/null +++ b/sqrt/build/bin.dir/src/main.obj.d @@ -0,0 +1,16 @@ +CMakeFiles/../bin.dir/src/main.obj: \ + C:\Users\Administrator\PL\sqrt\src\main.c \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\stdio.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\corecrt_stdio_config.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\corecrt.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\_mingw.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\_mingw_mac.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\_mingw_secapi.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\vadefs.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\sdks/_mingw_ddk.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\_mingw_off_t.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\swprintf.inl \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\sec_api\stdio_s.h \ + c:\users\administrator\pl\sqrt\include\a.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\math.h \ + c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\crtdefs.h diff --git a/sqrt/include/a.h b/sqrt/include/a.h new file mode 100644 index 0000000..430d490 --- /dev/null +++ b/sqrt/include/a.h @@ -0,0 +1,7 @@ +#ifndef A_FILE_HEADER_INC +#define A_FILE_HEADER_INC +#include + +double get_sqrt(double var1); + +#endif diff --git a/sqrt/src/a.c b/sqrt/src/a.c new file mode 100644 index 0000000..6452aaa --- /dev/null +++ b/sqrt/src/a.c @@ -0,0 +1,5 @@ +#include"../include/a.h" +double get_sqrt(double var1) +{ + return sqrt(var1); +} diff --git a/sqrt/src/main.c b/sqrt/src/main.c new file mode 100644 index 0000000..c63b705 --- /dev/null +++ b/sqrt/src/main.c @@ -0,0 +1,11 @@ +#include +#include"../include/a.h" +int main() +{ + double b=25.0; + double a=0.0; + a=get_sqrt(b); + + printf("a is %lf, b is %lf\n",a,b); + return 0; +} From 9069c327167b829cc6bb56cda4e72169d96988c9 Mon Sep 17 00:00:00 2001 From: Mayuri <63649939+opensourcefuture@users.noreply.github.com> Date: Sun, 17 Oct 2021 09:13:28 +0800 Subject: [PATCH 15/82] Delete sqrt/bin.dir directory --- sqrt/bin.dir/DependInfo.cmake | 20 ----- sqrt/bin.dir/build.make | 129 ------------------------------ sqrt/bin.dir/cmake_clean.cmake | 15 ---- sqrt/bin.dir/compiler_depend.make | 2 - sqrt/bin.dir/compiler_depend.ts | 2 - sqrt/bin.dir/depend.make | 2 - sqrt/bin.dir/flags.make | 10 --- sqrt/bin.dir/includes_C.rsp | 1 - sqrt/bin.dir/link.txt | 3 - sqrt/bin.dir/linklibs.rsp | 1 - sqrt/bin.dir/objects.a | Bin 2266 -> 0 bytes sqrt/bin.dir/objects1.rsp | 1 - sqrt/bin.dir/progress.make | 4 - sqrt/bin.dir/src/a.obj | Bin 784 -> 0 bytes sqrt/bin.dir/src/a.obj.d | 10 --- sqrt/bin.dir/src/main.obj | Bin 1267 -> 0 bytes sqrt/bin.dir/src/main.obj.d | 16 ---- 17 files changed, 216 deletions(-) delete mode 100644 sqrt/bin.dir/DependInfo.cmake delete mode 100644 sqrt/bin.dir/build.make delete mode 100644 sqrt/bin.dir/cmake_clean.cmake delete mode 100644 sqrt/bin.dir/compiler_depend.make delete mode 100644 sqrt/bin.dir/compiler_depend.ts delete mode 100644 sqrt/bin.dir/depend.make delete mode 100644 sqrt/bin.dir/flags.make delete mode 100644 sqrt/bin.dir/includes_C.rsp delete mode 100644 sqrt/bin.dir/link.txt delete mode 100644 sqrt/bin.dir/linklibs.rsp delete mode 100644 sqrt/bin.dir/objects.a delete mode 100644 sqrt/bin.dir/objects1.rsp delete mode 100644 sqrt/bin.dir/progress.make delete mode 100644 sqrt/bin.dir/src/a.obj delete mode 100644 sqrt/bin.dir/src/a.obj.d delete mode 100644 sqrt/bin.dir/src/main.obj delete mode 100644 sqrt/bin.dir/src/main.obj.d diff --git a/sqrt/bin.dir/DependInfo.cmake b/sqrt/bin.dir/DependInfo.cmake deleted file mode 100644 index 322272c..0000000 --- a/sqrt/bin.dir/DependInfo.cmake +++ /dev/null @@ -1,20 +0,0 @@ - -# Consider dependencies only in project. -set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) - -# The set of languages for which implicit dependencies are needed: -set(CMAKE_DEPENDS_LANGUAGES - ) - -# The set of dependency files which are needed: -set(CMAKE_DEPENDS_DEPENDENCY_FILES - "C:/Users/Administrator/PL/sqrt/src/a.c" "bin.dir/src/a.obj" "gcc" "bin.dir/src/a.obj.d" - "C:/Users/Administrator/PL/sqrt/src/main.c" "bin.dir/src/main.obj" "gcc" "bin.dir/src/main.obj.d" - ) - -# Targets to which this target links. -set(CMAKE_TARGET_LINKED_INFO_FILES - ) - -# Fortran module output directory. -set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/sqrt/bin.dir/build.make b/sqrt/bin.dir/build.make deleted file mode 100644 index fee2418..0000000 --- a/sqrt/bin.dir/build.make +++ /dev/null @@ -1,129 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "MinGW Makefiles" Generator, CMake Version 3.21 - -# Delete rule output on recipe failure. -.DELETE_ON_ERROR: - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - -# Disable VCS-based implicit rules. -% : %,v - -# Disable VCS-based implicit rules. -% : RCS/% - -# Disable VCS-based implicit rules. -% : RCS/%,v - -# Disable VCS-based implicit rules. -% : SCCS/s.% - -# Disable VCS-based implicit rules. -% : s.% - -.SUFFIXES: .hpux_make_needs_suffix_list - -# Command-line flag to silence nested $(MAKE). -$(VERBOSE)MAKESILENT = -s - -#Suppress display of executed commands. -$(VERBOSE).SILENT: - -# A target that is always out of date. -cmake_force: -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -SHELL = cmd.exe - -# The CMake executable. -CMAKE_COMMAND = "C:\Program Files\CMake\bin\cmake.exe" - -# The command to remove a file. -RM = "C:\Program Files\CMake\bin\cmake.exe" -E rm -f - -# Escaping for special characters. -EQUALS = = - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = C:\Users\Administrator\PL\sqrt - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = C:\Users\Administrator\PL\sqrt - -# Include any dependencies generated for this target. -include CMakeFiles/../bin.dir/depend.make -# Include any dependencies generated by the compiler for this target. -include CMakeFiles/../bin.dir/compiler_depend.make - -# Include the progress variables for this target. -include CMakeFiles/../bin.dir/progress.make - -# Include the compile flags for this target's objects. -include CMakeFiles/../bin.dir/flags.make - -CMakeFiles/../bin.dir/src/a.obj: CMakeFiles/../bin.dir/flags.make -CMakeFiles/../bin.dir/src/a.obj: CMakeFiles/../bin.dir/includes_C.rsp -CMakeFiles/../bin.dir/src/a.obj: src/a.c -CMakeFiles/../bin.dir/src/a.obj: CMakeFiles/../bin.dir/compiler_depend.ts - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=C:\Users\Administrator\PL\sqrt\CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object CMakeFiles/../bin.dir/src/a.obj" - C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT CMakeFiles/../bin.dir/src/a.obj -MF CMakeFiles\..\bin.dir\src\a.obj.d -o CMakeFiles\..\bin.dir\src\a.obj -c C:\Users\Administrator\PL\sqrt\src\a.c - -CMakeFiles/../bin.dir/src/a.i: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/../bin.dir/src/a.i" - C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E C:\Users\Administrator\PL\sqrt\src\a.c > CMakeFiles\..\bin.dir\src\a.i - -CMakeFiles/../bin.dir/src/a.s: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/../bin.dir/src/a.s" - C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S C:\Users\Administrator\PL\sqrt\src\a.c -o CMakeFiles\..\bin.dir\src\a.s - -CMakeFiles/../bin.dir/src/main.obj: CMakeFiles/../bin.dir/flags.make -CMakeFiles/../bin.dir/src/main.obj: CMakeFiles/../bin.dir/includes_C.rsp -CMakeFiles/../bin.dir/src/main.obj: src/main.c -CMakeFiles/../bin.dir/src/main.obj: CMakeFiles/../bin.dir/compiler_depend.ts - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=C:\Users\Administrator\PL\sqrt\CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building C object CMakeFiles/../bin.dir/src/main.obj" - C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT CMakeFiles/../bin.dir/src/main.obj -MF CMakeFiles\..\bin.dir\src\main.obj.d -o CMakeFiles\..\bin.dir\src\main.obj -c C:\Users\Administrator\PL\sqrt\src\main.c - -CMakeFiles/../bin.dir/src/main.i: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/../bin.dir/src/main.i" - C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E C:\Users\Administrator\PL\sqrt\src\main.c > CMakeFiles\..\bin.dir\src\main.i - -CMakeFiles/../bin.dir/src/main.s: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/../bin.dir/src/main.s" - C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S C:\Users\Administrator\PL\sqrt\src\main.c -o CMakeFiles\..\bin.dir\src\main.s - -# Object files for target ../bin -__/bin_OBJECTS = \ -"CMakeFiles/../bin.dir/src/a.obj" \ -"CMakeFiles/../bin.dir/src/main.obj" - -# External object files for target ../bin -__/bin_EXTERNAL_OBJECTS = - -../bin.exe: CMakeFiles/../bin.dir/src/a.obj -../bin.exe: CMakeFiles/../bin.dir/src/main.obj -../bin.exe: CMakeFiles/../bin.dir/build.make -../bin.exe: CMakeFiles/../bin.dir/linklibs.rsp -../bin.exe: CMakeFiles/../bin.dir/objects1.rsp -../bin.exe: CMakeFiles/../bin.dir/link.txt - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=C:\Users\Administrator\PL\sqrt\CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Linking C executable ..\bin.exe" - $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles\..\bin.dir\link.txt --verbose=$(VERBOSE) - -# Rule to build all files generated by this target. -CMakeFiles/../bin.dir/build: ../bin.exe -.PHONY : CMakeFiles/../bin.dir/build - -CMakeFiles/../bin.dir/clean: - $(CMAKE_COMMAND) -P CMakeFiles\..\bin.dir\cmake_clean.cmake -.PHONY : CMakeFiles/../bin.dir/clean - -CMakeFiles/../bin.dir/depend: - $(CMAKE_COMMAND) -E cmake_depends "MinGW Makefiles" C:\Users\Administrator\PL\sqrt C:\Users\Administrator\PL\sqrt C:\Users\Administrator\PL\sqrt C:\Users\Administrator\PL\sqrt C:\Users\Administrator\PL\sqrt\bin.dir\DependInfo.cmake --color=$(COLOR) -.PHONY : CMakeFiles/../bin.dir/depend - diff --git a/sqrt/bin.dir/cmake_clean.cmake b/sqrt/bin.dir/cmake_clean.cmake deleted file mode 100644 index 3d6bfe3..0000000 --- a/sqrt/bin.dir/cmake_clean.cmake +++ /dev/null @@ -1,15 +0,0 @@ -file(REMOVE_RECURSE - "../bin.exe" - "../bin.exe.manifest" - "../bin.pdb" - "CMakeFiles/../bin.dir/src/a.obj" - "CMakeFiles/../bin.dir/src/a.obj.d" - "CMakeFiles/../bin.dir/src/main.obj" - "CMakeFiles/../bin.dir/src/main.obj.d" - "lib../bin.dll.a" -) - -# Per-language clean rules from dependency scanning. -foreach(lang C) - include(CMakeFiles/../bin.dir/cmake_clean_${lang}.cmake OPTIONAL) -endforeach() diff --git a/sqrt/bin.dir/compiler_depend.make b/sqrt/bin.dir/compiler_depend.make deleted file mode 100644 index 9338eab..0000000 --- a/sqrt/bin.dir/compiler_depend.make +++ /dev/null @@ -1,2 +0,0 @@ -# Empty compiler generated dependencies file for ../bin. -# This may be replaced when dependencies are built. diff --git a/sqrt/bin.dir/compiler_depend.ts b/sqrt/bin.dir/compiler_depend.ts deleted file mode 100644 index e120a65..0000000 --- a/sqrt/bin.dir/compiler_depend.ts +++ /dev/null @@ -1,2 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Timestamp file for compiler generated dependencies management for ../bin. diff --git a/sqrt/bin.dir/depend.make b/sqrt/bin.dir/depend.make deleted file mode 100644 index 3f24db7..0000000 --- a/sqrt/bin.dir/depend.make +++ /dev/null @@ -1,2 +0,0 @@ -# Empty dependencies file for ../bin. -# This may be replaced when dependencies are built. diff --git a/sqrt/bin.dir/flags.make b/sqrt/bin.dir/flags.make deleted file mode 100644 index 3b217b6..0000000 --- a/sqrt/bin.dir/flags.make +++ /dev/null @@ -1,10 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "MinGW Makefiles" Generator, CMake Version 3.21 - -# compile C with C:/ProgramData/chocolatey/bin/gcc.exe -C_DEFINES = - -C_INCLUDES = @CMakeFiles/../bin.dir/includes_C.rsp - -C_FLAGS = - diff --git a/sqrt/bin.dir/includes_C.rsp b/sqrt/bin.dir/includes_C.rsp deleted file mode 100644 index a934c98..0000000 --- a/sqrt/bin.dir/includes_C.rsp +++ /dev/null @@ -1 +0,0 @@ --IC:/Users/Administrator/PL/sqrt/include diff --git a/sqrt/bin.dir/link.txt b/sqrt/bin.dir/link.txt deleted file mode 100644 index 880af15..0000000 --- a/sqrt/bin.dir/link.txt +++ /dev/null @@ -1,3 +0,0 @@ -"C:\Program Files\CMake\bin\cmake.exe" -E rm -f CMakeFiles\..\bin.dir/objects.a -C:\ProgramData\chocolatey\bin\ar.exe qc CMakeFiles\..\bin.dir/objects.a @CMakeFiles\..\bin.dir\objects1.rsp -C:\ProgramData\chocolatey\bin\gcc.exe -Wl,--whole-archive CMakeFiles\..\bin.dir/objects.a -Wl,--no-whole-archive -o ..\bin.exe -Wl,--out-implib,lib..\bin.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles\..\bin.dir\linklibs.rsp diff --git a/sqrt/bin.dir/linklibs.rsp b/sqrt/bin.dir/linklibs.rsp deleted file mode 100644 index 8ed353a..0000000 --- a/sqrt/bin.dir/linklibs.rsp +++ /dev/null @@ -1 +0,0 @@ - -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 diff --git a/sqrt/bin.dir/objects.a b/sqrt/bin.dir/objects.a deleted file mode 100644 index e3e48b344e3cc42aa10e1b85785086c47c25ae3b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2266 zcmcgt&ubGw6rRndwWLBK)*pBpp<;w~yGhq=6p`2xyM+d#B@~pp-K0solBO})YV4s1 z1z`z={sBFE@Zec*(YD~R-ue#+9t2BIJrv`6v%AS|v%QG;U}xUE_wAe6nfboGeow3B zm+pr~sMlihs3eWXB~hYOWGQz`X8nWYDDOQkl%&}4LeFQ^TL8= zXe@GelO&m@kgL_sMp&6Qh^u=Go`;lV&*{9MBw|vibmNkMduL;L03&Wha^AA~40O|7 z^)ktDzKih(I0JdE;65Vq9mgdmzO#3|917*dF3d=DBfi z5=M+E?I?UZxdtPlinnNRZEel%BB9)LYIAASpG&d0Jl5gTIX24xEb$8Sy1BFu@gdl= zZQMLCT=W0n(p8w}&=1)dCk9;i=bR5NI|GbMD4V50 zQ8Ck0F|*NWGbK)&X$YpGikUi88gqxAaLGyoPoK2*r_2MTkp=K)Mo=?#(ny^EITKIk zc5D)hECVF&!7o8Z9~Z;Fn&?157$BcJ^u~DroIZxS$4Gqy9TvmUZ&T(zbYB(oi?Ye4 z$5|h?TCI<`7MN6YDZi{mraez;V})0xzLo z<-b!ayj@=FRx8AuT91oGnBh4JZMQj!hI-dT^iW}!dZLPHn; diff --git a/sqrt/bin.dir/objects1.rsp b/sqrt/bin.dir/objects1.rsp deleted file mode 100644 index b4b3f2b..0000000 --- a/sqrt/bin.dir/objects1.rsp +++ /dev/null @@ -1 +0,0 @@ -CMakeFiles/../bin.dir/src/a.obj CMakeFiles/../bin.dir/src/main.obj diff --git a/sqrt/bin.dir/progress.make b/sqrt/bin.dir/progress.make deleted file mode 100644 index 6a9dc74..0000000 --- a/sqrt/bin.dir/progress.make +++ /dev/null @@ -1,4 +0,0 @@ -CMAKE_PROGRESS_1 = 1 -CMAKE_PROGRESS_2 = 2 -CMAKE_PROGRESS_3 = 3 - diff --git a/sqrt/bin.dir/src/a.obj b/sqrt/bin.dir/src/a.obj deleted file mode 100644 index e3406ef922f0c4e8e62552303fd97d93b6be5995..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 784 zcmZ`%%}T>S5Z-lDDIz4ro2NYpD%iCxp@^r@QksK8K%^(BX`8lzQfm?+_8>w*@a6+} z_BjgnRRj;7`T*+8CV`}-AME_>d^^kRx4oBbf>=;O3NliN2%IpGab!y16sW($LZIWs zx)nV;u;tEXV-RaDI=;V|5mla%7iJsoLP?MBOwJpmWQfT+&j8*>%w<4E-l?9Pio6Bx zVy&NLT$`_7=Inc4_q*y28lYzxUwYc1!YsCE`Hpi~&gGmU4d>OTUlO6oYu*1fZ%$yu$P9dIk zR5|P9z^TTWqYhZNIQWc5X5A1b8}~PyW7aJI`O9x~IO?dYj@ZGs%=6+=fjPe*rOYEI z(ZvwH@k#WmI@F_odk7#QELha+aSovU9@YVJZU}jY061x&N8>*?oIaQz%=yX=d3mh* zcsw3|!qQMwE*`x<6Co139}ySI0a?fkVKEeb8WaV5d5|Zr;r2V=EAW)4VbMDcJweMJ zy6mygJW$rx)*jM$&M?=vl3VE%ZD-P2I+bkhT1Go*)wW^Zp3$&r`3+rd)hgRI-7J~a zTFbgiS5~BZlI+Wda2cL!@C1nh`Z`C?K*u;LgN|~v5Bdg2A5VP%2)00k-4hfB6yZL6 z8#lUmiZH7im2{&~gB8lZF(Gwfr(~E?#r3$l*)mL9cd-D|AkN%VjNmS`*h}ODrX~wF zhywN&=jlxRQ-zmsUS|J9!Qjs4_@)VaAPRW9ro}%=ydRu1a~|ImVMG+@bP{ic-vR~y zC!(;*@vOS-a|DQ{O*({b><`M>EkIAbW^2~VmiIeC&m-VS{7g%oPR9>5&Dd#bnpUc` XY|Yp$YxIp(XzIe0 diff --git a/sqrt/bin.dir/src/main.obj.d b/sqrt/bin.dir/src/main.obj.d deleted file mode 100644 index e4e3a3e..0000000 --- a/sqrt/bin.dir/src/main.obj.d +++ /dev/null @@ -1,16 +0,0 @@ -CMakeFiles/../bin.dir/src/main.obj: \ - C:\Users\Administrator\PL\sqrt\src\main.c \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\stdio.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\corecrt_stdio_config.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\corecrt.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\_mingw.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\_mingw_mac.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\_mingw_secapi.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\vadefs.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\sdks/_mingw_ddk.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\_mingw_off_t.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\swprintf.inl \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\sec_api\stdio_s.h \ - c:\users\administrator\pl\sqrt\include\a.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\math.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\crtdefs.h From d5d9b3fd4bab4815a7247bda3c52b651c40c2b18 Mon Sep 17 00:00:00 2001 From: Mayuri <63649939+opensourcefuture@users.noreply.github.com> Date: Sun, 17 Oct 2021 09:13:40 +0800 Subject: [PATCH 16/82] Delete sqrt/build/bin.dir directory --- sqrt/build/bin.dir/DependInfo.cmake | 20 ---- sqrt/build/bin.dir/build.make | 129 ------------------------ sqrt/build/bin.dir/cmake_clean.cmake | 15 --- sqrt/build/bin.dir/compiler_depend.make | 2 - sqrt/build/bin.dir/compiler_depend.ts | 2 - sqrt/build/bin.dir/depend.make | 2 - sqrt/build/bin.dir/flags.make | 10 -- sqrt/build/bin.dir/includes_C.rsp | 1 - sqrt/build/bin.dir/link.txt | 3 - sqrt/build/bin.dir/linklibs.rsp | 1 - sqrt/build/bin.dir/objects.a | Bin 2266 -> 0 bytes sqrt/build/bin.dir/objects1.rsp | 1 - sqrt/build/bin.dir/progress.make | 4 - sqrt/build/bin.dir/src/a.obj | Bin 784 -> 0 bytes sqrt/build/bin.dir/src/a.obj.d | 10 -- sqrt/build/bin.dir/src/main.obj | Bin 1267 -> 0 bytes sqrt/build/bin.dir/src/main.obj.d | 16 --- 17 files changed, 216 deletions(-) delete mode 100644 sqrt/build/bin.dir/DependInfo.cmake delete mode 100644 sqrt/build/bin.dir/build.make delete mode 100644 sqrt/build/bin.dir/cmake_clean.cmake delete mode 100644 sqrt/build/bin.dir/compiler_depend.make delete mode 100644 sqrt/build/bin.dir/compiler_depend.ts delete mode 100644 sqrt/build/bin.dir/depend.make delete mode 100644 sqrt/build/bin.dir/flags.make delete mode 100644 sqrt/build/bin.dir/includes_C.rsp delete mode 100644 sqrt/build/bin.dir/link.txt delete mode 100644 sqrt/build/bin.dir/linklibs.rsp delete mode 100644 sqrt/build/bin.dir/objects.a delete mode 100644 sqrt/build/bin.dir/objects1.rsp delete mode 100644 sqrt/build/bin.dir/progress.make delete mode 100644 sqrt/build/bin.dir/src/a.obj delete mode 100644 sqrt/build/bin.dir/src/a.obj.d delete mode 100644 sqrt/build/bin.dir/src/main.obj delete mode 100644 sqrt/build/bin.dir/src/main.obj.d diff --git a/sqrt/build/bin.dir/DependInfo.cmake b/sqrt/build/bin.dir/DependInfo.cmake deleted file mode 100644 index 322272c..0000000 --- a/sqrt/build/bin.dir/DependInfo.cmake +++ /dev/null @@ -1,20 +0,0 @@ - -# Consider dependencies only in project. -set(CMAKE_DEPENDS_IN_PROJECT_ONLY OFF) - -# The set of languages for which implicit dependencies are needed: -set(CMAKE_DEPENDS_LANGUAGES - ) - -# The set of dependency files which are needed: -set(CMAKE_DEPENDS_DEPENDENCY_FILES - "C:/Users/Administrator/PL/sqrt/src/a.c" "bin.dir/src/a.obj" "gcc" "bin.dir/src/a.obj.d" - "C:/Users/Administrator/PL/sqrt/src/main.c" "bin.dir/src/main.obj" "gcc" "bin.dir/src/main.obj.d" - ) - -# Targets to which this target links. -set(CMAKE_TARGET_LINKED_INFO_FILES - ) - -# Fortran module output directory. -set(CMAKE_Fortran_TARGET_MODULE_DIR "") diff --git a/sqrt/build/bin.dir/build.make b/sqrt/build/bin.dir/build.make deleted file mode 100644 index fdaaac1..0000000 --- a/sqrt/build/bin.dir/build.make +++ /dev/null @@ -1,129 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "MinGW Makefiles" Generator, CMake Version 3.21 - -# Delete rule output on recipe failure. -.DELETE_ON_ERROR: - -#============================================================================= -# Special targets provided by cmake. - -# Disable implicit rules so canonical targets will work. -.SUFFIXES: - -# Disable VCS-based implicit rules. -% : %,v - -# Disable VCS-based implicit rules. -% : RCS/% - -# Disable VCS-based implicit rules. -% : RCS/%,v - -# Disable VCS-based implicit rules. -% : SCCS/s.% - -# Disable VCS-based implicit rules. -% : s.% - -.SUFFIXES: .hpux_make_needs_suffix_list - -# Command-line flag to silence nested $(MAKE). -$(VERBOSE)MAKESILENT = -s - -#Suppress display of executed commands. -$(VERBOSE).SILENT: - -# A target that is always out of date. -cmake_force: -.PHONY : cmake_force - -#============================================================================= -# Set environment variables for the build. - -SHELL = cmd.exe - -# The CMake executable. -CMAKE_COMMAND = "C:\Program Files\CMake\bin\cmake.exe" - -# The command to remove a file. -RM = "C:\Program Files\CMake\bin\cmake.exe" -E rm -f - -# Escaping for special characters. -EQUALS = = - -# The top-level source directory on which CMake was run. -CMAKE_SOURCE_DIR = C:\Users\Administrator\PL\sqrt - -# The top-level build directory on which CMake was run. -CMAKE_BINARY_DIR = C:\Users\Administrator\PL\sqrt\build - -# Include any dependencies generated for this target. -include CMakeFiles/../bin.dir/depend.make -# Include any dependencies generated by the compiler for this target. -include CMakeFiles/../bin.dir/compiler_depend.make - -# Include the progress variables for this target. -include CMakeFiles/../bin.dir/progress.make - -# Include the compile flags for this target's objects. -include CMakeFiles/../bin.dir/flags.make - -CMakeFiles/../bin.dir/src/a.obj: CMakeFiles/../bin.dir/flags.make -CMakeFiles/../bin.dir/src/a.obj: CMakeFiles/../bin.dir/includes_C.rsp -CMakeFiles/../bin.dir/src/a.obj: ../src/a.c -CMakeFiles/../bin.dir/src/a.obj: CMakeFiles/../bin.dir/compiler_depend.ts - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=C:\Users\Administrator\PL\sqrt\build\CMakeFiles --progress-num=$(CMAKE_PROGRESS_1) "Building C object CMakeFiles/../bin.dir/src/a.obj" - C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT CMakeFiles/../bin.dir/src/a.obj -MF CMakeFiles\..\bin.dir\src\a.obj.d -o CMakeFiles\..\bin.dir\src\a.obj -c C:\Users\Administrator\PL\sqrt\src\a.c - -CMakeFiles/../bin.dir/src/a.i: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/../bin.dir/src/a.i" - C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E C:\Users\Administrator\PL\sqrt\src\a.c > CMakeFiles\..\bin.dir\src\a.i - -CMakeFiles/../bin.dir/src/a.s: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/../bin.dir/src/a.s" - C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S C:\Users\Administrator\PL\sqrt\src\a.c -o CMakeFiles\..\bin.dir\src\a.s - -CMakeFiles/../bin.dir/src/main.obj: CMakeFiles/../bin.dir/flags.make -CMakeFiles/../bin.dir/src/main.obj: CMakeFiles/../bin.dir/includes_C.rsp -CMakeFiles/../bin.dir/src/main.obj: ../src/main.c -CMakeFiles/../bin.dir/src/main.obj: CMakeFiles/../bin.dir/compiler_depend.ts - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --progress-dir=C:\Users\Administrator\PL\sqrt\build\CMakeFiles --progress-num=$(CMAKE_PROGRESS_2) "Building C object CMakeFiles/../bin.dir/src/main.obj" - C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -MD -MT CMakeFiles/../bin.dir/src/main.obj -MF CMakeFiles\..\bin.dir\src\main.obj.d -o CMakeFiles\..\bin.dir\src\main.obj -c C:\Users\Administrator\PL\sqrt\src\main.c - -CMakeFiles/../bin.dir/src/main.i: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Preprocessing C source to CMakeFiles/../bin.dir/src/main.i" - C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -E C:\Users\Administrator\PL\sqrt\src\main.c > CMakeFiles\..\bin.dir\src\main.i - -CMakeFiles/../bin.dir/src/main.s: cmake_force - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green "Compiling C source to assembly CMakeFiles/../bin.dir/src/main.s" - C:\ProgramData\chocolatey\bin\gcc.exe $(C_DEFINES) $(C_INCLUDES) $(C_FLAGS) -S C:\Users\Administrator\PL\sqrt\src\main.c -o CMakeFiles\..\bin.dir\src\main.s - -# Object files for target ../bin -__/bin_OBJECTS = \ -"CMakeFiles/../bin.dir/src/a.obj" \ -"CMakeFiles/../bin.dir/src/main.obj" - -# External object files for target ../bin -__/bin_EXTERNAL_OBJECTS = - -../bin.exe: CMakeFiles/../bin.dir/src/a.obj -../bin.exe: CMakeFiles/../bin.dir/src/main.obj -../bin.exe: CMakeFiles/../bin.dir/build.make -../bin.exe: CMakeFiles/../bin.dir/linklibs.rsp -../bin.exe: CMakeFiles/../bin.dir/objects1.rsp -../bin.exe: CMakeFiles/../bin.dir/link.txt - @$(CMAKE_COMMAND) -E cmake_echo_color --switch=$(COLOR) --green --bold --progress-dir=C:\Users\Administrator\PL\sqrt\build\CMakeFiles --progress-num=$(CMAKE_PROGRESS_3) "Linking C executable ..\bin.exe" - $(CMAKE_COMMAND) -E cmake_link_script CMakeFiles\..\bin.dir\link.txt --verbose=$(VERBOSE) - -# Rule to build all files generated by this target. -CMakeFiles/../bin.dir/build: ../bin.exe -.PHONY : CMakeFiles/../bin.dir/build - -CMakeFiles/../bin.dir/clean: - $(CMAKE_COMMAND) -P CMakeFiles\..\bin.dir\cmake_clean.cmake -.PHONY : CMakeFiles/../bin.dir/clean - -CMakeFiles/../bin.dir/depend: - $(CMAKE_COMMAND) -E cmake_depends "MinGW Makefiles" C:\Users\Administrator\PL\sqrt C:\Users\Administrator\PL\sqrt C:\Users\Administrator\PL\sqrt\build C:\Users\Administrator\PL\sqrt\build C:\Users\Administrator\PL\sqrt\build\bin.dir\DependInfo.cmake --color=$(COLOR) -.PHONY : CMakeFiles/../bin.dir/depend - diff --git a/sqrt/build/bin.dir/cmake_clean.cmake b/sqrt/build/bin.dir/cmake_clean.cmake deleted file mode 100644 index 3d6bfe3..0000000 --- a/sqrt/build/bin.dir/cmake_clean.cmake +++ /dev/null @@ -1,15 +0,0 @@ -file(REMOVE_RECURSE - "../bin.exe" - "../bin.exe.manifest" - "../bin.pdb" - "CMakeFiles/../bin.dir/src/a.obj" - "CMakeFiles/../bin.dir/src/a.obj.d" - "CMakeFiles/../bin.dir/src/main.obj" - "CMakeFiles/../bin.dir/src/main.obj.d" - "lib../bin.dll.a" -) - -# Per-language clean rules from dependency scanning. -foreach(lang C) - include(CMakeFiles/../bin.dir/cmake_clean_${lang}.cmake OPTIONAL) -endforeach() diff --git a/sqrt/build/bin.dir/compiler_depend.make b/sqrt/build/bin.dir/compiler_depend.make deleted file mode 100644 index 9338eab..0000000 --- a/sqrt/build/bin.dir/compiler_depend.make +++ /dev/null @@ -1,2 +0,0 @@ -# Empty compiler generated dependencies file for ../bin. -# This may be replaced when dependencies are built. diff --git a/sqrt/build/bin.dir/compiler_depend.ts b/sqrt/build/bin.dir/compiler_depend.ts deleted file mode 100644 index e120a65..0000000 --- a/sqrt/build/bin.dir/compiler_depend.ts +++ /dev/null @@ -1,2 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Timestamp file for compiler generated dependencies management for ../bin. diff --git a/sqrt/build/bin.dir/depend.make b/sqrt/build/bin.dir/depend.make deleted file mode 100644 index 3f24db7..0000000 --- a/sqrt/build/bin.dir/depend.make +++ /dev/null @@ -1,2 +0,0 @@ -# Empty dependencies file for ../bin. -# This may be replaced when dependencies are built. diff --git a/sqrt/build/bin.dir/flags.make b/sqrt/build/bin.dir/flags.make deleted file mode 100644 index 3b217b6..0000000 --- a/sqrt/build/bin.dir/flags.make +++ /dev/null @@ -1,10 +0,0 @@ -# CMAKE generated file: DO NOT EDIT! -# Generated by "MinGW Makefiles" Generator, CMake Version 3.21 - -# compile C with C:/ProgramData/chocolatey/bin/gcc.exe -C_DEFINES = - -C_INCLUDES = @CMakeFiles/../bin.dir/includes_C.rsp - -C_FLAGS = - diff --git a/sqrt/build/bin.dir/includes_C.rsp b/sqrt/build/bin.dir/includes_C.rsp deleted file mode 100644 index a934c98..0000000 --- a/sqrt/build/bin.dir/includes_C.rsp +++ /dev/null @@ -1 +0,0 @@ --IC:/Users/Administrator/PL/sqrt/include diff --git a/sqrt/build/bin.dir/link.txt b/sqrt/build/bin.dir/link.txt deleted file mode 100644 index 880af15..0000000 --- a/sqrt/build/bin.dir/link.txt +++ /dev/null @@ -1,3 +0,0 @@ -"C:\Program Files\CMake\bin\cmake.exe" -E rm -f CMakeFiles\..\bin.dir/objects.a -C:\ProgramData\chocolatey\bin\ar.exe qc CMakeFiles\..\bin.dir/objects.a @CMakeFiles\..\bin.dir\objects1.rsp -C:\ProgramData\chocolatey\bin\gcc.exe -Wl,--whole-archive CMakeFiles\..\bin.dir/objects.a -Wl,--no-whole-archive -o ..\bin.exe -Wl,--out-implib,lib..\bin.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles\..\bin.dir\linklibs.rsp diff --git a/sqrt/build/bin.dir/linklibs.rsp b/sqrt/build/bin.dir/linklibs.rsp deleted file mode 100644 index 8ed353a..0000000 --- a/sqrt/build/bin.dir/linklibs.rsp +++ /dev/null @@ -1 +0,0 @@ - -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32 diff --git a/sqrt/build/bin.dir/objects.a b/sqrt/build/bin.dir/objects.a deleted file mode 100644 index d0d990e4468609b0b201348e9f67cd7081d8b964..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 2266 zcmcgt&ubGw6rRndwWLBS)*pBpp<;w~yGi3Vib!mU-9iJ=5(-M)ZqjVKlBO})YV4s1 z1z`z={sBFE@Zec*(YD~R-ue#+9t2BIJrv`6v%Be}*9>GoeRys?S`U+>W2Ms$)GIP?r zZs{y?c9SHThLo#T&qg?zH;AjX7d#KCxI3r!ev-&ZsoaT60`8rQ6#Zq4VW>x#Uy8e?MhA*W04#Rz^z90C4p@!EQ(3BeL`VO7l-t!{wV`TZaggR#%%VkeujyE&kY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9cd-D|AkN%VjNmS`*h}ODrX~wF zhywN&=jlxRQ-zmsUS|J9!Qjs4_@)VaAPRW9ro}%=ydRu1a~|ImVMG+@bP{ic-vR~y zC!(;*@vOS-a|DQ{O*({b><`M>EkIAbW^2~VmiIeC&m-VS{7g%oPR9>5&Dd#bnpUc` XY|Yp$YxIp(XzIe0 diff --git a/sqrt/build/bin.dir/src/main.obj.d b/sqrt/build/bin.dir/src/main.obj.d deleted file mode 100644 index e4e3a3e..0000000 --- a/sqrt/build/bin.dir/src/main.obj.d +++ /dev/null @@ -1,16 +0,0 @@ -CMakeFiles/../bin.dir/src/main.obj: \ - C:\Users\Administrator\PL\sqrt\src\main.c \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\stdio.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\corecrt_stdio_config.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\corecrt.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\_mingw.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\_mingw_mac.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\_mingw_secapi.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\vadefs.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\sdks/_mingw_ddk.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\_mingw_off_t.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\swprintf.inl \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\sec_api\stdio_s.h \ - c:\users\administrator\pl\sqrt\include\a.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\math.h \ - c:\programdata\chocolatey\lib\mingw\tools\install\mingw64\x86_64-w64-mingw32\include\crtdefs.h From b1a5e0210b112d368fa534f173e85d184cdb8de7 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Sun, 17 Oct 2021 09:22:38 +0800 Subject: [PATCH 17/82] modified: .gitignore modified: sqrt/CMakeLists.txt --- .gitignore | 2 ++ sqrt/CMakeLists.txt | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2c196bf..68f1b0c 100644 --- a/.gitignore +++ b/.gitignore @@ -5,3 +5,5 @@ CMakeCache.txt CMakeFiles/ Makefile cmake_install.cmake +build/ +bin/ diff --git a/sqrt/CMakeLists.txt b/sqrt/CMakeLists.txt index 78db70f..d313677 100644 --- a/sqrt/CMakeLists.txt +++ b/sqrt/CMakeLists.txt @@ -1,4 +1,4 @@ PROJECT(test_math) INCLUDE_DIRECTORIES(include) AUX_SOURCE_DIRECTORY(src DIR_SRCS) -ADD_EXECUTABLE(../bin ${DIR_SRCS}) +ADD_EXECUTABLE(../bin/bin ${DIR_SRCS}) From 718b99c298a55aabf28e2e1f03b6ef6472e08cc0 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Sun, 17 Oct 2021 09:25:16 +0800 Subject: [PATCH 18/82] new file: README.md --- sqrt/README.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 sqrt/README.md diff --git a/sqrt/README.md b/sqrt/README.md new file mode 100644 index 0000000..24c092d --- /dev/null +++ b/sqrt/README.md @@ -0,0 +1 @@ +# A project to learn cmake From 0e72bc5fbc546e8d0651e4ea9142b9fb83696a8d Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Sun, 17 Oct 2021 09:31:26 +0800 Subject: [PATCH 19/82] renamed: composition.c -> composition/composition.c renamed: 1.c -> string_operation/1.c renamed: 2.c -> string_operation/2.c --- composition.c => composition/composition.c | 1 - 1.c => string_operation/1.c | 0 2.c => string_operation/2.c | 0 3 files changed, 1 deletion(-) rename composition.c => composition/composition.c (95%) rename 1.c => string_operation/1.c (100%) rename 2.c => string_operation/2.c (100%) diff --git a/composition.c b/composition/composition.c similarity index 95% rename from composition.c rename to composition/composition.c index dcd1161..b697031 100644 --- a/composition.c +++ b/composition/composition.c @@ -13,7 +13,6 @@ int main(int argc,char *argv[]){ if ( argc == 1 ) { printf("please input name\n"); -// baka will be used as default"); //char name[] = "baka"; return 0; } diff --git a/1.c b/string_operation/1.c similarity index 100% rename from 1.c rename to string_operation/1.c diff --git a/2.c b/string_operation/2.c similarity index 100% rename from 2.c rename to string_operation/2.c From ada30eac7199513cc71ba177621262ea3741e24c Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Sun, 17 Oct 2021 14:10:45 +0800 Subject: [PATCH 20/82] =?UTF-8?q?=09=E4=BF=AE=E6=94=B9=EF=BC=9A=20=20=20?= =?UTF-8?q?=20=20helloworld/CMakeLists.txt?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- helloworld/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/helloworld/CMakeLists.txt b/helloworld/CMakeLists.txt index c51b16b..25ba0e5 100644 --- a/helloworld/CMakeLists.txt +++ b/helloworld/CMakeLists.txt @@ -1,4 +1,4 @@ -#cmake_minimum_required (VERSION 2.8) +cmake_minimum_required (VERSION 2.9) project(helloworld) #include_directories(include) AUX_SOURCE_DIRECTORY(src DIR_SRCS) From 5a98bfa0f37b48030b11e311a05a9c64f02ceeb0 Mon Sep 17 00:00:00 2001 From: Mayuri <63649939+opensourcefuture@users.noreply.github.com> Date: Sun, 17 Oct 2021 23:33:55 +0800 Subject: [PATCH 21/82] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 909d363..b102999 100644 --- a/README.md +++ b/README.md @@ -1 +1,2 @@ # Programme Learning + From 000c674c7fad9b4b5c6cc88d43841cbce835b3ae Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Fri, 22 Oct 2021 21:34:02 +0800 Subject: [PATCH 22/82] =?UTF-8?q?=09=E6=96=B0=E6=96=87=E4=BB=B6=EF=BC=9A?= =?UTF-8?q?=20=20=20sqrt/.project?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- sqrt/.project | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 sqrt/.project diff --git a/sqrt/.project b/sqrt/.project new file mode 100644 index 0000000..8ff2a75 --- /dev/null +++ b/sqrt/.project @@ -0,0 +1,11 @@ + + + sqrt + + + + + + + + From 2a7240a02dba354b2736f2b65c0c350409ac7b8d Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Sun, 28 Nov 2021 13:26:56 +0800 Subject: [PATCH 23/82] Move C code to ../c --- {composition => c/composition}/composition.c | 0 {helloworld => c/helloworld}/CMakeLists.txt | 0 {helloworld => c/helloworld}/cmkls.txt | 0 {helloworld => c/helloworld}/src/main.c | 0 {sqrt => c/sqrt}/.project | 0 {sqrt => c/sqrt}/CMakeLists.txt | 0 {sqrt => c/sqrt}/README.md | 0 {sqrt => c/sqrt}/include/a.h | 0 {sqrt => c/sqrt}/src/a.c | 0 {sqrt => c/sqrt}/src/main.c | 0 {string_operation => c/string_operation}/1.c | 0 {string_operation => c/string_operation}/2.c | 0 12 files changed, 0 insertions(+), 0 deletions(-) rename {composition => c/composition}/composition.c (100%) rename {helloworld => c/helloworld}/CMakeLists.txt (100%) rename {helloworld => c/helloworld}/cmkls.txt (100%) rename {helloworld => c/helloworld}/src/main.c (100%) rename {sqrt => c/sqrt}/.project (100%) rename {sqrt => c/sqrt}/CMakeLists.txt (100%) rename {sqrt => c/sqrt}/README.md (100%) rename {sqrt => c/sqrt}/include/a.h (100%) rename {sqrt => c/sqrt}/src/a.c (100%) rename {sqrt => c/sqrt}/src/main.c (100%) rename {string_operation => c/string_operation}/1.c (100%) rename {string_operation => c/string_operation}/2.c (100%) diff --git a/composition/composition.c b/c/composition/composition.c similarity index 100% rename from composition/composition.c rename to c/composition/composition.c diff --git a/helloworld/CMakeLists.txt b/c/helloworld/CMakeLists.txt similarity index 100% rename from helloworld/CMakeLists.txt rename to c/helloworld/CMakeLists.txt diff --git a/helloworld/cmkls.txt b/c/helloworld/cmkls.txt similarity index 100% rename from helloworld/cmkls.txt rename to c/helloworld/cmkls.txt diff --git a/helloworld/src/main.c b/c/helloworld/src/main.c similarity index 100% rename from helloworld/src/main.c rename to c/helloworld/src/main.c diff --git a/sqrt/.project b/c/sqrt/.project similarity index 100% rename from sqrt/.project rename to c/sqrt/.project diff --git a/sqrt/CMakeLists.txt b/c/sqrt/CMakeLists.txt similarity index 100% rename from sqrt/CMakeLists.txt rename to c/sqrt/CMakeLists.txt diff --git a/sqrt/README.md b/c/sqrt/README.md similarity index 100% rename from sqrt/README.md rename to c/sqrt/README.md diff --git a/sqrt/include/a.h b/c/sqrt/include/a.h similarity index 100% rename from sqrt/include/a.h rename to c/sqrt/include/a.h diff --git a/sqrt/src/a.c b/c/sqrt/src/a.c similarity index 100% rename from sqrt/src/a.c rename to c/sqrt/src/a.c diff --git a/sqrt/src/main.c b/c/sqrt/src/main.c similarity index 100% rename from sqrt/src/main.c rename to c/sqrt/src/main.c diff --git a/string_operation/1.c b/c/string_operation/1.c similarity index 100% rename from string_operation/1.c rename to c/string_operation/1.c diff --git a/string_operation/2.c b/c/string_operation/2.c similarity index 100% rename from string_operation/2.c rename to c/string_operation/2.c From 439cb30e228470c23274a4aa36d9575429f00dd7 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Wed, 1 Dec 2021 22:12:45 +0800 Subject: [PATCH 24/82] new file: rainbowBomb/main.cpp --- c/composition/composition.c | 2 +- c/rainbowBomb/main.cpp | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) create mode 100644 c/rainbowBomb/main.cpp diff --git a/c/composition/composition.c b/c/composition/composition.c index b697031..fe22774 100644 --- a/c/composition/composition.c +++ b/c/composition/composition.c @@ -28,7 +28,7 @@ int main(int argc,char *argv[]){ return 0; } -void write(char saying1[],char name[]){ +void write(char saying1[],const char *name){ sprintf(saying1,"%s,my %s,I do love u so much. ",name,name); char saying2[]="Pls take me away"; strcat(saying1,saying2); diff --git a/c/rainbowBomb/main.cpp b/c/rainbowBomb/main.cpp new file mode 100644 index 0000000..b05d5dc --- /dev/null +++ b/c/rainbowBomb/main.cpp @@ -0,0 +1,14 @@ +#include +int main(){ + //char char; //todo:make output customize + //char = getchar(); + while (true) { + printf("%c[47;31m%s%c[0m\n",0x1B,"~~~~~~~~~~~~~~~~~~~~~~~~",0x1B); + printf("%c[47;33m%s%c[0m\n",0x1B,"~~~~~~~~~~~~~~~~~~~~~~~~",0x1B); + printf("%c[47;32m%s%c[0m\n",0x1B,"~~~~~~~~~~~~~~~~~~~~~~~~",0x1B); + printf("%c[47;36m%s%c[0m\n",0x1B,"~~~~~~~~~~~~~~~~~~~~~~~~",0x1B); + printf("%c[47;34m%s%c[0m\n",0x1B,"~~~~~~~~~~~~~~~~~~~~~~~~",0x1B); + printf("%c[47;35m%s%c[0m\n",0x1B,"~~~~~~~~~~~~~~~~~~~~~~~~",0x1B); + printf("%c[47;37m%s%c[0m\n",0x1B,"~~~~~~~~~~~~~~~~~~~~~~~~",0x1B); + } +} From 4a1209bfb5e3faf0cbe4dfc0c61283591f859994 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Wed, 1 Dec 2021 22:44:11 +0800 Subject: [PATCH 25/82] use pure c instead of cpp --- c/rainbowBomb/main.c | 31 +++++++++++++++++++++++++++++++ c/rainbowBomb/main.cpp | 14 -------------- 2 files changed, 31 insertions(+), 14 deletions(-) create mode 100644 c/rainbowBomb/main.c delete mode 100644 c/rainbowBomb/main.cpp diff --git a/c/rainbowBomb/main.c b/c/rainbowBomb/main.c new file mode 100644 index 0000000..690aa4c --- /dev/null +++ b/c/rainbowBomb/main.c @@ -0,0 +1,31 @@ +#include +#include +int bomb(int times,char Char){ + printf("%c[47;31m",0x1B); + while (times>0){ + putchar(Char); + times--; + } + printf("%c[0m\n",0x1B); +} +int main(int argc,char *argv[]){ + char Char; + if (1 == argc){ + Char='~'; + printf("plz input a char:"); + Char = getchar(); + }else + { + Char = argv[1][0]; + } + while (true) { + bomb(8,Char); + bomb(9,Char); + bomb(10,Char); + bomb(11,Char); + bomb(10,Char); + bomb(9,Char); + bomb(8,Char); + + } +} diff --git a/c/rainbowBomb/main.cpp b/c/rainbowBomb/main.cpp deleted file mode 100644 index b05d5dc..0000000 --- a/c/rainbowBomb/main.cpp +++ /dev/null @@ -1,14 +0,0 @@ -#include -int main(){ - //char char; //todo:make output customize - //char = getchar(); - while (true) { - printf("%c[47;31m%s%c[0m\n",0x1B,"~~~~~~~~~~~~~~~~~~~~~~~~",0x1B); - printf("%c[47;33m%s%c[0m\n",0x1B,"~~~~~~~~~~~~~~~~~~~~~~~~",0x1B); - printf("%c[47;32m%s%c[0m\n",0x1B,"~~~~~~~~~~~~~~~~~~~~~~~~",0x1B); - printf("%c[47;36m%s%c[0m\n",0x1B,"~~~~~~~~~~~~~~~~~~~~~~~~",0x1B); - printf("%c[47;34m%s%c[0m\n",0x1B,"~~~~~~~~~~~~~~~~~~~~~~~~",0x1B); - printf("%c[47;35m%s%c[0m\n",0x1B,"~~~~~~~~~~~~~~~~~~~~~~~~",0x1B); - printf("%c[47;37m%s%c[0m\n",0x1B,"~~~~~~~~~~~~~~~~~~~~~~~~",0x1B); - } -} From 5bbff231c1c7e451a605136fccafa7ad5b3484fa Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Fri, 3 Dec 2021 21:12:33 +0800 Subject: [PATCH 26/82] new file: ../../rainbowBomb/CMakeLists.txt new file: ../../rainbowBomb/include/bomb.h new file: ../../rainbowBomb/src/bomb.c renamed: ../../rainbowBomb/main.c -> ../../rainbowBomb/src/main.c modified: ../CMakeLists.txt --- c/rainbowBomb/CMakeLists.txt | 7 +++++++ c/rainbowBomb/include/bomb.h | 3 +++ c/rainbowBomb/src/bomb.c | 10 ++++++++++ c/rainbowBomb/{ => src}/main.c | 11 +---------- c/sqrt/CMakeLists.txt | 1 + 5 files changed, 22 insertions(+), 10 deletions(-) create mode 100644 c/rainbowBomb/CMakeLists.txt create mode 100644 c/rainbowBomb/include/bomb.h create mode 100644 c/rainbowBomb/src/bomb.c rename c/rainbowBomb/{ => src}/main.c (62%) diff --git a/c/rainbowBomb/CMakeLists.txt b/c/rainbowBomb/CMakeLists.txt new file mode 100644 index 0000000..0710332 --- /dev/null +++ b/c/rainbowBomb/CMakeLists.txt @@ -0,0 +1,7 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.9) +PROJECT(RainbowBomb) +INCLUDE_DIRECTORIES(include) +AUX_SOURCE_DIRECTORY(src DIR_SRCS) +ADD_EXECUTABLE(../bin/bin ${DIR_SRCS}) + + diff --git a/c/rainbowBomb/include/bomb.h b/c/rainbowBomb/include/bomb.h new file mode 100644 index 0000000..5db66f4 --- /dev/null +++ b/c/rainbowBomb/include/bomb.h @@ -0,0 +1,3 @@ +#include +#include +int bomb(int times , char Char); diff --git a/c/rainbowBomb/src/bomb.c b/c/rainbowBomb/src/bomb.c new file mode 100644 index 0000000..29d60f9 --- /dev/null +++ b/c/rainbowBomb/src/bomb.c @@ -0,0 +1,10 @@ +#include "../include/bomb.h" +int bomb(int times,char Char){ + printf("%c[47;31m",0x1B); + while (times>0){ + putchar(Char); + times--; + } + printf("%c[0m\n",0x1B); + return 0; +} diff --git a/c/rainbowBomb/main.c b/c/rainbowBomb/src/main.c similarity index 62% rename from c/rainbowBomb/main.c rename to c/rainbowBomb/src/main.c index 690aa4c..f45ca90 100644 --- a/c/rainbowBomb/main.c +++ b/c/rainbowBomb/src/main.c @@ -1,13 +1,4 @@ -#include -#include -int bomb(int times,char Char){ - printf("%c[47;31m",0x1B); - while (times>0){ - putchar(Char); - times--; - } - printf("%c[0m\n",0x1B); -} +#include "../include/bomb.h" int main(int argc,char *argv[]){ char Char; if (1 == argc){ diff --git a/c/sqrt/CMakeLists.txt b/c/sqrt/CMakeLists.txt index d313677..a0fbacb 100644 --- a/c/sqrt/CMakeLists.txt +++ b/c/sqrt/CMakeLists.txt @@ -1,3 +1,4 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.9) PROJECT(test_math) INCLUDE_DIRECTORIES(include) AUX_SOURCE_DIRECTORY(src DIR_SRCS) From 6c55f2cb22e49ec05a2bc1f64f60d6a5f0f18158 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Fri, 3 Dec 2021 21:24:02 +0800 Subject: [PATCH 27/82] Add a README.md --- c/README.md | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 c/README.md diff --git a/c/README.md b/c/README.md new file mode 100644 index 0000000..cff5625 --- /dev/null +++ b/c/README.md @@ -0,0 +1,9 @@ +# How to use +``` +mkdir build +cd build +cmake .. -G "MinGW Makefiles" +make +``` + +The bin will be find in ./bin/ From ed6d26a88f514faee811b17f84edba1ac029955d Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Fri, 3 Dec 2021 21:28:09 +0800 Subject: [PATCH 28/82] Upgrade the README.md --- c/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/README.md b/c/README.md index cff5625..76d7233 100644 --- a/c/README.md +++ b/c/README.md @@ -6,4 +6,4 @@ cmake .. -G "MinGW Makefiles" make ``` -The bin will be find in ./bin/ +The bin will be find in `./bin/` From 8495165c52ea9be9bd0f4a2fbd6ca12b37f0d762 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Sun, 5 Dec 2021 12:47:49 +0800 Subject: [PATCH 29/82] new file: file.txt new file: main.c --- c/fileio/.file.txt.swp | Bin 0 -> 12288 bytes c/fileio/file.txt | 3 +++ c/fileio/main.c | 17 +++++++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 c/fileio/.file.txt.swp create mode 100644 c/fileio/file.txt create mode 100644 c/fileio/main.c diff --git a/c/fileio/.file.txt.swp b/c/fileio/.file.txt.swp new file mode 100644 index 0000000000000000000000000000000000000000..f787c728d827b59240ed6d6d882a753a7579dc79 GIT binary patch literal 12288 zcmeI%%}&BV5Ww*P?n3YdR=u-rK}2tcCWOQqE_k-o5*kzt-6rr%ybEuF2M=C#7dew& zCI3k#`!&1C{*Jp7?`asRUMmnA4UuHNiCyvCQ1)c-)84@bP%bezkw6$9cNU z_20odTqMO?`fhSP$jq#m=+T2t^fY@-v&Ft?nUyJVE+q&cP)6WP+JWy~U0$g3=D5rT zY7jsG0R#|0009ILK;VP~%tu9j?0u>>Yc?x~v<-m(0tg_000IagfB*srAb +#include +int main() +{ + FILE *fp; + char str1[100],str2[100],str3[100],str4[100]; + int a; + //fp = fopen("file.txt", "w"); + + //fprintf(fp, "%s", "this is an apple"); + //fclose(fp); + fp = fopen("file.txt", "r"); + fscanf(fp,"%s %s %s %s",str1,str2,str3,str4); + printf("%s %s %s %s",str1,str2,str3,str4); + fclose(fp); + return(0); +} From 66df05b617dc97b8e76fd8dd6814422e73557279 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Sun, 5 Dec 2021 12:48:42 +0800 Subject: [PATCH 30/82] deleted: .file.txt.swp --- c/fileio/.file.txt.swp | Bin 12288 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 c/fileio/.file.txt.swp diff --git a/c/fileio/.file.txt.swp b/c/fileio/.file.txt.swp deleted file mode 100644 index f787c728d827b59240ed6d6d882a753a7579dc79..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 12288 zcmeI%%}&BV5Ww*P?n3YdR=u-rK}2tcCWOQqE_k-o5*kzt-6rr%ybEuF2M=C#7dew& zCI3k#`!&1C{*Jp7?`asRUMmnA4UuHNiCyvCQ1)c-)84@bP%bezkw6$9cNU z_20odTqMO?`fhSP$jq#m=+T2t^fY@-v&Ft?nUyJVE+q&cP)6WP+JWy~U0$g3=D5rT zY7jsG0R#|0009ILK;VP~%tu9j?0u>>Yc?x~v<-m(0tg_000IagfB*srAb Date: Sun, 5 Dec 2021 13:59:13 +0800 Subject: [PATCH 31/82] new file: main.go --- go/r/main.go | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 go/r/main.go diff --git a/go/r/main.go b/go/r/main.go new file mode 100644 index 0000000..25b95a3 --- /dev/null +++ b/go/r/main.go @@ -0,0 +1,33 @@ +package main + +import ( + "flag" + "fmt" +) + +func main() { + r1 := (flag.Int("r1", -1, "the value of R1")) + r2 := (flag.Int("r2", -1, "the value of R2")) + r := (flag.Int("r", -1, "the value of R")) + flag.Parse() + if (-1 != *r) && (-1 != *r1) && (-1 != *r2) { + fmt.Printf("(R R1)R2=%f\n(R1 R2)R=%f\n", float64((*r1)*(*r))/float64(*r1-*r), float64((*r1)*(*r2))/float64((*r1)+(*r2))) + return + } + if (-1 == *r1) && (-1 != *r2) { + *r1 = *r2 + *r2 = -1 + } + if -1 == *r1 || ((-1 == *r) && (-1 == *r2)) { + fmt.Printf("plz input args\n") + return + } + if *r != -1 { + fmt.Printf("R2=%f\n", float64((*r1)*(*r))/float64(*r1-*r)) + return + } + if *r2 != -1 { + fmt.Printf("R=%f\n", float64((*r1)*(*r2))/float64((*r1)+(*r2))) + return + } +} From a412e987ee7dd823d3f4695fbc66f759eed49e3e Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Mon, 6 Dec 2021 18:30:04 +0800 Subject: [PATCH 32/82] TODO --- c/fileio/file.txt | 3 --- c/fileio/include/head.h | 5 +++++ c/fileio/src/main.c | 6 ++++++ c/fileio/src/r.c | 9 +++++++++ c/fileio/src/w.c | 8 ++++++++ 5 files changed, 28 insertions(+), 3 deletions(-) delete mode 100644 c/fileio/file.txt create mode 100644 c/fileio/include/head.h create mode 100644 c/fileio/src/main.c create mode 100644 c/fileio/src/r.c create mode 100644 c/fileio/src/w.c diff --git a/c/fileio/file.txt b/c/fileio/file.txt deleted file mode 100644 index 2ee0440..0000000 --- a/c/fileio/file.txt +++ /dev/null @@ -1,3 +0,0 @@ -123 456 -789 -012 diff --git a/c/fileio/include/head.h b/c/fileio/include/head.h new file mode 100644 index 0000000..6eef59c --- /dev/null +++ b/c/fileio/include/head.h @@ -0,0 +1,5 @@ +#include +#include +int r(); +int w(); + diff --git a/c/fileio/src/main.c b/c/fileio/src/main.c new file mode 100644 index 0000000..07ff152 --- /dev/null +++ b/c/fileio/src/main.c @@ -0,0 +1,6 @@ +#include "../include/head.h" +int main(){ + w(); + r(); + return 0; +} diff --git a/c/fileio/src/r.c b/c/fileio/src/r.c new file mode 100644 index 0000000..34b4d5c --- /dev/null +++ b/c/fileio/src/r.c @@ -0,0 +1,9 @@ +#include "../include/head.h" +int r(){ + FILE *fp = fopen("file.txt","r"); + char a[10],b[10],c[10],d[10]; + fscanf(fp,"%s %s %s %s",a,b,c,d); + printf("%s %s %s %s\n",a,b,c,d); + fclose(fp); + return 0; +} diff --git a/c/fileio/src/w.c b/c/fileio/src/w.c new file mode 100644 index 0000000..3bbec5d --- /dev/null +++ b/c/fileio/src/w.c @@ -0,0 +1,8 @@ +#include "../include/head.h" +int w(){ + FILE *fp; + fp = fopen("file.txt","w"); + fprintf(fp,"this is an %s\n","apple"); + fclose(fp); + return 0; +} From e75f0fb8de6efda6bfe0cbd413a1e9eb221fcb38 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Mon, 6 Dec 2021 18:40:50 +0800 Subject: [PATCH 33/82] A Project Done and A New TODO --- c/fileio/CMakeLists.txt | 5 +++++ c/sqlite/main.c | 4 ++++ 2 files changed, 9 insertions(+) create mode 100644 c/fileio/CMakeLists.txt create mode 100644 c/sqlite/main.c diff --git a/c/fileio/CMakeLists.txt b/c/fileio/CMakeLists.txt new file mode 100644 index 0000000..3ca4e38 --- /dev/null +++ b/c/fileio/CMakeLists.txt @@ -0,0 +1,5 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.9) +PROJECT(fileio) +INCLUDE_DIRECTORIES(./include) +AUX_SOURCE_DIRECTORY(./src DIR_SRC) +ADD_EXECUTABLE(../bin/bin ${DIR_SRC}) diff --git a/c/sqlite/main.c b/c/sqlite/main.c new file mode 100644 index 0000000..8b08b04 --- /dev/null +++ b/c/sqlite/main.c @@ -0,0 +1,4 @@ +#include +int main(){ + printf("%s","原神ing"); +} From facd5c807e39127cd8bc5bcd93886b7468c787a8 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Mon, 6 Dec 2021 18:52:48 +0800 Subject: [PATCH 34/82] modified: src/main.c modified: src/r.c modified: src/w.c --- c/fileio/src/main.c | 4 ++-- c/fileio/src/r.c | 8 ++++---- c/fileio/src/w.c | 6 +++--- 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/c/fileio/src/main.c b/c/fileio/src/main.c index 07ff152..953528a 100644 --- a/c/fileio/src/main.c +++ b/c/fileio/src/main.c @@ -1,6 +1,6 @@ #include "../include/head.h" int main(){ - w(); - r(); + w("file.txt","this_is_an_apple"); + r("file.txt"); return 0; } diff --git a/c/fileio/src/r.c b/c/fileio/src/r.c index 34b4d5c..e2eab4f 100644 --- a/c/fileio/src/r.c +++ b/c/fileio/src/r.c @@ -1,9 +1,9 @@ #include "../include/head.h" -int r(){ +int r(const char* filename){ FILE *fp = fopen("file.txt","r"); - char a[10],b[10],c[10],d[10]; - fscanf(fp,"%s %s %s %s",a,b,c,d); - printf("%s %s %s %s\n",a,b,c,d); + char a[100]; + fscanf(fp,"%s",a); + printf("%s",a); fclose(fp); return 0; } diff --git a/c/fileio/src/w.c b/c/fileio/src/w.c index 3bbec5d..a905151 100644 --- a/c/fileio/src/w.c +++ b/c/fileio/src/w.c @@ -1,8 +1,8 @@ #include "../include/head.h" -int w(){ +int w(const char* filename,const char* string){ FILE *fp; - fp = fopen("file.txt","w"); - fprintf(fp,"this is an %s\n","apple"); + fp = fopen(filename,"w"); + fprintf(fp,"%s",string); fclose(fp); return 0; } From ffeea67fe912f2c622f53ff29bae83cab378eb34 Mon Sep 17 00:00:00 2001 From: Mayuri <63649939+MayuriNFC@users.noreply.github.com> Date: Tue, 7 Dec 2021 19:54:45 +0800 Subject: [PATCH 35/82] Update r.c --- c/fileio/src/r.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/c/fileio/src/r.c b/c/fileio/src/r.c index e2eab4f..402b88b 100644 --- a/c/fileio/src/r.c +++ b/c/fileio/src/r.c @@ -1,9 +1,15 @@ #include "../include/head.h" int r(const char* filename){ FILE *fp = fopen("file.txt","r"); - char a[100]; - fscanf(fp,"%s",a); - printf("%s",a); + int i; + long location=-2; + while(ftell(fp)!=-1 && ftell(fp)!=location){ + //location=ftell(fp); + //printf("location:%ld ",location); + char a[100]; + fscanf(fp,"%s",a); + printf("%s \n\n",a); + } fclose(fp); return 0; } From e87bb275f8e56d40e23d045f2bab91dff5f689ef Mon Sep 17 00:00:00 2001 From: Mayuri <63649939+MayuriNFC@users.noreply.github.com> Date: Tue, 7 Dec 2021 19:57:35 +0800 Subject: [PATCH 36/82] Update .gitignore --- .gitignore | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.gitignore b/.gitignore index 68f1b0c..961ae99 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,5 @@ Makefile cmake_install.cmake build/ bin/ +.idea +.vscode From 1d819be88c011eb365109def57b3ff3dcf21a8b9 Mon Sep 17 00:00:00 2001 From: Mayuri <63649939+MayuriNFC@users.noreply.github.com> Date: Tue, 7 Dec 2021 20:00:14 +0800 Subject: [PATCH 37/82] Create LICENSE --- LICENSE | 661 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 661 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..0ad25db --- /dev/null +++ b/LICENSE @@ -0,0 +1,661 @@ + GNU AFFERO GENERAL PUBLIC LICENSE + Version 3, 19 November 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU Affero General Public License is a free, copyleft license for +software and other kinds of works, specifically designed to ensure +cooperation with the community in the case of network server software. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +our General Public Licenses are intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + Developers that use our General Public Licenses protect your rights +with two steps: (1) assert copyright on the software, and (2) offer +you this License which gives you legal permission to copy, distribute +and/or modify the software. + + A secondary benefit of defending all users' freedom is that +improvements made in alternate versions of the program, if they +receive widespread use, become available for other developers to +incorporate. Many developers of free software are heartened and +encouraged by the resulting cooperation. However, in the case of +software used on network servers, this result may fail to come about. +The GNU General Public License permits making a modified version and +letting the public access it on a server without ever releasing its +source code to the public. + + The GNU Affero General Public License is designed specifically to +ensure that, in such cases, the modified source code becomes available +to the community. It requires the operator of a network server to +provide the source code of the modified version running there to the +users of that server. Therefore, public use of a modified version, on +a publicly accessible server, gives the public access to the source +code of the modified version. + + An older license, called the Affero General Public License and +published by Affero, was designed to accomplish similar goals. This is +a different license, not a version of the Affero GPL, but Affero has +released a new version of the Affero GPL which permits relicensing under +this license. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU Affero General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Remote Network Interaction; Use with the GNU General Public License. + + Notwithstanding any other provision of this License, if you modify the +Program, your modified version must prominently offer all users +interacting with it remotely through a computer network (if your version +supports such interaction) an opportunity to receive the Corresponding +Source of your version by providing access to the Corresponding Source +from a network server at no charge, through some standard or customary +means of facilitating copying of software. This Corresponding Source +shall include the Corresponding Source for any work covered by version 3 +of the GNU General Public License that is incorporated pursuant to the +following paragraph. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the work with which it is combined will remain governed by version +3 of the GNU General Public License. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU Affero General Public License from time to time. Such new versions +will be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU Affero General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU Affero General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU Affero General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Affero General Public License as published + by the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If your software can interact with users remotely through a computer +network, you should also make sure that it provides a way for users to +get its source. For example, if your program is a web application, its +interface could display a "Source" link that leads users to an archive +of the code. There are many ways you could offer source, and different +solutions will be better for different programs; see section 13 for the +specific requirements. + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU AGPL, see +. From e79e55337976f4b9f313953d5acd68cba3f9214f Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Tue, 7 Dec 2021 20:10:27 +0800 Subject: [PATCH 38/82] new file: ../.gitmodules new file: GenericMakefile --- .gitmodules | 3 +++ c/GenericMakefile | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 c/GenericMakefile diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..8cff3bb --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "c/GenericMakefile"] + path = c/GenericMakefile + url = https://github.com/MayuriNFC/GenericMakefile.git diff --git a/c/GenericMakefile b/c/GenericMakefile new file mode 160000 index 0000000..d1ea112 --- /dev/null +++ b/c/GenericMakefile @@ -0,0 +1 @@ +Subproject commit d1ea11252105597156fb5aaecf687391475c2ca1 From 8dff26b25e356bf5ee31c9999ccef7894e1655cc Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Wed, 8 Dec 2021 20:24:44 +0800 Subject: [PATCH 39/82] new file: CMakeLists.txt new file: include/head.h new file: src/main.c --- c/fd/CMakeLists.txt | 5 ++++ c/fd/include/head.h | 6 ++++ c/fd/src/main.c | 68 +++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 79 insertions(+) create mode 100644 c/fd/CMakeLists.txt create mode 100644 c/fd/include/head.h create mode 100644 c/fd/src/main.c diff --git a/c/fd/CMakeLists.txt b/c/fd/CMakeLists.txt new file mode 100644 index 0000000..dfcd2b0 --- /dev/null +++ b/c/fd/CMakeLists.txt @@ -0,0 +1,5 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.9) +PROJECT(fd) +INCLUDE_DIRECTORIES(./include) +AUX_SOURCE_DIRECTORY(./src DIR_SRC) +ADD_EXECUTABLE(./bin ${DIR_SRC}) diff --git a/c/fd/include/head.h b/c/fd/include/head.h new file mode 100644 index 0000000..aea50a4 --- /dev/null +++ b/c/fd/include/head.h @@ -0,0 +1,6 @@ +#include +#include +#include +#include +#include + diff --git a/c/fd/src/main.c b/c/fd/src/main.c new file mode 100644 index 0000000..ccf3d77 --- /dev/null +++ b/c/fd/src/main.c @@ -0,0 +1,68 @@ +#include "../include/head.h" +int main(){ + char *path="file.txt"; + int fd; + char buf[40],buf2[]="hello world"; + int n,i; + if ((fd=open(path,O_RDWR))<0){ + perror("open file failed"); + return 1; + } + else + { + printf("open file successfully\n"); + } + + if ((n=read(fd,buf,20))<0){ + perror("read failed"); + return 1; + } + else + { + printf("output read data:\n"); + printf("%s\n",buf); + } + if ((i=lseek(fd,11,SEEK_SET))<0){ + perror("lseek error"); + return 1; + } + else + { + if (write(fd,buf2,11)<0){ + perror("write error"); + return 1; + } + else + { + printf("write successfully\n"); + } + } + close(fd); + + if ((fd=open(path,O_RDWR))<0){ + perror("open file failed"); + return 1; + } + else + { + if ((n=read(fd,buf,40)<0)) + { + perror("open file 2 failed"); + return 1; + } + else + { + printf("read the changed data:\n"); + printf("%s\n",buf); + } + if (close(fd)<0){ + perror("close file failed"); + return 1; + } + else + { + printf("goodbye\n"); + } + } + return 0; +} From 82d242d88e8d65a67aaff89663ecad0633542af0 Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Fri, 10 Dec 2021 21:15:26 +0800 Subject: [PATCH 40/82] Add a test of link --- c/link_test/CMakeLists.txt | 5 +++++ c/link_test/include/head.h | 2 ++ c/link_test/src/main.c | 13 +++++++++++++ 3 files changed, 20 insertions(+) create mode 100644 c/link_test/CMakeLists.txt create mode 100644 c/link_test/include/head.h create mode 100644 c/link_test/src/main.c diff --git a/c/link_test/CMakeLists.txt b/c/link_test/CMakeLists.txt new file mode 100644 index 0000000..44e0904 --- /dev/null +++ b/c/link_test/CMakeLists.txt @@ -0,0 +1,5 @@ +PROJECT(LINK_TEST) +CMAKE_MINIMUM_REQUIRED(VERSION 2.9) +INCLUDE_DIRECTORIES(./include) +AUX_SOURCE_DIRECTORY(./src DIR_SRC) +ADD_EXECUTABLE(./bin ${DIR_SRC}) diff --git a/c/link_test/include/head.h b/c/link_test/include/head.h new file mode 100644 index 0000000..fbfff34 --- /dev/null +++ b/c/link_test/include/head.h @@ -0,0 +1,2 @@ +#include +#include diff --git a/c/link_test/src/main.c b/c/link_test/src/main.c new file mode 100644 index 0000000..f95d6c2 --- /dev/null +++ b/c/link_test/src/main.c @@ -0,0 +1,13 @@ +#include "../include/head.h" +int main(){ + struct test { + char name[20]; + int num; + struct test *next; + }; + struct test *test1=(struct test*)(malloc(sizeof(struct test))); + scanf("%d",&test1->num); + printf("%d\n",test1->num); + return 0; +} + From 1d9a7eeff02bed06f075fb1ee19e1d9afbe1021e Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Fri, 10 Dec 2021 21:15:54 +0800 Subject: [PATCH 41/82] Add a Todo --- c/link_table/CMakeLists.txt | 5 +++++ c/link_table/build.sh | 4 ++++ c/link_table/include/head.h | 2 ++ c/link_table/src/main.c | 34 ++++++++++++++++++++++++++++++++++ 4 files changed, 45 insertions(+) create mode 100644 c/link_table/CMakeLists.txt create mode 100644 c/link_table/build.sh create mode 100644 c/link_table/include/head.h create mode 100644 c/link_table/src/main.c diff --git a/c/link_table/CMakeLists.txt b/c/link_table/CMakeLists.txt new file mode 100644 index 0000000..98a32c9 --- /dev/null +++ b/c/link_table/CMakeLists.txt @@ -0,0 +1,5 @@ +PROJECT(LINK_TABLE) +CMAKE_MINIMUM_REQUIRED(VERSION 2.9) +INCLUDE_DIRECTORIES(./include) +AUX_SOURCE_DIRECTORY(./src DIR_SRC) +ADD_EXECUTABLE(./bin ${DIR_SRC}) diff --git a/c/link_table/build.sh b/c/link_table/build.sh new file mode 100644 index 0000000..97e5ac1 --- /dev/null +++ b/c/link_table/build.sh @@ -0,0 +1,4 @@ +mkdir build +cd build +cmake .. +make diff --git a/c/link_table/include/head.h b/c/link_table/include/head.h new file mode 100644 index 0000000..fbfff34 --- /dev/null +++ b/c/link_table/include/head.h @@ -0,0 +1,2 @@ +#include +#include diff --git a/c/link_table/src/main.c b/c/link_table/src/main.c new file mode 100644 index 0000000..68c947f --- /dev/null +++ b/c/link_table/src/main.c @@ -0,0 +1,34 @@ +#include "../include/head.h" +int main(){ + struct body_link { + void *data; + int type; + struct body_link *next; + }; + struct head_link { + char *name; + struct body_link *head; + struct body_link **location; + int offset; + struct head_link *next; + }; + return 0; +} + +(struct head_link*)hcreate(){ + struct head_link *temp; + temp = (struct head_link*)(malloc(sizeof(struct head_link))); + temp->head = (struct body_link*)(malloc(sizeof(struct body_link))); + temp->location = &(temp->head); + temp->offset = 0; + return temp; +} +int hadd(struct head_link *head_hl){ + struct head_link *temp; + temp = (struct head_link*)(malloc(sizeof(struct head_link))); + head_hl->next = temp; + temp->head = head_hl->head; + temp->location = (struct body_link*)(malloc(sizeof(struct body_link))); + temp->offset = (head_hl->offset+1); + return 0; +} From 765464b0a74faa58ebf2baeb6a5ea2d6772ab54b Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Wed, 15 Dec 2021 20:19:51 +0800 Subject: [PATCH 42/82] modified: link_table/build.sh modified: link_table/include/head.h modified: link_table/src/main.c new file: link_test/build.sh modified: link_test/src/main.c new file: test/build.sh new file: test/src/1 new file: test/src/main.c --- c/link_table/build.sh | 2 ++ c/link_table/include/head.h | 2 ++ c/link_table/src/main.c | 41 +++++++++++++++++++----------------- c/link_test/build.sh | 6 ++++++ c/link_test/src/main.c | 1 - c/test/build.sh | 6 ++++++ c/test/src/1 | Bin 0 -> 6632 bytes c/test/src/main.c | 25 ++++++++++++++++++++++ 8 files changed, 63 insertions(+), 20 deletions(-) create mode 100644 c/link_test/build.sh create mode 100644 c/test/build.sh create mode 100755 c/test/src/1 create mode 100644 c/test/src/main.c diff --git a/c/link_table/build.sh b/c/link_table/build.sh index 97e5ac1..b7b8e70 100644 --- a/c/link_table/build.sh +++ b/c/link_table/build.sh @@ -1,3 +1,5 @@ + +rm -rf build mkdir build cd build cmake .. diff --git a/c/link_table/include/head.h b/c/link_table/include/head.h index fbfff34..ee5323b 100644 --- a/c/link_table/include/head.h +++ b/c/link_table/include/head.h @@ -1,2 +1,4 @@ #include #include +struct head_link; +struct body_link; diff --git a/c/link_table/src/main.c b/c/link_table/src/main.c index 68c947f..98f77a0 100644 --- a/c/link_table/src/main.c +++ b/c/link_table/src/main.c @@ -1,21 +1,6 @@ #include "../include/head.h" -int main(){ - struct body_link { - void *data; - int type; - struct body_link *next; - }; - struct head_link { - char *name; - struct body_link *head; - struct body_link **location; - int offset; - struct head_link *next; - }; - return 0; -} -(struct head_link*)hcreate(){ +*head_link hcreate() { struct head_link *temp; temp = (struct head_link*)(malloc(sizeof(struct head_link))); temp->head = (struct body_link*)(malloc(sizeof(struct body_link))); @@ -23,12 +8,30 @@ int main(){ temp->offset = 0; return temp; } -int hadd(struct head_link *head_hl){ +int hadd(head_link *head_hl){ struct head_link *temp; temp = (struct head_link*)(malloc(sizeof(struct head_link))); head_hl->next = temp; - temp->head = head_hl->head; - temp->location = (struct body_link*)(malloc(sizeof(struct body_link))); + temp->head = (struct body_link*)(malloc(sizeof(struct body_link))); + *(temp->location) = temp->head; temp->offset = (head_hl->offset+1); return 0; } +struct body_link { + void *data; + int type; + struct body_link *next; +}; +struct head_link { + char *name; + struct body_link *head; + struct body_link **location; + int offset; + struct head_link *next; +}; + +int main(){ + struct head_link *first = hcreate(); + hadd(first); + return 0; +} diff --git a/c/link_test/build.sh b/c/link_test/build.sh new file mode 100644 index 0000000..b7b8e70 --- /dev/null +++ b/c/link_test/build.sh @@ -0,0 +1,6 @@ + +rm -rf build +mkdir build +cd build +cmake .. +make diff --git a/c/link_test/src/main.c b/c/link_test/src/main.c index f95d6c2..09e0eec 100644 --- a/c/link_test/src/main.c +++ b/c/link_test/src/main.c @@ -10,4 +10,3 @@ int main(){ printf("%d\n",test1->num); return 0; } - diff --git a/c/test/build.sh b/c/test/build.sh new file mode 100644 index 0000000..b7b8e70 --- /dev/null +++ b/c/test/build.sh @@ -0,0 +1,6 @@ + +rm -rf build +mkdir build +cd build +cmake .. +make diff --git a/c/test/src/1 b/c/test/src/1 new file mode 100755 index 0000000000000000000000000000000000000000..2ec0ffdc93207bc74a8772a35567e7add995e3fc GIT binary patch literal 6632 zcmb_gZ)_Y_5udwDNt!=6Dg9#_5?@FnIitAlRFF!*`h2_g9Xa2f z_Rg)-6k$ju_=1$HED=6X3PK`|iWDRewLq%XMo?9#G7*U)geoVL%J9j2DC!AP^PBf( zob@J0N?}gB^XB(v-ptOv_jcZWy?@}5Xe2^PG5RI3bm#$#q@*MJ32A_(Xg_Vh{XuG^ zk3n8zFx#K9484}J(basN;4yHvJ16~NexK+m*9e)jT|GLq*7hi;%~oc+yKpJ4&!>Es z#GyQB$Im!?w;gAA&uU&0JLO@!`3+Wo{@`kEB_hp-+VODg?~M36BmR`nOCpr3{m@@3 zF6ZS=alXWZgEXImVt23LVcuueNxA0!80^GEG(H?-d%or*Z()8`hEcBmlI4@-iZ`Ad z$rY0MT;YW0cXqHUKmYT%_<4E?u3yZ#n3Y6+Tl)yuN2ac>uI|pZmXB;-&yeH1=Qf=m zuY*5W2Ytwg&ZfJ8_77if@%BSSPn1NNAGCSKSAY+pZ5whp3dis87i0jT%j^b!q_lTF4Dk} z-ouo1)0MQnWs2hoj4?hjnHfD*>|>UU5H2^*7Bu`B8&OOql&<4!2rtQcD~0eW z!6!qw%aaXsR`4jsm#J;=mjXEFM(JDt=eCFC zkRJCA>@Ke_OpG7c?XIWYWy*TUb^Mv4pLZdy$2;5_JD7qt+a20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%L{v*qf_&dq9lG~ zQ~w&j85B31nTY$;zt*S9PphJE&Owkq4}oJ+`$Y**`LHO5{cHaCyUr%PqNnw@@^b-u z-kUXkwI2hxN5mZZ>DzSF`hca2{;7rETl`0M>or~`!a|Fw|4)=SFYQA6Pxzrx=V zd;QGo|F-&n?z9Ff24VkPSFnoOuhiAz=#1DY)A^|K3urK=??>xQ{l7J=ACCWru;u^w z)L!e+5-&{9o$P-Kod#TLuXVxHhqRxCEkC>3YrUcWGwc7!yndK8evRujV4Od-*Z-Gg2cK^ z%HKv?=f3HX+gV#6(x6N@K5xcxsefI6?*h}<(OjWLN$~qCh;67}g_qE{o&AC>MCltL IgOEu71|WJOg8%>k literal 0 HcmV?d00001 diff --git a/c/test/src/main.c b/c/test/src/main.c new file mode 100644 index 0000000..df4aeae --- /dev/null +++ b/c/test/src/main.c @@ -0,0 +1,25 @@ +#include +#include +#include +void strinit(char **str1,const char *str2){ + *str1=(char *)malloc(strlen(str2+1)); + sprintf(*str1,"%s",str2); +} +struct test{ + int type[2]; + char *name; + struct test *next; +}; +struct test* add(){ + struct test *temp=(struct test*)malloc(sizeof(struct test)); + return temp; +} +int main(){ + struct test *test1=add(); + test1->type[0]=1; + //test1->name=(char *)malloc(12); + //sprintf((test1->name),"hello world"); + strinit(&(test1->name),"hello world"); + printf("name:%s\nnum:%d\n",(test1->name),(test1->type[0])); + return 0; +} From 5fbdf0b963be8274330e676dc274875e7f4d51eb Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Thu, 16 Dec 2021 20:43:37 +0800 Subject: [PATCH 43/82] new file: CMakeLists.txt modified: build.sh new file: include/head.h deleted: src/1 modified: src/main.c --- c/test/CMakeLists.txt | 5 +++++ c/test/build.sh | 1 + c/test/include/head.h | 36 ++++++++++++++++++++++++++++++++++++ c/test/src/1 | Bin 6632 -> 0 bytes c/test/src/main.c | 23 ++++------------------- 5 files changed, 46 insertions(+), 19 deletions(-) create mode 100644 c/test/CMakeLists.txt create mode 100644 c/test/include/head.h delete mode 100755 c/test/src/1 diff --git a/c/test/CMakeLists.txt b/c/test/CMakeLists.txt new file mode 100644 index 0000000..0ac658e --- /dev/null +++ b/c/test/CMakeLists.txt @@ -0,0 +1,5 @@ +PROJECT(TEST) +CMAKE_MINIMUM_REQUIRED(VERSION 2.9) +INCLUDE_DIRECTORIES(./include) +AUX_SOURCE_DIRECTORY(./src DIR_SRC) +ADD_EXECUTABLE(./bin ${DIR_SRC}) diff --git a/c/test/build.sh b/c/test/build.sh index b7b8e70..9ed0f62 100644 --- a/c/test/build.sh +++ b/c/test/build.sh @@ -4,3 +4,4 @@ mkdir build cd build cmake .. make +./bin diff --git a/c/test/include/head.h b/c/test/include/head.h new file mode 100644 index 0000000..5ced7e7 --- /dev/null +++ b/c/test/include/head.h @@ -0,0 +1,36 @@ +#include +#include +#include +void strval(char **str1,const char *str2,int type){ + switch (type) + { + case 1 : { + *str1=(char *)malloc(strlen(str2+1)); + sprintf(*str1,"%s",str2); + printf("case 1 :%s\n",*str1); + break; + } + case 2 : { + *str1 = (char *)realloc(*str1,strlen(*str1)+strlen(str2)+1); + sprintf(*str1,"%s%s",*str1,str2); + printf("case 2 :%s\n",*str1); + } + break; + case 3 : { + free(*str1); + *str1=(char *)malloc(strlen(str2+1)); + sprintf(*str1,"%s",str2); + printf("case 3 :%s\n",*str1); + break; + } + } +} +struct test{ + int type[2]; + char *name; + struct test *next; +}; +struct test* add(){ + struct test *temp=(struct test*)malloc(sizeof(struct test)); + return temp; +} diff --git a/c/test/src/1 b/c/test/src/1 deleted file mode 100755 index 2ec0ffdc93207bc74a8772a35567e7add995e3fc..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6632 zcmb_gZ)_Y_5udwDNt!=6Dg9#_5?@FnIitAlRFF!*`h2_g9Xa2f z_Rg)-6k$ju_=1$HED=6X3PK`|iWDRewLq%XMo?9#G7*U)geoVL%J9j2DC!AP^PBf( zob@J0N?}gB^XB(v-ptOv_jcZ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8$X()A_0S{FT9P&S%BnH2BT= zulRewZ+G5kfZyBUTkGI^4SsVz>w7;axYogW_+xrPaD88{h3SiR#{Wtk+^d6+*TE|W zN1U>MHj7_M;2`1oB}x>E6)&M%T+a0h6-u}#3+0pJlo%^aBxF}yB{;qnv*~iyYFB{x zUOvsH(kkUKl3(Ow2_?L&GwP$(cCs!sRU#ZyCZT0iOTNd4ASdnn>60Aa&Gsk+#o-`5 zp35MBA}n#U)+6OI@uoa(9sto-(j$~8XK{eCEz2q6S4MEgDkL(r%T2WLt(|WjeA~yj zPQG=~uE|6zIps>)uQ=n_;~8zCf_uUlnaJf`2PcLR&o_Xkh*RlEDjl0j1DO<Uq51=|9@%I4m7Gdc^4&8tQq)HPh=W7@A;cajoh)L= z;|%$XpDvXUW9Yo;mW!fthr_3RdXj^xNkXZT^}VzkIG&n=>wi3^rd^kuzNe1%JbvV` zPQU+^V_IYX;BSYedjFS6x6#!$bFS;S22*?eJ}B4k1nV;C{$wR0u1mRAQ+xehD4!EW z_Q7%L{v*qf_&dq9lG~ zQ~w&j85B31nTY$;zt*S9PphJE&Owkq4}oJ+`$Y**`LHO5{cHaCyUr%PqNnw@@^b-u z-kUXkwI2hxN5mZZ>DzSF`hca2{;7rETl`0M>or~`!a|Fw|4)=SFYQA6Pxzrx=V zd;QGo|F-&n?z9Ff24VkPSFnoOuhiAz=#1DY)A^|K3urK=??>xQ{l7J=ACCWru;u^w z)L!e+5-&{9o$P-Kod#TLuXVxHhqRxCEkC>3YrUcWGwc7!yndK8evRujV4Od-*Z-Gg2cK^ z%HKv?=f3HX+gV#6(x6N@K5xcxsefI6?*h}<(OjWLN$~qCh;67}g_qE{o&AC>MCltL IgOEu71|WJOg8%>k diff --git a/c/test/src/main.c b/c/test/src/main.c index df4aeae..0a1ea61 100644 --- a/c/test/src/main.c +++ b/c/test/src/main.c @@ -1,25 +1,10 @@ -#include -#include -#include -void strinit(char **str1,const char *str2){ - *str1=(char *)malloc(strlen(str2+1)); - sprintf(*str1,"%s",str2); -} -struct test{ - int type[2]; - char *name; - struct test *next; -}; -struct test* add(){ - struct test *temp=(struct test*)malloc(sizeof(struct test)); - return temp; -} +#include "../include/head.h" int main(){ struct test *test1=add(); test1->type[0]=1; - //test1->name=(char *)malloc(12); - //sprintf((test1->name),"hello world"); - strinit(&(test1->name),"hello world"); + strval(&(test1->name),"hello ",1); + strval(&(test1->name),"world",2); + strval(&(test1->name),"goodbye world",3); printf("name:%s\nnum:%d\n",(test1->name),(test1->type[0])); return 0; } From 6a8668be46a04e95e153a5dd0e18d156cb673da9 Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Fri, 17 Dec 2021 16:40:00 +0800 Subject: [PATCH 44/82] separate .h file --- c/test/include/head.h | 40 ++++++++++++---------------------------- c/test/include/str.h | 4 ++++ c/test/src/main.c | 3 ++- c/test/src/str.c | 25 +++++++++++++++++++++++++ 4 files changed, 43 insertions(+), 29 deletions(-) create mode 100644 c/test/include/str.h create mode 100644 c/test/src/str.c diff --git a/c/test/include/head.h b/c/test/include/head.h index 5ced7e7..9be8f22 100644 --- a/c/test/include/head.h +++ b/c/test/include/head.h @@ -1,36 +1,20 @@ #include #include #include -void strval(char **str1,const char *str2,int type){ - switch (type) - { - case 1 : { - *str1=(char *)malloc(strlen(str2+1)); - sprintf(*str1,"%s",str2); - printf("case 1 :%s\n",*str1); - break; - } - case 2 : { - *str1 = (char *)realloc(*str1,strlen(*str1)+strlen(str2)+1); - sprintf(*str1,"%s%s",*str1,str2); - printf("case 2 :%s\n",*str1); - } - break; - case 3 : { - free(*str1); - *str1=(char *)malloc(strlen(str2+1)); - sprintf(*str1,"%s",str2); - printf("case 3 :%s\n",*str1); - break; - } - } -} -struct test{ +#include "./str.h" +struct body_link{ + int type; + void *data; + struct body_link *next; +}; +struct head_link{ int type[2]; - char *name; + char *name; + struct body_link *head; + struct body_link **location; struct test *next; }; -struct test* add(){ - struct test *temp=(struct test*)malloc(sizeof(struct test)); +struct head_link* add(){ + struct head_link *temp=(struct head_link*)malloc(sizeof(struct head_link)); return temp; } diff --git a/c/test/include/str.h b/c/test/include/str.h new file mode 100644 index 0000000..3bea0aa --- /dev/null +++ b/c/test/include/str.h @@ -0,0 +1,4 @@ +#include +#include +#include +void strval(char **str1,const char *str2,int type); diff --git a/c/test/src/main.c b/c/test/src/main.c index 0a1ea61..640fb1b 100644 --- a/c/test/src/main.c +++ b/c/test/src/main.c @@ -1,6 +1,7 @@ #include "../include/head.h" +#include "../include/str.h" int main(){ - struct test *test1=add(); + struct head_link *test1=add(); test1->type[0]=1; strval(&(test1->name),"hello ",1); strval(&(test1->name),"world",2); diff --git a/c/test/src/str.c b/c/test/src/str.c new file mode 100644 index 0000000..375d97f --- /dev/null +++ b/c/test/src/str.c @@ -0,0 +1,25 @@ +#include "../include/str.h" +void strval(char **str1,const char *str2,int type){ + switch (type) + { + case 1 : { + *str1=(char *)malloc(strlen(str2+1)); + sprintf(*str1,"%s",str2); + printf("case 1 :%s\n",*str1); + break; + } + case 2 : { + *str1 = (char *)realloc(*str1,strlen(*str1)+strlen(str2)+1); + sprintf(*str1,"%s%s",*str1,str2); + printf("case 2 :%s\n",*str1); + } + break; + case 3 : { + free(*str1); + *str1=(char *)malloc(strlen(str2+1)); + sprintf(*str1,"%s",str2); + printf("case 3 :%s\n",*str1); + break; + } + } +} From 3dc08af1a5a68cea7e9166d86cb9f9e08a6c42a2 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Fri, 17 Dec 2021 23:18:52 +0800 Subject: [PATCH 45/82] new file: ../../c/fileio/src/file.txt new file: main.go new file: test.bat new file: test.go --- c/fileio/src/file.txt | 1 + go/web/main.go | 32 ++++++++++++++++++++++++++++++++ go/web/test.bat | 1 + go/web/test.go | 23 +++++++++++++++++++++++ 4 files changed, 57 insertions(+) create mode 100644 c/fileio/src/file.txt create mode 100644 go/web/main.go create mode 100644 go/web/test.bat create mode 100644 go/web/test.go diff --git a/c/fileio/src/file.txt b/c/fileio/src/file.txt new file mode 100644 index 0000000..c493024 --- /dev/null +++ b/c/fileio/src/file.txt @@ -0,0 +1 @@ +this is an apple diff --git a/go/web/main.go b/go/web/main.go new file mode 100644 index 0000000..9677115 --- /dev/null +++ b/go/web/main.go @@ -0,0 +1,32 @@ +package main + +import ( + "fmt" + "log" + "net/http" +) + +var indexhtml = ` + + + + + This is Mayuri + + +

Title

+

Paragraph

+ + +` + +func index(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, indexhtml) +} +func main() { + http.HandleFunc("/test", index) + err := http.ListenAndServe(":3344", nil) + if err != nil { + log.Fatal("ListenAndServe", err) + } +} diff --git a/go/web/test.bat b/go/web/test.bat new file mode 100644 index 0000000..da4a1b1 --- /dev/null +++ b/go/web/test.bat @@ -0,0 +1 @@ +go build main.go && main.exe diff --git a/go/web/test.go b/go/web/test.go new file mode 100644 index 0000000..3732a85 --- /dev/null +++ b/go/web/test.go @@ -0,0 +1,23 @@ +package main + +import ( + "fmt" + "log" + "net/http" +) + +//go doc Server +func index(w http.ResponseWriter, r *http.Request) { + fmt.Fprintf(w, "Hello world!") + //fmt.Fprintf(w io.Writer,format string,a ...interface{})(n int, err error) + //io.WriteString(w io.Writer,String string) +} +func main() { + http.HandleFunc("/", index) + //http.HandleFunc(pattern string,handler func(w http.ResponseWriter,w *http.Request) + err := http.ListenAndServe(":9090", nil) + //http.ListenAndServe(addr string, handler Handler) + if err != nil { + log.Fatal("ListenAndServe:", err) + } +} From 2e94d6ec1de0e35fdecfd1cb46118673508ca366 Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Sat, 18 Dec 2021 11:00:54 +0800 Subject: [PATCH 46/82] new file: c/composition/build.sh new file: c/fd/build.sh new file: c/fileio/build.sh new file: c/helloworld/build.sh modified: c/link_table/build.sh modified: c/link_test/build.sh new file: c/rainbowBomb/build.sh new file: c/sqlite/build.sh new file: c/sqrt/build.sh new file: c/string_operation/build.sh --- c/composition/build.sh | 7 +++++++ c/fd/build.sh | 7 +++++++ c/fileio/build.sh | 7 +++++++ c/helloworld/build.sh | 7 +++++++ c/link_table/build.sh | 1 + c/link_test/build.sh | 1 + c/rainbowBomb/build.sh | 7 +++++++ c/sqlite/build.sh | 7 +++++++ c/sqrt/build.sh | 7 +++++++ c/string_operation/build.sh | 7 +++++++ 10 files changed, 58 insertions(+) create mode 100644 c/composition/build.sh create mode 100644 c/fd/build.sh create mode 100644 c/fileio/build.sh create mode 100644 c/helloworld/build.sh create mode 100644 c/rainbowBomb/build.sh create mode 100644 c/sqlite/build.sh create mode 100644 c/sqrt/build.sh create mode 100644 c/string_operation/build.sh diff --git a/c/composition/build.sh b/c/composition/build.sh new file mode 100644 index 0000000..9ed0f62 --- /dev/null +++ b/c/composition/build.sh @@ -0,0 +1,7 @@ + +rm -rf build +mkdir build +cd build +cmake .. +make +./bin diff --git a/c/fd/build.sh b/c/fd/build.sh new file mode 100644 index 0000000..9ed0f62 --- /dev/null +++ b/c/fd/build.sh @@ -0,0 +1,7 @@ + +rm -rf build +mkdir build +cd build +cmake .. +make +./bin diff --git a/c/fileio/build.sh b/c/fileio/build.sh new file mode 100644 index 0000000..9ed0f62 --- /dev/null +++ b/c/fileio/build.sh @@ -0,0 +1,7 @@ + +rm -rf build +mkdir build +cd build +cmake .. +make +./bin diff --git a/c/helloworld/build.sh b/c/helloworld/build.sh new file mode 100644 index 0000000..9ed0f62 --- /dev/null +++ b/c/helloworld/build.sh @@ -0,0 +1,7 @@ + +rm -rf build +mkdir build +cd build +cmake .. +make +./bin diff --git a/c/link_table/build.sh b/c/link_table/build.sh index b7b8e70..9ed0f62 100644 --- a/c/link_table/build.sh +++ b/c/link_table/build.sh @@ -4,3 +4,4 @@ mkdir build cd build cmake .. make +./bin diff --git a/c/link_test/build.sh b/c/link_test/build.sh index b7b8e70..9ed0f62 100644 --- a/c/link_test/build.sh +++ b/c/link_test/build.sh @@ -4,3 +4,4 @@ mkdir build cd build cmake .. make +./bin diff --git a/c/rainbowBomb/build.sh b/c/rainbowBomb/build.sh new file mode 100644 index 0000000..9ed0f62 --- /dev/null +++ b/c/rainbowBomb/build.sh @@ -0,0 +1,7 @@ + +rm -rf build +mkdir build +cd build +cmake .. +make +./bin diff --git a/c/sqlite/build.sh b/c/sqlite/build.sh new file mode 100644 index 0000000..9ed0f62 --- /dev/null +++ b/c/sqlite/build.sh @@ -0,0 +1,7 @@ + +rm -rf build +mkdir build +cd build +cmake .. +make +./bin diff --git a/c/sqrt/build.sh b/c/sqrt/build.sh new file mode 100644 index 0000000..9ed0f62 --- /dev/null +++ b/c/sqrt/build.sh @@ -0,0 +1,7 @@ + +rm -rf build +mkdir build +cd build +cmake .. +make +./bin diff --git a/c/string_operation/build.sh b/c/string_operation/build.sh new file mode 100644 index 0000000..9ed0f62 --- /dev/null +++ b/c/string_operation/build.sh @@ -0,0 +1,7 @@ + +rm -rf build +mkdir build +cd build +cmake .. +make +./bin From 081a472f465ac80f75a0e5ee39e74e6ac7d460a9 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Sat, 18 Dec 2021 11:09:54 +0800 Subject: [PATCH 47/82] modified: fd/CMakeLists.txt modified: fileio/CMakeLists.txt modified: helloworld/CMakeLists.txt modified: rainbowBomb/CMakeLists.txt modified: sqrt/CMakeLists.txt --- c/fd/CMakeLists.txt | 2 +- c/fileio/CMakeLists.txt | 4 ++-- c/helloworld/CMakeLists.txt | 8 ++++---- c/rainbowBomb/CMakeLists.txt | 6 +++--- c/sqrt/CMakeLists.txt | 8 ++++---- 5 files changed, 14 insertions(+), 14 deletions(-) diff --git a/c/fd/CMakeLists.txt b/c/fd/CMakeLists.txt index dfcd2b0..48a6962 100644 --- a/c/fd/CMakeLists.txt +++ b/c/fd/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.9) -PROJECT(fd) +PROJECT(FD) INCLUDE_DIRECTORIES(./include) AUX_SOURCE_DIRECTORY(./src DIR_SRC) ADD_EXECUTABLE(./bin ${DIR_SRC}) diff --git a/c/fileio/CMakeLists.txt b/c/fileio/CMakeLists.txt index 3ca4e38..c965929 100644 --- a/c/fileio/CMakeLists.txt +++ b/c/fileio/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.9) -PROJECT(fileio) +PROJECT(FILEIO) INCLUDE_DIRECTORIES(./include) AUX_SOURCE_DIRECTORY(./src DIR_SRC) -ADD_EXECUTABLE(../bin/bin ${DIR_SRC}) +ADD_EXECUTABLE(./bin ${DIR_SRC}) diff --git a/c/helloworld/CMakeLists.txt b/c/helloworld/CMakeLists.txt index 25ba0e5..3735e36 100644 --- a/c/helloworld/CMakeLists.txt +++ b/c/helloworld/CMakeLists.txt @@ -1,8 +1,8 @@ cmake_minimum_required (VERSION 2.9) -project(helloworld) -#include_directories(include) -AUX_SOURCE_DIRECTORY(src DIR_SRCS) +project(HELLOWORLD) +#include_directories(./include) +AUX_SOURCE_DIRECTORY(./src DIR_SRCS) set(SRCS ${DIR_SRCS}) #message(${DIR_SRCS}) -add_executable(helloworld ${SRCS}) +add_executable(./bin ${SRCS}) diff --git a/c/rainbowBomb/CMakeLists.txt b/c/rainbowBomb/CMakeLists.txt index 0710332..f747062 100644 --- a/c/rainbowBomb/CMakeLists.txt +++ b/c/rainbowBomb/CMakeLists.txt @@ -1,7 +1,7 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.9) PROJECT(RainbowBomb) -INCLUDE_DIRECTORIES(include) -AUX_SOURCE_DIRECTORY(src DIR_SRCS) -ADD_EXECUTABLE(../bin/bin ${DIR_SRCS}) +INCLUDE_DIRECTORIES(./include) +AUX_SOURCE_DIRECTORY(./src DIR_SRCS) +ADD_EXECUTABLE(./bin ${DIR_SRCS}) diff --git a/c/sqrt/CMakeLists.txt b/c/sqrt/CMakeLists.txt index a0fbacb..4756197 100644 --- a/c/sqrt/CMakeLists.txt +++ b/c/sqrt/CMakeLists.txt @@ -1,5 +1,5 @@ CMAKE_MINIMUM_REQUIRED(VERSION 2.9) -PROJECT(test_math) -INCLUDE_DIRECTORIES(include) -AUX_SOURCE_DIRECTORY(src DIR_SRCS) -ADD_EXECUTABLE(../bin/bin ${DIR_SRCS}) +PROJECT(TEST_MATH) +INCLUDE_DIRECTORIES(./include) +AUX_SOURCE_DIRECTORY(./src DIR_SRCS) +ADD_EXECUTABLE(./bin ${DIR_SRCS}) From 05311b4bdfec36a4d5cfcd1d96ea4b7d533f9752 Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Sat, 18 Dec 2021 14:45:56 +0800 Subject: [PATCH 48/82] new file: build.sh new file: build.bat --- go/web/{test.bat => build.bat} | 0 go/web/build.sh | 1 + 2 files changed, 1 insertion(+) rename go/web/{test.bat => build.bat} (100%) create mode 100644 go/web/build.sh diff --git a/go/web/test.bat b/go/web/build.bat similarity index 100% rename from go/web/test.bat rename to go/web/build.bat diff --git a/go/web/build.sh b/go/web/build.sh new file mode 100644 index 0000000..9cb5afc --- /dev/null +++ b/go/web/build.sh @@ -0,0 +1 @@ +go build main.go && ./main From 5a74e70b60355f5567fc4c4807de939ab494d1de Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Sat, 18 Dec 2021 16:01:07 +0800 Subject: [PATCH 49/82] =?UTF-8?q?=09=E8=B2=BC=E8=B4=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit new file: resistor/CMakeLists.txt new file: resistor/build.sh new file: resistor/include/resistorcal.h new file: resistor/src/main.c new file: resistor/src/resistorcal.c new file: ../go/r/01/main.go --- c/resistor/CMakeLists.txt | 5 +++++ c/resistor/build.sh | 7 +++++++ c/resistor/include/resistorcal.h | 4 ++++ c/resistor/src/main.c | 25 ++++++++++++++++++++++++ c/resistor/src/resistorcal.c | 8 ++++++++ go/r/01/main.go | 33 ++++++++++++++++++++++++++++++++ 6 files changed, 82 insertions(+) create mode 100644 c/resistor/CMakeLists.txt create mode 100644 c/resistor/build.sh create mode 100644 c/resistor/include/resistorcal.h create mode 100644 c/resistor/src/main.c create mode 100644 c/resistor/src/resistorcal.c create mode 100644 go/r/01/main.go diff --git a/c/resistor/CMakeLists.txt b/c/resistor/CMakeLists.txt new file mode 100644 index 0000000..e04f33b --- /dev/null +++ b/c/resistor/CMakeLists.txt @@ -0,0 +1,5 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.9) +PROJECT(RESISTOR) +INCLUDE_DIRECTORIES(./include) +AUX_SOURCE_DIRECTORY(./src DIR_SRC) +ADD_EXECUTABLE(./bin ${DIR_SRC}) diff --git a/c/resistor/build.sh b/c/resistor/build.sh new file mode 100644 index 0000000..cf49c9f --- /dev/null +++ b/c/resistor/build.sh @@ -0,0 +1,7 @@ + +rm -rf build +mkdir build +cd build +cmake .. -G "MinGW Makefiles" +make +./bin diff --git a/c/resistor/include/resistorcal.h b/c/resistor/include/resistorcal.h new file mode 100644 index 0000000..d2846d0 --- /dev/null +++ b/c/resistor/include/resistorcal.h @@ -0,0 +1,4 @@ +#ifndef _RESISTOR_H +#define _RESISTOR_H +double resistorcal(double R1,double R2,char type); +#endif diff --git a/c/resistor/src/main.c b/c/resistor/src/main.c new file mode 100644 index 0000000..4c5808f --- /dev/null +++ b/c/resistor/src/main.c @@ -0,0 +1,25 @@ +#include +#include "../include/resistorcal.h" +int main(){ + printf("Welcome to Mayuri's Resistor Calculator(Only for separate routes and 2 resistor in it)\n"); + printf("Make your choice\n> 1.Your have the two resistors of separate routes\n> 2. Your have one of the resistors in the separate routes and the total resistor\nAny other choice is to exit\n"); + char choice; + scanf("%c",&choice); + switch (choice){ + case '1' : printf("Please input your args as [R1 R2]:\n");break; + case '2' : printf("Please input your args as [R1 R]:\n");break; + default : printf("exiting\n");return 0;break; + } + double r1 = -1 ,r2 = -1; + scanf("%lf %lf",&r1,&r2); + while ((r1<0)||(r2<0)) { + printf("args don't meet the requirement(R>0)\n"); + printf("please input them again:\n"); + scanf("%lf %lf",&r1,&r2); + + } + switch (choice){ + case '1' : printf("R=%lf",resistorcal(r1,r2,choice));break; + case '2' : printf("R2=%lf",resistorcal(r1,r2,choice));break; + } +} diff --git a/c/resistor/src/resistorcal.c b/c/resistor/src/resistorcal.c new file mode 100644 index 0000000..b106d0d --- /dev/null +++ b/c/resistor/src/resistorcal.c @@ -0,0 +1,8 @@ +#include +#include "../include/resistorcal.h" +double resistorcal(double R1,double R2,char type){ + switch (type){ + case '1' : return (R1*R2)/(R1+R2); break; + case '2' : return (R1*R2)/(R1-R2); break; + } +} diff --git a/go/r/01/main.go b/go/r/01/main.go new file mode 100644 index 0000000..25b95a3 --- /dev/null +++ b/go/r/01/main.go @@ -0,0 +1,33 @@ +package main + +import ( + "flag" + "fmt" +) + +func main() { + r1 := (flag.Int("r1", -1, "the value of R1")) + r2 := (flag.Int("r2", -1, "the value of R2")) + r := (flag.Int("r", -1, "the value of R")) + flag.Parse() + if (-1 != *r) && (-1 != *r1) && (-1 != *r2) { + fmt.Printf("(R R1)R2=%f\n(R1 R2)R=%f\n", float64((*r1)*(*r))/float64(*r1-*r), float64((*r1)*(*r2))/float64((*r1)+(*r2))) + return + } + if (-1 == *r1) && (-1 != *r2) { + *r1 = *r2 + *r2 = -1 + } + if -1 == *r1 || ((-1 == *r) && (-1 == *r2)) { + fmt.Printf("plz input args\n") + return + } + if *r != -1 { + fmt.Printf("R2=%f\n", float64((*r1)*(*r))/float64(*r1-*r)) + return + } + if *r2 != -1 { + fmt.Printf("R=%f\n", float64((*r1)*(*r2))/float64((*r1)+(*r2))) + return + } +} From 3441905e9ed01ecb85d76d4608b36f31decc20fb Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Sat, 18 Dec 2021 21:40:06 +0800 Subject: [PATCH 50/82] new file: CMakeLists.txt new file: build.sh new file: include/head.hpp new file: include/onebot.h new file: include/str.h new file: src/main.cpp new file: src/onebot.cpp new file: src/str.cpp --- cpp/test/CMakeLists.txt | 5 +++++ cpp/test/build.sh | 7 +++++++ cpp/test/include/head.hpp | 24 ++++++++++++++++++++++++ cpp/test/include/onebot.h | 0 cpp/test/include/str.h | 4 ++++ cpp/test/src/main.cpp | 11 +++++++++++ cpp/test/src/onebot.cpp | 0 cpp/test/src/str.cpp | 25 +++++++++++++++++++++++++ 8 files changed, 76 insertions(+) create mode 100644 cpp/test/CMakeLists.txt create mode 100644 cpp/test/build.sh create mode 100644 cpp/test/include/head.hpp create mode 100644 cpp/test/include/onebot.h create mode 100644 cpp/test/include/str.h create mode 100644 cpp/test/src/main.cpp create mode 100644 cpp/test/src/onebot.cpp create mode 100644 cpp/test/src/str.cpp diff --git a/cpp/test/CMakeLists.txt b/cpp/test/CMakeLists.txt new file mode 100644 index 0000000..c19725b --- /dev/null +++ b/cpp/test/CMakeLists.txt @@ -0,0 +1,5 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.9) +PROJECT(ONEBOT_C) +INCLUDE_DIRECTORIES(./include) +AUX_SOURCE_DIRECTORY(./src DIR_SRC) +ADD_EXECUTABLE(./bin ${DIR_SRC}) diff --git a/cpp/test/build.sh b/cpp/test/build.sh new file mode 100644 index 0000000..cf49c9f --- /dev/null +++ b/cpp/test/build.sh @@ -0,0 +1,7 @@ + +rm -rf build +mkdir build +cd build +cmake .. -G "MinGW Makefiles" +make +./bin diff --git a/cpp/test/include/head.hpp b/cpp/test/include/head.hpp new file mode 100644 index 0000000..e70791e --- /dev/null +++ b/cpp/test/include/head.hpp @@ -0,0 +1,24 @@ +#include +#include +#include +#include +//extern "C" +//{ +#include "../include/str.h" +//} +struct body_link{ + int type; + void *data; + struct body_link *next; +}; +struct head_link{ + int type[2]; + char *name; + struct body_link *head; + struct body_link **location; + struct test *next; +}; +struct head_link* add(){ + struct head_link *temp=(struct head_link*)malloc(sizeof(struct head_link)); + return temp; +} diff --git a/cpp/test/include/onebot.h b/cpp/test/include/onebot.h new file mode 100644 index 0000000..e69de29 diff --git a/cpp/test/include/str.h b/cpp/test/include/str.h new file mode 100644 index 0000000..3e54abc --- /dev/null +++ b/cpp/test/include/str.h @@ -0,0 +1,4 @@ +#include +#include +#include +void strval(char **str1,const char *str2,int type); diff --git a/cpp/test/src/main.cpp b/cpp/test/src/main.cpp new file mode 100644 index 0000000..8b9abc7 --- /dev/null +++ b/cpp/test/src/main.cpp @@ -0,0 +1,11 @@ +#include "../include/head.hpp" +int main(){ + struct head_link *test1=add(); + test1->type[0]=1; + strval(&(test1->name),"hello ",1); + strval(&(test1->name),"world",2); + strval(&(test1->name),"goodbye world",3); + printf("name:%s\nnum:%d\n",(test1->name),(test1->type[0])); + return 0; +} + diff --git a/cpp/test/src/onebot.cpp b/cpp/test/src/onebot.cpp new file mode 100644 index 0000000..e69de29 diff --git a/cpp/test/src/str.cpp b/cpp/test/src/str.cpp new file mode 100644 index 0000000..375d97f --- /dev/null +++ b/cpp/test/src/str.cpp @@ -0,0 +1,25 @@ +#include "../include/str.h" +void strval(char **str1,const char *str2,int type){ + switch (type) + { + case 1 : { + *str1=(char *)malloc(strlen(str2+1)); + sprintf(*str1,"%s",str2); + printf("case 1 :%s\n",*str1); + break; + } + case 2 : { + *str1 = (char *)realloc(*str1,strlen(*str1)+strlen(str2)+1); + sprintf(*str1,"%s%s",*str1,str2); + printf("case 2 :%s\n",*str1); + } + break; + case 3 : { + free(*str1); + *str1=(char *)malloc(strlen(str2+1)); + sprintf(*str1,"%s",str2); + printf("case 3 :%s\n",*str1); + break; + } + } +} From b83b225e0d60f183420ce906a7fedb83ed0270cb Mon Sep 17 00:00:00 2001 From: Mayuri <1770747317@qq.com> Date: Sat, 18 Dec 2021 22:07:21 +0800 Subject: [PATCH 51/82] Avoid include a Header more than once --- cpp/test/include/head.hpp | 3 +++ cpp/test/include/onebot.h | 7 +++++++ cpp/test/include/str.h | 3 +++ cpp/test/src/onebot.cpp | 2 ++ cpp/test/src/{main.cpp => test.cpp} | 0 5 files changed, 15 insertions(+) rename cpp/test/src/{main.cpp => test.cpp} (100%) diff --git a/cpp/test/include/head.hpp b/cpp/test/include/head.hpp index e70791e..7bbff47 100644 --- a/cpp/test/include/head.hpp +++ b/cpp/test/include/head.hpp @@ -1,3 +1,5 @@ +#ifndef _head_hpp +#define _head_hpp #include #include #include @@ -22,3 +24,4 @@ struct head_link* add(){ struct head_link *temp=(struct head_link*)malloc(sizeof(struct head_link)); return temp; } +#endif diff --git a/cpp/test/include/onebot.h b/cpp/test/include/onebot.h index e69de29..3513430 100644 --- a/cpp/test/include/onebot.h +++ b/cpp/test/include/onebot.h @@ -0,0 +1,7 @@ +#ifndef _onebot_h +#define _onebot_h +#include +#include +#include +#include +#endif diff --git a/cpp/test/include/str.h b/cpp/test/include/str.h index 3e54abc..09edd87 100644 --- a/cpp/test/include/str.h +++ b/cpp/test/include/str.h @@ -1,4 +1,7 @@ +#ifndef _str_h +#define _str_h #include #include #include void strval(char **str1,const char *str2,int type); +#endif diff --git a/cpp/test/src/onebot.cpp b/cpp/test/src/onebot.cpp index e69de29..b258e12 100644 --- a/cpp/test/src/onebot.cpp +++ b/cpp/test/src/onebot.cpp @@ -0,0 +1,2 @@ +#include "../include/onebot.h" + diff --git a/cpp/test/src/main.cpp b/cpp/test/src/test.cpp similarity index 100% rename from cpp/test/src/main.cpp rename to cpp/test/src/test.cpp From 6a2afabf3be9cb6308d4b921fff9976c5eb2548d Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Wed, 22 Dec 2021 17:42:29 +0800 Subject: [PATCH 52/82] new file: r/CMakeLists.txt new file: r/main.c new file: r/resistor/CMakeLists.txt new file: r/resistor/build.sh new file: r/resistor/resistorcal.c new file: r/resistor/resistorcal.h modified: resistor/src/main.c new file: ../go/helloworld/main.go --- c/r/CMakeLists.txt | 6 ++++++ c/r/main.c | 25 +++++++++++++++++++++++++ c/r/resistor/CMakeLists.txt | 2 ++ c/r/resistor/build.sh | 1 + c/r/resistor/resistorcal.c | 9 +++++++++ c/r/resistor/resistorcal.h | 4 ++++ c/resistor/src/main.c | 4 ++-- go/helloworld/main.go | 7 +++++++ 8 files changed, 56 insertions(+), 2 deletions(-) create mode 100644 c/r/CMakeLists.txt create mode 100644 c/r/main.c create mode 100644 c/r/resistor/CMakeLists.txt create mode 100644 c/r/resistor/build.sh create mode 100644 c/r/resistor/resistorcal.c create mode 100644 c/r/resistor/resistorcal.h create mode 100644 go/helloworld/main.go diff --git a/c/r/CMakeLists.txt b/c/r/CMakeLists.txt new file mode 100644 index 0000000..2ccc98f --- /dev/null +++ b/c/r/CMakeLists.txt @@ -0,0 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.9) +PROJECT(RESISTOR) +ADD_SUBDIRECTORY(resistor) +AUX_SOURCE_DIRECTORY(. DIR_SRC) +ADD_EXECUTABLE(bin ${DIR_SRC}) +TARGET_LINK_LIBRARIES(bin RESISTOR) diff --git a/c/r/main.c b/c/r/main.c new file mode 100644 index 0000000..1201448 --- /dev/null +++ b/c/r/main.c @@ -0,0 +1,25 @@ +#include +#include "resistor/resistorcal.h" +int main(){ + printf("Welcome to Mayuri's Resistor Calculator(Only for separate routes and 2 resistor in it)\n"); + printf("Make your choice\n> 1.Your have the two resistors of separate routes\n> 2. Your have one of the resistors in the separate routes and the total resistor\nAny other choice is to exit\n"); + char choice; + scanf("%c",&choice); + switch (choice){ + case '1' : printf("Please input your args as [R1 R2]:\n");break; + case '2' : printf("Please input your args as [R1 R]:\n");break; + default : printf("exiting\n");return 0;break; + } + double r1 = -1 ,r2 = -1; + scanf("%lf %lf",&r1,&r2); + while ((r1<0)||(r2<0)) { + printf("args don't meet the requirement(R>0)\n"); + printf("please input them again:\n"); + scanf("%lf %lf",&r1,&r2); + + } + switch (choice){ + case '1' : printf("R=%lf\n",resistorcal(r1,r2,choice));break; + case '2' : printf("R2=%lf\n",resistorcal(r1,r2,choice));break; + } +} diff --git a/c/r/resistor/CMakeLists.txt b/c/r/resistor/CMakeLists.txt new file mode 100644 index 0000000..d644235 --- /dev/null +++ b/c/r/resistor/CMakeLists.txt @@ -0,0 +1,2 @@ +AUX_SOURCE_DIRECTORY(. DIR_LIB_SRCS) +ADD_LIBRARY(RESISTOR ${DIR_LIB_SRCS}) diff --git a/c/r/resistor/build.sh b/c/r/resistor/build.sh new file mode 100644 index 0000000..25710ea --- /dev/null +++ b/c/r/resistor/build.sh @@ -0,0 +1 @@ +rm -rf build && mkdir -p build &&cd build && cmake ..&& make diff --git a/c/r/resistor/resistorcal.c b/c/r/resistor/resistorcal.c new file mode 100644 index 0000000..1b30fb3 --- /dev/null +++ b/c/r/resistor/resistorcal.c @@ -0,0 +1,9 @@ +#include +#include "resistorcal.h" +double resistorcal(double R1,double R2,char type){ + switch (type){ + case '1' : return (R1*R2)/(R1+R2); break; + case '2' : return (R1*R2)/(R1-R2); break; + } + return (double)0; +} diff --git a/c/r/resistor/resistorcal.h b/c/r/resistor/resistorcal.h new file mode 100644 index 0000000..d2846d0 --- /dev/null +++ b/c/r/resistor/resistorcal.h @@ -0,0 +1,4 @@ +#ifndef _RESISTOR_H +#define _RESISTOR_H +double resistorcal(double R1,double R2,char type); +#endif diff --git a/c/resistor/src/main.c b/c/resistor/src/main.c index 4c5808f..45011c1 100644 --- a/c/resistor/src/main.c +++ b/c/resistor/src/main.c @@ -19,7 +19,7 @@ int main(){ } switch (choice){ - case '1' : printf("R=%lf",resistorcal(r1,r2,choice));break; - case '2' : printf("R2=%lf",resistorcal(r1,r2,choice));break; + case '1' : printf("R=%lf\n",resistorcal(r1,r2,choice));break; + case '2' : printf("R2=%lf\n",resistorcal(r1,r2,choice));break; } } diff --git a/go/helloworld/main.go b/go/helloworld/main.go new file mode 100644 index 0000000..44962e2 --- /dev/null +++ b/go/helloworld/main.go @@ -0,0 +1,7 @@ +package main + +import "fmt" + +func main() { + fmt.Println("helloworld") +} From 7655d319b902880758b9e975e9588474f17512b9 Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Sat, 25 Dec 2021 20:54:56 +0800 Subject: [PATCH 53/82] new file: 1.asm new file: 2.asm new file: 3.asm new file: 4.asm new file: a.c new file: b.c new file: first.asm new file: first.c new file: test.asm --- asm/1.asm | 9 +++++++++ asm/2.asm | 11 +++++++++++ asm/3.asm | 7 +++++++ asm/4.asm | 18 ++++++++++++++++++ asm/a.c | 7 +++++++ asm/b.c | 16 ++++++++++++++++ asm/first.asm | 5 +++++ asm/first.c | 4 ++++ asm/test.asm | 13 +++++++++++++ 9 files changed, 90 insertions(+) create mode 100644 asm/1.asm create mode 100644 asm/2.asm create mode 100644 asm/3.asm create mode 100644 asm/4.asm create mode 100644 asm/a.c create mode 100644 asm/b.c create mode 100755 asm/first.asm create mode 100755 asm/first.c create mode 100644 asm/test.asm diff --git a/asm/1.asm b/asm/1.asm new file mode 100644 index 0000000..06384bd --- /dev/null +++ b/asm/1.asm @@ -0,0 +1,9 @@ +global main + +main: + mov eax, 1 + add eax, 2 + add eax, 3 + add eax, 4 + add eax, 5 + ret diff --git a/asm/2.asm b/asm/2.asm new file mode 100644 index 0000000..a2ce70d --- /dev/null +++ b/asm/2.asm @@ -0,0 +1,11 @@ +global main + +main: + mov eax, 1 + mov ebx, 2 + mov ecx, 3 + mov edx, 4 + add eax, ebx + add eax, ecx + add eax, edx + ret diff --git a/asm/3.asm b/asm/3.asm new file mode 100644 index 0000000..1f0fbd0 --- /dev/null +++ b/asm/3.asm @@ -0,0 +1,7 @@ +global main + +main: + mov eax, 5 + mov ebx, 2 + add eax, ebx + ret diff --git a/asm/4.asm b/asm/4.asm new file mode 100644 index 0000000..a83c497 --- /dev/null +++ b/asm/4.asm @@ -0,0 +1,18 @@ +global main + +main: + mov ebx, [num1] + mov ecx, [num2] + add ebx, ecx + + + mov [result], ebx + mov eax, [result] + ret + + +section .data + +num1 dw 10 +num2 dw 20 +result dw 0 diff --git a/asm/a.c b/asm/a.c new file mode 100644 index 0000000..ef9b854 --- /dev/null +++ b/asm/a.c @@ -0,0 +1,7 @@ +global main + +main: + mov eax, 5 + mov ebx, 5 + add eax, ebx + ret diff --git a/asm/b.c b/asm/b.c new file mode 100644 index 0000000..47cea18 --- /dev/null +++ b/asm/b.c @@ -0,0 +1,16 @@ +global main + +main: + mov ebx, 1 + mov ecx, 2 + add ebx, ecx + + + mov [abcd], ebx + mov eax ,[abcd] + + ret + +section .data + +abcd dw 0 diff --git a/asm/first.asm b/asm/first.asm new file mode 100755 index 0000000..b9b3093 --- /dev/null +++ b/asm/first.asm @@ -0,0 +1,5 @@ +global main + +main: + mov eax, 1 + ret diff --git a/asm/first.c b/asm/first.c new file mode 100755 index 0000000..81a17ae --- /dev/null +++ b/asm/first.c @@ -0,0 +1,4 @@ +int main() +{ + return 114514; +} diff --git a/asm/test.asm b/asm/test.asm new file mode 100644 index 0000000..b6cf408 --- /dev/null +++ b/asm/test.asm @@ -0,0 +1,13 @@ +global main + +main: + mov ebx, 1 + mov ecx, 2 + add ebx, ecx + + mov [a], ebx + mov eax, [a] + ret + +section .data +a dw 0 From a0fa005372325d2c1fdf7d60b86f4c19f9026700 Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Sat, 25 Dec 2021 21:17:08 +0800 Subject: [PATCH 54/82] modified: asm/test.asm new file: c/unicodetozh/1.c --- asm/test.asm | 12 ++++++------ c/unicodetozh/1.c | 12 ++++++++++++ 2 files changed, 18 insertions(+), 6 deletions(-) create mode 100644 c/unicodetozh/1.c diff --git a/asm/test.asm b/asm/test.asm index b6cf408..68533fb 100644 --- a/asm/test.asm +++ b/asm/test.asm @@ -1,13 +1,13 @@ global main main: - mov ebx, 1 - mov ecx, 2 - add ebx, ecx + mov ebx, 1 + mov ecx, 2 + add ebx, ecx - mov [a], ebx - mov eax, [a] - ret + mov [a], ebx + mov eax, [a] + ret section .data a dw 0 diff --git a/c/unicodetozh/1.c b/c/unicodetozh/1.c new file mode 100644 index 0000000..433323e --- /dev/null +++ b/c/unicodetozh/1.c @@ -0,0 +1,12 @@ +#include +#include +#include +int main(void) +{ +char str[12]; +wchar_t wstr[] = { 0x52B3, 0x788C, 0 }; +setlocale(LC_ALL, ""); +wcstombs(str, wstr, sizeof(str)/sizeof(char)); +printf("%s", str); +return 0; +} From cf52a980d69bbb2c22cf2f395d85a37274f037c6 Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Sat, 25 Dec 2021 21:27:24 +0800 Subject: [PATCH 55/82] deleted: a.c deleted: b.c a.asm b.asm help.md --- asm/a.c | 7 ------- asm/b.c | 16 ---------------- 2 files changed, 23 deletions(-) delete mode 100644 asm/a.c delete mode 100644 asm/b.c diff --git a/asm/a.c b/asm/a.c deleted file mode 100644 index ef9b854..0000000 --- a/asm/a.c +++ /dev/null @@ -1,7 +0,0 @@ -global main - -main: - mov eax, 5 - mov ebx, 5 - add eax, ebx - ret diff --git a/asm/b.c b/asm/b.c deleted file mode 100644 index 47cea18..0000000 --- a/asm/b.c +++ /dev/null @@ -1,16 +0,0 @@ -global main - -main: - mov ebx, 1 - mov ecx, 2 - add ebx, ecx - - - mov [abcd], ebx - mov eax ,[abcd] - - ret - -section .data - -abcd dw 0 From 371ed28fdbbaf95e024e84d55dd58fa03799bab8 Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Sat, 25 Dec 2021 21:29:56 +0800 Subject: [PATCH 56/82] modified: ../c/resistor/src/main.c renamed: ../c/r/CMakeLists.txt -> ../cmake/r/CMakeLists.txt renamed: ../c/r/main.c -> ../cmake/r/main.c renamed: ../c/r/resistor/CMakeLists.txt -> ../cmake/r/resistor/CMakeLists.txt renamed: ../c/r/resistor/build.sh -> ../cmake/r/resistor/build.sh renamed: ../c/r/resistor/resistorcal.c -> ../cmake/r/resistor/resistorcal.c renamed: ../c/r/resistor/resistorcal.h -> ../cmake/r/resistor/resistorcal.h new file: ../cmake/r1/CMakeLists.txt new file: ../cmake/r1/main.c new file: ../cmake/r1/resistor/CMakeLists.txt new file: ../cmake/r1/resistor/build.sh new file: ../cmake/r1/resistor/resistorcal.c new file: ../cmake/r1/resistor/resistorcal.h --- c/resistor/src/main.c | 1 + {c => cmake}/r/CMakeLists.txt | 0 {c => cmake}/r/main.c | 1 + {c => cmake}/r/resistor/CMakeLists.txt | 0 {c => cmake}/r/resistor/build.sh | 0 {c => cmake}/r/resistor/resistorcal.c | 0 {c => cmake}/r/resistor/resistorcal.h | 0 cmake/r1/CMakeLists.txt | 6 ++++++ cmake/r1/main.c | 26 ++++++++++++++++++++++++++ cmake/r1/resistor/CMakeLists.txt | 2 ++ cmake/r1/resistor/build.sh | 1 + cmake/r1/resistor/resistorcal.c | 9 +++++++++ cmake/r1/resistor/resistorcal.h | 4 ++++ 13 files changed, 50 insertions(+) rename {c => cmake}/r/CMakeLists.txt (100%) rename {c => cmake}/r/main.c (96%) rename {c => cmake}/r/resistor/CMakeLists.txt (100%) rename {c => cmake}/r/resistor/build.sh (100%) rename {c => cmake}/r/resistor/resistorcal.c (100%) rename {c => cmake}/r/resistor/resistorcal.h (100%) create mode 100644 cmake/r1/CMakeLists.txt create mode 100644 cmake/r1/main.c create mode 100644 cmake/r1/resistor/CMakeLists.txt create mode 100644 cmake/r1/resistor/build.sh create mode 100644 cmake/r1/resistor/resistorcal.c create mode 100644 cmake/r1/resistor/resistorcal.h diff --git a/c/resistor/src/main.c b/c/resistor/src/main.c index 45011c1..ed54a82 100644 --- a/c/resistor/src/main.c +++ b/c/resistor/src/main.c @@ -22,4 +22,5 @@ int main(){ case '1' : printf("R=%lf\n",resistorcal(r1,r2,choice));break; case '2' : printf("R2=%lf\n",resistorcal(r1,r2,choice));break; } + return 0; } diff --git a/c/r/CMakeLists.txt b/cmake/r/CMakeLists.txt similarity index 100% rename from c/r/CMakeLists.txt rename to cmake/r/CMakeLists.txt diff --git a/c/r/main.c b/cmake/r/main.c similarity index 96% rename from c/r/main.c rename to cmake/r/main.c index 1201448..b4ed5bb 100644 --- a/c/r/main.c +++ b/cmake/r/main.c @@ -22,4 +22,5 @@ int main(){ case '1' : printf("R=%lf\n",resistorcal(r1,r2,choice));break; case '2' : printf("R2=%lf\n",resistorcal(r1,r2,choice));break; } + return 0; } diff --git a/c/r/resistor/CMakeLists.txt b/cmake/r/resistor/CMakeLists.txt similarity index 100% rename from c/r/resistor/CMakeLists.txt rename to cmake/r/resistor/CMakeLists.txt diff --git a/c/r/resistor/build.sh b/cmake/r/resistor/build.sh similarity index 100% rename from c/r/resistor/build.sh rename to cmake/r/resistor/build.sh diff --git a/c/r/resistor/resistorcal.c b/cmake/r/resistor/resistorcal.c similarity index 100% rename from c/r/resistor/resistorcal.c rename to cmake/r/resistor/resistorcal.c diff --git a/c/r/resistor/resistorcal.h b/cmake/r/resistor/resistorcal.h similarity index 100% rename from c/r/resistor/resistorcal.h rename to cmake/r/resistor/resistorcal.h diff --git a/cmake/r1/CMakeLists.txt b/cmake/r1/CMakeLists.txt new file mode 100644 index 0000000..2ccc98f --- /dev/null +++ b/cmake/r1/CMakeLists.txt @@ -0,0 +1,6 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.9) +PROJECT(RESISTOR) +ADD_SUBDIRECTORY(resistor) +AUX_SOURCE_DIRECTORY(. DIR_SRC) +ADD_EXECUTABLE(bin ${DIR_SRC}) +TARGET_LINK_LIBRARIES(bin RESISTOR) diff --git a/cmake/r1/main.c b/cmake/r1/main.c new file mode 100644 index 0000000..b4ed5bb --- /dev/null +++ b/cmake/r1/main.c @@ -0,0 +1,26 @@ +#include +#include "resistor/resistorcal.h" +int main(){ + printf("Welcome to Mayuri's Resistor Calculator(Only for separate routes and 2 resistor in it)\n"); + printf("Make your choice\n> 1.Your have the two resistors of separate routes\n> 2. Your have one of the resistors in the separate routes and the total resistor\nAny other choice is to exit\n"); + char choice; + scanf("%c",&choice); + switch (choice){ + case '1' : printf("Please input your args as [R1 R2]:\n");break; + case '2' : printf("Please input your args as [R1 R]:\n");break; + default : printf("exiting\n");return 0;break; + } + double r1 = -1 ,r2 = -1; + scanf("%lf %lf",&r1,&r2); + while ((r1<0)||(r2<0)) { + printf("args don't meet the requirement(R>0)\n"); + printf("please input them again:\n"); + scanf("%lf %lf",&r1,&r2); + + } + switch (choice){ + case '1' : printf("R=%lf\n",resistorcal(r1,r2,choice));break; + case '2' : printf("R2=%lf\n",resistorcal(r1,r2,choice));break; + } + return 0; +} diff --git a/cmake/r1/resistor/CMakeLists.txt b/cmake/r1/resistor/CMakeLists.txt new file mode 100644 index 0000000..d644235 --- /dev/null +++ b/cmake/r1/resistor/CMakeLists.txt @@ -0,0 +1,2 @@ +AUX_SOURCE_DIRECTORY(. DIR_LIB_SRCS) +ADD_LIBRARY(RESISTOR ${DIR_LIB_SRCS}) diff --git a/cmake/r1/resistor/build.sh b/cmake/r1/resistor/build.sh new file mode 100644 index 0000000..25710ea --- /dev/null +++ b/cmake/r1/resistor/build.sh @@ -0,0 +1 @@ +rm -rf build && mkdir -p build &&cd build && cmake ..&& make diff --git a/cmake/r1/resistor/resistorcal.c b/cmake/r1/resistor/resistorcal.c new file mode 100644 index 0000000..1b30fb3 --- /dev/null +++ b/cmake/r1/resistor/resistorcal.c @@ -0,0 +1,9 @@ +#include +#include "resistorcal.h" +double resistorcal(double R1,double R2,char type){ + switch (type){ + case '1' : return (R1*R2)/(R1+R2); break; + case '2' : return (R1*R2)/(R1-R2); break; + } + return (double)0; +} diff --git a/cmake/r1/resistor/resistorcal.h b/cmake/r1/resistor/resistorcal.h new file mode 100644 index 0000000..d2846d0 --- /dev/null +++ b/cmake/r1/resistor/resistorcal.h @@ -0,0 +1,4 @@ +#ifndef _RESISTOR_H +#define _RESISTOR_H +double resistorcal(double R1,double R2,char type); +#endif From 02b68d66fd3820f3d08774b8d29050c90879c800 Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Sun, 26 Dec 2021 22:35:36 +0800 Subject: [PATCH 57/82] new file: asm/a.asm new file: asm/b.asm new file: asm/help.md new file: c/csqlite/main.c new file: c/csqlite/test.db renamed: c/unicodetozh/1.c -> c/unicodetozh/main.c new file: cpp/test2/main.c --- asm/a.asm | 7 +++++++ asm/b.asm | 16 ++++++++++++++++ asm/help.md | 6 ++++++ c/csqlite/main.c | 18 ++++++++++++++++++ c/csqlite/test.db | 0 c/unicodetozh/{1.c => main.c} | 0 cpp/test2/main.c | 25 +++++++++++++++++++++++++ 7 files changed, 72 insertions(+) create mode 100644 asm/a.asm create mode 100644 asm/b.asm create mode 100644 asm/help.md create mode 100644 c/csqlite/main.c create mode 100644 c/csqlite/test.db rename c/unicodetozh/{1.c => main.c} (100%) create mode 100644 cpp/test2/main.c diff --git a/asm/a.asm b/asm/a.asm new file mode 100644 index 0000000..ef9b854 --- /dev/null +++ b/asm/a.asm @@ -0,0 +1,7 @@ +global main + +main: + mov eax, 5 + mov ebx, 5 + add eax, ebx + ret diff --git a/asm/b.asm b/asm/b.asm new file mode 100644 index 0000000..47cea18 --- /dev/null +++ b/asm/b.asm @@ -0,0 +1,16 @@ +global main + +main: + mov ebx, 1 + mov ecx, 2 + add ebx, ecx + + + mov [abcd], ebx + mov eax ,[abcd] + + ret + +section .data + +abcd dw 0 diff --git a/asm/help.md b/asm/help.md new file mode 100644 index 0000000..f77d86d --- /dev/null +++ b/asm/help.md @@ -0,0 +1,6 @@ +nasm -f elf exec.asm -o exec.o +gcc -m32 exec.o -o exec +./exec ; echo $? + + +gcc -S exec.c diff --git a/c/csqlite/main.c b/c/csqlite/main.c new file mode 100644 index 0000000..2161192 --- /dev/null +++ b/c/csqlite/main.c @@ -0,0 +1,18 @@ +#include +#include +#include +int main(int argc ,char* argv[]){ + sqlite3 *db; + char zErrMsg = 0; + int rc; + rc = sqlite3_open("test.db",&db); + + if (rc){ + fprintf(stderr, "Can't open database:%s\n",sqlite3_errmsg(db)); + exit(0); + }else{ + fprintf(stderr, "Opened database successfully\n"); + } + sqlite3_close(db); + return 0; +} diff --git a/c/csqlite/test.db b/c/csqlite/test.db new file mode 100644 index 0000000..e69de29 diff --git a/c/unicodetozh/1.c b/c/unicodetozh/main.c similarity index 100% rename from c/unicodetozh/1.c rename to c/unicodetozh/main.c diff --git a/cpp/test2/main.c b/cpp/test2/main.c new file mode 100644 index 0000000..a2a4af1 --- /dev/null +++ b/cpp/test2/main.c @@ -0,0 +1,25 @@ +#include +auto caller() +{ + int *cnt = new int; + *cnt = 0; + return [&] + { + (*cnt)++; + printf("%d\n", *cnt); + if (*cnt == 4) + { + delete cnt; + } + }; +} +int main() +{ + auto next = caller(); + next(); + next(); + next(); + next(); + next(); + return 0; +} From ac9889ee1c175dc8766dbf7d305789cc0b33219e Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Sun, 26 Dec 2021 22:42:39 +0800 Subject: [PATCH 58/82] modified: first.asm modified: first.c --- asm/first.asm | 0 asm/first.c | 0 2 files changed, 0 insertions(+), 0 deletions(-) mode change 100755 => 100644 asm/first.asm mode change 100755 => 100644 asm/first.c diff --git a/asm/first.asm b/asm/first.asm old mode 100755 new mode 100644 diff --git a/asm/first.c b/asm/first.c old mode 100755 new mode 100644 From 794e883f76e3985c4ef07819fc91acc5783a6bc7 Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Tue, 28 Dec 2021 18:35:33 +0800 Subject: [PATCH 59/82] renamed: main.c -> main.cpp --- cpp/test2/{main.c => main.cpp} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename cpp/test2/{main.c => main.cpp} (100%) diff --git a/cpp/test2/main.c b/cpp/test2/main.cpp similarity index 100% rename from cpp/test2/main.c rename to cpp/test2/main.cpp From f307442ae94db7482f32a832c5f05bf47993cc1b Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Tue, 28 Dec 2021 19:55:55 +0800 Subject: [PATCH 60/82] new file: CMakeLists.txt deleted: main.c new file: src/help.md new file: src/main.c --- c/sqlite/CMakeLists.txt | 0 c/sqlite/main.c | 4 ---- c/sqlite/src/help.md | 1 + c/sqlite/src/main.c | 18 ++++++++++++++++++ 4 files changed, 19 insertions(+), 4 deletions(-) create mode 100644 c/sqlite/CMakeLists.txt delete mode 100644 c/sqlite/main.c create mode 100644 c/sqlite/src/help.md create mode 100644 c/sqlite/src/main.c diff --git a/c/sqlite/CMakeLists.txt b/c/sqlite/CMakeLists.txt new file mode 100644 index 0000000..e69de29 diff --git a/c/sqlite/main.c b/c/sqlite/main.c deleted file mode 100644 index 8b08b04..0000000 --- a/c/sqlite/main.c +++ /dev/null @@ -1,4 +0,0 @@ -#include -int main(){ - printf("%s","原神ing"); -} diff --git a/c/sqlite/src/help.md b/c/sqlite/src/help.md new file mode 100644 index 0000000..9556184 --- /dev/null +++ b/c/sqlite/src/help.md @@ -0,0 +1 @@ +gcc test.c -l sqlite3 diff --git a/c/sqlite/src/main.c b/c/sqlite/src/main.c new file mode 100644 index 0000000..75c54b0 --- /dev/null +++ b/c/sqlite/src/main.c @@ -0,0 +1,18 @@ +#include +#include +#include +int main(int argc ,char *argv[]){ + sqlite3 *db; + char *zErrMsg = 0; + int rc; + rc = sqlite3_open("test.db",&db); + if (rc){ + fprintf(stderr,"Open database failed:%s\n",sqlite3_errmsg(db)); + exit(0); + } + else{ + fprintf(stderr,"Open database successfully\n"); + } + sqlite3_close(db); + return 0; +} From 0093f0c58025eb323273065de533f20d609f3490 Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Wed, 29 Dec 2021 01:09:33 +0800 Subject: [PATCH 61/82] modified: .gitmodules --- .gitmodules | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.gitmodules b/.gitmodules index 8cff3bb..318f01c 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,7 @@ [submodule "c/GenericMakefile"] path = c/GenericMakefile url = https://github.com/MayuriNFC/GenericMakefile.git + +[submodule "cmake/examples"] + path = cmake/examples + url = https://github.com/ttroy50/cmake-examples.git From 23d0dabc342ef15c98cb2ba05e24ce7f8c409c4f Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Thu, 30 Dec 2021 18:10:39 +0800 Subject: [PATCH 62/82] new file: ../structbit/main.c new file: ../uniconbit/main.c --- c/structbit/main.c | 13 +++++++++++++ c/uniconbit/main.c | 11 +++++++++++ 2 files changed, 24 insertions(+) create mode 100644 c/structbit/main.c create mode 100644 c/uniconbit/main.c diff --git a/c/structbit/main.c b/c/structbit/main.c new file mode 100644 index 0000000..cf26a64 --- /dev/null +++ b/c/structbit/main.c @@ -0,0 +1,13 @@ +#include +int main(){ + struct test { + unsigned int a:1; + unsigned int b:2; + unsigned int c:1; + }; + struct test test2; + test2.a=3; + test2.b=1; + test2.c=-1; + printf("%d\n%d\n%d\n",test2.a,test2.b,test2.c); +} diff --git a/c/uniconbit/main.c b/c/uniconbit/main.c new file mode 100644 index 0000000..4f2119d --- /dev/null +++ b/c/uniconbit/main.c @@ -0,0 +1,11 @@ +#include +int main(){ + union test { + unsigned int a:1; + unsigned int b:2; + unsigned int c:1; + }; + union test test2; + test2.a=1; + printf("%d\n",test2.a); +} From 0f661db41674f775df1e3a381f87340258557c12 Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Sat, 1 Jan 2022 23:32:27 +0800 Subject: [PATCH 63/82] new file: GenericMakefile/.gitignore new file: GenericMakefile/LICENSE new file: GenericMakefile/README.md new file: GenericMakefile/c/hello.c new file: GenericMakefile/cpp/hello.cpp new file: example/.gitignore new file: example/.travis.yml new file: example/01-basic/A-hello-cmake/CMakeLists.txt new file: example/01-basic/A-hello-cmake/README.adoc new file: example/01-basic/A-hello-cmake/main.cpp new file: example/01-basic/B-hello-headers/CMakeLists.txt new file: example/01-basic/B-hello-headers/README.adoc new file: example/01-basic/B-hello-headers/include/Hello.h new file: example/01-basic/B-hello-headers/src/Hello.cpp new file: example/01-basic/B-hello-headers/src/main.cpp new file: example/01-basic/C-static-library/CMakeLists.txt new file: example/01-basic/C-static-library/README.adoc new file: example/01-basic/C-static-library/include/static/Hello.h new file: example/01-basic/C-static-library/src/Hello.cpp new file: example/01-basic/C-static-library/src/main.cpp new file: example/01-basic/D-shared-library/CMakeLists.txt new file: example/01-basic/D-shared-library/README.adoc new file: example/01-basic/D-shared-library/include/shared/Hello.h new file: example/01-basic/D-shared-library/src/Hello.cpp new file: example/01-basic/D-shared-library/src/main.cpp new file: example/01-basic/E-installing/CMakeLists.txt new file: example/01-basic/E-installing/README.adoc new file: example/01-basic/E-installing/cmake-examples.conf new file: example/01-basic/E-installing/include/installing/Hello.h new file: example/01-basic/E-installing/src/Hello.cpp new file: example/01-basic/E-installing/src/main.cpp new file: example/01-basic/F-build-type/CMakeLists.txt new file: example/01-basic/F-build-type/README.adoc new file: example/01-basic/F-build-type/cmake-gui-build-type.png new file: example/01-basic/F-build-type/main.cpp new file: example/01-basic/G-compile-flags/CMakeLists.txt new file: example/01-basic/G-compile-flags/README.adoc new file: example/01-basic/G-compile-flags/main.cpp new file: example/01-basic/H-third-party-library/CMakeLists.txt new file: example/01-basic/H-third-party-library/README.adoc new file: example/01-basic/H-third-party-library/main.cpp new file: example/01-basic/I-compiling-with-clang/CMakeLists.txt new file: example/01-basic/I-compiling-with-clang/README.adoc new file: example/01-basic/I-compiling-with-clang/main.cpp new file: example/01-basic/I-compiling-with-clang/pre_test.sh new file: example/01-basic/I-compiling-with-clang/run_test.sh new file: example/01-basic/J-building-with-ninja/CMakeLists.txt new file: example/01-basic/J-building-with-ninja/README.adoc new file: example/01-basic/J-building-with-ninja/main.cpp new file: example/01-basic/J-building-with-ninja/pre_test.sh new file: example/01-basic/J-building-with-ninja/run_test.sh new file: example/01-basic/K-imported-targets/CMakeLists.txt new file: example/01-basic/K-imported-targets/README.adoc new file: example/01-basic/K-imported-targets/main.cpp new file: example/01-basic/K-imported-targets/run_test.sh new file: example/01-basic/L-cpp-standard/README.adoc new file: example/01-basic/L-cpp-standard/i-common-method/CMakeLists.txt new file: example/01-basic/L-cpp-standard/i-common-method/README.adoc new file: example/01-basic/L-cpp-standard/i-common-method/main.cpp new file: example/01-basic/L-cpp-standard/ii-cxx-standard/CMakeLists.txt new file: example/01-basic/L-cpp-standard/ii-cxx-standard/README.adoc new file: example/01-basic/L-cpp-standard/ii-cxx-standard/main.cpp new file: example/01-basic/L-cpp-standard/iii-compile-features/CMakeLists.txt new file: example/01-basic/L-cpp-standard/iii-compile-features/README.adoc new file: example/01-basic/L-cpp-standard/iii-compile-features/main.cpp new file: example/01-basic/README.adoc new file: example/02-sub-projects/A-basic/CMakeLists.txt new file: example/02-sub-projects/A-basic/README.adoc new file: example/02-sub-projects/A-basic/subbinary/CMakeLists.txt new file: example/02-sub-projects/A-basic/subbinary/main.cpp new file: example/02-sub-projects/A-basic/sublibrary1/CMakeLists.txt new file: example/02-sub-projects/A-basic/sublibrary1/include/sublib1/sublib1.h new file: example/02-sub-projects/A-basic/sublibrary1/src/sublib1.cpp new file: example/02-sub-projects/A-basic/sublibrary2/CMakeLists.txt new file: example/02-sub-projects/A-basic/sublibrary2/include/sublib2/sublib2.h new file: example/02-sub-projects/README.adoc new file: example/03-code-generation/README.adoc new file: example/03-code-generation/configure-files/CMakeLists.txt new file: example/03-code-generation/configure-files/README.adoc new file: example/03-code-generation/configure-files/main.cpp new file: example/03-code-generation/configure-files/path.h.in new file: example/03-code-generation/configure-files/ver.h.in new file: example/03-code-generation/protobuf/AddressBook.proto new file: example/03-code-generation/protobuf/CMakeLists.txt new file: example/03-code-generation/protobuf/README.adoc new file: example/03-code-generation/protobuf/main.cpp new file: example/04-static-analysis/README.adoc new file: example/04-static-analysis/clang-analyzer/CMakeLists.txt new file: example/04-static-analysis/clang-analyzer/README.adoc new file: example/04-static-analysis/clang-analyzer/run_test.sh new file: example/04-static-analysis/clang-analyzer/subproject1/CMakeLists.txt new file: example/04-static-analysis/clang-analyzer/subproject1/main1.cpp new file: example/04-static-analysis/clang-analyzer/subproject2/CMakeLists.txt new file: example/04-static-analysis/clang-analyzer/subproject2/main2.cpp new file: example/04-static-analysis/clang-format/.clang-format new file: example/04-static-analysis/clang-format/CMakeLists.txt new file: example/04-static-analysis/clang-format/README.adoc new file: example/04-static-analysis/clang-format/cmake/modules/FindClangFormat.cmake new file: example/04-static-analysis/clang-format/cmake/modules/clang-format.cmake new file: example/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed new file: example/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed.py new file: example/04-static-analysis/clang-format/run_test.sh new file: example/04-static-analysis/clang-format/subproject1/CMakeLists.txt new file: example/04-static-analysis/clang-format/subproject1/main1.cpp new file: example/04-static-analysis/clang-format/subproject2/CMakeLists.txt new file: example/04-static-analysis/clang-format/subproject2/main2.cpp new file: example/04-static-analysis/cppcheck-compile-commands/.cppcheck_suppressions new file: example/04-static-analysis/cppcheck-compile-commands/CMakeLists.txt new file: example/04-static-analysis/cppcheck-compile-commands/README.adoc new file: example/04-static-analysis/cppcheck-compile-commands/cmake/modules/FindCppCheck.cmake new file: example/04-static-analysis/cppcheck-compile-commands/run_test.sh new file: example/04-static-analysis/cppcheck-compile-commands/subproject1/CMakeLists.txt new file: example/04-static-analysis/cppcheck-compile-commands/subproject1/main1.cpp new file: example/04-static-analysis/cppcheck-compile-commands/subproject2/CMakeLists.txt new file: example/04-static-analysis/cppcheck-compile-commands/subproject2/main2.cpp new file: example/04-static-analysis/cppcheck/CMakeLists.txt new file: example/04-static-analysis/cppcheck/README.adoc new file: example/04-static-analysis/cppcheck/cmake/analysis.cmake new file: example/04-static-analysis/cppcheck/cmake/modules/FindCppCheck.cmake new file: example/04-static-analysis/cppcheck/run_test.sh new file: example/04-static-analysis/cppcheck/subproject1/CMakeLists.txt new file: example/04-static-analysis/cppcheck/subproject1/main1.cpp new file: example/04-static-analysis/cppcheck/subproject2/CMakeLists.txt new file: example/04-static-analysis/cppcheck/subproject2/main2.cpp new file: example/05-unit-testing/README.adoc new file: example/05-unit-testing/boost/CMakeLists.txt new file: example/05-unit-testing/boost/Palindrome.cpp new file: example/05-unit-testing/boost/Palindrome.h new file: example/05-unit-testing/boost/README.adoc new file: example/05-unit-testing/boost/Reverse.cpp new file: example/05-unit-testing/boost/Reverse.h new file: example/05-unit-testing/boost/main.cpp new file: example/05-unit-testing/boost/post_test.sh new file: example/05-unit-testing/boost/unit_tests.cpp new file: example/05-unit-testing/catch2-vendored/3rd_party/catch2/CMakeLists.txt new file: example/05-unit-testing/catch2-vendored/3rd_party/catch2/catch2/catch.hpp new file: example/05-unit-testing/catch2-vendored/CMakeLists.txt new file: example/05-unit-testing/catch2-vendored/Palindrome.cpp new file: example/05-unit-testing/catch2-vendored/Palindrome.h new file: example/05-unit-testing/catch2-vendored/README.adoc new file: example/05-unit-testing/catch2-vendored/Reverse.cpp new file: example/05-unit-testing/catch2-vendored/Reverse.h new file: example/05-unit-testing/catch2-vendored/main.cpp new file: example/05-unit-testing/catch2-vendored/post_test.sh new file: example/05-unit-testing/catch2-vendored/unit_tests.cpp new file: example/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt new file: example/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt.in new file: example/05-unit-testing/google-test-download/CMakeLists.txt new file: example/05-unit-testing/google-test-download/Palindrome.cpp new file: example/05-unit-testing/google-test-download/Palindrome.h new file: example/05-unit-testing/google-test-download/README.adoc new file: example/05-unit-testing/google-test-download/Reverse.cpp new file: example/05-unit-testing/google-test-download/Reverse.h new file: example/05-unit-testing/google-test-download/main.cpp new file: example/05-unit-testing/google-test-download/post_test.sh new file: example/05-unit-testing/google-test-download/run_test.sh new file: example/05-unit-testing/google-test-download/unit_tests.cpp new file: example/06-installer/README.adoc new file: example/06-installer/deb/CMakeLists.txt new file: example/06-installer/deb/README.adoc new file: example/06-installer/deb/cmake-examples.conf new file: example/06-installer/deb/include/Hello.h new file: example/06-installer/deb/post_test.sh new file: example/06-installer/deb/src/Hello.cpp new file: example/06-installer/deb/src/main.cpp new file: example/07-package-management/A-using-system-provide-packages/README.adoc new file: example/07-package-management/B-vendoring-code/README.adoc new file: example/07-package-management/C-external-project-add/README.adoc new file: example/07-package-management/D-conan/README.adoc new file: example/07-package-management/D-conan/i-basic/CMakeLists.txt new file: example/07-package-management/D-conan/i-basic/README.adoc new file: example/07-package-management/D-conan/i-basic/conanfile.txt new file: example/07-package-management/D-conan/i-basic/main.cpp new file: example/07-package-management/D-conan/i-basic/run_test.sh new file: example/07-package-management/D-conan/ii-basic-targets/CMakeLists.txt new file: example/07-package-management/D-conan/ii-basic-targets/README.adoc new file: example/07-package-management/D-conan/ii-basic-targets/conanfile.txt new file: example/07-package-management/D-conan/ii-basic-targets/main.cpp new file: example/07-package-management/D-conan/ii-basic-targets/run_test.sh new file: example/07-package-management/README.adoc new file: example/LICENSE new file: example/README.adoc new file: example/cmake-examples.sublime-project new file: example/dockerfiles/README.adoc new file: example/dockerfiles/setup.sh new file: example/dockerfiles/ubuntu14.04-cmake-3.4.3 new file: example/dockerfiles/ubuntu14.04-default-2.8.12.2 new file: example/dockerfiles/ubuntu16.04-cmake-3.10.3 new file: example/dockerfiles/ubuntu16.04-default-cmake-3.5.1 new file: example/test.sh new file: examples --- cmake/GenericMakefile/.gitignore | 3 + cmake/GenericMakefile/LICENSE | 21 + cmake/GenericMakefile/README.md | 38 + cmake/GenericMakefile/c/hello.c | 10 + cmake/GenericMakefile/cpp/hello.cpp | 10 + cmake/example/.gitignore | 64 + cmake/example/.travis.yml | 19 + .../01-basic/A-hello-cmake/CMakeLists.txt | 10 + .../01-basic/A-hello-cmake/README.adoc | 265 + cmake/example/01-basic/A-hello-cmake/main.cpp | 7 + .../01-basic/B-hello-headers/CMakeLists.txt | 23 + .../01-basic/B-hello-headers/README.adoc | 188 + .../01-basic/B-hello-headers/include/Hello.h | 10 + .../01-basic/B-hello-headers/src/Hello.cpp | 8 + .../01-basic/B-hello-headers/src/main.cpp | 8 + .../01-basic/C-static-library/CMakeLists.txt | 33 + .../01-basic/C-static-library/README.adoc | 164 + .../C-static-library/include/static/Hello.h | 10 + .../01-basic/C-static-library/src/Hello.cpp | 8 + .../01-basic/C-static-library/src/main.cpp | 8 + .../01-basic/D-shared-library/CMakeLists.txt | 33 + .../01-basic/D-shared-library/README.adoc | 125 + .../D-shared-library/include/shared/Hello.h | 10 + .../01-basic/D-shared-library/src/Hello.cpp | 8 + .../01-basic/D-shared-library/src/main.cpp | 8 + .../01-basic/E-installing/CMakeLists.txt | 53 + .../example/01-basic/E-installing/README.adoc | 235 + .../01-basic/E-installing/cmake-examples.conf | 1 + .../E-installing/include/installing/Hello.h | 10 + .../01-basic/E-installing/src/Hello.cpp | 8 + .../01-basic/E-installing/src/main.cpp | 8 + .../01-basic/F-build-type/CMakeLists.txt | 19 + .../example/01-basic/F-build-type/README.adoc | 158 + .../F-build-type/cmake-gui-build-type.png | Bin 0 -> 90872 bytes cmake/example/01-basic/F-build-type/main.cpp | 7 + .../01-basic/G-compile-flags/CMakeLists.txt | 14 + .../01-basic/G-compile-flags/README.adoc | 138 + .../example/01-basic/G-compile-flags/main.cpp | 17 + .../H-third-party-library/CMakeLists.txt | 24 + .../H-third-party-library/README.adoc | 213 + .../01-basic/H-third-party-library/main.cpp | 24 + .../I-compiling-with-clang/CMakeLists.txt | 10 + .../I-compiling-with-clang/README.adoc | 126 + .../01-basic/I-compiling-with-clang/main.cpp | 7 + .../I-compiling-with-clang/pre_test.sh | 9 + .../I-compiling-with-clang/run_test.sh | 17 + .../J-building-with-ninja/CMakeLists.txt | 10 + .../J-building-with-ninja/README.adoc | 160 + .../01-basic/J-building-with-ninja/main.cpp | 7 + .../J-building-with-ninja/pre_test.sh | 9 + .../J-building-with-ninja/run_test.sh | 11 + .../K-imported-targets/CMakeLists.txt | 24 + .../01-basic/K-imported-targets/README.adoc | 94 + .../01-basic/K-imported-targets/main.cpp | 24 + .../01-basic/K-imported-targets/run_test.sh | 12 + .../01-basic/L-cpp-standard/README.adoc | 11 + .../i-common-method/CMakeLists.txt | 24 + .../i-common-method/README.adoc | 111 + .../L-cpp-standard/i-common-method/main.cpp | 8 + .../ii-cxx-standard/CMakeLists.txt | 13 + .../ii-cxx-standard/README.adoc | 88 + .../L-cpp-standard/ii-cxx-standard/main.cpp | 8 + .../iii-compile-features/CMakeLists.txt | 16 + .../iii-compile-features/README.adoc | 97 + .../iii-compile-features/main.cpp | 8 + cmake/example/01-basic/README.adoc | 19 + .../02-sub-projects/A-basic/CMakeLists.txt | 8 + .../02-sub-projects/A-basic/README.adoc | 216 + .../A-basic/subbinary/CMakeLists.txt | 12 + .../A-basic/subbinary/main.cpp | 13 + .../A-basic/sublibrary1/CMakeLists.txt | 10 + .../sublibrary1/include/sublib1/sublib1.h | 10 + .../A-basic/sublibrary1/src/sublib1.cpp | 8 + .../A-basic/sublibrary2/CMakeLists.txt | 10 + .../sublibrary2/include/sublib2/sublib2.h | 15 + cmake/example/02-sub-projects/README.adoc | 9 + cmake/example/03-code-generation/README.adoc | 8 + .../configure-files/CMakeLists.txt | 29 + .../configure-files/README.adoc | 113 + .../configure-files/main.cpp | 10 + .../configure-files/path.h.in | 8 + .../configure-files/ver.h.in | 8 + .../protobuf/AddressBook.proto | 24 + .../protobuf/CMakeLists.txt | 39 + .../03-code-generation/protobuf/README.adoc | 209 + .../03-code-generation/protobuf/main.cpp | 93 + cmake/example/04-static-analysis/README.adoc | 28 + .../clang-analyzer/CMakeLists.txt | 13 + .../clang-analyzer/README.adoc | 154 + .../clang-analyzer/run_test.sh | 5 + .../clang-analyzer/subproject1/CMakeLists.txt | 5 + .../clang-analyzer/subproject1/main1.cpp | 7 + .../clang-analyzer/subproject2/CMakeLists.txt | 5 + .../clang-analyzer/subproject2/main2.cpp | 9 + .../clang-format/.clang-format | 61 + .../clang-format/CMakeLists.txt | 15 + .../clang-format/README.adoc | 152 + .../cmake/modules/FindClangFormat.cmake | 34 + .../cmake/modules/clang-format.cmake | 62 + .../cmake/scripts/clang-format-check-changed | 18 + .../scripts/clang-format-check-changed.py | 163 + .../clang-format/run_test.sh | 11 + .../clang-format/subproject1/CMakeLists.txt | 5 + .../clang-format/subproject1/main1.cpp | 7 + .../clang-format/subproject2/CMakeLists.txt | 5 + .../clang-format/subproject2/main2.cpp | 18 + .../.cppcheck_suppressions | 0 .../cppcheck-compile-commands/CMakeLists.txt | 17 + .../cppcheck-compile-commands/README.adoc | 195 + .../cmake/modules/FindCppCheck.cmake | 122 + .../cppcheck-compile-commands/run_test.sh | 2 + .../subproject1/CMakeLists.txt | 5 + .../subproject1/main1.cpp | 7 + .../subproject2/CMakeLists.txt | 5 + .../subproject2/main2.cpp | 9 + .../cppcheck/CMakeLists.txt | 26 + .../04-static-analysis/cppcheck/README.adoc | 365 + .../cppcheck/cmake/analysis.cmake | 50 + .../cppcheck/cmake/modules/FindCppCheck.cmake | 37 + .../04-static-analysis/cppcheck/run_test.sh | 2 + .../cppcheck/subproject1/CMakeLists.txt | 14 + .../cppcheck/subproject1/main1.cpp | 7 + .../cppcheck/subproject2/CMakeLists.txt | 14 + .../cppcheck/subproject2/main2.cpp | 9 + cmake/example/05-unit-testing/README.adoc | 28 + .../05-unit-testing/boost/CMakeLists.txt | 45 + .../05-unit-testing/boost/Palindrome.cpp | 11 + .../05-unit-testing/boost/Palindrome.h | 15 + .../example/05-unit-testing/boost/README.adoc | 155 + .../example/05-unit-testing/boost/Reverse.cpp | 12 + cmake/example/05-unit-testing/boost/Reverse.h | 15 + cmake/example/05-unit-testing/boost/main.cpp | 24 + .../05-unit-testing/boost/post_test.sh | 3 + .../05-unit-testing/boost/unit_tests.cpp | 46 + .../3rd_party/catch2/CMakeLists.txt | 8 + .../3rd_party/catch2/catch2/catch.hpp | 14362 ++++++++++++++++ .../catch2-vendored/CMakeLists.txt | 33 + .../catch2-vendored/Palindrome.cpp | 11 + .../catch2-vendored/Palindrome.h | 15 + .../catch2-vendored/README.adoc | 180 + .../catch2-vendored/Reverse.cpp | 12 + .../05-unit-testing/catch2-vendored/Reverse.h | 15 + .../05-unit-testing/catch2-vendored/main.cpp | 24 + .../catch2-vendored/post_test.sh | 3 + .../catch2-vendored/unit_tests.cpp | 36 + .../3rd_party/google-test/CMakeLists.txt | 68 + .../3rd_party/google-test/CMakeLists.txt.in | 19 + .../google-test-download/CMakeLists.txt | 30 + .../google-test-download/Palindrome.cpp | 11 + .../google-test-download/Palindrome.h | 15 + .../google-test-download/README.adoc | 231 + .../google-test-download/Reverse.cpp | 12 + .../google-test-download/Reverse.h | 15 + .../google-test-download/main.cpp | 24 + .../google-test-download/post_test.sh | 6 + .../google-test-download/run_test.sh | 4 + .../google-test-download/unit_tests.cpp | 39 + cmake/example/06-installer/README.adoc | 15 + cmake/example/06-installer/deb/CMakeLists.txt | 68 + cmake/example/06-installer/deb/README.adoc | 157 + .../06-installer/deb/cmake-examples.conf | 1 + .../example/06-installer/deb/include/Hello.h | 10 + cmake/example/06-installer/deb/post_test.sh | 3 + cmake/example/06-installer/deb/src/Hello.cpp | 8 + cmake/example/06-installer/deb/src/main.cpp | 8 + .../README.adoc | 13 + .../B-vendoring-code/README.adoc | 43 + .../C-external-project-add/README.adoc | 40 + .../07-package-management/D-conan/README.adoc | 159 + .../D-conan/i-basic/CMakeLists.txt | 17 + .../D-conan/i-basic/README.adoc | 213 + .../D-conan/i-basic/conanfile.txt | 5 + .../D-conan/i-basic/main.cpp | 8 + .../D-conan/i-basic/run_test.sh | 19 + .../D-conan/ii-basic-targets/CMakeLists.txt | 17 + .../D-conan/ii-basic-targets/README.adoc | 170 + .../D-conan/ii-basic-targets/conanfile.txt | 5 + .../D-conan/ii-basic-targets/main.cpp | 8 + .../D-conan/ii-basic-targets/run_test.sh | 19 + .../example/07-package-management/README.adoc | 12 + cmake/example/LICENSE | 22 + cmake/example/README.adoc | 108 + cmake/example/cmake-examples.sublime-project | 8 + cmake/example/dockerfiles/README.adoc | 90 + cmake/example/dockerfiles/setup.sh | 26 + .../dockerfiles/ubuntu14.04-cmake-3.4.3 | 51 + .../dockerfiles/ubuntu14.04-default-2.8.12.2 | 41 + .../dockerfiles/ubuntu16.04-cmake-3.10.3 | 52 + .../ubuntu16.04-default-cmake-3.5.1 | 42 + cmake/example/test.sh | 92 + cmake/examples | 1 + 191 files changed, 22536 insertions(+) create mode 100644 cmake/GenericMakefile/.gitignore create mode 100644 cmake/GenericMakefile/LICENSE create mode 100644 cmake/GenericMakefile/README.md create mode 100644 cmake/GenericMakefile/c/hello.c create mode 100644 cmake/GenericMakefile/cpp/hello.cpp create mode 100644 cmake/example/.gitignore create mode 100644 cmake/example/.travis.yml create mode 100644 cmake/example/01-basic/A-hello-cmake/CMakeLists.txt create mode 100644 cmake/example/01-basic/A-hello-cmake/README.adoc create mode 100644 cmake/example/01-basic/A-hello-cmake/main.cpp create mode 100644 cmake/example/01-basic/B-hello-headers/CMakeLists.txt create mode 100644 cmake/example/01-basic/B-hello-headers/README.adoc create mode 100644 cmake/example/01-basic/B-hello-headers/include/Hello.h create mode 100644 cmake/example/01-basic/B-hello-headers/src/Hello.cpp create mode 100644 cmake/example/01-basic/B-hello-headers/src/main.cpp create mode 100644 cmake/example/01-basic/C-static-library/CMakeLists.txt create mode 100644 cmake/example/01-basic/C-static-library/README.adoc create mode 100644 cmake/example/01-basic/C-static-library/include/static/Hello.h create mode 100644 cmake/example/01-basic/C-static-library/src/Hello.cpp create mode 100644 cmake/example/01-basic/C-static-library/src/main.cpp create mode 100644 cmake/example/01-basic/D-shared-library/CMakeLists.txt create mode 100644 cmake/example/01-basic/D-shared-library/README.adoc create mode 100644 cmake/example/01-basic/D-shared-library/include/shared/Hello.h create mode 100644 cmake/example/01-basic/D-shared-library/src/Hello.cpp create mode 100644 cmake/example/01-basic/D-shared-library/src/main.cpp create mode 100644 cmake/example/01-basic/E-installing/CMakeLists.txt create mode 100644 cmake/example/01-basic/E-installing/README.adoc create mode 100644 cmake/example/01-basic/E-installing/cmake-examples.conf create mode 100644 cmake/example/01-basic/E-installing/include/installing/Hello.h create mode 100644 cmake/example/01-basic/E-installing/src/Hello.cpp create mode 100644 cmake/example/01-basic/E-installing/src/main.cpp create mode 100644 cmake/example/01-basic/F-build-type/CMakeLists.txt create mode 100644 cmake/example/01-basic/F-build-type/README.adoc create mode 100644 cmake/example/01-basic/F-build-type/cmake-gui-build-type.png create mode 100644 cmake/example/01-basic/F-build-type/main.cpp create mode 100644 cmake/example/01-basic/G-compile-flags/CMakeLists.txt create mode 100644 cmake/example/01-basic/G-compile-flags/README.adoc create mode 100644 cmake/example/01-basic/G-compile-flags/main.cpp create mode 100644 cmake/example/01-basic/H-third-party-library/CMakeLists.txt create mode 100644 cmake/example/01-basic/H-third-party-library/README.adoc create mode 100644 cmake/example/01-basic/H-third-party-library/main.cpp create mode 100644 cmake/example/01-basic/I-compiling-with-clang/CMakeLists.txt create mode 100644 cmake/example/01-basic/I-compiling-with-clang/README.adoc create mode 100644 cmake/example/01-basic/I-compiling-with-clang/main.cpp create mode 100755 cmake/example/01-basic/I-compiling-with-clang/pre_test.sh create mode 100755 cmake/example/01-basic/I-compiling-with-clang/run_test.sh create mode 100644 cmake/example/01-basic/J-building-with-ninja/CMakeLists.txt create mode 100644 cmake/example/01-basic/J-building-with-ninja/README.adoc create mode 100644 cmake/example/01-basic/J-building-with-ninja/main.cpp create mode 100755 cmake/example/01-basic/J-building-with-ninja/pre_test.sh create mode 100755 cmake/example/01-basic/J-building-with-ninja/run_test.sh create mode 100644 cmake/example/01-basic/K-imported-targets/CMakeLists.txt create mode 100644 cmake/example/01-basic/K-imported-targets/README.adoc create mode 100644 cmake/example/01-basic/K-imported-targets/main.cpp create mode 100755 cmake/example/01-basic/K-imported-targets/run_test.sh create mode 100644 cmake/example/01-basic/L-cpp-standard/README.adoc create mode 100644 cmake/example/01-basic/L-cpp-standard/i-common-method/CMakeLists.txt create mode 100644 cmake/example/01-basic/L-cpp-standard/i-common-method/README.adoc create mode 100644 cmake/example/01-basic/L-cpp-standard/i-common-method/main.cpp create mode 100644 cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/CMakeLists.txt create mode 100644 cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/README.adoc create mode 100644 cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/main.cpp create mode 100644 cmake/example/01-basic/L-cpp-standard/iii-compile-features/CMakeLists.txt create mode 100644 cmake/example/01-basic/L-cpp-standard/iii-compile-features/README.adoc create mode 100644 cmake/example/01-basic/L-cpp-standard/iii-compile-features/main.cpp create mode 100644 cmake/example/01-basic/README.adoc create mode 100644 cmake/example/02-sub-projects/A-basic/CMakeLists.txt create mode 100644 cmake/example/02-sub-projects/A-basic/README.adoc create mode 100644 cmake/example/02-sub-projects/A-basic/subbinary/CMakeLists.txt create mode 100644 cmake/example/02-sub-projects/A-basic/subbinary/main.cpp create mode 100644 cmake/example/02-sub-projects/A-basic/sublibrary1/CMakeLists.txt create mode 100644 cmake/example/02-sub-projects/A-basic/sublibrary1/include/sublib1/sublib1.h create mode 100644 cmake/example/02-sub-projects/A-basic/sublibrary1/src/sublib1.cpp create mode 100644 cmake/example/02-sub-projects/A-basic/sublibrary2/CMakeLists.txt create mode 100644 cmake/example/02-sub-projects/A-basic/sublibrary2/include/sublib2/sublib2.h create mode 100644 cmake/example/02-sub-projects/README.adoc create mode 100644 cmake/example/03-code-generation/README.adoc create mode 100644 cmake/example/03-code-generation/configure-files/CMakeLists.txt create mode 100644 cmake/example/03-code-generation/configure-files/README.adoc create mode 100644 cmake/example/03-code-generation/configure-files/main.cpp create mode 100644 cmake/example/03-code-generation/configure-files/path.h.in create mode 100644 cmake/example/03-code-generation/configure-files/ver.h.in create mode 100644 cmake/example/03-code-generation/protobuf/AddressBook.proto create mode 100644 cmake/example/03-code-generation/protobuf/CMakeLists.txt create mode 100644 cmake/example/03-code-generation/protobuf/README.adoc create mode 100644 cmake/example/03-code-generation/protobuf/main.cpp create mode 100644 cmake/example/04-static-analysis/README.adoc create mode 100644 cmake/example/04-static-analysis/clang-analyzer/CMakeLists.txt create mode 100644 cmake/example/04-static-analysis/clang-analyzer/README.adoc create mode 100755 cmake/example/04-static-analysis/clang-analyzer/run_test.sh create mode 100644 cmake/example/04-static-analysis/clang-analyzer/subproject1/CMakeLists.txt create mode 100644 cmake/example/04-static-analysis/clang-analyzer/subproject1/main1.cpp create mode 100644 cmake/example/04-static-analysis/clang-analyzer/subproject2/CMakeLists.txt create mode 100644 cmake/example/04-static-analysis/clang-analyzer/subproject2/main2.cpp create mode 100644 cmake/example/04-static-analysis/clang-format/.clang-format create mode 100644 cmake/example/04-static-analysis/clang-format/CMakeLists.txt create mode 100644 cmake/example/04-static-analysis/clang-format/README.adoc create mode 100644 cmake/example/04-static-analysis/clang-format/cmake/modules/FindClangFormat.cmake create mode 100644 cmake/example/04-static-analysis/clang-format/cmake/modules/clang-format.cmake create mode 100755 cmake/example/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed create mode 100755 cmake/example/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed.py create mode 100755 cmake/example/04-static-analysis/clang-format/run_test.sh create mode 100644 cmake/example/04-static-analysis/clang-format/subproject1/CMakeLists.txt create mode 100644 cmake/example/04-static-analysis/clang-format/subproject1/main1.cpp create mode 100644 cmake/example/04-static-analysis/clang-format/subproject2/CMakeLists.txt create mode 100644 cmake/example/04-static-analysis/clang-format/subproject2/main2.cpp create mode 100644 cmake/example/04-static-analysis/cppcheck-compile-commands/.cppcheck_suppressions create mode 100644 cmake/example/04-static-analysis/cppcheck-compile-commands/CMakeLists.txt create mode 100644 cmake/example/04-static-analysis/cppcheck-compile-commands/README.adoc create mode 100644 cmake/example/04-static-analysis/cppcheck-compile-commands/cmake/modules/FindCppCheck.cmake create mode 100755 cmake/example/04-static-analysis/cppcheck-compile-commands/run_test.sh create mode 100644 cmake/example/04-static-analysis/cppcheck-compile-commands/subproject1/CMakeLists.txt create mode 100644 cmake/example/04-static-analysis/cppcheck-compile-commands/subproject1/main1.cpp create mode 100644 cmake/example/04-static-analysis/cppcheck-compile-commands/subproject2/CMakeLists.txt create mode 100644 cmake/example/04-static-analysis/cppcheck-compile-commands/subproject2/main2.cpp create mode 100644 cmake/example/04-static-analysis/cppcheck/CMakeLists.txt create mode 100644 cmake/example/04-static-analysis/cppcheck/README.adoc create mode 100644 cmake/example/04-static-analysis/cppcheck/cmake/analysis.cmake create mode 100644 cmake/example/04-static-analysis/cppcheck/cmake/modules/FindCppCheck.cmake create mode 100755 cmake/example/04-static-analysis/cppcheck/run_test.sh create mode 100644 cmake/example/04-static-analysis/cppcheck/subproject1/CMakeLists.txt create mode 100644 cmake/example/04-static-analysis/cppcheck/subproject1/main1.cpp create mode 100644 cmake/example/04-static-analysis/cppcheck/subproject2/CMakeLists.txt create mode 100644 cmake/example/04-static-analysis/cppcheck/subproject2/main2.cpp create mode 100644 cmake/example/05-unit-testing/README.adoc create mode 100644 cmake/example/05-unit-testing/boost/CMakeLists.txt create mode 100644 cmake/example/05-unit-testing/boost/Palindrome.cpp create mode 100644 cmake/example/05-unit-testing/boost/Palindrome.h create mode 100644 cmake/example/05-unit-testing/boost/README.adoc create mode 100644 cmake/example/05-unit-testing/boost/Reverse.cpp create mode 100644 cmake/example/05-unit-testing/boost/Reverse.h create mode 100644 cmake/example/05-unit-testing/boost/main.cpp create mode 100755 cmake/example/05-unit-testing/boost/post_test.sh create mode 100644 cmake/example/05-unit-testing/boost/unit_tests.cpp create mode 100644 cmake/example/05-unit-testing/catch2-vendored/3rd_party/catch2/CMakeLists.txt create mode 100644 cmake/example/05-unit-testing/catch2-vendored/3rd_party/catch2/catch2/catch.hpp create mode 100644 cmake/example/05-unit-testing/catch2-vendored/CMakeLists.txt create mode 100644 cmake/example/05-unit-testing/catch2-vendored/Palindrome.cpp create mode 100644 cmake/example/05-unit-testing/catch2-vendored/Palindrome.h create mode 100644 cmake/example/05-unit-testing/catch2-vendored/README.adoc create mode 100644 cmake/example/05-unit-testing/catch2-vendored/Reverse.cpp create mode 100644 cmake/example/05-unit-testing/catch2-vendored/Reverse.h create mode 100644 cmake/example/05-unit-testing/catch2-vendored/main.cpp create mode 100755 cmake/example/05-unit-testing/catch2-vendored/post_test.sh create mode 100644 cmake/example/05-unit-testing/catch2-vendored/unit_tests.cpp create mode 100644 cmake/example/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt create mode 100644 cmake/example/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt.in create mode 100644 cmake/example/05-unit-testing/google-test-download/CMakeLists.txt create mode 100644 cmake/example/05-unit-testing/google-test-download/Palindrome.cpp create mode 100644 cmake/example/05-unit-testing/google-test-download/Palindrome.h create mode 100644 cmake/example/05-unit-testing/google-test-download/README.adoc create mode 100644 cmake/example/05-unit-testing/google-test-download/Reverse.cpp create mode 100644 cmake/example/05-unit-testing/google-test-download/Reverse.h create mode 100644 cmake/example/05-unit-testing/google-test-download/main.cpp create mode 100755 cmake/example/05-unit-testing/google-test-download/post_test.sh create mode 100755 cmake/example/05-unit-testing/google-test-download/run_test.sh create mode 100644 cmake/example/05-unit-testing/google-test-download/unit_tests.cpp create mode 100644 cmake/example/06-installer/README.adoc create mode 100644 cmake/example/06-installer/deb/CMakeLists.txt create mode 100644 cmake/example/06-installer/deb/README.adoc create mode 100644 cmake/example/06-installer/deb/cmake-examples.conf create mode 100644 cmake/example/06-installer/deb/include/Hello.h create mode 100755 cmake/example/06-installer/deb/post_test.sh create mode 100644 cmake/example/06-installer/deb/src/Hello.cpp create mode 100644 cmake/example/06-installer/deb/src/main.cpp create mode 100644 cmake/example/07-package-management/A-using-system-provide-packages/README.adoc create mode 100644 cmake/example/07-package-management/B-vendoring-code/README.adoc create mode 100644 cmake/example/07-package-management/C-external-project-add/README.adoc create mode 100644 cmake/example/07-package-management/D-conan/README.adoc create mode 100644 cmake/example/07-package-management/D-conan/i-basic/CMakeLists.txt create mode 100644 cmake/example/07-package-management/D-conan/i-basic/README.adoc create mode 100644 cmake/example/07-package-management/D-conan/i-basic/conanfile.txt create mode 100644 cmake/example/07-package-management/D-conan/i-basic/main.cpp create mode 100755 cmake/example/07-package-management/D-conan/i-basic/run_test.sh create mode 100644 cmake/example/07-package-management/D-conan/ii-basic-targets/CMakeLists.txt create mode 100644 cmake/example/07-package-management/D-conan/ii-basic-targets/README.adoc create mode 100644 cmake/example/07-package-management/D-conan/ii-basic-targets/conanfile.txt create mode 100644 cmake/example/07-package-management/D-conan/ii-basic-targets/main.cpp create mode 100755 cmake/example/07-package-management/D-conan/ii-basic-targets/run_test.sh create mode 100644 cmake/example/07-package-management/README.adoc create mode 100644 cmake/example/LICENSE create mode 100644 cmake/example/README.adoc create mode 100644 cmake/example/cmake-examples.sublime-project create mode 100644 cmake/example/dockerfiles/README.adoc create mode 100644 cmake/example/dockerfiles/setup.sh create mode 100644 cmake/example/dockerfiles/ubuntu14.04-cmake-3.4.3 create mode 100644 cmake/example/dockerfiles/ubuntu14.04-default-2.8.12.2 create mode 100644 cmake/example/dockerfiles/ubuntu16.04-cmake-3.10.3 create mode 100644 cmake/example/dockerfiles/ubuntu16.04-default-cmake-3.5.1 create mode 100755 cmake/example/test.sh create mode 160000 cmake/examples diff --git a/cmake/GenericMakefile/.gitignore b/cmake/GenericMakefile/.gitignore new file mode 100644 index 0000000..b00b5b0 --- /dev/null +++ b/cmake/GenericMakefile/.gitignore @@ -0,0 +1,3 @@ +bin +build +hello diff --git a/cmake/GenericMakefile/LICENSE b/cmake/GenericMakefile/LICENSE new file mode 100644 index 0000000..b9d03aa --- /dev/null +++ b/cmake/GenericMakefile/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Michael Crawford + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/cmake/GenericMakefile/README.md b/cmake/GenericMakefile/README.md new file mode 100644 index 0000000..d29ee3c --- /dev/null +++ b/cmake/GenericMakefile/README.md @@ -0,0 +1,38 @@ +GenericMakefile +=============== + +A generic makefile for use with small/medium C and C++ projects. Allows for +easy project setup without the need to create tedious build rules or +dependency lists. The c directory contains a makefile configured for C, while +the makefile in the cpp directory is configured for C++. + +## Features +* Automatically finds and compiles all source files within the source directory. +* Compiles most recently modified files first, to hopefully find problems earlier. +* Automatically generates dependecies as files are compiled, ensuring that files are correctly recompiled when dependecies have updated. +* Includes configurations for normal (release) build and debug build suitable for GDB debugging. +* Times the compilation of each file and the entire build. +* Generates version numbers based on git tags (see below), which are passed the compiler as preprocessor macros. +* By default, builds in a "quiet" mode that only lists the actions being performed. By passing V=true to make, you can compile in verbose mode to see the full compiler commands being issued. + +### Versioning +Tags should be made in the format `vMAJOR.MINOR.PATCH[-description]`, where `MAJOR`, `MINOR`, and `PATCH` are numeric. The following macros will be generated and passed to the preprocessor: +* `VERSION_MAJOR (int)` - The major version number from the most recent tag. +* `VERSION_MINOR (int)` - The minor version number from the most recent tag. +* `VERSION_PATCH (int)` - The patch version number from the most recent tag. +* `VERSION_REVISION (int)` - The number of commits since the most recent tag. +* `VERSION_HASH (string)` - The SHA of the current commit. Includes the "-dirty" suffix if there are uncommited changes. + +If the makefile is not used in a git repository, or is in a repository with no tags, the version macros are not created. + +## Limitations +* Assumes GNU make. +* Timing does not work correctly with MacOS. See [issue #6](https://github.com/mbcrawfo/GenericMakefile/issues/6) for a workaround patch that allows timing in seconds on Mac. +* Doesn't really support multiple types of source files in the same project. +* No easy way to exclude files from the build. You can either change the + extension of files to be excluded, or use preprocessor flags for + conditional compilation. + +## Thanks to +* My friend Jay and people on Stack Overflow for help with regex to parse the version info. +* The residents of [/r/programming](https://www.reddit.com/r/programming/) for suggesting numerous tweaks and improvements. diff --git a/cmake/GenericMakefile/c/hello.c b/cmake/GenericMakefile/c/hello.c new file mode 100644 index 0000000..5f27e2c --- /dev/null +++ b/cmake/GenericMakefile/c/hello.c @@ -0,0 +1,10 @@ +#include + +int main(int argc, char* argv[]) +{ + // suppress warnings + (void)argc; (void)argv; + + printf("Hello World!\n"); + return 0; +} diff --git a/cmake/GenericMakefile/cpp/hello.cpp b/cmake/GenericMakefile/cpp/hello.cpp new file mode 100644 index 0000000..1374872 --- /dev/null +++ b/cmake/GenericMakefile/cpp/hello.cpp @@ -0,0 +1,10 @@ +#include + +int main(int argc, char* argv[]) +{ + // suppress warnings + (void)argc; (void)argv; + + std::cout << "Hello World!" << std::endl; + return 0; +} diff --git a/cmake/example/.gitignore b/cmake/example/.gitignore new file mode 100644 index 0000000..53bde5a --- /dev/null +++ b/cmake/example/.gitignore @@ -0,0 +1,64 @@ +CMakeCache.txt +CMakeFiles +Makefile +cmake_install.cmake +install_manifest.txt + +# +# Sublime Test +# +# cache files for sublime text +*.tmlanguage.cache +*.tmPreferences.cache +*.stTheme.cache + +# workspace files are user-specific +*.sublime-workspace + +# project files should be checked into the repository, unless a significant +# proportion of contributors will probably not be using SublimeText +# *.sublime-project + +# +# C / C++ +# + +# Compiled Object files +*.slo +*.lo +*.o +*.obj +*.ko +*.elf + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll +*.so.* +*.dylib + +# Fortran module files +*.mod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib +*.lo + +# Executables +*.exe +*.out +*.app + +/**/build +/**/build.* + +.tags +.vscode diff --git a/cmake/example/.travis.yml b/cmake/example/.travis.yml new file mode 100644 index 0000000..c862436 --- /dev/null +++ b/cmake/example/.travis.yml @@ -0,0 +1,19 @@ +language: cpp +services: + - docker +sudo: required +compiler: +- gcc +before_install: +- docker pull matrim/cmake-examples:3.5.1 +- docker pull matrim/cmake-examples:3.10.3 +script: +- docker run --rm -v $PWD:/data/code -e DEV_UID=`id -u` -e DEV_GID=`id -g` -it matrim/cmake-examples:3.5.1 /data/code/test.sh +- docker run --rm -v $PWD:/data/code -e DEV_UID=`id -u` -e DEV_GID=`id -g` -it matrim/cmake-examples:3.10.3 /data/code/test.sh +branches: + except: + - gh-pages +notifications: + email: true +os: +- linux diff --git a/cmake/example/01-basic/A-hello-cmake/CMakeLists.txt b/cmake/example/01-basic/A-hello-cmake/CMakeLists.txt new file mode 100644 index 0000000..0a43a8e --- /dev/null +++ b/cmake/example/01-basic/A-hello-cmake/CMakeLists.txt @@ -0,0 +1,10 @@ +# Set the minimum version of CMake that can be used +# To find the cmake version run +# $ cmake --version +cmake_minimum_required(VERSION 3.5) + +# Set the project name +project (hello_cmake) + +# Add an executable +add_executable(hello_cmake main.cpp) diff --git a/cmake/example/01-basic/A-hello-cmake/README.adoc b/cmake/example/01-basic/A-hello-cmake/README.adoc new file mode 100644 index 0000000..453b410 --- /dev/null +++ b/cmake/example/01-basic/A-hello-cmake/README.adoc @@ -0,0 +1,265 @@ += Hello CMake +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +Shows a very basic hello world example. + +The files in this tutorial are below: + +``` +A-hello-cmake$ tree +. +├── CMakeLists.txt +├── main.cpp +``` + + * link:CMakeLists.txt[CMakeLists.txt] - Contains the CMake commands you wish to run + * link:main.cpp[main.cpp] - A simple "Hello World" cpp file. + +# Concepts + +### CMakeLists.txt + +CMakeLists.txt is the file which should store all your CMake commands. When +cmake is run in a folder it will look for this file and if it does not exist cmake +will exit with an error. + +### Minimum CMake version + +When creating a project using CMake, you can specify the minimum version +of CMake that is supported. + +[source,cmake] +---- +cmake_minimum_required(VERSION 3.5) +---- + + +### Projects + +A CMake build can include a project name to make referencing certain +variables easier when using multiple projects. + +[source,cmake] +---- +project (hello_cmake) +---- + + +### Creating an Executable + +The +add_executable()+ command specifies that an executable should be +build from the specified source files, in this example main.cpp. The +first argument to the +add_executable()+ function is the name of the +executable to be built, and the second argument is the list of source files to compile. + +[source,cmake] +---- +add_executable(hello_cmake main.cpp) +---- + + +[NOTE] +==== +A shorthand that some people use is to have the project name and +executable name the same. This allows you to specify the CMakeLists.txt +as follows, + +[source,cmake] +---- +cmake_minimum_required(VERSION 2.6) +project (hello_cmake) +add_executable(${PROJECT_NAME} main.cpp) +---- + +In this example, the +project()+ function, will create a variable ++${PROJECT_NAME}+ with the value hello_cmake. This can then be passed to +the +add_executable()+ function to output a 'hello_cmake' executable. +==== + + +### Binary Directory + +The root or top level folder that you run the cmake command from is known as your +CMAKE_BINARY_DIR and is the root folder for all your binary files. +CMake supports building and generating your binary files both in-place and also +out-of-source. + + +#### In-Place Build + +In-place builds generate all temporary build files in the same directory structure +as the source code. This means that all Makefiles and object files are interspersed +with your normal code. To create an in-place build target run the cmake command +in your root directory. For example: + +[source,bash] +---- +A-hello-cmake$ cmake . +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/01-basic/A-hello-cmake + +A-hello-cmake$ tree +. +├── CMakeCache.txt +├── CMakeFiles +│   ├── 2.8.12.2 +│   │   ├── CMakeCCompiler.cmake +│   │   ├── CMakeCXXCompiler.cmake +│   │   ├── CMakeDetermineCompilerABI_C.bin +│   │   ├── CMakeDetermineCompilerABI_CXX.bin +│   │   ├── CMakeSystem.cmake +│   │   ├── CompilerIdC +│   │   │   ├── a.out +│   │   │   └── CMakeCCompilerId.c +│   │   └── CompilerIdCXX +│   │   ├── a.out +│   │   └── CMakeCXXCompilerId.cpp +│   ├── cmake.check_cache +│   ├── CMakeDirectoryInformation.cmake +│   ├── CMakeOutput.log +│   ├── CMakeTmp +│   ├── hello_cmake.dir +│   │   ├── build.make +│   │   ├── cmake_clean.cmake +│   │   ├── DependInfo.cmake +│   │   ├── depend.make +│   │   ├── flags.make +│   │   ├── link.txt +│   │   └── progress.make +│   ├── Makefile2 +│   ├── Makefile.cmake +│   ├── progress.marks +│   └── TargetDirectories.txt +├── cmake_install.cmake +├── CMakeLists.txt +├── main.cpp +├── Makefile +---- + + +#### Out-of-Source Build + +Out-of-source builds allow you to create a single build folder that can be anywhere on +your file system. All temporary build and object files are located in this directory keeping +your source tree clean. To create an out-of-source build run the cmake command in +the build folder and point it to the directory with your root CMakeLists.txt file. +Using out-of-source builds if you want to recreate your cmake environment +from scratch, you only need to delete your build directory and then rerun cmake. + +For example: + +[source,bash] +---- +A-hello-cmake$ mkdir build + +A-hello-cmake$ cd build/ + +matrim@freyr:~/workspace/cmake-examples/01-basic/A-hello-cmake/build$ cmake .. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/01-basic/A-hello-cmake/build + +A-hello-cmake/build$ cd .. + +A-hello-cmake$ tree +. +├── build +│   ├── CMakeCache.txt +│   ├── CMakeFiles +│   │   ├── 2.8.12.2 +│   │   │   ├── CMakeCCompiler.cmake +│   │   │   ├── CMakeCXXCompiler.cmake +│   │   │   ├── CMakeDetermineCompilerABI_C.bin +│   │   │   ├── CMakeDetermineCompilerABI_CXX.bin +│   │   │   ├── CMakeSystem.cmake +│   │   │   ├── CompilerIdC +│   │   │   │   ├── a.out +│   │   │   │   └── CMakeCCompilerId.c +│   │   │   └── CompilerIdCXX +│   │   │   ├── a.out +│   │   │   └── CMakeCXXCompilerId.cpp +│   │   ├── cmake.check_cache +│   │   ├── CMakeDirectoryInformation.cmake +│   │   ├── CMakeOutput.log +│   │   ├── CMakeTmp +│   │   ├── hello_cmake.dir +│   │   │   ├── build.make +│   │   │   ├── cmake_clean.cmake +│   │   │   ├── DependInfo.cmake +│   │   │   ├── depend.make +│   │   │   ├── flags.make +│   │   │   ├── link.txt +│   │   │   └── progress.make +│   │   ├── Makefile2 +│   │   ├── Makefile.cmake +│   │   ├── progress.marks +│   │   └── TargetDirectories.txt +│   ├── cmake_install.cmake +│   └── Makefile +├── CMakeLists.txt +├── main.cpp +---- + +All examples in this tutorial will use out-of-source builds. + + +# Building the Examples + +Below is sample output from building this example. + +[source,bash] +---- +$ mkdir build + +$ cd build + +$ cmake .. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Configuring done +-- Generating done +-- Build files have been written to: /workspace/cmake-examples/01-basic/hello_cmake/build + +$ make +Scanning dependencies of target hello_cmake +[100%] Building CXX object CMakeFiles/hello_cmake.dir/hello_cmake.cpp.o +Linking CXX executable hello_cmake +[100%] Built target hello_cmake + +$ ./hello_cmake +Hello CMake! +---- diff --git a/cmake/example/01-basic/A-hello-cmake/main.cpp b/cmake/example/01-basic/A-hello-cmake/main.cpp new file mode 100644 index 0000000..750dcac --- /dev/null +++ b/cmake/example/01-basic/A-hello-cmake/main.cpp @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + std::cout << "Hello CMake!" << std::endl; + return 0; +} \ No newline at end of file diff --git a/cmake/example/01-basic/B-hello-headers/CMakeLists.txt b/cmake/example/01-basic/B-hello-headers/CMakeLists.txt new file mode 100644 index 0000000..2c63e2c --- /dev/null +++ b/cmake/example/01-basic/B-hello-headers/CMakeLists.txt @@ -0,0 +1,23 @@ +# Set the minimum version of CMake that can be used +# To find the cmake version run +# $ cmake --version +cmake_minimum_required(VERSION 3.5) + +# Set the project name +project (hello_headers) + +# Create a sources variable with a link to all cpp files to compile +set(SOURCES + src/Hello.cpp + src/main.cpp +) + +# Add an executable with the above sources +add_executable(hello_headers ${SOURCES}) + +# Set the directories that should be included in the build command for this target +# when running g++ these will be included as -I/directory/path/ +target_include_directories(hello_headers + PRIVATE + ${PROJECT_SOURCE_DIR}/include +) diff --git a/cmake/example/01-basic/B-hello-headers/README.adoc b/cmake/example/01-basic/B-hello-headers/README.adoc new file mode 100644 index 0000000..16db117 --- /dev/null +++ b/cmake/example/01-basic/B-hello-headers/README.adoc @@ -0,0 +1,188 @@ += Hello Headers +:toc: +:toc-placement!: + +toc::[] + + +# Introduction + +Shows a hello world example which uses a different folder for source and include +files. + +The files in this tutorial include: + +``` +B-hello-headers$ tree +. +├── CMakeLists.txt +├── include +│   └── Hello.h +└── src + ├── Hello.cpp + └── main.cpp +``` + + * link:CMakeLists.txt[CMakeLists.txt] - Contains the CMake commands you wish to run. + * link:include/Hello.h[include/Hello.h] - The header file to include. + * link:src/Hello.cpp[src/Hello.cpp] - A source file to compile. + * link:src/main.cpp[src/main.cpp] - The source file with main. + + +# Concepts + +## Directory Paths + +CMake syntax specifies a number of https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/Useful-Variables[variables] +which can be used to help find useful directories in your project or source tree. +Some of these include: + +[cols=",",options="header",] +|======================================================================= +|Variable |Info +|CMAKE_SOURCE_DIR |The root source directory + +|CMAKE_CURRENT_SOURCE_DIR |The current source directory if using +sub-projects and directories. + +|PROJECT_SOURCE_DIR |The source directory of the current cmake project. + +|CMAKE_BINARY_DIR |The root binary / build directory. This is the +directory where you ran the cmake command. + +|CMAKE_CURRENT_BINARY_DIR |The build directory you are currently in. + +|PROJECT_BINARY_DIR |The build directory for the current project. +|======================================================================= + +## Source Files Variable + +Creating a variable which includes the source files allows you to be +clearer about these files and easily add them to multiple commands, for example, +the +add_executable()+ function. + +[source,cmake] +---- +# Create a sources variable with a link to all cpp files to compile +set(SOURCES + src/Hello.cpp + src/main.cpp +) + +add_executable(${PROJECT_NAME} ${SOURCES}) +---- + +[NOTE] +==== +An alternative to setting specific file names in the +SOURCES+ variable is +to use a GLOB command to find files using wildcard pattern matching. + +[source,cmake] +---- +file(GLOB SOURCES "src/*.cpp") +---- +==== + + +[TIP] +==== +For modern CMake it is NOT recommended to use a variable for sources. Instead it is +typical to directly declare the sources in the add_xxx function. + +This is particularly important for glob commands which may not always show you the +correct results if you add a new source file. +==== + +## Including Directories + +When you have different include folders, you can make your compiler aware of them using the ++target_include_directories()+ link:https://cmake.org/cmake/help/v3.0/command/target_include_directories.html[function]. When compiling this target this will add these directories to the compiler with the -I flag e.g. `-I/directory/path` + +[source,cmake] +---- +target_include_directories(target + PRIVATE + ${PROJECT_SOURCE_DIR}/include +) +---- + +The +PRIVATE+ identifier specifies the scope of the include. This is important for libraries and is explained in the next example. More details on the function is available link:https://cmake.org/cmake/help/v3.0/command/target_include_directories.html[here] + +# Building the Example + +## Standard Output + +The standard output from building this example is presented below. + +[source,bash] +---- +$ mkdir build + +$ cd build + +$ cmake .. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/01-basic/hello_headers/build + +$ make +Scanning dependencies of target hello_headers +[ 50%] Building CXX object CMakeFiles/hello_headers.dir/src/Hello.cpp.o +[100%] Building CXX object CMakeFiles/hello_headers.dir/src/main.cpp.o +Linking CXX executable hello_headers +[100%] Built target hello_headers + +$ ./hello_headers +Hello Headers! +---- + + +## Verbose Output + +In the previous examples, when running the make command the output only +shows the status of the build. To see the full output for debugging +purposes you can add +VERBOSE=1+ flag when running make. + +The VERBOSE output is show below, and a examination of the output shows +the include directories being added to the c++ compiler command. + +[source,bash] +---- +$ make clean + +$ make VERBOSE=1 +/usr/bin/cmake -H/home/matrim/workspace/cmake-examples/01-basic/hello_headers -B/home/matrim/workspace/cmake-examples/01-basic/hello_headers/build --check-build-system CMakeFiles/Makefile.cmake 0 +/usr/bin/cmake -E cmake_progress_start /home/matrim/workspace/cmake-examples/01-basic/hello_headers/build/CMakeFiles /home/matrim/workspace/cmake-examples/01-basic/hello_headers/build/CMakeFiles/progress.marks +make -f CMakeFiles/Makefile2 all +make[1]: Entering directory `/home/matrim/workspace/cmake-examples/01-basic/hello_headers/build' +make -f CMakeFiles/hello_headers.dir/build.make CMakeFiles/hello_headers.dir/depend +make[2]: Entering directory `/home/matrim/workspace/cmake-examples/01-basic/hello_headers/build' +cd /home/matrim/workspace/cmake-examples/01-basic/hello_headers/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/matrim/workspace/cmake-examples/01-basic/hello_headers /home/matrim/workspace/cmake-examples/01-basic/hello_headers /home/matrim/workspace/cmake-examples/01-basic/hello_headers/build /home/matrim/workspace/cmake-examples/01-basic/hello_headers/build /home/matrim/workspace/cmake-examples/01-basic/hello_headers/build/CMakeFiles/hello_headers.dir/DependInfo.cmake --color= +make[2]: Leaving directory `/home/matrim/workspace/cmake-examples/01-basic/hello_headers/build' +make -f CMakeFiles/hello_headers.dir/build.make CMakeFiles/hello_headers.dir/build +make[2]: Entering directory `/home/matrim/workspace/cmake-examples/01-basic/hello_headers/build' +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/01-basic/hello_headers/build/CMakeFiles 1 +[ 50%] Building CXX object CMakeFiles/hello_headers.dir/src/Hello.cpp.o +/usr/bin/c++ -I/home/matrim/workspace/cmake-examples/01-basic/hello_headers/include -o CMakeFiles/hello_headers.dir/src/Hello.cpp.o -c /home/matrim/workspace/cmake-examples/01-basic/hello_headers/src/Hello.cpp +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/01-basic/hello_headers/build/CMakeFiles 2 +[100%] Building CXX object CMakeFiles/hello_headers.dir/src/main.cpp.o +/usr/bin/c++ -I/home/matrim/workspace/cmake-examples/01-basic/hello_headers/include -o CMakeFiles/hello_headers.dir/src/main.cpp.o -c /home/matrim/workspace/cmake-examples/01-basic/hello_headers/src/main.cpp +Linking CXX executable hello_headers +/usr/bin/cmake -E cmake_link_script CMakeFiles/hello_headers.dir/link.txt --verbose=1 +/usr/bin/c++ CMakeFiles/hello_headers.dir/src/Hello.cpp.o CMakeFiles/hello_headers.dir/src/main.cpp.o -o hello_headers -rdynamic +make[2]: Leaving directory `/home/matrim/workspace/cmake-examples/01-basic/hello_headers/build' +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/01-basic/hello_headers/build/CMakeFiles 1 2 +[100%] Built target hello_headers +make[1]: Leaving directory `/home/matrim/workspace/cmake-examples/01-basic/hello_headers/build' +/usr/bin/cmake -E cmake_progress_start /home/matrim/workspace/cmake-examples/01-basic/hello_headers/build/CMakeFiles 0 +---- diff --git a/cmake/example/01-basic/B-hello-headers/include/Hello.h b/cmake/example/01-basic/B-hello-headers/include/Hello.h new file mode 100644 index 0000000..f838400 --- /dev/null +++ b/cmake/example/01-basic/B-hello-headers/include/Hello.h @@ -0,0 +1,10 @@ +#ifndef __HELLO_H__ +#define __HELLO_H__ + +class Hello +{ +public: + void print(); +}; + +#endif diff --git a/cmake/example/01-basic/B-hello-headers/src/Hello.cpp b/cmake/example/01-basic/B-hello-headers/src/Hello.cpp new file mode 100644 index 0000000..54d7e15 --- /dev/null +++ b/cmake/example/01-basic/B-hello-headers/src/Hello.cpp @@ -0,0 +1,8 @@ +#include + +#include "Hello.h" + +void Hello::print() +{ + std::cout << "Hello Headers!" << std::endl; +} diff --git a/cmake/example/01-basic/B-hello-headers/src/main.cpp b/cmake/example/01-basic/B-hello-headers/src/main.cpp new file mode 100644 index 0000000..62a1520 --- /dev/null +++ b/cmake/example/01-basic/B-hello-headers/src/main.cpp @@ -0,0 +1,8 @@ +#include "Hello.h" + +int main(int argc, char *argv[]) +{ + Hello hi; + hi.print(); + return 0; +} \ No newline at end of file diff --git a/cmake/example/01-basic/C-static-library/CMakeLists.txt b/cmake/example/01-basic/C-static-library/CMakeLists.txt new file mode 100644 index 0000000..3dc8210 --- /dev/null +++ b/cmake/example/01-basic/C-static-library/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.5) + +project(hello_library) + +############################################################ +# Create a library +############################################################ + +#Generate the static library from the library sources +add_library(hello_library STATIC + src/Hello.cpp +) + +target_include_directories(hello_library + PUBLIC + ${PROJECT_SOURCE_DIR}/include +) + + +############################################################ +# Create an executable +############################################################ + +# Add an executable with the above sources +add_executable(hello_binary + src/main.cpp +) + +# link the new hello_library target with the hello_binary target +target_link_libraries( hello_binary + PRIVATE + hello_library +) diff --git a/cmake/example/01-basic/C-static-library/README.adoc b/cmake/example/01-basic/C-static-library/README.adoc new file mode 100644 index 0000000..5f30a87 --- /dev/null +++ b/cmake/example/01-basic/C-static-library/README.adoc @@ -0,0 +1,164 @@ += Static Library +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +Shows a hello world example which first creates and links a static library. This is a +simplified example showing the library and binary in the same folder. Typically +these would be in sub-projects as described in section link:../../02-sub-projects[02-sub-projects] + +The files in this tutorial are below: + +``` +$ tree +. +├── CMakeLists.txt +├── include +│   └── static +│   └── Hello.h +└── src + ├── Hello.cpp + └── main.cpp +``` + + * link:CMakeLists.txt[] - Contains the CMake commands you wish to run + * link:include/static/Hello.h[] - The header file to include + * link:src/Hello.cpp[] - A source file to compile + * link:src/main.cpp[] - The source file with main + + +# Concepts + +## Adding a Static Library + +The +add_library()+ function is used to create a library from some source files. +This is called as follows: + +[source,cmake] +---- +add_library(hello_library STATIC + src/Hello.cpp +) +---- + +This will be used to create a static library with the name libhello_library.a with +the sources in the +add_library+ call. + +[NOTE] +==== +As mentioned in the previous example, we pass the source files directly to the ++add_library+ call, as recommended for modern CMake. +==== + +## Populating Including Directories + +In this example, we include directories in the library using the +target_include_directories()+ function with the scope set to +PUBLIC+. + +[source,cmake] +---- +target_include_directories(hello_library + PUBLIC + ${PROJECT_SOURCE_DIR}/include +) +---- + +This will cause the included directory used in the following places: + +* When compiling the library +* When compiling any additional target that links the library. + +The meaning of scopes are: + +* +PRIVATE+ - the directory is added to this target's include directories +* +INTERFACE+ - the directory is added to the include directories for any targets that link this library. +* +PUBLIC+ - As above, it is included in this library and also any targets that link this library. + + +[TIP] +==== +For public headers it is often a good idea to have your include folder be "namespaced" +with sub-directories. + +The directory passed to +target_include_directories+ will be the root of your +include directory tree and your C++ files should include the path from there to your header. + +For this example you can see that we do it as follows: +[source,cpp] +---- +#include "static/Hello.h" +---- + +Using this method means that there is less chance of header filename clashes when +you use multiple libraries in your project. +==== + +## Linking a Library + +When creating an executable that will use your library you must tell the compiler +about the library. This can be done using the +target_link_libraries()+ function. + +[source,cmake] +---- +add_executable(hello_binary + src/main.cpp +) + +target_link_libraries( hello_binary + PRIVATE + hello_library +) +---- + +This tells CMake to link the hello_library against the hello_binary executable +during link time. It will also propagate any include directories with +PUBLIC+ or +INTERFACE+ scope + from the linked library target. + +An example of this being called by the compiler is + +``` +/usr/bin/c++ CMakeFiles/hello_binary.dir/src/main.cpp.o -o hello_binary -rdynamic libhello_library.a +``` + + +# Building the Example + +[source,bash] +---- +$ mkdir build + +$ cd build + +$ cmake .. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/01-basic/C-static-library/build + +$ make +Scanning dependencies of target hello_library +[ 50%] Building CXX object CMakeFiles/hello_library.dir/src/Hello.cpp.o +Linking CXX static library libhello_library.a +[ 50%] Built target hello_library +Scanning dependencies of target hello_binary +[100%] Building CXX object CMakeFiles/hello_binary.dir/src/main.cpp.o +Linking CXX executable hello_binary +[100%] Built target hello_binary + +$ ls +CMakeCache.txt CMakeFiles cmake_install.cmake hello_binary libhello_library.a Makefile + +$ ./hello_binary +Hello Static Library! +---- diff --git a/cmake/example/01-basic/C-static-library/include/static/Hello.h b/cmake/example/01-basic/C-static-library/include/static/Hello.h new file mode 100644 index 0000000..f838400 --- /dev/null +++ b/cmake/example/01-basic/C-static-library/include/static/Hello.h @@ -0,0 +1,10 @@ +#ifndef __HELLO_H__ +#define __HELLO_H__ + +class Hello +{ +public: + void print(); +}; + +#endif diff --git a/cmake/example/01-basic/C-static-library/src/Hello.cpp b/cmake/example/01-basic/C-static-library/src/Hello.cpp new file mode 100644 index 0000000..3b15c03 --- /dev/null +++ b/cmake/example/01-basic/C-static-library/src/Hello.cpp @@ -0,0 +1,8 @@ +#include + +#include "static/Hello.h" + +void Hello::print() +{ + std::cout << "Hello Static Library!" << std::endl; +} diff --git a/cmake/example/01-basic/C-static-library/src/main.cpp b/cmake/example/01-basic/C-static-library/src/main.cpp new file mode 100644 index 0000000..bec6b3e --- /dev/null +++ b/cmake/example/01-basic/C-static-library/src/main.cpp @@ -0,0 +1,8 @@ +#include "static/Hello.h" + +int main(int argc, char *argv[]) +{ + Hello hi; + hi.print(); + return 0; +} diff --git a/cmake/example/01-basic/D-shared-library/CMakeLists.txt b/cmake/example/01-basic/D-shared-library/CMakeLists.txt new file mode 100644 index 0000000..49bf0d3 --- /dev/null +++ b/cmake/example/01-basic/D-shared-library/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.5) + +project(hello_library) + +############################################################ +# Create a library +############################################################ + +#Generate the shared library from the library sources +add_library(hello_library SHARED + src/Hello.cpp +) +add_library(hello::library ALIAS hello_library) + +target_include_directories(hello_library + PUBLIC + ${PROJECT_SOURCE_DIR}/include +) + +############################################################ +# Create an executable +############################################################ + +# Add an executable with the above sources +add_executable(hello_binary + src/main.cpp +) + +# link the new hello_library target with the hello_binary target +target_link_libraries( hello_binary + PRIVATE + hello::library +) diff --git a/cmake/example/01-basic/D-shared-library/README.adoc b/cmake/example/01-basic/D-shared-library/README.adoc new file mode 100644 index 0000000..adda586 --- /dev/null +++ b/cmake/example/01-basic/D-shared-library/README.adoc @@ -0,0 +1,125 @@ += Shared Library +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +Shows a hello world example which first creates and links a shared library. + +This also shows how to create an link:https://cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html#alias-targets[alias target] + +The files in this tutorial are below: + +``` +$ tree +. +├── CMakeLists.txt +├── include +│   └── shared +│   └── Hello.h +└── src + ├── Hello.cpp + └── main.cpp +``` + + * link:CMakeLists.txt[] - Contains the CMake commands you wish to run + * link:include/shared/Hello.h[] - The header file to include + * link:src/Hello.cpp[] - A source file to compile + * link:src/main.cpp[] - The source file with main + + +# Concepts + +## Adding a Shared Library + +As with the previous example on static libraries, the +add_library()+ function +is also used to create a shared library from some source files. +This is called as follows: + +[source,cmake] +---- +add_library(hello_library SHARED + src/Hello.cpp +) +---- + +This will be used to create a shared library with the name libhello_library.so with +the sources passed to the +add_library()+ function. + +## Alias Target + +As the name suggests an link:https://cmake.org/cmake/help/v3.0/manual/cmake-buildsystem.7.html#alias-targets[alias target] is an alternative name for a target that can be used instead of the real target name in read-only contexts. + +[source,cmake] +---- +add_library(hello::library ALIAS hello_library) +---- + +As shown below, this allows you to reference the target using the alias name when linking it against other targets. + +## Linking a Shared Library + +Linking a shared library is the same as linking a static library. When creating your +executable use the the +target_link_library()+ function to point to your library + +[source,cmake] +---- +add_executable(hello_binary + src/main.cpp +) + +target_link_libraries(hello_binary + PRIVATE + hello::library +) +---- + +This tells CMake to link the hello_library against the hello_binary executable using the alias target name. + +An example of this being called by the linker is + +``` +/usr/bin/c++ CMakeFiles/hello_binary.dir/src/main.cpp.o -o hello_binary -rdynamic libhello_library.so -Wl,-rpath,/home/matrim/workspace/cmake-examples/01-basic/D-shared-library/build +``` + +# Building the Example + +[source,bash] +---- +$ mkdir build + +$ cd build + +$ cmake .. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/01-basic/D-shared-library/build + +$ make +Scanning dependencies of target hello_library +[ 50%] Building CXX object CMakeFiles/hello_library.dir/src/Hello.cpp.o +Linking CXX shared library libhello_library.so +[ 50%] Built target hello_library +Scanning dependencies of target hello_binary +[100%] Building CXX object CMakeFiles/hello_binary.dir/src/main.cpp.o +Linking CXX executable hello_binary +[100%] Built target hello_binary + +$ ls +CMakeCache.txt CMakeFiles cmake_install.cmake hello_binary libhello_library.so Makefile + +$ ./hello_binary +Hello Shared Library! +---- diff --git a/cmake/example/01-basic/D-shared-library/include/shared/Hello.h b/cmake/example/01-basic/D-shared-library/include/shared/Hello.h new file mode 100644 index 0000000..f838400 --- /dev/null +++ b/cmake/example/01-basic/D-shared-library/include/shared/Hello.h @@ -0,0 +1,10 @@ +#ifndef __HELLO_H__ +#define __HELLO_H__ + +class Hello +{ +public: + void print(); +}; + +#endif diff --git a/cmake/example/01-basic/D-shared-library/src/Hello.cpp b/cmake/example/01-basic/D-shared-library/src/Hello.cpp new file mode 100644 index 0000000..865e58f --- /dev/null +++ b/cmake/example/01-basic/D-shared-library/src/Hello.cpp @@ -0,0 +1,8 @@ +#include + +#include "shared/Hello.h" + +void Hello::print() +{ + std::cout << "Hello Shared Library!" << std::endl; +} diff --git a/cmake/example/01-basic/D-shared-library/src/main.cpp b/cmake/example/01-basic/D-shared-library/src/main.cpp new file mode 100644 index 0000000..a57a9e9 --- /dev/null +++ b/cmake/example/01-basic/D-shared-library/src/main.cpp @@ -0,0 +1,8 @@ +#include "shared/Hello.h" + +int main(int argc, char *argv[]) +{ + Hello hi; + hi.print(); + return 0; +} diff --git a/cmake/example/01-basic/E-installing/CMakeLists.txt b/cmake/example/01-basic/E-installing/CMakeLists.txt new file mode 100644 index 0000000..5d03c5c --- /dev/null +++ b/cmake/example/01-basic/E-installing/CMakeLists.txt @@ -0,0 +1,53 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmake_examples_install) + +############################################################ +# Create a library +############################################################ + +#Generate the shared library from the library sources +add_library(cmake_examples_inst SHARED + src/Hello.cpp +) + +target_include_directories(cmake_examples_inst + PUBLIC + ${PROJECT_SOURCE_DIR}/include +) + +############################################################ +# Create an executable +############################################################ + +# Add an executable with the above sources +add_executable(cmake_examples_inst_bin + src/main.cpp +) + +# link the new hello_library target with the hello_binary target +target_link_libraries( cmake_examples_inst_bin + PRIVATE + cmake_examples_inst +) + +############################################################ +# Install +############################################################ + +# Binaries +install (TARGETS cmake_examples_inst_bin + DESTINATION bin) + +# Library +# Note: may not work on windows +install (TARGETS cmake_examples_inst + LIBRARY DESTINATION lib) + +# Header files +install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ + DESTINATION include) + +# Config +install (FILES cmake-examples.conf + DESTINATION etc) diff --git a/cmake/example/01-basic/E-installing/README.adoc b/cmake/example/01-basic/E-installing/README.adoc new file mode 100644 index 0000000..eb6e6e8 --- /dev/null +++ b/cmake/example/01-basic/E-installing/README.adoc @@ -0,0 +1,235 @@ += Installing +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +This example shows how to generate a `make install` target to install files and +binaries on your system. This is based on the previous shared library example. + +The files in this tutorial are below: + +``` +$ tree +. +├── cmake-examples.conf +├── CMakeLists.txt +├── include +│   └── installing +│   └── Hello.h +├── README.adoc +└── src + ├── Hello.cpp + └── main.cpp +``` + + * link:CMakeLists.txt[] - Contains the CMake commands you wish to run + * link:cmake-examples.conf[] - An example configuration file + * link:include/installing/Hello.h[] - The header file to include + * link:src/Hello.cpp[] - A source file to compile + * link:src/main.cpp[] - The source file with main + +# Concepts + +## Installing + +CMake offers the ability to add a `make install` target to allow a user to +install binaries, libraries and other files. The base install location is controlled +by the variable +CMAKE_INSTALL_PREFIX+ which can be set using ccmake or by calling +cmake with `cmake .. -DCMAKE_INSTALL_PREFIX=/install/location` + +The files that are installed are controlled by the https://cmake.org/cmake/help/v3.0/command/install.html[+install()+] function. + +[source,cmake] +---- +install (TARGETS cmake_examples_inst_bin + DESTINATION bin) +---- + +Install the binary generated from the target cmake_examples_inst_bin target to +the destination +${CMAKE_INSTALL_PREFIX}/bin+ + +[source,cmake] +---- +install (TARGETS cmake_examples_inst + LIBRARY DESTINATION lib) +---- + +Install the shared library generated from the target cmake_examples_inst target to +the destination +${CMAKE_INSTALL_PREFIX}/lib+ + +[NOTE] +==== +This may not work on windows. On platforms that have DLL targets you +may need to add the following + +[source,cmake] +---- +install (TARGETS cmake_examples_inst + LIBRARY DESTINATION lib + RUNTIME DESTINATION bin) +---- +==== + + +[source,cmake] +---- +install(DIRECTORY ${PROJECT_SOURCE_DIR}/include/ + DESTINATION include) +---- + +Install the header files for developing against the +cmake_examples_inst+ library +into the +${CMAKE_INSTALL_PREFIX}/include+ directory. + +[source,cmake] +---- +install (FILES cmake-examples.conf + DESTINATION etc) +---- + +Install a configuration file to the destination +${CMAKE_INSTALL_PREFIX}/etc+ + +After `make install` has been run, CMake generates an install_manifest.txt file +which includes details on all installed files. + +[NOTE] +==== +If you run the `make install` command as root, the install_manifest.txt file will +be owned by root. +==== + +# Building the Example + +[source,bash] +---- +$ mkdir build + +$ cd build/ + +$ cmake .. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/01-basic/E-installing/build + +$ make +Scanning dependencies of target cmake_examples_inst +[ 50%] Building CXX object CMakeFiles/cmake_examples_inst.dir/src/Hello.cpp.o +Linking CXX shared library libcmake_examples_inst.so +[ 50%] Built target cmake_examples_inst +Scanning dependencies of target cmake_examples_inst_bin +[100%] Building CXX object CMakeFiles/cmake_examples_inst_bin.dir/src/main.cpp.o +Linking CXX executable cmake_examples_inst_bin +[100%] Built target cmake_examples_inst_bin + +$ sudo make install +[sudo] password for matrim: +[ 50%] Built target cmake_examples_inst +[100%] Built target cmake_examples_inst_bin +Install the project... +-- Install configuration: "" +-- Installing: /usr/local/bin/cmake_examples_inst_bin +-- Removed runtime path from "/usr/local/bin/cmake_examples_inst_bin" +-- Installing: /usr/local/lib/libcmake_examples_inst.so +-- Installing: /usr/local/etc/cmake-examples.conf + +$ cat install_manifest.txt +/usr/local/bin/cmake_examples_inst_bin +/usr/local/lib/libcmake_examples_inst.so +/usr/local/etc/cmake-examples.conf + +$ ls /usr/local/bin/ +cmake_examples_inst_bin + +$ ls /usr/local/lib +libcmake_examples_inst.so + +$ ls /usr/local/etc/ +cmake-examples.conf + +$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib cmake_examples_inst_bin +Hello Install! +---- + +[NOTE] +==== +If `/usr/local/lib` is not in your library path you may need to add it to the +path before running the binary. +==== + +[[extra-notes]] +Extra Notes +~~~~~~~~~~~ + +[[default-location]] +Overriding the default install location +^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ + +As mentioned the default install location is set from the +CMAKE_INSTALL_PREFIX+, +which defaults to `/usr/local/` + +If you want to change this default location for all users you can add the +following code to your top level CMakeLists.txt before adding any binaries or +libraries. + +[source,cmake] +---- +if( CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT ) + message(STATUS "Setting default CMAKE_INSTALL_PREFIX path to ${CMAKE_BINARY_DIR}/install") + set(CMAKE_INSTALL_PREFIX "${CMAKE_BINARY_DIR}/install" CACHE STRING "The path to use for make install" FORCE) +endif() +---- + +This example sets the default install location to under your build directory. + +[[destdir]] +DESTDIR +^^^^^^^ + +If you wish to stage your install to confirm that all files are included the +`make install` target supports the DESTDIR argument. + +``` +make install DESTDIR=/tmp/stage +``` + +This will create the install path `${DESTDIR}/${CMAKE_INSTALL_PREFIX}` for all +your installation files. In this example, it would install all files under the +path `/tmp/stage/usr/local` + +``` +$ tree /tmp/stage +/tmp/stage +└── usr + └── local + ├── bin + │   └── cmake_examples_inst_bin + ├── etc + │   └── cmake-examples.conf + └── lib + └── libcmake_examples_inst.so +``` + +[[uninstall]] +Uninstall +^^^^^^^^^ + +By default CMake does not add a `make uninstall` target. For details on how to generate +an uninstall target see this https://cmake.org/Wiki/CMake_FAQ#Can_I_do_.22make_uninstall.22_with_CMake.3F[FAQ] + +For an easy way to remove the files from this example, you can use: + +``` +sudo xargs rm < install_manifest.txt +``` diff --git a/cmake/example/01-basic/E-installing/cmake-examples.conf b/cmake/example/01-basic/E-installing/cmake-examples.conf new file mode 100644 index 0000000..d530261 --- /dev/null +++ b/cmake/example/01-basic/E-installing/cmake-examples.conf @@ -0,0 +1 @@ +# Sample configuration file that could be installed diff --git a/cmake/example/01-basic/E-installing/include/installing/Hello.h b/cmake/example/01-basic/E-installing/include/installing/Hello.h new file mode 100644 index 0000000..f838400 --- /dev/null +++ b/cmake/example/01-basic/E-installing/include/installing/Hello.h @@ -0,0 +1,10 @@ +#ifndef __HELLO_H__ +#define __HELLO_H__ + +class Hello +{ +public: + void print(); +}; + +#endif diff --git a/cmake/example/01-basic/E-installing/src/Hello.cpp b/cmake/example/01-basic/E-installing/src/Hello.cpp new file mode 100644 index 0000000..13350ed --- /dev/null +++ b/cmake/example/01-basic/E-installing/src/Hello.cpp @@ -0,0 +1,8 @@ +#include + +#include "installing/Hello.h" + +void Hello::print() +{ + std::cout << "Hello Install!" << std::endl; +} diff --git a/cmake/example/01-basic/E-installing/src/main.cpp b/cmake/example/01-basic/E-installing/src/main.cpp new file mode 100644 index 0000000..960f3a0 --- /dev/null +++ b/cmake/example/01-basic/E-installing/src/main.cpp @@ -0,0 +1,8 @@ +#include "installing/Hello.h" + +int main(int argc, char *argv[]) +{ + Hello hi; + hi.print(); + return 0; +} diff --git a/cmake/example/01-basic/F-build-type/CMakeLists.txt b/cmake/example/01-basic/F-build-type/CMakeLists.txt new file mode 100644 index 0000000..cdbfd18 --- /dev/null +++ b/cmake/example/01-basic/F-build-type/CMakeLists.txt @@ -0,0 +1,19 @@ +# Set the minimum version of CMake that can be used +# To find the cmake version run +# $ cmake --version +cmake_minimum_required(VERSION 3.5) + +# Set a default build type if none was specified +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message("Setting build type to 'RelWithDebInfo' as none was specified.") + set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" + "MinSizeRel" "RelWithDebInfo") +endif() + +# Set the project name +project (build_type) + +# Add an executable +add_executable(cmake_examples_build_type main.cpp) diff --git a/cmake/example/01-basic/F-build-type/README.adoc b/cmake/example/01-basic/F-build-type/README.adoc new file mode 100644 index 0000000..5635286 --- /dev/null +++ b/cmake/example/01-basic/F-build-type/README.adoc @@ -0,0 +1,158 @@ += Build Type +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +CMake has a number of built in build configurations which can be used to compile +your project. These specify the optimization levels and if debug information is +to be included in the binary. + +The levels provided are: + + * Release - Adds the `-O3 -DNDEBUG` flags to the compiler + * Debug - Adds the `-g` flag + * MinSizeRel - Adds `-Os -DNDEBUG` + * RelWithDebInfo - Adds `-O2 -g -DNDEBUG` flags + +The files in this tutorial are below: + +``` +$ tree +. +├── CMakeLists.txt +├── main.cpp +``` + + * link:CMakeLists.txt[] - Contains the CMake commands you wish to run + * link:main.cpp[] - The source file with main + +# Concepts + +## Set Build Type + +The build type can be set using the following methods. + + - Using a gui tool such as ccmake / cmake-gui + +image::cmake-gui-build-type.png[cmake-gui build type] + + - Passing into cmake + +[source,cmake] +---- +cmake .. -DCMAKE_BUILD_TYPE=Release +---- + +## Set Default Build Type + +The default build type provided by CMake is to include no compiler flags for +optimization. For some projects you may want to +set a default build type so that you do not have to remember to set it. + +To do this you can add the following to your top level CMakeLists.txt + +[source,cmake] +---- +if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES) + message("Setting build type to 'RelWithDebInfo' as none was specified.") + set(CMAKE_BUILD_TYPE RelWithDebInfo CACHE STRING "Choose the type of build." FORCE) + # Set the possible values of build type for cmake-gui + set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" + "MinSizeRel" "RelWithDebInfo") +endif() +---- + +# Building the Example + +[source,bash] +---- +$ mkdir build + +$ cd build/ + +$ cmake .. +Setting build type to 'RelWithDebInfo' as none was specified. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build + +$ make VERBOSE=1 +/usr/bin/cmake -H/home/matrim/workspace/cmake-examples/01-basic/F-build-type -B/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build --check-build-system CMakeFiles/Makefile.cmake 0 +/usr/bin/cmake -E cmake_progress_start /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles/progress.marks +make -f CMakeFiles/Makefile2 all +make[1]: Entering directory `/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build' +make -f CMakeFiles/cmake_examples_build_type.dir/build.make CMakeFiles/cmake_examples_build_type.dir/depend +make[2]: Entering directory `/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build' +cd /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/matrim/workspace/cmake-examples/01-basic/F-build-type /home/matrim/workspace/cmake-examples/01-basic/F-build-type /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles/cmake_examples_build_type.dir/DependInfo.cmake --color= +Dependee "/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles/cmake_examples_build_type.dir/DependInfo.cmake" is newer than depender "/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles/cmake_examples_build_type.dir/depend.internal". +Dependee "/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles/cmake_examples_build_type.dir/depend.internal". +Scanning dependencies of target cmake_examples_build_type +make[2]: Leaving directory `/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build' +make -f CMakeFiles/cmake_examples_build_type.dir/build.make CMakeFiles/cmake_examples_build_type.dir/build +make[2]: Entering directory `/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build' +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles 1 +[100%] Building CXX object CMakeFiles/cmake_examples_build_type.dir/main.cpp.o +/usr/bin/c++ -O2 -g -DNDEBUG -o CMakeFiles/cmake_examples_build_type.dir/main.cpp.o -c /home/matrim/workspace/cmake-examples/01-basic/F-build-type/main.cpp +Linking CXX executable cmake_examples_build_type +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmake_examples_build_type.dir/link.txt --verbose=1 +/usr/bin/c++ -O2 -g -DNDEBUG CMakeFiles/cmake_examples_build_type.dir/main.cpp.o -o cmake_examples_build_type -rdynamic +make[2]: Leaving directory `/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build' +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles 1 +[100%] Built target cmake_examples_build_type +make[1]: Leaving directory `/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build' +/usr/bin/cmake -E cmake_progress_start /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles 0$ mkdir build +$ cd build/ +/build$ cmake .. +Setting build type to 'RelWithDebInfo' as none was specified. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build +/build$ make VERBOSE=1 +/usr/bin/cmake -H/home/matrim/workspace/cmake-examples/01-basic/F-build-type -B/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build --check-build-system CMakeFiles/Makefile.cmake 0 +/usr/bin/cmake -E cmake_progress_start /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles/progress.marks +make -f CMakeFiles/Makefile2 all +make[1]: Entering directory `/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build' +make -f CMakeFiles/cmake_examples_build_type.dir/build.make CMakeFiles/cmake_examples_build_type.dir/depend +make[2]: Entering directory `/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build' +cd /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/matrim/workspace/cmake-examples/01-basic/F-build-type /home/matrim/workspace/cmake-examples/01-basic/F-build-type /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles/cmake_examples_build_type.dir/DependInfo.cmake --color= +Dependee "/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles/cmake_examples_build_type.dir/DependInfo.cmake" is newer than depender "/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles/cmake_examples_build_type.dir/depend.internal". +Dependee "/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles/cmake_examples_build_type.dir/depend.internal". +Scanning dependencies of target cmake_examples_build_type +make[2]: Leaving directory `/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build' +make -f CMakeFiles/cmake_examples_build_type.dir/build.make CMakeFiles/cmake_examples_build_type.dir/build +make[2]: Entering directory `/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build' +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles 1 +[100%] Building CXX object CMakeFiles/cmake_examples_build_type.dir/main.cpp.o +/usr/bin/c++ -O2 -g -DNDEBUG -o CMakeFiles/cmake_examples_build_type.dir/main.cpp.o -c /home/matrim/workspace/cmake-examples/01-basic/F-build-type/main.cpp +Linking CXX executable cmake_examples_build_type +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmake_examples_build_type.dir/link.txt --verbose=1 +/usr/bin/c++ -O2 -g -DNDEBUG CMakeFiles/cmake_examples_build_type.dir/main.cpp.o -o cmake_examples_build_type -rdynamic +make[2]: Leaving directory `/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build' +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles 1 +[100%] Built target cmake_examples_build_type +make[1]: Leaving directory `/home/matrim/workspace/cmake-examples/01-basic/F-build-type/build' +/usr/bin/cmake -E cmake_progress_start /home/matrim/workspace/cmake-examples/01-basic/F-build-type/build/CMakeFiles 0 +---- diff --git a/cmake/example/01-basic/F-build-type/cmake-gui-build-type.png b/cmake/example/01-basic/F-build-type/cmake-gui-build-type.png new file mode 100644 index 0000000000000000000000000000000000000000..37a92d04898e2e6ff7f626360f4c9ceb81a1e4f4 GIT binary patch literal 90872 zcmaI7WmH_v(gupVL~u=Tch@992<{Nv-QC@SyE_DTcL+MT1|8gCa2N&|;Bvlu-gD0V zb7$=}Th?CPy{o#apQ?H~LQ!546O9NB1_lOG>W8>83=DiF3=A9}3eww?XmkIyw-bW% zHz`$=x1SG+$*;G2LKlgjE-LnBF7Ad-rZDDq_O_EwoFV-v2@mDLLPjO+zvLLav@!Z!WZ2a!iTw) zN^#wg4MEm-Y^;mP0;qDtXtyx32w&g*`zY{TL8wx)Nb2)&SZ%Tdf$aZUz4C1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Y|povE`*|2hP@9LcG{Ux$WfbUa9IcB-DuOx>5u6YJB=df#~LsqcH%AqH2K;6hfM+! zS&hx|eY|sRWBFFa@7Pl=Y%>qy%Ra{%eQcL1GA^R(^)<|vf7X;1X-4D*a8ZpH|tp)QTY};9XhL zh-ieZ!#Il34m2%{NC-CEe2mM=D{}MxP`N?^X|e9nvG_fosdV&Qn+5YC;+obE?-tqM zZ5L+JAqp!3A{u!{1&g6eH3PKhxuA@;R(=zP=5MydUIb(sjV)aIq;u(q8s*}G>jjJ3 z?mwMe6V?1$MNP;02{2m3m?vF9 zR+9&I{${piSzwEN$$@a8_165+F1{GyPGM2n?h};`9C_2#KDmRXi!uWQxv9%OaAoTh zelSKd0(4BK+NG`bS%^Ndf8b*=62O5QoNKja3l)-2t$PiVnmV7B)7dCxW8a<3j{b@c z$nO)GtX9vvu~LbHKAm!W=4#aZ+|f&u*4wI~czU}z@1~?set3!NT8k%5YiZT8`Hq5t z+U?9>`7i>653${0HKbmDU1pEPfJr~yp-cg?*aVqV+&j~EHFwUcWDe=M<3l#IuNGErL z^&gmJUGP_691R+6Qg!?-=UY5ucbeqn(KoSg2gUE}v8mrZ9GE($cgndlE8jZ4?2dZl z38(bT_4>blsIMR8zZ_-zrJ9`k{{aEMK)gCxLVRAv@r2_SIgw&>!oGX)=J)Bve=w!B zza9O{E#-d;vCqH68^^CO{(JE@N^d7aK|x8Ssd`8Mm;Lq4c|6~;TE2H1heIEXuoW`%G`2UgI|4~9#DKY<4+i$V^zkEi&EB*Cl-S`|Fd}Ee_ z@mO$&Y7|^x%IYvF-she^0TS}3{Sy7ozlHg~)$PBeuS_uqlPBsopCAr(myb@}c4haq T993$fAQ#QM+N!zARxkbo#}Bs= literal 0 HcmV?d00001 diff --git a/cmake/example/01-basic/F-build-type/main.cpp b/cmake/example/01-basic/F-build-type/main.cpp new file mode 100644 index 0000000..eb3dda0 --- /dev/null +++ b/cmake/example/01-basic/F-build-type/main.cpp @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + std::cout << "Hello Build Type!" << std::endl; + return 0; +} diff --git a/cmake/example/01-basic/G-compile-flags/CMakeLists.txt b/cmake/example/01-basic/G-compile-flags/CMakeLists.txt new file mode 100644 index 0000000..56e2261 --- /dev/null +++ b/cmake/example/01-basic/G-compile-flags/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.5) + +# Set a default C++ compile flag +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEX2" CACHE STRING "Set C++ Compiler Flags" FORCE) + +# Set the project name +project (compile_flags) + +# Add an executable +add_executable(cmake_examples_compile_flags main.cpp) + +target_compile_definitions(cmake_examples_compile_flags + PRIVATE EX3 +) diff --git a/cmake/example/01-basic/G-compile-flags/README.adoc b/cmake/example/01-basic/G-compile-flags/README.adoc new file mode 100644 index 0000000..7e55abc --- /dev/null +++ b/cmake/example/01-basic/G-compile-flags/README.adoc @@ -0,0 +1,138 @@ += Compile Flags +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +CMake supports setting compile flags in a number of different ways: + + * using +target_compile_definitions()+ function + * using the +CMAKE_C_FLAGS+ and +CMAKE_CXX_FLAGS+ variables. + +The files in this tutorial are below: + +``` +$ tree +. +├── CMakeLists.txt +├── main.cpp +``` + + * link:CMakeLists.txt[] - Contains the CMake commands you wish to run + * link:main.cpp[] - The source file with main + +# Concepts + +# Set Per-Target C++ Flags + +The recommended way to set C++ flags in modern CMake is to use per-target flags which can be populated to other targets +through the +target_compile_definitions()+ link:https://cmake.org/cmake/help/v3.0/command/target_compile_definitions.html?highlight=target_compile_definitions[function]. This will populate the link:https://cmake.org/cmake/help/v3.0/prop_tgt/INTERFACE_COMPILE_DEFINITIONS.html#prop_tgt:INTERFACE_COMPILE_DEFINITIONS[INTERFACE_COMPILE_DEFINITIONS] for the library and push the definition to the linked target depending on the scope. + +[source,cmake] +---- +target_compile_definitions(cmake_examples_compile_flags + PRIVATE EX3 +) +---- + +This will cause the compiler to add the definition +-DEX3+ when compiling the target. + +If the target was a library and the scope +PUBLIC+ or +INTERFACE+ has been chosen the definition would also be included in any executables that link this target. + +For compiler options you can also use the +target_compile_options()+ link:https://cmake.org/cmake/help/v3.0/command/target_compile_options.html[function]. + +## Set Default C++ Flags + +The default `CMAKE_CXX_FLAGS` is either empty or contains the appropriate flags +for the build type. + +To set additional default compile flags you can add the following to your +top level CMakeLists.txt + +[source,cmake] +---- +set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DEX2" CACHE STRING "Set C++ Compiler Flags" FORCE) +---- + +Similarly to +CMAKE_CXX_FLAGS+ other options include: + + * Setting C compiler flags using +CMAKE_C_FLAGS+ + * Setting linker flags using +CMAKE_LINKER_FLAGS+. + +[NOTE] +==== +The values `CACHE STRING "Set C++ Compiler Flags" FORCE` from the above command +are used to force this variable to be set in the CMakeCache.txt file. + +For more details, see https://cmake.org/cmake/help/v3.0/command/set.html[here] +==== + + +Once set the +CMAKE_C_FLAGS+ and +CMAKE_CXX_FLAGS+ will set a compiler flag / definition globally for all targets in this directory or any included sub-directories. This method is not recommended for general usage now and the +target_compile_definitions+ function is preferred. + +### Set CMake Flags + +Similar to the build type a global C++ compiler flag can be set using the following methods. + + - Using a gui tool such as ccmake / cmake-gui + +image::cmake-gui-set-cxx-flag.png[cmake-gui set cxx flag] + + - Passing into cmake + +[source,cmake] +---- +cmake .. -DCMAKE_CXX_FLAGS="-DEX3" +---- + +# Building the Example + +[source,bash] +---- +$ mkdir build + +$ cd build/ + +$ cmake .. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build + +$ make VERBOSE=1 +/usr/bin/cmake -H/home/matrim/workspace/cmake-examples/01-basic/G-compile-flags -B/home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build --check-build-system CMakeFiles/Makefile.cmake 0 +/usr/bin/cmake -E cmake_progress_start /home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build/CMakeFiles /home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build/CMakeFiles/progress.marks +make -f CMakeFiles/Makefile2 all +make[1]: Entering directory `/home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build' +make -f CMakeFiles/cmake_examples_compile_flags.dir/build.make CMakeFiles/cmake_examples_compile_flags.dir/depend +make[2]: Entering directory `/home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build' +cd /home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/matrim/workspace/cmake-examples/01-basic/G-compile-flags /home/matrim/workspace/cmake-examples/01-basic/G-compile-flags /home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build /home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build /home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build/CMakeFiles/cmake_examples_compile_flags.dir/DependInfo.cmake --color= +Dependee "/home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build/CMakeFiles/cmake_examples_compile_flags.dir/DependInfo.cmake" is newer than depender "/home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build/CMakeFiles/cmake_examples_compile_flags.dir/depend.internal". +Dependee "/home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build/CMakeFiles/cmake_examples_compile_flags.dir/depend.internal". +Scanning dependencies of target cmake_examples_compile_flags +make[2]: Leaving directory `/home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build' +make -f CMakeFiles/cmake_examples_compile_flags.dir/build.make CMakeFiles/cmake_examples_compile_flags.dir/build +make[2]: Entering directory `/home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build' +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build/CMakeFiles 1 +[100%] Building CXX object CMakeFiles/cmake_examples_compile_flags.dir/main.cpp.o +/usr/bin/c++ -DEX2 -o CMakeFiles/cmake_examples_compile_flags.dir/main.cpp.o -c /home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/main.cpp +Linking CXX executable cmake_examples_compile_flags +/usr/bin/cmake -E cmake_link_script CMakeFiles/cmake_examples_compile_flags.dir/link.txt --verbose=1 +/usr/bin/c++ -DEX2 CMakeFiles/cmake_examples_compile_flags.dir/main.cpp.o -o cmake_examples_compile_flags -rdynamic +make[2]: Leaving directory `/home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build' +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build/CMakeFiles 1 +[100%] Built target cmake_examples_compile_flags +make[1]: Leaving directory `/home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build' +/usr/bin/cmake -E cmake_progress_start /home/matrim/workspace/cmake-examples/01-basic/G-compile-flags/build/CMakeFiles 0 +---- diff --git a/cmake/example/01-basic/G-compile-flags/main.cpp b/cmake/example/01-basic/G-compile-flags/main.cpp new file mode 100644 index 0000000..d3a2e5d --- /dev/null +++ b/cmake/example/01-basic/G-compile-flags/main.cpp @@ -0,0 +1,17 @@ +#include + +int main(int argc, char *argv[]) +{ + std::cout << "Hello Compile Flags!" << std::endl; + + // only print if compile flag set +#ifdef EX2 + std::cout << "Hello Compile Flag EX2!" << std::endl; +#endif + +#ifdef EX3 + std::cout << "Hello Compile Flag EX3!" << std::endl; +#endif + + return 0; +} diff --git a/cmake/example/01-basic/H-third-party-library/CMakeLists.txt b/cmake/example/01-basic/H-third-party-library/CMakeLists.txt new file mode 100644 index 0000000..85128ef --- /dev/null +++ b/cmake/example/01-basic/H-third-party-library/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.5) + +# Set the project name +project (third_party_include) + + +# find a boost install with the libraries filesystem and system +find_package(Boost 1.46.1 REQUIRED COMPONENTS filesystem system) + +# check if boost was found +if(Boost_FOUND) + message ("boost found") +else() + message (FATAL_ERROR "Cannot find Boost") +endif() + +# Add an executable +add_executable(third_party_include main.cpp) + +# link against the boost libraries +target_link_libraries( third_party_include + PRIVATE + Boost::filesystem +) diff --git a/cmake/example/01-basic/H-third-party-library/README.adoc b/cmake/example/01-basic/H-third-party-library/README.adoc new file mode 100644 index 0000000..9e8fcdc --- /dev/null +++ b/cmake/example/01-basic/H-third-party-library/README.adoc @@ -0,0 +1,213 @@ += Including Third Party Library +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +Nearly all non-trivial projects will have a requirement for including third party +libraries, headers, or programs. CMake has support for finding the path to these tools using +the `find_package()` function. This will search for CMake modules in the format +"FindXXX.cmake" from the list of folders in `CMAKE_MODULE_PATH`. On linux the +default search path will include `/usr/share/cmake/Modules`. On my system this +includes support for approximately 142 common third party libraries. + + +The files in this tutorial are below: + +``` +$ tree +. +├── CMakeLists.txt +├── main.cpp +``` + + * link:CMakeLists.txt[] - Contains the CMake commands you wish to run + * link:main.cpp[] - The source file with main + +# Requirements + +This example requires the boost libraries to be installed in a default system +location. + +# Concepts + +## Finding a Package + +As mentioned above the `find_package()` function will search for CMake modules in the formant +"FindXXX.cmake" from the list of folders in `CMAKE_MODULE_PATH`. The exact +format of the arguments to `find_package` will depend on the module you are looking +for. This is typically documented at the top of the `FindXXX.cmake` file. + +A basic example of finding boost is below: + +[source,cmake] +---- +find_package(Boost 1.46.1 REQUIRED COMPONENTS filesystem system) +---- + +The arguments are: + + * Boost - Name of the library. This is part of used to find the module file FindBoost.cmake + * 1.46.1 - The minimum version of boost to find + * REQUIRED - Tells the module that this is required and to fail if it cannot be found + * COMPONENTS - The list of components to find in the library. + +Boost includes can take more arguments and also make use of other variables. +More complex setups are provided in later examples. + + +## Checking if the package is found + +Most included packages will set a variable `XXX_FOUND`, which can be used to check +if the package is available on the system. + +In this example the variable is `Boost_FOUND`: + +[source,cmake] +---- +if(Boost_FOUND) + message ("boost found") + include_directories(${Boost_INCLUDE_DIRS}) +else() + message (FATAL_ERROR "Cannot find Boost") +endif() +---- + +## Exported Variables + +After a package is found it will often export variables which can inform the user +where to find the library, header, or executable files. Similar to the `XXX_FOUND` +variable, these are package specific and are typically documented at the top of the +`FindXXX.cmake` file. + +The variables exported in this example include: + + * `Boost_INCLUDE_DIRS` - The path to the boost header files. + +In some cases you can also check these variables by examining the cache using +ccmake or cmake-gui. + +## Alias / Imported targets + +Most modern CMake libraries link:https://cmake.org/cmake/help/v3.6/prop_tgt/IMPORTED.html#prop_tgt:IMPORTED[export] +ALIAS+ targets in their module files. +The benefit of imported targets are that they can also populate include directories and linked libraries. + +For example, starting from v3.5+ of CMake, the +Boost module supports this. Similar to using your own ALIAS target for libraires, an +ALIAS+ in a module can make referencing found targets easier. + +In the case of Boost, all targets are exported using the `Boost::` identifier and then the name +of the subsystem. For example you can use: + + * `Boost::boost` for header only libraries + * `Boost::system` for the boost system library. + * `Boost::filesystem` for filesystem library. + +As with your own targets, these targets include their dependencies, so linking against +`Boost::filesystem` will automatically add `Boost::boost` and `Boost::system` dependencies. + +To link against an imported target you can use the following: + +[source,cmake] +---- + target_link_libraries( third_party_include + PRIVATE + Boost::filesystem + ) +---- + +## Non-alias targets + +While most modern libraries use imported targets, not all modules have been updated. In the +case where a library hasn't been updated you will often find the following variables available: + + * xxx_INCLUDE_DIRS - A variable pointing to the include directory for the library. + * xxx_LIBRARY - A variable pointing to the library path. + +These can then be added to your +target_include_directories+ and +target_link_libraries+ as: + +[source,cmake] +---- +# Include the boost headers +target_include_directories( third_party_include + PRIVATE ${Boost_INCLUDE_DIRS} +) + +# link against the boost libraries +target_link_libraries( third_party_include + PRIVATE + ${Boost_SYSTEM_LIBRARY} + ${Boost_FILESYSTEM_LIBRARY} +) +---- + +# Building the Example + +[source,bash] +---- +$ mkdir build + +$ cd build/ + +$ cmake .. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Boost version: 1.54.0 +-- Found the following Boost libraries: +-- filesystem +-- system +boost found +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/01-basic/H-third-party-library/build + +$ make +Scanning dependencies of target third_party_include +[100%] Building CXX object CMakeFiles/third_party_include.dir/main.cpp.o +Linking CXX executable third_party_include +[100%] Built target third_party_include +matrim@freyr:~/workspace/cmake-examples/01-basic/H-third-party-library/build$ ./ +CMakeFiles/ third_party_include +matrim@freyr:~/workspace/cmake-examples/01-basic/H-third-party-library/build$ ./third_party_include +Hello Third Party Include! +Path is not relative +$ cmake .. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Boost version: 1.54.0 +-- Found the following Boost libraries: +-- filesystem +-- system +boost found +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/01-basic/H-third-party-library/build + +$ make +Scanning dependencies of target third_party_include +[100%] Building CXX object CMakeFiles/third_party_include.dir/main.cpp.o +Linking CXX executable third_party_include +[100%] Built target third_party_include + +$ ./third_party_include +Hello Third Party Include! +Path is not relative + +---- diff --git a/cmake/example/01-basic/H-third-party-library/main.cpp b/cmake/example/01-basic/H-third-party-library/main.cpp new file mode 100644 index 0000000..c7b58af --- /dev/null +++ b/cmake/example/01-basic/H-third-party-library/main.cpp @@ -0,0 +1,24 @@ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + std::cout << "Hello Third Party Include!" << std::endl; + + // use a shared ptr + boost::shared_ptr isp(new int(4)); + + // trivial use of boost filesystem + boost::filesystem::path path = "/usr/share/cmake/modules"; + if(path.is_relative()) + { + std::cout << "Path is relative" << std::endl; + } + else + { + std::cout << "Path is not relative" << std::endl; + } + + return 0; +} diff --git a/cmake/example/01-basic/I-compiling-with-clang/CMakeLists.txt b/cmake/example/01-basic/I-compiling-with-clang/CMakeLists.txt new file mode 100644 index 0000000..0a43a8e --- /dev/null +++ b/cmake/example/01-basic/I-compiling-with-clang/CMakeLists.txt @@ -0,0 +1,10 @@ +# Set the minimum version of CMake that can be used +# To find the cmake version run +# $ cmake --version +cmake_minimum_required(VERSION 3.5) + +# Set the project name +project (hello_cmake) + +# Add an executable +add_executable(hello_cmake main.cpp) diff --git a/cmake/example/01-basic/I-compiling-with-clang/README.adoc b/cmake/example/01-basic/I-compiling-with-clang/README.adoc new file mode 100644 index 0000000..3d4ae9c --- /dev/null +++ b/cmake/example/01-basic/I-compiling-with-clang/README.adoc @@ -0,0 +1,126 @@ += Compiling with clang +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +When building with CMake it is possible to set the C and C++ compiler. This example +is the same as the link:../A-hello-cmake[hello-cmake] example except that it shows the most basic +method of changing the compiler from the default gcc to http://clang.llvm.org/[clang]. + +The files in this tutorial are below: + +``` +$ tree +. +├── CMakeLists.txt +├── main.cpp +``` + + * link:CMakeLists.txt[] - Contains the CMake commands you wish to run + * link:main.cpp[] - A simple "Hello World" cpp file. + +# Concepts + +### Compiler Option + +CMake exposes options to control the programs used to compile and link your code. These +programs include: + + * CMAKE_C_COMPILER - The program used to compile c code. + * CMAKE_CXX_COMPILER - The program used to compile c++ code. + * CMAKE_LINKER - The program used to link your binary. + +[NOTE] +==== +In this example clang-3.6 is installed via the command `sudo apt-get install clang-3.6` +==== + +[NOTE] +==== +This is the most basic and easiest way to invoke clang. Future examples will show better +ways to invoke the compiler. +==== + + +### Setting Flags + +As described in the link:../F-build-type[Build Type] example, you can set CMake options +using either a cmake gui or by passing from the command line. + +Below is an example of passing the compiler via the command line. + +[source,cmake] +---- +cmake .. -DCMAKE_C_COMPILER=clang-3.6 -DCMAKE_CXX_COMPILER=clang++-3.6 +---- + +After setting these options, when your run `make` clang will be used to compile your binary. This +can be seen from the following lines in the make output. + +[source,bash] +---- +/usr/bin/clang++-3.6 -o CMakeFiles/hello_cmake.dir/main.cpp.o -c /home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/main.cpp +Linking CXX executable hello_cmake +/usr/bin/cmake -E cmake_link_script CMakeFiles/hello_cmake.dir/link.txt --verbose=1 +/usr/bin/clang++-3.6 CMakeFiles/hello_cmake.dir/main.cpp.o -o hello_cmake -rdynamic +---- + + + +# Building the Examples + +Below is sample output from building this example. + +[source,bash] +---- +$ mkdir build.clang + +$ cd build.clang/ + +$ cmake .. -DCMAKE_C_COMPILER=clang-3.6 -DCMAKE_CXX_COMPILER=clang++-3.6 +-- The C compiler identification is Clang 3.6.0 +-- The CXX compiler identification is Clang 3.6.0 +-- Check for working C compiler: /usr/bin/clang-3.6 +-- Check for working C compiler: /usr/bin/clang-3.6 -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/clang++-3.6 +-- Check for working CXX compiler: /usr/bin/clang++-3.6 -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang + +$ make VERBOSE=1 +/usr/bin/cmake -H/home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang -B/home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang --check-build-system CMakeFiles/Makefile.cmake 0 +/usr/bin/cmake -E cmake_progress_start /home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang/CMakeFiles /home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang/CMakeFiles/progress.marks +make -f CMakeFiles/Makefile2 all +make[1]: Entering directory `/home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang' +make -f CMakeFiles/hello_cmake.dir/build.make CMakeFiles/hello_cmake.dir/depend +make[2]: Entering directory `/home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang' +cd /home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang /home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang /home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang /home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang /home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang/CMakeFiles/hello_cmake.dir/DependInfo.cmake --color= +Dependee "/home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang/CMakeFiles/hello_cmake.dir/DependInfo.cmake" is newer than depender "/home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang/CMakeFiles/hello_cmake.dir/depend.internal". +Dependee "/home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang/CMakeFiles/hello_cmake.dir/depend.internal". +Scanning dependencies of target hello_cmake +make[2]: Leaving directory `/home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang' +make -f CMakeFiles/hello_cmake.dir/build.make CMakeFiles/hello_cmake.dir/build +make[2]: Entering directory `/home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang' +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang/CMakeFiles 1 +[100%] Building CXX object CMakeFiles/hello_cmake.dir/main.cpp.o +/usr/bin/clang++-3.6 -o CMakeFiles/hello_cmake.dir/main.cpp.o -c /home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/main.cpp +Linking CXX executable hello_cmake +/usr/bin/cmake -E cmake_link_script CMakeFiles/hello_cmake.dir/link.txt --verbose=1 +/usr/bin/clang++-3.6 CMakeFiles/hello_cmake.dir/main.cpp.o -o hello_cmake -rdynamic +make[2]: Leaving directory `/home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang' +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang/CMakeFiles 1 +[100%] Built target hello_cmake +make[1]: Leaving directory `/home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang' +/usr/bin/cmake -E cmake_progress_start /home/matrim/workspace/cmake-examples/01-basic/I-compiling-with-clang/build.clang/CMakeFiles 0 + +$ ./hello_cmake +Hello CMake! +---- diff --git a/cmake/example/01-basic/I-compiling-with-clang/main.cpp b/cmake/example/01-basic/I-compiling-with-clang/main.cpp new file mode 100644 index 0000000..750dcac --- /dev/null +++ b/cmake/example/01-basic/I-compiling-with-clang/main.cpp @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + std::cout << "Hello CMake!" << std::endl; + return 0; +} \ No newline at end of file diff --git a/cmake/example/01-basic/I-compiling-with-clang/pre_test.sh b/cmake/example/01-basic/I-compiling-with-clang/pre_test.sh new file mode 100755 index 0000000..5231fcd --- /dev/null +++ b/cmake/example/01-basic/I-compiling-with-clang/pre_test.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +ROOT_DIR=`pwd` +dir="01-basic/I-compiling-with-clang" + +if [ -d "$ROOT_DIR/$dir/build.clang" ]; then + echo "deleting $dir/build.clang" + rm -r $dir/build.clang +fi diff --git a/cmake/example/01-basic/I-compiling-with-clang/run_test.sh b/cmake/example/01-basic/I-compiling-with-clang/run_test.sh new file mode 100755 index 0000000..b1ec516 --- /dev/null +++ b/cmake/example/01-basic/I-compiling-with-clang/run_test.sh @@ -0,0 +1,17 @@ +#!/bin/bash +# Ubuntu supports multiple versions of clang to be installed at the same time. +# The tests need to determine the clang binary before calling cmake +clang_bin=`which clang` +clang_xx_bin=`which clang++` + +if [ -z $clang_bin ]; then + clang_ver=`dpkg --get-selections | grep clang | grep -v -m1 libclang | cut -f1 | cut -d '-' -f2` + clang_bin="clang-$clang_ver" + clang_xx_bin="clang++-$clang_ver" +fi + +echo "Will use clang [$clang_bin] and clang++ [$clang_xx_bin]" + + +mkdir -p build.clang && cd build.clang && \ + cmake .. -DCMAKE_C_COMPILER=$clang_bin -DCMAKE_CXX_COMPILER=$clang_xx_bin && make diff --git a/cmake/example/01-basic/J-building-with-ninja/CMakeLists.txt b/cmake/example/01-basic/J-building-with-ninja/CMakeLists.txt new file mode 100644 index 0000000..0a43a8e --- /dev/null +++ b/cmake/example/01-basic/J-building-with-ninja/CMakeLists.txt @@ -0,0 +1,10 @@ +# Set the minimum version of CMake that can be used +# To find the cmake version run +# $ cmake --version +cmake_minimum_required(VERSION 3.5) + +# Set the project name +project (hello_cmake) + +# Add an executable +add_executable(hello_cmake main.cpp) diff --git a/cmake/example/01-basic/J-building-with-ninja/README.adoc b/cmake/example/01-basic/J-building-with-ninja/README.adoc new file mode 100644 index 0000000..039374a --- /dev/null +++ b/cmake/example/01-basic/J-building-with-ninja/README.adoc @@ -0,0 +1,160 @@ += Building with ninja +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +As mentioned, CMake is a meta-build system that can be used to + create the build files for many other build tools. This example shows how + to have CMake use the https://ninja-build.org/[ninja build] tool. + +The files in this tutorial are below: + +``` +$ tree +. +├── CMakeLists.txt +├── main.cpp +``` + + * link:CMakeLists.txt[] - Contains the CMake commands you wish to run + * link:main.cpp[] - A simple "Hello World" cpp file. + +# Concepts + +### Generators + +CMake https://cmake.org/cmake/help/v3.0/manual/cmake-generators.7.html[generators] are +responsible for writing the input files (e.g. Makefiles) for the underlying build system. Running `cmake --help` +will show the generators available. For cmake v2.8.12.2 the generators supported +on my system include: + +[source,bash] +---- +Generators + +The following generators are available on this platform: + Unix Makefiles = Generates standard UNIX makefiles. + Ninja = Generates build.ninja files (experimental). + CodeBlocks - Ninja = Generates CodeBlocks project files. + CodeBlocks - Unix Makefiles = Generates CodeBlocks project files. + Eclipse CDT4 - Ninja = Generates Eclipse CDT 4.0 project files. + Eclipse CDT4 - Unix Makefiles + = Generates Eclipse CDT 4.0 project files. + KDevelop3 = Generates KDevelop 3 project files. + KDevelop3 - Unix Makefiles = Generates KDevelop 3 project files. + Sublime Text 2 - Ninja = Generates Sublime Text 2 project files. + Sublime Text 2 - Unix Makefiles + = Generates Sublime Text 2 project files.Generators +---- + +As specified in this https://stackoverflow.com/questions/25941536/what-is-a-cmake-generator[post], +CMake includes different types of generators such as Command-Line, IDE, and Extra generators. + +#### Command-Line Build Tool Generators + +These generators are for command-line build tools, like Make and Ninja. The chosen tool chain must be configured prior to generating the build system with CMake. + +The supported generators include: + + * Borland Makefiles + * MSYS Makefiles + * MinGW Makefiles + * NMake Makefiles + * NMake Makefiles JOM + * Ninja + * Unix Makefiles + * Watcom WMake + +#### IDE Build Tool Generators + +These generators are for Integrated Development Environments that include their own compiler. Examples are Visual Studio and Xcode which include a compiler natively. + +The supported generators include: + + * Visual Studio 6 + * Visual Studio 7 + * Visual Studio 7 .NET 2003 + * Visual Studio 8 2005 + * Visual Studio 9 2008 + * Visual Studio 10 2010 + * Visual Studio 11 2012 + * Visual Studio 12 2013 + * Xcode + +#### Extra Generators + +These are generators create a configuration to work with an alternative IDE tool and must be included with either an IDE or Command-Line generator. + +The supported generators include: + + * CodeBlocks + * CodeLite + * Eclipse CDT4 + * KDevelop3 + * Kate + * Sublime Text 2 + + +[NOTE] +==== +In this example ninja is installed via the command `sudo apt-get install ninja-build` +==== + +### Calling a Generator + +To call a CMake generator you can use the `-G` command line switch, for example: + +[source,cmake] +---- +cmake .. -G Ninja +---- + +After doing the above CMake will generate the required Ninja build files, which can be run +from using the `ninja` command. + +[source,bash] +---- +$ cmake .. -G Ninja + +$ ls +build.ninja CMakeCache.txt CMakeFiles cmake_install.cmake rules.ninja +---- + +# Building the Examples + +Below is sample output from building this example. + +[source,bash] +---- +$ mkdir build.ninja + +$ cd build.ninja/ + +$ cmake .. -G Ninja +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler using: Ninja +-- Check for working C compiler using: Ninja -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler using: Ninja +-- Check for working CXX compiler using: Ninja -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/01-basic/J-building-with-ninja/build.ninja + +$ ninja -v +[1/2] /usr/bin/c++ -MMD -MT CMakeFiles/hello_cmake.dir/main.cpp.o -MF "CMakeFiles/hello_cmake.dir/main.cpp.o.d" -o CMakeFiles/hello_cmake.dir/main.cpp.o -c ../main.cpp +[2/2] : && /usr/bin/c++ CMakeFiles/hello_cmake.dir/main.cpp.o -o hello_cmake -rdynamic && : + +$ ls +build.ninja CMakeCache.txt CMakeFiles cmake_install.cmake hello_cmake rules.ninja + +$ ./hello_cmake +Hello CMake! +---- diff --git a/cmake/example/01-basic/J-building-with-ninja/main.cpp b/cmake/example/01-basic/J-building-with-ninja/main.cpp new file mode 100644 index 0000000..750dcac --- /dev/null +++ b/cmake/example/01-basic/J-building-with-ninja/main.cpp @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + std::cout << "Hello CMake!" << std::endl; + return 0; +} \ No newline at end of file diff --git a/cmake/example/01-basic/J-building-with-ninja/pre_test.sh b/cmake/example/01-basic/J-building-with-ninja/pre_test.sh new file mode 100755 index 0000000..a3f9854 --- /dev/null +++ b/cmake/example/01-basic/J-building-with-ninja/pre_test.sh @@ -0,0 +1,9 @@ +#!/bin/bash + +ROOT_DIR=`pwd` +dir="01-basic/J-building-with-ninja" + +if [ -d "$ROOT_DIR/$dir/build.ninja" ]; then + echo "deleting $dir/build.ninja" + rm -r $dir/build.ninja +fi diff --git a/cmake/example/01-basic/J-building-with-ninja/run_test.sh b/cmake/example/01-basic/J-building-with-ninja/run_test.sh new file mode 100755 index 0000000..56b171e --- /dev/null +++ b/cmake/example/01-basic/J-building-with-ninja/run_test.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# Travis-ci cmake version doesn't support ninja, so first check if it's supported +ninja_supported=`cmake --help | grep Ninja` + +if [ -z $ninja_supported ]; then + echo "Ninja not supported" + exit +fi + +mkdir -p build.ninja && cd build.ninja && \ + cmake .. -G Ninja && ninja diff --git a/cmake/example/01-basic/K-imported-targets/CMakeLists.txt b/cmake/example/01-basic/K-imported-targets/CMakeLists.txt new file mode 100644 index 0000000..46eac96 --- /dev/null +++ b/cmake/example/01-basic/K-imported-targets/CMakeLists.txt @@ -0,0 +1,24 @@ +cmake_minimum_required(VERSION 3.5) + +# Set the project name +project (imported_targets) + + +# find a boost install with the libraries filesystem and system +find_package(Boost 1.46.1 REQUIRED COMPONENTS filesystem system) + +# check if boost was found +if(Boost_FOUND) + message ("boost found") +else() + message (FATAL_ERROR "Cannot find Boost") +endif() + +# Add an executable +add_executable(imported_targets main.cpp) + +# link against the boost libraries +target_link_libraries( imported_targets + PRIVATE + Boost::filesystem +) diff --git a/cmake/example/01-basic/K-imported-targets/README.adoc b/cmake/example/01-basic/K-imported-targets/README.adoc new file mode 100644 index 0000000..e7b5335 --- /dev/null +++ b/cmake/example/01-basic/K-imported-targets/README.adoc @@ -0,0 +1,94 @@ += Imported Targets +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +As previously mentioned in the link:../H-third-party-library[third party library], newer +versions of CMake allow you to link third party libraries using link:https://cmake.org/cmake/help/v3.6/prop_tgt/IMPORTED.html#prop_tgt:IMPORTED[imported] +ALIAS+ targets. + +The files in this tutorial are below: + +``` +$ tree +. +├── CMakeLists.txt +├── main.cpp +``` + + * link:CMakeLists.txt[] - Contains the CMake commands you wish to run + * link:main.cpp[] - The source file with main + +# Requirements + +This example requires the following: + + * CMake v3.5+ + * The boost libraries to be installed in a default system location. + +# Concepts + +## Imported Target + +Imported targets are read-only targets that are exported by FindXXX modules. + +To include boost filesystem you can do the following: + +[source,cmake] +---- + target_link_libraries( imported_targets + PRIVATE + Boost::filesystem + ) +---- + +This will automtaically link the Boost::filesystem and Boost::system libraries while also including the +Boost include directories. + +# Building the Example + +[source,bash] +---- +$ mkdir build + +$ cd build/ + +$ cmake .. +-- The C compiler identification is GNU 5.4.0 +-- The CXX compiler identification is GNU 5.4.0 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Detecting C compile features +-- Detecting C compile features - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Detecting CXX compile features +-- Detecting CXX compile features - done +-- Boost version: 1.58.0 +-- Found the following Boost libraries: +-- filesystem +-- system +boost found +-- Configuring done +-- Generating done +-- Build files have been written to: /data/code/01-basic/K-imported-targets/build + +$ make +Scanning dependencies of target imported_targets +[ 50%] Building CXX object CMakeFiles/imported_targets.dir/main.cpp.o +[100%] Linking CXX executable imported_targets +[100%] Built target imported_targets + + +$ ./imported_targets +Hello Third Party Include! +Path is not relative + + +---- diff --git a/cmake/example/01-basic/K-imported-targets/main.cpp b/cmake/example/01-basic/K-imported-targets/main.cpp new file mode 100644 index 0000000..c7b58af --- /dev/null +++ b/cmake/example/01-basic/K-imported-targets/main.cpp @@ -0,0 +1,24 @@ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + std::cout << "Hello Third Party Include!" << std::endl; + + // use a shared ptr + boost::shared_ptr isp(new int(4)); + + // trivial use of boost filesystem + boost::filesystem::path path = "/usr/share/cmake/modules"; + if(path.is_relative()) + { + std::cout << "Path is relative" << std::endl; + } + else + { + std::cout << "Path is not relative" << std::endl; + } + + return 0; +} diff --git a/cmake/example/01-basic/K-imported-targets/run_test.sh b/cmake/example/01-basic/K-imported-targets/run_test.sh new file mode 100755 index 0000000..e1efb51 --- /dev/null +++ b/cmake/example/01-basic/K-imported-targets/run_test.sh @@ -0,0 +1,12 @@ +#!/bin/bash +# Make sure we have the minimum cmake version +cmake_version=`cmake --version | grep version | cut -d" " -f3` + +[[ "$cmake_version" =~ ([3-9][.][5-9.][.][0-9]) ]] || exit 0 + +echo "correct version of cmake" +mkdir -p build && cd build && cmake .. && make +if [ $? -ne 0 ]; then + echo "Error running example" + exit 1 +fi diff --git a/cmake/example/01-basic/L-cpp-standard/README.adoc b/cmake/example/01-basic/L-cpp-standard/README.adoc new file mode 100644 index 0000000..1aaafb4 --- /dev/null +++ b/cmake/example/01-basic/L-cpp-standard/README.adoc @@ -0,0 +1,11 @@ += C++ Standard + +Since the release of C+\+11 and C++14 a common use case is to invoke the compiler to use these standards. As CMake has evolved, it has added features to make this easier and new versions of CMake have changed how this is achieved. + +The following examples show different methods of setting the C++ standard and what versions of CMake they are available from. + +The examples include: + + - link:i-common-method[common-method]. A simple version that should work with most versions of CMake. + - link:ii-cxx-standard[cxx-standard]. Using the `CMAKE_CXX_STANDARD` variable introduced in CMake v3.1. + - link:iii-compile-features[compile-features]. Using the `target_compile_features` function introduced in CMake v3.1. diff --git a/cmake/example/01-basic/L-cpp-standard/i-common-method/CMakeLists.txt b/cmake/example/01-basic/L-cpp-standard/i-common-method/CMakeLists.txt new file mode 100644 index 0000000..534eb57 --- /dev/null +++ b/cmake/example/01-basic/L-cpp-standard/i-common-method/CMakeLists.txt @@ -0,0 +1,24 @@ +# Set the minimum version of CMake that can be used +# To find the cmake version run +# $ cmake --version +cmake_minimum_required(VERSION 2.8) + +# Set the project name +project (hello_cpp11) + +# try conditional compilation +include(CheckCXXCompilerFlag) +CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) +CHECK_CXX_COMPILER_FLAG("-std=c++0x" COMPILER_SUPPORTS_CXX0X) + +# check results and add flag +if(COMPILER_SUPPORTS_CXX11)# + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +elseif(COMPILER_SUPPORTS_CXX0X)# + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") +else() + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") +endif() + +# Add an executable +add_executable(hello_cpp11 main.cpp) diff --git a/cmake/example/01-basic/L-cpp-standard/i-common-method/README.adoc b/cmake/example/01-basic/L-cpp-standard/i-common-method/README.adoc new file mode 100644 index 0000000..990bd04 --- /dev/null +++ b/cmake/example/01-basic/L-cpp-standard/i-common-method/README.adoc @@ -0,0 +1,111 @@ += C++ Standard Common Method +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +This example shows a common method to set the C++ Standard. This can be used with most versions of CMake. However, if you are targeting a recent version of CMake there are more convenient methods available. + +The files in this tutorial are below: + +``` +A-hello-cmake$ tree +. +├── CMakeLists.txt +├── main.cpp +``` + + * link:CMakeLists.txt[CMakeLists.txt] - Contains the CMake commands you wish to run + * link:main.cpp[main.cpp] - A simple "Hello World" cpp file targeting C++11. + +# Concepts + +## Checking Compile flags + +CMake has support for attempting to compile a program with any flags you pass into the function `CMAKE_CXX_COMPILER_FLAG`. The result is then stored in a variable that you pass in. + +For example: + +[source,cmake] +---- +include(CheckCXXCompilerFlag) +CHECK_CXX_COMPILER_FLAG("-std=c++11" COMPILER_SUPPORTS_CXX11) +---- + +This example will attempt to compile a program with the flag `-std=c++11` and store the result in the variable `COMPILER_SUPPORTS_CXX11`. + +The line `include(CheckCXXCompilerFlag)` tells CMake to include this function to make it available for use. + +## Adding the flag + +Once you have determined if the compile supports a flag, you can then use the link:../../G-compile-flags/[standard cmake methods] to add this flag to a target. In this example we use the `CMAKE_CXX_FLAGS` to propegate the flag to all targets . + +[source,cmake] +---- +if(COMPILER_SUPPORTS_CXX11)# + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") +elseif(COMPILER_SUPPORTS_CXX0X)# + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++0x") +else() + message(STATUS "The compiler ${CMAKE_CXX_COMPILER} has no C++11 support. Please use a different C++ compiler.") +endif() +---- + +The above example only checks for the gcc version of the compile flags and supports fallback from C+\+11 to the pre-standardisation C+\+0x flag. In real usage you may want to check for C++14, or add support for different methods of setting the compile, e.g. `-std=gnu++11` + +# Building the Examples + +Below is sample output from building this example. + +[source,bash] +---- +$ mkdir build +$ cd build + +$ cmake .. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Performing Test COMPILER_SUPPORTS_CXX11 +-- Performing Test COMPILER_SUPPORTS_CXX11 - Success +-- Performing Test COMPILER_SUPPORTS_CXX0X +-- Performing Test COMPILER_SUPPORTS_CXX0X - Success +-- Configuring done +-- Generating done +-- Build files have been written to: /data/code/01-basic/L-cpp-standard/i-common-method/build + +$ make VERBOSE=1 +/usr/bin/cmake -H/data/code/01-basic/L-cpp-standard/i-common-method -B/data/code/01-basic/L-cpp-standard/i-common-method/build --check-build-system CMakeFiles/Makefile.cmake 0 +/usr/bin/cmake -E cmake_progress_start /data/code/01-basic/L-cpp-standard/i-common-method/build/CMakeFiles /data/code/01-basic/L-cpp-standard/i-common-method/build/CMakeFiles/progress.marks +make -f CMakeFiles/Makefile2 all +make[1]: Entering directory `/data/code/01-basic/L-cpp-standard/i-common-method/build' +make -f CMakeFiles/hello_cpp11.dir/build.make CMakeFiles/hello_cpp11.dir/depend +make[2]: Entering directory `/data/code/01-basic/L-cpp-standard/i-common-method/build' +cd /data/code/01-basic/L-cpp-standard/i-common-method/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /data/code/01-basic/L-cpp-standard/i-common-method /data/code/01-basic/L-cpp-standard/i-common-method /data/code/01-basic/L-cpp-standard/i-common-method/build /data/code/01-basic/L-cpp-standard/i-common-method/build /data/code/01-basic/L-cpp-standard/i-common-method/build/CMakeFiles/hello_cpp11.dir/DependInfo.cmake --color= +Dependee "/data/code/01-basic/L-cpp-standard/i-common-method/build/CMakeFiles/hello_cpp11.dir/DependInfo.cmake" is newer than depender "/data/code/01-basic/L-cpp-standard/i-common-method/build/CMakeFiles/hello_cpp11.dir/depend.internal". +Dependee "/data/code/01-basic/L-cpp-standard/i-common-method/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/data/code/01-basic/L-cpp-standard/i-common-method/build/CMakeFiles/hello_cpp11.dir/depend.internal". +Scanning dependencies of target hello_cpp11 +make[2]: Leaving directory `/data/code/01-basic/L-cpp-standard/i-common-method/build' +make -f CMakeFiles/hello_cpp11.dir/build.make CMakeFiles/hello_cpp11.dir/build +make[2]: Entering directory `/data/code/01-basic/L-cpp-standard/i-common-method/build' +/usr/bin/cmake -E cmake_progress_report /data/code/01-basic/L-cpp-standard/i-common-method/build/CMakeFiles 1 +[100%] Building CXX object CMakeFiles/hello_cpp11.dir/main.cpp.o +/usr/bin/c++ -std=c++11 -o CMakeFiles/hello_cpp11.dir/main.cpp.o -c /data/code/01-basic/L-cpp-standard/i-common-method/main.cpp +Linking CXX executable hello_cpp11 +/usr/bin/cmake -E cmake_link_script CMakeFiles/hello_cpp11.dir/link.txt --verbose=1 +/usr/bin/c++ -std=c++11 CMakeFiles/hello_cpp11.dir/main.cpp.o -o hello_cpp11 -rdynamic +make[2]: Leaving directory `/data/code/01-basic/L-cpp-standard/i-common-method/build' +/usr/bin/cmake -E cmake_progress_report /data/code/01-basic/L-cpp-standard/i-common-method/build/CMakeFiles 1 +[100%] Built target hello_cpp11 +make[1]: Leaving directory `/data/code/01-basic/L-cpp-standard/i-common-method/build' +/usr/bin/cmake -E cmake_progress_start /data/code/01-basic/L-cpp-standard/i-common-method/build/CMakeFiles 0 +---- diff --git a/cmake/example/01-basic/L-cpp-standard/i-common-method/main.cpp b/cmake/example/01-basic/L-cpp-standard/i-common-method/main.cpp new file mode 100644 index 0000000..12886a0 --- /dev/null +++ b/cmake/example/01-basic/L-cpp-standard/i-common-method/main.cpp @@ -0,0 +1,8 @@ +#include + +int main(int argc, char *argv[]) +{ + auto message = "Hello C++11"; + std::cout << message << std::endl; + return 0; +} diff --git a/cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/CMakeLists.txt b/cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/CMakeLists.txt new file mode 100644 index 0000000..af79ca9 --- /dev/null +++ b/cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/CMakeLists.txt @@ -0,0 +1,13 @@ +# Set the minimum version of CMake that can be used +# To find the cmake version run +# $ cmake --version +cmake_minimum_required(VERSION 3.1) + +# Set the project name +project (hello_cpp11) + +# set the C++ standard to C++ 11 +set(CMAKE_CXX_STANDARD 11) + +# Add an executable +add_executable(hello_cpp11 main.cpp) diff --git a/cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/README.adoc b/cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/README.adoc new file mode 100644 index 0000000..55f00f2 --- /dev/null +++ b/cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/README.adoc @@ -0,0 +1,88 @@ += Set C++ Standard +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +This example shows how to set the C++ standard using the `CMAKE_CXX_STANDARD` variable. This is available since CMake v3.1 + +The files in this tutorial are below: + +``` +A-hello-cmake$ tree +. +├── CMakeLists.txt +├── main.cpp +``` + + * link:CMakeLists.txt[CMakeLists.txt] - Contains the CMake commands you wish to run + * link:main.cpp[main.cpp] - A simple "Hello World" cpp file targeting C++11. + +# Concepts + +## Using CXX_STANDARD property + +Setting the link:https://cmake.org/cmake/help/v3.1/variable/CMAKE_CXX_STANDARD.html[CMAKE_CXX_STANDARD] variable causes the `CXX_STANDARD` property on all targets. This causes CMake to set the appropriate flag at compille time. + + +[NOTE] +==== +The `CMAKE_CXX_STANDARD` variable falls back to the closest appropriate standard without a failure. For example, if you request `-std=gnu++11` you may end up with `-std=gnu++0x`. + +This can result in an unexpected failure at compile time. +==== + +# Building the Examples + +Below is sample output from building this example. + +[source,bash] +---- +$ mkdir build +$ cd build + + +$ cmake .. +-- The C compiler identification is GNU 5.4.0 +-- The CXX compiler identification is GNU 5.4.0 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Detecting C compile features +-- Detecting C compile features - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Detecting CXX compile features +-- Detecting CXX compile features - done +-- Configuring done +-- Generating done +-- Build files have been written to: /data/code/01-basic/L-cpp-standard/ii-cxx-standard/build + +$ make VERBOSE=1 +/usr/bin/cmake -H/data/code/01-basic/L-cpp-standard/ii-cxx-standard -B/data/code/01-basic/L-cpp-standard/ii-cxx-standard/build --check-build-system CMakeFiles/Makefile.cmake 0 +/usr/bin/cmake -E cmake_progress_start /data/code/01-basic/L-cpp-standard/ii-cxx-standard/build/CMakeFiles /data/code/01-basic/L-cpp-standard/ii-cxx-standard/build/CMakeFiles/progress.marks +make -f CMakeFiles/Makefile2 all +make[1]: Entering directory '/data/code/01-basic/L-cpp-standard/ii-cxx-standard/build' +make -f CMakeFiles/hello_cpp11.dir/build.make CMakeFiles/hello_cpp11.dir/depend +make[2]: Entering directory '/data/code/01-basic/L-cpp-standard/ii-cxx-standard/build' +cd /data/code/01-basic/L-cpp-standard/ii-cxx-standard/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /data/code/01-basic/L-cpp-standard/ii-cxx-standard /data/code/01-basic/L-cpp-standard/ii-cxx-standard /data/code/01-basic/L-cpp-standard/ii-cxx-standard/build /data/code/01-basic/L-cpp-standard/ii-cxx-standard/build /data/code/01-basic/L-cpp-standard/ii-cxx-standard/build/CMakeFiles/hello_cpp11.dir/DependInfo.cmake --color= +Dependee "/data/code/01-basic/L-cpp-standard/ii-cxx-standard/build/CMakeFiles/hello_cpp11.dir/DependInfo.cmake" is newer than depender "/data/code/01-basic/L-cpp-standard/ii-cxx-standard/build/CMakeFiles/hello_cpp11.dir/depend.internal". +Dependee "/data/code/01-basic/L-cpp-standard/ii-cxx-standard/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/data/code/01-basic/L-cpp-standard/ii-cxx-standard/build/CMakeFiles/hello_cpp11.dir/depend.internal". +Scanning dependencies of target hello_cpp11 +make[2]: Leaving directory '/data/code/01-basic/L-cpp-standard/ii-cxx-standard/build' +make -f CMakeFiles/hello_cpp11.dir/build.make CMakeFiles/hello_cpp11.dir/build +make[2]: Entering directory '/data/code/01-basic/L-cpp-standard/ii-cxx-standard/build' +[ 50%] Building CXX object CMakeFiles/hello_cpp11.dir/main.cpp.o +/usr/bin/c++ -std=gnu++11 -o CMakeFiles/hello_cpp11.dir/main.cpp.o -c /data/code/01-basic/L-cpp-standard/ii-cxx-standard/main.cpp +[100%] Linking CXX executable hello_cpp11 +/usr/bin/cmake -E cmake_link_script CMakeFiles/hello_cpp11.dir/link.txt --verbose=1 +/usr/bin/c++ CMakeFiles/hello_cpp11.dir/main.cpp.o -o hello_cpp11 -rdynamic +make[2]: Leaving directory '/data/code/01-basic/L-cpp-standard/ii-cxx-standard/build' +[100%] Built target hello_cpp11 +make[1]: Leaving directory '/data/code/01-basic/L-cpp-standard/ii-cxx-standard/build' +---- diff --git a/cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/main.cpp b/cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/main.cpp new file mode 100644 index 0000000..12886a0 --- /dev/null +++ b/cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/main.cpp @@ -0,0 +1,8 @@ +#include + +int main(int argc, char *argv[]) +{ + auto message = "Hello C++11"; + std::cout << message << std::endl; + return 0; +} diff --git a/cmake/example/01-basic/L-cpp-standard/iii-compile-features/CMakeLists.txt b/cmake/example/01-basic/L-cpp-standard/iii-compile-features/CMakeLists.txt new file mode 100644 index 0000000..f331a44 --- /dev/null +++ b/cmake/example/01-basic/L-cpp-standard/iii-compile-features/CMakeLists.txt @@ -0,0 +1,16 @@ +# Set the minimum version of CMake that can be used +# To find the cmake version run +# $ cmake --version +cmake_minimum_required(VERSION 3.1) + +# Set the project name +project (hello_cpp11) + +# Add an executable +add_executable(hello_cpp11 main.cpp) + +# set the C++ standard to the appropriate standard for using auto +target_compile_features(hello_cpp11 PUBLIC cxx_auto_type) + +# Print the list of known compile features for this version of CMake +message("List of compile features: ${CMAKE_CXX_COMPILE_FEATURES}") diff --git a/cmake/example/01-basic/L-cpp-standard/iii-compile-features/README.adoc b/cmake/example/01-basic/L-cpp-standard/iii-compile-features/README.adoc new file mode 100644 index 0000000..9e551a9 --- /dev/null +++ b/cmake/example/01-basic/L-cpp-standard/iii-compile-features/README.adoc @@ -0,0 +1,97 @@ += Set C++ Standard +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +This example shows how to set the C++ standard using the `target_compile_features` function. This is available since CMake v3.1 + +The files in this tutorial are below: + +``` +A-hello-cmake$ tree +. +├── CMakeLists.txt +├── main.cpp +``` + + * link:CMakeLists.txt[CMakeLists.txt] - Contains the CMake commands you wish to run + * link:main.cpp[main.cpp] - A simple "Hello World" cpp file targeting C++11. + +# Concepts + +## Using target_compile_features + +Calling the link:https://cmake.org/cmake/help/v3.1/command/target_compile_features.html[target_compile_features] function on a target will look at the passed in feature and determine the correct compiler flag to use for your target. + +[source,cmake] +---- +target_compile_features(hello_cpp11 PUBLIC cxx_auto_type) +---- + +As with other `target_*` functions, you can specify the scope of the feature for the selected target. This populates the link:https://cmake.org/cmake/help/v3.1/prop_tgt/INTERFACE_COMPILE_FEATURES.html#prop_tgt:INTERFACE_COMPILE_FEATURES[INTERFACE_COMPILE_FEATURES] property for the target. + +The list of available features can be found from the link:https://cmake.org/cmake/help/v3.1/variable/CMAKE_CXX_COMPILE_FEATURES.html#variable:CMAKE_CXX_COMPILE_FEATURES[CMAKE_CXX_COMPILE_FEATURES] variable. You can obtain a list of the available features using the following code: + +[source,cmake] +---- +message("List of compile features: ${CMAKE_CXX_COMPILE_FEATURES}") +---- + +# Building the Examples + +Below is sample output from building this example. + +[source,bash] +---- +$ mkdir build +$ cd build + +$ cmake .. +-- The C compiler identification is GNU 5.4.0 +-- The CXX compiler identification is GNU 5.4.0 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Detecting C compile features +-- Detecting C compile features - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Detecting CXX compile features +-- Detecting CXX compile features - done +List of compile features: cxx_template_template_parameters;cxx_alias_templates;cxx_alignas;cxx_alignof;cxx_attributes;cxx_auto_type;cxx_constexpr;cxx_decltype;cxx_decltype_incomplete_return_types;cxx_default_function_template_args;cxx_defaulted_functions;cxx_defaulted_move_initializers;cxx_delegating_constructors;cxx_deleted_functions;cxx_enum_forward_declarations;cxx_explicit_conversions;cxx_extended_friend_declarations;cxx_extern_templates;cxx_final;cxx_func_identifier;cxx_generalized_initializers;cxx_inheriting_constructors;cxx_inline_namespaces;cxx_lambdas;cxx_local_type_template_args;cxx_long_long_type;cxx_noexcept;cxx_nonstatic_member_init;cxx_nullptr;cxx_override;cxx_range_for;cxx_raw_string_literals;cxx_reference_qualified_functions;cxx_right_angle_brackets;cxx_rvalue_references;cxx_sizeof_member;cxx_static_assert;cxx_strong_enums;cxx_thread_local;cxx_trailing_return_types;cxx_unicode_literals;cxx_uniform_initialization;cxx_unrestricted_unions;cxx_user_literals;cxx_variadic_macros;cxx_variadic_templates;cxx_aggregate_default_initializers;cxx_attribute_deprecated;cxx_binary_literals;cxx_contextual_conversions;cxx_decltype_auto;cxx_digit_separators;cxx_generic_lambdas;cxx_lambda_init_captures;cxx_relaxed_constexpr;cxx_return_type_deduction;cxx_variable_templates +-- Configuring done +-- Generating done +-- Build files have been written to: /data/code/01-basic/L-cpp-standard/iii-compile-features/build + + +$ make VERBOSE=1 +/usr/bin/cmake -H/data/code/01-basic/L-cpp-standard/iii-compile-features -B/data/code/01-basic/L-cpp-standard/iii-compile-features/build --check-build-system CMakeFiles/Makefile.cmake 0 +/usr/bin/cmake -E cmake_progress_start /data/code/01-basic/L-cpp-standard/iii-compile-features/build/CMakeFiles /data/code/01-basic/L-cpp-standard/iii-compile-features/build/CMakeFiles/progress.marks +make -f CMakeFiles/Makefile2 all +make[1]: Entering directory '/data/code/01-basic/L-cpp-standard/iii-compile-features/build' +make -f CMakeFiles/hello_cpp11.dir/build.make CMakeFiles/hello_cpp11.dir/depend +make[2]: Entering directory '/data/code/01-basic/L-cpp-standard/iii-compile-features/build' +cd /data/code/01-basic/L-cpp-standard/iii-compile-features/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /data/code/01-basic/L-cpp-standard/iii-compile-features /data/code/01-basic/L-cpp-standard/iii-compile-features /data/code/01-basic/L-cpp-standard/iii-compile-features/build /data/code/01-basic/L-cpp-standard/iii-compile-features/build /data/code/01-basic/L-cpp-standard/iii-compile-features/build/CMakeFiles/hello_cpp11.dir/DependInfo.cmake --color= +Dependee "/data/code/01-basic/L-cpp-standard/iii-compile-features/build/CMakeFiles/hello_cpp11.dir/DependInfo.cmake" is newer than depender "/data/code/01-basic/L-cpp-standard/iii-compile-features/build/CMakeFiles/hello_cpp11.dir/depend.internal". +Dependee "/data/code/01-basic/L-cpp-standard/iii-compile-features/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/data/code/01-basic/L-cpp-standard/iii-compile-features/build/CMakeFiles/hello_cpp11.dir/depend.internal". +Scanning dependencies of target hello_cpp11 +make[2]: Leaving directory '/data/code/01-basic/L-cpp-standard/iii-compile-features/build' +make -f CMakeFiles/hello_cpp11.dir/build.make CMakeFiles/hello_cpp11.dir/build +make[2]: Entering directory '/data/code/01-basic/L-cpp-standard/iii-compile-features/build' +[ 50%] Building CXX object CMakeFiles/hello_cpp11.dir/main.cpp.o +/usr/bin/c++ -std=gnu++11 -o CMakeFiles/hello_cpp11.dir/main.cpp.o -c /data/code/01-basic/L-cpp-standard/iii-compile-features/main.cpp +[100%] Linking CXX executable hello_cpp11 +/usr/bin/cmake -E cmake_link_script CMakeFiles/hello_cpp11.dir/link.txt --verbose=1 +/usr/bin/c++ CMakeFiles/hello_cpp11.dir/main.cpp.o -o hello_cpp11 -rdynamic +make[2]: Leaving directory '/data/code/01-basic/L-cpp-standard/iii-compile-features/build' +[100%] Built target hello_cpp11 +make[1]: Leaving directory '/data/code/01-basic/L-cpp-standard/iii-compile-features/build' +/usr/bin/cmake -E cmake_progress_start /data/code/01-basic/L-cpp-standard/iii-compile-features/build/CMakeFiles 0 + +---- diff --git a/cmake/example/01-basic/L-cpp-standard/iii-compile-features/main.cpp b/cmake/example/01-basic/L-cpp-standard/iii-compile-features/main.cpp new file mode 100644 index 0000000..12886a0 --- /dev/null +++ b/cmake/example/01-basic/L-cpp-standard/iii-compile-features/main.cpp @@ -0,0 +1,8 @@ +#include + +int main(int argc, char *argv[]) +{ + auto message = "Hello C++11"; + std::cout << message << std::endl; + return 0; +} diff --git a/cmake/example/01-basic/README.adoc b/cmake/example/01-basic/README.adoc new file mode 100644 index 0000000..87fc185 --- /dev/null +++ b/cmake/example/01-basic/README.adoc @@ -0,0 +1,19 @@ += Basic Examples + +The basic examples in this directory show how the setup a CMake project, +set compile flags, create and link executables and libraries, and install them. + +The examples included are + + - link:A-hello-cmake[hello-cmake]. A hello world example. + - link:B-hello-headers[hello-headers]. A slightly more complicated hello world example, using separate source and include folders. + - link:C-static-library[static-library]. An example using a static library. + - link:D-shared-library[shared-library]. An example using a shared library. + - link:E-installing[installing]. Shows how to create a 'make install' target that will install binaries and libraries. + - link:F-build-type[build-type]. An example showing how to set a default build and optimization flags for your project. + - link:G-compile-flags[compile-flags]. Shows how to set additional compile flags. + - link:H-third-party-library[third-party-library]. Shows an example of how to link third party libraries. + - link:I-compiling-with-clang[compiling-with-clang]. An example of invoking the clang compiler. + - link:J-building-with-ninja[building-with-ninja] - Shows how to generate ninja build files + - link:K-imported-targets[imported-targets] - Shows how to link boost using the new imported targets + - link:L-cpp-standard[cpp-standard] - Shows various methods to set the C++ standard diff --git a/cmake/example/02-sub-projects/A-basic/CMakeLists.txt b/cmake/example/02-sub-projects/A-basic/CMakeLists.txt new file mode 100644 index 0000000..7e2a6c2 --- /dev/null +++ b/cmake/example/02-sub-projects/A-basic/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required (VERSION 3.5) + +project(subprojects) + +# Add sub directories +add_subdirectory(sublibrary1) +add_subdirectory(sublibrary2) +add_subdirectory(subbinary) diff --git a/cmake/example/02-sub-projects/A-basic/README.adoc b/cmake/example/02-sub-projects/A-basic/README.adoc new file mode 100644 index 0000000..98b1f2b --- /dev/null +++ b/cmake/example/02-sub-projects/A-basic/README.adoc @@ -0,0 +1,216 @@ += Basic Sub-Project +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +This example shows how to setup a CMake project that includes sub-projects. The +top level CMakeLists.txt calls the CMakeLists.txt in the sub directories to +create the following: + + * sublibrary1 - A static library + * sublibrary2 - A header only library + * subbinary - An executable + +The files included in this example are: + +``` +$ tree +. +├── CMakeLists.txt +├── subbinary +│   ├── CMakeLists.txt +│   └── main.cpp +├── sublibrary1 +│   ├── CMakeLists.txt +│   ├── include +│   │   └── sublib1 +│   │   └── sublib1.h +│   └── src +│   └── sublib1.cpp +└── sublibrary2 + ├── CMakeLists.txt + └── include + └── sublib2 + └── sublib2.h +``` + + * link:CMakeLists.txt[] - Top level CMakeLists.txt + * link:subbinary/CMakeLists.txt[] - to make the executable + * link:subbinary/main.cpp[] - source for the executable + * link:sublibrary1/CMakeLists.txt[] - to make a static library + * link:sublibrary1/include/sublib1/sublib1.h[] + * link:sublibrary1/src/sublib1.cpp[] + * link:sublibrary2/CMakeLists.txt[] - to setup header only library + * link:sublibrary2/include/sublib2/sublib2.h[] + +[TIP] +==== +In this example I have moved the header files to a subfolder under each projects +include+ +directory, while leaving the target include as the root +include+ folder. This is a good idea to prevent +filename clashes because you have to include a file like below: +[source,cpp] +---- +#include "sublib1/sublib1.h" +---- + +This also means that if you install your library for other users the default install location would be ++/usr/local/include/sublib1/sublib1.h+. +==== + +# Concepts + +## Adding a Sub-Directory + +A CMakeLists.txt file can include and call sub-directories which include a CMakeLists.txt +files. + +[source,cmake] +---- +add_subdirectory(sublibrary1) +add_subdirectory(sublibrary2) +add_subdirectory(subbinary) +---- + +## Referencing Sub-Project Directories + +When a project is created using the `project()` command, CMake will automatically +create a number of variables which can be used to reference details about the project. +These variables can then be used by other sub-projects or the main project. For example, +to reference the source directory for a different project you can use. + +[source,cmake] +---- + ${sublibrary1_SOURCE_DIR} + ${sublibrary2_SOURCE_DIR} +---- + +The variables created by CMake include: + +[cols=",",options="header",] +|======================================================================= +|Variable |Info +|PROJECT_NAME | The name of the project set by the current `project()`. + +|CMAKE_PROJECT_NAME |the name of the first project set by the `project()` +command, i.e. the top level project. + +|PROJECT_SOURCE_DIR |The source director of the current project. + +|PROJECT_BINARY_DIR |The build directory for the current project. + +|name_SOURCE_DIR | The source directory of the project called "name". +In this example the source directories created would be `sublibrary1_SOURCE_DIR`, +`sublibrary2_SOURCE_DIR`, and `subbinary_SOURCE_DIR` + +|name_BINARY_DIR | The binary directory of the project called "name". +In this example the binary directories created would be `sublibrary1_BINARY_DIR`, +`sublibrary2_BINARY_DIR`, and `subbinary_BINARY_DIR` + +|======================================================================= + +## Header only Libraries + +If you have a library that is created as a header only library, cmake supports the +INTERFACE+ +target to allow creating a target without any build output. More details can be found from +link:https://cmake.org/cmake/help/v3.4/command/add_library.html#interface-libraries[here] + +[source,cmake] +---- +add_library(${PROJECT_NAME} INTERFACE) +---- + +When creating the target you can also include directories for that target using +the +INTERFACE+ scope. The +INTERFACE+ scope is use to make target requirements that are used in any Libraries +that link this target but not in the compilation of the target itself. + +[source,cmake] +---- +target_include_directories(${PROJECT_NAME} + INTERFACE + ${PROJECT_SOURCE_DIR}/include +) +---- + +## Referencing Libraries from Sub-Projects + +If a sub-project creates a library, it can be referenced by other projects by +calling the name of the target in the `target_link_libraries()` command. This +means that you don't have to reference the full path of the new library and it +is added as a dependency. + +[source,cmake] +---- +target_link_libraries(subbinary + PUBLIC + sublibrary1 +) +---- + +Alternatively, you can create an alias target which allows you to reference the +target in read only contexts. + +To create an alias target run: + +[source,cmake] +---- +add_library(sublibrary2) +add_library(sub::lib2 ALIAS sublibrary2) +---- + +To reference the alias, just it as follows: +[source,cmake] +---- +target_link_libraries(subbinary + sub::lib2 +) +---- + +## Include directories from sub-projects + +When adding the libraries from the sub-projects, starting from cmake v3, there is +no need to add the projects include directories in the include directories of the +binary using them. + +This is controlled by the scope in the `target_include_directories()` command when creating +the libraries. In this example because the subbinary executable links the sublibrary1 +and sublibrary2 libraries it will automatically include the `${sublibrary1_SOURCE_DIR}/include` +and `${sublibrary2_SOURCE_DIR}/include` folders as they are exported with the + +PUBLIC+ and +INTERFACE+ scopes of the libraries. + +# Building the example + +[source,bash] +---- +$ mkdir build + +$ cd build/ + +$ cmake .. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/02-sub-projects/A-basic/build + +$ make +Scanning dependencies of target sublibrary1 +[ 50%] Building CXX object sublibrary1/CMakeFiles/sublibrary1.dir/src/sublib1.cpp.o +Linking CXX static library libsublibrary1.a +[ 50%] Built target sublibrary1 +Scanning dependencies of target subbinary +[100%] Building CXX object subbinary/CMakeFiles/subbinary.dir/main.cpp.o +Linking CXX executable subbinary +[100%] Built target subbinary + +---- diff --git a/cmake/example/02-sub-projects/A-basic/subbinary/CMakeLists.txt b/cmake/example/02-sub-projects/A-basic/subbinary/CMakeLists.txt new file mode 100644 index 0000000..36de880 --- /dev/null +++ b/cmake/example/02-sub-projects/A-basic/subbinary/CMakeLists.txt @@ -0,0 +1,12 @@ +project(subbinary) + +# Create the executable +add_executable(${PROJECT_NAME} main.cpp) + +# Link the static library from subproject1 using its alias sub::lib1 +# Link the header only library from subproject2 using its alias sub::lib2 +# This will cause the include directories for that target to be added to this project +target_link_libraries(${PROJECT_NAME} + sub::lib1 + sub::lib2 +) diff --git a/cmake/example/02-sub-projects/A-basic/subbinary/main.cpp b/cmake/example/02-sub-projects/A-basic/subbinary/main.cpp new file mode 100644 index 0000000..4219c5e --- /dev/null +++ b/cmake/example/02-sub-projects/A-basic/subbinary/main.cpp @@ -0,0 +1,13 @@ +#include "sublib1/sublib1.h" +#include "sublib2/sublib2.h" + +int main(int argc, char *argv[]) +{ + sublib1 hi; + hi.print(); + + sublib2 howdy; + howdy.print(); + + return 0; +} diff --git a/cmake/example/02-sub-projects/A-basic/sublibrary1/CMakeLists.txt b/cmake/example/02-sub-projects/A-basic/sublibrary1/CMakeLists.txt new file mode 100644 index 0000000..97dcb59 --- /dev/null +++ b/cmake/example/02-sub-projects/A-basic/sublibrary1/CMakeLists.txt @@ -0,0 +1,10 @@ +# Set the project name +project (sublibrary1) + +# Add a library with the above sources +add_library(${PROJECT_NAME} src/sublib1.cpp) +add_library(sub::lib1 ALIAS ${PROJECT_NAME}) + +target_include_directories( ${PROJECT_NAME} + PUBLIC ${PROJECT_SOURCE_DIR}/include +) diff --git a/cmake/example/02-sub-projects/A-basic/sublibrary1/include/sublib1/sublib1.h b/cmake/example/02-sub-projects/A-basic/sublibrary1/include/sublib1/sublib1.h new file mode 100644 index 0000000..599d2d7 --- /dev/null +++ b/cmake/example/02-sub-projects/A-basic/sublibrary1/include/sublib1/sublib1.h @@ -0,0 +1,10 @@ +#ifndef __SUBLIB_1_H__ +#define __SUBLIB_1_H__ + +class sublib1 +{ +public: + void print(); +}; + +#endif diff --git a/cmake/example/02-sub-projects/A-basic/sublibrary1/src/sublib1.cpp b/cmake/example/02-sub-projects/A-basic/sublibrary1/src/sublib1.cpp new file mode 100644 index 0000000..633d00d --- /dev/null +++ b/cmake/example/02-sub-projects/A-basic/sublibrary1/src/sublib1.cpp @@ -0,0 +1,8 @@ +#include + +#include "sublib1/sublib1.h" + +void sublib1::print() +{ + std::cout << "Hello sub-library 1!" << std::endl; +} diff --git a/cmake/example/02-sub-projects/A-basic/sublibrary2/CMakeLists.txt b/cmake/example/02-sub-projects/A-basic/sublibrary2/CMakeLists.txt new file mode 100644 index 0000000..c9c98ce --- /dev/null +++ b/cmake/example/02-sub-projects/A-basic/sublibrary2/CMakeLists.txt @@ -0,0 +1,10 @@ +# Set the project name +project (sublibrary2) + +add_library(${PROJECT_NAME} INTERFACE) +add_library(sub::lib2 ALIAS ${PROJECT_NAME}) + +target_include_directories(${PROJECT_NAME} + INTERFACE + ${PROJECT_SOURCE_DIR}/include +) diff --git a/cmake/example/02-sub-projects/A-basic/sublibrary2/include/sublib2/sublib2.h b/cmake/example/02-sub-projects/A-basic/sublibrary2/include/sublib2/sublib2.h new file mode 100644 index 0000000..2df61ac --- /dev/null +++ b/cmake/example/02-sub-projects/A-basic/sublibrary2/include/sublib2/sublib2.h @@ -0,0 +1,15 @@ +#ifndef __SUBLIB_2_H__ +#define __SUBLIB_2_H__ + +#include + +class sublib2 +{ +public: + void print() + { + std::cout << "Hello header only sub-library 2!" << std::endl; + } +}; + +#endif diff --git a/cmake/example/02-sub-projects/README.adoc b/cmake/example/02-sub-projects/README.adoc new file mode 100644 index 0000000..7151991 --- /dev/null +++ b/cmake/example/02-sub-projects/README.adoc @@ -0,0 +1,9 @@ += Sub-Project Examples + +Many large projects are made up of different libraries and binaries. These +can be organised into multiple folders and sub-projects to ease development. + +The examples included are + + - link:A-basic[basic] - This basic example includes a static library, a header only library + and an executable diff --git a/cmake/example/03-code-generation/README.adoc b/cmake/example/03-code-generation/README.adoc new file mode 100644 index 0000000..fe6201b --- /dev/null +++ b/cmake/example/03-code-generation/README.adoc @@ -0,0 +1,8 @@ += Code Generation + +Code generation can be useful to create source code in different languages from a common description file. This can reduce the amount of manual code to write and increase interoperability. + +Examples showing code generation using variables from CMake and also using some common tools. + + * link:configure-files[configure-file] - Using the CMake configure_file function to inject CMake variables. + * link:protobuf[Protocol Buffers] - Using Google Protocol Buffers to generate C++ source. diff --git a/cmake/example/03-code-generation/configure-files/CMakeLists.txt b/cmake/example/03-code-generation/configure-files/CMakeLists.txt new file mode 100644 index 0000000..1dfaf80 --- /dev/null +++ b/cmake/example/03-code-generation/configure-files/CMakeLists.txt @@ -0,0 +1,29 @@ +cmake_minimum_required(VERSION 3.5) + +# Set the project name +project (cf_example) + +# set a project version +set (cf_example_VERSION_MAJOR 0) +set (cf_example_VERSION_MINOR 2) +set (cf_example_VERSION_PATCH 1) +set (cf_example_VERSION "${cf_example_VERSION_MAJOR}.${cf_example_VERSION_MINOR}.${cf_example_VERSION_PATCH}") + +# Call configure files on ver.h.in to set the version. +# Uses the standard ${VARIABLE} syntax in the file +configure_file(ver.h.in ${PROJECT_BINARY_DIR}/ver.h) + +# configure the path.h.in file. +# This file can only use the @VARIABLE@ syntax in the file +configure_file(path.h.in ${PROJECT_BINARY_DIR}/path.h @ONLY) + +# Add an executable +add_executable(cf_example + main.cpp +) + +# include the directory with the new files +target_include_directories( cf_example + PUBLIC + ${CMAKE_BINARY_DIR} +) diff --git a/cmake/example/03-code-generation/configure-files/README.adoc b/cmake/example/03-code-generation/configure-files/README.adoc new file mode 100644 index 0000000..6715c7d --- /dev/null +++ b/cmake/example/03-code-generation/configure-files/README.adoc @@ -0,0 +1,113 @@ += Configure Files Generation +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +During the call to cmake it is possible to create files that use variables from +the CMakeLists.txt and cmake cache. During CMake generation the file is copied to a +new location and any cmake variables are replaced. + +The files in this tutorial are below: + +``` +$ tree +. +├── CMakeLists.txt +├── main.cpp +├── path.h.in +├── ver.h.in +``` + + * link:CMakeLists.txt[] - Contains the CMake commands you wish to run + * link:main.cpp[] - The source file with main + * link:path.h.in[] - File to contain a path to the build directory + * link:ver.h.in[] - File to contain the version of the project + +# Concepts + +## Configure Files + +To do variable substitution in a file you can use the `configure_file()` function +in CMake. This core arguments for this function are source file and destination file. + +[source,cmake] +---- +configure_file(ver.h.in ${PROJECT_BINARY_DIR}/ver.h) + +configure_file(path.h.in ${PROJECT_BINARY_DIR}/path.h @ONLY) +---- + +The first example above, allows the variable to be defined like a CMake variables using +the `${}` syntax or an `@@` in the ver.h.in file. After generation a new file ver.h will be available +in the `PROJECT_BINARY_DIR`. + +``` +const char* ver = "${cf_example_VERSION}"; +``` + +The second example, only allows variables to be defined using the `@@` syntax in the path.h.in file. +After generation a new file path.h will be available in the `PROJECT_BINARY_DIR`. + +``` +const char* path = "@CMAKE_SOURCE_DIR@"; +``` + +# Building the Example + +[source,bash] +---- +$ mkdir build + +$ cd build/ + +$ cmake .. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/03-code-generation/configure-files/build + +$ ls +CMakeCache.txt CMakeFiles cmake_install.cmake Makefile path.h ver.h + +$ cat path.h +#ifndef __PATH_H__ +#define __PATH_H__ + +// version variable that will be substituted by cmake +// This shows an example using the @ variable type +const char* path = "/home/matrim/workspace/cmake-examples/03-code-generation/configure-files"; + +#endif + +$ cat ver.h +#ifndef __VER_H__ +#define __VER_H__ + +// version variable that will be substituted by cmake +// This shows an example using the $ variable type +const char* ver = "0.2.1"; + +#endif + +$ make +Scanning dependencies of target cf_example +[100%] Building CXX object CMakeFiles/cf_example.dir/main.cpp.o +Linking CXX executable cf_example +[100%] Built target cf_example + +$ ./cf_example +Hello Version 0.2.1! +Path is /home/matrim/workspace/cmake-examples/03-code-generation/configure-files +---- diff --git a/cmake/example/03-code-generation/configure-files/main.cpp b/cmake/example/03-code-generation/configure-files/main.cpp new file mode 100644 index 0000000..a95d73f --- /dev/null +++ b/cmake/example/03-code-generation/configure-files/main.cpp @@ -0,0 +1,10 @@ +#include +#include "ver.h" +#include "path.h" + +int main(int argc, char *argv[]) +{ + std::cout << "Hello Version " << ver << "!" << std::endl; + std::cout << "Path is " << path << std::endl; + return 0; +} diff --git a/cmake/example/03-code-generation/configure-files/path.h.in b/cmake/example/03-code-generation/configure-files/path.h.in new file mode 100644 index 0000000..c7436ff --- /dev/null +++ b/cmake/example/03-code-generation/configure-files/path.h.in @@ -0,0 +1,8 @@ +#ifndef __PATH_H__ +#define __PATH_H__ + +// version variable that will be substituted by cmake +// This shows an example using the @ variable type +const char* path = "@CMAKE_SOURCE_DIR@"; + +#endif diff --git a/cmake/example/03-code-generation/configure-files/ver.h.in b/cmake/example/03-code-generation/configure-files/ver.h.in new file mode 100644 index 0000000..89c55c5 --- /dev/null +++ b/cmake/example/03-code-generation/configure-files/ver.h.in @@ -0,0 +1,8 @@ +#ifndef __VER_H__ +#define __VER_H__ + +// version variable that will be substituted by cmake +// This shows an example using the $ variable type +const char* ver = "${cf_example_VERSION}"; + +#endif diff --git a/cmake/example/03-code-generation/protobuf/AddressBook.proto b/cmake/example/03-code-generation/protobuf/AddressBook.proto new file mode 100644 index 0000000..13913b8 --- /dev/null +++ b/cmake/example/03-code-generation/protobuf/AddressBook.proto @@ -0,0 +1,24 @@ +package tutorial; + +message Person { + required string name = 1; + required int32 id = 2; + optional string email = 3; + + enum PhoneType { + MOBILE = 0; + HOME = 1; + WORK = 2; + } + + message PhoneNumber { + required string number = 1; + optional PhoneType type = 2 [default = HOME]; + } + + repeated PhoneNumber phone = 4; +} + +message AddressBook { + repeated Person person = 1; +} diff --git a/cmake/example/03-code-generation/protobuf/CMakeLists.txt b/cmake/example/03-code-generation/protobuf/CMakeLists.txt new file mode 100644 index 0000000..8fd31db --- /dev/null +++ b/cmake/example/03-code-generation/protobuf/CMakeLists.txt @@ -0,0 +1,39 @@ +cmake_minimum_required(VERSION 3.5) + +# Set the project name +project (protobuf_example) + +# find the protobuf compiler and libraries +find_package(Protobuf REQUIRED) + +# check if protobuf was found +if(PROTOBUF_FOUND) + message ("protobuf found") +else() + message (FATAL_ERROR "Cannot find Protobuf") +endif() + +# Generate the .h and .cxx files +PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS AddressBook.proto) + +# Print path to generated files +message ("PROTO_SRCS = ${PROTO_SRCS}") +message ("PROTO_HDRS = ${PROTO_HDRS}") + +# Add an executable +add_executable(protobuf_example + main.cpp + ${PROTO_SRCS} + ${PROTO_HDRS}) + +target_include_directories(protobuf_example + PUBLIC + ${PROTOBUF_INCLUDE_DIRS} + ${CMAKE_CURRENT_BINARY_DIR} +) + +# link the exe against the libraries +target_link_libraries(protobuf_example + PUBLIC + ${PROTOBUF_LIBRARIES} +) diff --git a/cmake/example/03-code-generation/protobuf/README.adoc b/cmake/example/03-code-generation/protobuf/README.adoc new file mode 100644 index 0000000..7ccd87a --- /dev/null +++ b/cmake/example/03-code-generation/protobuf/README.adoc @@ -0,0 +1,209 @@ += Protobuf Code Generation +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +This example shows how to generate source files using https://github.com/google/protobuf[protobuf]. +Protocol Buffers is a data serialization format from Google. A user provides a +`.proto` file with a description of the data. Then using the protobuf compiler, the proto file +can be translated into source code in a number of languages including C++. + +The files in this tutorial are below: + +``` +$ tree +. +├── AddressBook.proto +├── CMakeLists.txt +├── main.cpp +``` + + * link:AddressBook.proto[] - proto file from main protocol buffer https://developers.google.com/protocol-buffers/docs/cpptutorial[example] + * link:CMakeLists.txt[] - Contains the CMake commands you wish to run + * link:main.cpp[] - The source file from the protobuf example. + +# Requirements + +This example requires the protocol buffers binary and libraries to be installed. + +This can be installed on Ubuntu using + +[source,bash] +---- +sudo apt-get install protobuf-compiler libprotobuf-dev +---- + +# Concepts + +## Exported Variables + +The variables exported by the CMake protobuf package and used in this example include: + + * `PROTOBUF_FOUND` - If Protocol Buffers is installed + * `PROTOBUF_INCLUDE_DIRS` - The protobuf header files + * `PROTOBUF_LIBRARIES` - The protobuf library + +More variables are defined and can be found by examining the documentation at the +top of your `FindProtobuf.cmake` file. + +## Generating Source + +The protobuf CMake package includes a number of helper functions to make the +code generation easier. In this example we are generating C++ source and use +the following code: + +[source,cmake] +---- +PROTOBUF_GENERATE_CPP(PROTO_SRCS PROTO_HDRS AddressBook.proto) +---- + +The arguments are: + + * PROTO_SRCS - Name of the variable that will store the .pb.cc files. + * PROTO_HDRS- Name of the variable that will store the .pb.h files. + * AddressBook.proto - The .proto file to generate code from. + +## Generated Files + +After the `PROTOBUF_GENERATE_CPP` function is called, you will have the above +mentioned variables available. These will be marked as the output to a custom command +which calls the protobuf compiler binary to generate them. + +To then have the files generated you should add them to a library or executable. +For example: + +[source,cmake] +---- +add_executable(protobuf_example + main.cpp + ${PROTO_SRCS} + ${PROTO_HDRS}) +---- + +This will cause the protobuf compiler to be called when you call `make` on that +executables target. + +When changes are made to the .proto file, the associated source files will be +autogenerated again. However, if no changes are made to the .proto file and you re-run +make, then nothing will be done. + +# Building the Example + +[source,bash] +---- +$ mkdir build + +$ cd build/ + +$ cmake .. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Looking for include file pthread.h +-- Looking for include file pthread.h - found +-- Looking for pthread_create +-- Looking for pthread_create - not found +-- Looking for pthread_create in pthreads +-- Looking for pthread_create in pthreads - not found +-- Looking for pthread_create in pthread +-- Looking for pthread_create in pthread - found +-- Found Threads: TRUE +-- Found PROTOBUF: /usr/lib/x86_64-linux-gnu/libprotobuf.so +protobuf found +PROTO_SRCS = /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/AddressBook.pb.cc +PROTO_HDRS = /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/AddressBook.pb.h +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build + +$ ls +CMakeCache.txt CMakeFiles cmake_install.cmake Makefile + +$ make VERBOSE=1 +/usr/bin/cmake -H/home/matrim/workspace/cmake-examples/03-code-generation/protobuf -B/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build --check-build-system CMakeFiles/Makefile.cmake 0 +/usr/bin/cmake -E cmake_progress_start /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles/progress.marks +make -f CMakeFiles/Makefile2 all +make[1]: Entering directory `/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build' +make -f CMakeFiles/protobuf_example.dir/build.make CMakeFiles/protobuf_example.dir/depend +make[2]: Entering directory `/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build' +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles 1 +[ 33%] Running C++ protocol buffer compiler on AddressBook.proto +/usr/bin/protoc --cpp_out /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build -I /home/matrim/workspace/cmake-examples/03-code-generation/protobuf /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/AddressBook.proto +cd /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/matrim/workspace/cmake-examples/03-code-generation/protobuf /home/matrim/workspace/cmake-examples/03-code-generation/protobuf /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles/protobuf_example.dir/DependInfo.cmake --color= +Dependee "/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles/protobuf_example.dir/DependInfo.cmake" is newer than depender "/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles/protobuf_example.dir/depend.internal". +Dependee "/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles/protobuf_example.dir/depend.internal". +Scanning dependencies of target protobuf_example +make[2]: Leaving directory `/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build' +make -f CMakeFiles/protobuf_example.dir/build.make CMakeFiles/protobuf_example.dir/build +make[2]: Entering directory `/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build' +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles 2 +[ 66%] Building CXX object CMakeFiles/protobuf_example.dir/main.cpp.o +/usr/bin/c++ -I/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build -o CMakeFiles/protobuf_example.dir/main.cpp.o -c /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/main.cpp +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles 3 +[100%] Building CXX object CMakeFiles/protobuf_example.dir/AddressBook.pb.cc.o +/usr/bin/c++ -I/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build -o CMakeFiles/protobuf_example.dir/AddressBook.pb.cc.o -c /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/AddressBook.pb.cc +Linking CXX executable protobuf_example +/usr/bin/cmake -E cmake_link_script CMakeFiles/protobuf_example.dir/link.txt --verbose=1 +/usr/bin/c++ CMakeFiles/protobuf_example.dir/main.cpp.o CMakeFiles/protobuf_example.dir/AddressBook.pb.cc.o -o protobuf_example -rdynamic -lprotobuf -lpthread +make[2]: Leaving directory `/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build' +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles 1 2 3 +[100%] Built target protobuf_example +make[1]: Leaving directory `/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build' +/usr/bin/cmake -E cmake_progress_start /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles 0 +$ make VERBOSE=1 +/usr/bin/cmake -H/home/matrim/workspace/cmake-examples/03-code-generation/protobuf -B/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build --check-build-system CMakeFiles/Makefile.cmake 0 +/usr/bin/cmake -E cmake_progress_start /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles/progress.marks +make -f CMakeFiles/Makefile2 all +make[1]: Entering directory `/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build' +make -f CMakeFiles/protobuf_example.dir/build.make CMakeFiles/protobuf_example.dir/depend +make[2]: Entering directory `/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build' +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles 1 +[ 33%] Running C++ protocol buffer compiler on AddressBook.proto +/usr/bin/protoc --cpp_out /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build -I /home/matrim/workspace/cmake-examples/03-code-generation/protobuf /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/AddressBook.proto +cd /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/matrim/workspace/cmake-examples/03-code-generation/protobuf /home/matrim/workspace/cmake-examples/03-code-generation/protobuf /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles/protobuf_example.dir/DependInfo.cmake --color= +Dependee "/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles/protobuf_example.dir/DependInfo.cmake" is newer than depender "/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles/protobuf_example.dir/depend.internal". +Dependee "/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles/protobuf_example.dir/depend.internal". +Scanning dependencies of target protobuf_example +make[2]: Leaving directory `/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build' +make -f CMakeFiles/protobuf_example.dir/build.make CMakeFiles/protobuf_example.dir/build +make[2]: Entering directory `/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build' +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles 2 +[ 66%] Building CXX object CMakeFiles/protobuf_example.dir/main.cpp.o +/usr/bin/c++ -I/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build -o CMakeFiles/protobuf_example.dir/main.cpp.o -c /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/main.cpp +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles 3 +[100%] Building CXX object CMakeFiles/protobuf_example.dir/AddressBook.pb.cc.o +/usr/bin/c++ -I/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build -o CMakeFiles/protobuf_example.dir/AddressBook.pb.cc.o -c /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/AddressBook.pb.cc +Linking CXX executable protobuf_example +/usr/bin/cmake -E cmake_link_script CMakeFiles/protobuf_example.dir/link.txt --verbose=1 +/usr/bin/c++ CMakeFiles/protobuf_example.dir/main.cpp.o CMakeFiles/protobuf_example.dir/AddressBook.pb.cc.o -o protobuf_example -rdynamic -lprotobuf -lpthread +make[2]: Leaving directory `/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build' +/usr/bin/cmake -E cmake_progress_report /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles 1 2 3 +[100%] Built target protobuf_example +make[1]: Leaving directory `/home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build' +/usr/bin/cmake -E cmake_progress_start /home/matrim/workspace/cmake-examples/03-code-generation/protobuf/build/CMakeFiles 0 + +$ ls +AddressBook.pb.cc CMakeCache.txt cmake_install.cmake protobuf_example +AddressBook.pb.h CMakeFiles Makefile + +$ ./protobuf_example test.db +test.db: File not found. Creating a new file. +Enter person ID number: 11 +Enter name: John Doe +Enter email address (blank for none): wolly@sheep.ie +Enter a phone number (or leave blank to finish): + +$ ls +AddressBook.pb.cc CMakeCache.txt cmake_install.cmake protobuf_example +AddressBook.pb.h CMakeFiles Makefile test.db +---- diff --git a/cmake/example/03-code-generation/protobuf/main.cpp b/cmake/example/03-code-generation/protobuf/main.cpp new file mode 100644 index 0000000..e519fa5 --- /dev/null +++ b/cmake/example/03-code-generation/protobuf/main.cpp @@ -0,0 +1,93 @@ +#include +#include +#include +#include "AddressBook.pb.h" +using namespace std; + +// This function fills in a Person message based on user input. +void PromptForAddress(tutorial::Person* person) { + cout << "Enter person ID number: "; + int id; + cin >> id; + person->set_id(id); + cin.ignore(256, '\n'); + + cout << "Enter name: "; + getline(cin, *person->mutable_name()); + + cout << "Enter email address (blank for none): "; + string email; + getline(cin, email); + if (!email.empty()) { + person->set_email(email); + } + + while (true) { + cout << "Enter a phone number (or leave blank to finish): "; + string number; + getline(cin, number); + if (number.empty()) { + break; + } + + tutorial::Person::PhoneNumber* phone_number = person->add_phone(); + phone_number->set_number(number); + + cout << "Is this a mobile, home, or work phone? "; + string type; + getline(cin, type); + if (type == "mobile") { + phone_number->set_type(tutorial::Person::MOBILE); + } else if (type == "home") { + phone_number->set_type(tutorial::Person::HOME); + } else if (type == "work") { + phone_number->set_type(tutorial::Person::WORK); + } else { + cout << "Unknown phone type. Using default." << endl; + } + } +} + +// Main function: Reads the entire address book from a file, +// adds one person based on user input, then writes it back out to the same +// file. +int main(int argc, char* argv[]) { + // Verify that the version of the library that we linked against is + // compatible with the version of the headers we compiled against. + GOOGLE_PROTOBUF_VERIFY_VERSION; + + if (argc != 2) { + cerr << "Usage: " << argv[0] << " ADDRESS_BOOK_FILE" << endl; + return -1; + } + + tutorial::AddressBook address_book; + + { + // Read the existing address book. + fstream input(argv[1], ios::in | ios::binary); + if (!input) { + cout << argv[1] << ": File not found. Creating a new file." << endl; + } else if (!address_book.ParseFromIstream(&input)) { + cerr << "Failed to parse address book." << endl; + return -1; + } + } + + // Add an address. + PromptForAddress(address_book.add_person()); + + { + // Write the new address book back to disk. + fstream output(argv[1], ios::out | ios::trunc | ios::binary); + if (!address_book.SerializeToOstream(&output)) { + cerr << "Failed to write address book." << endl; + return -1; + } + } + + // Optional: Delete all global objects allocated by libprotobuf. + google::protobuf::ShutdownProtobufLibrary(); + + return 0; +} diff --git a/cmake/example/04-static-analysis/README.adoc b/cmake/example/04-static-analysis/README.adoc new file mode 100644 index 0000000..b895728 --- /dev/null +++ b/cmake/example/04-static-analysis/README.adoc @@ -0,0 +1,28 @@ += Static Analysis +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +Static analysis is the analysis of code without executing it. It can be +used to find common programming errors and enforce coding guidelines. +Examples of errors that can be found using static analysis tools +include: + +* Out of bounds errors +* Memory leaks +* Usage of uninitialized variables +* Use of unsafe functions + +Analysis tools can detect errors early and are becoming a standard tool +in most build chains. Some build tools such as +http://clang-analyzer.llvm.org/[Clang] include a build in static +analysis tool. However standalone tools also exist. + +The examples here include using the following tools: + +* http://cppcheck.sourceforge.net/[CppCheck] +* https://clang-analyzer.llvm.org/[Clang Static Analyzer] +* https://clang.llvm.org/docs/ClangFormat.html[Clang Format] diff --git a/cmake/example/04-static-analysis/clang-analyzer/CMakeLists.txt b/cmake/example/04-static-analysis/clang-analyzer/CMakeLists.txt new file mode 100644 index 0000000..0a94a19 --- /dev/null +++ b/cmake/example/04-static-analysis/clang-analyzer/CMakeLists.txt @@ -0,0 +1,13 @@ +cmake_minimum_required (VERSION 3.5) + +project(cppcheck_analysis) + +# Use debug build as recommended +set(CMAKE_BUILD_TYPE Debug) + +# Have cmake create a compile database +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +# Add sub directories +add_subdirectory(subproject1) +add_subdirectory(subproject2) diff --git a/cmake/example/04-static-analysis/clang-analyzer/README.adoc b/cmake/example/04-static-analysis/clang-analyzer/README.adoc new file mode 100644 index 0000000..14e1f44 --- /dev/null +++ b/cmake/example/04-static-analysis/clang-analyzer/README.adoc @@ -0,0 +1,154 @@ += clang-analyzer +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +This example shows how to call the +https://clang-analyzer.llvm.org/[Clang Static Analyzer] to do static analysis using the +scan-build tool. + +The files included in this example are: + +``` +$ tree +. +├── CMakeLists.txt +├── subproject1 +│   ├── CMakeLists.txt +│   └── main1.cpp +└── subproject2 + ├── CMakeLists.txt + └── main2.cpp +``` + + * link:CMakeLists.txt[] - Top level CMakeLists.txt + * link:subproject1/CMakeLists.txt[] - CMake commands for subproject 1 + * link:subproject1/main.cpp[] - source for a subproject with no errors + * link:subproject2/CMakeLists.txt[] - CMake commands for subproject 2 + * link:subproject2/main2.cpp[] - source for a subproject that includes errors + +# Requirements + +To run this example you must have clang analyzer and the scan-build tool installed. This can be installed on Ubuntu using the following command. + +[source,bash] +---- +$ sudo apt-get install clang +---- + +It will result in the tool being available as: + +[source,bash] +---- +$ scan-build-3.6 +---- + +# Concepts + +## scan-build + +To run clang static analyzer you can use the tool `scan-build` to run the analyzer when you +also run the compiler. This overrides the CC and CXX environment variables and replaces them with it's own tools. To run it you can do + +[source,bash] +---- +$ scan-build-3.6 cmake .. +$ scan-build-3.6 make +---- + +By default this will run the standard compiler for your platform, i.e. `gcc` on linux. However, if you want to override this you can change the command to: + +[source,bash] +---- +$ scan-build-3.6 --use-cc=clang-3.6 --use-c++=clang++-3.6 -o ./scanbuildout/ make +---- + +## scan-build output + +scan-build will only output warnings during compile time and will also generate a list of HTML files which contain detailed analysis of the error. + +[source,bash] +---- +$ cd scanbuildout/ +$ tree +. +└── 2017-07-03-213514-3653-1 + ├── index.html + ├── report-42eba1.html + ├── scanview.css + └── sorttable.js + +1 directory, 4 files +---- + +By default these are output to +/tmp/scanbuildout/{run folder}+. You can change this using `scan-build -o /output/folder`. + +# Building the example + +[source,bash] +---- +$ mkdir build + +$ cd build/ + +$ scan-build-3.6 -o ./scanbuildout make +scan-build: Using '/usr/lib/llvm-3.6/bin/clang' for static analysis +make: *** No targets specified and no makefile found. Stop. +scan-build: Removing directory '/data/code/clang-analyzer/build/scanbuildout/2017-07-03-211632-937-1' because it contains no reports. +scan-build: No bugs found. +devuser@91457fbfa423:/data/code/clang-analyzer/build$ scan-build-3.6 -o ./scanbuildout cmake .. +scan-build: Using '/usr/lib/llvm-3.6/bin/clang' for static analysis +-- The C compiler identification is GNU 5.4.0 +-- The CXX compiler identification is GNU 5.4.0 +-- Check for working C compiler: /usr/share/clang/scan-build-3.6/ccc-analyzer +-- Check for working C compiler: /usr/share/clang/scan-build-3.6/ccc-analyzer -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Detecting C compile features +-- Detecting C compile features - done +-- Check for working CXX compiler: /usr/share/clang/scan-build-3.6/c++-analyzer +-- Check for working CXX compiler: /usr/share/clang/scan-build-3.6/c++-analyzer -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Detecting CXX compile features +-- Detecting CXX compile features - done +-- Found CPPCHECK: /usr/local/bin/cppcheck +cppcheck found. Use cppccheck-analysis targets to run it +-- Configuring done +-- Generating done +-- Build files have been written to: /data/code/clang-analyzer/build +scan-build: Removing directory '/data/code/clang-analyzer/build/scanbuildout/2017-07-03-211641-941-1' because it contains no reports. +scan-build: No bugs found. + +$ $ scan-build-3.6 -o ./scanbuildout make +scan-build: Using '/usr/lib/llvm-3.6/bin/clang' for static analysis +Scanning dependencies of target subproject1 +[ 25%] Building CXX object subproject1/CMakeFiles/subproject1.dir/main1.cpp.o +[ 50%] Linking CXX executable subproject1 +[ 50%] Built target subproject1 +Scanning dependencies of target subproject2 +[ 75%] Building CXX object subproject2/CMakeFiles/subproject2.dir/main2.cpp.o +/data/code/clang-analyzer/subproject2/main2.cpp:7:17: warning: Dereference of null pointer (loaded from variable 'x') + std::cout << *x << std::endl; + ^~ +1 warning generated. +[100%] Linking CXX executable subproject2 +[100%] Built target subproject2 +scan-build: 1 bug found. +scan-build: Run 'scan-view /data/code/clang-analyzer/build/scanbuildout/2017-07-03-211647-1172-1' to examine bug reports. + +$ cd scanbuildout/ +$ tree +. +└── 2017-07-03-213514-3653-1 + ├── index.html + ├── report-42eba1.html + ├── scanview.css + └── sorttable.js + +1 directory, 4 files +---- + diff --git a/cmake/example/04-static-analysis/clang-analyzer/run_test.sh b/cmake/example/04-static-analysis/clang-analyzer/run_test.sh new file mode 100755 index 0000000..3d97c27 --- /dev/null +++ b/cmake/example/04-static-analysis/clang-analyzer/run_test.sh @@ -0,0 +1,5 @@ +#!/bin/bash +mkdir -p build \ + && cd build \ + && scan-build-3.6 -o scanbuildout cmake .. \ + && scan-build-3.6 -o scanbuildout make diff --git a/cmake/example/04-static-analysis/clang-analyzer/subproject1/CMakeLists.txt b/cmake/example/04-static-analysis/clang-analyzer/subproject1/CMakeLists.txt new file mode 100644 index 0000000..e846c31 --- /dev/null +++ b/cmake/example/04-static-analysis/clang-analyzer/subproject1/CMakeLists.txt @@ -0,0 +1,5 @@ +# Set the project name +project (subproject1) + +# Add an executable with the above sources +add_executable(${PROJECT_NAME} main1.cpp) diff --git a/cmake/example/04-static-analysis/clang-analyzer/subproject1/main1.cpp b/cmake/example/04-static-analysis/clang-analyzer/subproject1/main1.cpp new file mode 100644 index 0000000..98cacb2 --- /dev/null +++ b/cmake/example/04-static-analysis/clang-analyzer/subproject1/main1.cpp @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + std::cout << "Hello Main1!" << std::endl; + return 0; +} \ No newline at end of file diff --git a/cmake/example/04-static-analysis/clang-analyzer/subproject2/CMakeLists.txt b/cmake/example/04-static-analysis/clang-analyzer/subproject2/CMakeLists.txt new file mode 100644 index 0000000..0c882a4 --- /dev/null +++ b/cmake/example/04-static-analysis/clang-analyzer/subproject2/CMakeLists.txt @@ -0,0 +1,5 @@ +# Set the project name +project (subproject2) + +# Add an executable with the above sources +add_executable(${PROJECT_NAME} main2.cpp) diff --git a/cmake/example/04-static-analysis/clang-analyzer/subproject2/main2.cpp b/cmake/example/04-static-analysis/clang-analyzer/subproject2/main2.cpp new file mode 100644 index 0000000..de94989 --- /dev/null +++ b/cmake/example/04-static-analysis/clang-analyzer/subproject2/main2.cpp @@ -0,0 +1,9 @@ +#include + +int main(int argc, char *argv[]) +{ + std::cout << "Hello Main2!" << std::endl; + int* x = NULL; + std::cout << *x << std::endl; + return 0; +} diff --git a/cmake/example/04-static-analysis/clang-format/.clang-format b/cmake/example/04-static-analysis/clang-format/.clang-format new file mode 100644 index 0000000..2ee84f8 --- /dev/null +++ b/cmake/example/04-static-analysis/clang-format/.clang-format @@ -0,0 +1,61 @@ +--- +Language: Cpp +# BasedOnStyle: LLVM +AccessModifierOffset: -4 +AlignEscapedNewlinesLeft: false +AlignOperands: true +AlignTrailingComments: true +AllowAllParametersOfDeclarationOnNextLine: true +AllowShortBlocksOnASingleLine: false +AllowShortCaseLabelsOnASingleLine: false +AllowShortFunctionsOnASingleLine: All +AllowShortIfStatementsOnASingleLine: false +AllowShortLoopsOnASingleLine: false +AlwaysBreakBeforeMultilineStrings: false +AlwaysBreakTemplateDeclarations: false +BinPackArguments: true +BinPackParameters: true +BreakBeforeBinaryOperators: None +BreakBeforeBraces: Allman +BreakBeforeTernaryOperators: true +BreakConstructorInitializersBeforeComma: false +ColumnLimit: 120 +CommentPragmas: '' +ConstructorInitializerAllOnOneLineOrOnePerLine: false +ConstructorInitializerIndentWidth: 8 +ContinuationIndentWidth: 4 +Cpp11BracedListStyle: true +DerivePointerAlignment: false +DisableFormat: false +ExperimentalAutoDetectBinPacking: false +ForEachMacros: [ foreach, Q_FOREACH, BOOST_FOREACH ] +IndentCaseLabels: false +IndentWidth: 4 +IndentWrappedFunctionNames: false +KeepEmptyLinesAtTheStartOfBlocks: true +MaxEmptyLinesToKeep: 3 +NamespaceIndentation: All +ObjCBlockIndentWidth: 2 +ObjCSpaceAfterProperty: false +ObjCSpaceBeforeProtocolList: true +PenaltyBreakBeforeFirstCallParameter: 19 +PenaltyBreakComment: 300 +PenaltyBreakFirstLessLess: 120 +PenaltyBreakString: 1000 +PenaltyExcessCharacter: 1000000 +PenaltyReturnTypeOnItsOwnLine: 60 +PointerAlignment: Left +SpaceAfterCStyleCast: false +SpaceBeforeAssignmentOperators: true +SpaceBeforeParens: ControlStatements +SpaceInEmptyParentheses: false +SpacesBeforeTrailingComments: 1 +SpacesInAngles: false +SpacesInContainerLiterals: true +SpacesInCStyleCastParentheses: false +SpacesInParentheses: false +SpacesInSquareBrackets: false +Standard: Cpp11 +TabWidth: 4 +UseTab: Never +... diff --git a/cmake/example/04-static-analysis/clang-format/CMakeLists.txt b/cmake/example/04-static-analysis/clang-format/CMakeLists.txt new file mode 100644 index 0000000..b6c4674 --- /dev/null +++ b/cmake/example/04-static-analysis/clang-format/CMakeLists.txt @@ -0,0 +1,15 @@ +cmake_minimum_required (VERSION 3.5) + +project(cppcheck_analysis) + +# Add a custom CMake Modules directory +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules + ${CMAKE_MODULE_PATH}) + +# Add sub directories +add_subdirectory(subproject1) +add_subdirectory(subproject2) + +set(CLANG_FORMAT_BIN_NAME clang-format-3.6) +set(CLANG_FORMAT_EXCLUDE_PATTERNS "build/" ${CMAKE_BINARY_DIR}) +find_package(ClangFormat) diff --git a/cmake/example/04-static-analysis/clang-format/README.adoc b/cmake/example/04-static-analysis/clang-format/README.adoc new file mode 100644 index 0000000..66034cb --- /dev/null +++ b/cmake/example/04-static-analysis/clang-format/README.adoc @@ -0,0 +1,152 @@ += clang-format +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +This example shows how to call the +https://clang.llvm.org/docs/ClangFormat.html[Clang Format] to check if your source code +matches against your code style guidelines. + +The files included in this example are: + +``` +$ tree +. +├── .clang-format +├── CMakeLists.txt +├── cmake +│   ├── modules +│   │   ├── clang-format.cmake +│   │   └── FindClangFormat.cmake +│   └── scripts +│   └── clang-format-check-changed +├── subproject1 +│   ├── CMakeLists.txt +│   └── main1.cpp +└── subproject2 + ├── CMakeLists.txt + └── main2.cpp +``` + + * link:CMakeLists.txt[] - Top level CMakeLists.txt + * link:.clang-format[] - The file describing the style guide + * link:cmake/modules/FindClangFormat.cmake[] - Script to find the clang-format binary + * link:cmake/modules/clang-format.cmake[] - Script to setup the format targets + * link:cmake/scripts/clang-format-check-changed.py[] - A helper script to check against changed files in git + * link:cmake/scripts/clang-format-check-changed.py[] - An old simplified version of the above helper script + * link:subproject1/CMakeLists.txt[] - CMake commands for subproject 1 + * link:subproject1/main1.cpp[] - source for a subproject with no style errors + * link:subproject2/CMakeLists.txt[] - CMake commands for subproject 2 + * link:subproject2/main2.cpp[] - source for a subproject that includes style errors + +# Requirements + +To run this example you must have clang format tool installed. This can be installed on Ubuntu using the following command. + +[source,bash] +---- +$ sudo apt-get install clang-format-3.6 +---- + +It will result in the tool being available as: + +[source,bash] +---- +$ clang-format-3.6 +---- + +If you install a different version, you can edit the `CLANG_FORMAT_BIN_NAME` variable in the root CMakeLists.txt + +# Concepts + +## clang-format + ++clang-format+ can scan a source file then find and optionally format it to match your +companys style guidelines. There are default styles build in but you can also setup a style guide using a custom file called +.clang-format+, for example a snipped from this +repositories +.clang-format+ is below: + +[source] +---- +Language: Cpp +# BasedOnStyle: LLVM +AccessModifierOffset: -4 +AlignAfterOpenBracket: Align +AlignConsecutiveAssignments: false +AlignConsecutiveDeclarations: false +---- + +## format style + +As mentioned, the style in this example is based on the +.clang-format+ file. This can be changed by editing link:cmake/modules/clang-format.cmake[clang-format.cmake] and changing +the `-style=file` to the required style; + +# Targets + +This example will setup 3 targets: + + * format + * format-check + * format-check-changed + +## format + +The format target will find any C++ source files and in place modify them to match the ++.clang-format+ style. The source files are found using the following cmake code + +[source,cmake] +---- +file(GLOB_RECURSE ALL_SOURCE_FILES *.cpp *.h *.cxx *.hxx *.hpp *.cc *.ipp) + +# Don't include some common build folders +set(CLANG_FORMAT_EXCLUDE_PATTERNS ${CLANG_FORMAT_EXCLUDE_PATTERNS} "/CMakeFiles/" "cmake") + +# get all project files file +foreach (SOURCE_FILE ${ALL_SOURCE_FILES}) + foreach (EXCLUDE_PATTERN ${CLANG_FORMAT_EXCLUDE_PATTERNS}) + string(FIND ${SOURCE_FILE} ${EXCLUDE_PATTERN} EXCLUDE_FOUND) + if (NOT ${EXCLUDE_FOUND} EQUAL -1) + list(REMOVE_ITEM ALL_SOURCE_FILES ${SOURCE_FILE}) + endif () + endforeach () +endforeach () +---- + +This will find files matching the common C++ suffixes and then remove any that match some +common CMake directories. + +In the root `CMakeList.txt` we also exclude the build directory by adding the line + +[source,cmake] +---- +set(CLANG_FORMAT_EXCLUDE_PATTERNS "build/") +---- + +## format-check + +This target will work as above but instead of formatting the files it will cause a failure +if any files don't match the clang-format style + +## format-check-changed + +This target will check the output of `git status` and scan the files to check if they match the style. This can be used by developers to make sure their changed files match the correct style. + +In this example the actual check is done with a helper script +clang-format-check-changed.py+. This script will run `git status --porcelain --ignore-submodules` +to get a list of changed files, match them against the allowed extensions from the above list, and finally remove any +that match the exclude pattern from +CLANG_FORMAT_EXCLUDE_PATTERNS+. It will then run these files through clang-format and +exit with an error if the files do not match the style. + +An example call to the +clang-format-check-changed.py+ script is: + +[source,bash] +---- +cmake/scripts/clang-format-check-changed.py --file-extensions ".cpp,*.cpp,*.h,*.cxx,*.hxx,*.hpp,*.cc,*.ipp" --exclude=build/ --exclude=/CMakeFiles/ --exclude=cmake --clang-format-bin /usr/bin/clang-format-3.6 +---- + +[NOTE] +==== +This will include all changed files in your git repository that match the patterns. In this example repository this can include files that +are part of different examples. +==== diff --git a/cmake/example/04-static-analysis/clang-format/cmake/modules/FindClangFormat.cmake b/cmake/example/04-static-analysis/clang-format/cmake/modules/FindClangFormat.cmake new file mode 100644 index 0000000..c627343 --- /dev/null +++ b/cmake/example/04-static-analysis/clang-format/cmake/modules/FindClangFormat.cmake @@ -0,0 +1,34 @@ +# Find Clang format +# +# +if(NOT CLANG_FORMAT_BIN_NAME) + set(CLANG_FORMAT_BIN_NAME clang-format) +endif() + +# if custom path check there first +if(CLANG_FORMAT_ROOT_DIR) + find_program(CLANG_FORMAT_BIN + NAMES + ${CLANG_FORMAT_BIN_NAME} + PATHS + "${CLANG_FORMAT_ROOT_DIR}" + NO_DEFAULT_PATH) +endif() + +find_program(CLANG_FORMAT_BIN NAMES ${CLANG_FORMAT_BIN_NAME}) + +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS( + CLANG_FORMAT + DEFAULT_MSG + CLANG_FORMAT_BIN) + +mark_as_advanced( + CLANG_FORMAT_BIN) + +if(CLANG_FORMAT_FOUND) + # A CMake script to find all source files and setup clang-format targets for them + include(clang-format) +else() + message("clang-format not found. Not setting up format targets") +endif() diff --git a/cmake/example/04-static-analysis/clang-format/cmake/modules/clang-format.cmake b/cmake/example/04-static-analysis/clang-format/cmake/modules/clang-format.cmake new file mode 100644 index 0000000..39b07ea --- /dev/null +++ b/cmake/example/04-static-analysis/clang-format/cmake/modules/clang-format.cmake @@ -0,0 +1,62 @@ +# A CMake script to find all source files and setup clang-format targets for them + +# Find all source files +set(CLANG_FORMAT_CXX_FILE_EXTENSIONS ${CLANG_FORMAT_CXX_FILE_EXTENSIONS} *.cpp *.h *.cxx *.hxx *.hpp *.cc *.ipp) +file(GLOB_RECURSE ALL_SOURCE_FILES ${CLANG_FORMAT_CXX_FILE_EXTENSIONS}) + +# Don't include some common build folders +set(CLANG_FORMAT_EXCLUDE_PATTERNS ${CLANG_FORMAT_EXCLUDE_PATTERNS} "/CMakeFiles/" "cmake") + +# get all project files file +foreach (SOURCE_FILE ${ALL_SOURCE_FILES}) + foreach (EXCLUDE_PATTERN ${CLANG_FORMAT_EXCLUDE_PATTERNS}) + string(FIND ${SOURCE_FILE} ${EXCLUDE_PATTERN} EXCLUDE_FOUND) + if (NOT ${EXCLUDE_FOUND} EQUAL -1) + list(REMOVE_ITEM ALL_SOURCE_FILES ${SOURCE_FILE}) + endif () + endforeach () +endforeach () + +add_custom_target(format + COMMENT "Running clang-format to change files" + COMMAND ${CLANG_FORMAT_BIN} + -style=file + -i + ${ALL_SOURCE_FILES} +) + + +add_custom_target(format-check + COMMENT "Checking clang-format changes" + # Use ! to negate the result for correct output + COMMAND ! + ${CLANG_FORMAT_BIN} + -style=file + -output-replacements-xml + ${ALL_SOURCE_FILES} + | grep -q "replacement offset" +) + +# Get the path to this file +get_filename_component(_clangcheckpath ${CMAKE_CURRENT_LIST_FILE} PATH) +# have at least one here by default +set(CHANGED_FILE_EXTENSIONS ".cpp") +foreach(EXTENSION ${CLANG_FORMAT_CXX_FILE_EXTENSIONS}) + set(CHANGED_FILE_EXTENSIONS "${CHANGED_FILE_EXTENSIONS},${EXTENSION}" ) +endforeach() + +set(EXCLUDE_PATTERN_ARGS) +foreach(EXCLUDE_PATTERN ${CLANG_FORMAT_EXCLUDE_PATTERNS}) + list(APPEND EXCLUDE_PATTERN_ARGS "--exclude=${EXCLUDE_PATTERN}") +endforeach() + +# call the script to check changed files in git +add_custom_target(format-check-changed + COMMENT "Checking changed files in git" + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + COMMAND ${_clangcheckpath}/../scripts/clang-format-check-changed.py + --file-extensions \"${CHANGED_FILE_EXTENSIONS}\" + ${EXCLUDE_PATTERN_ARGS} + --clang-format-bin ${CLANG_FORMAT_BIN} +) + diff --git a/cmake/example/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed b/cmake/example/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed new file mode 100755 index 0000000..30da46e --- /dev/null +++ b/cmake/example/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed @@ -0,0 +1,18 @@ +#!/bin/bash + +# Required because cmake root isn't git root in this example +CLANG_FORMAT_BIN=$1 +GIT_ROOT=`git rev-parse --show-toplevel` + +pushd ${GIT_ROOT} > /dev/null + +git status --porcelain \ + | egrep '*\.cpp|*\.h|*\.cxx|*\.hxx|*\.hpp|*\.cc' \ + | awk -F " " '{print $NF}' \ + | xargs -r ${CLANG_FORMAT_BIN} -style=file -output-replacements-xml \ + | grep "replacement offset" 2>&1 > /dev/null + +RET=$? +popd > /dev/null + +exit ${RET} diff --git a/cmake/example/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed.py b/cmake/example/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed.py new file mode 100755 index 0000000..3fcbb0c --- /dev/null +++ b/cmake/example/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed.py @@ -0,0 +1,163 @@ +#!/usr/bin/env python + +import argparse +import os +import sys +import subprocess + + +def check_file(filename, excludes, extensions): + """ + Check if a file should be included in our check + """ + name, ext = os.path.splitext(filename) + + if len(ext) > 0 and ext in extensions: + if len(excludes) == 0: + return True + + for exclude in excludes: + if exclude in filename: + return False + + return True + + return False + + +def check_directory(directory, excludes, extensions): + output = [] + + if len(excludes) > 0: + for exclude in excludes: + if exclude in directory: + directory_excluded = False + return output + + for root, _, files in os.walk(directory): + for file in files: + filename = os.path.join(root, file) + if check_file(filename, excludes, extensions): + print("Will check file [{}]".format(filename)) + output.append(filename) + return output + +def get_git_root(git_bin): + cmd = [git_bin, "rev-parse", "--show-toplevel"] + try: + return subprocess.check_output(cmd).strip() + except subprocess.CalledProcessError, e: + print("Error calling git [{}]".format(e)) + raise + +def clean_git_filename(line): + """ + Takes a line from git status --porcelain and returns the filename + """ + file = None + git_status = line[:2] + # Not an exhaustive list of git status output but should + # be enough for this case + # check if this is a delete + if 'D' in git_status: + return None + # ignored file + if '!' in git_status: + return None + # Covers renamed files + if '->' in line: + file = line[3:].split('->')[-1].strip() + else: + file = line[3:].strip() + + return file + + +def get_changed_files(git_bin, excludes, file_extensions): + """ + Run git status and return the list of changed files + """ + extensions = file_extensions.split(",") + # arguments coming from cmake will be *.xx. We want to remove the * + for i, extension in enumerate(extensions): + if extension[0] == '*': + extensions[i] = extension[1:] + + git_root = get_git_root(git_bin) + + cmd = [git_bin, "status", "--porcelain", "--ignore-submodules"] + print("git cmd = {}".format(cmd)) + output = [] + returncode = 0 + try: + cmd_output = subprocess.check_output(cmd) + for line in cmd_output.split('\n'): + if len(line) > 0: + file = clean_git_filename(line) + if not file: + continue + file = os.path.join(git_root, file) + + if file[-1] == "/": + directory_files = check_directory( + file, excludes, file_extensions) + output = output + directory_files + else: + if check_file(file, excludes, file_extensions): + print("Will check file [{}]".format(file)) + output.append(file) + + except subprocess.CalledProcessError, e: + print("Error calling git [{}]".format(e)) + returncode = e.returncode + + return output, returncode + + +def run_clang_format(clang_format_bin, changed_files): + """ + Run clang format on a list of files + @return 0 if formatted correctly. + """ + if len(changed_files) == 0: + return 0 + cmd = [clang_format_bin, "-style=file", + "-output-replacements-xml"] + changed_files + print("clang-format cmd = {}".format(cmd)) + try: + cmd_output = subprocess.check_output(cmd) + if "replacement offset" in cmd_output: + print("ERROR: Changed files don't match format") + return 1 + except subprocess.CalledProcessError, e: + print("Error calling clang-format [{}]".format(e)) + return e.returncode + + return 0 + + +def cli(): + # global params + parser = argparse.ArgumentParser(prog='clang-format-check-changed', + description='Checks if files chagned in git match the .clang-format specification') + parser.add_argument("--file-extensions", type=str, + default=".cpp,.h,.cxx,.hxx,.hpp,.cc,.ipp", + help="Comma separated list of file extensions to check") + parser.add_argument('--exclude', action='append', default=[], + help='Will not match the files / directories with these in the name') + parser.add_argument('--clang-format-bin', type=str, default="clang-format", + help="The clang format binary") + parser.add_argument('--git-bin', type=str, default="git", + help="The git binary") + args = parser.parse_args() + + # Run gcovr to get the .gcda files form .gcno + changed_files, returncode = get_changed_files( + args.git_bin, args.exclude, args.file_extensions) + if returncode != 0: + return returncode + + return run_clang_format(args.clang_format_bin, changed_files) + +if __name__ == '__main__': + sys.exit(cli()) diff --git a/cmake/example/04-static-analysis/clang-format/run_test.sh b/cmake/example/04-static-analysis/clang-format/run_test.sh new file mode 100755 index 0000000..40bd914 --- /dev/null +++ b/cmake/example/04-static-analysis/clang-format/run_test.sh @@ -0,0 +1,11 @@ +#!/bin/bash +mkdir -p build && cd build && cmake .. && make format-check +RET=$? +echo "return code was ${RET}" +if [ ${RET} == "0" ]; then + echo "test failed. Expected format-check to fail" + exit 1 +else + echo "test success" + exit 0 +fi diff --git a/cmake/example/04-static-analysis/clang-format/subproject1/CMakeLists.txt b/cmake/example/04-static-analysis/clang-format/subproject1/CMakeLists.txt new file mode 100644 index 0000000..e846c31 --- /dev/null +++ b/cmake/example/04-static-analysis/clang-format/subproject1/CMakeLists.txt @@ -0,0 +1,5 @@ +# Set the project name +project (subproject1) + +# Add an executable with the above sources +add_executable(${PROJECT_NAME} main1.cpp) diff --git a/cmake/example/04-static-analysis/clang-format/subproject1/main1.cpp b/cmake/example/04-static-analysis/clang-format/subproject1/main1.cpp new file mode 100644 index 0000000..daf763b --- /dev/null +++ b/cmake/example/04-static-analysis/clang-format/subproject1/main1.cpp @@ -0,0 +1,7 @@ +#include + +int main(int argc, char* argv[]) +{ + std::cout << "Hello Main1!" << std::endl; + return 0; +} \ No newline at end of file diff --git a/cmake/example/04-static-analysis/clang-format/subproject2/CMakeLists.txt b/cmake/example/04-static-analysis/clang-format/subproject2/CMakeLists.txt new file mode 100644 index 0000000..0c882a4 --- /dev/null +++ b/cmake/example/04-static-analysis/clang-format/subproject2/CMakeLists.txt @@ -0,0 +1,5 @@ +# Set the project name +project (subproject2) + +# Add an executable with the above sources +add_executable(${PROJECT_NAME} main2.cpp) diff --git a/cmake/example/04-static-analysis/clang-format/subproject2/main2.cpp b/cmake/example/04-static-analysis/clang-format/subproject2/main2.cpp new file mode 100644 index 0000000..4e90e90 --- /dev/null +++ b/cmake/example/04-static-analysis/clang-format/subproject2/main2.cpp @@ -0,0 +1,18 @@ +#include + +class TestClass { +public: + TestClass(); +}; + +TestClass::TestClass() { + +} + +int main(int argc, char* argv[]) +{ + std::cout << "Hello Main2!" << std::endl; + int* x = NULL; + std::cout << *x << std::endl; + return 0; +} diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/.cppcheck_suppressions b/cmake/example/04-static-analysis/cppcheck-compile-commands/.cppcheck_suppressions new file mode 100644 index 0000000..e69de29 diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/CMakeLists.txt b/cmake/example/04-static-analysis/cppcheck-compile-commands/CMakeLists.txt new file mode 100644 index 0000000..f1d572a --- /dev/null +++ b/cmake/example/04-static-analysis/cppcheck-compile-commands/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required (VERSION 3.5) + +project(cppcheck_analysis) + +# Have cmake create a compile database +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) + +# Add a custom CMake Modules directory +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules + ${CMAKE_MODULE_PATH}) + +# find the cppcheck binary +find_package(CppCheck) + +# Add sub directories +add_subdirectory(subproject1) +add_subdirectory(subproject2) diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/README.adoc b/cmake/example/04-static-analysis/cppcheck-compile-commands/README.adoc new file mode 100644 index 0000000..246822c --- /dev/null +++ b/cmake/example/04-static-analysis/cppcheck-compile-commands/README.adoc @@ -0,0 +1,195 @@ += CppCheck Static Analysis using Compile Commands +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +This example shows how to call the +http://cppcheck.sourceforge.net/[CppCheck] tool to do static analysis. +This shows how to use projects and a compile database. +Projects are available from cppcheck v1.77 + +It includes code to + + * Find the cppcheck binary + * Generate an overall `make cppcheck-analysis` target to do static +analysis on all sub-projects. + +The files included in this example are: + +``` +$ tree +. +├── cmake +│   └── modules +│   └── FindCppCheck.cmake +├── CMakeLists.txt +├── subproject1 +│   ├── CMakeLists.txt +│   └── main1.cpp +└── subproject2 + ├── CMakeLists.txt + └── main2.cpp +``` + + * link:CMakeLists.txt[] - Top level CMakeLists.txt + * link:cmake/modules/FindCppCheck.cmake[] - A custom package module to find CppCheck + * link:subproject1/CMakeLists.txt[] - CMake commands for subproject 1 + * link:subproject1/main1.cpp[] - source for a subproject with no errors + * link:subproject2/CMakeLists.txt[] - CMake commands for subproject 2 + * link:subproject2/main2.cpp[] - source for a subproject that includes errors + +# Requirements + +To run this example you must have CppCheck of at least v1.77 installed. This is not +available by default on Ubuntu but can be compiled using the following command. + +[source,bash] +---- +$ wget https://github.com/danmar/cppcheck/archive/1.79.tar.gz \ + && tar xvf 1.79.tar.gz \ + && cd cppcheck-1.79 \ + && mkdir build \ + && cd build \ + && cmake .. \ + && sudo make install +---- + +# Concepts + +## Adding Custom Package Modules + +As with the previous example I use a custom module to find CppCheck. This version is slightly different to the previous one and +will automatically add a `make cppcheck-analysis` target. + +[source,cmake] +---- +if(CPPCHECK_FOUND) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/analysis/cppcheck) + add_custom_target(cppcheck-analysis + COMMAND ${CPPCHECK_COMMAND}) + message("cppcheck found. Use cppccheck-analysis targets to run it") +else() + message("cppcheck not found. No cppccheck-analysis targets") +endif() +---- + +The variables available have also changed. For full details on the commands see the `FindCppCheck.cmake` module. Below are a subset of the available options: + +### Suppressions + +Adding a suppression file called `.cppcheck-suppressions` which must be in your +CMAKE_SOURCE_DIR+ + +### Error Exitcode + +When cppcheck finds an error it can cause it to exit with a specific error. In this +example, by default, it will exit with `1`. To change this you can set the ++CPPCHECK_ERROR_EXITCODE_ARG+ argument when running CMake. + +### Exitcode suppressions + +Sometimes you wish to display an error in the log, but to not have that error cause a failed build. To do this you can create a file `.cppcheck_exitcode_suppressions` and add suppressions to it. This file must be in your +CMAKE_SOURCE_DIR+ + +### CppCheck arguments + +The default enabled checks are `--enabled=warning`. To change this you can override the `CPPCHECK_CHECK_ARGS` variable before calling `find(cppcheck)`. + +### Excluding files / folders + +Many projects include some vendored 3rd party code. To exclude this from you check you can create a list `CPPCHECK_EXCLUDES` before calling the find module. This will add all files and folders in the list into the list of excluded folders. + +### CppCheck build dir + +In this example, we set +CPPCHECK_BUILD_DIR_ARG+, to `${PROJECT_BINARY_DIR}/analysis/cppcheck`. This will output details of the build to this folder and can be used to +increase the speed of rechecks if a file hasn't changed + +## Compile Database + +CMake allows you to export all https://cmake.org/cmake/help/v3.5/variable/CMAKE_EXPORT_COMPILE_COMMANDS.html[compile commands] +that are used to build the project into a file called `compile_commands.json` + +This can be done by setting the +CMAKE_EXPORT_COMPILE_COMMANDS+ variable to +ON+ +as below: + +[source,cmake] +---- +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) +---- + +The JSON file will look like: + +[source,json] +---- +[ + { + "directory": "/home/user/development/project", + "command": "/usr/bin/c++ ... -c ../foo/foo.cc", + "file": "../foo/foo.cc" + }, + + ... + + { + "directory": "/home/user/development/project", + "command": "/usr/bin/c++ ... -c ../foo/bar.cc", + "file": "../foo/bar.cc" + } +] +---- + +[NOTE] +==== +This is only available for the `Makefile` and `ninja` generators. +==== + +## CppCheck Projects + +Starting with CppCheck v1.77, you can pass the `--project` flag pointing to the +compile database. This will cause CppCheck to run on al your cpp files using the same +include directories and compiler flags as your normal build. + +[source,bash] +---- +cppcheck --project=compile_comands.json +---- + +This will check all files in your project and sub-projects. There will be no analysis target per sub-project as with our previous example. + +# Building the example + +[source,bash] +---- +$ mkdir build + +$ cd build/ + +$ cmake .. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Detecting C compile features +-- Detecting C compile features - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Detecting CXX compile features +-- Detecting CXX compile features - done +-- Found CPPCHECK: /usr/local/bin/cppcheck +cppcheck found. Use cppccheck-analysis targets to run it +-- Configuring done +-- Generating done +-- Build files have been written to: /data/code/04-static-analysis/cppcheck-compile-commands/build + +$ make cppcheck-analysis +Scanning dependencies of target cppcheck-analysis +[/data/code/04-static-analysis/cppcheck-compile-commands/subproject2/main2.cpp:7]: (error) Array 'tmp[10]' accessed at index 11, which is out of bounds. +make[3]: *** [CMakeFiles/cppcheck-analysis] Error 1 +make[2]: *** [CMakeFiles/cppcheck-analysis.dir/all] Error 2 +make[1]: *** [CMakeFiles/cppcheck-analysis.dir/rule] Error 2 +make: *** [cppcheck-analysis] Error 2 diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/cmake/modules/FindCppCheck.cmake b/cmake/example/04-static-analysis/cppcheck-compile-commands/cmake/modules/FindCppCheck.cmake new file mode 100644 index 0000000..7d811ef --- /dev/null +++ b/cmake/example/04-static-analysis/cppcheck-compile-commands/cmake/modules/FindCppCheck.cmake @@ -0,0 +1,122 @@ +# Locate cppcheck +# +# This module defines +# CPPCHECK_BIN, where to find cppcheck +# +# To help find the binary you can set CPPCHECK_ROOT_DIR to search a custom path +# Exported argumets include +# CPPCHECK_FOUND, if false, do not try to link to cppcheck --- if (CPPCHECK_FOUND) +# +# CPPCHECK_THREADS_ARG - Number of threads to use (e.g. -j 3) +# CPPCHECK_PROJECT_ARG - The project to use (compile_comands.json) +# CPPCHECK_BUILD_DIR_ARG - The build output directory +# CPPCHECK_ERROR_EXITCODE_ARG - The exit code if an error is found +# CPPCHECK_SUPPRESSIONS - A suppressiosn file to use +# CPPCHECK_CHECKS_ARGS - The checks to run +# CPPCHECK_OTHER_ARGS - Any other arguments +# CPPCHECK_COMMAND - The full command to run the default cppcheck configuration +# CPPCHECK_EXCLUDES - A list of files or folders to exclude from the scan. Must be the full path +# +# if CPPCHECK_XML_OUTPUT is set before calling this. CppCheck will create an xml file with that name +# find the cppcheck binary + +# if custom path check there first +if(CPPCHECK_ROOT_DIR) + find_program(CPPCHECK_BIN + NAMES + cppcheck + PATHS + "${CPPCHECK_ROOT_DIR}" + NO_DEFAULT_PATH) +endif() + +find_program(CPPCHECK_BIN NAMES cppcheck) + +if(CPPCHECK_BIN) + execute_process(COMMAND ${CPPCHECK_BIN} --version + OUTPUT_VARIABLE CPPCHECK_VERSION + ERROR_QUIET + OUTPUT_STRIP_TRAILING_WHITESPACE) + + set(CPPCHECK_THREADS_ARG "-j4" CACHE STRING "The number of threads to use") + set(CPPCHECK_PROJECT_ARG "--project=${PROJECT_BINARY_DIR}/compile_commands.json") + set(CPPCHECK_BUILD_DIR_ARG "--cppcheck-build-dir=${PROJECT_BINARY_DIR}/analysis/cppcheck" CACHE STRING "The build directory to use") + # Don't show these errors + if(EXISTS "${CMAKE_SOURCE_DIR}/.cppcheck_suppressions") + set(CPPCHECK_SUPPRESSIONS "--suppressions-list=${CMAKE_SOURCE_DIR}/.cppcheck_suppressions" CACHE STRING "The suppressions file to use") + else() + set(CPPCHECK_SUPPRESSIONS "" CACHE STRING "The suppressions file to use") + endif() + + # Show these errors but don't fail the build + # These are mainly going to be from the "warning" category that is enabled by default later + if(EXISTS "${CMAKE_SOURCE_DIR}/.cppcheck_exitcode_suppressions") + set(CPPCHECK_EXITCODE_SUPPRESSIONS "--exitcode-suppressions=${CMAKE_SOURCE_DIR}/.cppcheck_exitcode_suppressions" CACHE STRING "The exitcode suppressions file to use") + else() + set(CPPCHECK_EXITCODE_SUPPRESSIONS "" CACHE STRING "The exitcode suppressions file to use") + endif() + + set(CPPCHECK_ERROR_EXITCODE_ARG "--error-exitcode=1" CACHE STRING "The exitcode to use if an error is found") + set(CPPCHECK_CHECKS_ARGS "--enable=warning" CACHE STRING "Arguments for the checks to run") + set(CPPCHECK_OTHER_ARGS "" CACHE STRING "Other arguments") + set(_CPPCHECK_EXCLUDES) + + foreach(ex ${CPPCHECK_EXCLUDES}) + list(APPEND _CPPCHECK_EXCLUDES "-i${ex}") + endforeach(ex) + + set(CPPCHECK_ALL_ARGS + ${CPPCHECK_THREADS_ARG} + ${CPPCHECK_PROJECT_ARG} + ${CPPCHECK_BUILD_DIR_ARG} + ${CPPCHECK_ERROR_EXITCODE_ARG} + ${CPPCHECK_SUPPRESSIONS} + ${CPPCHECK_EXITCODE_SUPPRESSIONS} + ${CPPCHECK_CHECKS_ARGS} + ${CPPCHECK_OTHER_ARGS} + ${_CPPCHECK_EXCLUDES} + ) + + if(NOT CPPCHECK_XML_OUTPUT) + set(CPPCHECK_COMMAND + ${CPPCHECK_BIN} + ${CPPCHECK_ALL_ARGS} + ) + else() + set(CPPCHECK_COMMAND + ${CPPCHECK_BIN} + ${CPPCHECK_ALL_ARGS} + --xml + --xml-version=2 + 2> ${CPPCHECK_XML_OUTPUT}) + endif() + +endif() + + + +# handle the QUIETLY and REQUIRED arguments and set YAMLCPP_FOUND to TRUE if all listed variables are TRUE +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS( + CPPCHECK + DEFAULT_MSG + CPPCHECK_BIN) + +mark_as_advanced( + CPPCHECK_BIN + CPPCHECK_THREADS_ARG + CPPCHECK_PROJECT_ARG + CPPCHECK_BUILD_DIR_ARG + CPPCHECK_ERROR_EXITCODE_ARG + CPPCHECK_SUPPRESSIONS + CPPCHECK_CHECKS_ARGS + CPPCHECK_OTHER_ARGS) + +if(CPPCHECK_FOUND) + file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/analysis/cppcheck) + add_custom_target(cppcheck-analysis + COMMAND ${CPPCHECK_COMMAND}) + message("cppcheck found. Use cppccheck-analysis targets to run it") +else() + message("cppcheck not found. No cppccheck-analysis targets") +endif() diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/run_test.sh b/cmake/example/04-static-analysis/cppcheck-compile-commands/run_test.sh new file mode 100755 index 0000000..58a7e9b --- /dev/null +++ b/cmake/example/04-static-analysis/cppcheck-compile-commands/run_test.sh @@ -0,0 +1,2 @@ +#!/bin/bash +mkdir -p build && cd build && cmake -DCPPCHECK_ERROR_EXITCODE_ARG="" .. && make cppcheck-analysis diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/subproject1/CMakeLists.txt b/cmake/example/04-static-analysis/cppcheck-compile-commands/subproject1/CMakeLists.txt new file mode 100644 index 0000000..e846c31 --- /dev/null +++ b/cmake/example/04-static-analysis/cppcheck-compile-commands/subproject1/CMakeLists.txt @@ -0,0 +1,5 @@ +# Set the project name +project (subproject1) + +# Add an executable with the above sources +add_executable(${PROJECT_NAME} main1.cpp) diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/subproject1/main1.cpp b/cmake/example/04-static-analysis/cppcheck-compile-commands/subproject1/main1.cpp new file mode 100644 index 0000000..98cacb2 --- /dev/null +++ b/cmake/example/04-static-analysis/cppcheck-compile-commands/subproject1/main1.cpp @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + std::cout << "Hello Main1!" << std::endl; + return 0; +} \ No newline at end of file diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/subproject2/CMakeLists.txt b/cmake/example/04-static-analysis/cppcheck-compile-commands/subproject2/CMakeLists.txt new file mode 100644 index 0000000..0c882a4 --- /dev/null +++ b/cmake/example/04-static-analysis/cppcheck-compile-commands/subproject2/CMakeLists.txt @@ -0,0 +1,5 @@ +# Set the project name +project (subproject2) + +# Add an executable with the above sources +add_executable(${PROJECT_NAME} main2.cpp) diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/subproject2/main2.cpp b/cmake/example/04-static-analysis/cppcheck-compile-commands/subproject2/main2.cpp new file mode 100644 index 0000000..63d388a --- /dev/null +++ b/cmake/example/04-static-analysis/cppcheck-compile-commands/subproject2/main2.cpp @@ -0,0 +1,9 @@ +#include + +int main(int argc, char *argv[]) +{ + std::cout << "Hello Main2!" << std::endl; + char tmp[10]; + tmp[11] = 's'; + return 0; +} \ No newline at end of file diff --git a/cmake/example/04-static-analysis/cppcheck/CMakeLists.txt b/cmake/example/04-static-analysis/cppcheck/CMakeLists.txt new file mode 100644 index 0000000..b76205b --- /dev/null +++ b/cmake/example/04-static-analysis/cppcheck/CMakeLists.txt @@ -0,0 +1,26 @@ +cmake_minimum_required (VERSION 3.5) + +project(cppcheck_analysis) + +# Add a custom CMake Modules directory +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules + ${CMAKE_MODULE_PATH}) + +# find the cppcheck binary +find_package(CppCheck) + +# static analysis. Should be before adding subprojects +set (ALL_ANALYSIS_TARGETS) + +# Add sub directories +add_subdirectory(subproject1) +add_subdirectory(subproject2) + + +# Add the "make analysis" target +if( CPPCHECK_FOUND ) + add_custom_target(analysis) + ADD_DEPENDENCIES(analysis ${ALL_ANALYSIS_TARGETS}) + set_target_properties(analysis PROPERTIES EXCLUDE_FROM_ALL TRUE) + message("analysis analysis targets are ${ALL_ANALYSIS_TARGETS}") +endif() diff --git a/cmake/example/04-static-analysis/cppcheck/README.adoc b/cmake/example/04-static-analysis/cppcheck/README.adoc new file mode 100644 index 0000000..2a469db --- /dev/null +++ b/cmake/example/04-static-analysis/cppcheck/README.adoc @@ -0,0 +1,365 @@ += CppCheck Static Analysis +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +This example shows how to call the +http://cppcheck.sourceforge.net/[CppCheck] tool to do static analysis. +This shows how to make an analysis target for each project in your repository. + +It includes code to + + * Find the cppcheck binary + * Add cppcheck with a target for each sub-projects + * Generate an overall `make analysis` target to do static +analysis on all sub-projects. + +The files included in this example are: + +``` +$ tree +. +├── cmake +│   ├── analysis.cmake +│   └── modules +│   └── FindCppCheck.cmake +├── CMakeLists.txt +├── subproject1 +│   ├── CMakeLists.txt +│   └── main1.cpp +└── subproject2 + ├── CMakeLists.txt + └── main2.cpp +``` + + * link:CMakeLists.txt[] - Top level CMakeLists.txt + * link:cmake/analysis.cmake[] - Includes functions to add analysis targets + * link:cmake/modules/FindCppCheck.cmake[] - A custom package module to find CppCheck + * link:subproject1/CMakeLists.txt[] - CMake commands for subproject 1 + * link:subproject1/main.cpp[] - source for a subproject with no errors + * link:subproject2/CMakeLists.txt[] - CMake commands for subproject 2 + * link:subproject2/main2.cpp[] - source for a subproject that includes errors + +# Requirements + +To run this example you must have the CppCheck utility installed. On +Ubuntu you can install it as + +[source,bash] +---- +$ sudo apt-get install cppcheck +---- + +# Concepts + +## Adding Custom Package Modules + +Custom modules can be used to find programs, libraries and header files +to include in your program. + +### Adding a custom module + +The `cmake/modules/FindCppCheck.cmake` file contains the code to initialise a +custom package module. + +The following is a breakdown of the file: + +[source,cmake,numbered] +---- +find_program(CPPCHECK_BIN NAMES cppcheck) +---- + +Search the path for the cppcheck binary. Once found store the result in the ++CPPCHECK_BIN+ variable + +[source,cmake,numbered] +---- +set (CPPCHECK_THREADS "-j 4" CACHE STRING "The -j argument to have cppcheck use multiple threads / cores") + +set (CPPCHECK_ARG "${CPPCHECK_THREADS}" CACHE STRING "The arguments to pass to cppcheck. If set will overwrite CPPCHECK_THREADS") +---- + +Set some custom arguments that can be later passed to cppcheck. + +[source,cmake] +---- +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS( + CPPCHECK + DEFAULT_MSG + CPPCHECK_BIN + CPPCHECK_THREADS + CPPCHECK_ARG) + +mark_as_advanced( + CPPCHECK_BIN + CPPCHECK_THREADS + CPPCHECK_ARG) +---- + +Export the variables so that they can be seen from ccmake / cmake-gui +and set in the cache. By default these will not be visible unless the +view advanced flag is set. + +### Setting path to custom modules + +The default path that CMake will search for modules is `/usr/share/cmake/Modules`. +To include custom modules you must tell CMake where to search for them. +This can be done using the variable +${CMAKE_MODULE_PATH}+ which +contains the paths that CMake will search for modules. + +[source,cmake] +---- +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake/modules + ${CMAKE_MODULE_PATH}) +---- + + +To then add the package module to your CMakeLists.txt you can call + +[source,cmake] +---- +find_package(CppCheck) +---- + +## Parent Scope Variables + +The scope of variables when they are declared / changed is typically in +the function of file the are called. To make a change to a variable +which is the caller of your scope, you should call it as follows: + +[source,cmake] +---- +set(ALL_ANALYSIS_TARGETS "${ALL_ANALYSIS_TARGETS}" PARENT_SCOPE) +---- + +## add_analysis macro + +The +add_analysis()+ macro in `cmake/analysis.cmake` is the core idea for this +example. If cppcheck is available then a list of arguments are compiled +and added to a custom command that calls cppcheck on the sources. These +are then added to a custom target. + +A breakdown of this macro is below: + +[source,cmake] +---- +get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) +foreach(dir ${dirs}) + LIST(APPEND cppcheck_includes "-I${dir}") +endforeach() +---- + +Find the include files from and calls to +include_directories()+ in the +same project. + +[source,cmake] +---- +LIST(APPEND ALL_ANALYSIS_TARGETS "${_target}_analysis") +set(ALL_ANALYSIS_TARGETS "${ALL_ANALYSIS_TARGETS}" PARENT_SCOPE) +---- + +Export the target name into a variable that can later be used to add a +global `make analysis` target. + +[source,cmake] +---- +if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VESION} GREATER 2.7) + separate_arguments(tmp_args UNIX_COMMAND ${CPPCHECK_ARG}) +else () + # cmake 2.6 has different arguments + string(REPLACE " " ";" tmp_args ${CPPCHECK_ARG}) +endif () +---- + +Change the +CPPCHECK_ARG+ so that the can be added to command correctly in +the custom command. + +[source,cmake] +---- +add_custom_target(${_target}_analysis) +set_target_properties(${_target}_analysis PROPERTIES EXCLUDE_FROM_ALL TRUE) +---- + +Add a custom target with a name you have passed in followed by +_analysis. Do not include this in the all target. + +[source,cmake] +---- +add_custom_command(TARGET ${_target}_analysis PRE_BUILD + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMAND ${CPPCHECK_BIN} ${tmp_args} ${cppcheck_includes} ${${_sources}} + DEPENDS ${${_sources}} + COMMENT "Running cppcheck: ${_target}" + VERBATIM) +---- + +Add a custom command which is called from the custom target added above. +This will call cppcheck with any includes, arguments and sources that +you have provided. The sources that are analysed come from a _sources +variable. This should be the name of the variable which holds your list +of source files. + +To call the +add_analysis()+ marco add the following to your projects +CMakeLists.txt file: + +[source,cmake] +---- +include(${CMAKE_SOURCE_DIR}/cmake/analysis.cmake) +add_analysis(${PROJECT_NAME} SOURCES) +---- + +## Creating a target to call other targets + +In the top level CMakeLists.txt a custom target is created, which will call +all other analysis targets. This allows you to call `make analysis` and +scan all sub projects. + +To achieve this 2 things should be added to the top level CMakeLists.txt + +First add an empty variable +ALL_ANALYSIS_TARGETS+ before calling your ++add_subdirectories()+ function. + +[source,cmake] +---- +set (ALL_ANALYSIS_TARGETS) +---- + +Second add the following after your +add_subdirectories()+ call. + +[source,cmake] +---- +if( CPPCHECK_FOUND ) + add_custom_target(analysis) + ADD_DEPENDENCIES(analysis ${ALL_ANALYSIS_TARGETS}) + set_target_properties(analysis PROPERTIES EXCLUDE_FROM_ALL TRUE) + message("analysis analysis targets are ${ALL_ANALYSIS_TARGETS}") +endif() +---- + +This adds the "make analysis" target which calls all the sub-targets. + +# Building the example + +[source,bash] +---- +$ mkdir build + +$ cd build/ + +$ cmake .. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Found CPPCHECK: /usr/bin/cppcheck +adding cppcheck analysys target for subproject1 +adding cppcheck analysys target for subproject2 +analysis analysis targets are subproject1_analysis;subproject2_analysis +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/04-static-analysis/cppcheck/build + +$ make analysis +Scanning dependencies of target subproject1_analysis +Running cppcheck: subproject1 +Checking main1.cpp... +Built target subproject1_analysis +Scanning dependencies of target subproject2_analysis +Running cppcheck: subproject2 +Checking main2.cpp... +[main2.cpp:7]: (error) Array 'tmp[10]' accessed at index 11, which is out of bounds. +Built target subproject2_analysis +Scanning dependencies of target analysis +Built target analysis +---- + +The above calls cppcheck in both subproject folders as + +[source,bash] +---- +... +cd /path/to/subproject1 && /usr/bin/cppcheck -j 4 main1.cpp +... +cd /path/to/subproject2 && /usr/bin/cppcheck -j 4 main2.cpp +... +---- + +The main1.cpp has no errors so will complete correctly, however the +main2.cpp includes an out-of-bounds error. This is show with a warning as + +------------------------------------------------------------------------------------ +[main2.cpp:7]: (error) Array 'tmp[10]' accessed at index 11, which is out of bounds. +------------------------------------------------------------------------------------ + +By default cppcheck only prints warnings and exits with a successful +exit code. If the +${CPPCHECK_ARG}+ variable is set with +`--error-exitcode=1`, the make analysis will finish early as follows. + +[source,bash] +---- +$ make analysis +Running cppcheck: subproject2 +Checking main2.cpp... +[main2.cpp:7]: (error) Array 'tmp[10]' accessed at index 11, which is out of bounds. +make[3]: *** [subproject2_analysis] Error 1 +make[2]: *** [subproject2/CMakeFiles/subproject2_analysis.dir/all] Error 2 +make[1]: *** [CMakeFiles/analysis.dir/rule] Error 2 +make: *** [analysis] Error 2 +---- + +# Extra Notes + +## Multiple Folders + +If you have a multiple folders levels, where one folder just points to +sub folders, such as below: + +------------------------------ +├── root +│   ├── CMakeLists.txt +│   ├── src +│   │   ├── CMakeLists.txt +│   │   ├── project1 +│   │   │   ├── CMakeLists.txt +│   │   │   ├── main.cpp +│   │   ├── project2 +│   │   │   ├── CMakeLists.txt +│   │   │   ├── main.cpp +------------------------------ + +To correctly generate the root `make analysis` target you must export the +ALL_ANALYSIS_TARGET+ +variable to the parent scope in `src/CMakeLists.txt`. + +[source,cmake] +---- +add_subdirectory(project1) +add_subdirectory(project2) +set(ALL_ANALYSIS_TARGETS "${ALL_ANALYSIS_TARGETS}" PARENT_SCOPE) +---- + +## Include Directories + +In the +add_analysis+ macro in `analysis.cmake` we extract the +INCLUDE_DIRECTORIES+ from the +target and add them to the call to cppcheck. + +[source,cmake] +---- + get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) + foreach(dir ${dirs}) + LIST(APPEND cppcheck_includes "-I${dir}") + endforeach() +---- + +This works for basic examples but if you use some CMake features such as +generator expressions this will not add the include directory. + diff --git a/cmake/example/04-static-analysis/cppcheck/cmake/analysis.cmake b/cmake/example/04-static-analysis/cppcheck/cmake/analysis.cmake new file mode 100644 index 0000000..5c3028d --- /dev/null +++ b/cmake/example/04-static-analysis/cppcheck/cmake/analysis.cmake @@ -0,0 +1,50 @@ +# Make sure cppcheck binary is available +if( NOT CPPCHECK_FOUND ) + find_package(CppCheck) +endif() + +# add a target for CppCheck +# _target - The name of the project that this is for. Will generate ${_target}_analysis +# _sources - The name of the variable holding the sources list. +# This is the name of the variable not the actual list +# +# Macro instead of function to make the PARENT_SCOPE stuff easier +macro(add_analysis _target _sources) + if( CPPCHECK_FOUND ) + + # Get the include files to also feed to cppcheck + get_property(dirs DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY INCLUDE_DIRECTORIES) + foreach(dir ${dirs}) + LIST(APPEND cppcheck_includes "-I${dir}") + endforeach() + + # Add to the all target to have a high level "make analysis" + LIST(APPEND ALL_ANALYSIS_TARGETS "${_target}_analysis") + set(ALL_ANALYSIS_TARGETS "${ALL_ANALYSIS_TARGETS}" PARENT_SCOPE) + + # This is used to make the command run correctly on the command line. + # The COMMAND argument expects a list and this does the change + # I need to check which version works with 2.7 + if (${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VESION} GREATER 2.7) + separate_arguments(tmp_args UNIX_COMMAND ${CPPCHECK_ARG}) + else () + # cmake 2.6 has different arguments + string(REPLACE " " ";" tmp_args ${CPPCHECK_ARG}) + endif () + + # add a custom _target_analysis target + add_custom_target(${_target}_analysis) + set_target_properties(${_target}_analysis PROPERTIES EXCLUDE_FROM_ALL TRUE) + + # add the cppcheck command to the target + add_custom_command(TARGET ${_target}_analysis PRE_BUILD + WORKING_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}" + COMMAND ${CPPCHECK_BIN} ${tmp_args} ${cppcheck_includes} ${${_sources}} + DEPENDS ${${_sources}} + COMMENT "Running cppcheck: ${_target}" + VERBATIM) + message("adding cppcheck analysys target for ${_target}") + endif() + +endmacro() + diff --git a/cmake/example/04-static-analysis/cppcheck/cmake/modules/FindCppCheck.cmake b/cmake/example/04-static-analysis/cppcheck/cmake/modules/FindCppCheck.cmake new file mode 100644 index 0000000..095797e --- /dev/null +++ b/cmake/example/04-static-analysis/cppcheck/cmake/modules/FindCppCheck.cmake @@ -0,0 +1,37 @@ +# Locate cppcheck +# +# This module defines +# CPPCHECK_FOUND, if false, do not try to link to cppcheck --- if (CPPCHECK_FOUND) +# CPPCHECK_BIN, where to find cppcheck +# +# Exported argumets include +# CPPCHECK_THREADS +# CPPCHECK_ARG +# +# find the cppcheck binary +find_program(CPPCHECK_BIN NAMES cppcheck) + +# +# Arguments are +# -j use multiple threads (and thread count) +# --quite only show errors / warnings etc +# --error-exitcode The code to exit with if an error shows up +# --enabled Comma separated list of the check types. Can include warning,performance,style +# Note nightly build on earth changes error-exitcode to 0 +set (CPPCHECK_THREADS "-j 4" CACHE STRING "The -j argument to have cppcheck use multiple threads / cores") + +set (CPPCHECK_ARG "${CPPCHECK_THREADS}" CACHE STRING "The arguments to pass to cppcheck. If set will overwrite CPPCHECK_THREADS") + +# handle the QUIETLY and REQUIRED arguments and set YAMLCPP_FOUND to TRUE if all listed variables are TRUE +include(FindPackageHandleStandardArgs) +FIND_PACKAGE_HANDLE_STANDARD_ARGS( + CPPCHECK + DEFAULT_MSG + CPPCHECK_BIN + CPPCHECK_THREADS + CPPCHECK_ARG) + +mark_as_advanced( + CPPCHECK_BIN + CPPCHECK_THREADS + CPPCHECK_ARG) diff --git a/cmake/example/04-static-analysis/cppcheck/run_test.sh b/cmake/example/04-static-analysis/cppcheck/run_test.sh new file mode 100755 index 0000000..171c145 --- /dev/null +++ b/cmake/example/04-static-analysis/cppcheck/run_test.sh @@ -0,0 +1,2 @@ +#!/bin/bash +mkdir -p build && cd build && cmake .. && make analysis diff --git a/cmake/example/04-static-analysis/cppcheck/subproject1/CMakeLists.txt b/cmake/example/04-static-analysis/cppcheck/subproject1/CMakeLists.txt new file mode 100644 index 0000000..3de3659 --- /dev/null +++ b/cmake/example/04-static-analysis/cppcheck/subproject1/CMakeLists.txt @@ -0,0 +1,14 @@ +# Set the project name +project (subproject1) + +# Create a sources variable with a link to all cpp files to compile +set(SOURCES + main1.cpp +) + +# include the file with the function then call the macro +include(${CMAKE_SOURCE_DIR}/cmake/analysis.cmake) +add_analysis(${PROJECT_NAME} SOURCES) + +# Add an executable with the above sources +add_executable(${PROJECT_NAME} ${SOURCES}) \ No newline at end of file diff --git a/cmake/example/04-static-analysis/cppcheck/subproject1/main1.cpp b/cmake/example/04-static-analysis/cppcheck/subproject1/main1.cpp new file mode 100644 index 0000000..98cacb2 --- /dev/null +++ b/cmake/example/04-static-analysis/cppcheck/subproject1/main1.cpp @@ -0,0 +1,7 @@ +#include + +int main(int argc, char *argv[]) +{ + std::cout << "Hello Main1!" << std::endl; + return 0; +} \ No newline at end of file diff --git a/cmake/example/04-static-analysis/cppcheck/subproject2/CMakeLists.txt b/cmake/example/04-static-analysis/cppcheck/subproject2/CMakeLists.txt new file mode 100644 index 0000000..d6e724f --- /dev/null +++ b/cmake/example/04-static-analysis/cppcheck/subproject2/CMakeLists.txt @@ -0,0 +1,14 @@ +# Set the project name +project (subproject2) + +# Create a sources variable with a link to all cpp files to compile +set(SOURCES + main2.cpp +) + +# include the file with the function then call the macro +include(${CMAKE_SOURCE_DIR}/cmake/analysis.cmake) +add_analysis(${PROJECT_NAME} SOURCES) + +# Add an executable with the above sources +add_executable(${PROJECT_NAME} ${SOURCES}) \ No newline at end of file diff --git a/cmake/example/04-static-analysis/cppcheck/subproject2/main2.cpp b/cmake/example/04-static-analysis/cppcheck/subproject2/main2.cpp new file mode 100644 index 0000000..63d388a --- /dev/null +++ b/cmake/example/04-static-analysis/cppcheck/subproject2/main2.cpp @@ -0,0 +1,9 @@ +#include + +int main(int argc, char *argv[]) +{ + std::cout << "Hello Main2!" << std::endl; + char tmp[10]; + tmp[11] = 's'; + return 0; +} \ No newline at end of file diff --git a/cmake/example/05-unit-testing/README.adoc b/cmake/example/05-unit-testing/README.adoc new file mode 100644 index 0000000..6312bdb --- /dev/null +++ b/cmake/example/05-unit-testing/README.adoc @@ -0,0 +1,28 @@ += Unit Testing + +:toc: +:toc-placement!: + +toc::[] + +[[intro]] +Introduction +------------ + +Unit testing is a software development process in which the smallest testable parts of an +application, called units, are individually and independently scrutinized +for proper operation. This can involve taking a class, function, or algorithm +and writing test cases that can be run to verify that the unit is working correctly. + +CMake includes a tool called link:https://cmake.org/Wiki/CMake/Testing_With_CTest[CTest] +which allows you to enable the `make test` target to run automated tests such as unit tests. + +There are many unit-testing frameworks available which can be used to help automate +and ease the development of unit tests. In these examples I show how to use +some of these frameworks and call them using the CMake testing utility CTest. + +The examples here include using the following frameworks: + +* http://www.boost.org/doc/libs/1_56_0/libs/test/doc/html/utf/user-guide.html[Boost Unit Test Framework] +* https://github.com/google/googletest[Google Test - Download] +* https://github.com/catchorg/Catch2[Catch2] diff --git a/cmake/example/05-unit-testing/boost/CMakeLists.txt b/cmake/example/05-unit-testing/boost/CMakeLists.txt new file mode 100644 index 0000000..58c1b66 --- /dev/null +++ b/cmake/example/05-unit-testing/boost/CMakeLists.txt @@ -0,0 +1,45 @@ +cmake_minimum_required(VERSION 3.5) + +# Set the project name +project (boost_unit_test) + + +# find a boost install with the libraries unit_test_framework +find_package(Boost 1.46.1 REQUIRED COMPONENTS unit_test_framework) + +# Add an library for the example classes +add_library(example_boost_unit_test + Reverse.cpp + Palindrome.cpp +) + +target_include_directories(example_boost_unit_test + PUBLIC + ${CMAKE_CURRENT_SOURCE_DIR} +) + +target_link_libraries(example_boost_unit_test + PUBLIC + Boost::boost +) + +############################################# +# Unit tests + +# enable CTest testing +enable_testing() + +# Add a testing executable +add_executable(unit_tests unit_tests.cpp) + +target_link_libraries(unit_tests + example_boost_unit_test + Boost::unit_test_framework +) + +target_compile_definitions(unit_tests + PRIVATE + BOOST_TEST_DYN_LINK +) + +add_test(test_all unit_tests) diff --git a/cmake/example/05-unit-testing/boost/Palindrome.cpp b/cmake/example/05-unit-testing/boost/Palindrome.cpp new file mode 100644 index 0000000..7276aec --- /dev/null +++ b/cmake/example/05-unit-testing/boost/Palindrome.cpp @@ -0,0 +1,11 @@ +#include "Palindrome.h" + +bool Palindrome::isPalindrome(const std::string& toCheck) +{ + + if (toCheck == std::string(toCheck.rbegin(), toCheck.rend())) { + return true; + } + + return false; +} diff --git a/cmake/example/05-unit-testing/boost/Palindrome.h b/cmake/example/05-unit-testing/boost/Palindrome.h new file mode 100644 index 0000000..3990017 --- /dev/null +++ b/cmake/example/05-unit-testing/boost/Palindrome.h @@ -0,0 +1,15 @@ +#ifndef __PALINDROME_H__ +#define __PALINDROME_H__ + +#include + +/** + * Trivial class to check if a string is a palindrome. + */ +class Palindrome +{ +public: + bool isPalindrome(const std::string& toCheck); +}; + +#endif diff --git a/cmake/example/05-unit-testing/boost/README.adoc b/cmake/example/05-unit-testing/boost/README.adoc new file mode 100644 index 0000000..c9d77fc --- /dev/null +++ b/cmake/example/05-unit-testing/boost/README.adoc @@ -0,0 +1,155 @@ += Boost Unit Testing Framework +:toc: +:toc-placement!: + +toc::[] + + +# Introduction + +Using link:https://cmake.org/Wiki/CMake/Testing_With_CTest[CTest] you can generate +a `make test` target to run automated unit-tests. This example shows how to +find the link:http://www.boost.org/doc/libs/1_56_0/libs/test/doc/html/utf/user-guide.html[boost unit-test-framework], +create tests and run them. + +The files in this tutorial are below: + +``` +$ tree +. +├── CMakeLists.txt +├── Reverse.h +├── Reverse.cpp +├── Palindrome.h +├── Palindrome.cpp +├── unit_tests.cpp +``` + + * link:CMakeLists.txt[] - Contains the CMake commands you wish to run + * link:Reverse.h[] / link:Reverse.cpp[.cpp] - Class to reverse a string + * link:Palindrome.h[] / link:Palindrome.cpp[.cpp] - Class to test if a string is a palindrome + * link:unit_test.cpp[] - Unit Tests using boost unit test framework + +# Requirements + +This example requires the boost libraries to be installed in a default system +location. The library in use is the boost unit-test-framework. + +# Concepts + +## Enabling testing + +To enable testing you must include the following line in your top level CMakeLists.txt + +[source,cmake] +---- +enable_testing() +---- + +This will enable testing for the current folder and all folders below it. + +## Adding a testing executable + +The requirement for this step will depend on your unit-test framework. In the example +of boost, you can create binary(s) which includes all the unit tests that you want to run. + +[source,cmake] +---- +add_executable(unit_tests unit_tests.cpp) + +target_link_libraries(unit_tests + example_boost_unit_test + Boost::unit_test_framework +) + +target_compile_definitions(unit_tests + PRIVATE + BOOST_TEST_DYN_LINK +) +---- + +In the above code, a unit test binary is added, which links against the boost unit-test-framework +and includes a definition to tell it that we are using dynamic linking. + +## Add A test + +To add a test you call the link:https://cmake.org/cmake/help/v3.0/command/add_test.html[`add_test()`] function. +This will create a named test which will run the supplied command. + +[source,cmake] +---- +add_test(test_all unit_tests) +---- + +In this example, we create a test called `test_all` which will run the executable +created by the `unit_tests` executable created from the call to `add_executable` + +# Building the Example + +[source,bash] +---- +$ mkdir build + +$ cd build/ + +$ cmake .. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Boost version: 1.54.0 +-- Found the following Boost libraries: +-- unit_test_framework +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/05-unit-testing/boost/build + +$ make +Scanning dependencies of target example_boost_unit_test +[ 33%] Building CXX object CMakeFiles/example_boost_unit_test.dir/Reverse.cpp.o +[ 66%] Building CXX object CMakeFiles/example_boost_unit_test.dir/Palindrome.cpp.o +Linking CXX static library libexample_boost_unit_test.a +[ 66%] Built target example_boost_unit_test +Scanning dependencies of target unit_tests +[100%] Building CXX object CMakeFiles/unit_tests.dir/unit_tests.cpp.o +Linking CXX executable unit_tests +[100%] Built target unit_tests + +$ make test +Running tests... +Test project /home/matrim/workspace/cmake-examples/05-unit-testing/boost/build + Start 1: test_all +1/1 Test #1: test_all ......................... Passed 0.00 sec + +100% tests passed, 0 tests failed out of 1 + +Total Test time (real) = 0.01 sec +---- + +If the code is changed and it causes the unit tests to produce an error. +Then when running the tests you will see the following output. + +[source,bash] +---- +$ make test +Running tests... +Test project /home/matrim/workspace/cmake-examples/05-unit-testing/boost/build + Start 1: test_all +1/1 Test #1: test_all .........................***Failed 0.00 sec + +0% tests passed, 1 tests failed out of 1 + +Total Test time (real) = 0.00 sec + +The following tests FAILED: + 1 - test_all (Failed) +Errors while running CTest +make: *** [test] Error 8 + +---- diff --git a/cmake/example/05-unit-testing/boost/Reverse.cpp b/cmake/example/05-unit-testing/boost/Reverse.cpp new file mode 100644 index 0000000..135757a --- /dev/null +++ b/cmake/example/05-unit-testing/boost/Reverse.cpp @@ -0,0 +1,12 @@ +#include "Reverse.h" + +std::string Reverse::reverse(std::string& toReverse) +{ + std::string ret; + + for(std::string::reverse_iterator rit=toReverse.rbegin(); rit!=toReverse.rend(); ++rit) + { + ret.insert(ret.end(), *rit); + } + return ret; +} diff --git a/cmake/example/05-unit-testing/boost/Reverse.h b/cmake/example/05-unit-testing/boost/Reverse.h new file mode 100644 index 0000000..b06d5f2 --- /dev/null +++ b/cmake/example/05-unit-testing/boost/Reverse.h @@ -0,0 +1,15 @@ +#ifndef __REVERSE_H__ +#define __REVERSE_H__ + +#include + +/** + * Trivial class whose only function is to reverse a string. + * Should use std::reverse instead but want to have example with own class + */ +class Reverse +{ +public: + std::string reverse(std::string& toReverse); +}; +#endif diff --git a/cmake/example/05-unit-testing/boost/main.cpp b/cmake/example/05-unit-testing/boost/main.cpp new file mode 100644 index 0000000..c7b58af --- /dev/null +++ b/cmake/example/05-unit-testing/boost/main.cpp @@ -0,0 +1,24 @@ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + std::cout << "Hello Third Party Include!" << std::endl; + + // use a shared ptr + boost::shared_ptr isp(new int(4)); + + // trivial use of boost filesystem + boost::filesystem::path path = "/usr/share/cmake/modules"; + if(path.is_relative()) + { + std::cout << "Path is relative" << std::endl; + } + else + { + std::cout << "Path is not relative" << std::endl; + } + + return 0; +} diff --git a/cmake/example/05-unit-testing/boost/post_test.sh b/cmake/example/05-unit-testing/boost/post_test.sh new file mode 100755 index 0000000..982663b --- /dev/null +++ b/cmake/example/05-unit-testing/boost/post_test.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +make test diff --git a/cmake/example/05-unit-testing/boost/unit_tests.cpp b/cmake/example/05-unit-testing/boost/unit_tests.cpp new file mode 100644 index 0000000..a5669b1 --- /dev/null +++ b/cmake/example/05-unit-testing/boost/unit_tests.cpp @@ -0,0 +1,46 @@ +#include +#include "Reverse.h" +#include "Palindrome.h" + +#define BOOST_TEST_MODULE VsidCommonTest +#include + +BOOST_AUTO_TEST_SUITE( reverse_tests ) + +BOOST_AUTO_TEST_CASE( simple ) +{ + std::string toRev = "Hello"; + + Reverse rev; + std::string res = rev.reverse(toRev); + + BOOST_CHECK_EQUAL( res, "olleH" ); + +} + + +BOOST_AUTO_TEST_CASE( empty ) +{ + std::string toRev; + + Reverse rev; + std::string res = rev.reverse(toRev); + + BOOST_CHECK_EQUAL( res, "" ); +} + +BOOST_AUTO_TEST_SUITE_END() + + +BOOST_AUTO_TEST_SUITE( palindrome_tests ) + +BOOST_AUTO_TEST_CASE( is_palindrome ) +{ + std::string pal = "mom"; + Palindrome pally; + + BOOST_CHECK_EQUAL( pally.isPalindrome(pal), true ); + +} + +BOOST_AUTO_TEST_SUITE_END() diff --git a/cmake/example/05-unit-testing/catch2-vendored/3rd_party/catch2/CMakeLists.txt b/cmake/example/05-unit-testing/catch2-vendored/3rd_party/catch2/CMakeLists.txt new file mode 100644 index 0000000..5761d99 --- /dev/null +++ b/cmake/example/05-unit-testing/catch2-vendored/3rd_party/catch2/CMakeLists.txt @@ -0,0 +1,8 @@ +cmake_minimum_required(VERSION 3.0) + +project(catch2) + +# Prepare "Catch2" library for other executables +add_library(Catch2 INTERFACE) +add_library(Catch2::Test ALIAS Catch2) +target_include_directories(Catch2 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/cmake/example/05-unit-testing/catch2-vendored/3rd_party/catch2/catch2/catch.hpp b/cmake/example/05-unit-testing/catch2-vendored/3rd_party/catch2/catch2/catch.hpp new file mode 100644 index 0000000..274eaba --- /dev/null +++ b/cmake/example/05-unit-testing/catch2-vendored/3rd_party/catch2/catch2/catch.hpp @@ -0,0 +1,14362 @@ +/* + * Catch v2.5.0 + * Generated: 2018-11-26 20:46:12.165372 + * ---------------------------------------------------------- + * This file has been merged from multiple headers. Please don't edit it directly + * Copyright (c) 2018 Two Blue Cubes Ltd. All rights reserved. + * + * Distributed under the Boost Software License, Version 1.0. (See accompanying + * file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) + */ +#ifndef TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED +#define TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED +// start catch.hpp + + +#define CATCH_VERSION_MAJOR 2 +#define CATCH_VERSION_MINOR 5 +#define CATCH_VERSION_PATCH 0 + +#ifdef __clang__ +# pragma clang system_header +#elif defined __GNUC__ +# pragma GCC system_header +#endif + +// start catch_suppress_warnings.h + +#ifdef __clang__ +# ifdef __ICC // icpc defines the __clang__ macro +# pragma warning(push) +# pragma warning(disable: 161 1682) +# else // __ICC +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wpadded" +# pragma clang diagnostic ignored "-Wswitch-enum" +# pragma clang diagnostic ignored "-Wcovered-switch-default" +# endif +#elif defined __GNUC__ + // GCC likes to warn on REQUIREs, and we cannot suppress them + // locally because g++'s support for _Pragma is lacking in older, + // still supported, versions +# pragma GCC diagnostic ignored "-Wparentheses" +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wunused-variable" +# pragma GCC diagnostic ignored "-Wpadded" +#endif +// end catch_suppress_warnings.h +#if defined(CATCH_CONFIG_MAIN) || defined(CATCH_CONFIG_RUNNER) +# define CATCH_IMPL +# define CATCH_CONFIG_ALL_PARTS +#endif + +// In the impl file, we want to have access to all parts of the headers +// Can also be used to sanely support PCHs +#if defined(CATCH_CONFIG_ALL_PARTS) +# define CATCH_CONFIG_EXTERNAL_INTERFACES +# if defined(CATCH_CONFIG_DISABLE_MATCHERS) +# undef CATCH_CONFIG_DISABLE_MATCHERS +# endif +# if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) +# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER +# endif +#endif + +#if !defined(CATCH_CONFIG_IMPL_ONLY) +// start catch_platform.h + +#ifdef __APPLE__ +# include +# if TARGET_OS_OSX == 1 +# define CATCH_PLATFORM_MAC +# elif TARGET_OS_IPHONE == 1 +# define CATCH_PLATFORM_IPHONE +# endif + +#elif defined(linux) || defined(__linux) || defined(__linux__) +# define CATCH_PLATFORM_LINUX + +#elif defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) || defined(__MINGW32__) +# define CATCH_PLATFORM_WINDOWS +#endif + +// end catch_platform.h + +#ifdef CATCH_IMPL +# ifndef CLARA_CONFIG_MAIN +# define CLARA_CONFIG_MAIN_NOT_DEFINED +# define CLARA_CONFIG_MAIN +# endif +#endif + +// start catch_user_interfaces.h + +namespace Catch { + unsigned int rngSeed(); +} + +// end catch_user_interfaces.h +// start catch_tag_alias_autoregistrar.h + +// start catch_common.h + +// start catch_compiler_capabilities.h + +// Detect a number of compiler features - by compiler +// The following features are defined: +// +// CATCH_CONFIG_COUNTER : is the __COUNTER__ macro supported? +// CATCH_CONFIG_WINDOWS_SEH : is Windows SEH supported? +// CATCH_CONFIG_POSIX_SIGNALS : are POSIX signals supported? +// CATCH_CONFIG_DISABLE_EXCEPTIONS : Are exceptions enabled? +// **************** +// Note to maintainers: if new toggles are added please document them +// in configuration.md, too +// **************** + +// In general each macro has a _NO_ form +// (e.g. CATCH_CONFIG_NO_POSIX_SIGNALS) which disables the feature. +// Many features, at point of detection, define an _INTERNAL_ macro, so they +// can be combined, en-mass, with the _NO_ forms later. + +#ifdef __cplusplus + +# if (__cplusplus >= 201402L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201402L) +# define CATCH_CPP14_OR_GREATER +# endif + +# if (__cplusplus >= 201703L) || (defined(_MSVC_LANG) && _MSVC_LANG >= 201703L) +# define CATCH_CPP17_OR_GREATER +# endif + +#endif + +#if defined(CATCH_CPP17_OR_GREATER) +# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS +#endif + +#ifdef __clang__ + +# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + _Pragma( "clang diagnostic push" ) \ + _Pragma( "clang diagnostic ignored \"-Wexit-time-destructors\"" ) \ + _Pragma( "clang diagnostic ignored \"-Wglobal-constructors\"") +# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + _Pragma( "clang diagnostic pop" ) + +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + _Pragma( "clang diagnostic push" ) \ + _Pragma( "clang diagnostic ignored \"-Wparentheses\"" ) +# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ + _Pragma( "clang diagnostic pop" ) + +# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ + _Pragma( "clang diagnostic push" ) \ + _Pragma( "clang diagnostic ignored \"-Wunused-variable\"" ) +# define CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS \ + _Pragma( "clang diagnostic pop" ) + +#endif // __clang__ + +//////////////////////////////////////////////////////////////////////////////// +// Assume that non-Windows platforms support posix signals by default +#if !defined(CATCH_PLATFORM_WINDOWS) + #define CATCH_INTERNAL_CONFIG_POSIX_SIGNALS +#endif + +//////////////////////////////////////////////////////////////////////////////// +// We know some environments not to support full POSIX signals +#if defined(__CYGWIN__) || defined(__QNX__) || defined(__EMSCRIPTEN__) || defined(__DJGPP__) + #define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +#endif + +#ifdef __OS400__ +# define CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS +# define CATCH_CONFIG_COLOUR_NONE +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Android somehow still does not support std::to_string +#if defined(__ANDROID__) +# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Not all Windows environments support SEH properly +#if defined(__MINGW32__) +# define CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH +#endif + +//////////////////////////////////////////////////////////////////////////////// +// PS4 +#if defined(__ORBIS__) +# define CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Cygwin +#ifdef __CYGWIN__ + +// Required for some versions of Cygwin to declare gettimeofday +// see: http://stackoverflow.com/questions/36901803/gettimeofday-not-declared-in-this-scope-cygwin +# define _BSD_SOURCE +// some versions of cygwin (most) do not support std::to_string. Use the libstd check. +// https://gcc.gnu.org/onlinedocs/gcc-4.8.2/libstdc++/api/a01053_source.html line 2812-2813 +# if !((__cplusplus >= 201103L) && defined(_GLIBCXX_USE_C99) \ + && !defined(_GLIBCXX_HAVE_BROKEN_VSWPRINTF)) + +# define CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING + +# endif +#endif // __CYGWIN__ + +//////////////////////////////////////////////////////////////////////////////// +// Visual C++ +#ifdef _MSC_VER + +# if _MSC_VER >= 1900 // Visual Studio 2015 or newer +# define CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS +# endif + +// Universal Windows platform does not support SEH +// Or console colours (or console at all...) +# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY == WINAPI_FAMILY_APP) +# define CATCH_CONFIG_COLOUR_NONE +# else +# define CATCH_INTERNAL_CONFIG_WINDOWS_SEH +# endif + +// MSVC traditional preprocessor needs some workaround for __VA_ARGS__ +// _MSVC_TRADITIONAL == 0 means new conformant preprocessor +// _MSVC_TRADITIONAL == 1 means old traditional non-conformant preprocessor +# if !defined(_MSVC_TRADITIONAL) || (defined(_MSVC_TRADITIONAL) && _MSVC_TRADITIONAL) +# define CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +# endif + +#endif // _MSC_VER + +//////////////////////////////////////////////////////////////////////////////// +// Check if we are compiled with -fno-exceptions or equivalent +#if defined(__EXCEPTIONS) || defined(__cpp_exceptions) || defined(_CPPUNWIND) +# define CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED +#endif + +//////////////////////////////////////////////////////////////////////////////// +// DJGPP +#ifdef __DJGPP__ +# define CATCH_INTERNAL_CONFIG_NO_WCHAR +#endif // __DJGPP__ + +//////////////////////////////////////////////////////////////////////////////// +// Embarcadero C++Build +#if defined(__BORLANDC__) + #define CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN +#endif + +//////////////////////////////////////////////////////////////////////////////// + +// Use of __COUNTER__ is suppressed during code analysis in +// CLion/AppCode 2017.2.x and former, because __COUNTER__ is not properly +// handled by it. +// Otherwise all supported compilers support COUNTER macro, +// but user still might want to turn it off +#if ( !defined(__JETBRAINS_IDE__) || __JETBRAINS_IDE__ >= 20170300L ) + #define CATCH_INTERNAL_CONFIG_COUNTER +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Check if string_view is available and usable +// The check is split apart to work around v140 (VS2015) preprocessor issue... +#if defined(__has_include) +#if __has_include() && defined(CATCH_CPP17_OR_GREATER) +# define CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW +#endif +#endif + +//////////////////////////////////////////////////////////////////////////////// +// Check if variant is available and usable +#if defined(__has_include) +# if __has_include() && defined(CATCH_CPP17_OR_GREATER) +# if defined(__clang__) && (__clang_major__ < 8) + // work around clang bug with libstdc++ https://bugs.llvm.org/show_bug.cgi?id=31852 + // fix should be in clang 8, workaround in libstdc++ 8.2 +# include +# if defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) +# define CATCH_CONFIG_NO_CPP17_VARIANT +# else +# define CATCH_INTERNAL_CONFIG_CPP17_VARIANT +# endif // defined(__GLIBCXX__) && defined(_GLIBCXX_RELEASE) && (_GLIBCXX_RELEASE < 9) +# endif // defined(__clang__) && (__clang_major__ < 8) +# endif // __has_include() && defined(CATCH_CPP17_OR_GREATER) +#endif // __has_include + +#if defined(CATCH_INTERNAL_CONFIG_COUNTER) && !defined(CATCH_CONFIG_NO_COUNTER) && !defined(CATCH_CONFIG_COUNTER) +# define CATCH_CONFIG_COUNTER +#endif +#if defined(CATCH_INTERNAL_CONFIG_WINDOWS_SEH) && !defined(CATCH_CONFIG_NO_WINDOWS_SEH) && !defined(CATCH_CONFIG_WINDOWS_SEH) && !defined(CATCH_INTERNAL_CONFIG_NO_WINDOWS_SEH) +# define CATCH_CONFIG_WINDOWS_SEH +#endif +// This is set by default, because we assume that unix compilers are posix-signal-compatible by default. +#if defined(CATCH_INTERNAL_CONFIG_POSIX_SIGNALS) && !defined(CATCH_INTERNAL_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_NO_POSIX_SIGNALS) && !defined(CATCH_CONFIG_POSIX_SIGNALS) +# define CATCH_CONFIG_POSIX_SIGNALS +#endif +// This is set by default, because we assume that compilers with no wchar_t support are just rare exceptions. +#if !defined(CATCH_INTERNAL_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_NO_WCHAR) && !defined(CATCH_CONFIG_WCHAR) +# define CATCH_CONFIG_WCHAR +#endif + +#if !defined(CATCH_INTERNAL_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_NO_CPP11_TO_STRING) && !defined(CATCH_CONFIG_CPP11_TO_STRING) +# define CATCH_CONFIG_CPP11_TO_STRING +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_NO_CPP17_UNCAUGHT_EXCEPTIONS) && !defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) +# define CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_NO_CPP17_STRING_VIEW) && !defined(CATCH_CONFIG_CPP17_STRING_VIEW) +# define CATCH_CONFIG_CPP17_STRING_VIEW +#endif + +#if defined(CATCH_INTERNAL_CONFIG_CPP17_VARIANT) && !defined(CATCH_CONFIG_NO_CPP17_VARIANT) && !defined(CATCH_CONFIG_CPP17_VARIANT) +# define CATCH_CONFIG_CPP17_VARIANT +#endif + +#if defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) +# define CATCH_INTERNAL_CONFIG_NEW_CAPTURE +#endif + +#if defined(CATCH_INTERNAL_CONFIG_NEW_CAPTURE) && !defined(CATCH_INTERNAL_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NO_NEW_CAPTURE) && !defined(CATCH_CONFIG_NEW_CAPTURE) +# define CATCH_CONFIG_NEW_CAPTURE +#endif + +#if !defined(CATCH_INTERNAL_CONFIG_EXCEPTIONS_ENABLED) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) +# define CATCH_CONFIG_DISABLE_EXCEPTIONS +#endif + +#if defined(CATCH_INTERNAL_CONFIG_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_NO_POLYFILL_ISNAN) && !defined(CATCH_CONFIG_POLYFILL_ISNAN) +# define CATCH_CONFIG_POLYFILL_ISNAN +#endif + +#if !defined(CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS +# define CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS +# define CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS +#endif +#if !defined(CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS) +# define CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS +# define CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS +#endif + +#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) +#define CATCH_TRY if ((true)) +#define CATCH_CATCH_ALL if ((false)) +#define CATCH_CATCH_ANON(type) if ((false)) +#else +#define CATCH_TRY try +#define CATCH_CATCH_ALL catch (...) +#define CATCH_CATCH_ANON(type) catch (type) +#endif + +#if defined(CATCH_INTERNAL_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_NO_TRADITIONAL_MSVC_PREPROCESSOR) && !defined(CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR) +#define CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#endif + +// end catch_compiler_capabilities.h +#define INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) name##line +#define INTERNAL_CATCH_UNIQUE_NAME_LINE( name, line ) INTERNAL_CATCH_UNIQUE_NAME_LINE2( name, line ) +#ifdef CATCH_CONFIG_COUNTER +# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __COUNTER__ ) +#else +# define INTERNAL_CATCH_UNIQUE_NAME( name ) INTERNAL_CATCH_UNIQUE_NAME_LINE( name, __LINE__ ) +#endif + +#include +#include +#include + +// We need a dummy global operator<< so we can bring it into Catch namespace later +struct Catch_global_namespace_dummy {}; +std::ostream& operator<<(std::ostream&, Catch_global_namespace_dummy); + +namespace Catch { + + struct CaseSensitive { enum Choice { + Yes, + No + }; }; + + class NonCopyable { + NonCopyable( NonCopyable const& ) = delete; + NonCopyable( NonCopyable && ) = delete; + NonCopyable& operator = ( NonCopyable const& ) = delete; + NonCopyable& operator = ( NonCopyable && ) = delete; + + protected: + NonCopyable(); + virtual ~NonCopyable(); + }; + + struct SourceLineInfo { + + SourceLineInfo() = delete; + SourceLineInfo( char const* _file, std::size_t _line ) noexcept + : file( _file ), + line( _line ) + {} + + SourceLineInfo( SourceLineInfo const& other ) = default; + SourceLineInfo( SourceLineInfo && ) = default; + SourceLineInfo& operator = ( SourceLineInfo const& ) = default; + SourceLineInfo& operator = ( SourceLineInfo && ) = default; + + bool empty() const noexcept; + bool operator == ( SourceLineInfo const& other ) const noexcept; + bool operator < ( SourceLineInfo const& other ) const noexcept; + + char const* file; + std::size_t line; + }; + + std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ); + + // Bring in operator<< from global namespace into Catch namespace + // This is necessary because the overload of operator<< above makes + // lookup stop at namespace Catch + using ::operator<<; + + // Use this in variadic streaming macros to allow + // >> +StreamEndStop + // as well as + // >> stuff +StreamEndStop + struct StreamEndStop { + std::string operator+() const; + }; + template + T const& operator + ( T const& value, StreamEndStop ) { + return value; + } +} + +#define CATCH_INTERNAL_LINEINFO \ + ::Catch::SourceLineInfo( __FILE__, static_cast( __LINE__ ) ) + +// end catch_common.h +namespace Catch { + + struct RegistrarForTagAliases { + RegistrarForTagAliases( char const* alias, char const* tag, SourceLineInfo const& lineInfo ); + }; + +} // end namespace Catch + +#define CATCH_REGISTER_TAG_ALIAS( alias, spec ) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::RegistrarForTagAliases INTERNAL_CATCH_UNIQUE_NAME( AutoRegisterTagAlias )( alias, spec, CATCH_INTERNAL_LINEINFO ); } \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + +// end catch_tag_alias_autoregistrar.h +// start catch_test_registry.h + +// start catch_interfaces_testcase.h + +#include +#include + +namespace Catch { + + class TestSpec; + + struct ITestInvoker { + virtual void invoke () const = 0; + virtual ~ITestInvoker(); + }; + + using ITestCasePtr = std::shared_ptr; + + class TestCase; + struct IConfig; + + struct ITestCaseRegistry { + virtual ~ITestCaseRegistry(); + virtual std::vector const& getAllTests() const = 0; + virtual std::vector const& getAllTestsSorted( IConfig const& config ) const = 0; + }; + + bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); + std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); + std::vector const& getAllTestCasesSorted( IConfig const& config ); + +} + +// end catch_interfaces_testcase.h +// start catch_stringref.h + +#include +#include +#include + +namespace Catch { + + class StringData; + + /// A non-owning string class (similar to the forthcoming std::string_view) + /// Note that, because a StringRef may be a substring of another string, + /// it may not be null terminated. c_str() must return a null terminated + /// string, however, and so the StringRef will internally take ownership + /// (taking a copy), if necessary. In theory this ownership is not externally + /// visible - but it does mean (substring) StringRefs should not be shared between + /// threads. + class StringRef { + public: + using size_type = std::size_t; + + private: + friend struct StringRefTestAccess; + + char const* m_start; + size_type m_size; + + char* m_data = nullptr; + + void takeOwnership(); + + static constexpr char const* const s_empty = ""; + + public: // construction/ assignment + StringRef() noexcept + : StringRef( s_empty, 0 ) + {} + + StringRef( StringRef const& other ) noexcept + : m_start( other.m_start ), + m_size( other.m_size ) + {} + + StringRef( StringRef&& other ) noexcept + : m_start( other.m_start ), + m_size( other.m_size ), + m_data( other.m_data ) + { + other.m_data = nullptr; + } + + StringRef( char const* rawChars ) noexcept; + + StringRef( char const* rawChars, size_type size ) noexcept + : m_start( rawChars ), + m_size( size ) + {} + + StringRef( std::string const& stdString ) noexcept + : m_start( stdString.c_str() ), + m_size( stdString.size() ) + {} + + ~StringRef() noexcept { + delete[] m_data; + } + + auto operator = ( StringRef const &other ) noexcept -> StringRef& { + delete[] m_data; + m_data = nullptr; + m_start = other.m_start; + m_size = other.m_size; + return *this; + } + + operator std::string() const; + + void swap( StringRef& other ) noexcept; + + public: // operators + auto operator == ( StringRef const& other ) const noexcept -> bool; + auto operator != ( StringRef const& other ) const noexcept -> bool; + + auto operator[] ( size_type index ) const noexcept -> char; + + public: // named queries + auto empty() const noexcept -> bool { + return m_size == 0; + } + auto size() const noexcept -> size_type { + return m_size; + } + + auto numberOfCharacters() const noexcept -> size_type; + auto c_str() const -> char const*; + + public: // substrings and searches + auto substr( size_type start, size_type size ) const noexcept -> StringRef; + + // Returns the current start pointer. + // Note that the pointer can change when if the StringRef is a substring + auto currentData() const noexcept -> char const*; + + private: // ownership queries - may not be consistent between calls + auto isOwned() const noexcept -> bool; + auto isSubstring() const noexcept -> bool; + }; + + auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string; + auto operator + ( StringRef const& lhs, char const* rhs ) -> std::string; + auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string; + + auto operator += ( std::string& lhs, StringRef const& sr ) -> std::string&; + auto operator << ( std::ostream& os, StringRef const& sr ) -> std::ostream&; + + inline auto operator "" _sr( char const* rawChars, std::size_t size ) noexcept -> StringRef { + return StringRef( rawChars, size ); + } + +} // namespace Catch + +inline auto operator "" _catch_sr( char const* rawChars, std::size_t size ) noexcept -> Catch::StringRef { + return Catch::StringRef( rawChars, size ); +} + +// end catch_stringref.h +// start catch_type_traits.hpp + + +namespace Catch{ + +#ifdef CATCH_CPP17_OR_GREATER + template + inline constexpr auto is_unique = std::true_type{}; + + template + inline constexpr auto is_unique = std::bool_constant< + (!std::is_same_v && ...) && is_unique + >{}; +#else + +template +struct is_unique : std::true_type{}; + +template +struct is_unique : std::integral_constant +::value + && is_unique::value + && is_unique::value +>{}; + +#endif +} + +// end catch_type_traits.hpp +// start catch_preprocessor.hpp + + +#define CATCH_RECURSION_LEVEL0(...) __VA_ARGS__ +#define CATCH_RECURSION_LEVEL1(...) CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(CATCH_RECURSION_LEVEL0(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL2(...) CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(CATCH_RECURSION_LEVEL1(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL3(...) CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(CATCH_RECURSION_LEVEL2(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL4(...) CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(CATCH_RECURSION_LEVEL3(__VA_ARGS__))) +#define CATCH_RECURSION_LEVEL5(...) CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(CATCH_RECURSION_LEVEL4(__VA_ARGS__))) + +#ifdef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define INTERNAL_CATCH_EXPAND_VARGS(...) __VA_ARGS__ +// MSVC needs more evaluations +#define CATCH_RECURSION_LEVEL6(...) CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(CATCH_RECURSION_LEVEL5(__VA_ARGS__))) +#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL6(CATCH_RECURSION_LEVEL6(__VA_ARGS__)) +#else +#define CATCH_RECURSE(...) CATCH_RECURSION_LEVEL5(__VA_ARGS__) +#endif + +#define CATCH_REC_END(...) +#define CATCH_REC_OUT + +#define CATCH_EMPTY() +#define CATCH_DEFER(id) id CATCH_EMPTY() + +#define CATCH_REC_GET_END2() 0, CATCH_REC_END +#define CATCH_REC_GET_END1(...) CATCH_REC_GET_END2 +#define CATCH_REC_GET_END(...) CATCH_REC_GET_END1 +#define CATCH_REC_NEXT0(test, next, ...) next CATCH_REC_OUT +#define CATCH_REC_NEXT1(test, next) CATCH_DEFER ( CATCH_REC_NEXT0 ) ( test, next, 0) +#define CATCH_REC_NEXT(test, next) CATCH_REC_NEXT1(CATCH_REC_GET_END test, next) + +#define CATCH_REC_LIST0(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST1(f, x, peek, ...) , f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0) ) ( f, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST2(f, x, peek, ...) f(x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1) ) ( f, peek, __VA_ARGS__ ) + +#define CATCH_REC_LIST0_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST1_UD(f, userdata, x, peek, ...) , f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST0_UD) ) ( f, userdata, peek, __VA_ARGS__ ) +#define CATCH_REC_LIST2_UD(f, userdata, x, peek, ...) f(userdata, x) CATCH_DEFER ( CATCH_REC_NEXT(peek, CATCH_REC_LIST1_UD) ) ( f, userdata, peek, __VA_ARGS__ ) + +// Applies the function macro `f` to each of the remaining parameters, inserts commas between the results, +// and passes userdata as the first parameter to each invocation, +// e.g. CATCH_REC_LIST_UD(f, x, a, b, c) evaluates to f(x, a), f(x, b), f(x, c) +#define CATCH_REC_LIST_UD(f, userdata, ...) CATCH_RECURSE(CATCH_REC_LIST2_UD(f, userdata, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) + +#define CATCH_REC_LIST(f, ...) CATCH_RECURSE(CATCH_REC_LIST2(f, __VA_ARGS__, ()()(), ()()(), ()()(), 0)) + +#define INTERNAL_CATCH_EXPAND1(param) INTERNAL_CATCH_EXPAND2(param) +#define INTERNAL_CATCH_EXPAND2(...) INTERNAL_CATCH_NO## __VA_ARGS__ +#define INTERNAL_CATCH_DEF(...) INTERNAL_CATCH_DEF __VA_ARGS__ +#define INTERNAL_CATCH_NOINTERNAL_CATCH_DEF + +#define INTERNAL_CATCH_REMOVE_PARENS(...) INTERNAL_CATCH_EXPAND1(INTERNAL_CATCH_DEF __VA_ARGS__) + +#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME2(Name, ...) INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME3(Name, __VA_ARGS__) +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME3(Name,...) Name " - " #__VA_ARGS__ +#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME(Name,...) INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME2(Name, INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__)) +#else +// MSVC is adding extra space and needs more calls to properly remove () +#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME3(Name,...) Name " -" #__VA_ARGS__ +#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME1(Name, ...) INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME2(Name, __VA_ARGS__) +#define INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME(Name, ...) INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME1(Name, INTERNAL_CATCH_EXPAND_VARGS(INTERNAL_CATCH_REMOVE_PARENS(__VA_ARGS__))) +#endif + +// end catch_preprocessor.hpp +namespace Catch { + +template +class TestInvokerAsMethod : public ITestInvoker { + void (C::*m_testAsMethod)(); +public: + TestInvokerAsMethod( void (C::*testAsMethod)() ) noexcept : m_testAsMethod( testAsMethod ) {} + + void invoke() const override { + C obj; + (obj.*m_testAsMethod)(); + } +}; + +auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker*; + +template +auto makeTestInvoker( void (C::*testAsMethod)() ) noexcept -> ITestInvoker* { + return new(std::nothrow) TestInvokerAsMethod( testAsMethod ); +} + +struct NameAndTags { + NameAndTags( StringRef const& name_ = StringRef(), StringRef const& tags_ = StringRef() ) noexcept; + StringRef name; + StringRef tags; +}; + +struct AutoReg : NonCopyable { + AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept; + ~AutoReg(); +}; + +} // end namespace Catch + +#if defined(CATCH_CONFIG_DISABLE) + #define INTERNAL_CATCH_TESTCASE_NO_REGISTRATION( TestName, ... ) \ + static void TestName() + #define INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \ + namespace{ \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \ + void test(); \ + }; \ + } \ + void TestName::test() + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION( TestName, ... ) \ + template \ + static void TestName() + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION( TestName, ClassName, ... ) \ + namespace{ \ + template \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName ) { \ + void test(); \ + }; \ + } \ + template \ + void TestName::test() +#endif + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TESTCASE2( TestName, ... ) \ + static void TestName(); \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &TestName ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + static void TestName() + #define INTERNAL_CATCH_TESTCASE( ... ) \ + INTERNAL_CATCH_TESTCASE2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), __VA_ARGS__ ) + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_METHOD_AS_TEST_CASE( QualifiedMethod, ... ) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( &QualifiedMethod ), CATCH_INTERNAL_LINEINFO, "&" #QualifiedMethod, Catch::NameAndTags{ __VA_ARGS__ } ); } /* NOLINT */ \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TEST_CASE_METHOD2( TestName, ClassName, ... )\ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName) { \ + void test(); \ + }; \ + Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar ) ( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ + } \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + void TestName::test() + #define INTERNAL_CATCH_TEST_CASE_METHOD( ClassName, ... ) \ + INTERNAL_CATCH_TEST_CASE_METHOD2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), ClassName, __VA_ARGS__ ) + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_REGISTER_TESTCASE( Function, ... ) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + Catch::AutoReg INTERNAL_CATCH_UNIQUE_NAME( autoRegistrar )( Catch::makeTestInvoker( Function ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ __VA_ARGS__ } ); /* NOLINT */ \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + + /////////////////////////////////////////////////////////////////////////////// + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_2(TestName, TestFunc, Name, Tags, ... )\ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + template \ + static void TestFunc();\ + namespace {\ + template \ + struct TestName{\ + template \ + TestName(Ts...names){\ + CATCH_INTERNAL_CHECK_UNIQUE_TYPES(CATCH_REC_LIST(INTERNAL_CATCH_REMOVE_PARENS, __VA_ARGS__)) \ + using expander = int[];\ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestFunc ), CATCH_INTERNAL_LINEINFO, Catch::StringRef(), Catch::NameAndTags{ names, Tags } ), 0)... };/* NOLINT */ \ + }\ + };\ + INTERNAL_CATCH_TEMPLATE_REGISTRY_INITIATE(TestName, Name, __VA_ARGS__) \ + }\ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + template \ + static void TestFunc() + +#if defined(CATCH_CPP17_OR_GREATER) +#define CATCH_INTERNAL_CHECK_UNIQUE_TYPES(...) static_assert(Catch::is_unique<__VA_ARGS__>,"Duplicate type detected in declaration of template test case"); +#else +#define CATCH_INTERNAL_CHECK_UNIQUE_TYPES(...) static_assert(Catch::is_unique<__VA_ARGS__>::value,"Duplicate type detected in declaration of template test case"); +#endif + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE(Name, Tags, ...) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____F_U_N_C____ ), Name, Tags, __VA_ARGS__ ) ) +#endif + + #define INTERNAL_CATCH_TEMPLATE_REGISTRY_INITIATE(TestName, Name, ...)\ + static int INTERNAL_CATCH_UNIQUE_NAME( globalRegistrar ) = [](){\ + TestName(CATCH_REC_LIST_UD(INTERNAL_CATCH_TEMPLATE_UNIQUE_NAME,Name, __VA_ARGS__));\ + return 0;\ + }(); + + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( TestNameClass, TestName, ClassName, Name, Tags, ... ) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ \ + template \ + struct TestName : INTERNAL_CATCH_REMOVE_PARENS(ClassName ) { \ + void test();\ + };\ + template \ + struct TestNameClass{\ + template \ + TestNameClass(Ts...names){\ + CATCH_INTERNAL_CHECK_UNIQUE_TYPES(CATCH_REC_LIST(INTERNAL_CATCH_REMOVE_PARENS, __VA_ARGS__)) \ + using expander = int[];\ + (void)expander{(Catch::AutoReg( Catch::makeTestInvoker( &TestName::test ), CATCH_INTERNAL_LINEINFO, #ClassName, Catch::NameAndTags{ names, Tags } ), 0)... };/* NOLINT */ \ + }\ + };\ + INTERNAL_CATCH_TEMPLATE_REGISTRY_INITIATE(TestNameClass, Name, __VA_ARGS__)\ + }\ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS\ + template \ + void TestName::test() + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \ + INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, __VA_ARGS__ ) +#else + #define INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( ClassName, Name, Tags,... ) \ + INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_2( INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____C_L_A_S_S____ ), INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) , ClassName, Name, Tags, __VA_ARGS__ ) ) +#endif + +// end catch_test_registry.h +// start catch_capture.hpp + +// start catch_assertionhandler.h + +// start catch_assertioninfo.h + +// start catch_result_type.h + +namespace Catch { + + // ResultWas::OfType enum + struct ResultWas { enum OfType { + Unknown = -1, + Ok = 0, + Info = 1, + Warning = 2, + + FailureBit = 0x10, + + ExpressionFailed = FailureBit | 1, + ExplicitFailure = FailureBit | 2, + + Exception = 0x100 | FailureBit, + + ThrewException = Exception | 1, + DidntThrowException = Exception | 2, + + FatalErrorCondition = 0x200 | FailureBit + + }; }; + + bool isOk( ResultWas::OfType resultType ); + bool isJustInfo( int flags ); + + // ResultDisposition::Flags enum + struct ResultDisposition { enum Flags { + Normal = 0x01, + + ContinueOnFailure = 0x02, // Failures fail test, but execution continues + FalseTest = 0x04, // Prefix expression with ! + SuppressFail = 0x08 // Failures are reported but do not fail the test + }; }; + + ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ); + + bool shouldContinueOnFailure( int flags ); + inline bool isFalseTest( int flags ) { return ( flags & ResultDisposition::FalseTest ) != 0; } + bool shouldSuppressFailure( int flags ); + +} // end namespace Catch + +// end catch_result_type.h +namespace Catch { + + struct AssertionInfo + { + StringRef macroName; + SourceLineInfo lineInfo; + StringRef capturedExpression; + ResultDisposition::Flags resultDisposition; + + // We want to delete this constructor but a compiler bug in 4.8 means + // the struct is then treated as non-aggregate + //AssertionInfo() = delete; + }; + +} // end namespace Catch + +// end catch_assertioninfo.h +// start catch_decomposer.h + +// start catch_tostring.h + +#include +#include +#include +#include +// start catch_stream.h + +#include +#include +#include + +namespace Catch { + + std::ostream& cout(); + std::ostream& cerr(); + std::ostream& clog(); + + class StringRef; + + struct IStream { + virtual ~IStream(); + virtual std::ostream& stream() const = 0; + }; + + auto makeStream( StringRef const &filename ) -> IStream const*; + + class ReusableStringStream { + std::size_t m_index; + std::ostream* m_oss; + public: + ReusableStringStream(); + ~ReusableStringStream(); + + auto str() const -> std::string; + + template + auto operator << ( T const& value ) -> ReusableStringStream& { + *m_oss << value; + return *this; + } + auto get() -> std::ostream& { return *m_oss; } + }; +} + +// end catch_stream.h + +#ifdef CATCH_CONFIG_CPP17_STRING_VIEW +#include +#endif + +#ifdef __OBJC__ +// start catch_objc_arc.hpp + +#import + +#ifdef __has_feature +#define CATCH_ARC_ENABLED __has_feature(objc_arc) +#else +#define CATCH_ARC_ENABLED 0 +#endif + +void arcSafeRelease( NSObject* obj ); +id performOptionalSelector( id obj, SEL sel ); + +#if !CATCH_ARC_ENABLED +inline void arcSafeRelease( NSObject* obj ) { + [obj release]; +} +inline id performOptionalSelector( id obj, SEL sel ) { + if( [obj respondsToSelector: sel] ) + return [obj performSelector: sel]; + return nil; +} +#define CATCH_UNSAFE_UNRETAINED +#define CATCH_ARC_STRONG +#else +inline void arcSafeRelease( NSObject* ){} +inline id performOptionalSelector( id obj, SEL sel ) { +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Warc-performSelector-leaks" +#endif + if( [obj respondsToSelector: sel] ) + return [obj performSelector: sel]; +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + return nil; +} +#define CATCH_UNSAFE_UNRETAINED __unsafe_unretained +#define CATCH_ARC_STRONG __strong +#endif + +// end catch_objc_arc.hpp +#endif + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4180) // We attempt to stream a function (address) by const&, which MSVC complains about but is harmless +#endif + +namespace Catch { + namespace Detail { + + extern const std::string unprintableString; + + std::string rawMemoryToString( const void *object, std::size_t size ); + + template + std::string rawMemoryToString( const T& object ) { + return rawMemoryToString( &object, sizeof(object) ); + } + + template + class IsStreamInsertable { + template + static auto test(int) + -> decltype(std::declval() << std::declval(), std::true_type()); + + template + static auto test(...)->std::false_type; + + public: + static const bool value = decltype(test(0))::value; + }; + + template + std::string convertUnknownEnumToString( E e ); + + template + typename std::enable_if< + !std::is_enum::value && !std::is_base_of::value, + std::string>::type convertUnstreamable( T const& ) { + return Detail::unprintableString; + } + template + typename std::enable_if< + !std::is_enum::value && std::is_base_of::value, + std::string>::type convertUnstreamable(T const& ex) { + return ex.what(); + } + + template + typename std::enable_if< + std::is_enum::value + , std::string>::type convertUnstreamable( T const& value ) { + return convertUnknownEnumToString( value ); + } + +#if defined(_MANAGED) + //! Convert a CLR string to a utf8 std::string + template + std::string clrReferenceToString( T^ ref ) { + if (ref == nullptr) + return std::string("null"); + auto bytes = System::Text::Encoding::UTF8->GetBytes(ref->ToString()); + cli::pin_ptr p = &bytes[0]; + return std::string(reinterpret_cast(p), bytes->Length); + } +#endif + + } // namespace Detail + + // If we decide for C++14, change these to enable_if_ts + template + struct StringMaker { + template + static + typename std::enable_if<::Catch::Detail::IsStreamInsertable::value, std::string>::type + convert(const Fake& value) { + ReusableStringStream rss; + // NB: call using the function-like syntax to avoid ambiguity with + // user-defined templated operator<< under clang. + rss.operator<<(value); + return rss.str(); + } + + template + static + typename std::enable_if::value, std::string>::type + convert( const Fake& value ) { +#if !defined(CATCH_CONFIG_FALLBACK_STRINGIFIER) + return Detail::convertUnstreamable(value); +#else + return CATCH_CONFIG_FALLBACK_STRINGIFIER(value); +#endif + } + }; + + namespace Detail { + + // This function dispatches all stringification requests inside of Catch. + // Should be preferably called fully qualified, like ::Catch::Detail::stringify + template + std::string stringify(const T& e) { + return ::Catch::StringMaker::type>::type>::convert(e); + } + + template + std::string convertUnknownEnumToString( E e ) { + return ::Catch::Detail::stringify(static_cast::type>(e)); + } + +#if defined(_MANAGED) + template + std::string stringify( T^ e ) { + return ::Catch::StringMaker::convert(e); + } +#endif + + } // namespace Detail + + // Some predefined specializations + + template<> + struct StringMaker { + static std::string convert(const std::string& str); + }; + +#ifdef CATCH_CONFIG_CPP17_STRING_VIEW + template<> + struct StringMaker { + static std::string convert(std::string_view str); + }; +#endif + + template<> + struct StringMaker { + static std::string convert(char const * str); + }; + template<> + struct StringMaker { + static std::string convert(char * str); + }; + +#ifdef CATCH_CONFIG_WCHAR + template<> + struct StringMaker { + static std::string convert(const std::wstring& wstr); + }; + +# ifdef CATCH_CONFIG_CPP17_STRING_VIEW + template<> + struct StringMaker { + static std::string convert(std::wstring_view str); + }; +# endif + + template<> + struct StringMaker { + static std::string convert(wchar_t const * str); + }; + template<> + struct StringMaker { + static std::string convert(wchar_t * str); + }; +#endif + + // TBD: Should we use `strnlen` to ensure that we don't go out of the buffer, + // while keeping string semantics? + template + struct StringMaker { + static std::string convert(char const* str) { + return ::Catch::Detail::stringify(std::string{ str }); + } + }; + template + struct StringMaker { + static std::string convert(signed char const* str) { + return ::Catch::Detail::stringify(std::string{ reinterpret_cast(str) }); + } + }; + template + struct StringMaker { + static std::string convert(unsigned char const* str) { + return ::Catch::Detail::stringify(std::string{ reinterpret_cast(str) }); + } + }; + + template<> + struct StringMaker { + static std::string convert(int value); + }; + template<> + struct StringMaker { + static std::string convert(long value); + }; + template<> + struct StringMaker { + static std::string convert(long long value); + }; + template<> + struct StringMaker { + static std::string convert(unsigned int value); + }; + template<> + struct StringMaker { + static std::string convert(unsigned long value); + }; + template<> + struct StringMaker { + static std::string convert(unsigned long long value); + }; + + template<> + struct StringMaker { + static std::string convert(bool b); + }; + + template<> + struct StringMaker { + static std::string convert(char c); + }; + template<> + struct StringMaker { + static std::string convert(signed char c); + }; + template<> + struct StringMaker { + static std::string convert(unsigned char c); + }; + + template<> + struct StringMaker { + static std::string convert(std::nullptr_t); + }; + + template<> + struct StringMaker { + static std::string convert(float value); + }; + template<> + struct StringMaker { + static std::string convert(double value); + }; + + template + struct StringMaker { + template + static std::string convert(U* p) { + if (p) { + return ::Catch::Detail::rawMemoryToString(p); + } else { + return "nullptr"; + } + } + }; + + template + struct StringMaker { + static std::string convert(R C::* p) { + if (p) { + return ::Catch::Detail::rawMemoryToString(p); + } else { + return "nullptr"; + } + } + }; + +#if defined(_MANAGED) + template + struct StringMaker { + static std::string convert( T^ ref ) { + return ::Catch::Detail::clrReferenceToString(ref); + } + }; +#endif + + namespace Detail { + template + std::string rangeToString(InputIterator first, InputIterator last) { + ReusableStringStream rss; + rss << "{ "; + if (first != last) { + rss << ::Catch::Detail::stringify(*first); + for (++first; first != last; ++first) + rss << ", " << ::Catch::Detail::stringify(*first); + } + rss << " }"; + return rss.str(); + } + } + +#ifdef __OBJC__ + template<> + struct StringMaker { + static std::string convert(NSString * nsstring) { + if (!nsstring) + return "nil"; + return std::string("@") + [nsstring UTF8String]; + } + }; + template<> + struct StringMaker { + static std::string convert(NSObject* nsObject) { + return ::Catch::Detail::stringify([nsObject description]); + } + + }; + namespace Detail { + inline std::string stringify( NSString* nsstring ) { + return StringMaker::convert( nsstring ); + } + + } // namespace Detail +#endif // __OBJC__ + +} // namespace Catch + +////////////////////////////////////////////////////// +// Separate std-lib types stringification, so it can be selectively enabled +// This means that we do not bring in + +#if defined(CATCH_CONFIG_ENABLE_ALL_STRINGMAKERS) +# define CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER +# define CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER +# define CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER +# define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER +#endif + +// Separate std::pair specialization +#if defined(CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER) +#include +namespace Catch { + template + struct StringMaker > { + static std::string convert(const std::pair& pair) { + ReusableStringStream rss; + rss << "{ " + << ::Catch::Detail::stringify(pair.first) + << ", " + << ::Catch::Detail::stringify(pair.second) + << " }"; + return rss.str(); + } + }; +} +#endif // CATCH_CONFIG_ENABLE_PAIR_STRINGMAKER + +// Separate std::tuple specialization +#if defined(CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER) +#include +namespace Catch { + namespace Detail { + template< + typename Tuple, + std::size_t N = 0, + bool = (N < std::tuple_size::value) + > + struct TupleElementPrinter { + static void print(const Tuple& tuple, std::ostream& os) { + os << (N ? ", " : " ") + << ::Catch::Detail::stringify(std::get(tuple)); + TupleElementPrinter::print(tuple, os); + } + }; + + template< + typename Tuple, + std::size_t N + > + struct TupleElementPrinter { + static void print(const Tuple&, std::ostream&) {} + }; + + } + + template + struct StringMaker> { + static std::string convert(const std::tuple& tuple) { + ReusableStringStream rss; + rss << '{'; + Detail::TupleElementPrinter>::print(tuple, rss.get()); + rss << " }"; + return rss.str(); + } + }; +} +#endif // CATCH_CONFIG_ENABLE_TUPLE_STRINGMAKER + +#if defined(CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER) && defined(CATCH_CONFIG_CPP17_VARIANT) +#include +namespace Catch { + template<> + struct StringMaker { + static std::string convert(const std::monostate&) { + return "{ }"; + } + }; + + template + struct StringMaker> { + static std::string convert(const std::variant& variant) { + if (variant.valueless_by_exception()) { + return "{valueless variant}"; + } else { + return std::visit( + [](const auto& value) { + return ::Catch::Detail::stringify(value); + }, + variant + ); + } + } + }; +} +#endif // CATCH_CONFIG_ENABLE_VARIANT_STRINGMAKER + +namespace Catch { + struct not_this_one {}; // Tag type for detecting which begin/ end are being selected + + // Import begin/ end from std here so they are considered alongside the fallback (...) overloads in this namespace + using std::begin; + using std::end; + + not_this_one begin( ... ); + not_this_one end( ... ); + + template + struct is_range { + static const bool value = + !std::is_same())), not_this_one>::value && + !std::is_same())), not_this_one>::value; + }; + +#if defined(_MANAGED) // Managed types are never ranges + template + struct is_range { + static const bool value = false; + }; +#endif + + template + std::string rangeToString( Range const& range ) { + return ::Catch::Detail::rangeToString( begin( range ), end( range ) ); + } + + // Handle vector specially + template + std::string rangeToString( std::vector const& v ) { + ReusableStringStream rss; + rss << "{ "; + bool first = true; + for( bool b : v ) { + if( first ) + first = false; + else + rss << ", "; + rss << ::Catch::Detail::stringify( b ); + } + rss << " }"; + return rss.str(); + } + + template + struct StringMaker::value && !::Catch::Detail::IsStreamInsertable::value>::type> { + static std::string convert( R const& range ) { + return rangeToString( range ); + } + }; + + template + struct StringMaker { + static std::string convert(T const(&arr)[SZ]) { + return rangeToString(arr); + } + }; + +} // namespace Catch + +// Separate std::chrono::duration specialization +#if defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) +#include +#include +#include + +namespace Catch { + +template +struct ratio_string { + static std::string symbol(); +}; + +template +std::string ratio_string::symbol() { + Catch::ReusableStringStream rss; + rss << '[' << Ratio::num << '/' + << Ratio::den << ']'; + return rss.str(); +} +template <> +struct ratio_string { + static std::string symbol(); +}; +template <> +struct ratio_string { + static std::string symbol(); +}; +template <> +struct ratio_string { + static std::string symbol(); +}; +template <> +struct ratio_string { + static std::string symbol(); +}; +template <> +struct ratio_string { + static std::string symbol(); +}; +template <> +struct ratio_string { + static std::string symbol(); +}; + + //////////// + // std::chrono::duration specializations + template + struct StringMaker> { + static std::string convert(std::chrono::duration const& duration) { + ReusableStringStream rss; + rss << duration.count() << ' ' << ratio_string::symbol() << 's'; + return rss.str(); + } + }; + template + struct StringMaker>> { + static std::string convert(std::chrono::duration> const& duration) { + ReusableStringStream rss; + rss << duration.count() << " s"; + return rss.str(); + } + }; + template + struct StringMaker>> { + static std::string convert(std::chrono::duration> const& duration) { + ReusableStringStream rss; + rss << duration.count() << " m"; + return rss.str(); + } + }; + template + struct StringMaker>> { + static std::string convert(std::chrono::duration> const& duration) { + ReusableStringStream rss; + rss << duration.count() << " h"; + return rss.str(); + } + }; + + //////////// + // std::chrono::time_point specialization + // Generic time_point cannot be specialized, only std::chrono::time_point + template + struct StringMaker> { + static std::string convert(std::chrono::time_point const& time_point) { + return ::Catch::Detail::stringify(time_point.time_since_epoch()) + " since epoch"; + } + }; + // std::chrono::time_point specialization + template + struct StringMaker> { + static std::string convert(std::chrono::time_point const& time_point) { + auto converted = std::chrono::system_clock::to_time_t(time_point); + +#ifdef _MSC_VER + std::tm timeInfo = {}; + gmtime_s(&timeInfo, &converted); +#else + std::tm* timeInfo = std::gmtime(&converted); +#endif + + auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); + char timeStamp[timeStampSize]; + const char * const fmt = "%Y-%m-%dT%H:%M:%SZ"; + +#ifdef _MSC_VER + std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); +#else + std::strftime(timeStamp, timeStampSize, fmt, timeInfo); +#endif + return std::string(timeStamp); + } + }; +} +#endif // CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +// end catch_tostring.h +#include + +#ifdef _MSC_VER +#pragma warning(push) +#pragma warning(disable:4389) // '==' : signed/unsigned mismatch +#pragma warning(disable:4018) // more "signed/unsigned mismatch" +#pragma warning(disable:4312) // Converting int to T* using reinterpret_cast (issue on x64 platform) +#pragma warning(disable:4180) // qualifier applied to function type has no meaning +#endif + +namespace Catch { + + struct ITransientExpression { + auto isBinaryExpression() const -> bool { return m_isBinaryExpression; } + auto getResult() const -> bool { return m_result; } + virtual void streamReconstructedExpression( std::ostream &os ) const = 0; + + ITransientExpression( bool isBinaryExpression, bool result ) + : m_isBinaryExpression( isBinaryExpression ), + m_result( result ) + {} + + // We don't actually need a virtual destructor, but many static analyzers + // complain if it's not here :-( + virtual ~ITransientExpression(); + + bool m_isBinaryExpression; + bool m_result; + + }; + + void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ); + + template + class BinaryExpr : public ITransientExpression { + LhsT m_lhs; + StringRef m_op; + RhsT m_rhs; + + void streamReconstructedExpression( std::ostream &os ) const override { + formatReconstructedExpression + ( os, Catch::Detail::stringify( m_lhs ), m_op, Catch::Detail::stringify( m_rhs ) ); + } + + public: + BinaryExpr( bool comparisonResult, LhsT lhs, StringRef op, RhsT rhs ) + : ITransientExpression{ true, comparisonResult }, + m_lhs( lhs ), + m_op( op ), + m_rhs( rhs ) + {} + }; + + template + class UnaryExpr : public ITransientExpression { + LhsT m_lhs; + + void streamReconstructedExpression( std::ostream &os ) const override { + os << Catch::Detail::stringify( m_lhs ); + } + + public: + explicit UnaryExpr( LhsT lhs ) + : ITransientExpression{ false, lhs ? true : false }, + m_lhs( lhs ) + {} + }; + + // Specialised comparison functions to handle equality comparisons between ints and pointers (NULL deduces as an int) + template + auto compareEqual( LhsT const& lhs, RhsT const& rhs ) -> bool { return static_cast(lhs == rhs); } + template + auto compareEqual( T* const& lhs, int rhs ) -> bool { return lhs == reinterpret_cast( rhs ); } + template + auto compareEqual( T* const& lhs, long rhs ) -> bool { return lhs == reinterpret_cast( rhs ); } + template + auto compareEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; } + template + auto compareEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) == rhs; } + + template + auto compareNotEqual( LhsT const& lhs, RhsT&& rhs ) -> bool { return static_cast(lhs != rhs); } + template + auto compareNotEqual( T* const& lhs, int rhs ) -> bool { return lhs != reinterpret_cast( rhs ); } + template + auto compareNotEqual( T* const& lhs, long rhs ) -> bool { return lhs != reinterpret_cast( rhs ); } + template + auto compareNotEqual( int lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) != rhs; } + template + auto compareNotEqual( long lhs, T* const& rhs ) -> bool { return reinterpret_cast( lhs ) != rhs; } + + template + class ExprLhs { + LhsT m_lhs; + public: + explicit ExprLhs( LhsT lhs ) : m_lhs( lhs ) {} + + template + auto operator == ( RhsT const& rhs ) -> BinaryExpr const { + return { compareEqual( m_lhs, rhs ), m_lhs, "==", rhs }; + } + auto operator == ( bool rhs ) -> BinaryExpr const { + return { m_lhs == rhs, m_lhs, "==", rhs }; + } + + template + auto operator != ( RhsT const& rhs ) -> BinaryExpr const { + return { compareNotEqual( m_lhs, rhs ), m_lhs, "!=", rhs }; + } + auto operator != ( bool rhs ) -> BinaryExpr const { + return { m_lhs != rhs, m_lhs, "!=", rhs }; + } + + template + auto operator > ( RhsT const& rhs ) -> BinaryExpr const { + return { static_cast(m_lhs > rhs), m_lhs, ">", rhs }; + } + template + auto operator < ( RhsT const& rhs ) -> BinaryExpr const { + return { static_cast(m_lhs < rhs), m_lhs, "<", rhs }; + } + template + auto operator >= ( RhsT const& rhs ) -> BinaryExpr const { + return { static_cast(m_lhs >= rhs), m_lhs, ">=", rhs }; + } + template + auto operator <= ( RhsT const& rhs ) -> BinaryExpr const { + return { static_cast(m_lhs <= rhs), m_lhs, "<=", rhs }; + } + + auto makeUnaryExpr() const -> UnaryExpr { + return UnaryExpr{ m_lhs }; + } + }; + + void handleExpression( ITransientExpression const& expr ); + + template + void handleExpression( ExprLhs const& expr ) { + handleExpression( expr.makeUnaryExpr() ); + } + + struct Decomposer { + template + auto operator <= ( T const& lhs ) -> ExprLhs { + return ExprLhs{ lhs }; + } + + auto operator <=( bool value ) -> ExprLhs { + return ExprLhs{ value }; + } + }; + +} // end namespace Catch + +#ifdef _MSC_VER +#pragma warning(pop) +#endif + +// end catch_decomposer.h +// start catch_interfaces_capture.h + +#include + +namespace Catch { + + class AssertionResult; + struct AssertionInfo; + struct SectionInfo; + struct SectionEndInfo; + struct MessageInfo; + struct Counts; + struct BenchmarkInfo; + struct BenchmarkStats; + struct AssertionReaction; + struct SourceLineInfo; + + struct ITransientExpression; + struct IGeneratorTracker; + + struct IResultCapture { + + virtual ~IResultCapture(); + + virtual bool sectionStarted( SectionInfo const& sectionInfo, + Counts& assertions ) = 0; + virtual void sectionEnded( SectionEndInfo const& endInfo ) = 0; + virtual void sectionEndedEarly( SectionEndInfo const& endInfo ) = 0; + + virtual auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& = 0; + + virtual void benchmarkStarting( BenchmarkInfo const& info ) = 0; + virtual void benchmarkEnded( BenchmarkStats const& stats ) = 0; + + virtual void pushScopedMessage( MessageInfo const& message ) = 0; + virtual void popScopedMessage( MessageInfo const& message ) = 0; + + virtual void handleFatalErrorCondition( StringRef message ) = 0; + + virtual void handleExpr + ( AssertionInfo const& info, + ITransientExpression const& expr, + AssertionReaction& reaction ) = 0; + virtual void handleMessage + ( AssertionInfo const& info, + ResultWas::OfType resultType, + StringRef const& message, + AssertionReaction& reaction ) = 0; + virtual void handleUnexpectedExceptionNotThrown + ( AssertionInfo const& info, + AssertionReaction& reaction ) = 0; + virtual void handleUnexpectedInflightException + ( AssertionInfo const& info, + std::string const& message, + AssertionReaction& reaction ) = 0; + virtual void handleIncomplete + ( AssertionInfo const& info ) = 0; + virtual void handleNonExpr + ( AssertionInfo const &info, + ResultWas::OfType resultType, + AssertionReaction &reaction ) = 0; + + virtual bool lastAssertionPassed() = 0; + virtual void assertionPassed() = 0; + + // Deprecated, do not use: + virtual std::string getCurrentTestName() const = 0; + virtual const AssertionResult* getLastResult() const = 0; + virtual void exceptionEarlyReported() = 0; + }; + + IResultCapture& getResultCapture(); +} + +// end catch_interfaces_capture.h +namespace Catch { + + struct TestFailureException{}; + struct AssertionResultData; + struct IResultCapture; + class RunContext; + + class LazyExpression { + friend class AssertionHandler; + friend struct AssertionStats; + friend class RunContext; + + ITransientExpression const* m_transientExpression = nullptr; + bool m_isNegated; + public: + LazyExpression( bool isNegated ); + LazyExpression( LazyExpression const& other ); + LazyExpression& operator = ( LazyExpression const& ) = delete; + + explicit operator bool() const; + + friend auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream&; + }; + + struct AssertionReaction { + bool shouldDebugBreak = false; + bool shouldThrow = false; + }; + + class AssertionHandler { + AssertionInfo m_assertionInfo; + AssertionReaction m_reaction; + bool m_completed = false; + IResultCapture& m_resultCapture; + + public: + AssertionHandler + ( StringRef const& macroName, + SourceLineInfo const& lineInfo, + StringRef capturedExpression, + ResultDisposition::Flags resultDisposition ); + ~AssertionHandler() { + if ( !m_completed ) { + m_resultCapture.handleIncomplete( m_assertionInfo ); + } + } + + template + void handleExpr( ExprLhs const& expr ) { + handleExpr( expr.makeUnaryExpr() ); + } + void handleExpr( ITransientExpression const& expr ); + + void handleMessage(ResultWas::OfType resultType, StringRef const& message); + + void handleExceptionThrownAsExpected(); + void handleUnexpectedExceptionNotThrown(); + void handleExceptionNotThrownAsExpected(); + void handleThrowingCallSkipped(); + void handleUnexpectedInflightException(); + + void complete(); + void setCompleted(); + + // query + auto allowThrows() const -> bool; + }; + + void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString ); + +} // namespace Catch + +// end catch_assertionhandler.h +// start catch_message.h + +#include +#include + +namespace Catch { + + struct MessageInfo { + MessageInfo( StringRef const& _macroName, + SourceLineInfo const& _lineInfo, + ResultWas::OfType _type ); + + StringRef macroName; + std::string message; + SourceLineInfo lineInfo; + ResultWas::OfType type; + unsigned int sequence; + + bool operator == ( MessageInfo const& other ) const; + bool operator < ( MessageInfo const& other ) const; + private: + static unsigned int globalCount; + }; + + struct MessageStream { + + template + MessageStream& operator << ( T const& value ) { + m_stream << value; + return *this; + } + + ReusableStringStream m_stream; + }; + + struct MessageBuilder : MessageStream { + MessageBuilder( StringRef const& macroName, + SourceLineInfo const& lineInfo, + ResultWas::OfType type ); + + template + MessageBuilder& operator << ( T const& value ) { + m_stream << value; + return *this; + } + + MessageInfo m_info; + }; + + class ScopedMessage { + public: + explicit ScopedMessage( MessageBuilder const& builder ); + ~ScopedMessage(); + + MessageInfo m_info; + }; + + class Capturer { + std::vector m_messages; + IResultCapture& m_resultCapture = getResultCapture(); + size_t m_captured = 0; + public: + Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ); + ~Capturer(); + + void captureValue( size_t index, std::string const& value ); + + template + void captureValues( size_t index, T const& value ) { + captureValue( index, Catch::Detail::stringify( value ) ); + } + + template + void captureValues( size_t index, T const& value, Ts const&... values ) { + captureValue( index, Catch::Detail::stringify(value) ); + captureValues( index+1, values... ); + } + }; + +} // end namespace Catch + +// end catch_message.h +#if !defined(CATCH_CONFIG_DISABLE) + +#if !defined(CATCH_CONFIG_DISABLE_STRINGIFICATION) + #define CATCH_INTERNAL_STRINGIFY(...) #__VA_ARGS__ +#else + #define CATCH_INTERNAL_STRINGIFY(...) "Disabled by CATCH_CONFIG_DISABLE_STRINGIFICATION" +#endif + +#if defined(CATCH_CONFIG_FAST_COMPILE) || defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + +/////////////////////////////////////////////////////////////////////////////// +// Another way to speed-up compilation is to omit local try-catch for REQUIRE* +// macros. +#define INTERNAL_CATCH_TRY +#define INTERNAL_CATCH_CATCH( capturer ) + +#else // CATCH_CONFIG_FAST_COMPILE + +#define INTERNAL_CATCH_TRY try +#define INTERNAL_CATCH_CATCH( handler ) catch(...) { handler.handleUnexpectedInflightException(); } + +#endif + +#define INTERNAL_CATCH_REACT( handler ) handler.complete(); + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_TEST( macroName, resultDisposition, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \ + INTERNAL_CATCH_TRY { \ + CATCH_INTERNAL_SUPPRESS_PARENTHESES_WARNINGS \ + catchAssertionHandler.handleExpr( Catch::Decomposer() <= __VA_ARGS__ ); \ + CATCH_INTERNAL_UNSUPPRESS_PARENTHESES_WARNINGS \ + } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( (void)0, false && static_cast( !!(__VA_ARGS__) ) ) // the expression here is never evaluated at runtime but it forces the compiler to give it a look + // The double negation silences MSVC's C4800 warning, the static_cast forces short-circuit evaluation if the type has overloaded &&. + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_IF( macroName, resultDisposition, ... ) \ + INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \ + if( Catch::getResultCapture().lastAssertionPassed() ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_ELSE( macroName, resultDisposition, ... ) \ + INTERNAL_CATCH_TEST( macroName, resultDisposition, __VA_ARGS__ ); \ + if( !Catch::getResultCapture().lastAssertionPassed() ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_NO_THROW( macroName, resultDisposition, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition ); \ + try { \ + static_cast(__VA_ARGS__); \ + catchAssertionHandler.handleExceptionNotThrownAsExpected(); \ + } \ + catch( ... ) { \ + catchAssertionHandler.handleUnexpectedInflightException(); \ + } \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_THROWS( macroName, resultDisposition, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__), resultDisposition); \ + if( catchAssertionHandler.allowThrows() ) \ + try { \ + static_cast(__VA_ARGS__); \ + catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ + } \ + catch( ... ) { \ + catchAssertionHandler.handleExceptionThrownAsExpected(); \ + } \ + else \ + catchAssertionHandler.handleThrowingCallSkipped(); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_THROWS_AS( macroName, exceptionType, resultDisposition, expr ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(expr) ", " CATCH_INTERNAL_STRINGIFY(exceptionType), resultDisposition ); \ + if( catchAssertionHandler.allowThrows() ) \ + try { \ + static_cast(expr); \ + catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ + } \ + catch( exceptionType const& ) { \ + catchAssertionHandler.handleExceptionThrownAsExpected(); \ + } \ + catch( ... ) { \ + catchAssertionHandler.handleUnexpectedInflightException(); \ + } \ + else \ + catchAssertionHandler.handleThrowingCallSkipped(); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_MSG( macroName, messageType, resultDisposition, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::StringRef(), resultDisposition ); \ + catchAssertionHandler.handleMessage( messageType, ( Catch::MessageStream() << __VA_ARGS__ + ::Catch::StreamEndStop() ).m_stream.str() ); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_CAPTURE( varName, macroName, ... ) \ + auto varName = Catch::Capturer( macroName, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info, #__VA_ARGS__ ); \ + varName.captureValues( 0, __VA_ARGS__ ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_INFO( macroName, log ) \ + Catch::ScopedMessage INTERNAL_CATCH_UNIQUE_NAME( scopedMessage )( Catch::MessageBuilder( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, Catch::ResultWas::Info ) << log ); + +/////////////////////////////////////////////////////////////////////////////// +// Although this is matcher-based, it can be used with just a string +#define INTERNAL_CATCH_THROWS_STR_MATCHES( macroName, resultDisposition, matcher, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ + if( catchAssertionHandler.allowThrows() ) \ + try { \ + static_cast(__VA_ARGS__); \ + catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ + } \ + catch( ... ) { \ + Catch::handleExceptionMatchExpr( catchAssertionHandler, matcher, #matcher##_catch_sr ); \ + } \ + else \ + catchAssertionHandler.handleThrowingCallSkipped(); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +#endif // CATCH_CONFIG_DISABLE + +// end catch_capture.hpp +// start catch_section.h + +// start catch_section_info.h + +// start catch_totals.h + +#include + +namespace Catch { + + struct Counts { + Counts operator - ( Counts const& other ) const; + Counts& operator += ( Counts const& other ); + + std::size_t total() const; + bool allPassed() const; + bool allOk() const; + + std::size_t passed = 0; + std::size_t failed = 0; + std::size_t failedButOk = 0; + }; + + struct Totals { + + Totals operator - ( Totals const& other ) const; + Totals& operator += ( Totals const& other ); + + Totals delta( Totals const& prevTotals ) const; + + int error = 0; + Counts assertions; + Counts testCases; + }; +} + +// end catch_totals.h +#include + +namespace Catch { + + struct SectionInfo { + SectionInfo + ( SourceLineInfo const& _lineInfo, + std::string const& _name ); + + // Deprecated + SectionInfo + ( SourceLineInfo const& _lineInfo, + std::string const& _name, + std::string const& ) : SectionInfo( _lineInfo, _name ) {} + + std::string name; + std::string description; // !Deprecated: this will always be empty + SourceLineInfo lineInfo; + }; + + struct SectionEndInfo { + SectionInfo sectionInfo; + Counts prevAssertions; + double durationInSeconds; + }; + +} // end namespace Catch + +// end catch_section_info.h +// start catch_timer.h + +#include + +namespace Catch { + + auto getCurrentNanosecondsSinceEpoch() -> uint64_t; + auto getEstimatedClockResolution() -> uint64_t; + + class Timer { + uint64_t m_nanoseconds = 0; + public: + void start(); + auto getElapsedNanoseconds() const -> uint64_t; + auto getElapsedMicroseconds() const -> uint64_t; + auto getElapsedMilliseconds() const -> unsigned int; + auto getElapsedSeconds() const -> double; + }; + +} // namespace Catch + +// end catch_timer.h +#include + +namespace Catch { + + class Section : NonCopyable { + public: + Section( SectionInfo const& info ); + ~Section(); + + // This indicates whether the section should be executed or not + explicit operator bool() const; + + private: + SectionInfo m_info; + + std::string m_name; + Counts m_assertions; + bool m_sectionIncluded; + Timer m_timer; + }; + +} // end namespace Catch + +#define INTERNAL_CATCH_SECTION( ... ) \ + CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ + if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, __VA_ARGS__ ) ) \ + CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS + +#define INTERNAL_CATCH_DYNAMIC_SECTION( ... ) \ + CATCH_INTERNAL_SUPPRESS_UNUSED_WARNINGS \ + if( Catch::Section const& INTERNAL_CATCH_UNIQUE_NAME( catch_internal_Section ) = Catch::SectionInfo( CATCH_INTERNAL_LINEINFO, (Catch::ReusableStringStream() << __VA_ARGS__).str() ) ) \ + CATCH_INTERNAL_UNSUPPRESS_UNUSED_WARNINGS + +// end catch_section.h +// start catch_benchmark.h + +#include +#include + +namespace Catch { + + class BenchmarkLooper { + + std::string m_name; + std::size_t m_count = 0; + std::size_t m_iterationsToRun = 1; + uint64_t m_resolution; + Timer m_timer; + + static auto getResolution() -> uint64_t; + public: + // Keep most of this inline as it's on the code path that is being timed + BenchmarkLooper( StringRef name ) + : m_name( name ), + m_resolution( getResolution() ) + { + reportStart(); + m_timer.start(); + } + + explicit operator bool() { + if( m_count < m_iterationsToRun ) + return true; + return needsMoreIterations(); + } + + void increment() { + ++m_count; + } + + void reportStart(); + auto needsMoreIterations() -> bool; + }; + +} // end namespace Catch + +#define BENCHMARK( name ) \ + for( Catch::BenchmarkLooper looper( name ); looper; looper.increment() ) + +// end catch_benchmark.h +// start catch_interfaces_exception.h + +// start catch_interfaces_registry_hub.h + +#include +#include + +namespace Catch { + + class TestCase; + struct ITestCaseRegistry; + struct IExceptionTranslatorRegistry; + struct IExceptionTranslator; + struct IReporterRegistry; + struct IReporterFactory; + struct ITagAliasRegistry; + class StartupExceptionRegistry; + + using IReporterFactoryPtr = std::shared_ptr; + + struct IRegistryHub { + virtual ~IRegistryHub(); + + virtual IReporterRegistry const& getReporterRegistry() const = 0; + virtual ITestCaseRegistry const& getTestCaseRegistry() const = 0; + virtual ITagAliasRegistry const& getTagAliasRegistry() const = 0; + + virtual IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const = 0; + + virtual StartupExceptionRegistry const& getStartupExceptionRegistry() const = 0; + }; + + struct IMutableRegistryHub { + virtual ~IMutableRegistryHub(); + virtual void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) = 0; + virtual void registerListener( IReporterFactoryPtr const& factory ) = 0; + virtual void registerTest( TestCase const& testInfo ) = 0; + virtual void registerTranslator( const IExceptionTranslator* translator ) = 0; + virtual void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) = 0; + virtual void registerStartupException() noexcept = 0; + }; + + IRegistryHub const& getRegistryHub(); + IMutableRegistryHub& getMutableRegistryHub(); + void cleanUp(); + std::string translateActiveException(); + +} + +// end catch_interfaces_registry_hub.h +#if defined(CATCH_CONFIG_DISABLE) + #define INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( translatorName, signature) \ + static std::string translatorName( signature ) +#endif + +#include +#include +#include + +namespace Catch { + using exceptionTranslateFunction = std::string(*)(); + + struct IExceptionTranslator; + using ExceptionTranslators = std::vector>; + + struct IExceptionTranslator { + virtual ~IExceptionTranslator(); + virtual std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const = 0; + }; + + struct IExceptionTranslatorRegistry { + virtual ~IExceptionTranslatorRegistry(); + + virtual std::string translateActiveException() const = 0; + }; + + class ExceptionTranslatorRegistrar { + template + class ExceptionTranslator : public IExceptionTranslator { + public: + + ExceptionTranslator( std::string(*translateFunction)( T& ) ) + : m_translateFunction( translateFunction ) + {} + + std::string translate( ExceptionTranslators::const_iterator it, ExceptionTranslators::const_iterator itEnd ) const override { + try { + if( it == itEnd ) + std::rethrow_exception(std::current_exception()); + else + return (*it)->translate( it+1, itEnd ); + } + catch( T& ex ) { + return m_translateFunction( ex ); + } + } + + protected: + std::string(*m_translateFunction)( T& ); + }; + + public: + template + ExceptionTranslatorRegistrar( std::string(*translateFunction)( T& ) ) { + getMutableRegistryHub().registerTranslator + ( new ExceptionTranslator( translateFunction ) ); + } + }; +} + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_TRANSLATE_EXCEPTION2( translatorName, signature ) \ + static std::string translatorName( signature ); \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::ExceptionTranslatorRegistrar INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionRegistrar )( &translatorName ); } \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS \ + static std::string translatorName( signature ) + +#define INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION2( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature ) + +// end catch_interfaces_exception.h +// start catch_approx.h + +#include + +namespace Catch { +namespace Detail { + + class Approx { + private: + bool equalityComparisonImpl(double other) const; + // Validates the new margin (margin >= 0) + // out-of-line to avoid including stdexcept in the header + void setMargin(double margin); + // Validates the new epsilon (0 < epsilon < 1) + // out-of-line to avoid including stdexcept in the header + void setEpsilon(double epsilon); + + public: + explicit Approx ( double value ); + + static Approx custom(); + + Approx operator-() const; + + template ::value>::type> + Approx operator()( T const& value ) { + Approx approx( static_cast(value) ); + approx.m_epsilon = m_epsilon; + approx.m_margin = m_margin; + approx.m_scale = m_scale; + return approx; + } + + template ::value>::type> + explicit Approx( T const& value ): Approx(static_cast(value)) + {} + + template ::value>::type> + friend bool operator == ( const T& lhs, Approx const& rhs ) { + auto lhs_v = static_cast(lhs); + return rhs.equalityComparisonImpl(lhs_v); + } + + template ::value>::type> + friend bool operator == ( Approx const& lhs, const T& rhs ) { + return operator==( rhs, lhs ); + } + + template ::value>::type> + friend bool operator != ( T const& lhs, Approx const& rhs ) { + return !operator==( lhs, rhs ); + } + + template ::value>::type> + friend bool operator != ( Approx const& lhs, T const& rhs ) { + return !operator==( rhs, lhs ); + } + + template ::value>::type> + friend bool operator <= ( T const& lhs, Approx const& rhs ) { + return static_cast(lhs) < rhs.m_value || lhs == rhs; + } + + template ::value>::type> + friend bool operator <= ( Approx const& lhs, T const& rhs ) { + return lhs.m_value < static_cast(rhs) || lhs == rhs; + } + + template ::value>::type> + friend bool operator >= ( T const& lhs, Approx const& rhs ) { + return static_cast(lhs) > rhs.m_value || lhs == rhs; + } + + template ::value>::type> + friend bool operator >= ( Approx const& lhs, T const& rhs ) { + return lhs.m_value > static_cast(rhs) || lhs == rhs; + } + + template ::value>::type> + Approx& epsilon( T const& newEpsilon ) { + double epsilonAsDouble = static_cast(newEpsilon); + setEpsilon(epsilonAsDouble); + return *this; + } + + template ::value>::type> + Approx& margin( T const& newMargin ) { + double marginAsDouble = static_cast(newMargin); + setMargin(marginAsDouble); + return *this; + } + + template ::value>::type> + Approx& scale( T const& newScale ) { + m_scale = static_cast(newScale); + return *this; + } + + std::string toString() const; + + private: + double m_epsilon; + double m_margin; + double m_scale; + double m_value; + }; +} // end namespace Detail + +namespace literals { + Detail::Approx operator "" _a(long double val); + Detail::Approx operator "" _a(unsigned long long val); +} // end namespace literals + +template<> +struct StringMaker { + static std::string convert(Catch::Detail::Approx const& value); +}; + +} // end namespace Catch + +// end catch_approx.h +// start catch_string_manip.h + +#include +#include + +namespace Catch { + + bool startsWith( std::string const& s, std::string const& prefix ); + bool startsWith( std::string const& s, char prefix ); + bool endsWith( std::string const& s, std::string const& suffix ); + bool endsWith( std::string const& s, char suffix ); + bool contains( std::string const& s, std::string const& infix ); + void toLowerInPlace( std::string& s ); + std::string toLower( std::string const& s ); + std::string trim( std::string const& str ); + bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ); + + struct pluralise { + pluralise( std::size_t count, std::string const& label ); + + friend std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ); + + std::size_t m_count; + std::string m_label; + }; +} + +// end catch_string_manip.h +#ifndef CATCH_CONFIG_DISABLE_MATCHERS +// start catch_capture_matchers.h + +// start catch_matchers.h + +#include +#include + +namespace Catch { +namespace Matchers { + namespace Impl { + + template struct MatchAllOf; + template struct MatchAnyOf; + template struct MatchNotOf; + + class MatcherUntypedBase { + public: + MatcherUntypedBase() = default; + MatcherUntypedBase ( MatcherUntypedBase const& ) = default; + MatcherUntypedBase& operator = ( MatcherUntypedBase const& ) = delete; + std::string toString() const; + + protected: + virtual ~MatcherUntypedBase(); + virtual std::string describe() const = 0; + mutable std::string m_cachedToString; + }; + +#ifdef __clang__ +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wnon-virtual-dtor" +#endif + + template + struct MatcherMethod { + virtual bool match( ObjectT const& arg ) const = 0; + }; + +#ifdef __clang__ +# pragma clang diagnostic pop +#endif + + template + struct MatcherBase : MatcherUntypedBase, MatcherMethod { + + MatchAllOf operator && ( MatcherBase const& other ) const; + MatchAnyOf operator || ( MatcherBase const& other ) const; + MatchNotOf operator ! () const; + }; + + template + struct MatchAllOf : MatcherBase { + bool match( ArgT const& arg ) const override { + for( auto matcher : m_matchers ) { + if (!matcher->match(arg)) + return false; + } + return true; + } + std::string describe() const override { + std::string description; + description.reserve( 4 + m_matchers.size()*32 ); + description += "( "; + bool first = true; + for( auto matcher : m_matchers ) { + if( first ) + first = false; + else + description += " and "; + description += matcher->toString(); + } + description += " )"; + return description; + } + + MatchAllOf& operator && ( MatcherBase const& other ) { + m_matchers.push_back( &other ); + return *this; + } + + std::vector const*> m_matchers; + }; + template + struct MatchAnyOf : MatcherBase { + + bool match( ArgT const& arg ) const override { + for( auto matcher : m_matchers ) { + if (matcher->match(arg)) + return true; + } + return false; + } + std::string describe() const override { + std::string description; + description.reserve( 4 + m_matchers.size()*32 ); + description += "( "; + bool first = true; + for( auto matcher : m_matchers ) { + if( first ) + first = false; + else + description += " or "; + description += matcher->toString(); + } + description += " )"; + return description; + } + + MatchAnyOf& operator || ( MatcherBase const& other ) { + m_matchers.push_back( &other ); + return *this; + } + + std::vector const*> m_matchers; + }; + + template + struct MatchNotOf : MatcherBase { + + MatchNotOf( MatcherBase const& underlyingMatcher ) : m_underlyingMatcher( underlyingMatcher ) {} + + bool match( ArgT const& arg ) const override { + return !m_underlyingMatcher.match( arg ); + } + + std::string describe() const override { + return "not " + m_underlyingMatcher.toString(); + } + MatcherBase const& m_underlyingMatcher; + }; + + template + MatchAllOf MatcherBase::operator && ( MatcherBase const& other ) const { + return MatchAllOf() && *this && other; + } + template + MatchAnyOf MatcherBase::operator || ( MatcherBase const& other ) const { + return MatchAnyOf() || *this || other; + } + template + MatchNotOf MatcherBase::operator ! () const { + return MatchNotOf( *this ); + } + + } // namespace Impl + +} // namespace Matchers + +using namespace Matchers; +using Matchers::Impl::MatcherBase; + +} // namespace Catch + +// end catch_matchers.h +// start catch_matchers_floating.h + +#include +#include + +namespace Catch { +namespace Matchers { + + namespace Floating { + + enum class FloatingPointKind : uint8_t; + + struct WithinAbsMatcher : MatcherBase { + WithinAbsMatcher(double target, double margin); + bool match(double const& matchee) const override; + std::string describe() const override; + private: + double m_target; + double m_margin; + }; + + struct WithinUlpsMatcher : MatcherBase { + WithinUlpsMatcher(double target, int ulps, FloatingPointKind baseType); + bool match(double const& matchee) const override; + std::string describe() const override; + private: + double m_target; + int m_ulps; + FloatingPointKind m_type; + }; + + } // namespace Floating + + // The following functions create the actual matcher objects. + // This allows the types to be inferred + Floating::WithinUlpsMatcher WithinULP(double target, int maxUlpDiff); + Floating::WithinUlpsMatcher WithinULP(float target, int maxUlpDiff); + Floating::WithinAbsMatcher WithinAbs(double target, double margin); + +} // namespace Matchers +} // namespace Catch + +// end catch_matchers_floating.h +// start catch_matchers_generic.hpp + +#include +#include + +namespace Catch { +namespace Matchers { +namespace Generic { + +namespace Detail { + std::string finalizeDescription(const std::string& desc); +} + +template +class PredicateMatcher : public MatcherBase { + std::function m_predicate; + std::string m_description; +public: + + PredicateMatcher(std::function const& elem, std::string const& descr) + :m_predicate(std::move(elem)), + m_description(Detail::finalizeDescription(descr)) + {} + + bool match( T const& item ) const override { + return m_predicate(item); + } + + std::string describe() const override { + return m_description; + } +}; + +} // namespace Generic + + // The following functions create the actual matcher objects. + // The user has to explicitly specify type to the function, because + // inferring std::function is hard (but possible) and + // requires a lot of TMP. + template + Generic::PredicateMatcher Predicate(std::function const& predicate, std::string const& description = "") { + return Generic::PredicateMatcher(predicate, description); + } + +} // namespace Matchers +} // namespace Catch + +// end catch_matchers_generic.hpp +// start catch_matchers_string.h + +#include + +namespace Catch { +namespace Matchers { + + namespace StdString { + + struct CasedString + { + CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity ); + std::string adjustString( std::string const& str ) const; + std::string caseSensitivitySuffix() const; + + CaseSensitive::Choice m_caseSensitivity; + std::string m_str; + }; + + struct StringMatcherBase : MatcherBase { + StringMatcherBase( std::string const& operation, CasedString const& comparator ); + std::string describe() const override; + + CasedString m_comparator; + std::string m_operation; + }; + + struct EqualsMatcher : StringMatcherBase { + EqualsMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct ContainsMatcher : StringMatcherBase { + ContainsMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct StartsWithMatcher : StringMatcherBase { + StartsWithMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + struct EndsWithMatcher : StringMatcherBase { + EndsWithMatcher( CasedString const& comparator ); + bool match( std::string const& source ) const override; + }; + + struct RegexMatcher : MatcherBase { + RegexMatcher( std::string regex, CaseSensitive::Choice caseSensitivity ); + bool match( std::string const& matchee ) const override; + std::string describe() const override; + + private: + std::string m_regex; + CaseSensitive::Choice m_caseSensitivity; + }; + + } // namespace StdString + + // The following functions create the actual matcher objects. + // This allows the types to be inferred + + StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + StdString::RegexMatcher Matches( std::string const& regex, CaseSensitive::Choice caseSensitivity = CaseSensitive::Yes ); + +} // namespace Matchers +} // namespace Catch + +// end catch_matchers_string.h +// start catch_matchers_vector.h + +#include + +namespace Catch { +namespace Matchers { + + namespace Vector { + namespace Detail { + template + size_t count(InputIterator first, InputIterator last, T const& item) { + size_t cnt = 0; + for (; first != last; ++first) { + if (*first == item) { + ++cnt; + } + } + return cnt; + } + template + bool contains(InputIterator first, InputIterator last, T const& item) { + for (; first != last; ++first) { + if (*first == item) { + return true; + } + } + return false; + } + } + + template + struct ContainsElementMatcher : MatcherBase> { + + ContainsElementMatcher(T const &comparator) : m_comparator( comparator) {} + + bool match(std::vector const &v) const override { + for (auto const& el : v) { + if (el == m_comparator) { + return true; + } + } + return false; + } + + std::string describe() const override { + return "Contains: " + ::Catch::Detail::stringify( m_comparator ); + } + + T const& m_comparator; + }; + + template + struct ContainsMatcher : MatcherBase> { + + ContainsMatcher(std::vector const &comparator) : m_comparator( comparator ) {} + + bool match(std::vector const &v) const override { + // !TBD: see note in EqualsMatcher + if (m_comparator.size() > v.size()) + return false; + for (auto const& comparator : m_comparator) { + auto present = false; + for (const auto& el : v) { + if (el == comparator) { + present = true; + break; + } + } + if (!present) { + return false; + } + } + return true; + } + std::string describe() const override { + return "Contains: " + ::Catch::Detail::stringify( m_comparator ); + } + + std::vector const& m_comparator; + }; + + template + struct EqualsMatcher : MatcherBase> { + + EqualsMatcher(std::vector const &comparator) : m_comparator( comparator ) {} + + bool match(std::vector const &v) const override { + // !TBD: This currently works if all elements can be compared using != + // - a more general approach would be via a compare template that defaults + // to using !=. but could be specialised for, e.g. std::vector etc + // - then just call that directly + if (m_comparator.size() != v.size()) + return false; + for (std::size_t i = 0; i < v.size(); ++i) + if (m_comparator[i] != v[i]) + return false; + return true; + } + std::string describe() const override { + return "Equals: " + ::Catch::Detail::stringify( m_comparator ); + } + std::vector const& m_comparator; + }; + + template + struct UnorderedEqualsMatcher : MatcherBase> { + UnorderedEqualsMatcher(std::vector const& target) : m_target(target) {} + bool match(std::vector const& vec) const override { + // Note: This is a reimplementation of std::is_permutation, + // because I don't want to include inside the common path + if (m_target.size() != vec.size()) { + return false; + } + auto lfirst = m_target.begin(), llast = m_target.end(); + auto rfirst = vec.begin(), rlast = vec.end(); + // Cut common prefix to optimize checking of permuted parts + while (lfirst != llast && *lfirst == *rfirst) { + ++lfirst; ++rfirst; + } + if (lfirst == llast) { + return true; + } + + for (auto mid = lfirst; mid != llast; ++mid) { + // Skip already counted items + if (Detail::contains(lfirst, mid, *mid)) { + continue; + } + size_t num_vec = Detail::count(rfirst, rlast, *mid); + if (num_vec == 0 || Detail::count(lfirst, llast, *mid) != num_vec) { + return false; + } + } + + return true; + } + + std::string describe() const override { + return "UnorderedEquals: " + ::Catch::Detail::stringify(m_target); + } + private: + std::vector const& m_target; + }; + + } // namespace Vector + + // The following functions create the actual matcher objects. + // This allows the types to be inferred + + template + Vector::ContainsMatcher Contains( std::vector const& comparator ) { + return Vector::ContainsMatcher( comparator ); + } + + template + Vector::ContainsElementMatcher VectorContains( T const& comparator ) { + return Vector::ContainsElementMatcher( comparator ); + } + + template + Vector::EqualsMatcher Equals( std::vector const& comparator ) { + return Vector::EqualsMatcher( comparator ); + } + + template + Vector::UnorderedEqualsMatcher UnorderedEquals(std::vector const& target) { + return Vector::UnorderedEqualsMatcher(target); + } + +} // namespace Matchers +} // namespace Catch + +// end catch_matchers_vector.h +namespace Catch { + + template + class MatchExpr : public ITransientExpression { + ArgT const& m_arg; + MatcherT m_matcher; + StringRef m_matcherString; + public: + MatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef const& matcherString ) + : ITransientExpression{ true, matcher.match( arg ) }, + m_arg( arg ), + m_matcher( matcher ), + m_matcherString( matcherString ) + {} + + void streamReconstructedExpression( std::ostream &os ) const override { + auto matcherAsString = m_matcher.toString(); + os << Catch::Detail::stringify( m_arg ) << ' '; + if( matcherAsString == Detail::unprintableString ) + os << m_matcherString; + else + os << matcherAsString; + } + }; + + using StringMatcher = Matchers::Impl::MatcherBase; + + void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ); + + template + auto makeMatchExpr( ArgT const& arg, MatcherT const& matcher, StringRef const& matcherString ) -> MatchExpr { + return MatchExpr( arg, matcher, matcherString ); + } + +} // namespace Catch + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CHECK_THAT( macroName, matcher, resultDisposition, arg ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(arg) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ + INTERNAL_CATCH_TRY { \ + catchAssertionHandler.handleExpr( Catch::makeMatchExpr( arg, matcher, #matcher##_catch_sr ) ); \ + } INTERNAL_CATCH_CATCH( catchAssertionHandler ) \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +/////////////////////////////////////////////////////////////////////////////// +#define INTERNAL_CATCH_THROWS_MATCHES( macroName, exceptionType, resultDisposition, matcher, ... ) \ + do { \ + Catch::AssertionHandler catchAssertionHandler( macroName##_catch_sr, CATCH_INTERNAL_LINEINFO, CATCH_INTERNAL_STRINGIFY(__VA_ARGS__) ", " CATCH_INTERNAL_STRINGIFY(exceptionType) ", " CATCH_INTERNAL_STRINGIFY(matcher), resultDisposition ); \ + if( catchAssertionHandler.allowThrows() ) \ + try { \ + static_cast(__VA_ARGS__ ); \ + catchAssertionHandler.handleUnexpectedExceptionNotThrown(); \ + } \ + catch( exceptionType const& ex ) { \ + catchAssertionHandler.handleExpr( Catch::makeMatchExpr( ex, matcher, #matcher##_catch_sr ) ); \ + } \ + catch( ... ) { \ + catchAssertionHandler.handleUnexpectedInflightException(); \ + } \ + else \ + catchAssertionHandler.handleThrowingCallSkipped(); \ + INTERNAL_CATCH_REACT( catchAssertionHandler ) \ + } while( false ) + +// end catch_capture_matchers.h +#endif +// start catch_generators.hpp + +// start catch_interfaces_generatortracker.h + + +#include + +namespace Catch { + + namespace Generators { + class GeneratorBase { + protected: + size_t m_size = 0; + + public: + GeneratorBase( size_t size ) : m_size( size ) {} + virtual ~GeneratorBase(); + auto size() const -> size_t { return m_size; } + }; + using GeneratorBasePtr = std::unique_ptr; + + } // namespace Generators + + struct IGeneratorTracker { + virtual ~IGeneratorTracker(); + virtual auto hasGenerator() const -> bool = 0; + virtual auto getGenerator() const -> Generators::GeneratorBasePtr const& = 0; + virtual void setGenerator( Generators::GeneratorBasePtr&& generator ) = 0; + virtual auto getIndex() const -> std::size_t = 0; + }; + +} // namespace Catch + +// end catch_interfaces_generatortracker.h +// start catch_enforce.h + +#include + +namespace Catch { +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + template + [[noreturn]] + void throw_exception(Ex const& e) { + throw e; + } +#else // ^^ Exceptions are enabled // Exceptions are disabled vv + [[noreturn]] + void throw_exception(std::exception const& e); +#endif +} // namespace Catch; + +#define CATCH_PREPARE_EXCEPTION( type, msg ) \ + type( ( Catch::ReusableStringStream() << msg ).str() ) +#define CATCH_INTERNAL_ERROR( msg ) \ + Catch::throw_exception(CATCH_PREPARE_EXCEPTION( std::logic_error, CATCH_INTERNAL_LINEINFO << ": Internal Catch error: " << msg)) +#define CATCH_ERROR( msg ) \ + Catch::throw_exception(CATCH_PREPARE_EXCEPTION( std::domain_error, msg )) +#define CATCH_RUNTIME_ERROR( msg ) \ + Catch::throw_exception(CATCH_PREPARE_EXCEPTION( std::runtime_error, msg )) +#define CATCH_ENFORCE( condition, msg ) \ + do{ if( !(condition) ) CATCH_ERROR( msg ); } while(false) + +// end catch_enforce.h +#include +#include +#include + +#include + +namespace Catch { +namespace Generators { + + // !TBD move this into its own location? + namespace pf{ + template + std::unique_ptr make_unique( Args&&... args ) { + return std::unique_ptr(new T(std::forward(args)...)); + } + } + + template + struct IGenerator { + virtual ~IGenerator() {} + virtual auto get( size_t index ) const -> T = 0; + }; + + template + class SingleValueGenerator : public IGenerator { + T m_value; + public: + SingleValueGenerator( T const& value ) : m_value( value ) {} + + auto get( size_t ) const -> T override { + return m_value; + } + }; + + template + class FixedValuesGenerator : public IGenerator { + std::vector m_values; + + public: + FixedValuesGenerator( std::initializer_list values ) : m_values( values ) {} + + auto get( size_t index ) const -> T override { + return m_values[index]; + } + }; + + template + class RangeGenerator : public IGenerator { + T const m_first; + T const m_last; + + public: + RangeGenerator( T const& first, T const& last ) : m_first( first ), m_last( last ) { + assert( m_last > m_first ); + } + + auto get( size_t index ) const -> T override { + // ToDo:: introduce a safe cast to catch potential overflows + return static_cast(m_first+index); + } + }; + + template + struct NullGenerator : IGenerator { + auto get( size_t ) const -> T override { + CATCH_INTERNAL_ERROR("A Null Generator is always empty"); + } + }; + + template + class Generator { + std::unique_ptr> m_generator; + size_t m_size; + + public: + Generator( size_t size, std::unique_ptr> generator ) + : m_generator( std::move( generator ) ), + m_size( size ) + {} + + auto size() const -> size_t { return m_size; } + auto operator[]( size_t index ) const -> T { + assert( index < m_size ); + return m_generator->get( index ); + } + }; + + std::vector randomiseIndices( size_t selectionSize, size_t sourceSize ); + + template + class GeneratorRandomiser : public IGenerator { + Generator m_baseGenerator; + + std::vector m_indices; + public: + GeneratorRandomiser( Generator&& baseGenerator, size_t numberOfItems ) + : m_baseGenerator( std::move( baseGenerator ) ), + m_indices( randomiseIndices( numberOfItems, m_baseGenerator.size() ) ) + {} + + auto get( size_t index ) const -> T override { + return m_baseGenerator[m_indices[index]]; + } + }; + + template + struct RequiresASpecialisationFor; + + template + auto all() -> Generator { return RequiresASpecialisationFor(); } + + template<> + auto all() -> Generator; + + template + auto range( T const& first, T const& last ) -> Generator { + return Generator( (last-first), pf::make_unique>( first, last ) ); + } + + template + auto random( T const& first, T const& last ) -> Generator { + auto gen = range( first, last ); + auto size = gen.size(); + + return Generator( size, pf::make_unique>( std::move( gen ), size ) ); + } + template + auto random( size_t size ) -> Generator { + return Generator( size, pf::make_unique>( all(), size ) ); + } + + template + auto values( std::initializer_list values ) -> Generator { + return Generator( values.size(), pf::make_unique>( values ) ); + } + template + auto value( T const& val ) -> Generator { + return Generator( 1, pf::make_unique>( val ) ); + } + + template + auto as() -> Generator { + return Generator( 0, pf::make_unique>() ); + } + + template + auto table( std::initializer_list>&& tuples ) -> Generator> { + return values>( std::forward>>( tuples ) ); + } + + template + struct Generators : GeneratorBase { + std::vector> m_generators; + + using type = T; + + Generators() : GeneratorBase( 0 ) {} + + void populate( T&& val ) { + m_size += 1; + m_generators.emplace_back( value( std::move( val ) ) ); + } + template + void populate( U&& val ) { + populate( T( std::move( val ) ) ); + } + void populate( Generator&& generator ) { + m_size += generator.size(); + m_generators.emplace_back( std::move( generator ) ); + } + + template + void populate( U&& valueOrGenerator, Gs... moreGenerators ) { + populate( std::forward( valueOrGenerator ) ); + populate( std::forward( moreGenerators )... ); + } + + auto operator[]( size_t index ) const -> T { + size_t sizes = 0; + for( auto const& gen : m_generators ) { + auto localIndex = index-sizes; + sizes += gen.size(); + if( index < sizes ) + return gen[localIndex]; + } + CATCH_INTERNAL_ERROR("Index '" << index << "' is out of range (" << sizes << ')'); + } + }; + + template + auto makeGenerators( Generator&& generator, Gs... moreGenerators ) -> Generators { + Generators generators; + generators.m_generators.reserve( 1+sizeof...(Gs) ); + generators.populate( std::move( generator ), std::forward( moreGenerators )... ); + return generators; + } + template + auto makeGenerators( Generator&& generator ) -> Generators { + Generators generators; + generators.populate( std::move( generator ) ); + return generators; + } + template + auto makeGenerators( T&& val, Gs... moreGenerators ) -> Generators { + return makeGenerators( value( std::forward( val ) ), std::forward( moreGenerators )... ); + } + template + auto makeGenerators( U&& val, Gs... moreGenerators ) -> Generators { + return makeGenerators( value( T( std::forward( val ) ) ), std::forward( moreGenerators )... ); + } + + auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker&; + + template + // Note: The type after -> is weird, because VS2015 cannot parse + // the expression used in the typedef inside, when it is in + // return type. Yeah, ¯\_(ツ)_/¯ + auto generate( SourceLineInfo const& lineInfo, L const& generatorExpression ) -> decltype(std::declval()[0]) { + using UnderlyingType = typename decltype(generatorExpression())::type; + + IGeneratorTracker& tracker = acquireGeneratorTracker( lineInfo ); + if( !tracker.hasGenerator() ) + tracker.setGenerator( pf::make_unique>( generatorExpression() ) ); + + auto const& generator = static_cast const&>( *tracker.getGenerator() ); + return generator[tracker.getIndex()]; + } + +} // namespace Generators +} // namespace Catch + +#define GENERATE( ... ) \ + Catch::Generators::generate( CATCH_INTERNAL_LINEINFO, []{ using namespace Catch::Generators; return makeGenerators( __VA_ARGS__ ); } ) + +// end catch_generators.hpp + +// These files are included here so the single_include script doesn't put them +// in the conditionally compiled sections +// start catch_test_case_info.h + +#include +#include +#include + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + +namespace Catch { + + struct ITestInvoker; + + struct TestCaseInfo { + enum SpecialProperties{ + None = 0, + IsHidden = 1 << 1, + ShouldFail = 1 << 2, + MayFail = 1 << 3, + Throws = 1 << 4, + NonPortable = 1 << 5, + Benchmark = 1 << 6 + }; + + TestCaseInfo( std::string const& _name, + std::string const& _className, + std::string const& _description, + std::vector const& _tags, + SourceLineInfo const& _lineInfo ); + + friend void setTags( TestCaseInfo& testCaseInfo, std::vector tags ); + + bool isHidden() const; + bool throws() const; + bool okToFail() const; + bool expectedToFail() const; + + std::string tagsAsString() const; + + std::string name; + std::string className; + std::string description; + std::vector tags; + std::vector lcaseTags; + SourceLineInfo lineInfo; + SpecialProperties properties; + }; + + class TestCase : public TestCaseInfo { + public: + + TestCase( ITestInvoker* testCase, TestCaseInfo&& info ); + + TestCase withName( std::string const& _newName ) const; + + void invoke() const; + + TestCaseInfo const& getTestCaseInfo() const; + + bool operator == ( TestCase const& other ) const; + bool operator < ( TestCase const& other ) const; + + private: + std::shared_ptr test; + }; + + TestCase makeTestCase( ITestInvoker* testCase, + std::string const& className, + NameAndTags const& nameAndTags, + SourceLineInfo const& lineInfo ); +} + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +// end catch_test_case_info.h +// start catch_interfaces_runner.h + +namespace Catch { + + struct IRunner { + virtual ~IRunner(); + virtual bool aborting() const = 0; + }; +} + +// end catch_interfaces_runner.h + +#ifdef __OBJC__ +// start catch_objc.hpp + +#import + +#include + +// NB. Any general catch headers included here must be included +// in catch.hpp first to make sure they are included by the single +// header for non obj-usage + +/////////////////////////////////////////////////////////////////////////////// +// This protocol is really only here for (self) documenting purposes, since +// all its methods are optional. +@protocol OcFixture + +@optional + +-(void) setUp; +-(void) tearDown; + +@end + +namespace Catch { + + class OcMethod : public ITestInvoker { + + public: + OcMethod( Class cls, SEL sel ) : m_cls( cls ), m_sel( sel ) {} + + virtual void invoke() const { + id obj = [[m_cls alloc] init]; + + performOptionalSelector( obj, @selector(setUp) ); + performOptionalSelector( obj, m_sel ); + performOptionalSelector( obj, @selector(tearDown) ); + + arcSafeRelease( obj ); + } + private: + virtual ~OcMethod() {} + + Class m_cls; + SEL m_sel; + }; + + namespace Detail{ + + inline std::string getAnnotation( Class cls, + std::string const& annotationName, + std::string const& testCaseName ) { + NSString* selStr = [[NSString alloc] initWithFormat:@"Catch_%s_%s", annotationName.c_str(), testCaseName.c_str()]; + SEL sel = NSSelectorFromString( selStr ); + arcSafeRelease( selStr ); + id value = performOptionalSelector( cls, sel ); + if( value ) + return [(NSString*)value UTF8String]; + return ""; + } + } + + inline std::size_t registerTestMethods() { + std::size_t noTestMethods = 0; + int noClasses = objc_getClassList( nullptr, 0 ); + + Class* classes = (CATCH_UNSAFE_UNRETAINED Class *)malloc( sizeof(Class) * noClasses); + objc_getClassList( classes, noClasses ); + + for( int c = 0; c < noClasses; c++ ) { + Class cls = classes[c]; + { + u_int count; + Method* methods = class_copyMethodList( cls, &count ); + for( u_int m = 0; m < count ; m++ ) { + SEL selector = method_getName(methods[m]); + std::string methodName = sel_getName(selector); + if( startsWith( methodName, "Catch_TestCase_" ) ) { + std::string testCaseName = methodName.substr( 15 ); + std::string name = Detail::getAnnotation( cls, "Name", testCaseName ); + std::string desc = Detail::getAnnotation( cls, "Description", testCaseName ); + const char* className = class_getName( cls ); + + getMutableRegistryHub().registerTest( makeTestCase( new OcMethod( cls, selector ), className, NameAndTags( name.c_str(), desc.c_str() ), SourceLineInfo("",0) ) ); + noTestMethods++; + } + } + free(methods); + } + } + return noTestMethods; + } + +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) + + namespace Matchers { + namespace Impl { + namespace NSStringMatchers { + + struct StringHolder : MatcherBase{ + StringHolder( NSString* substr ) : m_substr( [substr copy] ){} + StringHolder( StringHolder const& other ) : m_substr( [other.m_substr copy] ){} + StringHolder() { + arcSafeRelease( m_substr ); + } + + bool match( NSString* arg ) const override { + return false; + } + + NSString* CATCH_ARC_STRONG m_substr; + }; + + struct Equals : StringHolder { + Equals( NSString* substr ) : StringHolder( substr ){} + + bool match( NSString* str ) const override { + return (str != nil || m_substr == nil ) && + [str isEqualToString:m_substr]; + } + + std::string describe() const override { + return "equals string: " + Catch::Detail::stringify( m_substr ); + } + }; + + struct Contains : StringHolder { + Contains( NSString* substr ) : StringHolder( substr ){} + + bool match( NSString* str ) const { + return (str != nil || m_substr == nil ) && + [str rangeOfString:m_substr].location != NSNotFound; + } + + std::string describe() const override { + return "contains string: " + Catch::Detail::stringify( m_substr ); + } + }; + + struct StartsWith : StringHolder { + StartsWith( NSString* substr ) : StringHolder( substr ){} + + bool match( NSString* str ) const override { + return (str != nil || m_substr == nil ) && + [str rangeOfString:m_substr].location == 0; + } + + std::string describe() const override { + return "starts with: " + Catch::Detail::stringify( m_substr ); + } + }; + struct EndsWith : StringHolder { + EndsWith( NSString* substr ) : StringHolder( substr ){} + + bool match( NSString* str ) const override { + return (str != nil || m_substr == nil ) && + [str rangeOfString:m_substr].location == [str length] - [m_substr length]; + } + + std::string describe() const override { + return "ends with: " + Catch::Detail::stringify( m_substr ); + } + }; + + } // namespace NSStringMatchers + } // namespace Impl + + inline Impl::NSStringMatchers::Equals + Equals( NSString* substr ){ return Impl::NSStringMatchers::Equals( substr ); } + + inline Impl::NSStringMatchers::Contains + Contains( NSString* substr ){ return Impl::NSStringMatchers::Contains( substr ); } + + inline Impl::NSStringMatchers::StartsWith + StartsWith( NSString* substr ){ return Impl::NSStringMatchers::StartsWith( substr ); } + + inline Impl::NSStringMatchers::EndsWith + EndsWith( NSString* substr ){ return Impl::NSStringMatchers::EndsWith( substr ); } + + } // namespace Matchers + + using namespace Matchers; + +#endif // CATCH_CONFIG_DISABLE_MATCHERS + +} // namespace Catch + +/////////////////////////////////////////////////////////////////////////////// +#define OC_MAKE_UNIQUE_NAME( root, uniqueSuffix ) root##uniqueSuffix +#define OC_TEST_CASE2( name, desc, uniqueSuffix ) \ ++(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Name_test_, uniqueSuffix ) \ +{ \ +return @ name; \ +} \ ++(NSString*) OC_MAKE_UNIQUE_NAME( Catch_Description_test_, uniqueSuffix ) \ +{ \ +return @ desc; \ +} \ +-(void) OC_MAKE_UNIQUE_NAME( Catch_TestCase_test_, uniqueSuffix ) + +#define OC_TEST_CASE( name, desc ) OC_TEST_CASE2( name, desc, __LINE__ ) + +// end catch_objc.hpp +#endif + +#ifdef CATCH_CONFIG_EXTERNAL_INTERFACES +// start catch_external_interfaces.h + +// start catch_reporter_bases.hpp + +// start catch_interfaces_reporter.h + +// start catch_config.hpp + +// start catch_test_spec_parser.h + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + +// start catch_test_spec.h + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wpadded" +#endif + +// start catch_wildcard_pattern.h + +namespace Catch +{ + class WildcardPattern { + enum WildcardPosition { + NoWildcard = 0, + WildcardAtStart = 1, + WildcardAtEnd = 2, + WildcardAtBothEnds = WildcardAtStart | WildcardAtEnd + }; + + public: + + WildcardPattern( std::string const& pattern, CaseSensitive::Choice caseSensitivity ); + virtual ~WildcardPattern() = default; + virtual bool matches( std::string const& str ) const; + + private: + std::string adjustCase( std::string const& str ) const; + CaseSensitive::Choice m_caseSensitivity; + WildcardPosition m_wildcard = NoWildcard; + std::string m_pattern; + }; +} + +// end catch_wildcard_pattern.h +#include +#include +#include + +namespace Catch { + + class TestSpec { + struct Pattern { + virtual ~Pattern(); + virtual bool matches( TestCaseInfo const& testCase ) const = 0; + }; + using PatternPtr = std::shared_ptr; + + class NamePattern : public Pattern { + public: + NamePattern( std::string const& name ); + virtual ~NamePattern(); + virtual bool matches( TestCaseInfo const& testCase ) const override; + private: + WildcardPattern m_wildcardPattern; + }; + + class TagPattern : public Pattern { + public: + TagPattern( std::string const& tag ); + virtual ~TagPattern(); + virtual bool matches( TestCaseInfo const& testCase ) const override; + private: + std::string m_tag; + }; + + class ExcludedPattern : public Pattern { + public: + ExcludedPattern( PatternPtr const& underlyingPattern ); + virtual ~ExcludedPattern(); + virtual bool matches( TestCaseInfo const& testCase ) const override; + private: + PatternPtr m_underlyingPattern; + }; + + struct Filter { + std::vector m_patterns; + + bool matches( TestCaseInfo const& testCase ) const; + }; + + public: + bool hasFilters() const; + bool matches( TestCaseInfo const& testCase ) const; + + private: + std::vector m_filters; + + friend class TestSpecParser; + }; +} + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +// end catch_test_spec.h +// start catch_interfaces_tag_alias_registry.h + +#include + +namespace Catch { + + struct TagAlias; + + struct ITagAliasRegistry { + virtual ~ITagAliasRegistry(); + // Nullptr if not present + virtual TagAlias const* find( std::string const& alias ) const = 0; + virtual std::string expandAliases( std::string const& unexpandedTestSpec ) const = 0; + + static ITagAliasRegistry const& get(); + }; + +} // end namespace Catch + +// end catch_interfaces_tag_alias_registry.h +namespace Catch { + + class TestSpecParser { + enum Mode{ None, Name, QuotedName, Tag, EscapedName }; + Mode m_mode = None; + bool m_exclusion = false; + std::size_t m_start = std::string::npos, m_pos = 0; + std::string m_arg; + std::vector m_escapeChars; + TestSpec::Filter m_currentFilter; + TestSpec m_testSpec; + ITagAliasRegistry const* m_tagAliases = nullptr; + + public: + TestSpecParser( ITagAliasRegistry const& tagAliases ); + + TestSpecParser& parse( std::string const& arg ); + TestSpec testSpec(); + + private: + void visitChar( char c ); + void startNewMode( Mode mode, std::size_t start ); + void escape(); + std::string subString() const; + + template + void addPattern() { + std::string token = subString(); + for( std::size_t i = 0; i < m_escapeChars.size(); ++i ) + token = token.substr( 0, m_escapeChars[i]-m_start-i ) + token.substr( m_escapeChars[i]-m_start-i+1 ); + m_escapeChars.clear(); + if( startsWith( token, "exclude:" ) ) { + m_exclusion = true; + token = token.substr( 8 ); + } + if( !token.empty() ) { + TestSpec::PatternPtr pattern = std::make_shared( token ); + if( m_exclusion ) + pattern = std::make_shared( pattern ); + m_currentFilter.m_patterns.push_back( pattern ); + } + m_exclusion = false; + m_mode = None; + } + + void addFilter(); + }; + TestSpec parseTestSpec( std::string const& arg ); + +} // namespace Catch + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +// end catch_test_spec_parser.h +// start catch_interfaces_config.h + +#include +#include +#include +#include + +namespace Catch { + + enum class Verbosity { + Quiet = 0, + Normal, + High + }; + + struct WarnAbout { enum What { + Nothing = 0x00, + NoAssertions = 0x01, + NoTests = 0x02 + }; }; + + struct ShowDurations { enum OrNot { + DefaultForReporter, + Always, + Never + }; }; + struct RunTests { enum InWhatOrder { + InDeclarationOrder, + InLexicographicalOrder, + InRandomOrder + }; }; + struct UseColour { enum YesOrNo { + Auto, + Yes, + No + }; }; + struct WaitForKeypress { enum When { + Never, + BeforeStart = 1, + BeforeExit = 2, + BeforeStartAndExit = BeforeStart | BeforeExit + }; }; + + class TestSpec; + + struct IConfig : NonCopyable { + + virtual ~IConfig(); + + virtual bool allowThrows() const = 0; + virtual std::ostream& stream() const = 0; + virtual std::string name() const = 0; + virtual bool includeSuccessfulResults() const = 0; + virtual bool shouldDebugBreak() const = 0; + virtual bool warnAboutMissingAssertions() const = 0; + virtual bool warnAboutNoTests() const = 0; + virtual int abortAfter() const = 0; + virtual bool showInvisibles() const = 0; + virtual ShowDurations::OrNot showDurations() const = 0; + virtual TestSpec const& testSpec() const = 0; + virtual bool hasTestFilters() const = 0; + virtual RunTests::InWhatOrder runOrder() const = 0; + virtual unsigned int rngSeed() const = 0; + virtual int benchmarkResolutionMultiple() const = 0; + virtual UseColour::YesOrNo useColour() const = 0; + virtual std::vector const& getSectionsToRun() const = 0; + virtual Verbosity verbosity() const = 0; + }; + + using IConfigPtr = std::shared_ptr; +} + +// end catch_interfaces_config.h +// Libstdc++ doesn't like incomplete classes for unique_ptr + +#include +#include +#include + +#ifndef CATCH_CONFIG_CONSOLE_WIDTH +#define CATCH_CONFIG_CONSOLE_WIDTH 80 +#endif + +namespace Catch { + + struct IStream; + + struct ConfigData { + bool listTests = false; + bool listTags = false; + bool listReporters = false; + bool listTestNamesOnly = false; + + bool showSuccessfulTests = false; + bool shouldDebugBreak = false; + bool noThrow = false; + bool showHelp = false; + bool showInvisibles = false; + bool filenamesAsTags = false; + bool libIdentify = false; + + int abortAfter = -1; + unsigned int rngSeed = 0; + int benchmarkResolutionMultiple = 100; + + Verbosity verbosity = Verbosity::Normal; + WarnAbout::What warnings = WarnAbout::Nothing; + ShowDurations::OrNot showDurations = ShowDurations::DefaultForReporter; + RunTests::InWhatOrder runOrder = RunTests::InDeclarationOrder; + UseColour::YesOrNo useColour = UseColour::Auto; + WaitForKeypress::When waitForKeypress = WaitForKeypress::Never; + + std::string outputFilename; + std::string name; + std::string processName; +#ifndef CATCH_CONFIG_DEFAULT_REPORTER +#define CATCH_CONFIG_DEFAULT_REPORTER "console" +#endif + std::string reporterName = CATCH_CONFIG_DEFAULT_REPORTER; +#undef CATCH_CONFIG_DEFAULT_REPORTER + + std::vector testsOrTags; + std::vector sectionsToRun; + }; + + class Config : public IConfig { + public: + + Config() = default; + Config( ConfigData const& data ); + virtual ~Config() = default; + + std::string const& getFilename() const; + + bool listTests() const; + bool listTestNamesOnly() const; + bool listTags() const; + bool listReporters() const; + + std::string getProcessName() const; + std::string const& getReporterName() const; + + std::vector const& getTestsOrTags() const; + std::vector const& getSectionsToRun() const override; + + virtual TestSpec const& testSpec() const override; + bool hasTestFilters() const override; + + bool showHelp() const; + + // IConfig interface + bool allowThrows() const override; + std::ostream& stream() const override; + std::string name() const override; + bool includeSuccessfulResults() const override; + bool warnAboutMissingAssertions() const override; + bool warnAboutNoTests() const override; + ShowDurations::OrNot showDurations() const override; + RunTests::InWhatOrder runOrder() const override; + unsigned int rngSeed() const override; + int benchmarkResolutionMultiple() const override; + UseColour::YesOrNo useColour() const override; + bool shouldDebugBreak() const override; + int abortAfter() const override; + bool showInvisibles() const override; + Verbosity verbosity() const override; + + private: + + IStream const* openStream(); + ConfigData m_data; + + std::unique_ptr m_stream; + TestSpec m_testSpec; + bool m_hasTestFilters = false; + }; + +} // end namespace Catch + +// end catch_config.hpp +// start catch_assertionresult.h + +#include + +namespace Catch { + + struct AssertionResultData + { + AssertionResultData() = delete; + + AssertionResultData( ResultWas::OfType _resultType, LazyExpression const& _lazyExpression ); + + std::string message; + mutable std::string reconstructedExpression; + LazyExpression lazyExpression; + ResultWas::OfType resultType; + + std::string reconstructExpression() const; + }; + + class AssertionResult { + public: + AssertionResult() = delete; + AssertionResult( AssertionInfo const& info, AssertionResultData const& data ); + + bool isOk() const; + bool succeeded() const; + ResultWas::OfType getResultType() const; + bool hasExpression() const; + bool hasMessage() const; + std::string getExpression() const; + std::string getExpressionInMacro() const; + bool hasExpandedExpression() const; + std::string getExpandedExpression() const; + std::string getMessage() const; + SourceLineInfo getSourceInfo() const; + StringRef getTestMacroName() const; + + //protected: + AssertionInfo m_info; + AssertionResultData m_resultData; + }; + +} // end namespace Catch + +// end catch_assertionresult.h +// start catch_option.hpp + +namespace Catch { + + // An optional type + template + class Option { + public: + Option() : nullableValue( nullptr ) {} + Option( T const& _value ) + : nullableValue( new( storage ) T( _value ) ) + {} + Option( Option const& _other ) + : nullableValue( _other ? new( storage ) T( *_other ) : nullptr ) + {} + + ~Option() { + reset(); + } + + Option& operator= ( Option const& _other ) { + if( &_other != this ) { + reset(); + if( _other ) + nullableValue = new( storage ) T( *_other ); + } + return *this; + } + Option& operator = ( T const& _value ) { + reset(); + nullableValue = new( storage ) T( _value ); + return *this; + } + + void reset() { + if( nullableValue ) + nullableValue->~T(); + nullableValue = nullptr; + } + + T& operator*() { return *nullableValue; } + T const& operator*() const { return *nullableValue; } + T* operator->() { return nullableValue; } + const T* operator->() const { return nullableValue; } + + T valueOr( T const& defaultValue ) const { + return nullableValue ? *nullableValue : defaultValue; + } + + bool some() const { return nullableValue != nullptr; } + bool none() const { return nullableValue == nullptr; } + + bool operator !() const { return nullableValue == nullptr; } + explicit operator bool() const { + return some(); + } + + private: + T *nullableValue; + alignas(alignof(T)) char storage[sizeof(T)]; + }; + +} // end namespace Catch + +// end catch_option.hpp +#include +#include +#include +#include +#include + +namespace Catch { + + struct ReporterConfig { + explicit ReporterConfig( IConfigPtr const& _fullConfig ); + + ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream ); + + std::ostream& stream() const; + IConfigPtr fullConfig() const; + + private: + std::ostream* m_stream; + IConfigPtr m_fullConfig; + }; + + struct ReporterPreferences { + bool shouldRedirectStdOut = false; + bool shouldReportAllAssertions = false; + }; + + template + struct LazyStat : Option { + LazyStat& operator=( T const& _value ) { + Option::operator=( _value ); + used = false; + return *this; + } + void reset() { + Option::reset(); + used = false; + } + bool used = false; + }; + + struct TestRunInfo { + TestRunInfo( std::string const& _name ); + std::string name; + }; + struct GroupInfo { + GroupInfo( std::string const& _name, + std::size_t _groupIndex, + std::size_t _groupsCount ); + + std::string name; + std::size_t groupIndex; + std::size_t groupsCounts; + }; + + struct AssertionStats { + AssertionStats( AssertionResult const& _assertionResult, + std::vector const& _infoMessages, + Totals const& _totals ); + + AssertionStats( AssertionStats const& ) = default; + AssertionStats( AssertionStats && ) = default; + AssertionStats& operator = ( AssertionStats const& ) = default; + AssertionStats& operator = ( AssertionStats && ) = default; + virtual ~AssertionStats(); + + AssertionResult assertionResult; + std::vector infoMessages; + Totals totals; + }; + + struct SectionStats { + SectionStats( SectionInfo const& _sectionInfo, + Counts const& _assertions, + double _durationInSeconds, + bool _missingAssertions ); + SectionStats( SectionStats const& ) = default; + SectionStats( SectionStats && ) = default; + SectionStats& operator = ( SectionStats const& ) = default; + SectionStats& operator = ( SectionStats && ) = default; + virtual ~SectionStats(); + + SectionInfo sectionInfo; + Counts assertions; + double durationInSeconds; + bool missingAssertions; + }; + + struct TestCaseStats { + TestCaseStats( TestCaseInfo const& _testInfo, + Totals const& _totals, + std::string const& _stdOut, + std::string const& _stdErr, + bool _aborting ); + + TestCaseStats( TestCaseStats const& ) = default; + TestCaseStats( TestCaseStats && ) = default; + TestCaseStats& operator = ( TestCaseStats const& ) = default; + TestCaseStats& operator = ( TestCaseStats && ) = default; + virtual ~TestCaseStats(); + + TestCaseInfo testInfo; + Totals totals; + std::string stdOut; + std::string stdErr; + bool aborting; + }; + + struct TestGroupStats { + TestGroupStats( GroupInfo const& _groupInfo, + Totals const& _totals, + bool _aborting ); + TestGroupStats( GroupInfo const& _groupInfo ); + + TestGroupStats( TestGroupStats const& ) = default; + TestGroupStats( TestGroupStats && ) = default; + TestGroupStats& operator = ( TestGroupStats const& ) = default; + TestGroupStats& operator = ( TestGroupStats && ) = default; + virtual ~TestGroupStats(); + + GroupInfo groupInfo; + Totals totals; + bool aborting; + }; + + struct TestRunStats { + TestRunStats( TestRunInfo const& _runInfo, + Totals const& _totals, + bool _aborting ); + + TestRunStats( TestRunStats const& ) = default; + TestRunStats( TestRunStats && ) = default; + TestRunStats& operator = ( TestRunStats const& ) = default; + TestRunStats& operator = ( TestRunStats && ) = default; + virtual ~TestRunStats(); + + TestRunInfo runInfo; + Totals totals; + bool aborting; + }; + + struct BenchmarkInfo { + std::string name; + }; + struct BenchmarkStats { + BenchmarkInfo info; + std::size_t iterations; + uint64_t elapsedTimeInNanoseconds; + }; + + struct IStreamingReporter { + virtual ~IStreamingReporter() = default; + + // Implementing class must also provide the following static methods: + // static std::string getDescription(); + // static std::set getSupportedVerbosities() + + virtual ReporterPreferences getPreferences() const = 0; + + virtual void noMatchingTestCases( std::string const& spec ) = 0; + + virtual void testRunStarting( TestRunInfo const& testRunInfo ) = 0; + virtual void testGroupStarting( GroupInfo const& groupInfo ) = 0; + + virtual void testCaseStarting( TestCaseInfo const& testInfo ) = 0; + virtual void sectionStarting( SectionInfo const& sectionInfo ) = 0; + + // *** experimental *** + virtual void benchmarkStarting( BenchmarkInfo const& ) {} + + virtual void assertionStarting( AssertionInfo const& assertionInfo ) = 0; + + // The return value indicates if the messages buffer should be cleared: + virtual bool assertionEnded( AssertionStats const& assertionStats ) = 0; + + // *** experimental *** + virtual void benchmarkEnded( BenchmarkStats const& ) {} + + virtual void sectionEnded( SectionStats const& sectionStats ) = 0; + virtual void testCaseEnded( TestCaseStats const& testCaseStats ) = 0; + virtual void testGroupEnded( TestGroupStats const& testGroupStats ) = 0; + virtual void testRunEnded( TestRunStats const& testRunStats ) = 0; + + virtual void skipTest( TestCaseInfo const& testInfo ) = 0; + + // Default empty implementation provided + virtual void fatalErrorEncountered( StringRef name ); + + virtual bool isMulti() const; + }; + using IStreamingReporterPtr = std::unique_ptr; + + struct IReporterFactory { + virtual ~IReporterFactory(); + virtual IStreamingReporterPtr create( ReporterConfig const& config ) const = 0; + virtual std::string getDescription() const = 0; + }; + using IReporterFactoryPtr = std::shared_ptr; + + struct IReporterRegistry { + using FactoryMap = std::map; + using Listeners = std::vector; + + virtual ~IReporterRegistry(); + virtual IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const = 0; + virtual FactoryMap const& getFactories() const = 0; + virtual Listeners const& getListeners() const = 0; + }; + +} // end namespace Catch + +// end catch_interfaces_reporter.h +#include +#include +#include +#include +#include +#include +#include + +namespace Catch { + void prepareExpandedExpression(AssertionResult& result); + + // Returns double formatted as %.3f (format expected on output) + std::string getFormattedDuration( double duration ); + + template + struct StreamingReporterBase : IStreamingReporter { + + StreamingReporterBase( ReporterConfig const& _config ) + : m_config( _config.fullConfig() ), + stream( _config.stream() ) + { + m_reporterPrefs.shouldRedirectStdOut = false; + if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) ) + CATCH_ERROR( "Verbosity level not supported by this reporter" ); + } + + ReporterPreferences getPreferences() const override { + return m_reporterPrefs; + } + + static std::set getSupportedVerbosities() { + return { Verbosity::Normal }; + } + + ~StreamingReporterBase() override = default; + + void noMatchingTestCases(std::string const&) override {} + + void testRunStarting(TestRunInfo const& _testRunInfo) override { + currentTestRunInfo = _testRunInfo; + } + void testGroupStarting(GroupInfo const& _groupInfo) override { + currentGroupInfo = _groupInfo; + } + + void testCaseStarting(TestCaseInfo const& _testInfo) override { + currentTestCaseInfo = _testInfo; + } + void sectionStarting(SectionInfo const& _sectionInfo) override { + m_sectionStack.push_back(_sectionInfo); + } + + void sectionEnded(SectionStats const& /* _sectionStats */) override { + m_sectionStack.pop_back(); + } + void testCaseEnded(TestCaseStats const& /* _testCaseStats */) override { + currentTestCaseInfo.reset(); + } + void testGroupEnded(TestGroupStats const& /* _testGroupStats */) override { + currentGroupInfo.reset(); + } + void testRunEnded(TestRunStats const& /* _testRunStats */) override { + currentTestCaseInfo.reset(); + currentGroupInfo.reset(); + currentTestRunInfo.reset(); + } + + void skipTest(TestCaseInfo const&) override { + // Don't do anything with this by default. + // It can optionally be overridden in the derived class. + } + + IConfigPtr m_config; + std::ostream& stream; + + LazyStat currentTestRunInfo; + LazyStat currentGroupInfo; + LazyStat currentTestCaseInfo; + + std::vector m_sectionStack; + ReporterPreferences m_reporterPrefs; + }; + + template + struct CumulativeReporterBase : IStreamingReporter { + template + struct Node { + explicit Node( T const& _value ) : value( _value ) {} + virtual ~Node() {} + + using ChildNodes = std::vector>; + T value; + ChildNodes children; + }; + struct SectionNode { + explicit SectionNode(SectionStats const& _stats) : stats(_stats) {} + virtual ~SectionNode() = default; + + bool operator == (SectionNode const& other) const { + return stats.sectionInfo.lineInfo == other.stats.sectionInfo.lineInfo; + } + bool operator == (std::shared_ptr const& other) const { + return operator==(*other); + } + + SectionStats stats; + using ChildSections = std::vector>; + using Assertions = std::vector; + ChildSections childSections; + Assertions assertions; + std::string stdOut; + std::string stdErr; + }; + + struct BySectionInfo { + BySectionInfo( SectionInfo const& other ) : m_other( other ) {} + BySectionInfo( BySectionInfo const& other ) : m_other( other.m_other ) {} + bool operator() (std::shared_ptr const& node) const { + return ((node->stats.sectionInfo.name == m_other.name) && + (node->stats.sectionInfo.lineInfo == m_other.lineInfo)); + } + void operator=(BySectionInfo const&) = delete; + + private: + SectionInfo const& m_other; + }; + + using TestCaseNode = Node; + using TestGroupNode = Node; + using TestRunNode = Node; + + CumulativeReporterBase( ReporterConfig const& _config ) + : m_config( _config.fullConfig() ), + stream( _config.stream() ) + { + m_reporterPrefs.shouldRedirectStdOut = false; + if( !DerivedT::getSupportedVerbosities().count( m_config->verbosity() ) ) + CATCH_ERROR( "Verbosity level not supported by this reporter" ); + } + ~CumulativeReporterBase() override = default; + + ReporterPreferences getPreferences() const override { + return m_reporterPrefs; + } + + static std::set getSupportedVerbosities() { + return { Verbosity::Normal }; + } + + void testRunStarting( TestRunInfo const& ) override {} + void testGroupStarting( GroupInfo const& ) override {} + + void testCaseStarting( TestCaseInfo const& ) override {} + + void sectionStarting( SectionInfo const& sectionInfo ) override { + SectionStats incompleteStats( sectionInfo, Counts(), 0, false ); + std::shared_ptr node; + if( m_sectionStack.empty() ) { + if( !m_rootSection ) + m_rootSection = std::make_shared( incompleteStats ); + node = m_rootSection; + } + else { + SectionNode& parentNode = *m_sectionStack.back(); + auto it = + std::find_if( parentNode.childSections.begin(), + parentNode.childSections.end(), + BySectionInfo( sectionInfo ) ); + if( it == parentNode.childSections.end() ) { + node = std::make_shared( incompleteStats ); + parentNode.childSections.push_back( node ); + } + else + node = *it; + } + m_sectionStack.push_back( node ); + m_deepestSection = std::move(node); + } + + void assertionStarting(AssertionInfo const&) override {} + + bool assertionEnded(AssertionStats const& assertionStats) override { + assert(!m_sectionStack.empty()); + // AssertionResult holds a pointer to a temporary DecomposedExpression, + // which getExpandedExpression() calls to build the expression string. + // Our section stack copy of the assertionResult will likely outlive the + // temporary, so it must be expanded or discarded now to avoid calling + // a destroyed object later. + prepareExpandedExpression(const_cast( assertionStats.assertionResult ) ); + SectionNode& sectionNode = *m_sectionStack.back(); + sectionNode.assertions.push_back(assertionStats); + return true; + } + void sectionEnded(SectionStats const& sectionStats) override { + assert(!m_sectionStack.empty()); + SectionNode& node = *m_sectionStack.back(); + node.stats = sectionStats; + m_sectionStack.pop_back(); + } + void testCaseEnded(TestCaseStats const& testCaseStats) override { + auto node = std::make_shared(testCaseStats); + assert(m_sectionStack.size() == 0); + node->children.push_back(m_rootSection); + m_testCases.push_back(node); + m_rootSection.reset(); + + assert(m_deepestSection); + m_deepestSection->stdOut = testCaseStats.stdOut; + m_deepestSection->stdErr = testCaseStats.stdErr; + } + void testGroupEnded(TestGroupStats const& testGroupStats) override { + auto node = std::make_shared(testGroupStats); + node->children.swap(m_testCases); + m_testGroups.push_back(node); + } + void testRunEnded(TestRunStats const& testRunStats) override { + auto node = std::make_shared(testRunStats); + node->children.swap(m_testGroups); + m_testRuns.push_back(node); + testRunEndedCumulative(); + } + virtual void testRunEndedCumulative() = 0; + + void skipTest(TestCaseInfo const&) override {} + + IConfigPtr m_config; + std::ostream& stream; + std::vector m_assertions; + std::vector>> m_sections; + std::vector> m_testCases; + std::vector> m_testGroups; + + std::vector> m_testRuns; + + std::shared_ptr m_rootSection; + std::shared_ptr m_deepestSection; + std::vector> m_sectionStack; + ReporterPreferences m_reporterPrefs; + }; + + template + char const* getLineOfChars() { + static char line[CATCH_CONFIG_CONSOLE_WIDTH] = {0}; + if( !*line ) { + std::memset( line, C, CATCH_CONFIG_CONSOLE_WIDTH-1 ); + line[CATCH_CONFIG_CONSOLE_WIDTH-1] = 0; + } + return line; + } + + struct TestEventListenerBase : StreamingReporterBase { + TestEventListenerBase( ReporterConfig const& _config ); + + static std::set getSupportedVerbosities(); + + void assertionStarting(AssertionInfo const&) override; + bool assertionEnded(AssertionStats const&) override; + }; + +} // end namespace Catch + +// end catch_reporter_bases.hpp +// start catch_console_colour.h + +namespace Catch { + + struct Colour { + enum Code { + None = 0, + + White, + Red, + Green, + Blue, + Cyan, + Yellow, + Grey, + + Bright = 0x10, + + BrightRed = Bright | Red, + BrightGreen = Bright | Green, + LightGrey = Bright | Grey, + BrightWhite = Bright | White, + BrightYellow = Bright | Yellow, + + // By intention + FileName = LightGrey, + Warning = BrightYellow, + ResultError = BrightRed, + ResultSuccess = BrightGreen, + ResultExpectedFailure = Warning, + + Error = BrightRed, + Success = Green, + + OriginalExpression = Cyan, + ReconstructedExpression = BrightYellow, + + SecondaryText = LightGrey, + Headers = White + }; + + // Use constructed object for RAII guard + Colour( Code _colourCode ); + Colour( Colour&& other ) noexcept; + Colour& operator=( Colour&& other ) noexcept; + ~Colour(); + + // Use static method for one-shot changes + static void use( Code _colourCode ); + + private: + bool m_moved = false; + }; + + std::ostream& operator << ( std::ostream& os, Colour const& ); + +} // end namespace Catch + +// end catch_console_colour.h +// start catch_reporter_registrars.hpp + + +namespace Catch { + + template + class ReporterRegistrar { + + class ReporterFactory : public IReporterFactory { + + virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override { + return std::unique_ptr( new T( config ) ); + } + + virtual std::string getDescription() const override { + return T::getDescription(); + } + }; + + public: + + explicit ReporterRegistrar( std::string const& name ) { + getMutableRegistryHub().registerReporter( name, std::make_shared() ); + } + }; + + template + class ListenerRegistrar { + + class ListenerFactory : public IReporterFactory { + + virtual IStreamingReporterPtr create( ReporterConfig const& config ) const override { + return std::unique_ptr( new T( config ) ); + } + virtual std::string getDescription() const override { + return std::string(); + } + }; + + public: + + ListenerRegistrar() { + getMutableRegistryHub().registerListener( std::make_shared() ); + } + }; +} + +#if !defined(CATCH_CONFIG_DISABLE) + +#define CATCH_REGISTER_REPORTER( name, reporterType ) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::ReporterRegistrar catch_internal_RegistrarFor##reporterType( name ); } \ + CATCH_INTERNAL_UNSUPPRESS_GLOBALS_WARNINGS + +#define CATCH_REGISTER_LISTENER( listenerType ) \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS \ + namespace{ Catch::ListenerRegistrar catch_internal_RegistrarFor##listenerType; } \ + CATCH_INTERNAL_SUPPRESS_GLOBALS_WARNINGS +#else // CATCH_CONFIG_DISABLE + +#define CATCH_REGISTER_REPORTER(name, reporterType) +#define CATCH_REGISTER_LISTENER(listenerType) + +#endif // CATCH_CONFIG_DISABLE + +// end catch_reporter_registrars.hpp +// Allow users to base their work off existing reporters +// start catch_reporter_compact.h + +namespace Catch { + + struct CompactReporter : StreamingReporterBase { + + using StreamingReporterBase::StreamingReporterBase; + + ~CompactReporter() override; + + static std::string getDescription(); + + ReporterPreferences getPreferences() const override; + + void noMatchingTestCases(std::string const& spec) override; + + void assertionStarting(AssertionInfo const&) override; + + bool assertionEnded(AssertionStats const& _assertionStats) override; + + void sectionEnded(SectionStats const& _sectionStats) override; + + void testRunEnded(TestRunStats const& _testRunStats) override; + + }; + +} // end namespace Catch + +// end catch_reporter_compact.h +// start catch_reporter_console.h + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch + // Note that 4062 (not all labels are handled + // and default is missing) is enabled +#endif + +namespace Catch { + // Fwd decls + struct SummaryColumn; + class TablePrinter; + + struct ConsoleReporter : StreamingReporterBase { + std::unique_ptr m_tablePrinter; + + ConsoleReporter(ReporterConfig const& config); + ~ConsoleReporter() override; + static std::string getDescription(); + + void noMatchingTestCases(std::string const& spec) override; + + void assertionStarting(AssertionInfo const&) override; + + bool assertionEnded(AssertionStats const& _assertionStats) override; + + void sectionStarting(SectionInfo const& _sectionInfo) override; + void sectionEnded(SectionStats const& _sectionStats) override; + + void benchmarkStarting(BenchmarkInfo const& info) override; + void benchmarkEnded(BenchmarkStats const& stats) override; + + void testCaseEnded(TestCaseStats const& _testCaseStats) override; + void testGroupEnded(TestGroupStats const& _testGroupStats) override; + void testRunEnded(TestRunStats const& _testRunStats) override; + + private: + + void lazyPrint(); + + void lazyPrintWithoutClosingBenchmarkTable(); + void lazyPrintRunInfo(); + void lazyPrintGroupInfo(); + void printTestCaseAndSectionHeader(); + + void printClosedHeader(std::string const& _name); + void printOpenHeader(std::string const& _name); + + // if string has a : in first line will set indent to follow it on + // subsequent lines + void printHeaderString(std::string const& _string, std::size_t indent = 0); + + void printTotals(Totals const& totals); + void printSummaryRow(std::string const& label, std::vector const& cols, std::size_t row); + + void printTotalsDivider(Totals const& totals); + void printSummaryDivider(); + + private: + bool m_headerPrinted = false; + }; + +} // end namespace Catch + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif + +// end catch_reporter_console.h +// start catch_reporter_junit.h + +// start catch_xmlwriter.h + +#include + +namespace Catch { + + class XmlEncode { + public: + enum ForWhat { ForTextNodes, ForAttributes }; + + XmlEncode( std::string const& str, ForWhat forWhat = ForTextNodes ); + + void encodeTo( std::ostream& os ) const; + + friend std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ); + + private: + std::string m_str; + ForWhat m_forWhat; + }; + + class XmlWriter { + public: + + class ScopedElement { + public: + ScopedElement( XmlWriter* writer ); + + ScopedElement( ScopedElement&& other ) noexcept; + ScopedElement& operator=( ScopedElement&& other ) noexcept; + + ~ScopedElement(); + + ScopedElement& writeText( std::string const& text, bool indent = true ); + + template + ScopedElement& writeAttribute( std::string const& name, T const& attribute ) { + m_writer->writeAttribute( name, attribute ); + return *this; + } + + private: + mutable XmlWriter* m_writer = nullptr; + }; + + XmlWriter( std::ostream& os = Catch::cout() ); + ~XmlWriter(); + + XmlWriter( XmlWriter const& ) = delete; + XmlWriter& operator=( XmlWriter const& ) = delete; + + XmlWriter& startElement( std::string const& name ); + + ScopedElement scopedElement( std::string const& name ); + + XmlWriter& endElement(); + + XmlWriter& writeAttribute( std::string const& name, std::string const& attribute ); + + XmlWriter& writeAttribute( std::string const& name, bool attribute ); + + template + XmlWriter& writeAttribute( std::string const& name, T const& attribute ) { + ReusableStringStream rss; + rss << attribute; + return writeAttribute( name, rss.str() ); + } + + XmlWriter& writeText( std::string const& text, bool indent = true ); + + XmlWriter& writeComment( std::string const& text ); + + void writeStylesheetRef( std::string const& url ); + + XmlWriter& writeBlankLine(); + + void ensureTagClosed(); + + private: + + void writeDeclaration(); + + void newlineIfNecessary(); + + bool m_tagIsOpen = false; + bool m_needsNewline = false; + std::vector m_tags; + std::string m_indent; + std::ostream& m_os; + }; + +} + +// end catch_xmlwriter.h +namespace Catch { + + class JunitReporter : public CumulativeReporterBase { + public: + JunitReporter(ReporterConfig const& _config); + + ~JunitReporter() override; + + static std::string getDescription(); + + void noMatchingTestCases(std::string const& /*spec*/) override; + + void testRunStarting(TestRunInfo const& runInfo) override; + + void testGroupStarting(GroupInfo const& groupInfo) override; + + void testCaseStarting(TestCaseInfo const& testCaseInfo) override; + bool assertionEnded(AssertionStats const& assertionStats) override; + + void testCaseEnded(TestCaseStats const& testCaseStats) override; + + void testGroupEnded(TestGroupStats const& testGroupStats) override; + + void testRunEndedCumulative() override; + + void writeGroup(TestGroupNode const& groupNode, double suiteTime); + + void writeTestCase(TestCaseNode const& testCaseNode); + + void writeSection(std::string const& className, + std::string const& rootName, + SectionNode const& sectionNode); + + void writeAssertions(SectionNode const& sectionNode); + void writeAssertion(AssertionStats const& stats); + + XmlWriter xml; + Timer suiteTimer; + std::string stdOutForSuite; + std::string stdErrForSuite; + unsigned int unexpectedExceptions = 0; + bool m_okToFail = false; + }; + +} // end namespace Catch + +// end catch_reporter_junit.h +// start catch_reporter_xml.h + +namespace Catch { + class XmlReporter : public StreamingReporterBase { + public: + XmlReporter(ReporterConfig const& _config); + + ~XmlReporter() override; + + static std::string getDescription(); + + virtual std::string getStylesheetRef() const; + + void writeSourceInfo(SourceLineInfo const& sourceInfo); + + public: // StreamingReporterBase + + void noMatchingTestCases(std::string const& s) override; + + void testRunStarting(TestRunInfo const& testInfo) override; + + void testGroupStarting(GroupInfo const& groupInfo) override; + + void testCaseStarting(TestCaseInfo const& testInfo) override; + + void sectionStarting(SectionInfo const& sectionInfo) override; + + void assertionStarting(AssertionInfo const&) override; + + bool assertionEnded(AssertionStats const& assertionStats) override; + + void sectionEnded(SectionStats const& sectionStats) override; + + void testCaseEnded(TestCaseStats const& testCaseStats) override; + + void testGroupEnded(TestGroupStats const& testGroupStats) override; + + void testRunEnded(TestRunStats const& testRunStats) override; + + private: + Timer m_testCaseTimer; + XmlWriter m_xml; + int m_sectionDepth = 0; + }; + +} // end namespace Catch + +// end catch_reporter_xml.h + +// end catch_external_interfaces.h +#endif + +#endif // ! CATCH_CONFIG_IMPL_ONLY + +#ifdef CATCH_IMPL +// start catch_impl.hpp + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wweak-vtables" +#endif + +// Keep these here for external reporters +// start catch_test_case_tracker.h + +#include +#include +#include + +namespace Catch { +namespace TestCaseTracking { + + struct NameAndLocation { + std::string name; + SourceLineInfo location; + + NameAndLocation( std::string const& _name, SourceLineInfo const& _location ); + }; + + struct ITracker; + + using ITrackerPtr = std::shared_ptr; + + struct ITracker { + virtual ~ITracker(); + + // static queries + virtual NameAndLocation const& nameAndLocation() const = 0; + + // dynamic queries + virtual bool isComplete() const = 0; // Successfully completed or failed + virtual bool isSuccessfullyCompleted() const = 0; + virtual bool isOpen() const = 0; // Started but not complete + virtual bool hasChildren() const = 0; + + virtual ITracker& parent() = 0; + + // actions + virtual void close() = 0; // Successfully complete + virtual void fail() = 0; + virtual void markAsNeedingAnotherRun() = 0; + + virtual void addChild( ITrackerPtr const& child ) = 0; + virtual ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) = 0; + virtual void openChild() = 0; + + // Debug/ checking + virtual bool isSectionTracker() const = 0; + virtual bool isIndexTracker() const = 0; + }; + + class TrackerContext { + + enum RunState { + NotStarted, + Executing, + CompletedCycle + }; + + ITrackerPtr m_rootTracker; + ITracker* m_currentTracker = nullptr; + RunState m_runState = NotStarted; + + public: + + static TrackerContext& instance(); + + ITracker& startRun(); + void endRun(); + + void startCycle(); + void completeCycle(); + + bool completedCycle() const; + ITracker& currentTracker(); + void setCurrentTracker( ITracker* tracker ); + }; + + class TrackerBase : public ITracker { + protected: + enum CycleState { + NotStarted, + Executing, + ExecutingChildren, + NeedsAnotherRun, + CompletedSuccessfully, + Failed + }; + + using Children = std::vector; + NameAndLocation m_nameAndLocation; + TrackerContext& m_ctx; + ITracker* m_parent; + Children m_children; + CycleState m_runState = NotStarted; + + public: + TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); + + NameAndLocation const& nameAndLocation() const override; + bool isComplete() const override; + bool isSuccessfullyCompleted() const override; + bool isOpen() const override; + bool hasChildren() const override; + + void addChild( ITrackerPtr const& child ) override; + + ITrackerPtr findChild( NameAndLocation const& nameAndLocation ) override; + ITracker& parent() override; + + void openChild() override; + + bool isSectionTracker() const override; + bool isIndexTracker() const override; + + void open(); + + void close() override; + void fail() override; + void markAsNeedingAnotherRun() override; + + private: + void moveToParent(); + void moveToThis(); + }; + + class SectionTracker : public TrackerBase { + std::vector m_filters; + public: + SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ); + + bool isSectionTracker() const override; + + static SectionTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ); + + void tryOpen(); + + void addInitialFilters( std::vector const& filters ); + void addNextFilters( std::vector const& filters ); + }; + + class IndexTracker : public TrackerBase { + int m_size; + int m_index = -1; + public: + IndexTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent, int size ); + + bool isIndexTracker() const override; + void close() override; + + static IndexTracker& acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation, int size ); + + int index() const; + + void moveNext(); + }; + +} // namespace TestCaseTracking + +using TestCaseTracking::ITracker; +using TestCaseTracking::TrackerContext; +using TestCaseTracking::SectionTracker; +using TestCaseTracking::IndexTracker; + +} // namespace Catch + +// end catch_test_case_tracker.h + +// start catch_leak_detector.h + +namespace Catch { + + struct LeakDetector { + LeakDetector(); + ~LeakDetector(); + }; + +} +// end catch_leak_detector.h +// Cpp files will be included in the single-header file here +// start catch_approx.cpp + +#include +#include + +namespace { + +// Performs equivalent check of std::fabs(lhs - rhs) <= margin +// But without the subtraction to allow for INFINITY in comparison +bool marginComparison(double lhs, double rhs, double margin) { + return (lhs + margin >= rhs) && (rhs + margin >= lhs); +} + +} + +namespace Catch { +namespace Detail { + + Approx::Approx ( double value ) + : m_epsilon( std::numeric_limits::epsilon()*100 ), + m_margin( 0.0 ), + m_scale( 0.0 ), + m_value( value ) + {} + + Approx Approx::custom() { + return Approx( 0 ); + } + + Approx Approx::operator-() const { + auto temp(*this); + temp.m_value = -temp.m_value; + return temp; + } + + std::string Approx::toString() const { + ReusableStringStream rss; + rss << "Approx( " << ::Catch::Detail::stringify( m_value ) << " )"; + return rss.str(); + } + + bool Approx::equalityComparisonImpl(const double other) const { + // First try with fixed margin, then compute margin based on epsilon, scale and Approx's value + // Thanks to Richard Harris for his help refining the scaled margin value + return marginComparison(m_value, other, m_margin) || marginComparison(m_value, other, m_epsilon * (m_scale + std::fabs(m_value))); + } + + void Approx::setMargin(double margin) { + CATCH_ENFORCE(margin >= 0, + "Invalid Approx::margin: " << margin << '.' + << " Approx::Margin has to be non-negative."); + m_margin = margin; + } + + void Approx::setEpsilon(double epsilon) { + CATCH_ENFORCE(epsilon >= 0 && epsilon <= 1.0, + "Invalid Approx::epsilon: " << epsilon << '.' + << " Approx::epsilon has to be in [0, 1]"); + m_epsilon = epsilon; + } + +} // end namespace Detail + +namespace literals { + Detail::Approx operator "" _a(long double val) { + return Detail::Approx(val); + } + Detail::Approx operator "" _a(unsigned long long val) { + return Detail::Approx(val); + } +} // end namespace literals + +std::string StringMaker::convert(Catch::Detail::Approx const& value) { + return value.toString(); +} + +} // end namespace Catch +// end catch_approx.cpp +// start catch_assertionhandler.cpp + +// start catch_context.h + +#include + +namespace Catch { + + struct IResultCapture; + struct IRunner; + struct IConfig; + struct IMutableContext; + + using IConfigPtr = std::shared_ptr; + + struct IContext + { + virtual ~IContext(); + + virtual IResultCapture* getResultCapture() = 0; + virtual IRunner* getRunner() = 0; + virtual IConfigPtr const& getConfig() const = 0; + }; + + struct IMutableContext : IContext + { + virtual ~IMutableContext(); + virtual void setResultCapture( IResultCapture* resultCapture ) = 0; + virtual void setRunner( IRunner* runner ) = 0; + virtual void setConfig( IConfigPtr const& config ) = 0; + + private: + static IMutableContext *currentContext; + friend IMutableContext& getCurrentMutableContext(); + friend void cleanUpContext(); + static void createContext(); + }; + + inline IMutableContext& getCurrentMutableContext() + { + if( !IMutableContext::currentContext ) + IMutableContext::createContext(); + return *IMutableContext::currentContext; + } + + inline IContext& getCurrentContext() + { + return getCurrentMutableContext(); + } + + void cleanUpContext(); +} + +// end catch_context.h +// start catch_debugger.h + +namespace Catch { + bool isDebuggerActive(); +} + +#ifdef CATCH_PLATFORM_MAC + + #define CATCH_TRAP() __asm__("int $3\n" : : ) /* NOLINT */ + +#elif defined(CATCH_PLATFORM_LINUX) + // If we can use inline assembler, do it because this allows us to break + // directly at the location of the failing check instead of breaking inside + // raise() called from it, i.e. one stack frame below. + #if defined(__GNUC__) && (defined(__i386) || defined(__x86_64)) + #define CATCH_TRAP() asm volatile ("int $3") /* NOLINT */ + #else // Fall back to the generic way. + #include + + #define CATCH_TRAP() raise(SIGTRAP) + #endif +#elif defined(_MSC_VER) + #define CATCH_TRAP() __debugbreak() +#elif defined(__MINGW32__) + extern "C" __declspec(dllimport) void __stdcall DebugBreak(); + #define CATCH_TRAP() DebugBreak() +#endif + +#ifdef CATCH_TRAP + #define CATCH_BREAK_INTO_DEBUGGER() if( Catch::isDebuggerActive() ) { CATCH_TRAP(); } +#else + namespace Catch { + inline void doNothing() {} + } + #define CATCH_BREAK_INTO_DEBUGGER() Catch::doNothing() +#endif + +// end catch_debugger.h +// start catch_run_context.h + +// start catch_fatal_condition.h + +// start catch_windows_h_proxy.h + + +#if defined(CATCH_PLATFORM_WINDOWS) + +#if !defined(NOMINMAX) && !defined(CATCH_CONFIG_NO_NOMINMAX) +# define CATCH_DEFINED_NOMINMAX +# define NOMINMAX +#endif +#if !defined(WIN32_LEAN_AND_MEAN) && !defined(CATCH_CONFIG_NO_WIN32_LEAN_AND_MEAN) +# define CATCH_DEFINED_WIN32_LEAN_AND_MEAN +# define WIN32_LEAN_AND_MEAN +#endif + +#ifdef __AFXDLL +#include +#else +#include +#endif + +#ifdef CATCH_DEFINED_NOMINMAX +# undef NOMINMAX +#endif +#ifdef CATCH_DEFINED_WIN32_LEAN_AND_MEAN +# undef WIN32_LEAN_AND_MEAN +#endif + +#endif // defined(CATCH_PLATFORM_WINDOWS) + +// end catch_windows_h_proxy.h +#if defined( CATCH_CONFIG_WINDOWS_SEH ) + +namespace Catch { + + struct FatalConditionHandler { + + static LONG CALLBACK handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo); + FatalConditionHandler(); + static void reset(); + ~FatalConditionHandler(); + + private: + static bool isSet; + static ULONG guaranteeSize; + static PVOID exceptionHandlerHandle; + }; + +} // namespace Catch + +#elif defined ( CATCH_CONFIG_POSIX_SIGNALS ) + +#include + +namespace Catch { + + struct FatalConditionHandler { + + static bool isSet; + static struct sigaction oldSigActions[]; + static stack_t oldSigStack; + static char altStackMem[]; + + static void handleSignal( int sig ); + + FatalConditionHandler(); + ~FatalConditionHandler(); + static void reset(); + }; + +} // namespace Catch + +#else + +namespace Catch { + struct FatalConditionHandler { + void reset(); + }; +} + +#endif + +// end catch_fatal_condition.h +#include + +namespace Catch { + + struct IMutableContext; + + /////////////////////////////////////////////////////////////////////////// + + class RunContext : public IResultCapture, public IRunner { + + public: + RunContext( RunContext const& ) = delete; + RunContext& operator =( RunContext const& ) = delete; + + explicit RunContext( IConfigPtr const& _config, IStreamingReporterPtr&& reporter ); + + ~RunContext() override; + + void testGroupStarting( std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount ); + void testGroupEnded( std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount ); + + Totals runTest(TestCase const& testCase); + + IConfigPtr config() const; + IStreamingReporter& reporter() const; + + public: // IResultCapture + + // Assertion handlers + void handleExpr + ( AssertionInfo const& info, + ITransientExpression const& expr, + AssertionReaction& reaction ) override; + void handleMessage + ( AssertionInfo const& info, + ResultWas::OfType resultType, + StringRef const& message, + AssertionReaction& reaction ) override; + void handleUnexpectedExceptionNotThrown + ( AssertionInfo const& info, + AssertionReaction& reaction ) override; + void handleUnexpectedInflightException + ( AssertionInfo const& info, + std::string const& message, + AssertionReaction& reaction ) override; + void handleIncomplete + ( AssertionInfo const& info ) override; + void handleNonExpr + ( AssertionInfo const &info, + ResultWas::OfType resultType, + AssertionReaction &reaction ) override; + + bool sectionStarted( SectionInfo const& sectionInfo, Counts& assertions ) override; + + void sectionEnded( SectionEndInfo const& endInfo ) override; + void sectionEndedEarly( SectionEndInfo const& endInfo ) override; + + auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& override; + + void benchmarkStarting( BenchmarkInfo const& info ) override; + void benchmarkEnded( BenchmarkStats const& stats ) override; + + void pushScopedMessage( MessageInfo const& message ) override; + void popScopedMessage( MessageInfo const& message ) override; + + std::string getCurrentTestName() const override; + + const AssertionResult* getLastResult() const override; + + void exceptionEarlyReported() override; + + void handleFatalErrorCondition( StringRef message ) override; + + bool lastAssertionPassed() override; + + void assertionPassed() override; + + public: + // !TBD We need to do this another way! + bool aborting() const final; + + private: + + void runCurrentTest( std::string& redirectedCout, std::string& redirectedCerr ); + void invokeActiveTestCase(); + + void resetAssertionInfo(); + bool testForMissingAssertions( Counts& assertions ); + + void assertionEnded( AssertionResult const& result ); + void reportExpr + ( AssertionInfo const &info, + ResultWas::OfType resultType, + ITransientExpression const *expr, + bool negated ); + + void populateReaction( AssertionReaction& reaction ); + + private: + + void handleUnfinishedSections(); + + TestRunInfo m_runInfo; + IMutableContext& m_context; + TestCase const* m_activeTestCase = nullptr; + ITracker* m_testCaseTracker; + Option m_lastResult; + + IConfigPtr m_config; + Totals m_totals; + IStreamingReporterPtr m_reporter; + std::vector m_messages; + AssertionInfo m_lastAssertionInfo; + std::vector m_unfinishedSections; + std::vector m_activeSections; + TrackerContext m_trackerContext; + bool m_lastAssertionPassed = false; + bool m_shouldReportUnexpected = true; + bool m_includeSuccessfulResults; + }; + +} // end namespace Catch + +// end catch_run_context.h +namespace Catch { + + namespace { + auto operator <<( std::ostream& os, ITransientExpression const& expr ) -> std::ostream& { + expr.streamReconstructedExpression( os ); + return os; + } + } + + LazyExpression::LazyExpression( bool isNegated ) + : m_isNegated( isNegated ) + {} + + LazyExpression::LazyExpression( LazyExpression const& other ) : m_isNegated( other.m_isNegated ) {} + + LazyExpression::operator bool() const { + return m_transientExpression != nullptr; + } + + auto operator << ( std::ostream& os, LazyExpression const& lazyExpr ) -> std::ostream& { + if( lazyExpr.m_isNegated ) + os << "!"; + + if( lazyExpr ) { + if( lazyExpr.m_isNegated && lazyExpr.m_transientExpression->isBinaryExpression() ) + os << "(" << *lazyExpr.m_transientExpression << ")"; + else + os << *lazyExpr.m_transientExpression; + } + else { + os << "{** error - unchecked empty expression requested **}"; + } + return os; + } + + AssertionHandler::AssertionHandler + ( StringRef const& macroName, + SourceLineInfo const& lineInfo, + StringRef capturedExpression, + ResultDisposition::Flags resultDisposition ) + : m_assertionInfo{ macroName, lineInfo, capturedExpression, resultDisposition }, + m_resultCapture( getResultCapture() ) + {} + + void AssertionHandler::handleExpr( ITransientExpression const& expr ) { + m_resultCapture.handleExpr( m_assertionInfo, expr, m_reaction ); + } + void AssertionHandler::handleMessage(ResultWas::OfType resultType, StringRef const& message) { + m_resultCapture.handleMessage( m_assertionInfo, resultType, message, m_reaction ); + } + + auto AssertionHandler::allowThrows() const -> bool { + return getCurrentContext().getConfig()->allowThrows(); + } + + void AssertionHandler::complete() { + setCompleted(); + if( m_reaction.shouldDebugBreak ) { + + // If you find your debugger stopping you here then go one level up on the + // call-stack for the code that caused it (typically a failed assertion) + + // (To go back to the test and change execution, jump over the throw, next) + CATCH_BREAK_INTO_DEBUGGER(); + } + if (m_reaction.shouldThrow) { +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + throw Catch::TestFailureException(); +#else + CATCH_ERROR( "Test failure requires aborting test!" ); +#endif + } + } + void AssertionHandler::setCompleted() { + m_completed = true; + } + + void AssertionHandler::handleUnexpectedInflightException() { + m_resultCapture.handleUnexpectedInflightException( m_assertionInfo, Catch::translateActiveException(), m_reaction ); + } + + void AssertionHandler::handleExceptionThrownAsExpected() { + m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); + } + void AssertionHandler::handleExceptionNotThrownAsExpected() { + m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); + } + + void AssertionHandler::handleUnexpectedExceptionNotThrown() { + m_resultCapture.handleUnexpectedExceptionNotThrown( m_assertionInfo, m_reaction ); + } + + void AssertionHandler::handleThrowingCallSkipped() { + m_resultCapture.handleNonExpr(m_assertionInfo, ResultWas::Ok, m_reaction); + } + + // This is the overload that takes a string and infers the Equals matcher from it + // The more general overload, that takes any string matcher, is in catch_capture_matchers.cpp + void handleExceptionMatchExpr( AssertionHandler& handler, std::string const& str, StringRef const& matcherString ) { + handleExceptionMatchExpr( handler, Matchers::Equals( str ), matcherString ); + } + +} // namespace Catch +// end catch_assertionhandler.cpp +// start catch_assertionresult.cpp + +namespace Catch { + AssertionResultData::AssertionResultData(ResultWas::OfType _resultType, LazyExpression const & _lazyExpression): + lazyExpression(_lazyExpression), + resultType(_resultType) {} + + std::string AssertionResultData::reconstructExpression() const { + + if( reconstructedExpression.empty() ) { + if( lazyExpression ) { + ReusableStringStream rss; + rss << lazyExpression; + reconstructedExpression = rss.str(); + } + } + return reconstructedExpression; + } + + AssertionResult::AssertionResult( AssertionInfo const& info, AssertionResultData const& data ) + : m_info( info ), + m_resultData( data ) + {} + + // Result was a success + bool AssertionResult::succeeded() const { + return Catch::isOk( m_resultData.resultType ); + } + + // Result was a success, or failure is suppressed + bool AssertionResult::isOk() const { + return Catch::isOk( m_resultData.resultType ) || shouldSuppressFailure( m_info.resultDisposition ); + } + + ResultWas::OfType AssertionResult::getResultType() const { + return m_resultData.resultType; + } + + bool AssertionResult::hasExpression() const { + return m_info.capturedExpression[0] != 0; + } + + bool AssertionResult::hasMessage() const { + return !m_resultData.message.empty(); + } + + std::string AssertionResult::getExpression() const { + if( isFalseTest( m_info.resultDisposition ) ) + return "!(" + m_info.capturedExpression + ")"; + else + return m_info.capturedExpression; + } + + std::string AssertionResult::getExpressionInMacro() const { + std::string expr; + if( m_info.macroName[0] == 0 ) + expr = m_info.capturedExpression; + else { + expr.reserve( m_info.macroName.size() + m_info.capturedExpression.size() + 4 ); + expr += m_info.macroName; + expr += "( "; + expr += m_info.capturedExpression; + expr += " )"; + } + return expr; + } + + bool AssertionResult::hasExpandedExpression() const { + return hasExpression() && getExpandedExpression() != getExpression(); + } + + std::string AssertionResult::getExpandedExpression() const { + std::string expr = m_resultData.reconstructExpression(); + return expr.empty() + ? getExpression() + : expr; + } + + std::string AssertionResult::getMessage() const { + return m_resultData.message; + } + SourceLineInfo AssertionResult::getSourceInfo() const { + return m_info.lineInfo; + } + + StringRef AssertionResult::getTestMacroName() const { + return m_info.macroName; + } + +} // end namespace Catch +// end catch_assertionresult.cpp +// start catch_benchmark.cpp + +namespace Catch { + + auto BenchmarkLooper::getResolution() -> uint64_t { + return getEstimatedClockResolution() * getCurrentContext().getConfig()->benchmarkResolutionMultiple(); + } + + void BenchmarkLooper::reportStart() { + getResultCapture().benchmarkStarting( { m_name } ); + } + auto BenchmarkLooper::needsMoreIterations() -> bool { + auto elapsed = m_timer.getElapsedNanoseconds(); + + // Exponentially increasing iterations until we're confident in our timer resolution + if( elapsed < m_resolution ) { + m_iterationsToRun *= 10; + return true; + } + + getResultCapture().benchmarkEnded( { { m_name }, m_count, elapsed } ); + return false; + } + +} // end namespace Catch +// end catch_benchmark.cpp +// start catch_capture_matchers.cpp + +namespace Catch { + + using StringMatcher = Matchers::Impl::MatcherBase; + + // This is the general overload that takes a any string matcher + // There is another overload, in catch_assertionhandler.h/.cpp, that only takes a string and infers + // the Equals matcher (so the header does not mention matchers) + void handleExceptionMatchExpr( AssertionHandler& handler, StringMatcher const& matcher, StringRef const& matcherString ) { + std::string exceptionMessage = Catch::translateActiveException(); + MatchExpr expr( exceptionMessage, matcher, matcherString ); + handler.handleExpr( expr ); + } + +} // namespace Catch +// end catch_capture_matchers.cpp +// start catch_commandline.cpp + +// start catch_commandline.h + +// start catch_clara.h + +// Use Catch's value for console width (store Clara's off to the side, if present) +#ifdef CLARA_CONFIG_CONSOLE_WIDTH +#define CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH +#undef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH +#endif +#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CONFIG_CONSOLE_WIDTH-1 + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wweak-vtables" +#pragma clang diagnostic ignored "-Wexit-time-destructors" +#pragma clang diagnostic ignored "-Wshadow" +#endif + +// start clara.hpp +// Copyright 2017 Two Blue Cubes Ltd. All rights reserved. +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// See https://github.com/philsquared/Clara for more details + +// Clara v1.1.5 + + +#ifndef CATCH_CLARA_CONFIG_CONSOLE_WIDTH +#define CATCH_CLARA_CONFIG_CONSOLE_WIDTH 80 +#endif + +#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH +#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_CLARA_CONFIG_CONSOLE_WIDTH +#endif + +#ifndef CLARA_CONFIG_OPTIONAL_TYPE +#ifdef __has_include +#if __has_include() && __cplusplus >= 201703L +#include +#define CLARA_CONFIG_OPTIONAL_TYPE std::optional +#endif +#endif +#endif + +// ----------- #included from clara_textflow.hpp ----------- + +// TextFlowCpp +// +// A single-header library for wrapping and laying out basic text, by Phil Nash +// +// Distributed under the Boost Software License, Version 1.0. (See accompanying +// file LICENSE.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +// +// This project is hosted at https://github.com/philsquared/textflowcpp + + +#include +#include +#include +#include + +#ifndef CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH +#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH 80 +#endif + +namespace Catch { +namespace clara { +namespace TextFlow { + +inline auto isWhitespace(char c) -> bool { + static std::string chars = " \t\n\r"; + return chars.find(c) != std::string::npos; +} +inline auto isBreakableBefore(char c) -> bool { + static std::string chars = "[({<|"; + return chars.find(c) != std::string::npos; +} +inline auto isBreakableAfter(char c) -> bool { + static std::string chars = "])}>.,:;*+-=&/\\"; + return chars.find(c) != std::string::npos; +} + +class Columns; + +class Column { + std::vector m_strings; + size_t m_width = CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH; + size_t m_indent = 0; + size_t m_initialIndent = std::string::npos; + +public: + class iterator { + friend Column; + + Column const& m_column; + size_t m_stringIndex = 0; + size_t m_pos = 0; + + size_t m_len = 0; + size_t m_end = 0; + bool m_suffix = false; + + iterator(Column const& column, size_t stringIndex) + : m_column(column), + m_stringIndex(stringIndex) {} + + auto line() const -> std::string const& { return m_column.m_strings[m_stringIndex]; } + + auto isBoundary(size_t at) const -> bool { + assert(at > 0); + assert(at <= line().size()); + + return at == line().size() || + (isWhitespace(line()[at]) && !isWhitespace(line()[at - 1])) || + isBreakableBefore(line()[at]) || + isBreakableAfter(line()[at - 1]); + } + + void calcLength() { + assert(m_stringIndex < m_column.m_strings.size()); + + m_suffix = false; + auto width = m_column.m_width - indent(); + m_end = m_pos; + while (m_end < line().size() && line()[m_end] != '\n') + ++m_end; + + if (m_end < m_pos + width) { + m_len = m_end - m_pos; + } else { + size_t len = width; + while (len > 0 && !isBoundary(m_pos + len)) + --len; + while (len > 0 && isWhitespace(line()[m_pos + len - 1])) + --len; + + if (len > 0) { + m_len = len; + } else { + m_suffix = true; + m_len = width - 1; + } + } + } + + auto indent() const -> size_t { + auto initial = m_pos == 0 && m_stringIndex == 0 ? m_column.m_initialIndent : std::string::npos; + return initial == std::string::npos ? m_column.m_indent : initial; + } + + auto addIndentAndSuffix(std::string const &plain) const -> std::string { + return std::string(indent(), ' ') + (m_suffix ? plain + "-" : plain); + } + + public: + using difference_type = std::ptrdiff_t; + using value_type = std::string; + using pointer = value_type * ; + using reference = value_type & ; + using iterator_category = std::forward_iterator_tag; + + explicit iterator(Column const& column) : m_column(column) { + assert(m_column.m_width > m_column.m_indent); + assert(m_column.m_initialIndent == std::string::npos || m_column.m_width > m_column.m_initialIndent); + calcLength(); + if (m_len == 0) + m_stringIndex++; // Empty string + } + + auto operator *() const -> std::string { + assert(m_stringIndex < m_column.m_strings.size()); + assert(m_pos <= m_end); + return addIndentAndSuffix(line().substr(m_pos, m_len)); + } + + auto operator ++() -> iterator& { + m_pos += m_len; + if (m_pos < line().size() && line()[m_pos] == '\n') + m_pos += 1; + else + while (m_pos < line().size() && isWhitespace(line()[m_pos])) + ++m_pos; + + if (m_pos == line().size()) { + m_pos = 0; + ++m_stringIndex; + } + if (m_stringIndex < m_column.m_strings.size()) + calcLength(); + return *this; + } + auto operator ++(int) -> iterator { + iterator prev(*this); + operator++(); + return prev; + } + + auto operator ==(iterator const& other) const -> bool { + return + m_pos == other.m_pos && + m_stringIndex == other.m_stringIndex && + &m_column == &other.m_column; + } + auto operator !=(iterator const& other) const -> bool { + return !operator==(other); + } + }; + using const_iterator = iterator; + + explicit Column(std::string const& text) { m_strings.push_back(text); } + + auto width(size_t newWidth) -> Column& { + assert(newWidth > 0); + m_width = newWidth; + return *this; + } + auto indent(size_t newIndent) -> Column& { + m_indent = newIndent; + return *this; + } + auto initialIndent(size_t newIndent) -> Column& { + m_initialIndent = newIndent; + return *this; + } + + auto width() const -> size_t { return m_width; } + auto begin() const -> iterator { return iterator(*this); } + auto end() const -> iterator { return { *this, m_strings.size() }; } + + inline friend std::ostream& operator << (std::ostream& os, Column const& col) { + bool first = true; + for (auto line : col) { + if (first) + first = false; + else + os << "\n"; + os << line; + } + return os; + } + + auto operator + (Column const& other)->Columns; + + auto toString() const -> std::string { + std::ostringstream oss; + oss << *this; + return oss.str(); + } +}; + +class Spacer : public Column { + +public: + explicit Spacer(size_t spaceWidth) : Column("") { + width(spaceWidth); + } +}; + +class Columns { + std::vector m_columns; + +public: + + class iterator { + friend Columns; + struct EndTag {}; + + std::vector const& m_columns; + std::vector m_iterators; + size_t m_activeIterators; + + iterator(Columns const& columns, EndTag) + : m_columns(columns.m_columns), + m_activeIterators(0) { + m_iterators.reserve(m_columns.size()); + + for (auto const& col : m_columns) + m_iterators.push_back(col.end()); + } + + public: + using difference_type = std::ptrdiff_t; + using value_type = std::string; + using pointer = value_type * ; + using reference = value_type & ; + using iterator_category = std::forward_iterator_tag; + + explicit iterator(Columns const& columns) + : m_columns(columns.m_columns), + m_activeIterators(m_columns.size()) { + m_iterators.reserve(m_columns.size()); + + for (auto const& col : m_columns) + m_iterators.push_back(col.begin()); + } + + auto operator ==(iterator const& other) const -> bool { + return m_iterators == other.m_iterators; + } + auto operator !=(iterator const& other) const -> bool { + return m_iterators != other.m_iterators; + } + auto operator *() const -> std::string { + std::string row, padding; + + for (size_t i = 0; i < m_columns.size(); ++i) { + auto width = m_columns[i].width(); + if (m_iterators[i] != m_columns[i].end()) { + std::string col = *m_iterators[i]; + row += padding + col; + if (col.size() < width) + padding = std::string(width - col.size(), ' '); + else + padding = ""; + } else { + padding += std::string(width, ' '); + } + } + return row; + } + auto operator ++() -> iterator& { + for (size_t i = 0; i < m_columns.size(); ++i) { + if (m_iterators[i] != m_columns[i].end()) + ++m_iterators[i]; + } + return *this; + } + auto operator ++(int) -> iterator { + iterator prev(*this); + operator++(); + return prev; + } + }; + using const_iterator = iterator; + + auto begin() const -> iterator { return iterator(*this); } + auto end() const -> iterator { return { *this, iterator::EndTag() }; } + + auto operator += (Column const& col) -> Columns& { + m_columns.push_back(col); + return *this; + } + auto operator + (Column const& col) -> Columns { + Columns combined = *this; + combined += col; + return combined; + } + + inline friend std::ostream& operator << (std::ostream& os, Columns const& cols) { + + bool first = true; + for (auto line : cols) { + if (first) + first = false; + else + os << "\n"; + os << line; + } + return os; + } + + auto toString() const -> std::string { + std::ostringstream oss; + oss << *this; + return oss.str(); + } +}; + +inline auto Column::operator + (Column const& other) -> Columns { + Columns cols; + cols += *this; + cols += other; + return cols; +} +} + +} +} + +// ----------- end of #include from clara_textflow.hpp ----------- +// ........... back in clara.hpp + +#include +#include +#include +#include + +#if !defined(CATCH_PLATFORM_WINDOWS) && ( defined(WIN32) || defined(__WIN32__) || defined(_WIN32) || defined(_MSC_VER) ) +#define CATCH_PLATFORM_WINDOWS +#endif + +namespace Catch { namespace clara { +namespace detail { + + // Traits for extracting arg and return type of lambdas (for single argument lambdas) + template + struct UnaryLambdaTraits : UnaryLambdaTraits {}; + + template + struct UnaryLambdaTraits { + static const bool isValid = false; + }; + + template + struct UnaryLambdaTraits { + static const bool isValid = true; + using ArgType = typename std::remove_const::type>::type; + using ReturnType = ReturnT; + }; + + class TokenStream; + + // Transport for raw args (copied from main args, or supplied via init list for testing) + class Args { + friend TokenStream; + std::string m_exeName; + std::vector m_args; + + public: + Args( int argc, char const* const* argv ) + : m_exeName(argv[0]), + m_args(argv + 1, argv + argc) {} + + Args( std::initializer_list args ) + : m_exeName( *args.begin() ), + m_args( args.begin()+1, args.end() ) + {} + + auto exeName() const -> std::string { + return m_exeName; + } + }; + + // Wraps a token coming from a token stream. These may not directly correspond to strings as a single string + // may encode an option + its argument if the : or = form is used + enum class TokenType { + Option, Argument + }; + struct Token { + TokenType type; + std::string token; + }; + + inline auto isOptPrefix( char c ) -> bool { + return c == '-' +#ifdef CATCH_PLATFORM_WINDOWS + || c == '/' +#endif + ; + } + + // Abstracts iterators into args as a stream of tokens, with option arguments uniformly handled + class TokenStream { + using Iterator = std::vector::const_iterator; + Iterator it; + Iterator itEnd; + std::vector m_tokenBuffer; + + void loadBuffer() { + m_tokenBuffer.resize( 0 ); + + // Skip any empty strings + while( it != itEnd && it->empty() ) + ++it; + + if( it != itEnd ) { + auto const &next = *it; + if( isOptPrefix( next[0] ) ) { + auto delimiterPos = next.find_first_of( " :=" ); + if( delimiterPos != std::string::npos ) { + m_tokenBuffer.push_back( { TokenType::Option, next.substr( 0, delimiterPos ) } ); + m_tokenBuffer.push_back( { TokenType::Argument, next.substr( delimiterPos + 1 ) } ); + } else { + if( next[1] != '-' && next.size() > 2 ) { + std::string opt = "- "; + for( size_t i = 1; i < next.size(); ++i ) { + opt[1] = next[i]; + m_tokenBuffer.push_back( { TokenType::Option, opt } ); + } + } else { + m_tokenBuffer.push_back( { TokenType::Option, next } ); + } + } + } else { + m_tokenBuffer.push_back( { TokenType::Argument, next } ); + } + } + } + + public: + explicit TokenStream( Args const &args ) : TokenStream( args.m_args.begin(), args.m_args.end() ) {} + + TokenStream( Iterator it, Iterator itEnd ) : it( it ), itEnd( itEnd ) { + loadBuffer(); + } + + explicit operator bool() const { + return !m_tokenBuffer.empty() || it != itEnd; + } + + auto count() const -> size_t { return m_tokenBuffer.size() + (itEnd - it); } + + auto operator*() const -> Token { + assert( !m_tokenBuffer.empty() ); + return m_tokenBuffer.front(); + } + + auto operator->() const -> Token const * { + assert( !m_tokenBuffer.empty() ); + return &m_tokenBuffer.front(); + } + + auto operator++() -> TokenStream & { + if( m_tokenBuffer.size() >= 2 ) { + m_tokenBuffer.erase( m_tokenBuffer.begin() ); + } else { + if( it != itEnd ) + ++it; + loadBuffer(); + } + return *this; + } + }; + + class ResultBase { + public: + enum Type { + Ok, LogicError, RuntimeError + }; + + protected: + ResultBase( Type type ) : m_type( type ) {} + virtual ~ResultBase() = default; + + virtual void enforceOk() const = 0; + + Type m_type; + }; + + template + class ResultValueBase : public ResultBase { + public: + auto value() const -> T const & { + enforceOk(); + return m_value; + } + + protected: + ResultValueBase( Type type ) : ResultBase( type ) {} + + ResultValueBase( ResultValueBase const &other ) : ResultBase( other ) { + if( m_type == ResultBase::Ok ) + new( &m_value ) T( other.m_value ); + } + + ResultValueBase( Type, T const &value ) : ResultBase( Ok ) { + new( &m_value ) T( value ); + } + + auto operator=( ResultValueBase const &other ) -> ResultValueBase & { + if( m_type == ResultBase::Ok ) + m_value.~T(); + ResultBase::operator=(other); + if( m_type == ResultBase::Ok ) + new( &m_value ) T( other.m_value ); + return *this; + } + + ~ResultValueBase() override { + if( m_type == Ok ) + m_value.~T(); + } + + union { + T m_value; + }; + }; + + template<> + class ResultValueBase : public ResultBase { + protected: + using ResultBase::ResultBase; + }; + + template + class BasicResult : public ResultValueBase { + public: + template + explicit BasicResult( BasicResult const &other ) + : ResultValueBase( other.type() ), + m_errorMessage( other.errorMessage() ) + { + assert( type() != ResultBase::Ok ); + } + + template + static auto ok( U const &value ) -> BasicResult { return { ResultBase::Ok, value }; } + static auto ok() -> BasicResult { return { ResultBase::Ok }; } + static auto logicError( std::string const &message ) -> BasicResult { return { ResultBase::LogicError, message }; } + static auto runtimeError( std::string const &message ) -> BasicResult { return { ResultBase::RuntimeError, message }; } + + explicit operator bool() const { return m_type == ResultBase::Ok; } + auto type() const -> ResultBase::Type { return m_type; } + auto errorMessage() const -> std::string { return m_errorMessage; } + + protected: + void enforceOk() const override { + + // Errors shouldn't reach this point, but if they do + // the actual error message will be in m_errorMessage + assert( m_type != ResultBase::LogicError ); + assert( m_type != ResultBase::RuntimeError ); + if( m_type != ResultBase::Ok ) + std::abort(); + } + + std::string m_errorMessage; // Only populated if resultType is an error + + BasicResult( ResultBase::Type type, std::string const &message ) + : ResultValueBase(type), + m_errorMessage(message) + { + assert( m_type != ResultBase::Ok ); + } + + using ResultValueBase::ResultValueBase; + using ResultBase::m_type; + }; + + enum class ParseResultType { + Matched, NoMatch, ShortCircuitAll, ShortCircuitSame + }; + + class ParseState { + public: + + ParseState( ParseResultType type, TokenStream const &remainingTokens ) + : m_type(type), + m_remainingTokens( remainingTokens ) + {} + + auto type() const -> ParseResultType { return m_type; } + auto remainingTokens() const -> TokenStream { return m_remainingTokens; } + + private: + ParseResultType m_type; + TokenStream m_remainingTokens; + }; + + using Result = BasicResult; + using ParserResult = BasicResult; + using InternalParseResult = BasicResult; + + struct HelpColumns { + std::string left; + std::string right; + }; + + template + inline auto convertInto( std::string const &source, T& target ) -> ParserResult { + std::stringstream ss; + ss << source; + ss >> target; + if( ss.fail() ) + return ParserResult::runtimeError( "Unable to convert '" + source + "' to destination type" ); + else + return ParserResult::ok( ParseResultType::Matched ); + } + inline auto convertInto( std::string const &source, std::string& target ) -> ParserResult { + target = source; + return ParserResult::ok( ParseResultType::Matched ); + } + inline auto convertInto( std::string const &source, bool &target ) -> ParserResult { + std::string srcLC = source; + std::transform( srcLC.begin(), srcLC.end(), srcLC.begin(), []( char c ) { return static_cast( ::tolower(c) ); } ); + if (srcLC == "y" || srcLC == "1" || srcLC == "true" || srcLC == "yes" || srcLC == "on") + target = true; + else if (srcLC == "n" || srcLC == "0" || srcLC == "false" || srcLC == "no" || srcLC == "off") + target = false; + else + return ParserResult::runtimeError( "Expected a boolean value but did not recognise: '" + source + "'" ); + return ParserResult::ok( ParseResultType::Matched ); + } +#ifdef CLARA_CONFIG_OPTIONAL_TYPE + template + inline auto convertInto( std::string const &source, CLARA_CONFIG_OPTIONAL_TYPE& target ) -> ParserResult { + T temp; + auto result = convertInto( source, temp ); + if( result ) + target = std::move(temp); + return result; + } +#endif // CLARA_CONFIG_OPTIONAL_TYPE + + struct NonCopyable { + NonCopyable() = default; + NonCopyable( NonCopyable const & ) = delete; + NonCopyable( NonCopyable && ) = delete; + NonCopyable &operator=( NonCopyable const & ) = delete; + NonCopyable &operator=( NonCopyable && ) = delete; + }; + + struct BoundRef : NonCopyable { + virtual ~BoundRef() = default; + virtual auto isContainer() const -> bool { return false; } + virtual auto isFlag() const -> bool { return false; } + }; + struct BoundValueRefBase : BoundRef { + virtual auto setValue( std::string const &arg ) -> ParserResult = 0; + }; + struct BoundFlagRefBase : BoundRef { + virtual auto setFlag( bool flag ) -> ParserResult = 0; + virtual auto isFlag() const -> bool { return true; } + }; + + template + struct BoundValueRef : BoundValueRefBase { + T &m_ref; + + explicit BoundValueRef( T &ref ) : m_ref( ref ) {} + + auto setValue( std::string const &arg ) -> ParserResult override { + return convertInto( arg, m_ref ); + } + }; + + template + struct BoundValueRef> : BoundValueRefBase { + std::vector &m_ref; + + explicit BoundValueRef( std::vector &ref ) : m_ref( ref ) {} + + auto isContainer() const -> bool override { return true; } + + auto setValue( std::string const &arg ) -> ParserResult override { + T temp; + auto result = convertInto( arg, temp ); + if( result ) + m_ref.push_back( temp ); + return result; + } + }; + + struct BoundFlagRef : BoundFlagRefBase { + bool &m_ref; + + explicit BoundFlagRef( bool &ref ) : m_ref( ref ) {} + + auto setFlag( bool flag ) -> ParserResult override { + m_ref = flag; + return ParserResult::ok( ParseResultType::Matched ); + } + }; + + template + struct LambdaInvoker { + static_assert( std::is_same::value, "Lambda must return void or clara::ParserResult" ); + + template + static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult { + return lambda( arg ); + } + }; + + template<> + struct LambdaInvoker { + template + static auto invoke( L const &lambda, ArgType const &arg ) -> ParserResult { + lambda( arg ); + return ParserResult::ok( ParseResultType::Matched ); + } + }; + + template + inline auto invokeLambda( L const &lambda, std::string const &arg ) -> ParserResult { + ArgType temp{}; + auto result = convertInto( arg, temp ); + return !result + ? result + : LambdaInvoker::ReturnType>::invoke( lambda, temp ); + } + + template + struct BoundLambda : BoundValueRefBase { + L m_lambda; + + static_assert( UnaryLambdaTraits::isValid, "Supplied lambda must take exactly one argument" ); + explicit BoundLambda( L const &lambda ) : m_lambda( lambda ) {} + + auto setValue( std::string const &arg ) -> ParserResult override { + return invokeLambda::ArgType>( m_lambda, arg ); + } + }; + + template + struct BoundFlagLambda : BoundFlagRefBase { + L m_lambda; + + static_assert( UnaryLambdaTraits::isValid, "Supplied lambda must take exactly one argument" ); + static_assert( std::is_same::ArgType, bool>::value, "flags must be boolean" ); + + explicit BoundFlagLambda( L const &lambda ) : m_lambda( lambda ) {} + + auto setFlag( bool flag ) -> ParserResult override { + return LambdaInvoker::ReturnType>::invoke( m_lambda, flag ); + } + }; + + enum class Optionality { Optional, Required }; + + struct Parser; + + class ParserBase { + public: + virtual ~ParserBase() = default; + virtual auto validate() const -> Result { return Result::ok(); } + virtual auto parse( std::string const& exeName, TokenStream const &tokens) const -> InternalParseResult = 0; + virtual auto cardinality() const -> size_t { return 1; } + + auto parse( Args const &args ) const -> InternalParseResult { + return parse( args.exeName(), TokenStream( args ) ); + } + }; + + template + class ComposableParserImpl : public ParserBase { + public: + template + auto operator|( T const &other ) const -> Parser; + + template + auto operator+( T const &other ) const -> Parser; + }; + + // Common code and state for Args and Opts + template + class ParserRefImpl : public ComposableParserImpl { + protected: + Optionality m_optionality = Optionality::Optional; + std::shared_ptr m_ref; + std::string m_hint; + std::string m_description; + + explicit ParserRefImpl( std::shared_ptr const &ref ) : m_ref( ref ) {} + + public: + template + ParserRefImpl( T &ref, std::string const &hint ) + : m_ref( std::make_shared>( ref ) ), + m_hint( hint ) + {} + + template + ParserRefImpl( LambdaT const &ref, std::string const &hint ) + : m_ref( std::make_shared>( ref ) ), + m_hint(hint) + {} + + auto operator()( std::string const &description ) -> DerivedT & { + m_description = description; + return static_cast( *this ); + } + + auto optional() -> DerivedT & { + m_optionality = Optionality::Optional; + return static_cast( *this ); + }; + + auto required() -> DerivedT & { + m_optionality = Optionality::Required; + return static_cast( *this ); + }; + + auto isOptional() const -> bool { + return m_optionality == Optionality::Optional; + } + + auto cardinality() const -> size_t override { + if( m_ref->isContainer() ) + return 0; + else + return 1; + } + + auto hint() const -> std::string { return m_hint; } + }; + + class ExeName : public ComposableParserImpl { + std::shared_ptr m_name; + std::shared_ptr m_ref; + + template + static auto makeRef(LambdaT const &lambda) -> std::shared_ptr { + return std::make_shared>( lambda) ; + } + + public: + ExeName() : m_name( std::make_shared( "" ) ) {} + + explicit ExeName( std::string &ref ) : ExeName() { + m_ref = std::make_shared>( ref ); + } + + template + explicit ExeName( LambdaT const& lambda ) : ExeName() { + m_ref = std::make_shared>( lambda ); + } + + // The exe name is not parsed out of the normal tokens, but is handled specially + auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override { + return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) ); + } + + auto name() const -> std::string { return *m_name; } + auto set( std::string const& newName ) -> ParserResult { + + auto lastSlash = newName.find_last_of( "\\/" ); + auto filename = ( lastSlash == std::string::npos ) + ? newName + : newName.substr( lastSlash+1 ); + + *m_name = filename; + if( m_ref ) + return m_ref->setValue( filename ); + else + return ParserResult::ok( ParseResultType::Matched ); + } + }; + + class Arg : public ParserRefImpl { + public: + using ParserRefImpl::ParserRefImpl; + + auto parse( std::string const &, TokenStream const &tokens ) const -> InternalParseResult override { + auto validationResult = validate(); + if( !validationResult ) + return InternalParseResult( validationResult ); + + auto remainingTokens = tokens; + auto const &token = *remainingTokens; + if( token.type != TokenType::Argument ) + return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) ); + + assert( !m_ref->isFlag() ); + auto valueRef = static_cast( m_ref.get() ); + + auto result = valueRef->setValue( remainingTokens->token ); + if( !result ) + return InternalParseResult( result ); + else + return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) ); + } + }; + + inline auto normaliseOpt( std::string const &optName ) -> std::string { +#ifdef CATCH_PLATFORM_WINDOWS + if( optName[0] == '/' ) + return "-" + optName.substr( 1 ); + else +#endif + return optName; + } + + class Opt : public ParserRefImpl { + protected: + std::vector m_optNames; + + public: + template + explicit Opt( LambdaT const &ref ) : ParserRefImpl( std::make_shared>( ref ) ) {} + + explicit Opt( bool &ref ) : ParserRefImpl( std::make_shared( ref ) ) {} + + template + Opt( LambdaT const &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {} + + template + Opt( T &ref, std::string const &hint ) : ParserRefImpl( ref, hint ) {} + + auto operator[]( std::string const &optName ) -> Opt & { + m_optNames.push_back( optName ); + return *this; + } + + auto getHelpColumns() const -> std::vector { + std::ostringstream oss; + bool first = true; + for( auto const &opt : m_optNames ) { + if (first) + first = false; + else + oss << ", "; + oss << opt; + } + if( !m_hint.empty() ) + oss << " <" << m_hint << ">"; + return { { oss.str(), m_description } }; + } + + auto isMatch( std::string const &optToken ) const -> bool { + auto normalisedToken = normaliseOpt( optToken ); + for( auto const &name : m_optNames ) { + if( normaliseOpt( name ) == normalisedToken ) + return true; + } + return false; + } + + using ParserBase::parse; + + auto parse( std::string const&, TokenStream const &tokens ) const -> InternalParseResult override { + auto validationResult = validate(); + if( !validationResult ) + return InternalParseResult( validationResult ); + + auto remainingTokens = tokens; + if( remainingTokens && remainingTokens->type == TokenType::Option ) { + auto const &token = *remainingTokens; + if( isMatch(token.token ) ) { + if( m_ref->isFlag() ) { + auto flagRef = static_cast( m_ref.get() ); + auto result = flagRef->setFlag( true ); + if( !result ) + return InternalParseResult( result ); + if( result.value() == ParseResultType::ShortCircuitAll ) + return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) ); + } else { + auto valueRef = static_cast( m_ref.get() ); + ++remainingTokens; + if( !remainingTokens ) + return InternalParseResult::runtimeError( "Expected argument following " + token.token ); + auto const &argToken = *remainingTokens; + if( argToken.type != TokenType::Argument ) + return InternalParseResult::runtimeError( "Expected argument following " + token.token ); + auto result = valueRef->setValue( argToken.token ); + if( !result ) + return InternalParseResult( result ); + if( result.value() == ParseResultType::ShortCircuitAll ) + return InternalParseResult::ok( ParseState( result.value(), remainingTokens ) ); + } + return InternalParseResult::ok( ParseState( ParseResultType::Matched, ++remainingTokens ) ); + } + } + return InternalParseResult::ok( ParseState( ParseResultType::NoMatch, remainingTokens ) ); + } + + auto validate() const -> Result override { + if( m_optNames.empty() ) + return Result::logicError( "No options supplied to Opt" ); + for( auto const &name : m_optNames ) { + if( name.empty() ) + return Result::logicError( "Option name cannot be empty" ); +#ifdef CATCH_PLATFORM_WINDOWS + if( name[0] != '-' && name[0] != '/' ) + return Result::logicError( "Option name must begin with '-' or '/'" ); +#else + if( name[0] != '-' ) + return Result::logicError( "Option name must begin with '-'" ); +#endif + } + return ParserRefImpl::validate(); + } + }; + + struct Help : Opt { + Help( bool &showHelpFlag ) + : Opt([&]( bool flag ) { + showHelpFlag = flag; + return ParserResult::ok( ParseResultType::ShortCircuitAll ); + }) + { + static_cast( *this ) + ("display usage information") + ["-?"]["-h"]["--help"] + .optional(); + } + }; + + struct Parser : ParserBase { + + mutable ExeName m_exeName; + std::vector m_options; + std::vector m_args; + + auto operator|=( ExeName const &exeName ) -> Parser & { + m_exeName = exeName; + return *this; + } + + auto operator|=( Arg const &arg ) -> Parser & { + m_args.push_back(arg); + return *this; + } + + auto operator|=( Opt const &opt ) -> Parser & { + m_options.push_back(opt); + return *this; + } + + auto operator|=( Parser const &other ) -> Parser & { + m_options.insert(m_options.end(), other.m_options.begin(), other.m_options.end()); + m_args.insert(m_args.end(), other.m_args.begin(), other.m_args.end()); + return *this; + } + + template + auto operator|( T const &other ) const -> Parser { + return Parser( *this ) |= other; + } + + // Forward deprecated interface with '+' instead of '|' + template + auto operator+=( T const &other ) -> Parser & { return operator|=( other ); } + template + auto operator+( T const &other ) const -> Parser { return operator|( other ); } + + auto getHelpColumns() const -> std::vector { + std::vector cols; + for (auto const &o : m_options) { + auto childCols = o.getHelpColumns(); + cols.insert( cols.end(), childCols.begin(), childCols.end() ); + } + return cols; + } + + void writeToStream( std::ostream &os ) const { + if (!m_exeName.name().empty()) { + os << "usage:\n" << " " << m_exeName.name() << " "; + bool required = true, first = true; + for( auto const &arg : m_args ) { + if (first) + first = false; + else + os << " "; + if( arg.isOptional() && required ) { + os << "["; + required = false; + } + os << "<" << arg.hint() << ">"; + if( arg.cardinality() == 0 ) + os << " ... "; + } + if( !required ) + os << "]"; + if( !m_options.empty() ) + os << " options"; + os << "\n\nwhere options are:" << std::endl; + } + + auto rows = getHelpColumns(); + size_t consoleWidth = CATCH_CLARA_CONFIG_CONSOLE_WIDTH; + size_t optWidth = 0; + for( auto const &cols : rows ) + optWidth = (std::max)(optWidth, cols.left.size() + 2); + + optWidth = (std::min)(optWidth, consoleWidth/2); + + for( auto const &cols : rows ) { + auto row = + TextFlow::Column( cols.left ).width( optWidth ).indent( 2 ) + + TextFlow::Spacer(4) + + TextFlow::Column( cols.right ).width( consoleWidth - 7 - optWidth ); + os << row << std::endl; + } + } + + friend auto operator<<( std::ostream &os, Parser const &parser ) -> std::ostream& { + parser.writeToStream( os ); + return os; + } + + auto validate() const -> Result override { + for( auto const &opt : m_options ) { + auto result = opt.validate(); + if( !result ) + return result; + } + for( auto const &arg : m_args ) { + auto result = arg.validate(); + if( !result ) + return result; + } + return Result::ok(); + } + + using ParserBase::parse; + + auto parse( std::string const& exeName, TokenStream const &tokens ) const -> InternalParseResult override { + + struct ParserInfo { + ParserBase const* parser = nullptr; + size_t count = 0; + }; + const size_t totalParsers = m_options.size() + m_args.size(); + assert( totalParsers < 512 ); + // ParserInfo parseInfos[totalParsers]; // <-- this is what we really want to do + ParserInfo parseInfos[512]; + + { + size_t i = 0; + for (auto const &opt : m_options) parseInfos[i++].parser = &opt; + for (auto const &arg : m_args) parseInfos[i++].parser = &arg; + } + + m_exeName.set( exeName ); + + auto result = InternalParseResult::ok( ParseState( ParseResultType::NoMatch, tokens ) ); + while( result.value().remainingTokens() ) { + bool tokenParsed = false; + + for( size_t i = 0; i < totalParsers; ++i ) { + auto& parseInfo = parseInfos[i]; + if( parseInfo.parser->cardinality() == 0 || parseInfo.count < parseInfo.parser->cardinality() ) { + result = parseInfo.parser->parse(exeName, result.value().remainingTokens()); + if (!result) + return result; + if (result.value().type() != ParseResultType::NoMatch) { + tokenParsed = true; + ++parseInfo.count; + break; + } + } + } + + if( result.value().type() == ParseResultType::ShortCircuitAll ) + return result; + if( !tokenParsed ) + return InternalParseResult::runtimeError( "Unrecognised token: " + result.value().remainingTokens()->token ); + } + // !TBD Check missing required options + return result; + } + }; + + template + template + auto ComposableParserImpl::operator|( T const &other ) const -> Parser { + return Parser() | static_cast( *this ) | other; + } +} // namespace detail + +// A Combined parser +using detail::Parser; + +// A parser for options +using detail::Opt; + +// A parser for arguments +using detail::Arg; + +// Wrapper for argc, argv from main() +using detail::Args; + +// Specifies the name of the executable +using detail::ExeName; + +// Convenience wrapper for option parser that specifies the help option +using detail::Help; + +// enum of result types from a parse +using detail::ParseResultType; + +// Result type for parser operation +using detail::ParserResult; + +}} // namespace Catch::clara + +// end clara.hpp +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +// Restore Clara's value for console width, if present +#ifdef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH +#define CATCH_CLARA_TEXTFLOW_CONFIG_CONSOLE_WIDTH CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH +#undef CATCH_TEMP_CLARA_CONFIG_CONSOLE_WIDTH +#endif + +// end catch_clara.h +namespace Catch { + + clara::Parser makeCommandLineParser( ConfigData& config ); + +} // end namespace Catch + +// end catch_commandline.h +#include +#include + +namespace Catch { + + clara::Parser makeCommandLineParser( ConfigData& config ) { + + using namespace clara; + + auto const setWarning = [&]( std::string const& warning ) { + auto warningSet = [&]() { + if( warning == "NoAssertions" ) + return WarnAbout::NoAssertions; + + if ( warning == "NoTests" ) + return WarnAbout::NoTests; + + return WarnAbout::Nothing; + }(); + + if (warningSet == WarnAbout::Nothing) + return ParserResult::runtimeError( "Unrecognised warning: '" + warning + "'" ); + config.warnings = static_cast( config.warnings | warningSet ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const loadTestNamesFromFile = [&]( std::string const& filename ) { + std::ifstream f( filename.c_str() ); + if( !f.is_open() ) + return ParserResult::runtimeError( "Unable to load input file: '" + filename + "'" ); + + std::string line; + while( std::getline( f, line ) ) { + line = trim(line); + if( !line.empty() && !startsWith( line, '#' ) ) { + if( !startsWith( line, '"' ) ) + line = '"' + line + '"'; + config.testsOrTags.push_back( line + ',' ); + } + } + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setTestOrder = [&]( std::string const& order ) { + if( startsWith( "declared", order ) ) + config.runOrder = RunTests::InDeclarationOrder; + else if( startsWith( "lexical", order ) ) + config.runOrder = RunTests::InLexicographicalOrder; + else if( startsWith( "random", order ) ) + config.runOrder = RunTests::InRandomOrder; + else + return clara::ParserResult::runtimeError( "Unrecognised ordering: '" + order + "'" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setRngSeed = [&]( std::string const& seed ) { + if( seed != "time" ) + return clara::detail::convertInto( seed, config.rngSeed ); + config.rngSeed = static_cast( std::time(nullptr) ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setColourUsage = [&]( std::string const& useColour ) { + auto mode = toLower( useColour ); + + if( mode == "yes" ) + config.useColour = UseColour::Yes; + else if( mode == "no" ) + config.useColour = UseColour::No; + else if( mode == "auto" ) + config.useColour = UseColour::Auto; + else + return ParserResult::runtimeError( "colour mode must be one of: auto, yes or no. '" + useColour + "' not recognised" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setWaitForKeypress = [&]( std::string const& keypress ) { + auto keypressLc = toLower( keypress ); + if( keypressLc == "start" ) + config.waitForKeypress = WaitForKeypress::BeforeStart; + else if( keypressLc == "exit" ) + config.waitForKeypress = WaitForKeypress::BeforeExit; + else if( keypressLc == "both" ) + config.waitForKeypress = WaitForKeypress::BeforeStartAndExit; + else + return ParserResult::runtimeError( "keypress argument must be one of: start, exit or both. '" + keypress + "' not recognised" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setVerbosity = [&]( std::string const& verbosity ) { + auto lcVerbosity = toLower( verbosity ); + if( lcVerbosity == "quiet" ) + config.verbosity = Verbosity::Quiet; + else if( lcVerbosity == "normal" ) + config.verbosity = Verbosity::Normal; + else if( lcVerbosity == "high" ) + config.verbosity = Verbosity::High; + else + return ParserResult::runtimeError( "Unrecognised verbosity, '" + verbosity + "'" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + auto const setReporter = [&]( std::string const& reporter ) { + IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); + + auto lcReporter = toLower( reporter ); + auto result = factories.find( lcReporter ); + + if( factories.end() != result ) + config.reporterName = lcReporter; + else + return ParserResult::runtimeError( "Unrecognized reporter, '" + reporter + "'. Check available with --list-reporters" ); + return ParserResult::ok( ParseResultType::Matched ); + }; + + auto cli + = ExeName( config.processName ) + | Help( config.showHelp ) + | Opt( config.listTests ) + ["-l"]["--list-tests"] + ( "list all/matching test cases" ) + | Opt( config.listTags ) + ["-t"]["--list-tags"] + ( "list all/matching tags" ) + | Opt( config.showSuccessfulTests ) + ["-s"]["--success"] + ( "include successful tests in output" ) + | Opt( config.shouldDebugBreak ) + ["-b"]["--break"] + ( "break into debugger on failure" ) + | Opt( config.noThrow ) + ["-e"]["--nothrow"] + ( "skip exception tests" ) + | Opt( config.showInvisibles ) + ["-i"]["--invisibles"] + ( "show invisibles (tabs, newlines)" ) + | Opt( config.outputFilename, "filename" ) + ["-o"]["--out"] + ( "output filename" ) + | Opt( setReporter, "name" ) + ["-r"]["--reporter"] + ( "reporter to use (defaults to console)" ) + | Opt( config.name, "name" ) + ["-n"]["--name"] + ( "suite name" ) + | Opt( [&]( bool ){ config.abortAfter = 1; } ) + ["-a"]["--abort"] + ( "abort at first failure" ) + | Opt( [&]( int x ){ config.abortAfter = x; }, "no. failures" ) + ["-x"]["--abortx"] + ( "abort after x failures" ) + | Opt( setWarning, "warning name" ) + ["-w"]["--warn"] + ( "enable warnings" ) + | Opt( [&]( bool flag ) { config.showDurations = flag ? ShowDurations::Always : ShowDurations::Never; }, "yes|no" ) + ["-d"]["--durations"] + ( "show test durations" ) + | Opt( loadTestNamesFromFile, "filename" ) + ["-f"]["--input-file"] + ( "load test names to run from a file" ) + | Opt( config.filenamesAsTags ) + ["-#"]["--filenames-as-tags"] + ( "adds a tag for the filename" ) + | Opt( config.sectionsToRun, "section name" ) + ["-c"]["--section"] + ( "specify section to run" ) + | Opt( setVerbosity, "quiet|normal|high" ) + ["-v"]["--verbosity"] + ( "set output verbosity" ) + | Opt( config.listTestNamesOnly ) + ["--list-test-names-only"] + ( "list all/matching test cases names only" ) + | Opt( config.listReporters ) + ["--list-reporters"] + ( "list all reporters" ) + | Opt( setTestOrder, "decl|lex|rand" ) + ["--order"] + ( "test case order (defaults to decl)" ) + | Opt( setRngSeed, "'time'|number" ) + ["--rng-seed"] + ( "set a specific seed for random numbers" ) + | Opt( setColourUsage, "yes|no" ) + ["--use-colour"] + ( "should output be colourised" ) + | Opt( config.libIdentify ) + ["--libidentify"] + ( "report name and version according to libidentify standard" ) + | Opt( setWaitForKeypress, "start|exit|both" ) + ["--wait-for-keypress"] + ( "waits for a keypress before exiting" ) + | Opt( config.benchmarkResolutionMultiple, "multiplier" ) + ["--benchmark-resolution-multiple"] + ( "multiple of clock resolution to run benchmarks" ) + + | Arg( config.testsOrTags, "test name|pattern|tags" ) + ( "which test or tests to use" ); + + return cli; + } + +} // end namespace Catch +// end catch_commandline.cpp +// start catch_common.cpp + +#include +#include + +namespace Catch { + + bool SourceLineInfo::empty() const noexcept { + return file[0] == '\0'; + } + bool SourceLineInfo::operator == ( SourceLineInfo const& other ) const noexcept { + return line == other.line && (file == other.file || std::strcmp(file, other.file) == 0); + } + bool SourceLineInfo::operator < ( SourceLineInfo const& other ) const noexcept { + // We can assume that the same file will usually have the same pointer. + // Thus, if the pointers are the same, there is no point in calling the strcmp + return line < other.line || ( line == other.line && file != other.file && (std::strcmp(file, other.file) < 0)); + } + + std::ostream& operator << ( std::ostream& os, SourceLineInfo const& info ) { +#ifndef __GNUG__ + os << info.file << '(' << info.line << ')'; +#else + os << info.file << ':' << info.line; +#endif + return os; + } + + std::string StreamEndStop::operator+() const { + return std::string(); + } + + NonCopyable::NonCopyable() = default; + NonCopyable::~NonCopyable() = default; + +} +// end catch_common.cpp +// start catch_config.cpp + +namespace Catch { + + Config::Config( ConfigData const& data ) + : m_data( data ), + m_stream( openStream() ) + { + TestSpecParser parser(ITagAliasRegistry::get()); + if (data.testsOrTags.empty()) { + parser.parse("~[.]"); // All not hidden tests + } + else { + m_hasTestFilters = true; + for( auto const& testOrTags : data.testsOrTags ) + parser.parse( testOrTags ); + } + m_testSpec = parser.testSpec(); + } + + std::string const& Config::getFilename() const { + return m_data.outputFilename ; + } + + bool Config::listTests() const { return m_data.listTests; } + bool Config::listTestNamesOnly() const { return m_data.listTestNamesOnly; } + bool Config::listTags() const { return m_data.listTags; } + bool Config::listReporters() const { return m_data.listReporters; } + + std::string Config::getProcessName() const { return m_data.processName; } + std::string const& Config::getReporterName() const { return m_data.reporterName; } + + std::vector const& Config::getTestsOrTags() const { return m_data.testsOrTags; } + std::vector const& Config::getSectionsToRun() const { return m_data.sectionsToRun; } + + TestSpec const& Config::testSpec() const { return m_testSpec; } + bool Config::hasTestFilters() const { return m_hasTestFilters; } + + bool Config::showHelp() const { return m_data.showHelp; } + + // IConfig interface + bool Config::allowThrows() const { return !m_data.noThrow; } + std::ostream& Config::stream() const { return m_stream->stream(); } + std::string Config::name() const { return m_data.name.empty() ? m_data.processName : m_data.name; } + bool Config::includeSuccessfulResults() const { return m_data.showSuccessfulTests; } + bool Config::warnAboutMissingAssertions() const { return !!(m_data.warnings & WarnAbout::NoAssertions); } + bool Config::warnAboutNoTests() const { return !!(m_data.warnings & WarnAbout::NoTests); } + ShowDurations::OrNot Config::showDurations() const { return m_data.showDurations; } + RunTests::InWhatOrder Config::runOrder() const { return m_data.runOrder; } + unsigned int Config::rngSeed() const { return m_data.rngSeed; } + int Config::benchmarkResolutionMultiple() const { return m_data.benchmarkResolutionMultiple; } + UseColour::YesOrNo Config::useColour() const { return m_data.useColour; } + bool Config::shouldDebugBreak() const { return m_data.shouldDebugBreak; } + int Config::abortAfter() const { return m_data.abortAfter; } + bool Config::showInvisibles() const { return m_data.showInvisibles; } + Verbosity Config::verbosity() const { return m_data.verbosity; } + + IStream const* Config::openStream() { + return Catch::makeStream(m_data.outputFilename); + } + +} // end namespace Catch +// end catch_config.cpp +// start catch_console_colour.cpp + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + +// start catch_errno_guard.h + +namespace Catch { + + class ErrnoGuard { + public: + ErrnoGuard(); + ~ErrnoGuard(); + private: + int m_oldErrno; + }; + +} + +// end catch_errno_guard.h +#include + +namespace Catch { + namespace { + + struct IColourImpl { + virtual ~IColourImpl() = default; + virtual void use( Colour::Code _colourCode ) = 0; + }; + + struct NoColourImpl : IColourImpl { + void use( Colour::Code ) {} + + static IColourImpl* instance() { + static NoColourImpl s_instance; + return &s_instance; + } + }; + + } // anon namespace +} // namespace Catch + +#if !defined( CATCH_CONFIG_COLOUR_NONE ) && !defined( CATCH_CONFIG_COLOUR_WINDOWS ) && !defined( CATCH_CONFIG_COLOUR_ANSI ) +# ifdef CATCH_PLATFORM_WINDOWS +# define CATCH_CONFIG_COLOUR_WINDOWS +# else +# define CATCH_CONFIG_COLOUR_ANSI +# endif +#endif + +#if defined ( CATCH_CONFIG_COLOUR_WINDOWS ) ///////////////////////////////////////// + +namespace Catch { +namespace { + + class Win32ColourImpl : public IColourImpl { + public: + Win32ColourImpl() : stdoutHandle( GetStdHandle(STD_OUTPUT_HANDLE) ) + { + CONSOLE_SCREEN_BUFFER_INFO csbiInfo; + GetConsoleScreenBufferInfo( stdoutHandle, &csbiInfo ); + originalForegroundAttributes = csbiInfo.wAttributes & ~( BACKGROUND_GREEN | BACKGROUND_RED | BACKGROUND_BLUE | BACKGROUND_INTENSITY ); + originalBackgroundAttributes = csbiInfo.wAttributes & ~( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE | FOREGROUND_INTENSITY ); + } + + virtual void use( Colour::Code _colourCode ) override { + switch( _colourCode ) { + case Colour::None: return setTextAttribute( originalForegroundAttributes ); + case Colour::White: return setTextAttribute( FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE ); + case Colour::Red: return setTextAttribute( FOREGROUND_RED ); + case Colour::Green: return setTextAttribute( FOREGROUND_GREEN ); + case Colour::Blue: return setTextAttribute( FOREGROUND_BLUE ); + case Colour::Cyan: return setTextAttribute( FOREGROUND_BLUE | FOREGROUND_GREEN ); + case Colour::Yellow: return setTextAttribute( FOREGROUND_RED | FOREGROUND_GREEN ); + case Colour::Grey: return setTextAttribute( 0 ); + + case Colour::LightGrey: return setTextAttribute( FOREGROUND_INTENSITY ); + case Colour::BrightRed: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED ); + case Colour::BrightGreen: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN ); + case Colour::BrightWhite: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_GREEN | FOREGROUND_RED | FOREGROUND_BLUE ); + case Colour::BrightYellow: return setTextAttribute( FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN ); + + case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" ); + + default: + CATCH_ERROR( "Unknown colour requested" ); + } + } + + private: + void setTextAttribute( WORD _textAttribute ) { + SetConsoleTextAttribute( stdoutHandle, _textAttribute | originalBackgroundAttributes ); + } + HANDLE stdoutHandle; + WORD originalForegroundAttributes; + WORD originalBackgroundAttributes; + }; + + IColourImpl* platformColourInstance() { + static Win32ColourImpl s_instance; + + IConfigPtr config = getCurrentContext().getConfig(); + UseColour::YesOrNo colourMode = config + ? config->useColour() + : UseColour::Auto; + if( colourMode == UseColour::Auto ) + colourMode = UseColour::Yes; + return colourMode == UseColour::Yes + ? &s_instance + : NoColourImpl::instance(); + } + +} // end anon namespace +} // end namespace Catch + +#elif defined( CATCH_CONFIG_COLOUR_ANSI ) ////////////////////////////////////// + +#include + +namespace Catch { +namespace { + + // use POSIX/ ANSI console terminal codes + // Thanks to Adam Strzelecki for original contribution + // (http://github.com/nanoant) + // https://github.com/philsquared/Catch/pull/131 + class PosixColourImpl : public IColourImpl { + public: + virtual void use( Colour::Code _colourCode ) override { + switch( _colourCode ) { + case Colour::None: + case Colour::White: return setColour( "[0m" ); + case Colour::Red: return setColour( "[0;31m" ); + case Colour::Green: return setColour( "[0;32m" ); + case Colour::Blue: return setColour( "[0;34m" ); + case Colour::Cyan: return setColour( "[0;36m" ); + case Colour::Yellow: return setColour( "[0;33m" ); + case Colour::Grey: return setColour( "[1;30m" ); + + case Colour::LightGrey: return setColour( "[0;37m" ); + case Colour::BrightRed: return setColour( "[1;31m" ); + case Colour::BrightGreen: return setColour( "[1;32m" ); + case Colour::BrightWhite: return setColour( "[1;37m" ); + case Colour::BrightYellow: return setColour( "[1;33m" ); + + case Colour::Bright: CATCH_INTERNAL_ERROR( "not a colour" ); + default: CATCH_INTERNAL_ERROR( "Unknown colour requested" ); + } + } + static IColourImpl* instance() { + static PosixColourImpl s_instance; + return &s_instance; + } + + private: + void setColour( const char* _escapeCode ) { + Catch::cout() << '\033' << _escapeCode; + } + }; + + bool useColourOnPlatform() { + return +#ifdef CATCH_PLATFORM_MAC + !isDebuggerActive() && +#endif +#if !(defined(__DJGPP__) && defined(__STRICT_ANSI__)) + isatty(STDOUT_FILENO) +#else + false +#endif + ; + } + IColourImpl* platformColourInstance() { + ErrnoGuard guard; + IConfigPtr config = getCurrentContext().getConfig(); + UseColour::YesOrNo colourMode = config + ? config->useColour() + : UseColour::Auto; + if( colourMode == UseColour::Auto ) + colourMode = useColourOnPlatform() + ? UseColour::Yes + : UseColour::No; + return colourMode == UseColour::Yes + ? PosixColourImpl::instance() + : NoColourImpl::instance(); + } + +} // end anon namespace +} // end namespace Catch + +#else // not Windows or ANSI /////////////////////////////////////////////// + +namespace Catch { + + static IColourImpl* platformColourInstance() { return NoColourImpl::instance(); } + +} // end namespace Catch + +#endif // Windows/ ANSI/ None + +namespace Catch { + + Colour::Colour( Code _colourCode ) { use( _colourCode ); } + Colour::Colour( Colour&& rhs ) noexcept { + m_moved = rhs.m_moved; + rhs.m_moved = true; + } + Colour& Colour::operator=( Colour&& rhs ) noexcept { + m_moved = rhs.m_moved; + rhs.m_moved = true; + return *this; + } + + Colour::~Colour(){ if( !m_moved ) use( None ); } + + void Colour::use( Code _colourCode ) { + static IColourImpl* impl = platformColourInstance(); + impl->use( _colourCode ); + } + + std::ostream& operator << ( std::ostream& os, Colour const& ) { + return os; + } + +} // end namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + +// end catch_console_colour.cpp +// start catch_context.cpp + +namespace Catch { + + class Context : public IMutableContext, NonCopyable { + + public: // IContext + virtual IResultCapture* getResultCapture() override { + return m_resultCapture; + } + virtual IRunner* getRunner() override { + return m_runner; + } + + virtual IConfigPtr const& getConfig() const override { + return m_config; + } + + virtual ~Context() override; + + public: // IMutableContext + virtual void setResultCapture( IResultCapture* resultCapture ) override { + m_resultCapture = resultCapture; + } + virtual void setRunner( IRunner* runner ) override { + m_runner = runner; + } + virtual void setConfig( IConfigPtr const& config ) override { + m_config = config; + } + + friend IMutableContext& getCurrentMutableContext(); + + private: + IConfigPtr m_config; + IRunner* m_runner = nullptr; + IResultCapture* m_resultCapture = nullptr; + }; + + IMutableContext *IMutableContext::currentContext = nullptr; + + void IMutableContext::createContext() + { + currentContext = new Context(); + } + + void cleanUpContext() { + delete IMutableContext::currentContext; + IMutableContext::currentContext = nullptr; + } + IContext::~IContext() = default; + IMutableContext::~IMutableContext() = default; + Context::~Context() = default; +} +// end catch_context.cpp +// start catch_debug_console.cpp + +// start catch_debug_console.h + +#include + +namespace Catch { + void writeToDebugConsole( std::string const& text ); +} + +// end catch_debug_console.h +#ifdef CATCH_PLATFORM_WINDOWS + + namespace Catch { + void writeToDebugConsole( std::string const& text ) { + ::OutputDebugStringA( text.c_str() ); + } + } + +#else + + namespace Catch { + void writeToDebugConsole( std::string const& text ) { + // !TBD: Need a version for Mac/ XCode and other IDEs + Catch::cout() << text; + } + } + +#endif // Platform +// end catch_debug_console.cpp +// start catch_debugger.cpp + +#ifdef CATCH_PLATFORM_MAC + +# include +# include +# include +# include +# include +# include +# include + +namespace Catch { + + // The following function is taken directly from the following technical note: + // http://developer.apple.com/library/mac/#qa/qa2004/qa1361.html + + // Returns true if the current process is being debugged (either + // running under the debugger or has a debugger attached post facto). + bool isDebuggerActive(){ + + int mib[4]; + struct kinfo_proc info; + std::size_t size; + + // Initialize the flags so that, if sysctl fails for some bizarre + // reason, we get a predictable result. + + info.kp_proc.p_flag = 0; + + // Initialize mib, which tells sysctl the info we want, in this case + // we're looking for information about a specific process ID. + + mib[0] = CTL_KERN; + mib[1] = KERN_PROC; + mib[2] = KERN_PROC_PID; + mib[3] = getpid(); + + // Call sysctl. + + size = sizeof(info); + if( sysctl(mib, sizeof(mib) / sizeof(*mib), &info, &size, nullptr, 0) != 0 ) { + Catch::cerr() << "\n** Call to sysctl failed - unable to determine if debugger is active **\n" << std::endl; + return false; + } + + // We're being debugged if the P_TRACED flag is set. + + return ( (info.kp_proc.p_flag & P_TRACED) != 0 ); + } + } // namespace Catch + +#elif defined(CATCH_PLATFORM_LINUX) + #include + #include + + namespace Catch{ + // The standard POSIX way of detecting a debugger is to attempt to + // ptrace() the process, but this needs to be done from a child and not + // this process itself to still allow attaching to this process later + // if wanted, so is rather heavy. Under Linux we have the PID of the + // "debugger" (which doesn't need to be gdb, of course, it could also + // be strace, for example) in /proc/$PID/status, so just get it from + // there instead. + bool isDebuggerActive(){ + // Libstdc++ has a bug, where std::ifstream sets errno to 0 + // This way our users can properly assert over errno values + ErrnoGuard guard; + std::ifstream in("/proc/self/status"); + for( std::string line; std::getline(in, line); ) { + static const int PREFIX_LEN = 11; + if( line.compare(0, PREFIX_LEN, "TracerPid:\t") == 0 ) { + // We're traced if the PID is not 0 and no other PID starts + // with 0 digit, so it's enough to check for just a single + // character. + return line.length() > PREFIX_LEN && line[PREFIX_LEN] != '0'; + } + } + + return false; + } + } // namespace Catch +#elif defined(_MSC_VER) + extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent(); + namespace Catch { + bool isDebuggerActive() { + return IsDebuggerPresent() != 0; + } + } +#elif defined(__MINGW32__) + extern "C" __declspec(dllimport) int __stdcall IsDebuggerPresent(); + namespace Catch { + bool isDebuggerActive() { + return IsDebuggerPresent() != 0; + } + } +#else + namespace Catch { + bool isDebuggerActive() { return false; } + } +#endif // Platform +// end catch_debugger.cpp +// start catch_decomposer.cpp + +namespace Catch { + + ITransientExpression::~ITransientExpression() = default; + + void formatReconstructedExpression( std::ostream &os, std::string const& lhs, StringRef op, std::string const& rhs ) { + if( lhs.size() + rhs.size() < 40 && + lhs.find('\n') == std::string::npos && + rhs.find('\n') == std::string::npos ) + os << lhs << " " << op << " " << rhs; + else + os << lhs << "\n" << op << "\n" << rhs; + } +} +// end catch_decomposer.cpp +// start catch_enforce.cpp + +namespace Catch { +#if defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) && !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS_CUSTOM_HANDLER) + [[noreturn]] + void throw_exception(std::exception const& e) { + Catch::cerr() << "Catch will terminate because it needed to throw an exception.\n" + << "The message was: " << e.what() << '\n'; + std::terminate(); + } +#endif +} // namespace Catch; +// end catch_enforce.cpp +// start catch_errno_guard.cpp + +#include + +namespace Catch { + ErrnoGuard::ErrnoGuard():m_oldErrno(errno){} + ErrnoGuard::~ErrnoGuard() { errno = m_oldErrno; } +} +// end catch_errno_guard.cpp +// start catch_exception_translator_registry.cpp + +// start catch_exception_translator_registry.h + +#include +#include +#include + +namespace Catch { + + class ExceptionTranslatorRegistry : public IExceptionTranslatorRegistry { + public: + ~ExceptionTranslatorRegistry(); + virtual void registerTranslator( const IExceptionTranslator* translator ); + virtual std::string translateActiveException() const override; + std::string tryTranslators() const; + + private: + std::vector> m_translators; + }; +} + +// end catch_exception_translator_registry.h +#ifdef __OBJC__ +#import "Foundation/Foundation.h" +#endif + +namespace Catch { + + ExceptionTranslatorRegistry::~ExceptionTranslatorRegistry() { + } + + void ExceptionTranslatorRegistry::registerTranslator( const IExceptionTranslator* translator ) { + m_translators.push_back( std::unique_ptr( translator ) ); + } + +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + std::string ExceptionTranslatorRegistry::translateActiveException() const { + try { +#ifdef __OBJC__ + // In Objective-C try objective-c exceptions first + @try { + return tryTranslators(); + } + @catch (NSException *exception) { + return Catch::Detail::stringify( [exception description] ); + } +#else + // Compiling a mixed mode project with MSVC means that CLR + // exceptions will be caught in (...) as well. However, these + // do not fill-in std::current_exception and thus lead to crash + // when attempting rethrow. + // /EHa switch also causes structured exceptions to be caught + // here, but they fill-in current_exception properly, so + // at worst the output should be a little weird, instead of + // causing a crash. + if (std::current_exception() == nullptr) { + return "Non C++ exception. Possibly a CLR exception."; + } + return tryTranslators(); +#endif + } + catch( TestFailureException& ) { + std::rethrow_exception(std::current_exception()); + } + catch( std::exception& ex ) { + return ex.what(); + } + catch( std::string& msg ) { + return msg; + } + catch( const char* msg ) { + return msg; + } + catch(...) { + return "Unknown exception"; + } + } + +#else // ^^ Exceptions are enabled // Exceptions are disabled vv + std::string ExceptionTranslatorRegistry::translateActiveException() const { + CATCH_INTERNAL_ERROR("Attempted to translate active exception under CATCH_CONFIG_DISABLE_EXCEPTIONS!"); + } +#endif + + std::string ExceptionTranslatorRegistry::tryTranslators() const { + if( m_translators.empty() ) + std::rethrow_exception(std::current_exception()); + else + return m_translators[0]->translate( m_translators.begin()+1, m_translators.end() ); + } +} +// end catch_exception_translator_registry.cpp +// start catch_fatal_condition.cpp + +#if defined(__GNUC__) +# pragma GCC diagnostic push +# pragma GCC diagnostic ignored "-Wmissing-field-initializers" +#endif + +#if defined( CATCH_CONFIG_WINDOWS_SEH ) || defined( CATCH_CONFIG_POSIX_SIGNALS ) + +namespace { + // Report the error condition + void reportFatal( char const * const message ) { + Catch::getCurrentContext().getResultCapture()->handleFatalErrorCondition( message ); + } +} + +#endif // signals/SEH handling + +#if defined( CATCH_CONFIG_WINDOWS_SEH ) + +namespace Catch { + struct SignalDefs { DWORD id; const char* name; }; + + // There is no 1-1 mapping between signals and windows exceptions. + // Windows can easily distinguish between SO and SigSegV, + // but SigInt, SigTerm, etc are handled differently. + static SignalDefs signalDefs[] = { + { EXCEPTION_ILLEGAL_INSTRUCTION, "SIGILL - Illegal instruction signal" }, + { EXCEPTION_STACK_OVERFLOW, "SIGSEGV - Stack overflow" }, + { EXCEPTION_ACCESS_VIOLATION, "SIGSEGV - Segmentation violation signal" }, + { EXCEPTION_INT_DIVIDE_BY_ZERO, "Divide by zero error" }, + }; + + LONG CALLBACK FatalConditionHandler::handleVectoredException(PEXCEPTION_POINTERS ExceptionInfo) { + for (auto const& def : signalDefs) { + if (ExceptionInfo->ExceptionRecord->ExceptionCode == def.id) { + reportFatal(def.name); + } + } + // If its not an exception we care about, pass it along. + // This stops us from eating debugger breaks etc. + return EXCEPTION_CONTINUE_SEARCH; + } + + FatalConditionHandler::FatalConditionHandler() { + isSet = true; + // 32k seems enough for Catch to handle stack overflow, + // but the value was found experimentally, so there is no strong guarantee + guaranteeSize = 32 * 1024; + exceptionHandlerHandle = nullptr; + // Register as first handler in current chain + exceptionHandlerHandle = AddVectoredExceptionHandler(1, handleVectoredException); + // Pass in guarantee size to be filled + SetThreadStackGuarantee(&guaranteeSize); + } + + void FatalConditionHandler::reset() { + if (isSet) { + RemoveVectoredExceptionHandler(exceptionHandlerHandle); + SetThreadStackGuarantee(&guaranteeSize); + exceptionHandlerHandle = nullptr; + isSet = false; + } + } + + FatalConditionHandler::~FatalConditionHandler() { + reset(); + } + +bool FatalConditionHandler::isSet = false; +ULONG FatalConditionHandler::guaranteeSize = 0; +PVOID FatalConditionHandler::exceptionHandlerHandle = nullptr; + +} // namespace Catch + +#elif defined( CATCH_CONFIG_POSIX_SIGNALS ) + +namespace Catch { + + struct SignalDefs { + int id; + const char* name; + }; + + // 32kb for the alternate stack seems to be sufficient. However, this value + // is experimentally determined, so that's not guaranteed. + constexpr static std::size_t sigStackSize = 32768 >= MINSIGSTKSZ ? 32768 : MINSIGSTKSZ; + + static SignalDefs signalDefs[] = { + { SIGINT, "SIGINT - Terminal interrupt signal" }, + { SIGILL, "SIGILL - Illegal instruction signal" }, + { SIGFPE, "SIGFPE - Floating point error signal" }, + { SIGSEGV, "SIGSEGV - Segmentation violation signal" }, + { SIGTERM, "SIGTERM - Termination request signal" }, + { SIGABRT, "SIGABRT - Abort (abnormal termination) signal" } + }; + + void FatalConditionHandler::handleSignal( int sig ) { + char const * name = ""; + for (auto const& def : signalDefs) { + if (sig == def.id) { + name = def.name; + break; + } + } + reset(); + reportFatal(name); + raise( sig ); + } + + FatalConditionHandler::FatalConditionHandler() { + isSet = true; + stack_t sigStack; + sigStack.ss_sp = altStackMem; + sigStack.ss_size = sigStackSize; + sigStack.ss_flags = 0; + sigaltstack(&sigStack, &oldSigStack); + struct sigaction sa = { }; + + sa.sa_handler = handleSignal; + sa.sa_flags = SA_ONSTACK; + for (std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i) { + sigaction(signalDefs[i].id, &sa, &oldSigActions[i]); + } + } + + FatalConditionHandler::~FatalConditionHandler() { + reset(); + } + + void FatalConditionHandler::reset() { + if( isSet ) { + // Set signals back to previous values -- hopefully nobody overwrote them in the meantime + for( std::size_t i = 0; i < sizeof(signalDefs)/sizeof(SignalDefs); ++i ) { + sigaction(signalDefs[i].id, &oldSigActions[i], nullptr); + } + // Return the old stack + sigaltstack(&oldSigStack, nullptr); + isSet = false; + } + } + + bool FatalConditionHandler::isSet = false; + struct sigaction FatalConditionHandler::oldSigActions[sizeof(signalDefs)/sizeof(SignalDefs)] = {}; + stack_t FatalConditionHandler::oldSigStack = {}; + char FatalConditionHandler::altStackMem[sigStackSize] = {}; + +} // namespace Catch + +#else + +namespace Catch { + void FatalConditionHandler::reset() {} +} + +#endif // signals/SEH handling + +#if defined(__GNUC__) +# pragma GCC diagnostic pop +#endif +// end catch_fatal_condition.cpp +// start catch_generators.cpp + +// start catch_random_number_generator.h + +#include +#include + +namespace Catch { + + struct IConfig; + + std::mt19937& rng(); + void seedRng( IConfig const& config ); + unsigned int rngSeed(); + +} + +// end catch_random_number_generator.h +#include +#include + +namespace Catch { + +IGeneratorTracker::~IGeneratorTracker() {} + +namespace Generators { + + GeneratorBase::~GeneratorBase() {} + + std::vector randomiseIndices( size_t selectionSize, size_t sourceSize ) { + + assert( selectionSize <= sourceSize ); + std::vector indices; + indices.reserve( selectionSize ); + std::uniform_int_distribution uid( 0, sourceSize-1 ); + + std::set seen; + // !TBD: improve this algorithm + while( indices.size() < selectionSize ) { + auto index = uid( rng() ); + if( seen.insert( index ).second ) + indices.push_back( index ); + } + return indices; + } + + auto acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { + return getResultCapture().acquireGeneratorTracker( lineInfo ); + } + + template<> + auto all() -> Generator { + return range( std::numeric_limits::min(), std::numeric_limits::max() ); + } + +} // namespace Generators +} // namespace Catch +// end catch_generators.cpp +// start catch_interfaces_capture.cpp + +namespace Catch { + IResultCapture::~IResultCapture() = default; +} +// end catch_interfaces_capture.cpp +// start catch_interfaces_config.cpp + +namespace Catch { + IConfig::~IConfig() = default; +} +// end catch_interfaces_config.cpp +// start catch_interfaces_exception.cpp + +namespace Catch { + IExceptionTranslator::~IExceptionTranslator() = default; + IExceptionTranslatorRegistry::~IExceptionTranslatorRegistry() = default; +} +// end catch_interfaces_exception.cpp +// start catch_interfaces_registry_hub.cpp + +namespace Catch { + IRegistryHub::~IRegistryHub() = default; + IMutableRegistryHub::~IMutableRegistryHub() = default; +} +// end catch_interfaces_registry_hub.cpp +// start catch_interfaces_reporter.cpp + +// start catch_reporter_listening.h + +namespace Catch { + + class ListeningReporter : public IStreamingReporter { + using Reporters = std::vector; + Reporters m_listeners; + IStreamingReporterPtr m_reporter = nullptr; + ReporterPreferences m_preferences; + + public: + ListeningReporter(); + + void addListener( IStreamingReporterPtr&& listener ); + void addReporter( IStreamingReporterPtr&& reporter ); + + public: // IStreamingReporter + + ReporterPreferences getPreferences() const override; + + void noMatchingTestCases( std::string const& spec ) override; + + static std::set getSupportedVerbosities(); + + void benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) override; + void benchmarkEnded( BenchmarkStats const& benchmarkStats ) override; + + void testRunStarting( TestRunInfo const& testRunInfo ) override; + void testGroupStarting( GroupInfo const& groupInfo ) override; + void testCaseStarting( TestCaseInfo const& testInfo ) override; + void sectionStarting( SectionInfo const& sectionInfo ) override; + void assertionStarting( AssertionInfo const& assertionInfo ) override; + + // The return value indicates if the messages buffer should be cleared: + bool assertionEnded( AssertionStats const& assertionStats ) override; + void sectionEnded( SectionStats const& sectionStats ) override; + void testCaseEnded( TestCaseStats const& testCaseStats ) override; + void testGroupEnded( TestGroupStats const& testGroupStats ) override; + void testRunEnded( TestRunStats const& testRunStats ) override; + + void skipTest( TestCaseInfo const& testInfo ) override; + bool isMulti() const override; + + }; + +} // end namespace Catch + +// end catch_reporter_listening.h +namespace Catch { + + ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig ) + : m_stream( &_fullConfig->stream() ), m_fullConfig( _fullConfig ) {} + + ReporterConfig::ReporterConfig( IConfigPtr const& _fullConfig, std::ostream& _stream ) + : m_stream( &_stream ), m_fullConfig( _fullConfig ) {} + + std::ostream& ReporterConfig::stream() const { return *m_stream; } + IConfigPtr ReporterConfig::fullConfig() const { return m_fullConfig; } + + TestRunInfo::TestRunInfo( std::string const& _name ) : name( _name ) {} + + GroupInfo::GroupInfo( std::string const& _name, + std::size_t _groupIndex, + std::size_t _groupsCount ) + : name( _name ), + groupIndex( _groupIndex ), + groupsCounts( _groupsCount ) + {} + + AssertionStats::AssertionStats( AssertionResult const& _assertionResult, + std::vector const& _infoMessages, + Totals const& _totals ) + : assertionResult( _assertionResult ), + infoMessages( _infoMessages ), + totals( _totals ) + { + assertionResult.m_resultData.lazyExpression.m_transientExpression = _assertionResult.m_resultData.lazyExpression.m_transientExpression; + + if( assertionResult.hasMessage() ) { + // Copy message into messages list. + // !TBD This should have been done earlier, somewhere + MessageBuilder builder( assertionResult.getTestMacroName(), assertionResult.getSourceInfo(), assertionResult.getResultType() ); + builder << assertionResult.getMessage(); + builder.m_info.message = builder.m_stream.str(); + + infoMessages.push_back( builder.m_info ); + } + } + + AssertionStats::~AssertionStats() = default; + + SectionStats::SectionStats( SectionInfo const& _sectionInfo, + Counts const& _assertions, + double _durationInSeconds, + bool _missingAssertions ) + : sectionInfo( _sectionInfo ), + assertions( _assertions ), + durationInSeconds( _durationInSeconds ), + missingAssertions( _missingAssertions ) + {} + + SectionStats::~SectionStats() = default; + + TestCaseStats::TestCaseStats( TestCaseInfo const& _testInfo, + Totals const& _totals, + std::string const& _stdOut, + std::string const& _stdErr, + bool _aborting ) + : testInfo( _testInfo ), + totals( _totals ), + stdOut( _stdOut ), + stdErr( _stdErr ), + aborting( _aborting ) + {} + + TestCaseStats::~TestCaseStats() = default; + + TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo, + Totals const& _totals, + bool _aborting ) + : groupInfo( _groupInfo ), + totals( _totals ), + aborting( _aborting ) + {} + + TestGroupStats::TestGroupStats( GroupInfo const& _groupInfo ) + : groupInfo( _groupInfo ), + aborting( false ) + {} + + TestGroupStats::~TestGroupStats() = default; + + TestRunStats::TestRunStats( TestRunInfo const& _runInfo, + Totals const& _totals, + bool _aborting ) + : runInfo( _runInfo ), + totals( _totals ), + aborting( _aborting ) + {} + + TestRunStats::~TestRunStats() = default; + + void IStreamingReporter::fatalErrorEncountered( StringRef ) {} + bool IStreamingReporter::isMulti() const { return false; } + + IReporterFactory::~IReporterFactory() = default; + IReporterRegistry::~IReporterRegistry() = default; + +} // end namespace Catch +// end catch_interfaces_reporter.cpp +// start catch_interfaces_runner.cpp + +namespace Catch { + IRunner::~IRunner() = default; +} +// end catch_interfaces_runner.cpp +// start catch_interfaces_testcase.cpp + +namespace Catch { + ITestInvoker::~ITestInvoker() = default; + ITestCaseRegistry::~ITestCaseRegistry() = default; +} +// end catch_interfaces_testcase.cpp +// start catch_leak_detector.cpp + +#ifdef CATCH_CONFIG_WINDOWS_CRTDBG +#include + +namespace Catch { + + LeakDetector::LeakDetector() { + int flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); + flag |= _CRTDBG_LEAK_CHECK_DF; + flag |= _CRTDBG_ALLOC_MEM_DF; + _CrtSetDbgFlag(flag); + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); + _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); + // Change this to leaking allocation's number to break there + _CrtSetBreakAlloc(-1); + } +} + +#else + + Catch::LeakDetector::LeakDetector() {} + +#endif + +Catch::LeakDetector::~LeakDetector() { + Catch::cleanUp(); +} +// end catch_leak_detector.cpp +// start catch_list.cpp + +// start catch_list.h + +#include + +namespace Catch { + + std::size_t listTests( Config const& config ); + + std::size_t listTestsNamesOnly( Config const& config ); + + struct TagInfo { + void add( std::string const& spelling ); + std::string all() const; + + std::set spellings; + std::size_t count = 0; + }; + + std::size_t listTags( Config const& config ); + + std::size_t listReporters(); + + Option list( Config const& config ); + +} // end namespace Catch + +// end catch_list.h +// start catch_text.h + +namespace Catch { + using namespace clara::TextFlow; +} + +// end catch_text.h +#include +#include +#include + +namespace Catch { + + std::size_t listTests( Config const& config ) { + TestSpec testSpec = config.testSpec(); + if( config.hasTestFilters() ) + Catch::cout() << "Matching test cases:\n"; + else { + Catch::cout() << "All available test cases:\n"; + } + + auto matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); + for( auto const& testCaseInfo : matchedTestCases ) { + Colour::Code colour = testCaseInfo.isHidden() + ? Colour::SecondaryText + : Colour::None; + Colour colourGuard( colour ); + + Catch::cout() << Column( testCaseInfo.name ).initialIndent( 2 ).indent( 4 ) << "\n"; + if( config.verbosity() >= Verbosity::High ) { + Catch::cout() << Column( Catch::Detail::stringify( testCaseInfo.lineInfo ) ).indent(4) << std::endl; + std::string description = testCaseInfo.description; + if( description.empty() ) + description = "(NO DESCRIPTION)"; + Catch::cout() << Column( description ).indent(4) << std::endl; + } + if( !testCaseInfo.tags.empty() ) + Catch::cout() << Column( testCaseInfo.tagsAsString() ).indent( 6 ) << "\n"; + } + + if( !config.hasTestFilters() ) + Catch::cout() << pluralise( matchedTestCases.size(), "test case" ) << '\n' << std::endl; + else + Catch::cout() << pluralise( matchedTestCases.size(), "matching test case" ) << '\n' << std::endl; + return matchedTestCases.size(); + } + + std::size_t listTestsNamesOnly( Config const& config ) { + TestSpec testSpec = config.testSpec(); + std::size_t matchedTests = 0; + std::vector matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); + for( auto const& testCaseInfo : matchedTestCases ) { + matchedTests++; + if( startsWith( testCaseInfo.name, '#' ) ) + Catch::cout() << '"' << testCaseInfo.name << '"'; + else + Catch::cout() << testCaseInfo.name; + if ( config.verbosity() >= Verbosity::High ) + Catch::cout() << "\t@" << testCaseInfo.lineInfo; + Catch::cout() << std::endl; + } + return matchedTests; + } + + void TagInfo::add( std::string const& spelling ) { + ++count; + spellings.insert( spelling ); + } + + std::string TagInfo::all() const { + std::string out; + for( auto const& spelling : spellings ) + out += "[" + spelling + "]"; + return out; + } + + std::size_t listTags( Config const& config ) { + TestSpec testSpec = config.testSpec(); + if( config.hasTestFilters() ) + Catch::cout() << "Tags for matching test cases:\n"; + else { + Catch::cout() << "All available tags:\n"; + } + + std::map tagCounts; + + std::vector matchedTestCases = filterTests( getAllTestCasesSorted( config ), testSpec, config ); + for( auto const& testCase : matchedTestCases ) { + for( auto const& tagName : testCase.getTestCaseInfo().tags ) { + std::string lcaseTagName = toLower( tagName ); + auto countIt = tagCounts.find( lcaseTagName ); + if( countIt == tagCounts.end() ) + countIt = tagCounts.insert( std::make_pair( lcaseTagName, TagInfo() ) ).first; + countIt->second.add( tagName ); + } + } + + for( auto const& tagCount : tagCounts ) { + ReusableStringStream rss; + rss << " " << std::setw(2) << tagCount.second.count << " "; + auto str = rss.str(); + auto wrapper = Column( tagCount.second.all() ) + .initialIndent( 0 ) + .indent( str.size() ) + .width( CATCH_CONFIG_CONSOLE_WIDTH-10 ); + Catch::cout() << str << wrapper << '\n'; + } + Catch::cout() << pluralise( tagCounts.size(), "tag" ) << '\n' << std::endl; + return tagCounts.size(); + } + + std::size_t listReporters() { + Catch::cout() << "Available reporters:\n"; + IReporterRegistry::FactoryMap const& factories = getRegistryHub().getReporterRegistry().getFactories(); + std::size_t maxNameLen = 0; + for( auto const& factoryKvp : factories ) + maxNameLen = (std::max)( maxNameLen, factoryKvp.first.size() ); + + for( auto const& factoryKvp : factories ) { + Catch::cout() + << Column( factoryKvp.first + ":" ) + .indent(2) + .width( 5+maxNameLen ) + + Column( factoryKvp.second->getDescription() ) + .initialIndent(0) + .indent(2) + .width( CATCH_CONFIG_CONSOLE_WIDTH - maxNameLen-8 ) + << "\n"; + } + Catch::cout() << std::endl; + return factories.size(); + } + + Option list( Config const& config ) { + Option listedCount; + if( config.listTests() ) + listedCount = listedCount.valueOr(0) + listTests( config ); + if( config.listTestNamesOnly() ) + listedCount = listedCount.valueOr(0) + listTestsNamesOnly( config ); + if( config.listTags() ) + listedCount = listedCount.valueOr(0) + listTags( config ); + if( config.listReporters() ) + listedCount = listedCount.valueOr(0) + listReporters(); + return listedCount; + } + +} // end namespace Catch +// end catch_list.cpp +// start catch_matchers.cpp + +namespace Catch { +namespace Matchers { + namespace Impl { + + std::string MatcherUntypedBase::toString() const { + if( m_cachedToString.empty() ) + m_cachedToString = describe(); + return m_cachedToString; + } + + MatcherUntypedBase::~MatcherUntypedBase() = default; + + } // namespace Impl +} // namespace Matchers + +using namespace Matchers; +using Matchers::Impl::MatcherBase; + +} // namespace Catch +// end catch_matchers.cpp +// start catch_matchers_floating.cpp + +// start catch_polyfills.hpp + +namespace Catch { + bool isnan(float f); + bool isnan(double d); +} + +// end catch_polyfills.hpp +// start catch_to_string.hpp + +#include + +namespace Catch { + template + std::string to_string(T const& t) { +#if defined(CATCH_CONFIG_CPP11_TO_STRING) + return std::to_string(t); +#else + ReusableStringStream rss; + rss << t; + return rss.str(); +#endif + } +} // end namespace Catch + +// end catch_to_string.hpp +#include +#include +#include + +namespace Catch { +namespace Matchers { +namespace Floating { +enum class FloatingPointKind : uint8_t { + Float, + Double +}; +} +} +} + +namespace { + +template +struct Converter; + +template <> +struct Converter { + static_assert(sizeof(float) == sizeof(int32_t), "Important ULP matcher assumption violated"); + Converter(float f) { + std::memcpy(&i, &f, sizeof(f)); + } + int32_t i; +}; + +template <> +struct Converter { + static_assert(sizeof(double) == sizeof(int64_t), "Important ULP matcher assumption violated"); + Converter(double d) { + std::memcpy(&i, &d, sizeof(d)); + } + int64_t i; +}; + +template +auto convert(T t) -> Converter { + return Converter(t); +} + +template +bool almostEqualUlps(FP lhs, FP rhs, int maxUlpDiff) { + // Comparison with NaN should always be false. + // This way we can rule it out before getting into the ugly details + if (Catch::isnan(lhs) || Catch::isnan(rhs)) { + return false; + } + + auto lc = convert(lhs); + auto rc = convert(rhs); + + if ((lc.i < 0) != (rc.i < 0)) { + // Potentially we can have +0 and -0 + return lhs == rhs; + } + + auto ulpDiff = std::abs(lc.i - rc.i); + return ulpDiff <= maxUlpDiff; +} + +} + +namespace Catch { +namespace Matchers { +namespace Floating { + WithinAbsMatcher::WithinAbsMatcher(double target, double margin) + :m_target{ target }, m_margin{ margin } { + CATCH_ENFORCE(margin >= 0, "Invalid margin: " << margin << '.' + << " Margin has to be non-negative."); + } + + // Performs equivalent check of std::fabs(lhs - rhs) <= margin + // But without the subtraction to allow for INFINITY in comparison + bool WithinAbsMatcher::match(double const& matchee) const { + return (matchee + m_margin >= m_target) && (m_target + m_margin >= matchee); + } + + std::string WithinAbsMatcher::describe() const { + return "is within " + ::Catch::Detail::stringify(m_margin) + " of " + ::Catch::Detail::stringify(m_target); + } + + WithinUlpsMatcher::WithinUlpsMatcher(double target, int ulps, FloatingPointKind baseType) + :m_target{ target }, m_ulps{ ulps }, m_type{ baseType } { + CATCH_ENFORCE(ulps >= 0, "Invalid ULP setting: " << ulps << '.' + << " ULPs have to be non-negative."); + } + +#if defined(__clang__) +#pragma clang diagnostic push +// Clang <3.5 reports on the default branch in the switch below +#pragma clang diagnostic ignored "-Wunreachable-code" +#endif + + bool WithinUlpsMatcher::match(double const& matchee) const { + switch (m_type) { + case FloatingPointKind::Float: + return almostEqualUlps(static_cast(matchee), static_cast(m_target), m_ulps); + case FloatingPointKind::Double: + return almostEqualUlps(matchee, m_target, m_ulps); + default: + CATCH_INTERNAL_ERROR( "Unknown FloatingPointKind value" ); + } + } + +#if defined(__clang__) +#pragma clang diagnostic pop +#endif + + std::string WithinUlpsMatcher::describe() const { + return "is within " + Catch::to_string(m_ulps) + " ULPs of " + ::Catch::Detail::stringify(m_target) + ((m_type == FloatingPointKind::Float)? "f" : ""); + } + +}// namespace Floating + +Floating::WithinUlpsMatcher WithinULP(double target, int maxUlpDiff) { + return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Double); +} + +Floating::WithinUlpsMatcher WithinULP(float target, int maxUlpDiff) { + return Floating::WithinUlpsMatcher(target, maxUlpDiff, Floating::FloatingPointKind::Float); +} + +Floating::WithinAbsMatcher WithinAbs(double target, double margin) { + return Floating::WithinAbsMatcher(target, margin); +} + +} // namespace Matchers +} // namespace Catch + +// end catch_matchers_floating.cpp +// start catch_matchers_generic.cpp + +std::string Catch::Matchers::Generic::Detail::finalizeDescription(const std::string& desc) { + if (desc.empty()) { + return "matches undescribed predicate"; + } else { + return "matches predicate: \"" + desc + '"'; + } +} +// end catch_matchers_generic.cpp +// start catch_matchers_string.cpp + +#include + +namespace Catch { +namespace Matchers { + + namespace StdString { + + CasedString::CasedString( std::string const& str, CaseSensitive::Choice caseSensitivity ) + : m_caseSensitivity( caseSensitivity ), + m_str( adjustString( str ) ) + {} + std::string CasedString::adjustString( std::string const& str ) const { + return m_caseSensitivity == CaseSensitive::No + ? toLower( str ) + : str; + } + std::string CasedString::caseSensitivitySuffix() const { + return m_caseSensitivity == CaseSensitive::No + ? " (case insensitive)" + : std::string(); + } + + StringMatcherBase::StringMatcherBase( std::string const& operation, CasedString const& comparator ) + : m_comparator( comparator ), + m_operation( operation ) { + } + + std::string StringMatcherBase::describe() const { + std::string description; + description.reserve(5 + m_operation.size() + m_comparator.m_str.size() + + m_comparator.caseSensitivitySuffix().size()); + description += m_operation; + description += ": \""; + description += m_comparator.m_str; + description += "\""; + description += m_comparator.caseSensitivitySuffix(); + return description; + } + + EqualsMatcher::EqualsMatcher( CasedString const& comparator ) : StringMatcherBase( "equals", comparator ) {} + + bool EqualsMatcher::match( std::string const& source ) const { + return m_comparator.adjustString( source ) == m_comparator.m_str; + } + + ContainsMatcher::ContainsMatcher( CasedString const& comparator ) : StringMatcherBase( "contains", comparator ) {} + + bool ContainsMatcher::match( std::string const& source ) const { + return contains( m_comparator.adjustString( source ), m_comparator.m_str ); + } + + StartsWithMatcher::StartsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "starts with", comparator ) {} + + bool StartsWithMatcher::match( std::string const& source ) const { + return startsWith( m_comparator.adjustString( source ), m_comparator.m_str ); + } + + EndsWithMatcher::EndsWithMatcher( CasedString const& comparator ) : StringMatcherBase( "ends with", comparator ) {} + + bool EndsWithMatcher::match( std::string const& source ) const { + return endsWith( m_comparator.adjustString( source ), m_comparator.m_str ); + } + + RegexMatcher::RegexMatcher(std::string regex, CaseSensitive::Choice caseSensitivity): m_regex(std::move(regex)), m_caseSensitivity(caseSensitivity) {} + + bool RegexMatcher::match(std::string const& matchee) const { + auto flags = std::regex::ECMAScript; // ECMAScript is the default syntax option anyway + if (m_caseSensitivity == CaseSensitive::Choice::No) { + flags |= std::regex::icase; + } + auto reg = std::regex(m_regex, flags); + return std::regex_match(matchee, reg); + } + + std::string RegexMatcher::describe() const { + return "matches " + ::Catch::Detail::stringify(m_regex) + ((m_caseSensitivity == CaseSensitive::Choice::Yes)? " case sensitively" : " case insensitively"); + } + + } // namespace StdString + + StdString::EqualsMatcher Equals( std::string const& str, CaseSensitive::Choice caseSensitivity ) { + return StdString::EqualsMatcher( StdString::CasedString( str, caseSensitivity) ); + } + StdString::ContainsMatcher Contains( std::string const& str, CaseSensitive::Choice caseSensitivity ) { + return StdString::ContainsMatcher( StdString::CasedString( str, caseSensitivity) ); + } + StdString::EndsWithMatcher EndsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) { + return StdString::EndsWithMatcher( StdString::CasedString( str, caseSensitivity) ); + } + StdString::StartsWithMatcher StartsWith( std::string const& str, CaseSensitive::Choice caseSensitivity ) { + return StdString::StartsWithMatcher( StdString::CasedString( str, caseSensitivity) ); + } + + StdString::RegexMatcher Matches(std::string const& regex, CaseSensitive::Choice caseSensitivity) { + return StdString::RegexMatcher(regex, caseSensitivity); + } + +} // namespace Matchers +} // namespace Catch +// end catch_matchers_string.cpp +// start catch_message.cpp + +// start catch_uncaught_exceptions.h + +namespace Catch { + bool uncaught_exceptions(); +} // end namespace Catch + +// end catch_uncaught_exceptions.h +#include +#include + +namespace Catch { + + MessageInfo::MessageInfo( StringRef const& _macroName, + SourceLineInfo const& _lineInfo, + ResultWas::OfType _type ) + : macroName( _macroName ), + lineInfo( _lineInfo ), + type( _type ), + sequence( ++globalCount ) + {} + + bool MessageInfo::operator==( MessageInfo const& other ) const { + return sequence == other.sequence; + } + + bool MessageInfo::operator<( MessageInfo const& other ) const { + return sequence < other.sequence; + } + + // This may need protecting if threading support is added + unsigned int MessageInfo::globalCount = 0; + + //////////////////////////////////////////////////////////////////////////// + + Catch::MessageBuilder::MessageBuilder( StringRef const& macroName, + SourceLineInfo const& lineInfo, + ResultWas::OfType type ) + :m_info(macroName, lineInfo, type) {} + + //////////////////////////////////////////////////////////////////////////// + + ScopedMessage::ScopedMessage( MessageBuilder const& builder ) + : m_info( builder.m_info ) + { + m_info.message = builder.m_stream.str(); + getResultCapture().pushScopedMessage( m_info ); + } + + ScopedMessage::~ScopedMessage() { + if ( !uncaught_exceptions() ){ + getResultCapture().popScopedMessage(m_info); + } + } + + Capturer::Capturer( StringRef macroName, SourceLineInfo const& lineInfo, ResultWas::OfType resultType, StringRef names ) { + auto trimmed = [&] (size_t start, size_t end) { + while (names[start] == ',' || isspace(names[start])) { + ++start; + } + while (names[end] == ',' || isspace(names[end])) { + --end; + } + return names.substr(start, end - start + 1); + }; + + size_t start = 0; + std::stack openings; + for (size_t pos = 0; pos < names.size(); ++pos) { + char c = names[pos]; + switch (c) { + case '[': + case '{': + case '(': + // It is basically impossible to disambiguate between + // comparison and start of template args in this context +// case '<': + openings.push(c); + break; + case ']': + case '}': + case ')': +// case '>': + openings.pop(); + break; + case ',': + if (start != pos && openings.size() == 0) { + m_messages.emplace_back(macroName, lineInfo, resultType); + m_messages.back().message = trimmed(start, pos); + m_messages.back().message += " := "; + start = pos; + } + } + } + assert(openings.size() == 0 && "Mismatched openings"); + m_messages.emplace_back(macroName, lineInfo, resultType); + m_messages.back().message = trimmed(start, names.size() - 1); + m_messages.back().message += " := "; + } + Capturer::~Capturer() { + if ( !uncaught_exceptions() ){ + assert( m_captured == m_messages.size() ); + for( size_t i = 0; i < m_captured; ++i ) + m_resultCapture.popScopedMessage( m_messages[i] ); + } + } + + void Capturer::captureValue( size_t index, std::string const& value ) { + assert( index < m_messages.size() ); + m_messages[index].message += value; + m_resultCapture.pushScopedMessage( m_messages[index] ); + m_captured++; + } + +} // end namespace Catch +// end catch_message.cpp +// start catch_output_redirect.cpp + +// start catch_output_redirect.h +#ifndef TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H +#define TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H + +#include +#include +#include + +namespace Catch { + + class RedirectedStream { + std::ostream& m_originalStream; + std::ostream& m_redirectionStream; + std::streambuf* m_prevBuf; + + public: + RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream ); + ~RedirectedStream(); + }; + + class RedirectedStdOut { + ReusableStringStream m_rss; + RedirectedStream m_cout; + public: + RedirectedStdOut(); + auto str() const -> std::string; + }; + + // StdErr has two constituent streams in C++, std::cerr and std::clog + // This means that we need to redirect 2 streams into 1 to keep proper + // order of writes + class RedirectedStdErr { + ReusableStringStream m_rss; + RedirectedStream m_cerr; + RedirectedStream m_clog; + public: + RedirectedStdErr(); + auto str() const -> std::string; + }; + +#if defined(CATCH_CONFIG_NEW_CAPTURE) + + // Windows's implementation of std::tmpfile is terrible (it tries + // to create a file inside system folder, thus requiring elevated + // privileges for the binary), so we have to use tmpnam(_s) and + // create the file ourselves there. + class TempFile { + public: + TempFile(TempFile const&) = delete; + TempFile& operator=(TempFile const&) = delete; + TempFile(TempFile&&) = delete; + TempFile& operator=(TempFile&&) = delete; + + TempFile(); + ~TempFile(); + + std::FILE* getFile(); + std::string getContents(); + + private: + std::FILE* m_file = nullptr; + #if defined(_MSC_VER) + char m_buffer[L_tmpnam] = { 0 }; + #endif + }; + + class OutputRedirect { + public: + OutputRedirect(OutputRedirect const&) = delete; + OutputRedirect& operator=(OutputRedirect const&) = delete; + OutputRedirect(OutputRedirect&&) = delete; + OutputRedirect& operator=(OutputRedirect&&) = delete; + + OutputRedirect(std::string& stdout_dest, std::string& stderr_dest); + ~OutputRedirect(); + + private: + int m_originalStdout = -1; + int m_originalStderr = -1; + TempFile m_stdoutFile; + TempFile m_stderrFile; + std::string& m_stdoutDest; + std::string& m_stderrDest; + }; + +#endif + +} // end namespace Catch + +#endif // TWOBLUECUBES_CATCH_OUTPUT_REDIRECT_H +// end catch_output_redirect.h +#include +#include +#include +#include +#include + +#if defined(CATCH_CONFIG_NEW_CAPTURE) + #if defined(_MSC_VER) + #include //_dup and _dup2 + #define dup _dup + #define dup2 _dup2 + #define fileno _fileno + #else + #include // dup and dup2 + #endif +#endif + +namespace Catch { + + RedirectedStream::RedirectedStream( std::ostream& originalStream, std::ostream& redirectionStream ) + : m_originalStream( originalStream ), + m_redirectionStream( redirectionStream ), + m_prevBuf( m_originalStream.rdbuf() ) + { + m_originalStream.rdbuf( m_redirectionStream.rdbuf() ); + } + + RedirectedStream::~RedirectedStream() { + m_originalStream.rdbuf( m_prevBuf ); + } + + RedirectedStdOut::RedirectedStdOut() : m_cout( Catch::cout(), m_rss.get() ) {} + auto RedirectedStdOut::str() const -> std::string { return m_rss.str(); } + + RedirectedStdErr::RedirectedStdErr() + : m_cerr( Catch::cerr(), m_rss.get() ), + m_clog( Catch::clog(), m_rss.get() ) + {} + auto RedirectedStdErr::str() const -> std::string { return m_rss.str(); } + +#if defined(CATCH_CONFIG_NEW_CAPTURE) + +#if defined(_MSC_VER) + TempFile::TempFile() { + if (tmpnam_s(m_buffer)) { + CATCH_RUNTIME_ERROR("Could not get a temp filename"); + } + if (fopen_s(&m_file, m_buffer, "w")) { + char buffer[100]; + if (strerror_s(buffer, errno)) { + CATCH_RUNTIME_ERROR("Could not translate errno to a string"); + } + CATCH_RUNTIME_ERROR("Could not open the temp file: '" << m_buffer << "' because: " << buffer); + } + } +#else + TempFile::TempFile() { + m_file = std::tmpfile(); + if (!m_file) { + CATCH_RUNTIME_ERROR("Could not create a temp file."); + } + } + +#endif + + TempFile::~TempFile() { + // TBD: What to do about errors here? + std::fclose(m_file); + // We manually create the file on Windows only, on Linux + // it will be autodeleted +#if defined(_MSC_VER) + std::remove(m_buffer); +#endif + } + + FILE* TempFile::getFile() { + return m_file; + } + + std::string TempFile::getContents() { + std::stringstream sstr; + char buffer[100] = {}; + std::rewind(m_file); + while (std::fgets(buffer, sizeof(buffer), m_file)) { + sstr << buffer; + } + return sstr.str(); + } + + OutputRedirect::OutputRedirect(std::string& stdout_dest, std::string& stderr_dest) : + m_originalStdout(dup(1)), + m_originalStderr(dup(2)), + m_stdoutDest(stdout_dest), + m_stderrDest(stderr_dest) { + dup2(fileno(m_stdoutFile.getFile()), 1); + dup2(fileno(m_stderrFile.getFile()), 2); + } + + OutputRedirect::~OutputRedirect() { + Catch::cout() << std::flush; + fflush(stdout); + // Since we support overriding these streams, we flush cerr + // even though std::cerr is unbuffered + Catch::cerr() << std::flush; + Catch::clog() << std::flush; + fflush(stderr); + + dup2(m_originalStdout, 1); + dup2(m_originalStderr, 2); + + m_stdoutDest += m_stdoutFile.getContents(); + m_stderrDest += m_stderrFile.getContents(); + } + +#endif // CATCH_CONFIG_NEW_CAPTURE + +} // namespace Catch + +#if defined(CATCH_CONFIG_NEW_CAPTURE) + #if defined(_MSC_VER) + #undef dup + #undef dup2 + #undef fileno + #endif +#endif +// end catch_output_redirect.cpp +// start catch_polyfills.cpp + +#include + +namespace Catch { + +#if !defined(CATCH_CONFIG_POLYFILL_ISNAN) + bool isnan(float f) { + return std::isnan(f); + } + bool isnan(double d) { + return std::isnan(d); + } +#else + // For now we only use this for embarcadero + bool isnan(float f) { + return std::_isnan(f); + } + bool isnan(double d) { + return std::_isnan(d); + } +#endif + +} // end namespace Catch +// end catch_polyfills.cpp +// start catch_random_number_generator.cpp + +namespace Catch { + + std::mt19937& rng() { + static std::mt19937 s_rng; + return s_rng; + } + + void seedRng( IConfig const& config ) { + if( config.rngSeed() != 0 ) { + std::srand( config.rngSeed() ); + rng().seed( config.rngSeed() ); + } + } + + unsigned int rngSeed() { + return getCurrentContext().getConfig()->rngSeed(); + } +} +// end catch_random_number_generator.cpp +// start catch_registry_hub.cpp + +// start catch_test_case_registry_impl.h + +#include +#include +#include +#include + +namespace Catch { + + class TestCase; + struct IConfig; + + std::vector sortTests( IConfig const& config, std::vector const& unsortedTestCases ); + bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ); + + void enforceNoDuplicateTestCases( std::vector const& functions ); + + std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ); + std::vector const& getAllTestCasesSorted( IConfig const& config ); + + class TestRegistry : public ITestCaseRegistry { + public: + virtual ~TestRegistry() = default; + + virtual void registerTest( TestCase const& testCase ); + + std::vector const& getAllTests() const override; + std::vector const& getAllTestsSorted( IConfig const& config ) const override; + + private: + std::vector m_functions; + mutable RunTests::InWhatOrder m_currentSortOrder = RunTests::InDeclarationOrder; + mutable std::vector m_sortedFunctions; + std::size_t m_unnamedCount = 0; + std::ios_base::Init m_ostreamInit; // Forces cout/ cerr to be initialised + }; + + /////////////////////////////////////////////////////////////////////////// + + class TestInvokerAsFunction : public ITestInvoker { + void(*m_testAsFunction)(); + public: + TestInvokerAsFunction( void(*testAsFunction)() ) noexcept; + + void invoke() const override; + }; + + std::string extractClassName( StringRef const& classOrQualifiedMethodName ); + + /////////////////////////////////////////////////////////////////////////// + +} // end namespace Catch + +// end catch_test_case_registry_impl.h +// start catch_reporter_registry.h + +#include + +namespace Catch { + + class ReporterRegistry : public IReporterRegistry { + + public: + + ~ReporterRegistry() override; + + IStreamingReporterPtr create( std::string const& name, IConfigPtr const& config ) const override; + + void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ); + void registerListener( IReporterFactoryPtr const& factory ); + + FactoryMap const& getFactories() const override; + Listeners const& getListeners() const override; + + private: + FactoryMap m_factories; + Listeners m_listeners; + }; +} + +// end catch_reporter_registry.h +// start catch_tag_alias_registry.h + +// start catch_tag_alias.h + +#include + +namespace Catch { + + struct TagAlias { + TagAlias(std::string const& _tag, SourceLineInfo _lineInfo); + + std::string tag; + SourceLineInfo lineInfo; + }; + +} // end namespace Catch + +// end catch_tag_alias.h +#include + +namespace Catch { + + class TagAliasRegistry : public ITagAliasRegistry { + public: + ~TagAliasRegistry() override; + TagAlias const* find( std::string const& alias ) const override; + std::string expandAliases( std::string const& unexpandedTestSpec ) const override; + void add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ); + + private: + std::map m_registry; + }; + +} // end namespace Catch + +// end catch_tag_alias_registry.h +// start catch_startup_exception_registry.h + +#include +#include + +namespace Catch { + + class StartupExceptionRegistry { + public: + void add(std::exception_ptr const& exception) noexcept; + std::vector const& getExceptions() const noexcept; + private: + std::vector m_exceptions; + }; + +} // end namespace Catch + +// end catch_startup_exception_registry.h +// start catch_singletons.hpp + +namespace Catch { + + struct ISingleton { + virtual ~ISingleton(); + }; + + void addSingleton( ISingleton* singleton ); + void cleanupSingletons(); + + template + class Singleton : SingletonImplT, public ISingleton { + + static auto getInternal() -> Singleton* { + static Singleton* s_instance = nullptr; + if( !s_instance ) { + s_instance = new Singleton; + addSingleton( s_instance ); + } + return s_instance; + } + + public: + static auto get() -> InterfaceT const& { + return *getInternal(); + } + static auto getMutable() -> MutableInterfaceT& { + return *getInternal(); + } + }; + +} // namespace Catch + +// end catch_singletons.hpp +namespace Catch { + + namespace { + + class RegistryHub : public IRegistryHub, public IMutableRegistryHub, + private NonCopyable { + + public: // IRegistryHub + RegistryHub() = default; + IReporterRegistry const& getReporterRegistry() const override { + return m_reporterRegistry; + } + ITestCaseRegistry const& getTestCaseRegistry() const override { + return m_testCaseRegistry; + } + IExceptionTranslatorRegistry const& getExceptionTranslatorRegistry() const override { + return m_exceptionTranslatorRegistry; + } + ITagAliasRegistry const& getTagAliasRegistry() const override { + return m_tagAliasRegistry; + } + StartupExceptionRegistry const& getStartupExceptionRegistry() const override { + return m_exceptionRegistry; + } + + public: // IMutableRegistryHub + void registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) override { + m_reporterRegistry.registerReporter( name, factory ); + } + void registerListener( IReporterFactoryPtr const& factory ) override { + m_reporterRegistry.registerListener( factory ); + } + void registerTest( TestCase const& testInfo ) override { + m_testCaseRegistry.registerTest( testInfo ); + } + void registerTranslator( const IExceptionTranslator* translator ) override { + m_exceptionTranslatorRegistry.registerTranslator( translator ); + } + void registerTagAlias( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) override { + m_tagAliasRegistry.add( alias, tag, lineInfo ); + } + void registerStartupException() noexcept override { + m_exceptionRegistry.add(std::current_exception()); + } + + private: + TestRegistry m_testCaseRegistry; + ReporterRegistry m_reporterRegistry; + ExceptionTranslatorRegistry m_exceptionTranslatorRegistry; + TagAliasRegistry m_tagAliasRegistry; + StartupExceptionRegistry m_exceptionRegistry; + }; + } + + using RegistryHubSingleton = Singleton; + + IRegistryHub const& getRegistryHub() { + return RegistryHubSingleton::get(); + } + IMutableRegistryHub& getMutableRegistryHub() { + return RegistryHubSingleton::getMutable(); + } + void cleanUp() { + cleanupSingletons(); + cleanUpContext(); + } + std::string translateActiveException() { + return getRegistryHub().getExceptionTranslatorRegistry().translateActiveException(); + } + +} // end namespace Catch +// end catch_registry_hub.cpp +// start catch_reporter_registry.cpp + +namespace Catch { + + ReporterRegistry::~ReporterRegistry() = default; + + IStreamingReporterPtr ReporterRegistry::create( std::string const& name, IConfigPtr const& config ) const { + auto it = m_factories.find( name ); + if( it == m_factories.end() ) + return nullptr; + return it->second->create( ReporterConfig( config ) ); + } + + void ReporterRegistry::registerReporter( std::string const& name, IReporterFactoryPtr const& factory ) { + m_factories.emplace(name, factory); + } + void ReporterRegistry::registerListener( IReporterFactoryPtr const& factory ) { + m_listeners.push_back( factory ); + } + + IReporterRegistry::FactoryMap const& ReporterRegistry::getFactories() const { + return m_factories; + } + IReporterRegistry::Listeners const& ReporterRegistry::getListeners() const { + return m_listeners; + } + +} +// end catch_reporter_registry.cpp +// start catch_result_type.cpp + +namespace Catch { + + bool isOk( ResultWas::OfType resultType ) { + return ( resultType & ResultWas::FailureBit ) == 0; + } + bool isJustInfo( int flags ) { + return flags == ResultWas::Info; + } + + ResultDisposition::Flags operator | ( ResultDisposition::Flags lhs, ResultDisposition::Flags rhs ) { + return static_cast( static_cast( lhs ) | static_cast( rhs ) ); + } + + bool shouldContinueOnFailure( int flags ) { return ( flags & ResultDisposition::ContinueOnFailure ) != 0; } + bool shouldSuppressFailure( int flags ) { return ( flags & ResultDisposition::SuppressFail ) != 0; } + +} // end namespace Catch +// end catch_result_type.cpp +// start catch_run_context.cpp + +#include +#include +#include + +namespace Catch { + + namespace Generators { + struct GeneratorTracker : TestCaseTracking::TrackerBase, IGeneratorTracker { + size_t m_index = static_cast( -1 ); + GeneratorBasePtr m_generator; + + GeneratorTracker( TestCaseTracking::NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) + : TrackerBase( nameAndLocation, ctx, parent ) + {} + ~GeneratorTracker(); + + static GeneratorTracker& acquire( TrackerContext& ctx, TestCaseTracking::NameAndLocation const& nameAndLocation ) { + std::shared_ptr tracker; + + ITracker& currentTracker = ctx.currentTracker(); + if( TestCaseTracking::ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) { + assert( childTracker ); + assert( childTracker->isIndexTracker() ); + tracker = std::static_pointer_cast( childTracker ); + } + else { + tracker = std::make_shared( nameAndLocation, ctx, ¤tTracker ); + currentTracker.addChild( tracker ); + } + + if( !ctx.completedCycle() && !tracker->isComplete() ) { + if( tracker->m_runState != ExecutingChildren && tracker->m_runState != NeedsAnotherRun ) + tracker->moveNext(); + tracker->open(); + } + + return *tracker; + } + + void moveNext() { + m_index++; + m_children.clear(); + } + + // TrackerBase interface + bool isIndexTracker() const override { return true; } + auto hasGenerator() const -> bool override { + return !!m_generator; + } + void close() override { + TrackerBase::close(); + if( m_runState == CompletedSuccessfully && m_index < m_generator->size()-1 ) + m_runState = Executing; + } + + // IGeneratorTracker interface + auto getGenerator() const -> GeneratorBasePtr const& override { + return m_generator; + } + void setGenerator( GeneratorBasePtr&& generator ) override { + m_generator = std::move( generator ); + } + auto getIndex() const -> size_t override { + return m_index; + } + }; + GeneratorTracker::~GeneratorTracker() {} + } + + RunContext::RunContext(IConfigPtr const& _config, IStreamingReporterPtr&& reporter) + : m_runInfo(_config->name()), + m_context(getCurrentMutableContext()), + m_config(_config), + m_reporter(std::move(reporter)), + m_lastAssertionInfo{ StringRef(), SourceLineInfo("",0), StringRef(), ResultDisposition::Normal }, + m_includeSuccessfulResults( m_config->includeSuccessfulResults() || m_reporter->getPreferences().shouldReportAllAssertions ) + { + m_context.setRunner(this); + m_context.setConfig(m_config); + m_context.setResultCapture(this); + m_reporter->testRunStarting(m_runInfo); + } + + RunContext::~RunContext() { + m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, aborting())); + } + + void RunContext::testGroupStarting(std::string const& testSpec, std::size_t groupIndex, std::size_t groupsCount) { + m_reporter->testGroupStarting(GroupInfo(testSpec, groupIndex, groupsCount)); + } + + void RunContext::testGroupEnded(std::string const& testSpec, Totals const& totals, std::size_t groupIndex, std::size_t groupsCount) { + m_reporter->testGroupEnded(TestGroupStats(GroupInfo(testSpec, groupIndex, groupsCount), totals, aborting())); + } + + Totals RunContext::runTest(TestCase const& testCase) { + Totals prevTotals = m_totals; + + std::string redirectedCout; + std::string redirectedCerr; + + auto const& testInfo = testCase.getTestCaseInfo(); + + m_reporter->testCaseStarting(testInfo); + + m_activeTestCase = &testCase; + + ITracker& rootTracker = m_trackerContext.startRun(); + assert(rootTracker.isSectionTracker()); + static_cast(rootTracker).addInitialFilters(m_config->getSectionsToRun()); + do { + m_trackerContext.startCycle(); + m_testCaseTracker = &SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(testInfo.name, testInfo.lineInfo)); + runCurrentTest(redirectedCout, redirectedCerr); + } while (!m_testCaseTracker->isSuccessfullyCompleted() && !aborting()); + + Totals deltaTotals = m_totals.delta(prevTotals); + if (testInfo.expectedToFail() && deltaTotals.testCases.passed > 0) { + deltaTotals.assertions.failed++; + deltaTotals.testCases.passed--; + deltaTotals.testCases.failed++; + } + m_totals.testCases += deltaTotals.testCases; + m_reporter->testCaseEnded(TestCaseStats(testInfo, + deltaTotals, + redirectedCout, + redirectedCerr, + aborting())); + + m_activeTestCase = nullptr; + m_testCaseTracker = nullptr; + + return deltaTotals; + } + + IConfigPtr RunContext::config() const { + return m_config; + } + + IStreamingReporter& RunContext::reporter() const { + return *m_reporter; + } + + void RunContext::assertionEnded(AssertionResult const & result) { + if (result.getResultType() == ResultWas::Ok) { + m_totals.assertions.passed++; + m_lastAssertionPassed = true; + } else if (!result.isOk()) { + m_lastAssertionPassed = false; + if( m_activeTestCase->getTestCaseInfo().okToFail() ) + m_totals.assertions.failedButOk++; + else + m_totals.assertions.failed++; + } + else { + m_lastAssertionPassed = true; + } + + // We have no use for the return value (whether messages should be cleared), because messages were made scoped + // and should be let to clear themselves out. + static_cast(m_reporter->assertionEnded(AssertionStats(result, m_messages, m_totals))); + + // Reset working state + resetAssertionInfo(); + m_lastResult = result; + } + void RunContext::resetAssertionInfo() { + m_lastAssertionInfo.macroName = StringRef(); + m_lastAssertionInfo.capturedExpression = "{Unknown expression after the reported line}"_sr; + } + + bool RunContext::sectionStarted(SectionInfo const & sectionInfo, Counts & assertions) { + ITracker& sectionTracker = SectionTracker::acquire(m_trackerContext, TestCaseTracking::NameAndLocation(sectionInfo.name, sectionInfo.lineInfo)); + if (!sectionTracker.isOpen()) + return false; + m_activeSections.push_back(§ionTracker); + + m_lastAssertionInfo.lineInfo = sectionInfo.lineInfo; + + m_reporter->sectionStarting(sectionInfo); + + assertions = m_totals.assertions; + + return true; + } + auto RunContext::acquireGeneratorTracker( SourceLineInfo const& lineInfo ) -> IGeneratorTracker& { + using namespace Generators; + GeneratorTracker& tracker = GeneratorTracker::acquire( m_trackerContext, TestCaseTracking::NameAndLocation( "generator", lineInfo ) ); + assert( tracker.isOpen() ); + m_lastAssertionInfo.lineInfo = lineInfo; + return tracker; + } + + bool RunContext::testForMissingAssertions(Counts& assertions) { + if (assertions.total() != 0) + return false; + if (!m_config->warnAboutMissingAssertions()) + return false; + if (m_trackerContext.currentTracker().hasChildren()) + return false; + m_totals.assertions.failed++; + assertions.failed++; + return true; + } + + void RunContext::sectionEnded(SectionEndInfo const & endInfo) { + Counts assertions = m_totals.assertions - endInfo.prevAssertions; + bool missingAssertions = testForMissingAssertions(assertions); + + if (!m_activeSections.empty()) { + m_activeSections.back()->close(); + m_activeSections.pop_back(); + } + + m_reporter->sectionEnded(SectionStats(endInfo.sectionInfo, assertions, endInfo.durationInSeconds, missingAssertions)); + m_messages.clear(); + } + + void RunContext::sectionEndedEarly(SectionEndInfo const & endInfo) { + if (m_unfinishedSections.empty()) + m_activeSections.back()->fail(); + else + m_activeSections.back()->close(); + m_activeSections.pop_back(); + + m_unfinishedSections.push_back(endInfo); + } + void RunContext::benchmarkStarting( BenchmarkInfo const& info ) { + m_reporter->benchmarkStarting( info ); + } + void RunContext::benchmarkEnded( BenchmarkStats const& stats ) { + m_reporter->benchmarkEnded( stats ); + } + + void RunContext::pushScopedMessage(MessageInfo const & message) { + m_messages.push_back(message); + } + + void RunContext::popScopedMessage(MessageInfo const & message) { + m_messages.erase(std::remove(m_messages.begin(), m_messages.end(), message), m_messages.end()); + } + + std::string RunContext::getCurrentTestName() const { + return m_activeTestCase + ? m_activeTestCase->getTestCaseInfo().name + : std::string(); + } + + const AssertionResult * RunContext::getLastResult() const { + return &(*m_lastResult); + } + + void RunContext::exceptionEarlyReported() { + m_shouldReportUnexpected = false; + } + + void RunContext::handleFatalErrorCondition( StringRef message ) { + // First notify reporter that bad things happened + m_reporter->fatalErrorEncountered(message); + + // Don't rebuild the result -- the stringification itself can cause more fatal errors + // Instead, fake a result data. + AssertionResultData tempResult( ResultWas::FatalErrorCondition, { false } ); + tempResult.message = message; + AssertionResult result(m_lastAssertionInfo, tempResult); + + assertionEnded(result); + + handleUnfinishedSections(); + + // Recreate section for test case (as we will lose the one that was in scope) + auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); + SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name); + + Counts assertions; + assertions.failed = 1; + SectionStats testCaseSectionStats(testCaseSection, assertions, 0, false); + m_reporter->sectionEnded(testCaseSectionStats); + + auto const& testInfo = m_activeTestCase->getTestCaseInfo(); + + Totals deltaTotals; + deltaTotals.testCases.failed = 1; + deltaTotals.assertions.failed = 1; + m_reporter->testCaseEnded(TestCaseStats(testInfo, + deltaTotals, + std::string(), + std::string(), + false)); + m_totals.testCases.failed++; + testGroupEnded(std::string(), m_totals, 1, 1); + m_reporter->testRunEnded(TestRunStats(m_runInfo, m_totals, false)); + } + + bool RunContext::lastAssertionPassed() { + return m_lastAssertionPassed; + } + + void RunContext::assertionPassed() { + m_lastAssertionPassed = true; + ++m_totals.assertions.passed; + resetAssertionInfo(); + } + + bool RunContext::aborting() const { + return m_totals.assertions.failed >= static_cast(m_config->abortAfter()); + } + + void RunContext::runCurrentTest(std::string & redirectedCout, std::string & redirectedCerr) { + auto const& testCaseInfo = m_activeTestCase->getTestCaseInfo(); + SectionInfo testCaseSection(testCaseInfo.lineInfo, testCaseInfo.name); + m_reporter->sectionStarting(testCaseSection); + Counts prevAssertions = m_totals.assertions; + double duration = 0; + m_shouldReportUnexpected = true; + m_lastAssertionInfo = { "TEST_CASE"_sr, testCaseInfo.lineInfo, StringRef(), ResultDisposition::Normal }; + + seedRng(*m_config); + + Timer timer; + CATCH_TRY { + if (m_reporter->getPreferences().shouldRedirectStdOut) { +#if !defined(CATCH_CONFIG_EXPERIMENTAL_REDIRECT) + RedirectedStdOut redirectedStdOut; + RedirectedStdErr redirectedStdErr; + + timer.start(); + invokeActiveTestCase(); + redirectedCout += redirectedStdOut.str(); + redirectedCerr += redirectedStdErr.str(); +#else + OutputRedirect r(redirectedCout, redirectedCerr); + timer.start(); + invokeActiveTestCase(); +#endif + } else { + timer.start(); + invokeActiveTestCase(); + } + duration = timer.getElapsedSeconds(); + } CATCH_CATCH_ANON (TestFailureException&) { + // This just means the test was aborted due to failure + } CATCH_CATCH_ALL { + // Under CATCH_CONFIG_FAST_COMPILE, unexpected exceptions under REQUIRE assertions + // are reported without translation at the point of origin. + if( m_shouldReportUnexpected ) { + AssertionReaction dummyReaction; + handleUnexpectedInflightException( m_lastAssertionInfo, translateActiveException(), dummyReaction ); + } + } + Counts assertions = m_totals.assertions - prevAssertions; + bool missingAssertions = testForMissingAssertions(assertions); + + m_testCaseTracker->close(); + handleUnfinishedSections(); + m_messages.clear(); + + SectionStats testCaseSectionStats(testCaseSection, assertions, duration, missingAssertions); + m_reporter->sectionEnded(testCaseSectionStats); + } + + void RunContext::invokeActiveTestCase() { + FatalConditionHandler fatalConditionHandler; // Handle signals + m_activeTestCase->invoke(); + fatalConditionHandler.reset(); + } + + void RunContext::handleUnfinishedSections() { + // If sections ended prematurely due to an exception we stored their + // infos here so we can tear them down outside the unwind process. + for (auto it = m_unfinishedSections.rbegin(), + itEnd = m_unfinishedSections.rend(); + it != itEnd; + ++it) + sectionEnded(*it); + m_unfinishedSections.clear(); + } + + void RunContext::handleExpr( + AssertionInfo const& info, + ITransientExpression const& expr, + AssertionReaction& reaction + ) { + m_reporter->assertionStarting( info ); + + bool negated = isFalseTest( info.resultDisposition ); + bool result = expr.getResult() != negated; + + if( result ) { + if (!m_includeSuccessfulResults) { + assertionPassed(); + } + else { + reportExpr(info, ResultWas::Ok, &expr, negated); + } + } + else { + reportExpr(info, ResultWas::ExpressionFailed, &expr, negated ); + populateReaction( reaction ); + } + } + void RunContext::reportExpr( + AssertionInfo const &info, + ResultWas::OfType resultType, + ITransientExpression const *expr, + bool negated ) { + + m_lastAssertionInfo = info; + AssertionResultData data( resultType, LazyExpression( negated ) ); + + AssertionResult assertionResult{ info, data }; + assertionResult.m_resultData.lazyExpression.m_transientExpression = expr; + + assertionEnded( assertionResult ); + } + + void RunContext::handleMessage( + AssertionInfo const& info, + ResultWas::OfType resultType, + StringRef const& message, + AssertionReaction& reaction + ) { + m_reporter->assertionStarting( info ); + + m_lastAssertionInfo = info; + + AssertionResultData data( resultType, LazyExpression( false ) ); + data.message = message; + AssertionResult assertionResult{ m_lastAssertionInfo, data }; + assertionEnded( assertionResult ); + if( !assertionResult.isOk() ) + populateReaction( reaction ); + } + void RunContext::handleUnexpectedExceptionNotThrown( + AssertionInfo const& info, + AssertionReaction& reaction + ) { + handleNonExpr(info, Catch::ResultWas::DidntThrowException, reaction); + } + + void RunContext::handleUnexpectedInflightException( + AssertionInfo const& info, + std::string const& message, + AssertionReaction& reaction + ) { + m_lastAssertionInfo = info; + + AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); + data.message = message; + AssertionResult assertionResult{ info, data }; + assertionEnded( assertionResult ); + populateReaction( reaction ); + } + + void RunContext::populateReaction( AssertionReaction& reaction ) { + reaction.shouldDebugBreak = m_config->shouldDebugBreak(); + reaction.shouldThrow = aborting() || (m_lastAssertionInfo.resultDisposition & ResultDisposition::Normal); + } + + void RunContext::handleIncomplete( + AssertionInfo const& info + ) { + m_lastAssertionInfo = info; + + AssertionResultData data( ResultWas::ThrewException, LazyExpression( false ) ); + data.message = "Exception translation was disabled by CATCH_CONFIG_FAST_COMPILE"; + AssertionResult assertionResult{ info, data }; + assertionEnded( assertionResult ); + } + void RunContext::handleNonExpr( + AssertionInfo const &info, + ResultWas::OfType resultType, + AssertionReaction &reaction + ) { + m_lastAssertionInfo = info; + + AssertionResultData data( resultType, LazyExpression( false ) ); + AssertionResult assertionResult{ info, data }; + assertionEnded( assertionResult ); + + if( !assertionResult.isOk() ) + populateReaction( reaction ); + } + + IResultCapture& getResultCapture() { + if (auto* capture = getCurrentContext().getResultCapture()) + return *capture; + else + CATCH_INTERNAL_ERROR("No result capture instance"); + } +} +// end catch_run_context.cpp +// start catch_section.cpp + +namespace Catch { + + Section::Section( SectionInfo const& info ) + : m_info( info ), + m_sectionIncluded( getResultCapture().sectionStarted( m_info, m_assertions ) ) + { + m_timer.start(); + } + + Section::~Section() { + if( m_sectionIncluded ) { + SectionEndInfo endInfo{ m_info, m_assertions, m_timer.getElapsedSeconds() }; + if( uncaught_exceptions() ) + getResultCapture().sectionEndedEarly( endInfo ); + else + getResultCapture().sectionEnded( endInfo ); + } + } + + // This indicates whether the section should be executed or not + Section::operator bool() const { + return m_sectionIncluded; + } + +} // end namespace Catch +// end catch_section.cpp +// start catch_section_info.cpp + +namespace Catch { + + SectionInfo::SectionInfo + ( SourceLineInfo const& _lineInfo, + std::string const& _name ) + : name( _name ), + lineInfo( _lineInfo ) + {} + +} // end namespace Catch +// end catch_section_info.cpp +// start catch_session.cpp + +// start catch_session.h + +#include + +namespace Catch { + + class Session : NonCopyable { + public: + + Session(); + ~Session() override; + + void showHelp() const; + void libIdentify(); + + int applyCommandLine( int argc, char const * const * argv ); + #if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(UNICODE) + int applyCommandLine( int argc, wchar_t const * const * argv ); + #endif + + void useConfigData( ConfigData const& configData ); + + template + int run(int argc, CharT const * const argv[]) { + if (m_startupExceptions) + return 1; + int returnCode = applyCommandLine(argc, argv); + if (returnCode == 0) + returnCode = run(); + return returnCode; + } + + int run(); + + clara::Parser const& cli() const; + void cli( clara::Parser const& newParser ); + ConfigData& configData(); + Config& config(); + private: + int runInternal(); + + clara::Parser m_cli; + ConfigData m_configData; + std::shared_ptr m_config; + bool m_startupExceptions = false; + }; + +} // end namespace Catch + +// end catch_session.h +// start catch_version.h + +#include + +namespace Catch { + + // Versioning information + struct Version { + Version( Version const& ) = delete; + Version& operator=( Version const& ) = delete; + Version( unsigned int _majorVersion, + unsigned int _minorVersion, + unsigned int _patchNumber, + char const * const _branchName, + unsigned int _buildNumber ); + + unsigned int const majorVersion; + unsigned int const minorVersion; + unsigned int const patchNumber; + + // buildNumber is only used if branchName is not null + char const * const branchName; + unsigned int const buildNumber; + + friend std::ostream& operator << ( std::ostream& os, Version const& version ); + }; + + Version const& libraryVersion(); +} + +// end catch_version.h +#include +#include + +namespace Catch { + + namespace { + const int MaxExitCode = 255; + + IStreamingReporterPtr createReporter(std::string const& reporterName, IConfigPtr const& config) { + auto reporter = Catch::getRegistryHub().getReporterRegistry().create(reporterName, config); + CATCH_ENFORCE(reporter, "No reporter registered with name: '" << reporterName << "'"); + + return reporter; + } + + IStreamingReporterPtr makeReporter(std::shared_ptr const& config) { + if (Catch::getRegistryHub().getReporterRegistry().getListeners().empty()) { + return createReporter(config->getReporterName(), config); + } + + auto multi = std::unique_ptr(new ListeningReporter); + + auto const& listeners = Catch::getRegistryHub().getReporterRegistry().getListeners(); + for (auto const& listener : listeners) { + multi->addListener(listener->create(Catch::ReporterConfig(config))); + } + multi->addReporter(createReporter(config->getReporterName(), config)); + return std::move(multi); + } + + Catch::Totals runTests(std::shared_ptr const& config) { + auto reporter = makeReporter(config); + + RunContext context(config, std::move(reporter)); + + Totals totals; + + context.testGroupStarting(config->name(), 1, 1); + + TestSpec testSpec = config->testSpec(); + + auto const& allTestCases = getAllTestCasesSorted(*config); + for (auto const& testCase : allTestCases) { + if (!context.aborting() && matchTest(testCase, testSpec, *config)) + totals += context.runTest(testCase); + else + context.reporter().skipTest(testCase); + } + + if (config->warnAboutNoTests() && totals.testCases.total() == 0) { + ReusableStringStream testConfig; + + bool first = true; + for (const auto& input : config->getTestsOrTags()) { + if (!first) { testConfig << ' '; } + first = false; + testConfig << input; + } + + context.reporter().noMatchingTestCases(testConfig.str()); + totals.error = -1; + } + + context.testGroupEnded(config->name(), totals, 1, 1); + return totals; + } + + void applyFilenamesAsTags(Catch::IConfig const& config) { + auto& tests = const_cast&>(getAllTestCasesSorted(config)); + for (auto& testCase : tests) { + auto tags = testCase.tags; + + std::string filename = testCase.lineInfo.file; + auto lastSlash = filename.find_last_of("\\/"); + if (lastSlash != std::string::npos) { + filename.erase(0, lastSlash); + filename[0] = '#'; + } + + auto lastDot = filename.find_last_of('.'); + if (lastDot != std::string::npos) { + filename.erase(lastDot); + } + + tags.push_back(std::move(filename)); + setTags(testCase, tags); + } + } + + } // anon namespace + + Session::Session() { + static bool alreadyInstantiated = false; + if( alreadyInstantiated ) { + CATCH_TRY { CATCH_INTERNAL_ERROR( "Only one instance of Catch::Session can ever be used" ); } + CATCH_CATCH_ALL { getMutableRegistryHub().registerStartupException(); } + } + + // There cannot be exceptions at startup in no-exception mode. +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + const auto& exceptions = getRegistryHub().getStartupExceptionRegistry().getExceptions(); + if ( !exceptions.empty() ) { + m_startupExceptions = true; + Colour colourGuard( Colour::Red ); + Catch::cerr() << "Errors occurred during startup!" << '\n'; + // iterate over all exceptions and notify user + for ( const auto& ex_ptr : exceptions ) { + try { + std::rethrow_exception(ex_ptr); + } catch ( std::exception const& ex ) { + Catch::cerr() << Column( ex.what() ).indent(2) << '\n'; + } + } + } +#endif + + alreadyInstantiated = true; + m_cli = makeCommandLineParser( m_configData ); + } + Session::~Session() { + Catch::cleanUp(); + } + + void Session::showHelp() const { + Catch::cout() + << "\nCatch v" << libraryVersion() << "\n" + << m_cli << std::endl + << "For more detailed usage please see the project docs\n" << std::endl; + } + void Session::libIdentify() { + Catch::cout() + << std::left << std::setw(16) << "description: " << "A Catch test executable\n" + << std::left << std::setw(16) << "category: " << "testframework\n" + << std::left << std::setw(16) << "framework: " << "Catch Test\n" + << std::left << std::setw(16) << "version: " << libraryVersion() << std::endl; + } + + int Session::applyCommandLine( int argc, char const * const * argv ) { + if( m_startupExceptions ) + return 1; + + auto result = m_cli.parse( clara::Args( argc, argv ) ); + if( !result ) { + Catch::cerr() + << Colour( Colour::Red ) + << "\nError(s) in input:\n" + << Column( result.errorMessage() ).indent( 2 ) + << "\n\n"; + Catch::cerr() << "Run with -? for usage\n" << std::endl; + return MaxExitCode; + } + + if( m_configData.showHelp ) + showHelp(); + if( m_configData.libIdentify ) + libIdentify(); + m_config.reset(); + return 0; + } + +#if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(UNICODE) + int Session::applyCommandLine( int argc, wchar_t const * const * argv ) { + + char **utf8Argv = new char *[ argc ]; + + for ( int i = 0; i < argc; ++i ) { + int bufSize = WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, NULL, 0, NULL, NULL ); + + utf8Argv[ i ] = new char[ bufSize ]; + + WideCharToMultiByte( CP_UTF8, 0, argv[i], -1, utf8Argv[i], bufSize, NULL, NULL ); + } + + int returnCode = applyCommandLine( argc, utf8Argv ); + + for ( int i = 0; i < argc; ++i ) + delete [] utf8Argv[ i ]; + + delete [] utf8Argv; + + return returnCode; + } +#endif + + void Session::useConfigData( ConfigData const& configData ) { + m_configData = configData; + m_config.reset(); + } + + int Session::run() { + if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeStart ) != 0 ) { + Catch::cout() << "...waiting for enter/ return before starting" << std::endl; + static_cast(std::getchar()); + } + int exitCode = runInternal(); + if( ( m_configData.waitForKeypress & WaitForKeypress::BeforeExit ) != 0 ) { + Catch::cout() << "...waiting for enter/ return before exiting, with code: " << exitCode << std::endl; + static_cast(std::getchar()); + } + return exitCode; + } + + clara::Parser const& Session::cli() const { + return m_cli; + } + void Session::cli( clara::Parser const& newParser ) { + m_cli = newParser; + } + ConfigData& Session::configData() { + return m_configData; + } + Config& Session::config() { + if( !m_config ) + m_config = std::make_shared( m_configData ); + return *m_config; + } + + int Session::runInternal() { + if( m_startupExceptions ) + return 1; + + if (m_configData.showHelp || m_configData.libIdentify) { + return 0; + } + + CATCH_TRY { + config(); // Force config to be constructed + + seedRng( *m_config ); + + if( m_configData.filenamesAsTags ) + applyFilenamesAsTags( *m_config ); + + // Handle list request + if( Option listed = list( config() ) ) + return static_cast( *listed ); + + auto totals = runTests( m_config ); + // Note that on unices only the lower 8 bits are usually used, clamping + // the return value to 255 prevents false negative when some multiple + // of 256 tests has failed + return (std::min) (MaxExitCode, (std::max) (totals.error, static_cast(totals.assertions.failed))); + } +#if !defined(CATCH_CONFIG_DISABLE_EXCEPTIONS) + catch( std::exception& ex ) { + Catch::cerr() << ex.what() << std::endl; + return MaxExitCode; + } +#endif + } + +} // end namespace Catch +// end catch_session.cpp +// start catch_singletons.cpp + +#include + +namespace Catch { + + namespace { + static auto getSingletons() -> std::vector*& { + static std::vector* g_singletons = nullptr; + if( !g_singletons ) + g_singletons = new std::vector(); + return g_singletons; + } + } + + ISingleton::~ISingleton() {} + + void addSingleton(ISingleton* singleton ) { + getSingletons()->push_back( singleton ); + } + void cleanupSingletons() { + auto& singletons = getSingletons(); + for( auto singleton : *singletons ) + delete singleton; + delete singletons; + singletons = nullptr; + } + +} // namespace Catch +// end catch_singletons.cpp +// start catch_startup_exception_registry.cpp + +namespace Catch { +void StartupExceptionRegistry::add( std::exception_ptr const& exception ) noexcept { + CATCH_TRY { + m_exceptions.push_back(exception); + } CATCH_CATCH_ALL { + // If we run out of memory during start-up there's really not a lot more we can do about it + std::terminate(); + } + } + + std::vector const& StartupExceptionRegistry::getExceptions() const noexcept { + return m_exceptions; + } + +} // end namespace Catch +// end catch_startup_exception_registry.cpp +// start catch_stream.cpp + +#include +#include +#include +#include +#include +#include + +namespace Catch { + + Catch::IStream::~IStream() = default; + + namespace detail { namespace { + template + class StreamBufImpl : public std::streambuf { + char data[bufferSize]; + WriterF m_writer; + + public: + StreamBufImpl() { + setp( data, data + sizeof(data) ); + } + + ~StreamBufImpl() noexcept { + StreamBufImpl::sync(); + } + + private: + int overflow( int c ) override { + sync(); + + if( c != EOF ) { + if( pbase() == epptr() ) + m_writer( std::string( 1, static_cast( c ) ) ); + else + sputc( static_cast( c ) ); + } + return 0; + } + + int sync() override { + if( pbase() != pptr() ) { + m_writer( std::string( pbase(), static_cast( pptr() - pbase() ) ) ); + setp( pbase(), epptr() ); + } + return 0; + } + }; + + /////////////////////////////////////////////////////////////////////////// + + struct OutputDebugWriter { + + void operator()( std::string const&str ) { + writeToDebugConsole( str ); + } + }; + + /////////////////////////////////////////////////////////////////////////// + + class FileStream : public IStream { + mutable std::ofstream m_ofs; + public: + FileStream( StringRef filename ) { + m_ofs.open( filename.c_str() ); + CATCH_ENFORCE( !m_ofs.fail(), "Unable to open file: '" << filename << "'" ); + } + ~FileStream() override = default; + public: // IStream + std::ostream& stream() const override { + return m_ofs; + } + }; + + /////////////////////////////////////////////////////////////////////////// + + class CoutStream : public IStream { + mutable std::ostream m_os; + public: + // Store the streambuf from cout up-front because + // cout may get redirected when running tests + CoutStream() : m_os( Catch::cout().rdbuf() ) {} + ~CoutStream() override = default; + + public: // IStream + std::ostream& stream() const override { return m_os; } + }; + + /////////////////////////////////////////////////////////////////////////// + + class DebugOutStream : public IStream { + std::unique_ptr> m_streamBuf; + mutable std::ostream m_os; + public: + DebugOutStream() + : m_streamBuf( new StreamBufImpl() ), + m_os( m_streamBuf.get() ) + {} + + ~DebugOutStream() override = default; + + public: // IStream + std::ostream& stream() const override { return m_os; } + }; + + }} // namespace anon::detail + + /////////////////////////////////////////////////////////////////////////// + + auto makeStream( StringRef const &filename ) -> IStream const* { + if( filename.empty() ) + return new detail::CoutStream(); + else if( filename[0] == '%' ) { + if( filename == "%debug" ) + return new detail::DebugOutStream(); + else + CATCH_ERROR( "Unrecognised stream: '" << filename << "'" ); + } + else + return new detail::FileStream( filename ); + } + + // This class encapsulates the idea of a pool of ostringstreams that can be reused. + struct StringStreams { + std::vector> m_streams; + std::vector m_unused; + std::ostringstream m_referenceStream; // Used for copy state/ flags from + + auto add() -> std::size_t { + if( m_unused.empty() ) { + m_streams.push_back( std::unique_ptr( new std::ostringstream ) ); + return m_streams.size()-1; + } + else { + auto index = m_unused.back(); + m_unused.pop_back(); + return index; + } + } + + void release( std::size_t index ) { + m_streams[index]->copyfmt( m_referenceStream ); // Restore initial flags and other state + m_unused.push_back(index); + } + }; + + ReusableStringStream::ReusableStringStream() + : m_index( Singleton::getMutable().add() ), + m_oss( Singleton::getMutable().m_streams[m_index].get() ) + {} + + ReusableStringStream::~ReusableStringStream() { + static_cast( m_oss )->str(""); + m_oss->clear(); + Singleton::getMutable().release( m_index ); + } + + auto ReusableStringStream::str() const -> std::string { + return static_cast( m_oss )->str(); + } + + /////////////////////////////////////////////////////////////////////////// + +#ifndef CATCH_CONFIG_NOSTDOUT // If you #define this you must implement these functions + std::ostream& cout() { return std::cout; } + std::ostream& cerr() { return std::cerr; } + std::ostream& clog() { return std::clog; } +#endif +} +// end catch_stream.cpp +// start catch_string_manip.cpp + +#include +#include +#include +#include + +namespace Catch { + + namespace { + char toLowerCh(char c) { + return static_cast( std::tolower( c ) ); + } + } + + bool startsWith( std::string const& s, std::string const& prefix ) { + return s.size() >= prefix.size() && std::equal(prefix.begin(), prefix.end(), s.begin()); + } + bool startsWith( std::string const& s, char prefix ) { + return !s.empty() && s[0] == prefix; + } + bool endsWith( std::string const& s, std::string const& suffix ) { + return s.size() >= suffix.size() && std::equal(suffix.rbegin(), suffix.rend(), s.rbegin()); + } + bool endsWith( std::string const& s, char suffix ) { + return !s.empty() && s[s.size()-1] == suffix; + } + bool contains( std::string const& s, std::string const& infix ) { + return s.find( infix ) != std::string::npos; + } + void toLowerInPlace( std::string& s ) { + std::transform( s.begin(), s.end(), s.begin(), toLowerCh ); + } + std::string toLower( std::string const& s ) { + std::string lc = s; + toLowerInPlace( lc ); + return lc; + } + std::string trim( std::string const& str ) { + static char const* whitespaceChars = "\n\r\t "; + std::string::size_type start = str.find_first_not_of( whitespaceChars ); + std::string::size_type end = str.find_last_not_of( whitespaceChars ); + + return start != std::string::npos ? str.substr( start, 1+end-start ) : std::string(); + } + + bool replaceInPlace( std::string& str, std::string const& replaceThis, std::string const& withThis ) { + bool replaced = false; + std::size_t i = str.find( replaceThis ); + while( i != std::string::npos ) { + replaced = true; + str = str.substr( 0, i ) + withThis + str.substr( i+replaceThis.size() ); + if( i < str.size()-withThis.size() ) + i = str.find( replaceThis, i+withThis.size() ); + else + i = std::string::npos; + } + return replaced; + } + + pluralise::pluralise( std::size_t count, std::string const& label ) + : m_count( count ), + m_label( label ) + {} + + std::ostream& operator << ( std::ostream& os, pluralise const& pluraliser ) { + os << pluraliser.m_count << ' ' << pluraliser.m_label; + if( pluraliser.m_count != 1 ) + os << 's'; + return os; + } + +} +// end catch_string_manip.cpp +// start catch_stringref.cpp + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + +#include +#include +#include + +namespace { + const uint32_t byte_2_lead = 0xC0; + const uint32_t byte_3_lead = 0xE0; + const uint32_t byte_4_lead = 0xF0; +} + +namespace Catch { + StringRef::StringRef( char const* rawChars ) noexcept + : StringRef( rawChars, static_cast(std::strlen(rawChars) ) ) + {} + + StringRef::operator std::string() const { + return std::string( m_start, m_size ); + } + + void StringRef::swap( StringRef& other ) noexcept { + std::swap( m_start, other.m_start ); + std::swap( m_size, other.m_size ); + std::swap( m_data, other.m_data ); + } + + auto StringRef::c_str() const -> char const* { + if( isSubstring() ) + const_cast( this )->takeOwnership(); + return m_start; + } + auto StringRef::currentData() const noexcept -> char const* { + return m_start; + } + + auto StringRef::isOwned() const noexcept -> bool { + return m_data != nullptr; + } + auto StringRef::isSubstring() const noexcept -> bool { + return m_start[m_size] != '\0'; + } + + void StringRef::takeOwnership() { + if( !isOwned() ) { + m_data = new char[m_size+1]; + memcpy( m_data, m_start, m_size ); + m_data[m_size] = '\0'; + m_start = m_data; + } + } + auto StringRef::substr( size_type start, size_type size ) const noexcept -> StringRef { + if( start < m_size ) + return StringRef( m_start+start, size ); + else + return StringRef(); + } + auto StringRef::operator == ( StringRef const& other ) const noexcept -> bool { + return + size() == other.size() && + (std::strncmp( m_start, other.m_start, size() ) == 0); + } + auto StringRef::operator != ( StringRef const& other ) const noexcept -> bool { + return !operator==( other ); + } + + auto StringRef::operator[](size_type index) const noexcept -> char { + return m_start[index]; + } + + auto StringRef::numberOfCharacters() const noexcept -> size_type { + size_type noChars = m_size; + // Make adjustments for uft encodings + for( size_type i=0; i < m_size; ++i ) { + char c = m_start[i]; + if( ( c & byte_2_lead ) == byte_2_lead ) { + noChars--; + if (( c & byte_3_lead ) == byte_3_lead ) + noChars--; + if( ( c & byte_4_lead ) == byte_4_lead ) + noChars--; + } + } + return noChars; + } + + auto operator + ( StringRef const& lhs, StringRef const& rhs ) -> std::string { + std::string str; + str.reserve( lhs.size() + rhs.size() ); + str += lhs; + str += rhs; + return str; + } + auto operator + ( StringRef const& lhs, const char* rhs ) -> std::string { + return std::string( lhs ) + std::string( rhs ); + } + auto operator + ( char const* lhs, StringRef const& rhs ) -> std::string { + return std::string( lhs ) + std::string( rhs ); + } + + auto operator << ( std::ostream& os, StringRef const& str ) -> std::ostream& { + return os.write(str.currentData(), str.size()); + } + + auto operator+=( std::string& lhs, StringRef const& rhs ) -> std::string& { + lhs.append(rhs.currentData(), rhs.size()); + return lhs; + } + +} // namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif +// end catch_stringref.cpp +// start catch_tag_alias.cpp + +namespace Catch { + TagAlias::TagAlias(std::string const & _tag, SourceLineInfo _lineInfo): tag(_tag), lineInfo(_lineInfo) {} +} +// end catch_tag_alias.cpp +// start catch_tag_alias_autoregistrar.cpp + +namespace Catch { + + RegistrarForTagAliases::RegistrarForTagAliases(char const* alias, char const* tag, SourceLineInfo const& lineInfo) { + CATCH_TRY { + getMutableRegistryHub().registerTagAlias(alias, tag, lineInfo); + } CATCH_CATCH_ALL { + // Do not throw when constructing global objects, instead register the exception to be processed later + getMutableRegistryHub().registerStartupException(); + } + } + +} +// end catch_tag_alias_autoregistrar.cpp +// start catch_tag_alias_registry.cpp + +#include + +namespace Catch { + + TagAliasRegistry::~TagAliasRegistry() {} + + TagAlias const* TagAliasRegistry::find( std::string const& alias ) const { + auto it = m_registry.find( alias ); + if( it != m_registry.end() ) + return &(it->second); + else + return nullptr; + } + + std::string TagAliasRegistry::expandAliases( std::string const& unexpandedTestSpec ) const { + std::string expandedTestSpec = unexpandedTestSpec; + for( auto const& registryKvp : m_registry ) { + std::size_t pos = expandedTestSpec.find( registryKvp.first ); + if( pos != std::string::npos ) { + expandedTestSpec = expandedTestSpec.substr( 0, pos ) + + registryKvp.second.tag + + expandedTestSpec.substr( pos + registryKvp.first.size() ); + } + } + return expandedTestSpec; + } + + void TagAliasRegistry::add( std::string const& alias, std::string const& tag, SourceLineInfo const& lineInfo ) { + CATCH_ENFORCE( startsWith(alias, "[@") && endsWith(alias, ']'), + "error: tag alias, '" << alias << "' is not of the form [@alias name].\n" << lineInfo ); + + CATCH_ENFORCE( m_registry.insert(std::make_pair(alias, TagAlias(tag, lineInfo))).second, + "error: tag alias, '" << alias << "' already registered.\n" + << "\tFirst seen at: " << find(alias)->lineInfo << "\n" + << "\tRedefined at: " << lineInfo ); + } + + ITagAliasRegistry::~ITagAliasRegistry() {} + + ITagAliasRegistry const& ITagAliasRegistry::get() { + return getRegistryHub().getTagAliasRegistry(); + } + +} // end namespace Catch +// end catch_tag_alias_registry.cpp +// start catch_test_case_info.cpp + +#include +#include +#include +#include + +namespace Catch { + + namespace { + TestCaseInfo::SpecialProperties parseSpecialTag( std::string const& tag ) { + if( startsWith( tag, '.' ) || + tag == "!hide" ) + return TestCaseInfo::IsHidden; + else if( tag == "!throws" ) + return TestCaseInfo::Throws; + else if( tag == "!shouldfail" ) + return TestCaseInfo::ShouldFail; + else if( tag == "!mayfail" ) + return TestCaseInfo::MayFail; + else if( tag == "!nonportable" ) + return TestCaseInfo::NonPortable; + else if( tag == "!benchmark" ) + return static_cast( TestCaseInfo::Benchmark | TestCaseInfo::IsHidden ); + else + return TestCaseInfo::None; + } + bool isReservedTag( std::string const& tag ) { + return parseSpecialTag( tag ) == TestCaseInfo::None && tag.size() > 0 && !std::isalnum( static_cast(tag[0]) ); + } + void enforceNotReservedTag( std::string const& tag, SourceLineInfo const& _lineInfo ) { + CATCH_ENFORCE( !isReservedTag(tag), + "Tag name: [" << tag << "] is not allowed.\n" + << "Tag names starting with non alpha-numeric characters are reserved\n" + << _lineInfo ); + } + } + + TestCase makeTestCase( ITestInvoker* _testCase, + std::string const& _className, + NameAndTags const& nameAndTags, + SourceLineInfo const& _lineInfo ) + { + bool isHidden = false; + + // Parse out tags + std::vector tags; + std::string desc, tag; + bool inTag = false; + std::string _descOrTags = nameAndTags.tags; + for (char c : _descOrTags) { + if( !inTag ) { + if( c == '[' ) + inTag = true; + else + desc += c; + } + else { + if( c == ']' ) { + TestCaseInfo::SpecialProperties prop = parseSpecialTag( tag ); + if( ( prop & TestCaseInfo::IsHidden ) != 0 ) + isHidden = true; + else if( prop == TestCaseInfo::None ) + enforceNotReservedTag( tag, _lineInfo ); + + tags.push_back( tag ); + tag.clear(); + inTag = false; + } + else + tag += c; + } + } + if( isHidden ) { + tags.push_back( "." ); + } + + TestCaseInfo info( nameAndTags.name, _className, desc, tags, _lineInfo ); + return TestCase( _testCase, std::move(info) ); + } + + void setTags( TestCaseInfo& testCaseInfo, std::vector tags ) { + std::sort(begin(tags), end(tags)); + tags.erase(std::unique(begin(tags), end(tags)), end(tags)); + testCaseInfo.lcaseTags.clear(); + + for( auto const& tag : tags ) { + std::string lcaseTag = toLower( tag ); + testCaseInfo.properties = static_cast( testCaseInfo.properties | parseSpecialTag( lcaseTag ) ); + testCaseInfo.lcaseTags.push_back( lcaseTag ); + } + testCaseInfo.tags = std::move(tags); + } + + TestCaseInfo::TestCaseInfo( std::string const& _name, + std::string const& _className, + std::string const& _description, + std::vector const& _tags, + SourceLineInfo const& _lineInfo ) + : name( _name ), + className( _className ), + description( _description ), + lineInfo( _lineInfo ), + properties( None ) + { + setTags( *this, _tags ); + } + + bool TestCaseInfo::isHidden() const { + return ( properties & IsHidden ) != 0; + } + bool TestCaseInfo::throws() const { + return ( properties & Throws ) != 0; + } + bool TestCaseInfo::okToFail() const { + return ( properties & (ShouldFail | MayFail ) ) != 0; + } + bool TestCaseInfo::expectedToFail() const { + return ( properties & (ShouldFail ) ) != 0; + } + + std::string TestCaseInfo::tagsAsString() const { + std::string ret; + // '[' and ']' per tag + std::size_t full_size = 2 * tags.size(); + for (const auto& tag : tags) { + full_size += tag.size(); + } + ret.reserve(full_size); + for (const auto& tag : tags) { + ret.push_back('['); + ret.append(tag); + ret.push_back(']'); + } + + return ret; + } + + TestCase::TestCase( ITestInvoker* testCase, TestCaseInfo&& info ) : TestCaseInfo( std::move(info) ), test( testCase ) {} + + TestCase TestCase::withName( std::string const& _newName ) const { + TestCase other( *this ); + other.name = _newName; + return other; + } + + void TestCase::invoke() const { + test->invoke(); + } + + bool TestCase::operator == ( TestCase const& other ) const { + return test.get() == other.test.get() && + name == other.name && + className == other.className; + } + + bool TestCase::operator < ( TestCase const& other ) const { + return name < other.name; + } + + TestCaseInfo const& TestCase::getTestCaseInfo() const + { + return *this; + } + +} // end namespace Catch +// end catch_test_case_info.cpp +// start catch_test_case_registry_impl.cpp + +#include + +namespace Catch { + + std::vector sortTests( IConfig const& config, std::vector const& unsortedTestCases ) { + + std::vector sorted = unsortedTestCases; + + switch( config.runOrder() ) { + case RunTests::InLexicographicalOrder: + std::sort( sorted.begin(), sorted.end() ); + break; + case RunTests::InRandomOrder: + seedRng( config ); + std::shuffle( sorted.begin(), sorted.end(), rng() ); + break; + case RunTests::InDeclarationOrder: + // already in declaration order + break; + } + return sorted; + } + bool matchTest( TestCase const& testCase, TestSpec const& testSpec, IConfig const& config ) { + return testSpec.matches( testCase ) && ( config.allowThrows() || !testCase.throws() ); + } + + void enforceNoDuplicateTestCases( std::vector const& functions ) { + std::set seenFunctions; + for( auto const& function : functions ) { + auto prev = seenFunctions.insert( function ); + CATCH_ENFORCE( prev.second, + "error: TEST_CASE( \"" << function.name << "\" ) already defined.\n" + << "\tFirst seen at " << prev.first->getTestCaseInfo().lineInfo << "\n" + << "\tRedefined at " << function.getTestCaseInfo().lineInfo ); + } + } + + std::vector filterTests( std::vector const& testCases, TestSpec const& testSpec, IConfig const& config ) { + std::vector filtered; + filtered.reserve( testCases.size() ); + for( auto const& testCase : testCases ) + if( matchTest( testCase, testSpec, config ) ) + filtered.push_back( testCase ); + return filtered; + } + std::vector const& getAllTestCasesSorted( IConfig const& config ) { + return getRegistryHub().getTestCaseRegistry().getAllTestsSorted( config ); + } + + void TestRegistry::registerTest( TestCase const& testCase ) { + std::string name = testCase.getTestCaseInfo().name; + if( name.empty() ) { + ReusableStringStream rss; + rss << "Anonymous test case " << ++m_unnamedCount; + return registerTest( testCase.withName( rss.str() ) ); + } + m_functions.push_back( testCase ); + } + + std::vector const& TestRegistry::getAllTests() const { + return m_functions; + } + std::vector const& TestRegistry::getAllTestsSorted( IConfig const& config ) const { + if( m_sortedFunctions.empty() ) + enforceNoDuplicateTestCases( m_functions ); + + if( m_currentSortOrder != config.runOrder() || m_sortedFunctions.empty() ) { + m_sortedFunctions = sortTests( config, m_functions ); + m_currentSortOrder = config.runOrder(); + } + return m_sortedFunctions; + } + + /////////////////////////////////////////////////////////////////////////// + TestInvokerAsFunction::TestInvokerAsFunction( void(*testAsFunction)() ) noexcept : m_testAsFunction( testAsFunction ) {} + + void TestInvokerAsFunction::invoke() const { + m_testAsFunction(); + } + + std::string extractClassName( StringRef const& classOrQualifiedMethodName ) { + std::string className = classOrQualifiedMethodName; + if( startsWith( className, '&' ) ) + { + std::size_t lastColons = className.rfind( "::" ); + std::size_t penultimateColons = className.rfind( "::", lastColons-1 ); + if( penultimateColons == std::string::npos ) + penultimateColons = 1; + className = className.substr( penultimateColons, lastColons-penultimateColons ); + } + return className; + } + +} // end namespace Catch +// end catch_test_case_registry_impl.cpp +// start catch_test_case_tracker.cpp + +#include +#include +#include +#include +#include + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +#endif + +namespace Catch { +namespace TestCaseTracking { + + NameAndLocation::NameAndLocation( std::string const& _name, SourceLineInfo const& _location ) + : name( _name ), + location( _location ) + {} + + ITracker::~ITracker() = default; + + TrackerContext& TrackerContext::instance() { + static TrackerContext s_instance; + return s_instance; + } + + ITracker& TrackerContext::startRun() { + m_rootTracker = std::make_shared( NameAndLocation( "{root}", CATCH_INTERNAL_LINEINFO ), *this, nullptr ); + m_currentTracker = nullptr; + m_runState = Executing; + return *m_rootTracker; + } + + void TrackerContext::endRun() { + m_rootTracker.reset(); + m_currentTracker = nullptr; + m_runState = NotStarted; + } + + void TrackerContext::startCycle() { + m_currentTracker = m_rootTracker.get(); + m_runState = Executing; + } + void TrackerContext::completeCycle() { + m_runState = CompletedCycle; + } + + bool TrackerContext::completedCycle() const { + return m_runState == CompletedCycle; + } + ITracker& TrackerContext::currentTracker() { + return *m_currentTracker; + } + void TrackerContext::setCurrentTracker( ITracker* tracker ) { + m_currentTracker = tracker; + } + + TrackerBase::TrackerBase( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) + : m_nameAndLocation( nameAndLocation ), + m_ctx( ctx ), + m_parent( parent ) + {} + + NameAndLocation const& TrackerBase::nameAndLocation() const { + return m_nameAndLocation; + } + bool TrackerBase::isComplete() const { + return m_runState == CompletedSuccessfully || m_runState == Failed; + } + bool TrackerBase::isSuccessfullyCompleted() const { + return m_runState == CompletedSuccessfully; + } + bool TrackerBase::isOpen() const { + return m_runState != NotStarted && !isComplete(); + } + bool TrackerBase::hasChildren() const { + return !m_children.empty(); + } + + void TrackerBase::addChild( ITrackerPtr const& child ) { + m_children.push_back( child ); + } + + ITrackerPtr TrackerBase::findChild( NameAndLocation const& nameAndLocation ) { + auto it = std::find_if( m_children.begin(), m_children.end(), + [&nameAndLocation]( ITrackerPtr const& tracker ){ + return + tracker->nameAndLocation().location == nameAndLocation.location && + tracker->nameAndLocation().name == nameAndLocation.name; + } ); + return( it != m_children.end() ) + ? *it + : nullptr; + } + ITracker& TrackerBase::parent() { + assert( m_parent ); // Should always be non-null except for root + return *m_parent; + } + + void TrackerBase::openChild() { + if( m_runState != ExecutingChildren ) { + m_runState = ExecutingChildren; + if( m_parent ) + m_parent->openChild(); + } + } + + bool TrackerBase::isSectionTracker() const { return false; } + bool TrackerBase::isIndexTracker() const { return false; } + + void TrackerBase::open() { + m_runState = Executing; + moveToThis(); + if( m_parent ) + m_parent->openChild(); + } + + void TrackerBase::close() { + + // Close any still open children (e.g. generators) + while( &m_ctx.currentTracker() != this ) + m_ctx.currentTracker().close(); + + switch( m_runState ) { + case NeedsAnotherRun: + break; + + case Executing: + m_runState = CompletedSuccessfully; + break; + case ExecutingChildren: + if( m_children.empty() || m_children.back()->isComplete() ) + m_runState = CompletedSuccessfully; + break; + + case NotStarted: + case CompletedSuccessfully: + case Failed: + CATCH_INTERNAL_ERROR( "Illogical state: " << m_runState ); + + default: + CATCH_INTERNAL_ERROR( "Unknown state: " << m_runState ); + } + moveToParent(); + m_ctx.completeCycle(); + } + void TrackerBase::fail() { + m_runState = Failed; + if( m_parent ) + m_parent->markAsNeedingAnotherRun(); + moveToParent(); + m_ctx.completeCycle(); + } + void TrackerBase::markAsNeedingAnotherRun() { + m_runState = NeedsAnotherRun; + } + + void TrackerBase::moveToParent() { + assert( m_parent ); + m_ctx.setCurrentTracker( m_parent ); + } + void TrackerBase::moveToThis() { + m_ctx.setCurrentTracker( this ); + } + + SectionTracker::SectionTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent ) + : TrackerBase( nameAndLocation, ctx, parent ) + { + if( parent ) { + while( !parent->isSectionTracker() ) + parent = &parent->parent(); + + SectionTracker& parentSection = static_cast( *parent ); + addNextFilters( parentSection.m_filters ); + } + } + + bool SectionTracker::isSectionTracker() const { return true; } + + SectionTracker& SectionTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation ) { + std::shared_ptr section; + + ITracker& currentTracker = ctx.currentTracker(); + if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) { + assert( childTracker ); + assert( childTracker->isSectionTracker() ); + section = std::static_pointer_cast( childTracker ); + } + else { + section = std::make_shared( nameAndLocation, ctx, ¤tTracker ); + currentTracker.addChild( section ); + } + if( !ctx.completedCycle() ) + section->tryOpen(); + return *section; + } + + void SectionTracker::tryOpen() { + if( !isComplete() && (m_filters.empty() || m_filters[0].empty() || m_filters[0] == m_nameAndLocation.name ) ) + open(); + } + + void SectionTracker::addInitialFilters( std::vector const& filters ) { + if( !filters.empty() ) { + m_filters.push_back(""); // Root - should never be consulted + m_filters.push_back(""); // Test Case - not a section filter + m_filters.insert( m_filters.end(), filters.begin(), filters.end() ); + } + } + void SectionTracker::addNextFilters( std::vector const& filters ) { + if( filters.size() > 1 ) + m_filters.insert( m_filters.end(), ++filters.begin(), filters.end() ); + } + + IndexTracker::IndexTracker( NameAndLocation const& nameAndLocation, TrackerContext& ctx, ITracker* parent, int size ) + : TrackerBase( nameAndLocation, ctx, parent ), + m_size( size ) + {} + + bool IndexTracker::isIndexTracker() const { return true; } + + IndexTracker& IndexTracker::acquire( TrackerContext& ctx, NameAndLocation const& nameAndLocation, int size ) { + std::shared_ptr tracker; + + ITracker& currentTracker = ctx.currentTracker(); + if( ITrackerPtr childTracker = currentTracker.findChild( nameAndLocation ) ) { + assert( childTracker ); + assert( childTracker->isIndexTracker() ); + tracker = std::static_pointer_cast( childTracker ); + } + else { + tracker = std::make_shared( nameAndLocation, ctx, ¤tTracker, size ); + currentTracker.addChild( tracker ); + } + + if( !ctx.completedCycle() && !tracker->isComplete() ) { + if( tracker->m_runState != ExecutingChildren && tracker->m_runState != NeedsAnotherRun ) + tracker->moveNext(); + tracker->open(); + } + + return *tracker; + } + + int IndexTracker::index() const { return m_index; } + + void IndexTracker::moveNext() { + m_index++; + m_children.clear(); + } + + void IndexTracker::close() { + TrackerBase::close(); + if( m_runState == CompletedSuccessfully && m_index < m_size-1 ) + m_runState = Executing; + } + +} // namespace TestCaseTracking + +using TestCaseTracking::ITracker; +using TestCaseTracking::TrackerContext; +using TestCaseTracking::SectionTracker; +using TestCaseTracking::IndexTracker; + +} // namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif +// end catch_test_case_tracker.cpp +// start catch_test_registry.cpp + +namespace Catch { + + auto makeTestInvoker( void(*testAsFunction)() ) noexcept -> ITestInvoker* { + return new(std::nothrow) TestInvokerAsFunction( testAsFunction ); + } + + NameAndTags::NameAndTags( StringRef const& name_ , StringRef const& tags_ ) noexcept : name( name_ ), tags( tags_ ) {} + + AutoReg::AutoReg( ITestInvoker* invoker, SourceLineInfo const& lineInfo, StringRef const& classOrMethod, NameAndTags const& nameAndTags ) noexcept { + CATCH_TRY { + getMutableRegistryHub() + .registerTest( + makeTestCase( + invoker, + extractClassName( classOrMethod ), + nameAndTags, + lineInfo)); + } CATCH_CATCH_ALL { + // Do not throw when constructing global objects, instead register the exception to be processed later + getMutableRegistryHub().registerStartupException(); + } + } + + AutoReg::~AutoReg() = default; +} +// end catch_test_registry.cpp +// start catch_test_spec.cpp + +#include +#include +#include +#include + +namespace Catch { + + TestSpec::Pattern::~Pattern() = default; + TestSpec::NamePattern::~NamePattern() = default; + TestSpec::TagPattern::~TagPattern() = default; + TestSpec::ExcludedPattern::~ExcludedPattern() = default; + + TestSpec::NamePattern::NamePattern( std::string const& name ) + : m_wildcardPattern( toLower( name ), CaseSensitive::No ) + {} + bool TestSpec::NamePattern::matches( TestCaseInfo const& testCase ) const { + return m_wildcardPattern.matches( toLower( testCase.name ) ); + } + + TestSpec::TagPattern::TagPattern( std::string const& tag ) : m_tag( toLower( tag ) ) {} + bool TestSpec::TagPattern::matches( TestCaseInfo const& testCase ) const { + return std::find(begin(testCase.lcaseTags), + end(testCase.lcaseTags), + m_tag) != end(testCase.lcaseTags); + } + + TestSpec::ExcludedPattern::ExcludedPattern( PatternPtr const& underlyingPattern ) : m_underlyingPattern( underlyingPattern ) {} + bool TestSpec::ExcludedPattern::matches( TestCaseInfo const& testCase ) const { return !m_underlyingPattern->matches( testCase ); } + + bool TestSpec::Filter::matches( TestCaseInfo const& testCase ) const { + // All patterns in a filter must match for the filter to be a match + for( auto const& pattern : m_patterns ) { + if( !pattern->matches( testCase ) ) + return false; + } + return true; + } + + bool TestSpec::hasFilters() const { + return !m_filters.empty(); + } + bool TestSpec::matches( TestCaseInfo const& testCase ) const { + // A TestSpec matches if any filter matches + for( auto const& filter : m_filters ) + if( filter.matches( testCase ) ) + return true; + return false; + } +} +// end catch_test_spec.cpp +// start catch_test_spec_parser.cpp + +namespace Catch { + + TestSpecParser::TestSpecParser( ITagAliasRegistry const& tagAliases ) : m_tagAliases( &tagAliases ) {} + + TestSpecParser& TestSpecParser::parse( std::string const& arg ) { + m_mode = None; + m_exclusion = false; + m_start = std::string::npos; + m_arg = m_tagAliases->expandAliases( arg ); + m_escapeChars.clear(); + for( m_pos = 0; m_pos < m_arg.size(); ++m_pos ) + visitChar( m_arg[m_pos] ); + if( m_mode == Name ) + addPattern(); + return *this; + } + TestSpec TestSpecParser::testSpec() { + addFilter(); + return m_testSpec; + } + + void TestSpecParser::visitChar( char c ) { + if( m_mode == None ) { + switch( c ) { + case ' ': return; + case '~': m_exclusion = true; return; + case '[': return startNewMode( Tag, ++m_pos ); + case '"': return startNewMode( QuotedName, ++m_pos ); + case '\\': return escape(); + default: startNewMode( Name, m_pos ); break; + } + } + if( m_mode == Name ) { + if( c == ',' ) { + addPattern(); + addFilter(); + } + else if( c == '[' ) { + if( subString() == "exclude:" ) + m_exclusion = true; + else + addPattern(); + startNewMode( Tag, ++m_pos ); + } + else if( c == '\\' ) + escape(); + } + else if( m_mode == EscapedName ) + m_mode = Name; + else if( m_mode == QuotedName && c == '"' ) + addPattern(); + else if( m_mode == Tag && c == ']' ) + addPattern(); + } + void TestSpecParser::startNewMode( Mode mode, std::size_t start ) { + m_mode = mode; + m_start = start; + } + void TestSpecParser::escape() { + if( m_mode == None ) + m_start = m_pos; + m_mode = EscapedName; + m_escapeChars.push_back( m_pos ); + } + std::string TestSpecParser::subString() const { return m_arg.substr( m_start, m_pos - m_start ); } + + void TestSpecParser::addFilter() { + if( !m_currentFilter.m_patterns.empty() ) { + m_testSpec.m_filters.push_back( m_currentFilter ); + m_currentFilter = TestSpec::Filter(); + } + } + + TestSpec parseTestSpec( std::string const& arg ) { + return TestSpecParser( ITagAliasRegistry::get() ).parse( arg ).testSpec(); + } + +} // namespace Catch +// end catch_test_spec_parser.cpp +// start catch_timer.cpp + +#include + +static const uint64_t nanosecondsInSecond = 1000000000; + +namespace Catch { + + auto getCurrentNanosecondsSinceEpoch() -> uint64_t { + return std::chrono::duration_cast( std::chrono::high_resolution_clock::now().time_since_epoch() ).count(); + } + + namespace { + auto estimateClockResolution() -> uint64_t { + uint64_t sum = 0; + static const uint64_t iterations = 1000000; + + auto startTime = getCurrentNanosecondsSinceEpoch(); + + for( std::size_t i = 0; i < iterations; ++i ) { + + uint64_t ticks; + uint64_t baseTicks = getCurrentNanosecondsSinceEpoch(); + do { + ticks = getCurrentNanosecondsSinceEpoch(); + } while( ticks == baseTicks ); + + auto delta = ticks - baseTicks; + sum += delta; + + // If we have been calibrating for over 3 seconds -- the clock + // is terrible and we should move on. + // TBD: How to signal that the measured resolution is probably wrong? + if (ticks > startTime + 3 * nanosecondsInSecond) { + return sum / i; + } + } + + // We're just taking the mean, here. To do better we could take the std. dev and exclude outliers + // - and potentially do more iterations if there's a high variance. + return sum/iterations; + } + } + auto getEstimatedClockResolution() -> uint64_t { + static auto s_resolution = estimateClockResolution(); + return s_resolution; + } + + void Timer::start() { + m_nanoseconds = getCurrentNanosecondsSinceEpoch(); + } + auto Timer::getElapsedNanoseconds() const -> uint64_t { + return getCurrentNanosecondsSinceEpoch() - m_nanoseconds; + } + auto Timer::getElapsedMicroseconds() const -> uint64_t { + return getElapsedNanoseconds()/1000; + } + auto Timer::getElapsedMilliseconds() const -> unsigned int { + return static_cast(getElapsedMicroseconds()/1000); + } + auto Timer::getElapsedSeconds() const -> double { + return getElapsedMicroseconds()/1000000.0; + } + +} // namespace Catch +// end catch_timer.cpp +// start catch_tostring.cpp + +#if defined(__clang__) +# pragma clang diagnostic push +# pragma clang diagnostic ignored "-Wexit-time-destructors" +# pragma clang diagnostic ignored "-Wglobal-constructors" +#endif + +// Enable specific decls locally +#if !defined(CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER) +#define CATCH_CONFIG_ENABLE_CHRONO_STRINGMAKER +#endif + +#include +#include + +namespace Catch { + +namespace Detail { + + const std::string unprintableString = "{?}"; + + namespace { + const int hexThreshold = 255; + + struct Endianness { + enum Arch { Big, Little }; + + static Arch which() { + union _{ + int asInt; + char asChar[sizeof (int)]; + } u; + + u.asInt = 1; + return ( u.asChar[sizeof(int)-1] == 1 ) ? Big : Little; + } + }; + } + + std::string rawMemoryToString( const void *object, std::size_t size ) { + // Reverse order for little endian architectures + int i = 0, end = static_cast( size ), inc = 1; + if( Endianness::which() == Endianness::Little ) { + i = end-1; + end = inc = -1; + } + + unsigned char const *bytes = static_cast(object); + ReusableStringStream rss; + rss << "0x" << std::setfill('0') << std::hex; + for( ; i != end; i += inc ) + rss << std::setw(2) << static_cast(bytes[i]); + return rss.str(); + } +} + +template +std::string fpToString( T value, int precision ) { + if (Catch::isnan(value)) { + return "nan"; + } + + ReusableStringStream rss; + rss << std::setprecision( precision ) + << std::fixed + << value; + std::string d = rss.str(); + std::size_t i = d.find_last_not_of( '0' ); + if( i != std::string::npos && i != d.size()-1 ) { + if( d[i] == '.' ) + i++; + d = d.substr( 0, i+1 ); + } + return d; +} + +//// ======================================================= //// +// +// Out-of-line defs for full specialization of StringMaker +// +//// ======================================================= //// + +std::string StringMaker::convert(const std::string& str) { + if (!getCurrentContext().getConfig()->showInvisibles()) { + return '"' + str + '"'; + } + + std::string s("\""); + for (char c : str) { + switch (c) { + case '\n': + s.append("\\n"); + break; + case '\t': + s.append("\\t"); + break; + default: + s.push_back(c); + break; + } + } + s.append("\""); + return s; +} + +#ifdef CATCH_CONFIG_CPP17_STRING_VIEW +std::string StringMaker::convert(std::string_view str) { + return ::Catch::Detail::stringify(std::string{ str }); +} +#endif + +std::string StringMaker::convert(char const* str) { + if (str) { + return ::Catch::Detail::stringify(std::string{ str }); + } else { + return{ "{null string}" }; + } +} +std::string StringMaker::convert(char* str) { + if (str) { + return ::Catch::Detail::stringify(std::string{ str }); + } else { + return{ "{null string}" }; + } +} + +#ifdef CATCH_CONFIG_WCHAR +std::string StringMaker::convert(const std::wstring& wstr) { + std::string s; + s.reserve(wstr.size()); + for (auto c : wstr) { + s += (c <= 0xff) ? static_cast(c) : '?'; + } + return ::Catch::Detail::stringify(s); +} + +# ifdef CATCH_CONFIG_CPP17_STRING_VIEW +std::string StringMaker::convert(std::wstring_view str) { + return StringMaker::convert(std::wstring(str)); +} +# endif + +std::string StringMaker::convert(wchar_t const * str) { + if (str) { + return ::Catch::Detail::stringify(std::wstring{ str }); + } else { + return{ "{null string}" }; + } +} +std::string StringMaker::convert(wchar_t * str) { + if (str) { + return ::Catch::Detail::stringify(std::wstring{ str }); + } else { + return{ "{null string}" }; + } +} +#endif + +std::string StringMaker::convert(int value) { + return ::Catch::Detail::stringify(static_cast(value)); +} +std::string StringMaker::convert(long value) { + return ::Catch::Detail::stringify(static_cast(value)); +} +std::string StringMaker::convert(long long value) { + ReusableStringStream rss; + rss << value; + if (value > Detail::hexThreshold) { + rss << " (0x" << std::hex << value << ')'; + } + return rss.str(); +} + +std::string StringMaker::convert(unsigned int value) { + return ::Catch::Detail::stringify(static_cast(value)); +} +std::string StringMaker::convert(unsigned long value) { + return ::Catch::Detail::stringify(static_cast(value)); +} +std::string StringMaker::convert(unsigned long long value) { + ReusableStringStream rss; + rss << value; + if (value > Detail::hexThreshold) { + rss << " (0x" << std::hex << value << ')'; + } + return rss.str(); +} + +std::string StringMaker::convert(bool b) { + return b ? "true" : "false"; +} + +std::string StringMaker::convert(signed char value) { + if (value == '\r') { + return "'\\r'"; + } else if (value == '\f') { + return "'\\f'"; + } else if (value == '\n') { + return "'\\n'"; + } else if (value == '\t') { + return "'\\t'"; + } else if ('\0' <= value && value < ' ') { + return ::Catch::Detail::stringify(static_cast(value)); + } else { + char chstr[] = "' '"; + chstr[1] = value; + return chstr; + } +} +std::string StringMaker::convert(char c) { + return ::Catch::Detail::stringify(static_cast(c)); +} +std::string StringMaker::convert(unsigned char c) { + return ::Catch::Detail::stringify(static_cast(c)); +} + +std::string StringMaker::convert(std::nullptr_t) { + return "nullptr"; +} + +std::string StringMaker::convert(float value) { + return fpToString(value, 5) + 'f'; +} +std::string StringMaker::convert(double value) { + return fpToString(value, 10); +} + +std::string ratio_string::symbol() { return "a"; } +std::string ratio_string::symbol() { return "f"; } +std::string ratio_string::symbol() { return "p"; } +std::string ratio_string::symbol() { return "n"; } +std::string ratio_string::symbol() { return "u"; } +std::string ratio_string::symbol() { return "m"; } + +} // end namespace Catch + +#if defined(__clang__) +# pragma clang diagnostic pop +#endif + +// end catch_tostring.cpp +// start catch_totals.cpp + +namespace Catch { + + Counts Counts::operator - ( Counts const& other ) const { + Counts diff; + diff.passed = passed - other.passed; + diff.failed = failed - other.failed; + diff.failedButOk = failedButOk - other.failedButOk; + return diff; + } + + Counts& Counts::operator += ( Counts const& other ) { + passed += other.passed; + failed += other.failed; + failedButOk += other.failedButOk; + return *this; + } + + std::size_t Counts::total() const { + return passed + failed + failedButOk; + } + bool Counts::allPassed() const { + return failed == 0 && failedButOk == 0; + } + bool Counts::allOk() const { + return failed == 0; + } + + Totals Totals::operator - ( Totals const& other ) const { + Totals diff; + diff.assertions = assertions - other.assertions; + diff.testCases = testCases - other.testCases; + return diff; + } + + Totals& Totals::operator += ( Totals const& other ) { + assertions += other.assertions; + testCases += other.testCases; + return *this; + } + + Totals Totals::delta( Totals const& prevTotals ) const { + Totals diff = *this - prevTotals; + if( diff.assertions.failed > 0 ) + ++diff.testCases.failed; + else if( diff.assertions.failedButOk > 0 ) + ++diff.testCases.failedButOk; + else + ++diff.testCases.passed; + return diff; + } + +} +// end catch_totals.cpp +// start catch_uncaught_exceptions.cpp + +#include + +namespace Catch { + bool uncaught_exceptions() { +#if defined(CATCH_CONFIG_CPP17_UNCAUGHT_EXCEPTIONS) + return std::uncaught_exceptions() > 0; +#else + return std::uncaught_exception(); +#endif + } +} // end namespace Catch +// end catch_uncaught_exceptions.cpp +// start catch_version.cpp + +#include + +namespace Catch { + + Version::Version + ( unsigned int _majorVersion, + unsigned int _minorVersion, + unsigned int _patchNumber, + char const * const _branchName, + unsigned int _buildNumber ) + : majorVersion( _majorVersion ), + minorVersion( _minorVersion ), + patchNumber( _patchNumber ), + branchName( _branchName ), + buildNumber( _buildNumber ) + {} + + std::ostream& operator << ( std::ostream& os, Version const& version ) { + os << version.majorVersion << '.' + << version.minorVersion << '.' + << version.patchNumber; + // branchName is never null -> 0th char is \0 if it is empty + if (version.branchName[0]) { + os << '-' << version.branchName + << '.' << version.buildNumber; + } + return os; + } + + Version const& libraryVersion() { + static Version version( 2, 5, 0, "", 0 ); + return version; + } + +} +// end catch_version.cpp +// start catch_wildcard_pattern.cpp + +#include + +namespace Catch { + + WildcardPattern::WildcardPattern( std::string const& pattern, + CaseSensitive::Choice caseSensitivity ) + : m_caseSensitivity( caseSensitivity ), + m_pattern( adjustCase( pattern ) ) + { + if( startsWith( m_pattern, '*' ) ) { + m_pattern = m_pattern.substr( 1 ); + m_wildcard = WildcardAtStart; + } + if( endsWith( m_pattern, '*' ) ) { + m_pattern = m_pattern.substr( 0, m_pattern.size()-1 ); + m_wildcard = static_cast( m_wildcard | WildcardAtEnd ); + } + } + + bool WildcardPattern::matches( std::string const& str ) const { + switch( m_wildcard ) { + case NoWildcard: + return m_pattern == adjustCase( str ); + case WildcardAtStart: + return endsWith( adjustCase( str ), m_pattern ); + case WildcardAtEnd: + return startsWith( adjustCase( str ), m_pattern ); + case WildcardAtBothEnds: + return contains( adjustCase( str ), m_pattern ); + default: + CATCH_INTERNAL_ERROR( "Unknown enum" ); + } + } + + std::string WildcardPattern::adjustCase( std::string const& str ) const { + return m_caseSensitivity == CaseSensitive::No ? toLower( str ) : str; + } +} +// end catch_wildcard_pattern.cpp +// start catch_xmlwriter.cpp + +#include + +using uchar = unsigned char; + +namespace Catch { + +namespace { + + size_t trailingBytes(unsigned char c) { + if ((c & 0xE0) == 0xC0) { + return 2; + } + if ((c & 0xF0) == 0xE0) { + return 3; + } + if ((c & 0xF8) == 0xF0) { + return 4; + } + CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered"); + } + + uint32_t headerValue(unsigned char c) { + if ((c & 0xE0) == 0xC0) { + return c & 0x1F; + } + if ((c & 0xF0) == 0xE0) { + return c & 0x0F; + } + if ((c & 0xF8) == 0xF0) { + return c & 0x07; + } + CATCH_INTERNAL_ERROR("Invalid multibyte utf-8 start byte encountered"); + } + + void hexEscapeChar(std::ostream& os, unsigned char c) { + os << "\\x" + << std::uppercase << std::hex << std::setfill('0') << std::setw(2) + << static_cast(c); + } + +} // anonymous namespace + + XmlEncode::XmlEncode( std::string const& str, ForWhat forWhat ) + : m_str( str ), + m_forWhat( forWhat ) + {} + + void XmlEncode::encodeTo( std::ostream& os ) const { + // Apostrophe escaping not necessary if we always use " to write attributes + // (see: http://www.w3.org/TR/xml/#syntax) + + for( std::size_t idx = 0; idx < m_str.size(); ++ idx ) { + uchar c = m_str[idx]; + switch (c) { + case '<': os << "<"; break; + case '&': os << "&"; break; + + case '>': + // See: http://www.w3.org/TR/xml/#syntax + if (idx > 2 && m_str[idx - 1] == ']' && m_str[idx - 2] == ']') + os << ">"; + else + os << c; + break; + + case '\"': + if (m_forWhat == ForAttributes) + os << """; + else + os << c; + break; + + default: + // Check for control characters and invalid utf-8 + + // Escape control characters in standard ascii + // see http://stackoverflow.com/questions/404107/why-are-control-characters-illegal-in-xml-1-0 + if (c < 0x09 || (c > 0x0D && c < 0x20) || c == 0x7F) { + hexEscapeChar(os, c); + break; + } + + // Plain ASCII: Write it to stream + if (c < 0x7F) { + os << c; + break; + } + + // UTF-8 territory + // Check if the encoding is valid and if it is not, hex escape bytes. + // Important: We do not check the exact decoded values for validity, only the encoding format + // First check that this bytes is a valid lead byte: + // This means that it is not encoded as 1111 1XXX + // Or as 10XX XXXX + if (c < 0xC0 || + c >= 0xF8) { + hexEscapeChar(os, c); + break; + } + + auto encBytes = trailingBytes(c); + // Are there enough bytes left to avoid accessing out-of-bounds memory? + if (idx + encBytes - 1 >= m_str.size()) { + hexEscapeChar(os, c); + break; + } + // The header is valid, check data + // The next encBytes bytes must together be a valid utf-8 + // This means: bitpattern 10XX XXXX and the extracted value is sane (ish) + bool valid = true; + uint32_t value = headerValue(c); + for (std::size_t n = 1; n < encBytes; ++n) { + uchar nc = m_str[idx + n]; + valid &= ((nc & 0xC0) == 0x80); + value = (value << 6) | (nc & 0x3F); + } + + if ( + // Wrong bit pattern of following bytes + (!valid) || + // Overlong encodings + (value < 0x80) || + (0x80 <= value && value < 0x800 && encBytes > 2) || + (0x800 < value && value < 0x10000 && encBytes > 3) || + // Encoded value out of range + (value >= 0x110000) + ) { + hexEscapeChar(os, c); + break; + } + + // If we got here, this is in fact a valid(ish) utf-8 sequence + for (std::size_t n = 0; n < encBytes; ++n) { + os << m_str[idx + n]; + } + idx += encBytes - 1; + break; + } + } + } + + std::ostream& operator << ( std::ostream& os, XmlEncode const& xmlEncode ) { + xmlEncode.encodeTo( os ); + return os; + } + + XmlWriter::ScopedElement::ScopedElement( XmlWriter* writer ) + : m_writer( writer ) + {} + + XmlWriter::ScopedElement::ScopedElement( ScopedElement&& other ) noexcept + : m_writer( other.m_writer ){ + other.m_writer = nullptr; + } + XmlWriter::ScopedElement& XmlWriter::ScopedElement::operator=( ScopedElement&& other ) noexcept { + if ( m_writer ) { + m_writer->endElement(); + } + m_writer = other.m_writer; + other.m_writer = nullptr; + return *this; + } + + XmlWriter::ScopedElement::~ScopedElement() { + if( m_writer ) + m_writer->endElement(); + } + + XmlWriter::ScopedElement& XmlWriter::ScopedElement::writeText( std::string const& text, bool indent ) { + m_writer->writeText( text, indent ); + return *this; + } + + XmlWriter::XmlWriter( std::ostream& os ) : m_os( os ) + { + writeDeclaration(); + } + + XmlWriter::~XmlWriter() { + while( !m_tags.empty() ) + endElement(); + } + + XmlWriter& XmlWriter::startElement( std::string const& name ) { + ensureTagClosed(); + newlineIfNecessary(); + m_os << m_indent << '<' << name; + m_tags.push_back( name ); + m_indent += " "; + m_tagIsOpen = true; + return *this; + } + + XmlWriter::ScopedElement XmlWriter::scopedElement( std::string const& name ) { + ScopedElement scoped( this ); + startElement( name ); + return scoped; + } + + XmlWriter& XmlWriter::endElement() { + newlineIfNecessary(); + m_indent = m_indent.substr( 0, m_indent.size()-2 ); + if( m_tagIsOpen ) { + m_os << "/>"; + m_tagIsOpen = false; + } + else { + m_os << m_indent << ""; + } + m_os << std::endl; + m_tags.pop_back(); + return *this; + } + + XmlWriter& XmlWriter::writeAttribute( std::string const& name, std::string const& attribute ) { + if( !name.empty() && !attribute.empty() ) + m_os << ' ' << name << "=\"" << XmlEncode( attribute, XmlEncode::ForAttributes ) << '"'; + return *this; + } + + XmlWriter& XmlWriter::writeAttribute( std::string const& name, bool attribute ) { + m_os << ' ' << name << "=\"" << ( attribute ? "true" : "false" ) << '"'; + return *this; + } + + XmlWriter& XmlWriter::writeText( std::string const& text, bool indent ) { + if( !text.empty() ){ + bool tagWasOpen = m_tagIsOpen; + ensureTagClosed(); + if( tagWasOpen && indent ) + m_os << m_indent; + m_os << XmlEncode( text ); + m_needsNewline = true; + } + return *this; + } + + XmlWriter& XmlWriter::writeComment( std::string const& text ) { + ensureTagClosed(); + m_os << m_indent << ""; + m_needsNewline = true; + return *this; + } + + void XmlWriter::writeStylesheetRef( std::string const& url ) { + m_os << "\n"; + } + + XmlWriter& XmlWriter::writeBlankLine() { + ensureTagClosed(); + m_os << '\n'; + return *this; + } + + void XmlWriter::ensureTagClosed() { + if( m_tagIsOpen ) { + m_os << ">" << std::endl; + m_tagIsOpen = false; + } + } + + void XmlWriter::writeDeclaration() { + m_os << "\n"; + } + + void XmlWriter::newlineIfNecessary() { + if( m_needsNewline ) { + m_os << std::endl; + m_needsNewline = false; + } + } +} +// end catch_xmlwriter.cpp +// start catch_reporter_bases.cpp + +#include +#include +#include +#include +#include + +namespace Catch { + void prepareExpandedExpression(AssertionResult& result) { + result.getExpandedExpression(); + } + + // Because formatting using c++ streams is stateful, drop down to C is required + // Alternatively we could use stringstream, but its performance is... not good. + std::string getFormattedDuration( double duration ) { + // Max exponent + 1 is required to represent the whole part + // + 1 for decimal point + // + 3 for the 3 decimal places + // + 1 for null terminator + const std::size_t maxDoubleSize = DBL_MAX_10_EXP + 1 + 1 + 3 + 1; + char buffer[maxDoubleSize]; + + // Save previous errno, to prevent sprintf from overwriting it + ErrnoGuard guard; +#ifdef _MSC_VER + sprintf_s(buffer, "%.3f", duration); +#else + sprintf(buffer, "%.3f", duration); +#endif + return std::string(buffer); + } + + TestEventListenerBase::TestEventListenerBase(ReporterConfig const & _config) + :StreamingReporterBase(_config) {} + + std::set TestEventListenerBase::getSupportedVerbosities() { + return { Verbosity::Quiet, Verbosity::Normal, Verbosity::High }; + } + + void TestEventListenerBase::assertionStarting(AssertionInfo const &) {} + + bool TestEventListenerBase::assertionEnded(AssertionStats const &) { + return false; + } + +} // end namespace Catch +// end catch_reporter_bases.cpp +// start catch_reporter_compact.cpp + +namespace { + +#ifdef CATCH_PLATFORM_MAC + const char* failedString() { return "FAILED"; } + const char* passedString() { return "PASSED"; } +#else + const char* failedString() { return "failed"; } + const char* passedString() { return "passed"; } +#endif + + // Colour::LightGrey + Catch::Colour::Code dimColour() { return Catch::Colour::FileName; } + + std::string bothOrAll( std::size_t count ) { + return count == 1 ? std::string() : + count == 2 ? "both " : "all " ; + } + +} // anon namespace + +namespace Catch { +namespace { +// Colour, message variants: +// - white: No tests ran. +// - red: Failed [both/all] N test cases, failed [both/all] M assertions. +// - white: Passed [both/all] N test cases (no assertions). +// - red: Failed N tests cases, failed M assertions. +// - green: Passed [both/all] N tests cases with M assertions. +void printTotals(std::ostream& out, const Totals& totals) { + if (totals.testCases.total() == 0) { + out << "No tests ran."; + } else if (totals.testCases.failed == totals.testCases.total()) { + Colour colour(Colour::ResultError); + const std::string qualify_assertions_failed = + totals.assertions.failed == totals.assertions.total() ? + bothOrAll(totals.assertions.failed) : std::string(); + out << + "Failed " << bothOrAll(totals.testCases.failed) + << pluralise(totals.testCases.failed, "test case") << ", " + "failed " << qualify_assertions_failed << + pluralise(totals.assertions.failed, "assertion") << '.'; + } else if (totals.assertions.total() == 0) { + out << + "Passed " << bothOrAll(totals.testCases.total()) + << pluralise(totals.testCases.total(), "test case") + << " (no assertions)."; + } else if (totals.assertions.failed) { + Colour colour(Colour::ResultError); + out << + "Failed " << pluralise(totals.testCases.failed, "test case") << ", " + "failed " << pluralise(totals.assertions.failed, "assertion") << '.'; + } else { + Colour colour(Colour::ResultSuccess); + out << + "Passed " << bothOrAll(totals.testCases.passed) + << pluralise(totals.testCases.passed, "test case") << + " with " << pluralise(totals.assertions.passed, "assertion") << '.'; + } +} + +// Implementation of CompactReporter formatting +class AssertionPrinter { +public: + AssertionPrinter& operator= (AssertionPrinter const&) = delete; + AssertionPrinter(AssertionPrinter const&) = delete; + AssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages) + : stream(_stream) + , result(_stats.assertionResult) + , messages(_stats.infoMessages) + , itMessage(_stats.infoMessages.begin()) + , printInfoMessages(_printInfoMessages) {} + + void print() { + printSourceInfo(); + + itMessage = messages.begin(); + + switch (result.getResultType()) { + case ResultWas::Ok: + printResultType(Colour::ResultSuccess, passedString()); + printOriginalExpression(); + printReconstructedExpression(); + if (!result.hasExpression()) + printRemainingMessages(Colour::None); + else + printRemainingMessages(); + break; + case ResultWas::ExpressionFailed: + if (result.isOk()) + printResultType(Colour::ResultSuccess, failedString() + std::string(" - but was ok")); + else + printResultType(Colour::Error, failedString()); + printOriginalExpression(); + printReconstructedExpression(); + printRemainingMessages(); + break; + case ResultWas::ThrewException: + printResultType(Colour::Error, failedString()); + printIssue("unexpected exception with message:"); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::FatalErrorCondition: + printResultType(Colour::Error, failedString()); + printIssue("fatal error condition with message:"); + printMessage(); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::DidntThrowException: + printResultType(Colour::Error, failedString()); + printIssue("expected exception, got none"); + printExpressionWas(); + printRemainingMessages(); + break; + case ResultWas::Info: + printResultType(Colour::None, "info"); + printMessage(); + printRemainingMessages(); + break; + case ResultWas::Warning: + printResultType(Colour::None, "warning"); + printMessage(); + printRemainingMessages(); + break; + case ResultWas::ExplicitFailure: + printResultType(Colour::Error, failedString()); + printIssue("explicitly"); + printRemainingMessages(Colour::None); + break; + // These cases are here to prevent compiler warnings + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + printResultType(Colour::Error, "** internal error **"); + break; + } + } + +private: + void printSourceInfo() const { + Colour colourGuard(Colour::FileName); + stream << result.getSourceInfo() << ':'; + } + + void printResultType(Colour::Code colour, std::string const& passOrFail) const { + if (!passOrFail.empty()) { + { + Colour colourGuard(colour); + stream << ' ' << passOrFail; + } + stream << ':'; + } + } + + void printIssue(std::string const& issue) const { + stream << ' ' << issue; + } + + void printExpressionWas() { + if (result.hasExpression()) { + stream << ';'; + { + Colour colour(dimColour()); + stream << " expression was:"; + } + printOriginalExpression(); + } + } + + void printOriginalExpression() const { + if (result.hasExpression()) { + stream << ' ' << result.getExpression(); + } + } + + void printReconstructedExpression() const { + if (result.hasExpandedExpression()) { + { + Colour colour(dimColour()); + stream << " for: "; + } + stream << result.getExpandedExpression(); + } + } + + void printMessage() { + if (itMessage != messages.end()) { + stream << " '" << itMessage->message << '\''; + ++itMessage; + } + } + + void printRemainingMessages(Colour::Code colour = dimColour()) { + if (itMessage == messages.end()) + return; + + // using messages.end() directly yields (or auto) compilation error: + std::vector::const_iterator itEnd = messages.end(); + const std::size_t N = static_cast(std::distance(itMessage, itEnd)); + + { + Colour colourGuard(colour); + stream << " with " << pluralise(N, "message") << ':'; + } + + for (; itMessage != itEnd; ) { + // If this assertion is a warning ignore any INFO messages + if (printInfoMessages || itMessage->type != ResultWas::Info) { + stream << " '" << itMessage->message << '\''; + if (++itMessage != itEnd) { + Colour colourGuard(dimColour()); + stream << " and"; + } + } + } + } + +private: + std::ostream& stream; + AssertionResult const& result; + std::vector messages; + std::vector::const_iterator itMessage; + bool printInfoMessages; +}; + +} // anon namespace + + std::string CompactReporter::getDescription() { + return "Reports test results on a single line, suitable for IDEs"; + } + + ReporterPreferences CompactReporter::getPreferences() const { + return m_reporterPrefs; + } + + void CompactReporter::noMatchingTestCases( std::string const& spec ) { + stream << "No test cases matched '" << spec << '\'' << std::endl; + } + + void CompactReporter::assertionStarting( AssertionInfo const& ) {} + + bool CompactReporter::assertionEnded( AssertionStats const& _assertionStats ) { + AssertionResult const& result = _assertionStats.assertionResult; + + bool printInfoMessages = true; + + // Drop out if result was successful and we're not printing those + if( !m_config->includeSuccessfulResults() && result.isOk() ) { + if( result.getResultType() != ResultWas::Warning ) + return false; + printInfoMessages = false; + } + + AssertionPrinter printer( stream, _assertionStats, printInfoMessages ); + printer.print(); + + stream << std::endl; + return true; + } + + void CompactReporter::sectionEnded(SectionStats const& _sectionStats) { + if (m_config->showDurations() == ShowDurations::Always) { + stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl; + } + } + + void CompactReporter::testRunEnded( TestRunStats const& _testRunStats ) { + printTotals( stream, _testRunStats.totals ); + stream << '\n' << std::endl; + StreamingReporterBase::testRunEnded( _testRunStats ); + } + + CompactReporter::~CompactReporter() {} + + CATCH_REGISTER_REPORTER( "compact", CompactReporter ) + +} // end namespace Catch +// end catch_reporter_compact.cpp +// start catch_reporter_console.cpp + +#include +#include + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch + // Note that 4062 (not all labels are handled + // and default is missing) is enabled +#endif + +namespace Catch { + +namespace { + +// Formatter impl for ConsoleReporter +class ConsoleAssertionPrinter { +public: + ConsoleAssertionPrinter& operator= (ConsoleAssertionPrinter const&) = delete; + ConsoleAssertionPrinter(ConsoleAssertionPrinter const&) = delete; + ConsoleAssertionPrinter(std::ostream& _stream, AssertionStats const& _stats, bool _printInfoMessages) + : stream(_stream), + stats(_stats), + result(_stats.assertionResult), + colour(Colour::None), + message(result.getMessage()), + messages(_stats.infoMessages), + printInfoMessages(_printInfoMessages) { + switch (result.getResultType()) { + case ResultWas::Ok: + colour = Colour::Success; + passOrFail = "PASSED"; + //if( result.hasMessage() ) + if (_stats.infoMessages.size() == 1) + messageLabel = "with message"; + if (_stats.infoMessages.size() > 1) + messageLabel = "with messages"; + break; + case ResultWas::ExpressionFailed: + if (result.isOk()) { + colour = Colour::Success; + passOrFail = "FAILED - but was ok"; + } else { + colour = Colour::Error; + passOrFail = "FAILED"; + } + if (_stats.infoMessages.size() == 1) + messageLabel = "with message"; + if (_stats.infoMessages.size() > 1) + messageLabel = "with messages"; + break; + case ResultWas::ThrewException: + colour = Colour::Error; + passOrFail = "FAILED"; + messageLabel = "due to unexpected exception with "; + if (_stats.infoMessages.size() == 1) + messageLabel += "message"; + if (_stats.infoMessages.size() > 1) + messageLabel += "messages"; + break; + case ResultWas::FatalErrorCondition: + colour = Colour::Error; + passOrFail = "FAILED"; + messageLabel = "due to a fatal error condition"; + break; + case ResultWas::DidntThrowException: + colour = Colour::Error; + passOrFail = "FAILED"; + messageLabel = "because no exception was thrown where one was expected"; + break; + case ResultWas::Info: + messageLabel = "info"; + break; + case ResultWas::Warning: + messageLabel = "warning"; + break; + case ResultWas::ExplicitFailure: + passOrFail = "FAILED"; + colour = Colour::Error; + if (_stats.infoMessages.size() == 1) + messageLabel = "explicitly with message"; + if (_stats.infoMessages.size() > 1) + messageLabel = "explicitly with messages"; + break; + // These cases are here to prevent compiler warnings + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + passOrFail = "** internal error **"; + colour = Colour::Error; + break; + } + } + + void print() const { + printSourceInfo(); + if (stats.totals.assertions.total() > 0) { + printResultType(); + printOriginalExpression(); + printReconstructedExpression(); + } else { + stream << '\n'; + } + printMessage(); + } + +private: + void printResultType() const { + if (!passOrFail.empty()) { + Colour colourGuard(colour); + stream << passOrFail << ":\n"; + } + } + void printOriginalExpression() const { + if (result.hasExpression()) { + Colour colourGuard(Colour::OriginalExpression); + stream << " "; + stream << result.getExpressionInMacro(); + stream << '\n'; + } + } + void printReconstructedExpression() const { + if (result.hasExpandedExpression()) { + stream << "with expansion:\n"; + Colour colourGuard(Colour::ReconstructedExpression); + stream << Column(result.getExpandedExpression()).indent(2) << '\n'; + } + } + void printMessage() const { + if (!messageLabel.empty()) + stream << messageLabel << ':' << '\n'; + for (auto const& msg : messages) { + // If this assertion is a warning ignore any INFO messages + if (printInfoMessages || msg.type != ResultWas::Info) + stream << Column(msg.message).indent(2) << '\n'; + } + } + void printSourceInfo() const { + Colour colourGuard(Colour::FileName); + stream << result.getSourceInfo() << ": "; + } + + std::ostream& stream; + AssertionStats const& stats; + AssertionResult const& result; + Colour::Code colour; + std::string passOrFail; + std::string messageLabel; + std::string message; + std::vector messages; + bool printInfoMessages; +}; + +std::size_t makeRatio(std::size_t number, std::size_t total) { + std::size_t ratio = total > 0 ? CATCH_CONFIG_CONSOLE_WIDTH * number / total : 0; + return (ratio == 0 && number > 0) ? 1 : ratio; +} + +std::size_t& findMax(std::size_t& i, std::size_t& j, std::size_t& k) { + if (i > j && i > k) + return i; + else if (j > k) + return j; + else + return k; +} + +struct ColumnInfo { + enum Justification { Left, Right }; + std::string name; + int width; + Justification justification; +}; +struct ColumnBreak {}; +struct RowBreak {}; + +class Duration { + enum class Unit { + Auto, + Nanoseconds, + Microseconds, + Milliseconds, + Seconds, + Minutes + }; + static const uint64_t s_nanosecondsInAMicrosecond = 1000; + static const uint64_t s_nanosecondsInAMillisecond = 1000 * s_nanosecondsInAMicrosecond; + static const uint64_t s_nanosecondsInASecond = 1000 * s_nanosecondsInAMillisecond; + static const uint64_t s_nanosecondsInAMinute = 60 * s_nanosecondsInASecond; + + uint64_t m_inNanoseconds; + Unit m_units; + +public: + explicit Duration(uint64_t inNanoseconds, Unit units = Unit::Auto) + : m_inNanoseconds(inNanoseconds), + m_units(units) { + if (m_units == Unit::Auto) { + if (m_inNanoseconds < s_nanosecondsInAMicrosecond) + m_units = Unit::Nanoseconds; + else if (m_inNanoseconds < s_nanosecondsInAMillisecond) + m_units = Unit::Microseconds; + else if (m_inNanoseconds < s_nanosecondsInASecond) + m_units = Unit::Milliseconds; + else if (m_inNanoseconds < s_nanosecondsInAMinute) + m_units = Unit::Seconds; + else + m_units = Unit::Minutes; + } + + } + + auto value() const -> double { + switch (m_units) { + case Unit::Microseconds: + return m_inNanoseconds / static_cast(s_nanosecondsInAMicrosecond); + case Unit::Milliseconds: + return m_inNanoseconds / static_cast(s_nanosecondsInAMillisecond); + case Unit::Seconds: + return m_inNanoseconds / static_cast(s_nanosecondsInASecond); + case Unit::Minutes: + return m_inNanoseconds / static_cast(s_nanosecondsInAMinute); + default: + return static_cast(m_inNanoseconds); + } + } + auto unitsAsString() const -> std::string { + switch (m_units) { + case Unit::Nanoseconds: + return "ns"; + case Unit::Microseconds: + return "µs"; + case Unit::Milliseconds: + return "ms"; + case Unit::Seconds: + return "s"; + case Unit::Minutes: + return "m"; + default: + return "** internal error **"; + } + + } + friend auto operator << (std::ostream& os, Duration const& duration) -> std::ostream& { + return os << duration.value() << " " << duration.unitsAsString(); + } +}; +} // end anon namespace + +class TablePrinter { + std::ostream& m_os; + std::vector m_columnInfos; + std::ostringstream m_oss; + int m_currentColumn = -1; + bool m_isOpen = false; + +public: + TablePrinter( std::ostream& os, std::vector columnInfos ) + : m_os( os ), + m_columnInfos( std::move( columnInfos ) ) {} + + auto columnInfos() const -> std::vector const& { + return m_columnInfos; + } + + void open() { + if (!m_isOpen) { + m_isOpen = true; + *this << RowBreak(); + for (auto const& info : m_columnInfos) + *this << info.name << ColumnBreak(); + *this << RowBreak(); + m_os << Catch::getLineOfChars<'-'>() << "\n"; + } + } + void close() { + if (m_isOpen) { + *this << RowBreak(); + m_os << std::endl; + m_isOpen = false; + } + } + + template + friend TablePrinter& operator << (TablePrinter& tp, T const& value) { + tp.m_oss << value; + return tp; + } + + friend TablePrinter& operator << (TablePrinter& tp, ColumnBreak) { + auto colStr = tp.m_oss.str(); + // This takes account of utf8 encodings + auto strSize = Catch::StringRef(colStr).numberOfCharacters(); + tp.m_oss.str(""); + tp.open(); + if (tp.m_currentColumn == static_cast(tp.m_columnInfos.size() - 1)) { + tp.m_currentColumn = -1; + tp.m_os << "\n"; + } + tp.m_currentColumn++; + + auto colInfo = tp.m_columnInfos[tp.m_currentColumn]; + auto padding = (strSize + 2 < static_cast(colInfo.width)) + ? std::string(colInfo.width - (strSize + 2), ' ') + : std::string(); + if (colInfo.justification == ColumnInfo::Left) + tp.m_os << colStr << padding << " "; + else + tp.m_os << padding << colStr << " "; + return tp; + } + + friend TablePrinter& operator << (TablePrinter& tp, RowBreak) { + if (tp.m_currentColumn > 0) { + tp.m_os << "\n"; + tp.m_currentColumn = -1; + } + return tp; + } +}; + +ConsoleReporter::ConsoleReporter(ReporterConfig const& config) + : StreamingReporterBase(config), + m_tablePrinter(new TablePrinter(config.stream(), + { + { "benchmark name", CATCH_CONFIG_CONSOLE_WIDTH - 32, ColumnInfo::Left }, + { "iters", 8, ColumnInfo::Right }, + { "elapsed ns", 14, ColumnInfo::Right }, + { "average", 14, ColumnInfo::Right } + })) {} +ConsoleReporter::~ConsoleReporter() = default; + +std::string ConsoleReporter::getDescription() { + return "Reports test results as plain lines of text"; +} + +void ConsoleReporter::noMatchingTestCases(std::string const& spec) { + stream << "No test cases matched '" << spec << '\'' << std::endl; +} + +void ConsoleReporter::assertionStarting(AssertionInfo const&) {} + +bool ConsoleReporter::assertionEnded(AssertionStats const& _assertionStats) { + AssertionResult const& result = _assertionStats.assertionResult; + + bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); + + // Drop out if result was successful but we're not printing them. + if (!includeResults && result.getResultType() != ResultWas::Warning) + return false; + + lazyPrint(); + + ConsoleAssertionPrinter printer(stream, _assertionStats, includeResults); + printer.print(); + stream << std::endl; + return true; +} + +void ConsoleReporter::sectionStarting(SectionInfo const& _sectionInfo) { + m_headerPrinted = false; + StreamingReporterBase::sectionStarting(_sectionInfo); +} +void ConsoleReporter::sectionEnded(SectionStats const& _sectionStats) { + m_tablePrinter->close(); + if (_sectionStats.missingAssertions) { + lazyPrint(); + Colour colour(Colour::ResultError); + if (m_sectionStack.size() > 1) + stream << "\nNo assertions in section"; + else + stream << "\nNo assertions in test case"; + stream << " '" << _sectionStats.sectionInfo.name << "'\n" << std::endl; + } + if (m_config->showDurations() == ShowDurations::Always) { + stream << getFormattedDuration(_sectionStats.durationInSeconds) << " s: " << _sectionStats.sectionInfo.name << std::endl; + } + if (m_headerPrinted) { + m_headerPrinted = false; + } + StreamingReporterBase::sectionEnded(_sectionStats); +} + +void ConsoleReporter::benchmarkStarting(BenchmarkInfo const& info) { + lazyPrintWithoutClosingBenchmarkTable(); + + auto nameCol = Column( info.name ).width( static_cast( m_tablePrinter->columnInfos()[0].width - 2 ) ); + + bool firstLine = true; + for (auto line : nameCol) { + if (!firstLine) + (*m_tablePrinter) << ColumnBreak() << ColumnBreak() << ColumnBreak(); + else + firstLine = false; + + (*m_tablePrinter) << line << ColumnBreak(); + } +} +void ConsoleReporter::benchmarkEnded(BenchmarkStats const& stats) { + Duration average(stats.elapsedTimeInNanoseconds / stats.iterations); + (*m_tablePrinter) + << stats.iterations << ColumnBreak() + << stats.elapsedTimeInNanoseconds << ColumnBreak() + << average << ColumnBreak(); +} + +void ConsoleReporter::testCaseEnded(TestCaseStats const& _testCaseStats) { + m_tablePrinter->close(); + StreamingReporterBase::testCaseEnded(_testCaseStats); + m_headerPrinted = false; +} +void ConsoleReporter::testGroupEnded(TestGroupStats const& _testGroupStats) { + if (currentGroupInfo.used) { + printSummaryDivider(); + stream << "Summary for group '" << _testGroupStats.groupInfo.name << "':\n"; + printTotals(_testGroupStats.totals); + stream << '\n' << std::endl; + } + StreamingReporterBase::testGroupEnded(_testGroupStats); +} +void ConsoleReporter::testRunEnded(TestRunStats const& _testRunStats) { + printTotalsDivider(_testRunStats.totals); + printTotals(_testRunStats.totals); + stream << std::endl; + StreamingReporterBase::testRunEnded(_testRunStats); +} + +void ConsoleReporter::lazyPrint() { + + m_tablePrinter->close(); + lazyPrintWithoutClosingBenchmarkTable(); +} + +void ConsoleReporter::lazyPrintWithoutClosingBenchmarkTable() { + + if (!currentTestRunInfo.used) + lazyPrintRunInfo(); + if (!currentGroupInfo.used) + lazyPrintGroupInfo(); + + if (!m_headerPrinted) { + printTestCaseAndSectionHeader(); + m_headerPrinted = true; + } +} +void ConsoleReporter::lazyPrintRunInfo() { + stream << '\n' << getLineOfChars<'~'>() << '\n'; + Colour colour(Colour::SecondaryText); + stream << currentTestRunInfo->name + << " is a Catch v" << libraryVersion() << " host application.\n" + << "Run with -? for options\n\n"; + + if (m_config->rngSeed() != 0) + stream << "Randomness seeded to: " << m_config->rngSeed() << "\n\n"; + + currentTestRunInfo.used = true; +} +void ConsoleReporter::lazyPrintGroupInfo() { + if (!currentGroupInfo->name.empty() && currentGroupInfo->groupsCounts > 1) { + printClosedHeader("Group: " + currentGroupInfo->name); + currentGroupInfo.used = true; + } +} +void ConsoleReporter::printTestCaseAndSectionHeader() { + assert(!m_sectionStack.empty()); + printOpenHeader(currentTestCaseInfo->name); + + if (m_sectionStack.size() > 1) { + Colour colourGuard(Colour::Headers); + + auto + it = m_sectionStack.begin() + 1, // Skip first section (test case) + itEnd = m_sectionStack.end(); + for (; it != itEnd; ++it) + printHeaderString(it->name, 2); + } + + SourceLineInfo lineInfo = m_sectionStack.back().lineInfo; + + if (!lineInfo.empty()) { + stream << getLineOfChars<'-'>() << '\n'; + Colour colourGuard(Colour::FileName); + stream << lineInfo << '\n'; + } + stream << getLineOfChars<'.'>() << '\n' << std::endl; +} + +void ConsoleReporter::printClosedHeader(std::string const& _name) { + printOpenHeader(_name); + stream << getLineOfChars<'.'>() << '\n'; +} +void ConsoleReporter::printOpenHeader(std::string const& _name) { + stream << getLineOfChars<'-'>() << '\n'; + { + Colour colourGuard(Colour::Headers); + printHeaderString(_name); + } +} + +// if string has a : in first line will set indent to follow it on +// subsequent lines +void ConsoleReporter::printHeaderString(std::string const& _string, std::size_t indent) { + std::size_t i = _string.find(": "); + if (i != std::string::npos) + i += 2; + else + i = 0; + stream << Column(_string).indent(indent + i).initialIndent(indent) << '\n'; +} + +struct SummaryColumn { + + SummaryColumn( std::string _label, Colour::Code _colour ) + : label( std::move( _label ) ), + colour( _colour ) {} + SummaryColumn addRow( std::size_t count ) { + ReusableStringStream rss; + rss << count; + std::string row = rss.str(); + for (auto& oldRow : rows) { + while (oldRow.size() < row.size()) + oldRow = ' ' + oldRow; + while (oldRow.size() > row.size()) + row = ' ' + row; + } + rows.push_back(row); + return *this; + } + + std::string label; + Colour::Code colour; + std::vector rows; + +}; + +void ConsoleReporter::printTotals( Totals const& totals ) { + if (totals.testCases.total() == 0) { + stream << Colour(Colour::Warning) << "No tests ran\n"; + } else if (totals.assertions.total() > 0 && totals.testCases.allPassed()) { + stream << Colour(Colour::ResultSuccess) << "All tests passed"; + stream << " (" + << pluralise(totals.assertions.passed, "assertion") << " in " + << pluralise(totals.testCases.passed, "test case") << ')' + << '\n'; + } else { + + std::vector columns; + columns.push_back(SummaryColumn("", Colour::None) + .addRow(totals.testCases.total()) + .addRow(totals.assertions.total())); + columns.push_back(SummaryColumn("passed", Colour::Success) + .addRow(totals.testCases.passed) + .addRow(totals.assertions.passed)); + columns.push_back(SummaryColumn("failed", Colour::ResultError) + .addRow(totals.testCases.failed) + .addRow(totals.assertions.failed)); + columns.push_back(SummaryColumn("failed as expected", Colour::ResultExpectedFailure) + .addRow(totals.testCases.failedButOk) + .addRow(totals.assertions.failedButOk)); + + printSummaryRow("test cases", columns, 0); + printSummaryRow("assertions", columns, 1); + } +} +void ConsoleReporter::printSummaryRow(std::string const& label, std::vector const& cols, std::size_t row) { + for (auto col : cols) { + std::string value = col.rows[row]; + if (col.label.empty()) { + stream << label << ": "; + if (value != "0") + stream << value; + else + stream << Colour(Colour::Warning) << "- none -"; + } else if (value != "0") { + stream << Colour(Colour::LightGrey) << " | "; + stream << Colour(col.colour) + << value << ' ' << col.label; + } + } + stream << '\n'; +} + +void ConsoleReporter::printTotalsDivider(Totals const& totals) { + if (totals.testCases.total() > 0) { + std::size_t failedRatio = makeRatio(totals.testCases.failed, totals.testCases.total()); + std::size_t failedButOkRatio = makeRatio(totals.testCases.failedButOk, totals.testCases.total()); + std::size_t passedRatio = makeRatio(totals.testCases.passed, totals.testCases.total()); + while (failedRatio + failedButOkRatio + passedRatio < CATCH_CONFIG_CONSOLE_WIDTH - 1) + findMax(failedRatio, failedButOkRatio, passedRatio)++; + while (failedRatio + failedButOkRatio + passedRatio > CATCH_CONFIG_CONSOLE_WIDTH - 1) + findMax(failedRatio, failedButOkRatio, passedRatio)--; + + stream << Colour(Colour::Error) << std::string(failedRatio, '='); + stream << Colour(Colour::ResultExpectedFailure) << std::string(failedButOkRatio, '='); + if (totals.testCases.allPassed()) + stream << Colour(Colour::ResultSuccess) << std::string(passedRatio, '='); + else + stream << Colour(Colour::Success) << std::string(passedRatio, '='); + } else { + stream << Colour(Colour::Warning) << std::string(CATCH_CONFIG_CONSOLE_WIDTH - 1, '='); + } + stream << '\n'; +} +void ConsoleReporter::printSummaryDivider() { + stream << getLineOfChars<'-'>() << '\n'; +} + +CATCH_REGISTER_REPORTER("console", ConsoleReporter) + +} // end namespace Catch + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif +// end catch_reporter_console.cpp +// start catch_reporter_junit.cpp + +#include +#include +#include +#include + +namespace Catch { + + namespace { + std::string getCurrentTimestamp() { + // Beware, this is not reentrant because of backward compatibility issues + // Also, UTC only, again because of backward compatibility (%z is C++11) + time_t rawtime; + std::time(&rawtime); + auto const timeStampSize = sizeof("2017-01-16T17:06:45Z"); + +#ifdef _MSC_VER + std::tm timeInfo = {}; + gmtime_s(&timeInfo, &rawtime); +#else + std::tm* timeInfo; + timeInfo = std::gmtime(&rawtime); +#endif + + char timeStamp[timeStampSize]; + const char * const fmt = "%Y-%m-%dT%H:%M:%SZ"; + +#ifdef _MSC_VER + std::strftime(timeStamp, timeStampSize, fmt, &timeInfo); +#else + std::strftime(timeStamp, timeStampSize, fmt, timeInfo); +#endif + return std::string(timeStamp); + } + + std::string fileNameTag(const std::vector &tags) { + auto it = std::find_if(begin(tags), + end(tags), + [] (std::string const& tag) {return tag.front() == '#'; }); + if (it != tags.end()) + return it->substr(1); + return std::string(); + } + } // anonymous namespace + + JunitReporter::JunitReporter( ReporterConfig const& _config ) + : CumulativeReporterBase( _config ), + xml( _config.stream() ) + { + m_reporterPrefs.shouldRedirectStdOut = true; + m_reporterPrefs.shouldReportAllAssertions = true; + } + + JunitReporter::~JunitReporter() {} + + std::string JunitReporter::getDescription() { + return "Reports test results in an XML format that looks like Ant's junitreport target"; + } + + void JunitReporter::noMatchingTestCases( std::string const& /*spec*/ ) {} + + void JunitReporter::testRunStarting( TestRunInfo const& runInfo ) { + CumulativeReporterBase::testRunStarting( runInfo ); + xml.startElement( "testsuites" ); + } + + void JunitReporter::testGroupStarting( GroupInfo const& groupInfo ) { + suiteTimer.start(); + stdOutForSuite.clear(); + stdErrForSuite.clear(); + unexpectedExceptions = 0; + CumulativeReporterBase::testGroupStarting( groupInfo ); + } + + void JunitReporter::testCaseStarting( TestCaseInfo const& testCaseInfo ) { + m_okToFail = testCaseInfo.okToFail(); + } + + bool JunitReporter::assertionEnded( AssertionStats const& assertionStats ) { + if( assertionStats.assertionResult.getResultType() == ResultWas::ThrewException && !m_okToFail ) + unexpectedExceptions++; + return CumulativeReporterBase::assertionEnded( assertionStats ); + } + + void JunitReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { + stdOutForSuite += testCaseStats.stdOut; + stdErrForSuite += testCaseStats.stdErr; + CumulativeReporterBase::testCaseEnded( testCaseStats ); + } + + void JunitReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { + double suiteTime = suiteTimer.getElapsedSeconds(); + CumulativeReporterBase::testGroupEnded( testGroupStats ); + writeGroup( *m_testGroups.back(), suiteTime ); + } + + void JunitReporter::testRunEndedCumulative() { + xml.endElement(); + } + + void JunitReporter::writeGroup( TestGroupNode const& groupNode, double suiteTime ) { + XmlWriter::ScopedElement e = xml.scopedElement( "testsuite" ); + TestGroupStats const& stats = groupNode.value; + xml.writeAttribute( "name", stats.groupInfo.name ); + xml.writeAttribute( "errors", unexpectedExceptions ); + xml.writeAttribute( "failures", stats.totals.assertions.failed-unexpectedExceptions ); + xml.writeAttribute( "tests", stats.totals.assertions.total() ); + xml.writeAttribute( "hostname", "tbd" ); // !TBD + if( m_config->showDurations() == ShowDurations::Never ) + xml.writeAttribute( "time", "" ); + else + xml.writeAttribute( "time", suiteTime ); + xml.writeAttribute( "timestamp", getCurrentTimestamp() ); + + // Write test cases + for( auto const& child : groupNode.children ) + writeTestCase( *child ); + + xml.scopedElement( "system-out" ).writeText( trim( stdOutForSuite ), false ); + xml.scopedElement( "system-err" ).writeText( trim( stdErrForSuite ), false ); + } + + void JunitReporter::writeTestCase( TestCaseNode const& testCaseNode ) { + TestCaseStats const& stats = testCaseNode.value; + + // All test cases have exactly one section - which represents the + // test case itself. That section may have 0-n nested sections + assert( testCaseNode.children.size() == 1 ); + SectionNode const& rootSection = *testCaseNode.children.front(); + + std::string className = stats.testInfo.className; + + if( className.empty() ) { + className = fileNameTag(stats.testInfo.tags); + if ( className.empty() ) + className = "global"; + } + + if ( !m_config->name().empty() ) + className = m_config->name() + "." + className; + + writeSection( className, "", rootSection ); + } + + void JunitReporter::writeSection( std::string const& className, + std::string const& rootName, + SectionNode const& sectionNode ) { + std::string name = trim( sectionNode.stats.sectionInfo.name ); + if( !rootName.empty() ) + name = rootName + '/' + name; + + if( !sectionNode.assertions.empty() || + !sectionNode.stdOut.empty() || + !sectionNode.stdErr.empty() ) { + XmlWriter::ScopedElement e = xml.scopedElement( "testcase" ); + if( className.empty() ) { + xml.writeAttribute( "classname", name ); + xml.writeAttribute( "name", "root" ); + } + else { + xml.writeAttribute( "classname", className ); + xml.writeAttribute( "name", name ); + } + xml.writeAttribute( "time", ::Catch::Detail::stringify( sectionNode.stats.durationInSeconds ) ); + + writeAssertions( sectionNode ); + + if( !sectionNode.stdOut.empty() ) + xml.scopedElement( "system-out" ).writeText( trim( sectionNode.stdOut ), false ); + if( !sectionNode.stdErr.empty() ) + xml.scopedElement( "system-err" ).writeText( trim( sectionNode.stdErr ), false ); + } + for( auto const& childNode : sectionNode.childSections ) + if( className.empty() ) + writeSection( name, "", *childNode ); + else + writeSection( className, name, *childNode ); + } + + void JunitReporter::writeAssertions( SectionNode const& sectionNode ) { + for( auto const& assertion : sectionNode.assertions ) + writeAssertion( assertion ); + } + + void JunitReporter::writeAssertion( AssertionStats const& stats ) { + AssertionResult const& result = stats.assertionResult; + if( !result.isOk() ) { + std::string elementName; + switch( result.getResultType() ) { + case ResultWas::ThrewException: + case ResultWas::FatalErrorCondition: + elementName = "error"; + break; + case ResultWas::ExplicitFailure: + elementName = "failure"; + break; + case ResultWas::ExpressionFailed: + elementName = "failure"; + break; + case ResultWas::DidntThrowException: + elementName = "failure"; + break; + + // We should never see these here: + case ResultWas::Info: + case ResultWas::Warning: + case ResultWas::Ok: + case ResultWas::Unknown: + case ResultWas::FailureBit: + case ResultWas::Exception: + elementName = "internalError"; + break; + } + + XmlWriter::ScopedElement e = xml.scopedElement( elementName ); + + xml.writeAttribute( "message", result.getExpandedExpression() ); + xml.writeAttribute( "type", result.getTestMacroName() ); + + ReusableStringStream rss; + if( !result.getMessage().empty() ) + rss << result.getMessage() << '\n'; + for( auto const& msg : stats.infoMessages ) + if( msg.type == ResultWas::Info ) + rss << msg.message << '\n'; + + rss << "at " << result.getSourceInfo(); + xml.writeText( rss.str(), false ); + } + } + + CATCH_REGISTER_REPORTER( "junit", JunitReporter ) + +} // end namespace Catch +// end catch_reporter_junit.cpp +// start catch_reporter_listening.cpp + +#include + +namespace Catch { + + ListeningReporter::ListeningReporter() { + // We will assume that listeners will always want all assertions + m_preferences.shouldReportAllAssertions = true; + } + + void ListeningReporter::addListener( IStreamingReporterPtr&& listener ) { + m_listeners.push_back( std::move( listener ) ); + } + + void ListeningReporter::addReporter(IStreamingReporterPtr&& reporter) { + assert(!m_reporter && "Listening reporter can wrap only 1 real reporter"); + m_reporter = std::move( reporter ); + m_preferences.shouldRedirectStdOut = m_reporter->getPreferences().shouldRedirectStdOut; + } + + ReporterPreferences ListeningReporter::getPreferences() const { + return m_preferences; + } + + std::set ListeningReporter::getSupportedVerbosities() { + return std::set{ }; + } + + void ListeningReporter::noMatchingTestCases( std::string const& spec ) { + for ( auto const& listener : m_listeners ) { + listener->noMatchingTestCases( spec ); + } + m_reporter->noMatchingTestCases( spec ); + } + + void ListeningReporter::benchmarkStarting( BenchmarkInfo const& benchmarkInfo ) { + for ( auto const& listener : m_listeners ) { + listener->benchmarkStarting( benchmarkInfo ); + } + m_reporter->benchmarkStarting( benchmarkInfo ); + } + void ListeningReporter::benchmarkEnded( BenchmarkStats const& benchmarkStats ) { + for ( auto const& listener : m_listeners ) { + listener->benchmarkEnded( benchmarkStats ); + } + m_reporter->benchmarkEnded( benchmarkStats ); + } + + void ListeningReporter::testRunStarting( TestRunInfo const& testRunInfo ) { + for ( auto const& listener : m_listeners ) { + listener->testRunStarting( testRunInfo ); + } + m_reporter->testRunStarting( testRunInfo ); + } + + void ListeningReporter::testGroupStarting( GroupInfo const& groupInfo ) { + for ( auto const& listener : m_listeners ) { + listener->testGroupStarting( groupInfo ); + } + m_reporter->testGroupStarting( groupInfo ); + } + + void ListeningReporter::testCaseStarting( TestCaseInfo const& testInfo ) { + for ( auto const& listener : m_listeners ) { + listener->testCaseStarting( testInfo ); + } + m_reporter->testCaseStarting( testInfo ); + } + + void ListeningReporter::sectionStarting( SectionInfo const& sectionInfo ) { + for ( auto const& listener : m_listeners ) { + listener->sectionStarting( sectionInfo ); + } + m_reporter->sectionStarting( sectionInfo ); + } + + void ListeningReporter::assertionStarting( AssertionInfo const& assertionInfo ) { + for ( auto const& listener : m_listeners ) { + listener->assertionStarting( assertionInfo ); + } + m_reporter->assertionStarting( assertionInfo ); + } + + // The return value indicates if the messages buffer should be cleared: + bool ListeningReporter::assertionEnded( AssertionStats const& assertionStats ) { + for( auto const& listener : m_listeners ) { + static_cast( listener->assertionEnded( assertionStats ) ); + } + return m_reporter->assertionEnded( assertionStats ); + } + + void ListeningReporter::sectionEnded( SectionStats const& sectionStats ) { + for ( auto const& listener : m_listeners ) { + listener->sectionEnded( sectionStats ); + } + m_reporter->sectionEnded( sectionStats ); + } + + void ListeningReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { + for ( auto const& listener : m_listeners ) { + listener->testCaseEnded( testCaseStats ); + } + m_reporter->testCaseEnded( testCaseStats ); + } + + void ListeningReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { + for ( auto const& listener : m_listeners ) { + listener->testGroupEnded( testGroupStats ); + } + m_reporter->testGroupEnded( testGroupStats ); + } + + void ListeningReporter::testRunEnded( TestRunStats const& testRunStats ) { + for ( auto const& listener : m_listeners ) { + listener->testRunEnded( testRunStats ); + } + m_reporter->testRunEnded( testRunStats ); + } + + void ListeningReporter::skipTest( TestCaseInfo const& testInfo ) { + for ( auto const& listener : m_listeners ) { + listener->skipTest( testInfo ); + } + m_reporter->skipTest( testInfo ); + } + + bool ListeningReporter::isMulti() const { + return true; + } + +} // end namespace Catch +// end catch_reporter_listening.cpp +// start catch_reporter_xml.cpp + +#if defined(_MSC_VER) +#pragma warning(push) +#pragma warning(disable:4061) // Not all labels are EXPLICITLY handled in switch + // Note that 4062 (not all labels are handled + // and default is missing) is enabled +#endif + +namespace Catch { + XmlReporter::XmlReporter( ReporterConfig const& _config ) + : StreamingReporterBase( _config ), + m_xml(_config.stream()) + { + m_reporterPrefs.shouldRedirectStdOut = true; + m_reporterPrefs.shouldReportAllAssertions = true; + } + + XmlReporter::~XmlReporter() = default; + + std::string XmlReporter::getDescription() { + return "Reports test results as an XML document"; + } + + std::string XmlReporter::getStylesheetRef() const { + return std::string(); + } + + void XmlReporter::writeSourceInfo( SourceLineInfo const& sourceInfo ) { + m_xml + .writeAttribute( "filename", sourceInfo.file ) + .writeAttribute( "line", sourceInfo.line ); + } + + void XmlReporter::noMatchingTestCases( std::string const& s ) { + StreamingReporterBase::noMatchingTestCases( s ); + } + + void XmlReporter::testRunStarting( TestRunInfo const& testInfo ) { + StreamingReporterBase::testRunStarting( testInfo ); + std::string stylesheetRef = getStylesheetRef(); + if( !stylesheetRef.empty() ) + m_xml.writeStylesheetRef( stylesheetRef ); + m_xml.startElement( "Catch" ); + if( !m_config->name().empty() ) + m_xml.writeAttribute( "name", m_config->name() ); + if( m_config->rngSeed() != 0 ) + m_xml.scopedElement( "Randomness" ) + .writeAttribute( "seed", m_config->rngSeed() ); + } + + void XmlReporter::testGroupStarting( GroupInfo const& groupInfo ) { + StreamingReporterBase::testGroupStarting( groupInfo ); + m_xml.startElement( "Group" ) + .writeAttribute( "name", groupInfo.name ); + } + + void XmlReporter::testCaseStarting( TestCaseInfo const& testInfo ) { + StreamingReporterBase::testCaseStarting(testInfo); + m_xml.startElement( "TestCase" ) + .writeAttribute( "name", trim( testInfo.name ) ) + .writeAttribute( "description", testInfo.description ) + .writeAttribute( "tags", testInfo.tagsAsString() ); + + writeSourceInfo( testInfo.lineInfo ); + + if ( m_config->showDurations() == ShowDurations::Always ) + m_testCaseTimer.start(); + m_xml.ensureTagClosed(); + } + + void XmlReporter::sectionStarting( SectionInfo const& sectionInfo ) { + StreamingReporterBase::sectionStarting( sectionInfo ); + if( m_sectionDepth++ > 0 ) { + m_xml.startElement( "Section" ) + .writeAttribute( "name", trim( sectionInfo.name ) ); + writeSourceInfo( sectionInfo.lineInfo ); + m_xml.ensureTagClosed(); + } + } + + void XmlReporter::assertionStarting( AssertionInfo const& ) { } + + bool XmlReporter::assertionEnded( AssertionStats const& assertionStats ) { + + AssertionResult const& result = assertionStats.assertionResult; + + bool includeResults = m_config->includeSuccessfulResults() || !result.isOk(); + + if( includeResults || result.getResultType() == ResultWas::Warning ) { + // Print any info messages in tags. + for( auto const& msg : assertionStats.infoMessages ) { + if( msg.type == ResultWas::Info && includeResults ) { + m_xml.scopedElement( "Info" ) + .writeText( msg.message ); + } else if ( msg.type == ResultWas::Warning ) { + m_xml.scopedElement( "Warning" ) + .writeText( msg.message ); + } + } + } + + // Drop out if result was successful but we're not printing them. + if( !includeResults && result.getResultType() != ResultWas::Warning ) + return true; + + // Print the expression if there is one. + if( result.hasExpression() ) { + m_xml.startElement( "Expression" ) + .writeAttribute( "success", result.succeeded() ) + .writeAttribute( "type", result.getTestMacroName() ); + + writeSourceInfo( result.getSourceInfo() ); + + m_xml.scopedElement( "Original" ) + .writeText( result.getExpression() ); + m_xml.scopedElement( "Expanded" ) + .writeText( result.getExpandedExpression() ); + } + + // And... Print a result applicable to each result type. + switch( result.getResultType() ) { + case ResultWas::ThrewException: + m_xml.startElement( "Exception" ); + writeSourceInfo( result.getSourceInfo() ); + m_xml.writeText( result.getMessage() ); + m_xml.endElement(); + break; + case ResultWas::FatalErrorCondition: + m_xml.startElement( "FatalErrorCondition" ); + writeSourceInfo( result.getSourceInfo() ); + m_xml.writeText( result.getMessage() ); + m_xml.endElement(); + break; + case ResultWas::Info: + m_xml.scopedElement( "Info" ) + .writeText( result.getMessage() ); + break; + case ResultWas::Warning: + // Warning will already have been written + break; + case ResultWas::ExplicitFailure: + m_xml.startElement( "Failure" ); + writeSourceInfo( result.getSourceInfo() ); + m_xml.writeText( result.getMessage() ); + m_xml.endElement(); + break; + default: + break; + } + + if( result.hasExpression() ) + m_xml.endElement(); + + return true; + } + + void XmlReporter::sectionEnded( SectionStats const& sectionStats ) { + StreamingReporterBase::sectionEnded( sectionStats ); + if( --m_sectionDepth > 0 ) { + XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResults" ); + e.writeAttribute( "successes", sectionStats.assertions.passed ); + e.writeAttribute( "failures", sectionStats.assertions.failed ); + e.writeAttribute( "expectedFailures", sectionStats.assertions.failedButOk ); + + if ( m_config->showDurations() == ShowDurations::Always ) + e.writeAttribute( "durationInSeconds", sectionStats.durationInSeconds ); + + m_xml.endElement(); + } + } + + void XmlReporter::testCaseEnded( TestCaseStats const& testCaseStats ) { + StreamingReporterBase::testCaseEnded( testCaseStats ); + XmlWriter::ScopedElement e = m_xml.scopedElement( "OverallResult" ); + e.writeAttribute( "success", testCaseStats.totals.assertions.allOk() ); + + if ( m_config->showDurations() == ShowDurations::Always ) + e.writeAttribute( "durationInSeconds", m_testCaseTimer.getElapsedSeconds() ); + + if( !testCaseStats.stdOut.empty() ) + m_xml.scopedElement( "StdOut" ).writeText( trim( testCaseStats.stdOut ), false ); + if( !testCaseStats.stdErr.empty() ) + m_xml.scopedElement( "StdErr" ).writeText( trim( testCaseStats.stdErr ), false ); + + m_xml.endElement(); + } + + void XmlReporter::testGroupEnded( TestGroupStats const& testGroupStats ) { + StreamingReporterBase::testGroupEnded( testGroupStats ); + // TODO: Check testGroupStats.aborting and act accordingly. + m_xml.scopedElement( "OverallResults" ) + .writeAttribute( "successes", testGroupStats.totals.assertions.passed ) + .writeAttribute( "failures", testGroupStats.totals.assertions.failed ) + .writeAttribute( "expectedFailures", testGroupStats.totals.assertions.failedButOk ); + m_xml.endElement(); + } + + void XmlReporter::testRunEnded( TestRunStats const& testRunStats ) { + StreamingReporterBase::testRunEnded( testRunStats ); + m_xml.scopedElement( "OverallResults" ) + .writeAttribute( "successes", testRunStats.totals.assertions.passed ) + .writeAttribute( "failures", testRunStats.totals.assertions.failed ) + .writeAttribute( "expectedFailures", testRunStats.totals.assertions.failedButOk ); + m_xml.endElement(); + } + + CATCH_REGISTER_REPORTER( "xml", XmlReporter ) + +} // end namespace Catch + +#if defined(_MSC_VER) +#pragma warning(pop) +#endif +// end catch_reporter_xml.cpp + +namespace Catch { + LeakDetector leakDetector; +} + +#ifdef __clang__ +#pragma clang diagnostic pop +#endif + +// end catch_impl.hpp +#endif + +#ifdef CATCH_CONFIG_MAIN +// start catch_default_main.hpp + +#ifndef __OBJC__ + +#if defined(CATCH_CONFIG_WCHAR) && defined(WIN32) && defined(_UNICODE) && !defined(DO_NOT_USE_WMAIN) +// Standard C/C++ Win32 Unicode wmain entry point +extern "C" int wmain (int argc, wchar_t * argv[], wchar_t * []) { +#else +// Standard C/C++ main entry point +int main (int argc, char * argv[]) { +#endif + + return Catch::Session().run( argc, argv ); +} + +#else // __OBJC__ + +// Objective-C entry point +int main (int argc, char * const argv[]) { +#if !CATCH_ARC_ENABLED + NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; +#endif + + Catch::registerTestMethods(); + int result = Catch::Session().run( argc, (char**)argv ); + +#if !CATCH_ARC_ENABLED + [pool drain]; +#endif + + return result; +} + +#endif // __OBJC__ + +// end catch_default_main.hpp +#endif + +#if !defined(CATCH_CONFIG_IMPL_ONLY) + +#ifdef CLARA_CONFIG_MAIN_NOT_DEFINED +# undef CLARA_CONFIG_MAIN +#endif + +#if !defined(CATCH_CONFIG_DISABLE) +////// +// If this config identifier is defined then all CATCH macros are prefixed with CATCH_ +#ifdef CATCH_CONFIG_PREFIX_ALL + +#define CATCH_REQUIRE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__ ) +#define CATCH_REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ ) + +#define CATCH_REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_REQUIRE_THROWS", Catch::ResultDisposition::Normal, "", __VA_ARGS__ ) +#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr ) +#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr ) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr ) +#endif// CATCH_CONFIG_DISABLE_MATCHERS +#define CATCH_REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ ) + +#define CATCH_CHECK( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CATCH_CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ ) +#define CATCH_CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CATCH_CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CATCH_CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CATCH_CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CATCH_CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CATCH_CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ ) + +#define CATCH_CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CATCH_CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, "", __VA_ARGS__ ) +#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CATCH_CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr ) +#define CATCH_CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CATCH_CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CATCH_CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define CATCH_CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CATCH_CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) + +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg ) + +#define CATCH_REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CATCH_REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg ) +#endif // CATCH_CONFIG_DISABLE_MATCHERS + +#define CATCH_INFO( msg ) INTERNAL_CATCH_INFO( "CATCH_INFO", msg ) +#define CATCH_WARN( msg ) INTERNAL_CATCH_MSG( "CATCH_WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg ) +#define CATCH_CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), "CATCH_CAPTURE",__VA_ARGS__ ) + +#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) +#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#define CATCH_METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) +#define CATCH_REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ ) +#define CATCH_SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) +#define CATCH_DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ ) +#define CATCH_FAIL( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) +#define CATCH_FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "CATCH_FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CATCH_SUCCEED( ... ) INTERNAL_CATCH_MSG( "CATCH_SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) + +#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE() + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) +#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#else +#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) ) +#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) +#endif + +#if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE) +#define CATCH_STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__ , #__VA_ARGS__ ); CATCH_SUCCEED( #__VA_ARGS__ ) +#define CATCH_STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); CATCH_SUCCEED( #__VA_ARGS__ ) +#else +#define CATCH_STATIC_REQUIRE( ... ) CATCH_REQUIRE( __VA_ARGS__ ) +#define CATCH_STATIC_REQUIRE_FALSE( ... ) CATCH_REQUIRE_FALSE( __VA_ARGS__ ) +#endif + +// "BDD-style" convenience wrappers +#define CATCH_SCENARIO( ... ) CATCH_TEST_CASE( "Scenario: " __VA_ARGS__ ) +#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ ) +#define CATCH_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Given: " << desc ) +#define CATCH_AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And given: " << desc ) +#define CATCH_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " When: " << desc ) +#define CATCH_AND_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And when: " << desc ) +#define CATCH_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Then: " << desc ) +#define CATCH_AND_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And: " << desc ) + +// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required +#else + +#define REQUIRE( ... ) INTERNAL_CATCH_TEST( "REQUIRE", Catch::ResultDisposition::Normal, __VA_ARGS__ ) +#define REQUIRE_FALSE( ... ) INTERNAL_CATCH_TEST( "REQUIRE_FALSE", Catch::ResultDisposition::Normal | Catch::ResultDisposition::FalseTest, __VA_ARGS__ ) + +#define REQUIRE_THROWS( ... ) INTERNAL_CATCH_THROWS( "REQUIRE_THROWS", Catch::ResultDisposition::Normal, __VA_ARGS__ ) +#define REQUIRE_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "REQUIRE_THROWS_AS", exceptionType, Catch::ResultDisposition::Normal, expr ) +#define REQUIRE_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "REQUIRE_THROWS_WITH", Catch::ResultDisposition::Normal, matcher, expr ) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "REQUIRE_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::Normal, matcher, expr ) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define REQUIRE_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "REQUIRE_NOTHROW", Catch::ResultDisposition::Normal, __VA_ARGS__ ) + +#define CHECK( ... ) INTERNAL_CATCH_TEST( "CHECK", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CHECK_FALSE( ... ) INTERNAL_CATCH_TEST( "CHECK_FALSE", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::FalseTest, __VA_ARGS__ ) +#define CHECKED_IF( ... ) INTERNAL_CATCH_IF( "CHECKED_IF", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CHECKED_ELSE( ... ) INTERNAL_CATCH_ELSE( "CHECKED_ELSE", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CHECK_NOFAIL( ... ) INTERNAL_CATCH_TEST( "CHECK_NOFAIL", Catch::ResultDisposition::ContinueOnFailure | Catch::ResultDisposition::SuppressFail, __VA_ARGS__ ) + +#define CHECK_THROWS( ... ) INTERNAL_CATCH_THROWS( "CHECK_THROWS", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define CHECK_THROWS_AS( expr, exceptionType ) INTERNAL_CATCH_THROWS_AS( "CHECK_THROWS_AS", exceptionType, Catch::ResultDisposition::ContinueOnFailure, expr ) +#define CHECK_THROWS_WITH( expr, matcher ) INTERNAL_CATCH_THROWS_STR_MATCHES( "CHECK_THROWS_WITH", Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) INTERNAL_CATCH_THROWS_MATCHES( "CHECK_THROWS_MATCHES", exceptionType, Catch::ResultDisposition::ContinueOnFailure, matcher, expr ) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define CHECK_NOTHROW( ... ) INTERNAL_CATCH_NO_THROW( "CHECK_NOTHROW", Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) + +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CHECK_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "CHECK_THAT", matcher, Catch::ResultDisposition::ContinueOnFailure, arg ) + +#define REQUIRE_THAT( arg, matcher ) INTERNAL_CHECK_THAT( "REQUIRE_THAT", matcher, Catch::ResultDisposition::Normal, arg ) +#endif // CATCH_CONFIG_DISABLE_MATCHERS + +#define INFO( msg ) INTERNAL_CATCH_INFO( "INFO", msg ) +#define WARN( msg ) INTERNAL_CATCH_MSG( "WARN", Catch::ResultWas::Warning, Catch::ResultDisposition::ContinueOnFailure, msg ) +#define CAPTURE( ... ) INTERNAL_CATCH_CAPTURE( INTERNAL_CATCH_UNIQUE_NAME(capturer), "CAPTURE",__VA_ARGS__ ) + +#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE( __VA_ARGS__ ) +#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#define METHOD_AS_TEST_CASE( method, ... ) INTERNAL_CATCH_METHOD_AS_TEST_CASE( method, __VA_ARGS__ ) +#define REGISTER_TEST_CASE( Function, ... ) INTERNAL_CATCH_REGISTER_TESTCASE( Function, __VA_ARGS__ ) +#define SECTION( ... ) INTERNAL_CATCH_SECTION( __VA_ARGS__ ) +#define DYNAMIC_SECTION( ... ) INTERNAL_CATCH_DYNAMIC_SECTION( __VA_ARGS__ ) +#define FAIL( ... ) INTERNAL_CATCH_MSG( "FAIL", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::Normal, __VA_ARGS__ ) +#define FAIL_CHECK( ... ) INTERNAL_CATCH_MSG( "FAIL_CHECK", Catch::ResultWas::ExplicitFailure, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define SUCCEED( ... ) INTERNAL_CATCH_MSG( "SUCCEED", Catch::ResultWas::Ok, Catch::ResultDisposition::ContinueOnFailure, __VA_ARGS__ ) +#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE() + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) +#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) +#else +#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE( __VA_ARGS__ ) ) +#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD( className, __VA_ARGS__ ) ) +#endif + +#if !defined(CATCH_CONFIG_RUNTIME_STATIC_REQUIRE) +#define STATIC_REQUIRE( ... ) static_assert( __VA_ARGS__, #__VA_ARGS__ ); SUCCEED( #__VA_ARGS__ ) +#define STATIC_REQUIRE_FALSE( ... ) static_assert( !(__VA_ARGS__), "!(" #__VA_ARGS__ ")" ); SUCCEED( "!(" #__VA_ARGS__ ")" ) +#else +#define STATIC_REQUIRE( ... ) REQUIRE( __VA_ARGS__ ) +#define STATIC_REQUIRE_FALSE( ... ) REQUIRE_FALSE( __VA_ARGS__ ) +#endif + +#endif + +#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION( signature ) + +// "BDD-style" convenience wrappers +#define SCENARIO( ... ) TEST_CASE( "Scenario: " __VA_ARGS__ ) +#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TEST_CASE_METHOD( className, "Scenario: " __VA_ARGS__ ) + +#define GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Given: " << desc ) +#define AND_GIVEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( "And given: " << desc ) +#define WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " When: " << desc ) +#define AND_WHEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And when: " << desc ) +#define THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " Then: " << desc ) +#define AND_THEN( desc ) INTERNAL_CATCH_DYNAMIC_SECTION( " And: " << desc ) + +using Catch::Detail::Approx; + +#else // CATCH_CONFIG_DISABLE + +////// +// If this config identifier is defined then all CATCH macros are prefixed with CATCH_ +#ifdef CATCH_CONFIG_PREFIX_ALL + +#define CATCH_REQUIRE( ... ) (void)(0) +#define CATCH_REQUIRE_FALSE( ... ) (void)(0) + +#define CATCH_REQUIRE_THROWS( ... ) (void)(0) +#define CATCH_REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0) +#define CATCH_REQUIRE_THROWS_WITH( expr, matcher ) (void)(0) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) +#endif// CATCH_CONFIG_DISABLE_MATCHERS +#define CATCH_REQUIRE_NOTHROW( ... ) (void)(0) + +#define CATCH_CHECK( ... ) (void)(0) +#define CATCH_CHECK_FALSE( ... ) (void)(0) +#define CATCH_CHECKED_IF( ... ) if (__VA_ARGS__) +#define CATCH_CHECKED_ELSE( ... ) if (!(__VA_ARGS__)) +#define CATCH_CHECK_NOFAIL( ... ) (void)(0) + +#define CATCH_CHECK_THROWS( ... ) (void)(0) +#define CATCH_CHECK_THROWS_AS( expr, exceptionType ) (void)(0) +#define CATCH_CHECK_THROWS_WITH( expr, matcher ) (void)(0) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define CATCH_CHECK_NOTHROW( ... ) (void)(0) + +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CATCH_CHECK_THAT( arg, matcher ) (void)(0) + +#define CATCH_REQUIRE_THAT( arg, matcher ) (void)(0) +#endif // CATCH_CONFIG_DISABLE_MATCHERS + +#define CATCH_INFO( msg ) (void)(0) +#define CATCH_WARN( msg ) (void)(0) +#define CATCH_CAPTURE( msg ) (void)(0) + +#define CATCH_TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) +#define CATCH_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) +#define CATCH_METHOD_AS_TEST_CASE( method, ... ) +#define CATCH_REGISTER_TEST_CASE( Function, ... ) (void)(0) +#define CATCH_SECTION( ... ) +#define CATCH_DYNAMIC_SECTION( ... ) +#define CATCH_FAIL( ... ) (void)(0) +#define CATCH_FAIL_CHECK( ... ) (void)(0) +#define CATCH_SUCCEED( ... ) (void)(0) + +#define CATCH_ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) ) +#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className ) +#else +#define CATCH_TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) ) ) +#define CATCH_TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className ) ) +#endif + +// "BDD-style" convenience wrappers +#define CATCH_SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) +#define CATCH_SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className ) +#define CATCH_GIVEN( desc ) +#define CATCH_AND_GIVEN( desc ) +#define CATCH_WHEN( desc ) +#define CATCH_AND_WHEN( desc ) +#define CATCH_THEN( desc ) +#define CATCH_AND_THEN( desc ) + +#define CATCH_STATIC_REQUIRE( ... ) (void)(0) +#define CATCH_STATIC_REQUIRE_FALSE( ... ) (void)(0) + +// If CATCH_CONFIG_PREFIX_ALL is not defined then the CATCH_ prefix is not required +#else + +#define REQUIRE( ... ) (void)(0) +#define REQUIRE_FALSE( ... ) (void)(0) + +#define REQUIRE_THROWS( ... ) (void)(0) +#define REQUIRE_THROWS_AS( expr, exceptionType ) (void)(0) +#define REQUIRE_THROWS_WITH( expr, matcher ) (void)(0) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define REQUIRE_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define REQUIRE_NOTHROW( ... ) (void)(0) + +#define CHECK( ... ) (void)(0) +#define CHECK_FALSE( ... ) (void)(0) +#define CHECKED_IF( ... ) if (__VA_ARGS__) +#define CHECKED_ELSE( ... ) if (!(__VA_ARGS__)) +#define CHECK_NOFAIL( ... ) (void)(0) + +#define CHECK_THROWS( ... ) (void)(0) +#define CHECK_THROWS_AS( expr, exceptionType ) (void)(0) +#define CHECK_THROWS_WITH( expr, matcher ) (void)(0) +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CHECK_THROWS_MATCHES( expr, exceptionType, matcher ) (void)(0) +#endif // CATCH_CONFIG_DISABLE_MATCHERS +#define CHECK_NOTHROW( ... ) (void)(0) + +#if !defined(CATCH_CONFIG_DISABLE_MATCHERS) +#define CHECK_THAT( arg, matcher ) (void)(0) + +#define REQUIRE_THAT( arg, matcher ) (void)(0) +#endif // CATCH_CONFIG_DISABLE_MATCHERS + +#define INFO( msg ) (void)(0) +#define WARN( msg ) (void)(0) +#define CAPTURE( msg ) (void)(0) + +#define TEST_CASE( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) +#define TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) +#define METHOD_AS_TEST_CASE( method, ... ) +#define REGISTER_TEST_CASE( Function, ... ) (void)(0) +#define SECTION( ... ) +#define DYNAMIC_SECTION( ... ) +#define FAIL( ... ) (void)(0) +#define FAIL_CHECK( ... ) (void)(0) +#define SUCCEED( ... ) (void)(0) +#define ANON_TEST_CASE() INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ )) + +#ifndef CATCH_CONFIG_TRADITIONAL_MSVC_PREPROCESSOR +#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) ) +#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className ) +#else +#define TEMPLATE_TEST_CASE( ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ) ) ) +#define TEMPLATE_TEST_CASE_METHOD( className, ... ) INTERNAL_CATCH_EXPAND_VARGS( INTERNAL_CATCH_TEMPLATE_TEST_CASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_M_P_L_A_T_E____T_E_S_T____ ), className ) ) +#endif + +#define STATIC_REQUIRE( ... ) (void)(0) +#define STATIC_REQUIRE_FALSE( ... ) (void)(0) + +#endif + +#define CATCH_TRANSLATE_EXCEPTION( signature ) INTERNAL_CATCH_TRANSLATE_EXCEPTION_NO_REG( INTERNAL_CATCH_UNIQUE_NAME( catch_internal_ExceptionTranslator ), signature ) + +// "BDD-style" convenience wrappers +#define SCENARIO( ... ) INTERNAL_CATCH_TESTCASE_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ) ) +#define SCENARIO_METHOD( className, ... ) INTERNAL_CATCH_TESTCASE_METHOD_NO_REGISTRATION(INTERNAL_CATCH_UNIQUE_NAME( ____C_A_T_C_H____T_E_S_T____ ), className ) + +#define GIVEN( desc ) +#define AND_GIVEN( desc ) +#define WHEN( desc ) +#define AND_WHEN( desc ) +#define THEN( desc ) +#define AND_THEN( desc ) + +using Catch::Detail::Approx; + +#endif + +#endif // ! CATCH_CONFIG_IMPL_ONLY + +// start catch_reenable_warnings.h + + +#ifdef __clang__ +# ifdef __ICC // icpc defines the __clang__ macro +# pragma warning(pop) +# else +# pragma clang diagnostic pop +# endif +#elif defined __GNUC__ +# pragma GCC diagnostic pop +#endif + +// end catch_reenable_warnings.h +// end catch.hpp +#endif // TWOBLUECUBES_SINGLE_INCLUDE_CATCH_HPP_INCLUDED + diff --git a/cmake/example/05-unit-testing/catch2-vendored/CMakeLists.txt b/cmake/example/05-unit-testing/catch2-vendored/CMakeLists.txt new file mode 100644 index 0000000..566ce62 --- /dev/null +++ b/cmake/example/05-unit-testing/catch2-vendored/CMakeLists.txt @@ -0,0 +1,33 @@ +cmake_minimum_required(VERSION 3.5) + +# Set the project name +project (catch2_unit_test) + + +set(CMAKE_CXX_STANDARD 11) + +# add the CMakeFile that defines catch2 +add_subdirectory(3rd_party/catch2) + +# Add an library for the example classes +add_library(example_unit_test + Reverse.cpp + Palindrome.cpp +) + + +############################################# +# Unit tests + +# enable CTest testing +enable_testing() + +# Add a testing executable +add_executable(unit_tests unit_tests.cpp) + +target_link_libraries(unit_tests + example_unit_test + Catch2::Test +) + +add_test(test_all unit_tests) diff --git a/cmake/example/05-unit-testing/catch2-vendored/Palindrome.cpp b/cmake/example/05-unit-testing/catch2-vendored/Palindrome.cpp new file mode 100644 index 0000000..7276aec --- /dev/null +++ b/cmake/example/05-unit-testing/catch2-vendored/Palindrome.cpp @@ -0,0 +1,11 @@ +#include "Palindrome.h" + +bool Palindrome::isPalindrome(const std::string& toCheck) +{ + + if (toCheck == std::string(toCheck.rbegin(), toCheck.rend())) { + return true; + } + + return false; +} diff --git a/cmake/example/05-unit-testing/catch2-vendored/Palindrome.h b/cmake/example/05-unit-testing/catch2-vendored/Palindrome.h new file mode 100644 index 0000000..3990017 --- /dev/null +++ b/cmake/example/05-unit-testing/catch2-vendored/Palindrome.h @@ -0,0 +1,15 @@ +#ifndef __PALINDROME_H__ +#define __PALINDROME_H__ + +#include + +/** + * Trivial class to check if a string is a palindrome. + */ +class Palindrome +{ +public: + bool isPalindrome(const std::string& toCheck); +}; + +#endif diff --git a/cmake/example/05-unit-testing/catch2-vendored/README.adoc b/cmake/example/05-unit-testing/catch2-vendored/README.adoc new file mode 100644 index 0000000..f32cada --- /dev/null +++ b/cmake/example/05-unit-testing/catch2-vendored/README.adoc @@ -0,0 +1,180 @@ += Catch2 Unit Testing Framework +:toc: +:toc-placement!: + +toc::[] + + +# Introduction + +Using link:https://cmake.org/Wiki/CMake/Testing_With_CTest[CTest] you can generate +a `make test` target to run automated unit-tests. This example shows how to +find the https://github.com/catchorg/Catch2[catch2 framework], +create tests and run them. + +The files in this tutorial are below: + +``` +$ tree +. +├── 3rd_party +│   └── catch2 +│   ├── catch2 +│   │   └── catch.hpp +│   └── CMakeLists.txt +├── CMakeLists.txt +├── Reverse.h +├── Reverse.cpp +├── Palindrome.h +├── Palindrome.cpp +├── unit_tests.cpp +``` + + * link:3rd_party/catch2/catch2/catch.hpp[] - Vendored copy of the https://github.com/catchorg/Catch2/blob/v2.5.0/single_include/catch2/catch.hpp[single header version of catch2] + * link:3rd_party/catch2/CMakeLists.txt[] - CMake file to make Catch2 available as a library + * link:CMakeLists.txt[] - Contains the CMake commands you wish to run + * link:Reverse.h[] / link:Reverse.cpp[.cpp] - Class to reverse a string + * link:Palindrome.h[] / link:Palindrome.cpp[.cpp] - Class to test if a string is a palindrome + * link:unit_test.cpp[] - Unit Tests using catch2 unit test framework + +# Requirements + +A C++11 compatible compiler + +# Concepts + +## Vendoring catch2 + +As catch2 is available as a single header file I have downloaded it and checked it into my repository. This mean +that I don't have any external dependencies when building my project. This is one of the +https://github.com/catchorg/Catch2/blob/master/docs/tutorial.md#getting-catch2[simplest] ways to use Catch2. + +## Catch2 Interface Library + +The CMakeLists in the catch2 directory creates an `INTERFACE` library and `ALIAS` library to make it +easy to add Catch2 to your executable. + +[source,cmake] +---- +add_library(Catch2 INTERFACE) +add_library(Catch2::Test ALIAS Catch2) +target_include_directories(Catch2 INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) +---- + +## Build with C++11 + +As Catch2 requires C++11 to build, I have used the `CMAKE_CXX_STANDARD` to set C++11. As described +in earlier examples you can use other methods to set this standard. + +## Enabling testing + +To enable testing you must include the following line in your top level CMakeLists.txt + +[source,cmake] +---- +enable_testing() +---- + +This will enable testing for the current folder and all folders below it. + +## Adding a testing executable + +The requirement for this step will depend on your unit-test framework. In the example +of catch2, you can create binary(s) which includes all the unit tests that you want to run. + +[source,cmake] +---- +add_executable(unit_tests unit_tests.cpp) + +target_link_libraries(unit_tests + example_unit_test + Catch2::Test +) +---- + +In the above code, a unit test binary is added, which links against the catch2 `ALIAS` target created earlier. + +## Add A test + +To add a test you call the link:https://cmake.org/cmake/help/v3.0/command/add_test.html[`add_test()`] function. +This will create a named test which will run the supplied command. + +[source,cmake] +---- +add_test(test_all unit_tests) +---- + +In this example, we create a test called `test_all` which will run the executable +created by the `unit_tests` executable created from the call to `add_executable` + +# Building the Example + +[source,bash] +---- +$ mkdir build + +$ cd build/ + +$ cmake .. +-- The C compiler identification is GNU 5.4.0 +-- The CXX compiler identification is GNU 5.4.0 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Detecting C compile features +-- Detecting C compile features - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Detecting CXX compile features +-- Detecting CXX compile features - done +-- Configuring done +-- Generating done +-- Build files have been written to: /data/code/cmake-examples/05-unit-testing/catch2-vendored/build + + +$ make +Scanning dependencies of target example_unit_test +[ 20%] Building CXX object CMakeFiles/example_unit_test.dir/Reverse.cpp.o +[ 40%] Building CXX object CMakeFiles/example_unit_test.dir/Palindrome.cpp.o +[ 60%] Linking CXX static library libexample_unit_test.a +[ 60%] Built target example_unit_test +Scanning dependencies of target unit_tests +[ 80%] Building CXX object CMakeFiles/unit_tests.dir/unit_tests.cpp.o +[100%] Linking CXX executable unit_tests +[100%] Built target unit_tests + + +$ make test +Running tests... +Test project /data/code/cmake-examples/05-unit-testing/catch2-vendored/build + Start 1: test_all +1/1 Test #1: test_all ......................... Passed 0.00 sec + +100% tests passed, 0 tests failed out of 1 + +Total Test time (real) = 0.00 sec +---- + +If the code is changed and it causes the unit tests to produce an error. +Then when running the tests you will see the following output. + +[source,bash] +---- +Running tests... +Test project /data/code/cmake-examples/05-unit-testing/catch2-vendored/build + Start 1: test_all +1/1 Test #1: test_all .........................***Failed 0.00 sec + +0% tests passed, 1 tests failed out of 1 + +Total Test time (real) = 0.00 sec + +The following tests FAILED: + 1 - test_all (Failed) +Errors while running CTest +Makefile:61: recipe for target 'test' failed +make: *** [test] Error 8 +---- diff --git a/cmake/example/05-unit-testing/catch2-vendored/Reverse.cpp b/cmake/example/05-unit-testing/catch2-vendored/Reverse.cpp new file mode 100644 index 0000000..135757a --- /dev/null +++ b/cmake/example/05-unit-testing/catch2-vendored/Reverse.cpp @@ -0,0 +1,12 @@ +#include "Reverse.h" + +std::string Reverse::reverse(std::string& toReverse) +{ + std::string ret; + + for(std::string::reverse_iterator rit=toReverse.rbegin(); rit!=toReverse.rend(); ++rit) + { + ret.insert(ret.end(), *rit); + } + return ret; +} diff --git a/cmake/example/05-unit-testing/catch2-vendored/Reverse.h b/cmake/example/05-unit-testing/catch2-vendored/Reverse.h new file mode 100644 index 0000000..b06d5f2 --- /dev/null +++ b/cmake/example/05-unit-testing/catch2-vendored/Reverse.h @@ -0,0 +1,15 @@ +#ifndef __REVERSE_H__ +#define __REVERSE_H__ + +#include + +/** + * Trivial class whose only function is to reverse a string. + * Should use std::reverse instead but want to have example with own class + */ +class Reverse +{ +public: + std::string reverse(std::string& toReverse); +}; +#endif diff --git a/cmake/example/05-unit-testing/catch2-vendored/main.cpp b/cmake/example/05-unit-testing/catch2-vendored/main.cpp new file mode 100644 index 0000000..c7b58af --- /dev/null +++ b/cmake/example/05-unit-testing/catch2-vendored/main.cpp @@ -0,0 +1,24 @@ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + std::cout << "Hello Third Party Include!" << std::endl; + + // use a shared ptr + boost::shared_ptr isp(new int(4)); + + // trivial use of boost filesystem + boost::filesystem::path path = "/usr/share/cmake/modules"; + if(path.is_relative()) + { + std::cout << "Path is relative" << std::endl; + } + else + { + std::cout << "Path is not relative" << std::endl; + } + + return 0; +} diff --git a/cmake/example/05-unit-testing/catch2-vendored/post_test.sh b/cmake/example/05-unit-testing/catch2-vendored/post_test.sh new file mode 100755 index 0000000..982663b --- /dev/null +++ b/cmake/example/05-unit-testing/catch2-vendored/post_test.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +make test diff --git a/cmake/example/05-unit-testing/catch2-vendored/unit_tests.cpp b/cmake/example/05-unit-testing/catch2-vendored/unit_tests.cpp new file mode 100644 index 0000000..e26165e --- /dev/null +++ b/cmake/example/05-unit-testing/catch2-vendored/unit_tests.cpp @@ -0,0 +1,36 @@ +#include +#include "Reverse.h" +#include "Palindrome.h" + +#define CATCH_CONFIG_MAIN +#include "catch2/catch.hpp" + + +TEST_CASE( "simple" ) +{ + std::string toRev = "Hello"; + + Reverse rev; + std::string res = rev.reverse(toRev); + + REQUIRE( res == "olleH" ); +} + +TEST_CASE( "empty" ) +{ + std::string toRev; + + Reverse rev; + std::string res = rev.reverse(toRev); + + REQUIRE( res == "" ); +} + +TEST_CASE( "is_palindrome" ) +{ + std::string pal = "mom"; + Palindrome pally; + + REQUIRE( pally.isPalindrome(pal) == true ); + +} diff --git a/cmake/example/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt b/cmake/example/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt new file mode 100644 index 0000000..d2a1fb1 --- /dev/null +++ b/cmake/example/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt @@ -0,0 +1,68 @@ +# Download and unpack googletest at configure time +# See: http://crascit.com/2015/07/25/cmake-gtest/ +configure_file(CMakeLists.txt.in googletest-download/CMakeLists.txt) +# Call CMake to download and Google Test +execute_process(COMMAND ${CMAKE_COMMAND} -G "${CMAKE_GENERATOR}" . + RESULT_VARIABLE result + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download ) +if(result) + message(FATAL_ERROR "CMake step for googletest failed: ${result}") +endif() +# Build the downloaded google test +execute_process(COMMAND ${CMAKE_COMMAND} --build . + RESULT_VARIABLE result + WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/googletest-download ) +if(result) + message(FATAL_ERROR "Build step for googletest failed: ${result}") +endif() + +# Prevent overriding the parent project's compiler/linker +# settings on Windows +set(gtest_force_shared_crt ON CACHE BOOL "" FORCE) +# Prevent installation of GTest with your project +set(INSTALL_GTEST OFF CACHE BOOL "" FORCE) +set(INSTALL_GMOCK OFF CACHE BOOL "" FORCE) + +# Add googletest directly to our build. This defines +# the gtest and gtest_main targets. +add_subdirectory(${CMAKE_CURRENT_BINARY_DIR}/googletest-src + ${CMAKE_CURRENT_BINARY_DIR}/googletest-build) + +# This is a bit of a hack that can be used to get gtest libraries to build in C++11 if you aren't using CMAKE_CXX_STANDARD +# +#set(CXX11_FEATURES +# cxx_nullptr +# cxx_auto_type +# cxx_delegating_constructors +#) +#target_compile_features(gtest +# PRIVATE +# ${CXX11_FEATURES} +#) +# +#target_compile_features(gmock_main +# PRIVATE +# ${CXX11_FEATURES} +#) +# +#target_compile_features(gmock +# PRIVATE +# ${CXX11_FEATURES} +#) +# +#target_compile_features(gmock_main +# PRIVATE +# ${CXX11_FEATURES} +#) + +# Add aliases for GTest and GMock libraries +if(NOT TARGET GTest::GTest) + add_library(GTest::GTest ALIAS gtest) + add_library(GTest::Main ALIAS gtest_main) +endif() + +if(NOT TARGET GTest::GMock) + add_library(GMock::GMock ALIAS gmock) + add_library(GMock::Main ALIAS gmock_main) +endif() + diff --git a/cmake/example/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt.in b/cmake/example/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt.in new file mode 100644 index 0000000..05a5e39 --- /dev/null +++ b/cmake/example/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt.in @@ -0,0 +1,19 @@ +cmake_minimum_required(VERSION 3.0) + +project(googletest-download NONE) + +include(ExternalProject) + +# Version bfc0ffc8a698072c794ae7299db9cb6866f4c0bc happens to be master when I set this up. +# To prevent an issue with accidentally installing GTest / GMock with your project you should use a +# commit after 9469fb687d040b60c8749b7617fee4e77c7f6409 +# Note: This is after the release of v1.8 +ExternalProject_Add(googletest + URL https://github.com/google/googletest/archive/bfc0ffc8a698072c794ae7299db9cb6866f4c0bc.tar.gz + SOURCE_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-src" + BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/googletest-build" + CONFIGURE_COMMAND "" + BUILD_COMMAND "" + INSTALL_COMMAND "" + TEST_COMMAND "" +) diff --git a/cmake/example/05-unit-testing/google-test-download/CMakeLists.txt b/cmake/example/05-unit-testing/google-test-download/CMakeLists.txt new file mode 100644 index 0000000..f433b17 --- /dev/null +++ b/cmake/example/05-unit-testing/google-test-download/CMakeLists.txt @@ -0,0 +1,30 @@ +cmake_minimum_required(VERSION 3.5) + +# Set the project name +project (google_test_example) + +# Add an library for the example classes +add_library(example_google_test + Reverse.cpp + Palindrome.cpp +) + + +############################################# +# Unit tests + +add_subdirectory(3rd_party/google-test) + +# enable CTest testing +enable_testing() + +# Add a testing executable +add_executable(unit_tests unit_tests.cpp) + +target_link_libraries(unit_tests + example_google_test + GTest::GTest + GTest::Main +) + +add_test(test_all unit_tests) diff --git a/cmake/example/05-unit-testing/google-test-download/Palindrome.cpp b/cmake/example/05-unit-testing/google-test-download/Palindrome.cpp new file mode 100644 index 0000000..7276aec --- /dev/null +++ b/cmake/example/05-unit-testing/google-test-download/Palindrome.cpp @@ -0,0 +1,11 @@ +#include "Palindrome.h" + +bool Palindrome::isPalindrome(const std::string& toCheck) +{ + + if (toCheck == std::string(toCheck.rbegin(), toCheck.rend())) { + return true; + } + + return false; +} diff --git a/cmake/example/05-unit-testing/google-test-download/Palindrome.h b/cmake/example/05-unit-testing/google-test-download/Palindrome.h new file mode 100644 index 0000000..3990017 --- /dev/null +++ b/cmake/example/05-unit-testing/google-test-download/Palindrome.h @@ -0,0 +1,15 @@ +#ifndef __PALINDROME_H__ +#define __PALINDROME_H__ + +#include + +/** + * Trivial class to check if a string is a palindrome. + */ +class Palindrome +{ +public: + bool isPalindrome(const std::string& toCheck); +}; + +#endif diff --git a/cmake/example/05-unit-testing/google-test-download/README.adoc b/cmake/example/05-unit-testing/google-test-download/README.adoc new file mode 100644 index 0000000..20507f7 --- /dev/null +++ b/cmake/example/05-unit-testing/google-test-download/README.adoc @@ -0,0 +1,231 @@ += Google Test Unit Testing Framework +:toc: +:toc-placement!: + +toc::[] + + +# Introduction + +Using link:https://cmake.org/Wiki/CMake/Testing_With_CTest[CTest] you can generate +a `make test` target to run automated unit-tests. This example shows how to +download and build the link:https://github.com/google/googletest[google test] library, +create tests and run them. + +The files in this tutorial are below: + +``` +$ tree +. +├── 3rd_party +│   └── google-test +│   ├── CMakeLists.txt +│   └── CMakeLists.txt.in +├── CMakeLists.txt +├── Reverse.h +├── Reverse.cpp +├── Palindrome.h +├── Palindrome.cpp +├── unit_tests.cpp +``` + + * link:3rd_party/google-test/CMakeLists.txt[] - CMake commands to build and prepare the google test library + * link:3rd_party/google-test/CMakeLists.txt.in[] - Helper script to do the download of google test + * link:CMakeLists.txt[] - Contains the CMake commands you wish to run + * link:Reverse.h[] / link:Reverse.cpp[.cpp] - Class to reverse a string + * link:Palindrome.h[] / link:Palindrome.cpp[.cpp] - Class to test if a string is a palindrome + * link:unit_test.cpp[] - Unit Tests using google test unit test framework + +# Requirements + +An internet connection. This example will download the google test library the first time you run the CMake configure step. See the +link:https://github.com/google/googletest/blob/master/googletest/README.md[google test readme] and link:http://crascit.com/2015/07/25/cmake-gtest/[here] for details. + +# Concepts + +## Download and Build Google Test + +[source,cmake] +---- +add_subdirectory(3rd_party/google-test) +---- + +This will add the CMake files which download and build Google Test. This is the recommended way to add google test and there are +more details from link:https://github.com/google/googletest/blob/master/googletest/README.md[google test readme] and link:http://crascit.com/2015/07/25/cmake-gtest/[here] + +Alternatives to this method include: + + * Use something like `git submodule` to download the source to a folder in your tree and then do `add_subdirectory` + * Vendor the google test source code within your repository + * Build google test externally and link it using `find_package(GTest)` - Not recommended by the google test authors anymore + +## Enabling testing + +To enable testing you must include the following line in your top level CMakeLists.txt + +[source,cmake] +---- +enable_testing() +---- + +This will enable testing for the current folder and all folders below it. + +## Adding a testing executable + +The requirement for this step will depend on your unit-test framework. In the example +of google test, you can create binary(s) which includes all the unit tests that you want to run. + +[source,cmake] +---- +add_executable(unit_tests unit_tests.cpp) + +target_link_libraries(unit_tests + example_google_test + GTest::GTest + GTest::main +) +---- + +In the above code, a unit test binary is added, which links against the google test unit-test-framework using the +ALIAS target setup during the link:3rd_party/google-test/CMakeLists.txt[download and build] of GTest. + +## Add A test + +To add a test you call the link:https://cmake.org/cmake/help/v3.0/command/add_test.html[`add_test()`] function. +This will create a named test which will run the supplied command. + +[source,cmake] +---- +add_test(test_all unit_tests) +---- + +In this example, we create a test called `test_all` which will run the executable +created by the `unit_tests` executable created from the call to `add_executable` + +# Building the Example + +[source,bash] +---- +$ mkdir build + +$ cd build/ + +$ cmake .. +-- The C compiler identification is GNU 5.4.0 +-- The CXX compiler identification is GNU 5.4.0 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Detecting C compile features +-- Detecting C compile features - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Detecting CXX compile features +-- Detecting CXX compile features - done +-- Configuring done +-- Generating done +-- Build files have been written to: /data/data/code/cmake-examples/05-unit-testing/google-test-download/build/3rd_party/google-test/googletest-download +Scanning dependencies of target googletest +[ 11%] Creating directories for 'googletest' +[ 22%] Performing download step (download, verify and extract) for 'googletest' +-- downloading... + src='https://github.com/google/googletest/archive/bfc0ffc8a698072c794ae7299db9cb6866f4c0bc.tar.gz' + dst='/data/data/code/cmake-examples/05-unit-testing/google-test-download/build/3rd_party/google-test/googletest-download/googletest-prefix/src/bfc0ffc8a698072c794ae7299db9cb6866f4c0bc.tar.gz' + timeout='none' +-- downloading... done +-- verifying file... + file='/data/data/code/cmake-examples/05-unit-testing/google-test-download/build/3rd_party/google-test/googletest-download/googletest-prefix/src/bfc0ffc8a698072c794ae7299db9cb6866f4c0bc.tar.gz' +-- verifying file... warning: did not verify file - no URL_HASH specified? +-- extracting... + src='/data/code/cmake-examples/05-unit-testing/google-test-download/build/3rd_party/google-test/googletest-download/googletest-prefix/src/bfc0ffc8a698072c794ae7299db9cb6866f4c0bc.tar.gz' + dst='/data/code/cmake-examples/05-unit-testing/google-test-download/build/3rd_party/google-test/googletest-src' +-- extracting... [tar xfz] +-- extracting... [analysis] +-- extracting... [rename] +-- extracting... [clean up] +-- extracting... done +[ 33%] No patch step for 'googletest' +[ 44%] No update step for 'googletest' +[ 55%] No configure step for 'googletest' +[ 66%] No build step for 'googletest' +[ 77%] No install step for 'googletest' +[ 88%] No test step for 'googletest' +[100%] Completed 'googletest' +[100%] Built target googletest +-- Found PythonInterp: /usr/bin/python (found version "2.7.12") +-- Looking for pthread.h +-- Looking for pthread.h - found +-- Looking for pthread_create +-- Looking for pthread_create - not found +-- Check if compiler accepts -pthread +-- Check if compiler accepts -pthread - yes +-- Found Threads: TRUE +-- Configuring done +-- Generating done +-- Build files have been written to: /data/code/cmake-examples/05-unit-testing/google-test-download/build + +$ make +Scanning dependencies of target example_google_test +[ 6%] Building CXX object CMakeFiles/example_google_test.dir/Reverse.cpp.o +[ 12%] Building CXX object CMakeFiles/example_google_test.dir/Palindrome.cpp.o +[ 18%] Linking CXX static library libexample_google_test.a +[ 18%] Built target example_google_test +Scanning dependencies of target gtest +[ 25%] Building CXX object 3rd_party/google-test/googletest-build/googlemock/gtest/CMakeFiles/gtest.dir/src/gtest-all.cc.o +[ 31%] Linking CXX static library libgtest.a +[ 31%] Built target gtest +Scanning dependencies of target gtest_main +[ 37%] Building CXX object 3rd_party/google-test/googletest-build/googlemock/gtest/CMakeFiles/gtest_main.dir/src/gtest_main.cc.o +[ 43%] Linking CXX static library libgtest_main.a +[ 43%] Built target gtest_main +Scanning dependencies of target unit_tests +[ 50%] Building CXX object CMakeFiles/unit_tests.dir/unit_tests.cpp.o +[ 56%] Linking CXX executable unit_tests +[ 56%] Built target unit_tests +Scanning dependencies of target gmock_main +[ 62%] Building CXX object 3rd_party/google-test/googletest-build/googlemock/CMakeFiles/gmock_main.dir/__/googletest/src/gtest-all.cc.o +[ 68%] Building CXX object 3rd_party/google-test/googletest-build/googlemock/CMakeFiles/gmock_main.dir/src/gmock-all.cc.o +[ 75%] Building CXX object 3rd_party/google-test/googletest-build/googlemock/CMakeFiles/gmock_main.dir/src/gmock_main.cc.o +[ 81%] Linking CXX static library libgmock_main.a +[ 81%] Built target gmock_main +Scanning dependencies of target gmock +[ 87%] Building CXX object 3rd_party/google-test/googletest-build/googlemock/CMakeFiles/gmock.dir/__/googletest/src/gtest-all.cc.o +[ 93%] Building CXX object 3rd_party/google-test/googletest-build/googlemock/CMakeFiles/gmock.dir/src/gmock-all.cc.o +[100%] Linking CXX static library libgmock.a +[100%] Built target gmock + +$ make test +Running tests... +Test project /data/code/cmake-examples/05-unit-testing/google-test-download/build + Start 1: test_all +1/1 Test #1: test_all ......................... Passed 0.00 sec + +100% tests passed, 0 tests failed out of 1 + +Total Test time (real) = 0.00 sec +---- + +If the code is changed and it causes the unit tests to produce an error. +Then when running the tests you will see the following output. + +[source,bash] +---- +$ make test +Running tests... +Test project /data/code/cmake-examples/05-unit-testing/google-test-download/build + Start 1: test_all +1/1 Test #1: test_all .........................***Failed 0.00 sec + +0% tests passed, 1 tests failed out of 1 + +Total Test time (real) = 0.00 sec + +The following tests FAILED: + 1 - test_all (Failed) +Errors while running CTest +Makefile:72: recipe for target 'test' failed +make: *** [test] Error 8 +---- diff --git a/cmake/example/05-unit-testing/google-test-download/Reverse.cpp b/cmake/example/05-unit-testing/google-test-download/Reverse.cpp new file mode 100644 index 0000000..135757a --- /dev/null +++ b/cmake/example/05-unit-testing/google-test-download/Reverse.cpp @@ -0,0 +1,12 @@ +#include "Reverse.h" + +std::string Reverse::reverse(std::string& toReverse) +{ + std::string ret; + + for(std::string::reverse_iterator rit=toReverse.rbegin(); rit!=toReverse.rend(); ++rit) + { + ret.insert(ret.end(), *rit); + } + return ret; +} diff --git a/cmake/example/05-unit-testing/google-test-download/Reverse.h b/cmake/example/05-unit-testing/google-test-download/Reverse.h new file mode 100644 index 0000000..b06d5f2 --- /dev/null +++ b/cmake/example/05-unit-testing/google-test-download/Reverse.h @@ -0,0 +1,15 @@ +#ifndef __REVERSE_H__ +#define __REVERSE_H__ + +#include + +/** + * Trivial class whose only function is to reverse a string. + * Should use std::reverse instead but want to have example with own class + */ +class Reverse +{ +public: + std::string reverse(std::string& toReverse); +}; +#endif diff --git a/cmake/example/05-unit-testing/google-test-download/main.cpp b/cmake/example/05-unit-testing/google-test-download/main.cpp new file mode 100644 index 0000000..c7b58af --- /dev/null +++ b/cmake/example/05-unit-testing/google-test-download/main.cpp @@ -0,0 +1,24 @@ +#include +#include +#include + +int main(int argc, char *argv[]) +{ + std::cout << "Hello Third Party Include!" << std::endl; + + // use a shared ptr + boost::shared_ptr isp(new int(4)); + + // trivial use of boost filesystem + boost::filesystem::path path = "/usr/share/cmake/modules"; + if(path.is_relative()) + { + std::cout << "Path is relative" << std::endl; + } + else + { + std::cout << "Path is not relative" << std::endl; + } + + return 0; +} diff --git a/cmake/example/05-unit-testing/google-test-download/post_test.sh b/cmake/example/05-unit-testing/google-test-download/post_test.sh new file mode 100755 index 0000000..f89ce58 --- /dev/null +++ b/cmake/example/05-unit-testing/google-test-download/post_test.sh @@ -0,0 +1,6 @@ +#!/bin/bash + +echo "Disabled for now because of issue with libcurl and https" +exit 0 + +#make test diff --git a/cmake/example/05-unit-testing/google-test-download/run_test.sh b/cmake/example/05-unit-testing/google-test-download/run_test.sh new file mode 100755 index 0000000..adfa0a8 --- /dev/null +++ b/cmake/example/05-unit-testing/google-test-download/run_test.sh @@ -0,0 +1,4 @@ +#!/bin/bash + +echo "Disabled for now because of issue with libcurl and https" +exit 0 diff --git a/cmake/example/05-unit-testing/google-test-download/unit_tests.cpp b/cmake/example/05-unit-testing/google-test-download/unit_tests.cpp new file mode 100644 index 0000000..2593511 --- /dev/null +++ b/cmake/example/05-unit-testing/google-test-download/unit_tests.cpp @@ -0,0 +1,39 @@ +#include +#include "Reverse.h" +#include "Palindrome.h" + +#include + +class ReverseTests : public ::testing::Test +{ +}; + +TEST_F(ReverseTests, simple ) +{ + std::string toRev = "Hello"; + + Reverse rev; + std::string res = rev.reverse(toRev); + + EXPECT_EQ(res, "olleH" ); + +} + +TEST_F(ReverseTests, empty ) +{ + std::string toRev; + + Reverse rev; + std::string res = rev.reverse(toRev); + + EXPECT_EQ(res, "" ); +} + +TEST_F(ReverseTests, is_palindrome ) +{ + std::string pal = "mom"; + Palindrome pally; + + EXPECT_TRUE(pally.isPalindrome(pal)); + +} diff --git a/cmake/example/06-installer/README.adoc b/cmake/example/06-installer/README.adoc new file mode 100644 index 0000000..be39fc3 --- /dev/null +++ b/cmake/example/06-installer/README.adoc @@ -0,0 +1,15 @@ += Installers + +:toc: +:toc-placement!: + +toc::[] + +[[intro]] +Introduction +------------ + +CMake has the ability to create installers for multiple platforms using a program +called link:https://cmake.org/Wiki/CMake:CPackPackageGenerators[CPack]. +CPack includes the ability to create Linux RPM, deb and gzip distributions + of both binaries and source code. It also includes the ability to create NSIS files for Microsoft Windows. diff --git a/cmake/example/06-installer/deb/CMakeLists.txt b/cmake/example/06-installer/deb/CMakeLists.txt new file mode 100644 index 0000000..a42bf23 --- /dev/null +++ b/cmake/example/06-installer/deb/CMakeLists.txt @@ -0,0 +1,68 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmake_examples_deb) + +# set a project version +set (deb_example_VERSION_MAJOR 0) +set (deb_example_VERSION_MINOR 2) +set (deb_example_VERSION_PATCH 2) +set (deb_example_VERSION "${deb_example_VERSION_MAJOR}.${deb_example_VERSION_MINOR}.${deb_example_VERSION_PATCH}") + + +############################################################ +# Create a library +############################################################ + +#Generate the shared library from the library sources +add_library(cmake_examples_deb SHARED src/Hello.cpp) + +target_include_directories(cmake_examples_deb + PUBLIC + ${PROJECT_SOURCE_DIR}/include +) +############################################################ +# Create an executable +############################################################ + +# Add an executable with the above sources +add_executable(cmake_examples_deb_bin src/main.cpp) + +# link the new hello_library target with the hello_binary target +target_link_libraries( cmake_examples_deb_bin + PUBLIC + cmake_examples_deb +) + +############################################################ +# Install +############################################################ + +# Binaries +install (TARGETS cmake_examples_deb_bin + DESTINATION bin) + +# Library +# Note: may not work on windows +install (TARGETS cmake_examples_deb + LIBRARY DESTINATION lib) + +# Config +install (FILES cmake-examples.conf + DESTINATION etc) + +############################################################ +# Create DEB +############################################################ + +# Tell CPack to generate a .deb package +set(CPACK_GENERATOR "DEB") + +# Set a Package Maintainer. +# This is required +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Thom Troy") + +# Set a Package Version +set(CPACK_PACKAGE_VERSION ${deb_example_VERSION}) + +# Include CPack +include(CPack) diff --git a/cmake/example/06-installer/deb/README.adoc b/cmake/example/06-installer/deb/README.adoc new file mode 100644 index 0000000..f52e08f --- /dev/null +++ b/cmake/example/06-installer/deb/README.adoc @@ -0,0 +1,157 @@ += Creating deb files +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +This example shows how to generate a Linux installers using the link:https://www.debian.org/doc/manuals/debian-faq/ch-pkg_basics.en.html[deb] + format. + +The files in this tutorial are below: + +``` +$ tree +. +├── cmake-examples.conf +├── CMakeLists.txt +├── include +│   └── Hello.h +└── src + ├── Hello.cpp + └── main.cpp +``` + + * link:CMakeLists.txt[] - Contains the CMake commands you wish to run + * link:cmake-examples.conf[] - An example configuration file + * link:include/Hello.h[] - The header file to include + * link:src/Hello.cpp[] - A source file to compile + * link:src/main.cpp[] - The source file with main + +# Concepts + +## CPack Generator + +A CPack Generator can be used by a `make package` target to create an installer. + +In the case of Debian packages you can tell CMake to create a generator using the following: + +[source,cmake] +---- +set(CPACK_GENERATOR "DEB") +---- + +After setting various settings to describe the package you must then tell CMake to +include the CPack generator using + +[source,cmake] +---- +include(CPack) +---- + +Once included all files that would typically be installed using a `make install` target +can now be packaged into a Debian package. + +## Debian Package Settings + +Various settings for the package are exposed by CPack. In this example we set the +following: + +[source,cmake] +---- +# Set a Package Maintainer. +# This is required +set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Thom Troy") + +# Set a Package Version +set(CPACK_PACKAGE_VERSION ${deb_example_VERSION}) +---- + +Which sets the maintainer and version. More debian specific settings are specified below +or at link:https://cmake.org/Wiki/CMake:CPackPackageGenerators#Debian_Generator_specific_settings[the CPack Wiki] + +[cols=",",options="header",] +|======================================================================= +|Variable |Info +|CPACK_DEBIAN_PACKAGE_MAINTAINER |Maintainer information + +|CPACK_PACKAGE_DESCRIPTION_SUMMARY |Package short description + +|CPACK_PACKAGE_DESCRIPTION |Package description + +|CPACK_DEBIAN_PACKAGE_DEPENDS |For advanced users to add custom scripts. + +|CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA |The build directory you are currently in. + +|CPACK_DEBIAN_PACKAGE_SECTION |Package section (see link:http://packages.debian.org/stable/[here]) + +|CPACK_DEBIAN_PACKAGE_VERSION |Package version +|======================================================================= + +# Building the Example + +[source,bash] +---- +$ mkdir build + +$ cd build/ + +$ cmake .. +-- The C compiler identification is GNU 4.8.4 +-- The CXX compiler identification is GNU 4.8.4 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Configuring done +-- Generating done +-- Build files have been written to: /home/matrim/workspace/cmake-examples/06-installer/deb/build + +$ make help +The following are some of the valid targets for this Makefile: +... all (the default if no target is provided) +... clean +... depend +... cmake_examples_deb +... cmake_examples_deb_bin +... edit_cache +... install +... install/local +... install/strip +... list_install_components +... package +... package_source +... rebuild_cache +... src/Hello.o +... src/Hello.i +... src/Hello.s +... src/main.o +... src/main.i +... src/main.s + +$ make package +Scanning dependencies of target cmake_examples_deb +[ 50%] Building CXX object CMakeFiles/cmake_examples_deb.dir/src/Hello.cpp.o +Linking CXX shared library libcmake_examples_deb.so +[ 50%] Built target cmake_examples_deb +Scanning dependencies of target cmake_examples_deb_bin +[100%] Building CXX object CMakeFiles/cmake_examples_deb_bin.dir/src/main.cpp.o +Linking CXX executable cmake_examples_deb_bin +[100%] Built target cmake_examples_deb_bin +Run CPack packaging tool... +CPack: Create package using DEB +CPack: Install projects +CPack: - Run preinstall target for: cmake_examples_deb +CPack: - Install project: cmake_examples_deb +CPack: Create package +CPack: - package: /home/matrim/workspace/cmake-examples/06-installer/deb/build/cmake_examples_deb-0.2.2-Linux.deb generated. + +$ ls +CMakeCache.txt cmake_examples_deb-0.2.2-Linux.deb cmake_examples_deb_bin CMakeFiles cmake_install.cmake CPackConfig.cmake _CPack_Packages CPackSourceConfig.cmake install_manifest.txt libcmake_examples_deb.so Makefile + +---- diff --git a/cmake/example/06-installer/deb/cmake-examples.conf b/cmake/example/06-installer/deb/cmake-examples.conf new file mode 100644 index 0000000..d530261 --- /dev/null +++ b/cmake/example/06-installer/deb/cmake-examples.conf @@ -0,0 +1 @@ +# Sample configuration file that could be installed diff --git a/cmake/example/06-installer/deb/include/Hello.h b/cmake/example/06-installer/deb/include/Hello.h new file mode 100644 index 0000000..f838400 --- /dev/null +++ b/cmake/example/06-installer/deb/include/Hello.h @@ -0,0 +1,10 @@ +#ifndef __HELLO_H__ +#define __HELLO_H__ + +class Hello +{ +public: + void print(); +}; + +#endif diff --git a/cmake/example/06-installer/deb/post_test.sh b/cmake/example/06-installer/deb/post_test.sh new file mode 100755 index 0000000..7375673 --- /dev/null +++ b/cmake/example/06-installer/deb/post_test.sh @@ -0,0 +1,3 @@ +#!/bin/bash + +make package diff --git a/cmake/example/06-installer/deb/src/Hello.cpp b/cmake/example/06-installer/deb/src/Hello.cpp new file mode 100644 index 0000000..75c152d --- /dev/null +++ b/cmake/example/06-installer/deb/src/Hello.cpp @@ -0,0 +1,8 @@ +#include + +#include "Hello.h" + +void Hello::print() +{ + std::cout << "Hello Install!" << std::endl; +} diff --git a/cmake/example/06-installer/deb/src/main.cpp b/cmake/example/06-installer/deb/src/main.cpp new file mode 100644 index 0000000..62a1520 --- /dev/null +++ b/cmake/example/06-installer/deb/src/main.cpp @@ -0,0 +1,8 @@ +#include "Hello.h" + +int main(int argc, char *argv[]) +{ + Hello hi; + hi.print(); + return 0; +} \ No newline at end of file diff --git a/cmake/example/07-package-management/A-using-system-provide-packages/README.adoc b/cmake/example/07-package-management/A-using-system-provide-packages/README.adoc new file mode 100644 index 0000000..edee481 --- /dev/null +++ b/cmake/example/07-package-management/A-using-system-provide-packages/README.adoc @@ -0,0 +1,13 @@ += Using System Provided Package Manager +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +Using your system provided packages is one of the oldest and most common form of package management solutions. For this, you use your systems package installer (e.g. apt, yum) to install libraries and headers into common locations. CMake can then use the `find_package()` function to search for these and make them available to your program. + +# Examples + +I have already shown how to do this in the link:https://github.com/ttroy50/cmake-examples/tree/master/01-basic/H-third-party-library[third party library] example from the basic section and the link:https://github.com/ttroy50/cmake-examples/tree/master/05-unit-testing/boost[boost unit test] example. diff --git a/cmake/example/07-package-management/B-vendoring-code/README.adoc b/cmake/example/07-package-management/B-vendoring-code/README.adoc new file mode 100644 index 0000000..fc2024e --- /dev/null +++ b/cmake/example/07-package-management/B-vendoring-code/README.adoc @@ -0,0 +1,43 @@ += Vendoring Code +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +Vendoring code means to include the third party code inside your repository and build it as part of your project. It is a way to ensure that all files required to build your project are part of the development environment. + +# Implementation + +## Including 3rd Party Code + +Typically, this might take the form or a `3rd_party` or `vendor` directory, in which you copy the source of the libraries you want to include. For example, you may do something like: + +``` +$ tree +. +├── 3rd_party +│   └── catch2 +│   ├── catch2 +│   │   └── catch.hpp +│   └── CMakeLists.txt +├── CMakeLists.txt +├── src +│   └── example.cpp +``` + + +If these projects support CMake directly, it may be possible to do `add_subdirectory()` on the libraries folder and have that project build and be made available to your code. + +If the third party code doesn't support CMake, you may need to create a "shim" layer on top of the project to allow it to be build and discovered from CMake. + +## Using git to vendor code + +A slightly different method to include the third party code can be to use your SCM software to manage the process for you. + +In the case of git, you can use link:https://git-scm.com/book/en/v2/Git-Tools-Submodules[git sub-modules] or link:https://git-scm.com/book/en/v1/Git-Tools-Subtree-Merging[git subtree]. These can pull the correct version of the third party code into your repository on initialisation / update. + +# Examples + +A simple example of vendoring code can already be seen in the link:https://github.com/ttroy50/cmake-examples/tree/master/05-unit-testing/catch2-vendored[catch2] testing tutorial. diff --git a/cmake/example/07-package-management/C-external-project-add/README.adoc b/cmake/example/07-package-management/C-external-project-add/README.adoc new file mode 100644 index 0000000..250f9d7 --- /dev/null +++ b/cmake/example/07-package-management/C-external-project-add/README.adoc @@ -0,0 +1,40 @@ += External Project +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +CMake supports downloading and building an external project using the link:https://cmake.org/cmake/help/latest/module/ExternalProject.html[External Project] commands. By adding +ExternalProject_Add+ to your code you can have CMake automatically download a source file from either HTTP or a source control system (e.g. git). + +Once configured an external project will generate a custom target which can be used to control the download, update, build, test, and install phases of the external project. + +# Implementation + +## Standard + +A simple example of an external project is as follows: + +[source,cmake] +---- +include(ExternalProject) +ExternalProject_Add(googletest + URL https://github.com/google/googletest/archive/bfc0ffc8a698072c794ae7299db9cb6866f4c0bc.tar.gz_ +) +---- + +Once added you will have a target `googletest` which will attempt to download, build, and install google test when your build your project. + +[NOTE] +==== +This will attempt to install google test to your standard locations e.g. `/usr/` and may fail if you are not root. To skip the install step you can add a line `INSTALL_COMMAND ""` +==== + +By default the project is assumed to work via CMake and external project will know how to build using standard CMake commands. If the external project uses a different build system, you can set the various commands using +INSTALL_COMMAND+, +CONFIGURE_COMMAND+, +BUILD_COMMAND+, etc. + +## Alternative + +An alternative method to install packages is to have the ExternalProject command run at CMake configure time. This can cause the download to happen at the configure step and you may then use +add_subdirectory+ to add the project to your code (assuming it uses CMake). An example of this can be found in the link:https://github.com/ttroy50/cmake-examples/tree/master/05-unit-testing/google-test-download[google-test-download] tutorial. + +A more generic version of the download code can be found link:https://github.com/Crascit/DownloadProject[here]. \ No newline at end of file diff --git a/cmake/example/07-package-management/D-conan/README.adoc b/cmake/example/07-package-management/D-conan/README.adoc new file mode 100644 index 0000000..803cea5 --- /dev/null +++ b/cmake/example/07-package-management/D-conan/README.adoc @@ -0,0 +1,159 @@ += Conan +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +link:https://conan.io[Conan] is an open source, decentralized, and multi-platform package manager that can be used to create and share native libraries and binaries. It supports multiple build systems (CMake, Visual Studio, Makefiles) and OSes (Linux, Windows, and Mac). + +Conan servers can be installed privately or you can use public servers and packages made available by link:https://bintray.com/conan/conan-center[Jfrog bintray]. + +Full documentation for conan can be found from link:https://docs.conan.io/en/latest/[here] + +# Installing Conan + +Conan is a python application and can be installed using pip. + +[source,bash] +---- +$ sudo apt-get install python3 python3-pip +$ pip3 install conan +$ conan help +Consumer commands + install Installs the requirements specified in a recipe (conanfile.py or conanfile.txt). +... +---- + +Alternatively, native packages are available for most operating systems. Full details are available link:https://docs.conan.io/en/latest/installation.html[here]. + +# Conan Profile + +In conan link:https://docs.conan.io/en/latest/reference/profiles.html#profiles[profiles] control information such as the compiler and environments that are available on your system. + +To create a new default profile run + +[source,bash] +---- +$ conan profile new default --detect +Found gcc 5.4 +gcc>=5, using the major as version +Profile created with detected settings: /home/devuser/.conan/profiles/default +---- + +The generated profile will look something like: + +[source,bash] +---- +[settings] +os=Linux +os_build=Linux +arch=x86_64 +arch_build=x86_64 +compiler=gcc +compiler.version=5 +compiler.libcxx=libstdc++ +build_type=Release +[options] +[build_requires] +[env] +---- + + +[NOTE] +==== +If you are using GCC compiler >= 5.1, Conan will set the compiler.libcxx to the old ABI for backwards compatibility. You can change this with the following commands: + +[source,bash] +---- +$ conan profile update settings.compiler.libcxx=libstdc++11 default +---- + +[source,bash] +---- +[settings] +os=Linux +os_build=Linux +arch=x86_64 +arch_build=x86_64 +compiler=gcc +compiler.version=5 +compiler.libcxx=libstdc++11 +build_type=Release +[options] +[build_requires] +[env] +---- + +You can find more information about this link:https://docs.conan.io/en/latest/howtos/manage_gcc_abi.html#manage-gcc-abi[here]. +==== + +All examples provided will assume that the ABI being used for libstdc++ is the Cpp11 ABI. + +# Finding Packages + +Remote repositories can be searched for conan packages. By default the `conan-center` remote is configured. This is located in link:https://bintray.com/conan/conan-center[bintray]. + +## Searching for Packages + +You can search for packages using the `conan search` command. For example, to search for a package such as link:https://github.com/fmtlib/fmt[fmtlib] you can run: + +[source,bash] +---- +$ conan search fmt* --remote=conan-center +Existing package recipes: + +fmt/4.0.0@bincrafters/stable +fmt/4.1.0@bincrafters/stable +fmt/5.0.0@bincrafters/stable +fmt/5.1.0@bincrafters/stable +fmt/5.2.0@bincrafters/stable +fmt/5.2.1@bincrafters/stable +fmt/5.3.0@bincrafters/stable + +---- + +## Inspecting Packages + +You can then inspect a package using the `conan inspect` command. To inspect one one of the fmt packages from the search command above you can run: + +[source,bash] +---- +$ conan inspect fmt/5.3.0@bincrafters/stable --remote=conan-center +name: fmt +version: 5.3.0 +url: https://github.com/bincrafters/conan-fmt +homepage: https://github.com/fmtlib/fmt +license: MIT +author: Bincrafters +description: A safe and fast alternative to printf and IOStreams. +topics: None +generators: cmake +exports: ['LICENSE.md'] +exports_sources: ['CMakeLists.txt'] +short_paths: False +apply_env: True +build_policy: None +revision_mode: hash +settings: ('os', 'compiler', 'build_type', 'arch') +options: + fPIC: [True, False] + header_only: [True, False] + shared: [True, False] + with_fmt_alias: [True, False] +default_options: + fPIC: True + header_only: False + shared: False + with_fmt_alias: False +---- + +This shows details about the package including what link:https://docs.conan.io/en/latest/using_packages/conanfile_txt.html#options[options] can be set when including the package. In the case of fmtlib there are 4 options which allow you to specify the type of installion you want. + +# Examples + +The examples included are: + + - link:i-basic[Basic]. A basic example linking against one library. + - link:ii-basic-targets[Using Targets]. The basic example, except using modern CMake targets. diff --git a/cmake/example/07-package-management/D-conan/i-basic/CMakeLists.txt b/cmake/example/07-package-management/D-conan/i-basic/CMakeLists.txt new file mode 100644 index 0000000..5edd7ff --- /dev/null +++ b/cmake/example/07-package-management/D-conan/i-basic/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.5) +project (conan_third_party_include) + +set(CMAKE_CXX_STANDARD 11) + +# Included the conan build information +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() + +# Add an executable +add_executable(third_party_include main.cpp) + +# link against the fmt target supplied by conan +target_link_libraries(third_party_include + PRIVATE + ${CONAN_LIBS} +) \ No newline at end of file diff --git a/cmake/example/07-package-management/D-conan/i-basic/README.adoc b/cmake/example/07-package-management/D-conan/i-basic/README.adoc new file mode 100644 index 0000000..d7e6add --- /dev/null +++ b/cmake/example/07-package-management/D-conan/i-basic/README.adoc @@ -0,0 +1,213 @@ += Conan Basic Example +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +link:http://conan.io[Conan] supports downloading libraries and making them available to an application developers. Packages are defined in the link:https://docs.conan.io/en/latest/using_packages/conanfile_txt.html[+conanfile.txt+] file, which defines packages, options, and the link:https://docs.conan.io/en/latest/reference/generators.html#generators-reference[generators] for your project. + +The files in this tutorial are below: + +``` +. +├── CMakeLists.txt +├── conanfile.txt +├── main.cpp +└── README.adoc +``` + + * link:CMakeLists.txt[] - Contains the CMake commands to run + * link:conanfile.txt[] - Contains the conan dependencies and options + * link:main.cpp[] - Source file of the application. + +# Concepts + +## conanfile.txt + +### requires + +The conanfile.txt defines the required packages you wish to install + +[source,ini] +---- +[requires] +fmt/5.3.0@bincrafters/stable +---- + + +Where: + + * `fmt` is the name of the package / library. + * `5.3.0` is the version of the package. + * `bincrafters` is the owner / builder of the package. + * `stable` is channel of the package. Channels provide a to have different variants of packages. + +### generators + +Generators define the build systems that you are using and allows Conan to create files with all the information needed to find your libraries and link your program. + +[source,ini] +---- +[generators] +cmake +---- + +The CMake generator will create the file `conanbuildinfo.cmake` which should be included in your +CMakeLists.txt+ file. This will be a per-user file and should not be committed to your source control system. + +## Installing Packages + +To install packages you should run the following: + +[source,bash] +---- +$ mkdir build +$ cd build +$ conan install .. +---- + +This will tell conan to read the +conanfile.txt+ from your root folder and install any required package configurations. If the package is not available in your package cache it will be downloaded. + +As per our requires section, `conan install` will download a static library version of fmtlib along with all required headers. On my system with default configuration, this cached library is as follows: + +[source,bash] +---- +$ ls ~/.conan/data/fmt/5.3.0/bincrafters/stable/package/4d887c1c2779c63d2cdd81580698d2e22cb35b29/ +conaninfo.txt conanmanifest.txt include lib licenses share +$ ls ~/.conan/data/fmt/5.3.0/bincrafters/stable/package/4d887c1c2779c63d2cdd81580698d2e22cb35b29/lib +cmake libfmt.a +---- + +The install command will also create any temporary files such as the +conanbuildinfo.cmake+ file. + +## conanbuildinfo.cmake + +As mentioned the +conanbuildinfo.cmake+ file contains any CMake commands that are required to link against your installed libraries. You must include this file in your CMakeLists.txt as follows + +[source,cmake] +---- +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup() +---- + +The +CMAKE_BINARY_DIR+ here is the same build directory that your ran `conan install` in and will eventually run your `cmake` command in. + +Once included the variable +CONAN_LIBS+ is made available which contains the information you need to link against the libraries. + +[source,cmake] +---- +# link against the fmt target supplied by conan +target_link_libraries(third_party_include + PRIVATE + ${CONAN_LIBS} +) +---- + +# Building the Example + +[source,bash] +---- +$ mkdir build + +$ cd build/ + +$ conan install .. +Configuration: +[settings] +arch=x86_64 +arch_build=x86_64 +build_type=Release +compiler=gcc +compiler.libcxx=libstdc++11 +compiler.version=5 +os=Linux +os_build=Linux +[options] +[build_requires] +[env] + +fmt/5.3.0@bincrafters/stable: Not found in local cache, looking in remotes... +fmt/5.3.0@bincrafters/stable: Trying with 'conan-center'... +Downloading conanmanifest.txt +[==================================================] 166B/166B +Downloading conanfile.py +[==================================================] 2.9KB/2.9KB +Downloading conan_export.tgz +[==================================================] 758B/758B +Decompressing conan_export.tgz: 1.98kB [00:00, 504kB/s] +fmt/5.3.0@bincrafters/stable: Downloaded recipe revision 0 +conanfile.txt: Installing package +Requirements + fmt/5.3.0@bincrafters/stable from 'conan-center' - Downloaded +Packages + fmt/5.3.0@bincrafters/stable:4d887c1c2779c63d2cdd81580698d2e22cb35b29 - Download + +fmt/5.3.0@bincrafters/stable: Retrieving package 4d887c1c2779c63d2cdd81580698d2e22cb35b29 from remote 'conan-center' +Downloading conanmanifest.txt +[==================================================] 1.1KB/1.1KB +Downloading conaninfo.txt +[==================================================] 550B/550B +Downloading conan_package.tgz +[==================================================] 156.2KB/156.2KB +Decompressing conan_package.tgz: 161kB [00:00, 13.8MB/s] +fmt/5.3.0@bincrafters/stable: Package installed 4d887c1c2779c63d2cdd81580698d2e22cb35b29 +fmt/5.3.0@bincrafters/stable: Downloaded package revision 0 +conanfile.txt: Generator cmake created conanbuildinfo.cmake +conanfile.txt: Generator txt created conanbuildinfo.txt +conanfile.txt: Generated conaninfo.txt +conanfile.txt: Generated graphinfo + +$ cmake .. +-- The C compiler identification is GNU 5.4.0 +-- The CXX compiler identification is GNU 5.4.0 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Detecting C compile features +-- Detecting C compile features - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Detecting CXX compile features +-- Detecting CXX compile features - done +-- Conan: Adjusting output directories +-- Conan: Using cmake global configuration +-- Conan: Adjusting default RPATHs Conan policies +-- Conan: Adjusting language standard +-- Current conanbuildinfo.cmake directory: /home/devuser/ws/build +-- Conan: Compiler GCC>=5, checking major version 5 +-- Conan: Checking correct version: 5 +-- Configuring done +-- Generating done +-- Build files have been written to: /home/devuser/ws/build + +$ make VERBOSE=1 +/usr/bin/cmake -H/home/devuser/ws -B/home/devuser/ws/build --check-build-system CMakeFiles/Makefile.cmake 0 +/usr/bin/cmake -E cmake_progress_start /home/devuser/ws/build/CMakeFiles /home/devuser/ws/build/CMakeFiles/progress.marks +make -f CMakeFiles/Makefile2 all +make[1]: Entering directory '/home/devuser/ws/build' +make -f CMakeFiles/third_party_include.dir/build.make CMakeFiles/third_party_include.dir/depend +make[2]: Entering directory '/home/devuser/ws/build' +cd /home/devuser/ws/build && /usr/bin/cmake -E cmake_depends "Unix Makefiles" /home/devuser/ws /home/devuser/ws /home/devuser/ws/build /home/devuser/ws/build /home/devuser/ws/build/CMakeFiles/third_party_include.dir/DependInfo.cmake --color= +Dependee "/home/devuser/ws/build/CMakeFiles/third_party_include.dir/DependInfo.cmake" is newer than depender "/home/devuser/ws/build/CMakeFiles/third_party_include.dir/depend.internal". +Dependee "/home/devuser/ws/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/home/devuser/ws/build/CMakeFiles/third_party_include.dir/depend.internal". +Scanning dependencies of target third_party_include +make[2]: Leaving directory '/home/devuser/ws/build' +make -f CMakeFiles/third_party_include.dir/build.make CMakeFiles/third_party_include.dir/build +make[2]: Entering directory '/home/devuser/ws/build' +[ 50%] Building CXX object CMakeFiles/third_party_include.dir/main.cpp.o +/usr/bin/c++ -I/home/devuser/.conan/data/fmt/5.3.0/bincrafters/stable/package/4d887c1c2779c63d2cdd81580698d2e22cb35b29/include -std=gnu++11 -o CMakeFiles/third_party_include.dir/main.cpp.o -c /home/devuser/ws/main.cpp +[100%] Linking CXX executable bin/third_party_include +/usr/bin/cmake -E cmake_link_script CMakeFiles/third_party_include.dir/link.txt --verbose=1 +/usr/bin/c++ CMakeFiles/third_party_include.dir/main.cpp.o -o bin/third_party_include -L/home/devuser/.conan/data/fmt/5.3.0/bincrafters/stable/package/4d887c1c2779c63d2cdd81580698d2e22cb35b29/lib -lfmt -Wl,-rpath,/home/devuser/.conan/data/fmt/5.3.0/bincrafters/stable/package/4d887c1c2779c63d2cdd81580698d2e22cb35b29/lib +make[2]: Leaving directory '/home/devuser/ws/build' +[100%] Built target third_party_include +make[1]: Leaving directory '/home/devuser/ws/build' +/usr/bin/cmake -E cmake_progress_start /home/devuser/ws/build/CMakeFiles 0 + +$ ./bin/third_party_include +Hello, conan. This is fmtlib! +---- diff --git a/cmake/example/07-package-management/D-conan/i-basic/conanfile.txt b/cmake/example/07-package-management/D-conan/i-basic/conanfile.txt new file mode 100644 index 0000000..1ff62aa --- /dev/null +++ b/cmake/example/07-package-management/D-conan/i-basic/conanfile.txt @@ -0,0 +1,5 @@ +[requires] +fmt/5.3.0@bincrafters/stable + +[generators] +cmake diff --git a/cmake/example/07-package-management/D-conan/i-basic/main.cpp b/cmake/example/07-package-management/D-conan/i-basic/main.cpp new file mode 100644 index 0000000..385a81a --- /dev/null +++ b/cmake/example/07-package-management/D-conan/i-basic/main.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + fmt::print("Hello, {}. This is {}!\n", "conan", "fmtlib"); + return 0; +} diff --git a/cmake/example/07-package-management/D-conan/i-basic/run_test.sh b/cmake/example/07-package-management/D-conan/i-basic/run_test.sh new file mode 100755 index 0000000..777acb2 --- /dev/null +++ b/cmake/example/07-package-management/D-conan/i-basic/run_test.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +conan_bin=`which conan` + +if [ -z $conan_bin ]; then + exit 0 +fi + +conan profile show default || { + conan profile new default --detect +} +conan profile update settings.compiler.libcxx=libstdc++11 default + +echo "correct version of cmake" +mkdir -p build && cd build && conan install .. && cmake .. && make +if [ $? -ne 0 ]; then + echo "Error running example" + exit 1 +fi diff --git a/cmake/example/07-package-management/D-conan/ii-basic-targets/CMakeLists.txt b/cmake/example/07-package-management/D-conan/ii-basic-targets/CMakeLists.txt new file mode 100644 index 0000000..d0b1326 --- /dev/null +++ b/cmake/example/07-package-management/D-conan/ii-basic-targets/CMakeLists.txt @@ -0,0 +1,17 @@ +cmake_minimum_required(VERSION 3.5) +project (conan_third_party_include) + +set(CMAKE_CXX_STANDARD 11) + +# Included the conan build information +include(${CMAKE_BINARY_DIR}/conanbuildinfo.cmake) +conan_basic_setup(TARGETS) + +# Add an executable +add_executable(third_party_include main.cpp) + +# link against the fmt target supplied by conan +target_link_libraries(third_party_include + PRIVATE + CONAN_PKG::fmt +) diff --git a/cmake/example/07-package-management/D-conan/ii-basic-targets/README.adoc b/cmake/example/07-package-management/D-conan/ii-basic-targets/README.adoc new file mode 100644 index 0000000..97517a6 --- /dev/null +++ b/cmake/example/07-package-management/D-conan/ii-basic-targets/README.adoc @@ -0,0 +1,170 @@ += Conan Basic Example +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +Modern CMake recommends to use a target based approach to including libraries. This example shows how to support this using +conan in an example that is functionally the same as the previous one. + +The files in this tutorial are below: + +``` +. +├── CMakeLists.txt +├── conanfile.txt +├── main.cpp +└── README.adoc +``` + + * link:CMakeLists.txt[] - Contains the CMake commands to run + * link:conanfile.txt[] - Contains the conan dependencies and options + * link:main.cpp[] - Source file of the application. + +# Concepts + +## Libraries Targets + +As described in the link:https://github.com/ttroy50/cmake-examples/tree/master/01-basic/H-third-party-library[third party library] example, CMake recommends to use +ALIAS+ targets for third party libraries. An example of +adding an imported target is + +[source,cmake] +---- + target_link_libraries( third_party_include + PRIVATE + Boost::filesystem + ) +---- + + +## Conan Imported Targets + +To configure conan to use imported targets add the argument +TARGETS+ to the +conan_basic_setup+ function. This will cause conan to create a `CONAN_PKG::pkg_name` target that can be imported as a library. + +An example of this using the `fmt` library is below: + +[source,cmake] +---- + conan_basic_setup(TARGETS) + + add_executable(third_party_include) + + target_link_libraries(third_party_include + PRIVATE + CONAN_PKG::fmt + ) +---- + +# Building the Example + +[source,bash] +---- +$ mkdir build + +$ cd build/ + +$ conan install .. +Configuration: +[settings] +arch=x86_64 +arch_build=x86_64 +build_type=Release +compiler=gcc +compiler.libcxx=libstdc++11 +compiler.version=5 +os=Linux +os_build=Linux +[options] +[build_requires] +[env] + +fmt/5.3.0@bincrafters/stable: Not found in local cache, looking in remotes... +fmt/5.3.0@bincrafters/stable: Trying with 'conan-center'... +Downloading conanmanifest.txt +[==================================================] 166B/166B +Downloading conanfile.py +[==================================================] 2.9KB/2.9KB +Downloading conan_export.tgz +[==================================================] 758B/758B +Decompressing conan_export.tgz: 1.98kB [00:00, 504kB/s] +fmt/5.3.0@bincrafters/stable: Downloaded recipe revision 0 +conanfile.txt: Installing package +Requirements + fmt/5.3.0@bincrafters/stable from 'conan-center' - Downloaded +Packages + fmt/5.3.0@bincrafters/stable:4d887c1c2779c63d2cdd81580698d2e22cb35b29 - Download + +fmt/5.3.0@bincrafters/stable: Retrieving package 4d887c1c2779c63d2cdd81580698d2e22cb35b29 from remote 'conan-center' +Downloading conanmanifest.txt +[==================================================] 1.1KB/1.1KB +Downloading conaninfo.txt +[==================================================] 550B/550B +Downloading conan_package.tgz +[==================================================] 156.2KB/156.2KB +Decompressing conan_package.tgz: 161kB [00:00, 13.8MB/s] +fmt/5.3.0@bincrafters/stable: Package installed 4d887c1c2779c63d2cdd81580698d2e22cb35b29 +fmt/5.3.0@bincrafters/stable: Downloaded package revision 0 +conanfile.txt: Generator cmake created conanbuildinfo.cmake +conanfile.txt: Generator txt created conanbuildinfo.txt +conanfile.txt: Generated conaninfo.txt +conanfile.txt: Generated graphinfo + +$ cmake .. +-- The C compiler identification is GNU 5.4.0 +-- The CXX compiler identification is GNU 5.4.0 +-- Check for working C compiler: /usr/bin/cc +-- Check for working C compiler: /usr/bin/cc -- works +-- Detecting C compiler ABI info +-- Detecting C compiler ABI info - done +-- Detecting C compile features +-- Detecting C compile features - done +-- Check for working CXX compiler: /usr/bin/c++ +-- Check for working CXX compiler: /usr/bin/c++ -- works +-- Detecting CXX compiler ABI info +-- Detecting CXX compiler ABI info - done +-- Detecting CXX compile features +-- Detecting CXX compile features - done +-- Conan: Adjusting output directories +-- Conan: Using cmake targets configuration +-- Library fmt found /home/devuser/.conan/data/fmt/5.3.0/bincrafters/stable/package/4d887c1c2779c63d2cdd81580698d2e22cb35b29/lib/libfmt.a +-- Conan: Adjusting default RPATHs Conan policies +-- Conan: Adjusting language standard +-- Current conanbuildinfo.cmake directory: /data/code/07-package-management/D-conan/ii-basic-targets/build +-- Conan: Compiler GCC>=5, checking major version 5 +-- Conan: Checking correct version: 5 +-- Configuring done +-- Generating done +-- Build files have been written to: /data/code/07-package-management/D-conan/ii-basic-targets/build + + +$ make VERBOSE=1 +/usr/local/bin/cmake -H/data/code/07-package-management/D-conan/ii-basic-targets -B/data/code/07-package-management/D-conan/ii-basic-targets/build --check-build-system CMakeFiles/Makefile.cmake 0 +/usr/local/bin/cmake -E cmake_progress_start /data/code/07-package-management/D-conan/ii-basic-targets/build/CMakeFiles /data/code/07-package-management/D-conan/ii-basic-targets/build/CMakeFiles/progress.marks +make -f CMakeFiles/Makefile2 all +make[1]: Entering directory '/data/code/07-package-management/D-conan/ii-basic-targets/build' +make -f CMakeFiles/third_party_include.dir/build.make CMakeFiles/third_party_include.dir/depend +make[2]: Entering directory '/data/code/07-package-management/D-conan/ii-basic-targets/build' +cd /data/code/07-package-management/D-conan/ii-basic-targets/build && /usr/local/bin/cmake -E cmake_depends "Unix Makefiles" /data/code/07-package-management/D-conan/ii-basic-targets /data/code/07-package-management/D-conan/ii-basic-targets /data/code/07-package-management/D-conan/ii-basic-targets/build /data/code/07-package-management/D-conan/ii-basic-targets/build /data/code/07-package-management/D-conan/ii-basic-targets/build/CMakeFiles/third_party_include.dir/DependInfo.cmake --color= +Dependee "/data/code/07-package-management/D-conan/ii-basic-targets/build/CMakeFiles/third_party_include.dir/DependInfo.cmake" is newer than depender "/data/code/07-package-management/D-conan/ii-basic-targets/build/CMakeFiles/third_party_include.dir/depend.internal". +Dependee "/data/code/07-package-management/D-conan/ii-basic-targets/build/CMakeFiles/CMakeDirectoryInformation.cmake" is newer than depender "/data/code/07-package-management/D-conan/ii-basic-targets/build/CMakeFiles/third_party_include.dir/depend.internal". +Scanning dependencies of target third_party_include +make[2]: Leaving directory '/data/code/07-package-management/D-conan/ii-basic-targets/build' +make -f CMakeFiles/third_party_include.dir/build.make CMakeFiles/third_party_include.dir/build +make[2]: Entering directory '/data/code/07-package-management/D-conan/ii-basic-targets/build' +[ 50%] Building CXX object CMakeFiles/third_party_include.dir/main.cpp.o +/usr/bin/c++ -isystem /home/devuser/.conan/data/fmt/5.3.0/bincrafters/stable/package/4d887c1c2779c63d2cdd81580698d2e22cb35b29/include -std=gnu++11 -o CMakeFiles/third_party_include.dir/main.cpp.o -c /data/code/07-package-management/D-conan/ii-basic-targets/main.cpp +[100%] Linking CXX executable bin/third_party_include +/usr/local/bin/cmake -E cmake_link_script CMakeFiles/third_party_include.dir/link.txt --verbose=1 +/usr/bin/c++ CMakeFiles/third_party_include.dir/main.cpp.o -o bin/third_party_include /home/devuser/.conan/data/fmt/5.3.0/bincrafters/stable/package/4d887c1c2779c63d2cdd81580698d2e22cb35b29/lib/libfmt.a +make[2]: Leaving directory '/data/code/07-package-management/D-conan/ii-basic-targets/build' +[100%] Built target third_party_include +make[1]: Leaving directory '/data/code/07-package-management/D-conan/ii-basic-targets/build' +/usr/local/bin/cmake -E cmake_progress_start /data/code/07-package-management/D-conan/ii-basic-targets/build/CMakeFiles 0 + +/usr/bin/cmake -E cmake_progress_start /home/devuser/ws/build/CMakeFiles 0 + +$ ./bin/third_party_include +Hello, conan. This is fmtlib! +---- diff --git a/cmake/example/07-package-management/D-conan/ii-basic-targets/conanfile.txt b/cmake/example/07-package-management/D-conan/ii-basic-targets/conanfile.txt new file mode 100644 index 0000000..1ff62aa --- /dev/null +++ b/cmake/example/07-package-management/D-conan/ii-basic-targets/conanfile.txt @@ -0,0 +1,5 @@ +[requires] +fmt/5.3.0@bincrafters/stable + +[generators] +cmake diff --git a/cmake/example/07-package-management/D-conan/ii-basic-targets/main.cpp b/cmake/example/07-package-management/D-conan/ii-basic-targets/main.cpp new file mode 100644 index 0000000..385a81a --- /dev/null +++ b/cmake/example/07-package-management/D-conan/ii-basic-targets/main.cpp @@ -0,0 +1,8 @@ +#include +#include + +int main(int argc, char *argv[]) +{ + fmt::print("Hello, {}. This is {}!\n", "conan", "fmtlib"); + return 0; +} diff --git a/cmake/example/07-package-management/D-conan/ii-basic-targets/run_test.sh b/cmake/example/07-package-management/D-conan/ii-basic-targets/run_test.sh new file mode 100755 index 0000000..777acb2 --- /dev/null +++ b/cmake/example/07-package-management/D-conan/ii-basic-targets/run_test.sh @@ -0,0 +1,19 @@ +#!/bin/bash + +conan_bin=`which conan` + +if [ -z $conan_bin ]; then + exit 0 +fi + +conan profile show default || { + conan profile new default --detect +} +conan profile update settings.compiler.libcxx=libstdc++11 default + +echo "correct version of cmake" +mkdir -p build && cd build && conan install .. && cmake .. && make +if [ $? -ne 0 ]; then + echo "Error running example" + exit 1 +fi diff --git a/cmake/example/07-package-management/README.adoc b/cmake/example/07-package-management/README.adoc new file mode 100644 index 0000000..6907be9 --- /dev/null +++ b/cmake/example/07-package-management/README.adoc @@ -0,0 +1,12 @@ += Package Management +:toc: +:toc-placement!: + +toc::[] + +[[intro]] +Introduction +------------ + +For C++ and CMake there is currently no universally accepted way of managing and packaging dependencies. However, in recent years there have been some new and interesting package management systems made available. While these are separate systems to CMake, most of them have are designed to integrate directly into a CMake based build system. + diff --git a/cmake/example/LICENSE b/cmake/example/LICENSE new file mode 100644 index 0000000..f92dce2 --- /dev/null +++ b/cmake/example/LICENSE @@ -0,0 +1,22 @@ +The MIT License (MIT) + +Copyright (c) 2015 Thom Troy + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. + diff --git a/cmake/example/README.adoc b/cmake/example/README.adoc new file mode 100644 index 0000000..ff487d0 --- /dev/null +++ b/cmake/example/README.adoc @@ -0,0 +1,108 @@ + += CMake Examples +:toc: +:toc-placement!: + +toc::[] + +# Introduction + +https://cmake.org/[CMake] is a cross-platform open-source meta-build system which +can build, test and package software. It can be used to support multiple native build environments including +make, Apple's xcode and Microsoft Visual Studio. + +This repository includes some example modern CMake configurations which I have picked up +when exploring it's usage for various projects. The examples are laid out in a tutorial like format. +The first examples are very basic and slowly increase in complexity drawing on previous examples to show +more complex use cases. + +These examples have been tested on Ubuntu 16.04 but should work under any Linux system that supports CMake v3.5+. + +This branch works with the CMake version 3.5 onwards. + +* For examples that use CMake version 2.x see the branch link:https://github.com/ttroy50/cmake-examples/tree/v2-style-includes[v2-style-includes]. +* For examples that use CMake version 3.0 see the branch link:https://github.com/ttroy50/cmake-examples/tree/v3.0-minimum[v3.0-minimum] + +image:https://travis-ci.org/ttroy50/cmake-examples.svg?branch=master["Build Status", link="https://travis-ci.org/ttroy50/cmake-examples"] + +# Requirements + +The basic requirements for most examples are: + +* CMake v3.5+ +* A c++ compiler (defaults to gcc) +* make + +## Installation on Ubuntu + +The easiest way to install the above on Ubuntu is as follows + +[source,bash] +---- +$ sudo apt-get install build-essential +$ sudo apt-get install cmake +---- + +Some specific examples may require other tools including: + +* http://www.boost.org/[boost] + + $ sudo apt-get install libboost-all-dev + +* https://github.com/google/protobuf[protobuf] + + $ sudo apt-get install libprotobuf-dev + $ sudo apt-get install protobuf-compiler + +* http://cppcheck.sourceforge.net/[cppcheck] + + $ sudo apt-get install cppcheck + +* http://clang.llvm.org/[clang] + + $ sudo apt-get install clang-3.6 + +* https://ninja-build.org/[ninja] + + $ sudo apt-get install ninja-build + +* link:https://conan.io[conan] + + $ sudo apt-get install python3 python3-pip + $ sudo pip3 install conan + +## Docker + +Docker containers with all requirements and various versions of CMake are generated to help make testing the examples easier. These are available from the docker hub repository link:https://hub.docker.com/r/matrim/cmake-examples/[matrim/cmake-examples]. + +To build the full set of cmake-examples test cases you can run: + +[source,bash] +---- +docker run -it matrim/cmake-examples:3.5.1 +cd ~ +git clone https://github.com/ttroy50/cmake-examples.git code +cd code +./test.sh +---- + +For more details on build and running the docker containers link:here[dockerfiles]. + +# Other Links + +There are many CMake tutorials and examples online. The list below includes links +to some of these which I have found helpful in my CMake journey. + + * https://web.archive.org/web/20160314094326/https://www.kdab.com/~stephen/moderncmake.pdf[Modern CMake Slides] + * https://rix0r.nl/blog/2015/08/13/cmake-guide/[rix0r Modern CMake Blog] + * https://cmake.org/cmake-tutorial/[Official CMake Tutorial] + * https://gitlab.kitware.com/cmake/community/wikis/home[Official CMake Wiki] + * https://gitlab.kitware.com/cmake/community/wikis/doc/cmake/Useful-Variables[CMake Useful Variables] + * http://derekmolloy.ie/hello-world-introductions-to-cmake/[Derek Molloy - Intro to CMake] + * http://techminded.net/blog/modular-c-projects-with-cmake.html[Modular C++ Projects] + * https://web.archive.org/web/20190320121339/http://voices.canonical.com/jussi.pakkanen/2013/03/26/a-list-of-common-cmake-antipatterns/[Common CMake Anti-Patterns] + * http://baptiste-wicht.com/posts/2014/04/install-use-clang-static-analyzer-cmake.html[Using clang static analyser with CMake] + * https://cmake.org/pipermail/cmake/2011-April/043709.html[Static Analysis with CDash] - Includes some info about using CppCheck with CMake + * https://samthursfield.wordpress.com/2015/10/20/some-cmake-tips/[CMake Tips] + * https://www.johnlamp.net/cmake-tutorial.html[John Lamp - CMake Tutorial] + * link:https://docs.conan.io[Conan Documentation] diff --git a/cmake/example/cmake-examples.sublime-project b/cmake/example/cmake-examples.sublime-project new file mode 100644 index 0000000..24db303 --- /dev/null +++ b/cmake/example/cmake-examples.sublime-project @@ -0,0 +1,8 @@ +{ + "folders": + [ + { + "path": "." + } + ] +} diff --git a/cmake/example/dockerfiles/README.adoc b/cmake/example/dockerfiles/README.adoc new file mode 100644 index 0000000..7202b76 --- /dev/null +++ b/cmake/example/dockerfiles/README.adoc @@ -0,0 +1,90 @@ + += CMake Examples with Docker +:toc: +:toc-placement!: + +toc::[] + +# Docker + +https://www.docker.com/[Docker] allows you to package software in a container which contains a filesystem with all dependencies. This allows having containers which include everything needed to run and test our examples. And as a result of packaging all dependencies we can create containers to include different versions of cmake so that it is possible to easily make sure our examples work for many cmake versions. + +# Building + +To build a container from the this directory run the following: + +[source,bash] +---- +$ docker build --rm -f -t . +---- + +For example: + +[source,bash] +---- +$ docker build --rm -f ubuntu14.04-cmake-3.5.1 -t matrim/cmake-examples:3.5.1 . +---- + +In this example the tag is created as follows + + /: + +This will tag the container as belong to my repository with the label of the container being the version of cmake installed. + +## Pre-build Images + +I have pre-build images and pushed them to the https://hub.docker.com[docker hub] in the repository https://hub.docker.com/r/matrim/cmake-examples/[matrim/cmake-examples]. + +The current usable images include the following versions of cmake: + +* Ubuntu 16.04 with CMake 3.5.1 + + $ docker pull docker pull matrim/cmake-examples:3.5.1 + +* Ubuntu 16.04 with CMake 3.10.3 + + $ docker pull docker pull matrim/cmake-examples:3.10.3 + +Some old images which work with older version of the repository include: + +* Ubuntu 14.04 with CMake 2.8.12.2 + + $ docker pull docker pull matrim/cmake-examples:2.8.12.2 + +* Ubuntu 14.04 with CMake 3.4.3 + + $ docker pull docker pull matrim/cmake-examples:3.4.3 + +# Running + +When run the images will automatically create a non root user called devuser, with a default command to launch a bash shell in the users home directory. + +If you want to set the UID and GID for this user you can pass them in via the environment variables `DEV_UID` and `DEV_GID` + +For example + +[source,bash] +---- +docker run -e DEV_UID=`id -u` -e DEV_GID=`id -u` -it matrim/cmake-examples:3.5.1 +---- + + +To build the full set of cmake-examples test cases you can run: + +[source,bash] +---- +docker run -it matrim/cmake-examples:3.5.1 +git clone https://github.com/ttroy50/cmake-examples.git +cd cmake-examples +./test.sh +---- + + +If you already have a checkout of the cmake-examples you can load the directory as a docker volume. + +Below is an example of loading a volume and automatically running all cmake-example test cases: + +[source,bash] +---- +docker run --rm -e DEV_UID=`id -u` -e DEV_GID=`id -u` -v /checkout/directory:/data/code -it matrim/cmake-examples:3.5.1 /data/code/test.sh +---- diff --git a/cmake/example/dockerfiles/setup.sh b/cmake/example/dockerfiles/setup.sh new file mode 100644 index 0000000..f9d6894 --- /dev/null +++ b/cmake/example/dockerfiles/setup.sh @@ -0,0 +1,26 @@ +#!/bin/bash +# Setup script for the cmake-examples repository +# Will create a non root user using the UID and GID passed in from environment +# variables and give them sudo access +# +ret=false +output=`getent passwd devuser 2>&1` +result=$? +if [ $result -ne 0 ] ; then + echo "Creating devuser" + if [ -z $DEV_UID ]; then + DEV_UID=1000 + fi + + if [ -z $DEV_GID ]; then + DEV_GID=1000 + fi + + groupadd -g $DEV_GID devgroup + useradd -c 'container user' -u $DEV_UID -g $DEV_GID -d /home/devuser -m devuser + echo "devuser:todo_$DEV_UID_$DEV_GID" | chpasswd + sudo adduser devuser sudo + echo "%sudo ALL=NOPASSWD: ALL" >> /etc/sudoers +fi + +exec gosu devuser "$@" diff --git a/cmake/example/dockerfiles/ubuntu14.04-cmake-3.4.3 b/cmake/example/dockerfiles/ubuntu14.04-cmake-3.4.3 new file mode 100644 index 0000000..280542a --- /dev/null +++ b/cmake/example/dockerfiles/ubuntu14.04-cmake-3.4.3 @@ -0,0 +1,51 @@ +# Container for building and testing cmake-examples with cmake v3.4.3 +FROM ubuntu:14.04 +MAINTAINER Thom Troy + +RUN apt-get update && apt-get install -y build-essential \ + sudo \ + libboost-all-dev \ + libprotobuf-dev \ + protobuf-compiler \ + clang-3.6 \ + clang-format-3.6 \ + ninja-build \ + wget \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* \ + && apt-get autoremove -y + +RUN cd /usr/local/src \ + && wget https://github.com/tianon/gosu/releases/download/1.10/gosu-amd64 \ + && mv gosu-amd64 /usr/local/bin/gosu \ + && chmod +x /usr/local/bin/gosu + +ADD setup.sh /setup.sh +RUN chmod +x /setup.sh + +RUN cd /usr/local/src \ + && wget https://cmake.org/files/v3.4/cmake-3.4.3.tar.gz \ + && tar xvf cmake-3.4.3.tar.gz \ + && cd cmake-3.4.3 \ + && ./bootstrap \ + && make \ + && make install \ + && cd .. \ + && rm -rf cmake* + +# cppcheck +RUN cd /usr/local/src \ + && wget https://github.com/danmar/cppcheck/archive/1.79.tar.gz \ + && tar xvf 1.79.tar.gz \ + && cd cppcheck-1.79 \ + && mkdir build \ + && cd build \ + && cmake .. \ + && make install \ + && cd ../.. && rm -rf cppcheck* + + +CMD ["/bin/bash"] + +ENTRYPOINT ["/setup.sh"] diff --git a/cmake/example/dockerfiles/ubuntu14.04-default-2.8.12.2 b/cmake/example/dockerfiles/ubuntu14.04-default-2.8.12.2 new file mode 100644 index 0000000..bcb1349 --- /dev/null +++ b/cmake/example/dockerfiles/ubuntu14.04-default-2.8.12.2 @@ -0,0 +1,41 @@ +# Container for building and testing cmake-examples with default cmake v2.8.12.2 +FROM ubuntu:14.04 +MAINTAINER Thom Troy + +RUN apt-get update && apt-get install -y build-essential \ + sudo \ + cmake \ + libboost-all-dev \ + libprotobuf-dev \ + protobuf-compiler \ + cppcheck \ + clang-3.6 \ + clang-format-3.6 \ + ninja-build \ + wget \ + git \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# tini required to handle issue with building deb packages from cmake v2.8 +RUN cd /usr/local/src \ + && wget https://github.com/krallin/tini/archive/v0.9.0.tar.gz \ + && tar xvf v0.9.0.tar.gz \ + && cd tini-0.9.0 \ + && cmake . \ + && make \ + && make install \ + && cd /usr/local/src \ + && rm -rf tini-* \ + && rm -rf v0.9.0.tar.gz + +RUN cd /usr/local/src \ + && wget https://github.com/tianon/gosu/releases/download/1.10/gosu-amd64 \ + && mv gosu-amd64 /usr/local/bin/gosu \ + && chmod +x /usr/local/bin/gosu + +ADD setup.sh /setup.sh +RUN chmod +x /setup.sh + +CMD ["/bin/bash"] +ENTRYPOINT ["/usr/local/bin/tini", "--", "/setup.sh"] diff --git a/cmake/example/dockerfiles/ubuntu16.04-cmake-3.10.3 b/cmake/example/dockerfiles/ubuntu16.04-cmake-3.10.3 new file mode 100644 index 0000000..074a896 --- /dev/null +++ b/cmake/example/dockerfiles/ubuntu16.04-cmake-3.10.3 @@ -0,0 +1,52 @@ +# Container for building and testing cmake-examples with CMake 3.10.3 +FROM ubuntu:16.04 +MAINTAINER Thom Troy + +RUN apt-get update && apt-get install -y build-essential \ + sudo \ + cmake \ + libboost-all-dev \ + libprotobuf-dev \ + protobuf-compiler \ + clang-3.6 \ + clang-format-3.6 \ + ninja-build \ + wget \ + git \ + python3 \ + python3-pip \ + && pip3 install conan \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +RUN cd /usr/local/src \ + && wget https://cmake.org/files/v3.10/cmake-3.10.3.tar.gz \ + && tar xvf cmake-3.10.3.tar.gz \ + && cd cmake-3.10.3 \ + && ./bootstrap \ + && make \ + && make install \ + && cd .. \ + && rm -rf cmake* + +# cppcheck +RUN cd /usr/local/src \ + && wget https://github.com/danmar/cppcheck/archive/1.79.tar.gz \ + && tar xvf 1.79.tar.gz \ + && cd cppcheck-1.79 \ + && mkdir build \ + && cd build \ + && cmake .. \ + && make install \ + && cd ../.. && rm -rf cppcheck* + +RUN cd /usr/local/src \ + && wget https://github.com/tianon/gosu/releases/download/1.10/gosu-amd64 \ + && mv gosu-amd64 /usr/local/bin/gosu \ + && chmod +x /usr/local/bin/gosu + +ADD setup.sh /setup.sh +RUN chmod +x /setup.sh + +CMD ["/bin/bash"] +ENTRYPOINT ["/setup.sh"] diff --git a/cmake/example/dockerfiles/ubuntu16.04-default-cmake-3.5.1 b/cmake/example/dockerfiles/ubuntu16.04-default-cmake-3.5.1 new file mode 100644 index 0000000..9398ec8 --- /dev/null +++ b/cmake/example/dockerfiles/ubuntu16.04-default-cmake-3.5.1 @@ -0,0 +1,42 @@ +# Container for building and testing cmake-examples with default cmake v3.5.1 +FROM ubuntu:16.04 +MAINTAINER Thom Troy + +RUN apt-get update && apt-get install -y build-essential \ + sudo \ + cmake \ + libboost-all-dev \ + libprotobuf-dev \ + protobuf-compiler \ + clang-3.6 \ + clang-format-3.6 \ + ninja-build \ + wget \ + git \ + python3 \ + python3-pip \ + && pip3 install conan \ + && apt-get clean \ + && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* + +# cppcheck +RUN cd /usr/local/src \ + && wget https://github.com/danmar/cppcheck/archive/1.79.tar.gz \ + && tar xvf 1.79.tar.gz \ + && cd cppcheck-1.79 \ + && mkdir build \ + && cd build \ + && cmake .. \ + && make install \ + && cd ../.. && rm -rf cppcheck* + +RUN cd /usr/local/src \ + && wget https://github.com/tianon/gosu/releases/download/1.10/gosu-amd64 \ + && mv gosu-amd64 /usr/local/bin/gosu \ + && chmod +x /usr/local/bin/gosu + +ADD setup.sh /setup.sh +RUN chmod +x /setup.sh + +CMD ["/bin/bash"] +ENTRYPOINT ["/setup.sh"] diff --git a/cmake/example/test.sh b/cmake/example/test.sh new file mode 100755 index 0000000..d8bc8fb --- /dev/null +++ b/cmake/example/test.sh @@ -0,0 +1,92 @@ +#!/bin/bash + +# print out cmake information to help with debugging. + +cmake --version +cmake --help + +# Find the directory this test script is in and then run them from there +EXAMPLES_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" +echo "running examples in $EXAMPLES_DIR" + +cd $EXAMPLES_DIR + +dirs=(./01-basic/A-hello-cmake \ +./01-basic/B-hello-headers \ +./01-basic/C-static-library \ +./01-basic/D-shared-library \ +./01-basic/E-installing \ +./01-basic/F-build-type \ +./01-basic/G-compile-flags \ +./01-basic/H-third-party-library \ +./01-basic/I-compiling-with-clang \ +./01-basic/J-building-with-ninja \ +./01-basic/K-imported-targets \ +./01-basic/L-cpp-standard/i-common-method \ +./01-basic/L-cpp-standard/ii-cxx-standard \ +./01-basic/L-cpp-standard/iii-compile-features \ +./02-sub-projects/A-basic \ +./03-code-generation/protobuf \ +./03-code-generation/configure-files \ +./04-static-analysis/cppcheck \ +./04-static-analysis/cppcheck-compile-commands \ +./04-static-analysis/clang-analyzer \ +./04-static-analysis/clang-format \ +./05-unit-testing/boost \ +./05-unit-testing/google-test-download \ +./05-unit-testing/catch2-vendored \ +./06-installer/deb \ +./07-package-management/D-conan/i-basic \ +./07-package-management/D-conan/ii-basic-targets \ +) + +ROOT_DIR=`pwd` + +for dir in ${dirs[*]} +do + echo "" + echo "" + echo "Running test for $dir" + cd $ROOT_DIR + if [ -d "$ROOT_DIR/$dir/build" ]; then + echo "deleting $dir/build" + rm -r $dir/build + fi + + if [ -f "$dir/pre_test.sh" ]; then + echo "running pre test" + $ROOT_DIR/$dir/pre_test.sh + if [ $? -ne 0 ]; then + echo "Error running pre_test for $dir" + exit 1 + fi + fi + + if [ -f "$dir/run_test.sh" ]; then + echo "running run_test" + cd $dir && $ROOT_DIR/$dir/run_test.sh + if [ $? -ne 0 ]; then + echo "Error running run_test for $dir" + exit 1 + fi + else + cd $dir && mkdir -p build && cd build && cmake .. && make + if [ $? -ne 0 ]; then + echo "Error running example $dir" + exit 1 + fi + fi + + if [ -f "$ROOT_DIR/$dir/post_test.sh" ]; then + echo "running post test" + $ROOT_DIR/$dir/post_test.sh + if [ $? -ne 0 ]; then + echo "Error running post_test for $dir" + exit 1 + fi + fi +done + +echo "" +echo "" +echo "All Tests Completed" diff --git a/cmake/examples b/cmake/examples new file mode 160000 index 0000000..2b27fc7 --- /dev/null +++ b/cmake/examples @@ -0,0 +1 @@ +Subproject commit 2b27fc75c40447c8cf9b371cc21224dd96d6ce45 From 9823e0c353675350d17355e6618aa1367b8f1ee1 Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Tue, 4 Jan 2022 17:20:01 +0800 Subject: [PATCH 64/82] new file: bit/1 new file: bit/1.c new file: bit/limit/main.c new file: malloc/1.c renamed: uniconbit/main.c -> unionbit/main.c new file: ../cpp/strlib/CMakeLists.txt new file: ../cpp/strlib/build.sh new file: ../cpp/strlib/include/str.h new file: ../cpp/strlib/src/str.cpp new file: ../cpp/strlib/src/test.cpp new file: ../cpp/test2/main.c --- c/bit/1 | Bin 0 -> 6352 bytes c/bit/1.c | 16 ++++++++++++++++ c/bit/limit/main.c | 27 +++++++++++++++++++++++++++ c/malloc/1.c | 14 ++++++++++++++ c/{uniconbit => unionbit}/main.c | 0 cpp/strlib/CMakeLists.txt | 5 +++++ cpp/strlib/build.sh | 7 +++++++ cpp/strlib/include/str.h | 7 +++++++ cpp/strlib/src/str.cpp | 25 +++++++++++++++++++++++++ cpp/strlib/src/test.cpp | 11 +++++++++++ cpp/test2/main.c | 13 +++++++++++++ 11 files changed, 125 insertions(+) create mode 100755 c/bit/1 create mode 100644 c/bit/1.c create mode 100644 c/bit/limit/main.c create mode 100644 c/malloc/1.c rename c/{uniconbit => unionbit}/main.c (100%) create mode 100644 cpp/strlib/CMakeLists.txt create mode 100644 cpp/strlib/build.sh create mode 100644 cpp/strlib/include/str.h create mode 100644 cpp/strlib/src/str.cpp create mode 100644 cpp/strlib/src/test.cpp create mode 100644 cpp/test2/main.c diff --git a/c/bit/1 b/c/bit/1 new file mode 100755 index 0000000000000000000000000000000000000000..cf694560ca7e3b929c2e605cee01aafc2f9442de GIT binary patch literal 6352 zcmb_gZ)_Y_5udwD!6bHLS8W=aCf?FSa?y29YXA6}kw43ZD!DloLwL%zHEE z^~R?}g|YX|o8OyxGyDGSy!&Qm;)Q4=0zxtP1(0-Omqv!U;lv|cK{gD7umj5{U^jdU zrQB;nAhWwLuHfXn*{e~%pq z586?ea~$|wkM2)+`2E6mceZQ&J4ZH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NxRtdB=Ulaclzv>i=FXKaP;$QMg;gVO1 zet7&}!Ul>->?Lm&eufRh{$>2=yG-_@tS5Q1@VS6JovjkT*iR!yG0`{@E%WzIc!!3Y zrNl3sl2fWT<7fNp%;nsc4#MOAjgY +#include +#include +const char *u2word(int u); +int main(){ + int a = 0x52B3; + printf("%s\n",u2word(a)); +} +const char *u2word(int u){ + char *temp=(char *)malloc(sizeof(int)); + sprintf(temp,"%X",u); + printf("\\u%s\n",temp); + temp[0]='\\'; + temp[1]='u'; + return temp; +} diff --git a/c/bit/limit/main.c b/c/bit/limit/main.c new file mode 100644 index 0000000..01e25e5 --- /dev/null +++ b/c/bit/limit/main.c @@ -0,0 +1,27 @@ +#include +#include + +int main(){ + printf("One Byte is %d bit\n",CHAR_BIT); + + printf("The min of signed char is %d\n",SCHAR_MIN); + printf("The max of signed char is %d\n",SCHAR_MAX); + printf("The max of unsigned char is %u\n",UCHAR_MAX); + + printf("The min of signed short is %d\n",SHRT_MIN); + printf("The max of signed short is %d\n",SHRT_MAX); + printf("The max of unsigned short is %u\n",USHRT_MAX); + + printf("The min of signed int is %d\n",INT_MIN); + printf("The max of signed int is %d\n",INT_MAX); + printf("The max of unsigned int is %u\n",UINT_MAX); + + printf("The min of signed long is %ld\n",LONG_MIN); + printf("The max of signed long is %ld\n",LONG_MAX); + printf("The max of unsigned long is %lu\n",ULONG_MAX); + + printf("The min of signed long long is %lld\n",LLONG_MIN); + printf("The max of signed long long is %lld\n",LLONG_MAX); + printf("The max of unsigned long long is %llu\n",ULLONG_MAX); + +} diff --git a/c/malloc/1.c b/c/malloc/1.c new file mode 100644 index 0000000..c58fdbc --- /dev/null +++ b/c/malloc/1.c @@ -0,0 +1,14 @@ +#include +#include +int main(){ + int *a=(int *)malloc(sizeof(int)); + *a=4; + printf("a:%p\n",a); + { + free(a); + int *b=(int *)malloc(sizeof(int)); + printf("a:%p\n",a); + printf("b:%p\n",b); + } + printf("%d\n",*a); +} diff --git a/c/uniconbit/main.c b/c/unionbit/main.c similarity index 100% rename from c/uniconbit/main.c rename to c/unionbit/main.c diff --git a/cpp/strlib/CMakeLists.txt b/cpp/strlib/CMakeLists.txt new file mode 100644 index 0000000..c19725b --- /dev/null +++ b/cpp/strlib/CMakeLists.txt @@ -0,0 +1,5 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.9) +PROJECT(ONEBOT_C) +INCLUDE_DIRECTORIES(./include) +AUX_SOURCE_DIRECTORY(./src DIR_SRC) +ADD_EXECUTABLE(./bin ${DIR_SRC}) diff --git a/cpp/strlib/build.sh b/cpp/strlib/build.sh new file mode 100644 index 0000000..cf49c9f --- /dev/null +++ b/cpp/strlib/build.sh @@ -0,0 +1,7 @@ + +rm -rf build +mkdir build +cd build +cmake .. -G "MinGW Makefiles" +make +./bin diff --git a/cpp/strlib/include/str.h b/cpp/strlib/include/str.h new file mode 100644 index 0000000..09edd87 --- /dev/null +++ b/cpp/strlib/include/str.h @@ -0,0 +1,7 @@ +#ifndef _str_h +#define _str_h +#include +#include +#include +void strval(char **str1,const char *str2,int type); +#endif diff --git a/cpp/strlib/src/str.cpp b/cpp/strlib/src/str.cpp new file mode 100644 index 0000000..375d97f --- /dev/null +++ b/cpp/strlib/src/str.cpp @@ -0,0 +1,25 @@ +#include "../include/str.h" +void strval(char **str1,const char *str2,int type){ + switch (type) + { + case 1 : { + *str1=(char *)malloc(strlen(str2+1)); + sprintf(*str1,"%s",str2); + printf("case 1 :%s\n",*str1); + break; + } + case 2 : { + *str1 = (char *)realloc(*str1,strlen(*str1)+strlen(str2)+1); + sprintf(*str1,"%s%s",*str1,str2); + printf("case 2 :%s\n",*str1); + } + break; + case 3 : { + free(*str1); + *str1=(char *)malloc(strlen(str2+1)); + sprintf(*str1,"%s",str2); + printf("case 3 :%s\n",*str1); + break; + } + } +} diff --git a/cpp/strlib/src/test.cpp b/cpp/strlib/src/test.cpp new file mode 100644 index 0000000..8b9abc7 --- /dev/null +++ b/cpp/strlib/src/test.cpp @@ -0,0 +1,11 @@ +#include "../include/head.hpp" +int main(){ + struct head_link *test1=add(); + test1->type[0]=1; + strval(&(test1->name),"hello ",1); + strval(&(test1->name),"world",2); + strval(&(test1->name),"goodbye world",3); + printf("name:%s\nnum:%d\n",(test1->name),(test1->type[0])); + return 0; +} + diff --git a/cpp/test2/main.c b/cpp/test2/main.c new file mode 100644 index 0000000..b3ba424 --- /dev/null +++ b/cpp/test2/main.c @@ -0,0 +1,13 @@ +#include +void (*add)(); +void addf(){ + int *a = (int *)malloc(sizeof(int)); + *a =4; +} +int main(int argc, char *argv[]) +{ + add()* fp=addf(); + fp(); + printf("%d\n",*a ); + return 0; +} From 841605c1806e76a36a77b12ce2850a1c1afd3ed1 Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Tue, 4 Jan 2022 17:55:20 +0800 Subject: [PATCH 65/82] new file: main.c new file: main.cpp --- c/fp/1 | Bin 0 -> 6848 bytes c/fp/main.c | 26 ++++++++++++++++++++++++++ c/fp/main.cpp | 28 ++++++++++++++++++++++++++++ 3 files changed, 54 insertions(+) create mode 100755 c/fp/1 create mode 100644 c/fp/main.c create mode 100644 c/fp/main.cpp diff --git a/c/fp/1 b/c/fp/1 new file mode 100755 index 0000000000000000000000000000000000000000..142a5d065e11bbd5ee70894dd808fa4a1e121ee8 GIT binary patch literal 6848 zcmb_hTWnls5uV*O#JRY(OB+l=;?p!n&ZT>^<4a4`wPRZebtA{^Ls|tLulF2#m+Vbv z*THFsFrq$6y-XF zX?;X9)M|=*H}ZPMeaOl0I_us1akdjKEhJ8UwdnK~tq~4QS|-1b;3K&7Pk5f&A-vj; z`na%F$5}YAk5W`V05TrpN8zYG*v1wIH}Vx82;t&C`iHzlm<_o31CL1{#*uzkM|#ifECS0^(&T1`OzyiH655p zB<);aD(B!lj{`XzI%MYJQOCB(69Fs9g%oj3D~B}q@q&?ky6VDMHhIZfp2$Xk$KM;=7}d*ma?>pq4y z$a|2#j+{u2d(W$*;Q7K{&+Z+q3jZX&>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U5)YNK9CEIuCy9Tsn6y1^&tOl%G%04T9-tF&@puwRIj5$4*Acl}p(qMshNA z2?M_!Hz%BE$~NN`T8adCDVs(sWtw$ty5yNr$BCY!_N|vEP!Jp|h^7)TY(NG*@uj`T zb2*?xJf%8-te;f9P_n)2b4Ob??dP!YJQheN^-G>BT=HD8caQ&z zsGv59zvS`4$Jo(bzlnpRV$!Ghf;-{*#DNn`j(~uJU(Sc%z0ZZ)v}9 zN|vcC?XUIwrvz}1{{@%70A0lbLwCioeX#B)qen(v4i=ctJY7&3Jeuaf8{gU^~{|(&sZuuViQvE@Es!9B*ebq#^M8Z`*t)UI?mIf`(@Pec3pMj6m nFZ=J0h)LVASfMLAL50-{q6<>5z$;kT%>NQ6hc{dfE)o6%*x**Y literal 0 HcmV?d00001 diff --git a/c/fp/main.c b/c/fp/main.c new file mode 100644 index 0000000..2f237e2 --- /dev/null +++ b/c/fp/main.c @@ -0,0 +1,26 @@ +#include +#include +int min(int a,int b){ + return a-b; +} +int mul(int a,int b){ + return a*b; +} +int div(int a,int b){ + return a/b; +} +int add(const char *a,const char *b){ + return sprintf(a,"%s%s",a,b); +} +int add(int a,int b){ + return a+b; +} + +int calc(int (*fp)(int a,int b),int a , int b){ + return (*fp)(a,b); +} + +int main(int argc,char *argv[]){ + int a=1,b=2; + printf("%d %d=%d\n",a,b,calc(add,a,b)); +} diff --git a/c/fp/main.cpp b/c/fp/main.cpp new file mode 100644 index 0000000..60122df --- /dev/null +++ b/c/fp/main.cpp @@ -0,0 +1,28 @@ +#include +#include +int min(int a,int b){ + return a-b; +} +int mul(int a,int b){ + return a*b; +} +int div(int a,int b){ + return a/b; +} +int add(const char *a,const char *b){ + char c[100]; + sprintf(c,"%s%s",a,b); + return (int)(*c); +} +int add(int a,int b){ + return a+b; +} + +int calc(int (*fp)(int a,int b),int a , int b){ + return (*fp)(a,b); +} + +int main(int argc,char *argv[]){ + int a=1,b=2; + printf("%d %d=%d\n",a,b,calc(add,a,b)); +} From c5553f7d6ebb3509d1e687ea8f855073b305c877 Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Thu, 13 Jan 2022 22:58:07 +0800 Subject: [PATCH 66/82] renamed: test/CMakeLists.txt -> onebot/CMakeLists.txt renamed: test/build.sh -> onebot/build.sh renamed: test/include/head.hpp -> onebot/include/head.hpp renamed: test/include/onebot.h -> onebot/include/onebot.h renamed: test/include/str.h -> onebot/include/str.h renamed: test/src/onebot.cpp -> onebot/src/onebot.cpp renamed: test/src/str.cpp -> onebot/src/str.cpp renamed: test/src/test.cpp -> onebot/src/test.cpp --- cpp/{test => onebot}/CMakeLists.txt | 0 cpp/{test => onebot}/build.sh | 0 cpp/{test => onebot}/include/head.hpp | 0 cpp/{test => onebot}/include/onebot.h | 0 cpp/{test => onebot}/include/str.h | 0 cpp/{test => onebot}/src/onebot.cpp | 0 cpp/{test => onebot}/src/str.cpp | 0 cpp/{test => onebot}/src/test.cpp | 0 8 files changed, 0 insertions(+), 0 deletions(-) rename cpp/{test => onebot}/CMakeLists.txt (100%) rename cpp/{test => onebot}/build.sh (100%) rename cpp/{test => onebot}/include/head.hpp (100%) rename cpp/{test => onebot}/include/onebot.h (100%) rename cpp/{test => onebot}/include/str.h (100%) rename cpp/{test => onebot}/src/onebot.cpp (100%) rename cpp/{test => onebot}/src/str.cpp (100%) rename cpp/{test => onebot}/src/test.cpp (100%) diff --git a/cpp/test/CMakeLists.txt b/cpp/onebot/CMakeLists.txt similarity index 100% rename from cpp/test/CMakeLists.txt rename to cpp/onebot/CMakeLists.txt diff --git a/cpp/test/build.sh b/cpp/onebot/build.sh similarity index 100% rename from cpp/test/build.sh rename to cpp/onebot/build.sh diff --git a/cpp/test/include/head.hpp b/cpp/onebot/include/head.hpp similarity index 100% rename from cpp/test/include/head.hpp rename to cpp/onebot/include/head.hpp diff --git a/cpp/test/include/onebot.h b/cpp/onebot/include/onebot.h similarity index 100% rename from cpp/test/include/onebot.h rename to cpp/onebot/include/onebot.h diff --git a/cpp/test/include/str.h b/cpp/onebot/include/str.h similarity index 100% rename from cpp/test/include/str.h rename to cpp/onebot/include/str.h diff --git a/cpp/test/src/onebot.cpp b/cpp/onebot/src/onebot.cpp similarity index 100% rename from cpp/test/src/onebot.cpp rename to cpp/onebot/src/onebot.cpp diff --git a/cpp/test/src/str.cpp b/cpp/onebot/src/str.cpp similarity index 100% rename from cpp/test/src/str.cpp rename to cpp/onebot/src/str.cpp diff --git a/cpp/test/src/test.cpp b/cpp/onebot/src/test.cpp similarity index 100% rename from cpp/test/src/test.cpp rename to cpp/onebot/src/test.cpp From 62acdea9288c007eee3032eefc46c1ddffc484e6 Mon Sep 17 00:00:00 2001 From: jiang-red <1343396474@qq.com> Date: Sat, 29 Jan 2022 11:02:53 +0800 Subject: [PATCH 67/82] add test --- test | 0 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 test diff --git a/test b/test new file mode 100644 index 0000000..e69de29 From e66ad4b62c709bf28f80006d64b5956ca03d634b Mon Sep 17 00:00:00 2001 From: jiang-red <1343396474@qq.com> Date: Sat, 29 Jan 2022 11:03:04 +0800 Subject: [PATCH 68/82] rm test --- test | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 test diff --git a/test b/test deleted file mode 100644 index e69de29..0000000 From a912c4d1489c4a30f266a86e24ed736ec01ebffd Mon Sep 17 00:00:00 2001 From: opensourcefuture <1770747317@qq.com> Date: Sun, 30 Jan 2022 00:07:23 +0800 Subject: [PATCH 69/82] test --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b102999..9870f08 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # Programme Learning + From 89c0de393671fb00601d385795170d025f78da74 Mon Sep 17 00:00:00 2001 From: Mayuri <63649939+MayuriNFC@users.noreply.github.com> Date: Sun, 30 Jan 2022 00:25:28 +0800 Subject: [PATCH 70/82] Update README.md --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index b102999..9870f08 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,3 @@ # Programme Learning + From 39ad6c906f8e230bd5455757153bb63eaeaffb88 Mon Sep 17 00:00:00 2001 From: Linus Date: Thu, 17 Mar 2022 01:25:42 +0800 Subject: [PATCH 71/82] nth --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 9870f08..1dc2cd0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,4 @@ # Programme Learning + From 698faa29d9cd511b9d01a286bf64561423516c81 Mon Sep 17 00:00:00 2001 From: MayuriNFC <1770747317@qq.com> Date: Fri, 18 Mar 2022 00:32:52 +0800 Subject: [PATCH 72/82] nothing --- .gitmodules | 9 + {cmake => make}/GenericMakefile/.gitignore | 0 {cmake => make}/GenericMakefile/LICENSE | 0 {cmake => make}/GenericMakefile/README.md | 0 {cmake => make}/GenericMakefile/c/hello.c | 0 {cmake => make}/GenericMakefile/cpp/hello.cpp | 0 make/cmake/CMakeTutorial/.gitignore | 42 ++ make/cmake/CMakeTutorial/.gitmodules | 3 + make/cmake/CMakeTutorial/CUDA/CMakeLists.txt | 14 + make/cmake/CMakeTutorial/CUDA/README.md | 130 +++++++ .../CMakeTutorial/CUDA/cmake/FindcuBLAS.cmake | 81 ++++ make/cmake/CMakeTutorial/CUDA/cublasMatMul.cu | 71 ++++ make/cmake/CMakeTutorial/CUDA/cudaMatMul.cu | 132 +++++++ make/cmake/CMakeTutorial/CUDA/cudaMatMul.h | 10 + .../CUDA/imgs/cmake_cuda_support.png | Bin 0 -> 162762 bytes make/cmake/CMakeTutorial/CUDA/main.cc | 48 +++ .../CMakeTutorial/FindPackage/CMakeLists.txt | 31 ++ .../FindPackage/ModuleMode/libadd.cc | 6 + .../FindPackage/ModuleMode/libadd.h | 6 + .../cmake/CMakeTutorial/FindPackage/README.md | 135 +++++++ .../CMakeTutorial/FindPackage/addtest.cc | 13 + .../FindPackage/cmake/FindADD.cmake | 7 + .../CMakeTutorial/FindPackage/curltest.cc | 30 ++ .../CMakeTutorial/FindPackage/glogtest.cc | 12 + .../ImportExternalProject/CMakeLists.txt | 33 ++ .../ImportExternalProject/README.md | 126 ++++++ .../cmake/FetchContentMakeAvaliable.cmake | 14 + .../ImportExternalProject/cmake/spdlog.cmake | 22 ++ .../ImportExternalProject/cmake/spdlog2.cmake | 17 + .../ImportExternalProject/testspdlog.cc | 29 ++ .../CMakeTutorial/Installation/CMakeLists.txt | 49 +++ .../Installation/MyMathConfig.cmake.in | 12 + .../CMakeTutorial/Installation/README.md | 137 +++++++ .../Installation/include/mymath.h | 6 + .../CMakeTutorial/Installation/mymath.cc | 9 + .../CMakeTutorial/Installation/mymathApp.cc | 13 + .../Installation/test_folder/CMakeLists.txt | 7 + .../Installation/test_folder/mymathApp.cc | 13 + make/cmake/CMakeTutorial/LICENSE | 21 + .../PackageManage/CMakeLists.txt | 6 + .../PackageManage/DisplayImage.cpp | 22 ++ .../CMakeTutorial/PackageManage/README.md | 126 ++++++ .../PythonExtention/CMakeLists.txt | 10 + .../CMakeTutorial/PythonExtention/README.md | 14 + .../PythonExtention/python_matrix.cc | 359 ++++++++++++++++++ .../CMakeTutorial/PythonExtention/setup.py | 87 +++++ .../CMakeTutorial/PythonExtention/stub.cc | 10 + .../PythonExtention/test_matrix.py | 68 ++++ make/cmake/CMakeTutorial/README.md | 16 + make/cmake/CMakeTutorial/_config.yml | 1 + .../cmake/cmake-examples}/.gitignore | 0 .../cmake/cmake-examples}/.travis.yml | 0 .../01-basic/A-hello-cmake/CMakeLists.txt | 0 .../01-basic/A-hello-cmake/README.adoc | 0 .../01-basic/A-hello-cmake/main.cpp | 0 .../01-basic/B-hello-headers/CMakeLists.txt | 0 .../01-basic/B-hello-headers/README.adoc | 0 .../01-basic/B-hello-headers/include/Hello.h | 0 .../01-basic/B-hello-headers/src/Hello.cpp | 0 .../01-basic/B-hello-headers/src/main.cpp | 0 .../01-basic/C-static-library/CMakeLists.txt | 0 .../01-basic/C-static-library/README.adoc | 0 .../C-static-library/include/static/Hello.h | 0 .../01-basic/C-static-library/src/Hello.cpp | 0 .../01-basic/C-static-library/src/main.cpp | 0 .../01-basic/D-shared-library/CMakeLists.txt | 0 .../01-basic/D-shared-library/README.adoc | 0 .../D-shared-library/include/shared/Hello.h | 0 .../01-basic/D-shared-library/src/Hello.cpp | 0 .../01-basic/D-shared-library/src/main.cpp | 0 .../01-basic/E-installing/CMakeLists.txt | 0 .../01-basic/E-installing/README.adoc | 0 .../01-basic/E-installing/cmake-examples.conf | 0 .../E-installing/include/installing/Hello.h | 0 .../01-basic/E-installing/src/Hello.cpp | 0 .../01-basic/E-installing/src/main.cpp | 0 .../01-basic/F-build-type/CMakeLists.txt | 0 .../01-basic/F-build-type/README.adoc | 0 .../F-build-type/cmake-gui-build-type.png | Bin .../01-basic/F-build-type/main.cpp | 0 .../01-basic/G-compile-flags/CMakeLists.txt | 0 .../01-basic/G-compile-flags/README.adoc | 0 .../01-basic/G-compile-flags/main.cpp | 0 .../H-third-party-library/CMakeLists.txt | 0 .../H-third-party-library/README.adoc | 0 .../01-basic/H-third-party-library/main.cpp | 0 .../I-compiling-with-clang/CMakeLists.txt | 0 .../I-compiling-with-clang/README.adoc | 0 .../01-basic/I-compiling-with-clang/main.cpp | 0 .../I-compiling-with-clang/pre_test.sh | 0 .../I-compiling-with-clang/run_test.sh | 0 .../J-building-with-ninja/CMakeLists.txt | 0 .../J-building-with-ninja/README.adoc | 0 .../01-basic/J-building-with-ninja/main.cpp | 0 .../J-building-with-ninja/pre_test.sh | 0 .../J-building-with-ninja/run_test.sh | 0 .../K-imported-targets/CMakeLists.txt | 0 .../01-basic/K-imported-targets/README.adoc | 0 .../01-basic/K-imported-targets/main.cpp | 0 .../01-basic/K-imported-targets/run_test.sh | 0 .../01-basic/L-cpp-standard/README.adoc | 0 .../i-common-method/CMakeLists.txt | 0 .../i-common-method/README.adoc | 0 .../L-cpp-standard/i-common-method/main.cpp | 0 .../ii-cxx-standard/CMakeLists.txt | 0 .../ii-cxx-standard/README.adoc | 0 .../L-cpp-standard/ii-cxx-standard/main.cpp | 0 .../iii-compile-features/CMakeLists.txt | 0 .../iii-compile-features/README.adoc | 0 .../iii-compile-features/main.cpp | 0 .../cmake-examples}/01-basic/README.adoc | 0 .../02-sub-projects/A-basic/CMakeLists.txt | 0 .../02-sub-projects/A-basic/README.adoc | 0 .../A-basic/subbinary/CMakeLists.txt | 0 .../A-basic/subbinary/main.cpp | 0 .../A-basic/sublibrary1/CMakeLists.txt | 0 .../sublibrary1/include/sublib1/sublib1.h | 0 .../A-basic/sublibrary1/src/sublib1.cpp | 0 .../A-basic/sublibrary2/CMakeLists.txt | 0 .../sublibrary2/include/sublib2/sublib2.h | 0 .../02-sub-projects/README.adoc | 0 .../03-code-generation/README.adoc | 0 .../configure-files/CMakeLists.txt | 0 .../configure-files/README.adoc | 0 .../configure-files/main.cpp | 0 .../configure-files/path.h.in | 0 .../configure-files/ver.h.in | 0 .../protobuf/AddressBook.proto | 0 .../protobuf/CMakeLists.txt | 0 .../03-code-generation/protobuf/README.adoc | 0 .../03-code-generation/protobuf/main.cpp | 0 .../04-static-analysis/README.adoc | 0 .../clang-analyzer/CMakeLists.txt | 0 .../clang-analyzer/README.adoc | 0 .../clang-analyzer/run_test.sh | 0 .../clang-analyzer/subproject1/CMakeLists.txt | 0 .../clang-analyzer/subproject1/main1.cpp | 0 .../clang-analyzer/subproject2/CMakeLists.txt | 0 .../clang-analyzer/subproject2/main2.cpp | 0 .../clang-format/.clang-format | 0 .../clang-format/CMakeLists.txt | 0 .../clang-format/README.adoc | 0 .../cmake/modules/FindClangFormat.cmake | 0 .../cmake/modules/clang-format.cmake | 0 .../cmake/scripts/clang-format-check-changed | 0 .../scripts/clang-format-check-changed.py | 0 .../clang-format/run_test.sh | 0 .../clang-format/subproject1/CMakeLists.txt | 0 .../clang-format/subproject1/main1.cpp | 0 .../clang-format/subproject2/CMakeLists.txt | 0 .../clang-format/subproject2/main2.cpp | 0 .../.cppcheck_suppressions | 0 .../cppcheck-compile-commands/CMakeLists.txt | 0 .../cppcheck-compile-commands/README.adoc | 0 .../cmake/modules/FindCppCheck.cmake | 0 .../cppcheck-compile-commands/run_test.sh | 0 .../subproject1/CMakeLists.txt | 0 .../subproject1/main1.cpp | 0 .../subproject2/CMakeLists.txt | 0 .../subproject2/main2.cpp | 0 .../cppcheck/CMakeLists.txt | 0 .../04-static-analysis/cppcheck/README.adoc | 0 .../cppcheck/cmake/analysis.cmake | 0 .../cppcheck/cmake/modules/FindCppCheck.cmake | 0 .../04-static-analysis/cppcheck/run_test.sh | 0 .../cppcheck/subproject1/CMakeLists.txt | 0 .../cppcheck/subproject1/main1.cpp | 0 .../cppcheck/subproject2/CMakeLists.txt | 0 .../cppcheck/subproject2/main2.cpp | 0 .../05-unit-testing/README.adoc | 0 .../05-unit-testing/boost/CMakeLists.txt | 0 .../05-unit-testing/boost/Palindrome.cpp | 0 .../05-unit-testing/boost/Palindrome.h | 0 .../05-unit-testing/boost/README.adoc | 0 .../05-unit-testing/boost/Reverse.cpp | 0 .../05-unit-testing/boost/Reverse.h | 0 .../05-unit-testing/boost/main.cpp | 0 .../05-unit-testing/boost/post_test.sh | 0 .../05-unit-testing/boost/unit_tests.cpp | 0 .../3rd_party/catch2/CMakeLists.txt | 0 .../3rd_party/catch2/catch2/catch.hpp | 0 .../catch2-vendored/CMakeLists.txt | 0 .../catch2-vendored/Palindrome.cpp | 0 .../catch2-vendored/Palindrome.h | 0 .../catch2-vendored/README.adoc | 0 .../catch2-vendored/Reverse.cpp | 0 .../05-unit-testing/catch2-vendored/Reverse.h | 0 .../05-unit-testing/catch2-vendored/main.cpp | 0 .../catch2-vendored/post_test.sh | 0 .../catch2-vendored/unit_tests.cpp | 0 .../3rd_party/google-test/CMakeLists.txt | 0 .../3rd_party/google-test/CMakeLists.txt.in | 0 .../google-test-download/CMakeLists.txt | 0 .../google-test-download/Palindrome.cpp | 0 .../google-test-download/Palindrome.h | 0 .../google-test-download/README.adoc | 0 .../google-test-download/Reverse.cpp | 0 .../google-test-download/Reverse.h | 0 .../google-test-download/main.cpp | 0 .../google-test-download/post_test.sh | 0 .../google-test-download/run_test.sh | 0 .../google-test-download/unit_tests.cpp | 0 .../cmake-examples}/06-installer/README.adoc | 0 .../06-installer/deb/CMakeLists.txt | 0 .../06-installer/deb/README.adoc | 0 .../06-installer/deb/cmake-examples.conf | 0 .../06-installer/deb/include/Hello.h | 0 .../06-installer/deb/post_test.sh | 0 .../06-installer/deb/src/Hello.cpp | 0 .../06-installer/deb/src/main.cpp | 0 .../README.adoc | 0 .../B-vendoring-code/README.adoc | 0 .../C-external-project-add/README.adoc | 0 .../07-package-management/D-conan/README.adoc | 0 .../D-conan/i-basic/CMakeLists.txt | 0 .../D-conan/i-basic/README.adoc | 0 .../D-conan/i-basic/conanfile.txt | 0 .../D-conan/i-basic/main.cpp | 0 .../D-conan/i-basic/run_test.sh | 0 .../D-conan/ii-basic-targets/CMakeLists.txt | 0 .../D-conan/ii-basic-targets/README.adoc | 0 .../D-conan/ii-basic-targets/conanfile.txt | 0 .../D-conan/ii-basic-targets/main.cpp | 0 .../D-conan/ii-basic-targets/run_test.sh | 0 .../07-package-management/README.adoc | 0 .../cmake/cmake-examples}/LICENSE | 0 .../cmake/cmake-examples}/README.adoc | 0 .../cmake-examples.sublime-project | 0 .../cmake-examples}/dockerfiles/README.adoc | 0 .../cmake-examples}/dockerfiles/setup.sh | 0 .../dockerfiles/ubuntu14.04-cmake-3.4.3 | 0 .../dockerfiles/ubuntu14.04-default-2.8.12.2 | 0 .../dockerfiles/ubuntu16.04-cmake-3.10.3 | 0 .../ubuntu16.04-default-cmake-3.5.1 | 0 .../cmake/cmake-examples}/test.sh | 0 {cmake => make/cmake}/r/CMakeLists.txt | 0 {cmake => make/cmake}/r/main.c | 52 +-- .../cmake}/r/resistor/CMakeLists.txt | 0 {cmake => make/cmake}/r/resistor/build.sh | 0 .../cmake/r}/resistor/resistorcal.c | 18 +- .../cmake/r}/resistor/resistorcal.h | 8 +- {cmake => make/cmake}/r1/CMakeLists.txt | 0 {cmake => make/cmake}/r1/main.c | 52 +-- .../cmake}/r1/resistor/CMakeLists.txt | 0 {cmake => make/cmake}/r1/resistor/build.sh | 0 .../cmake/r1}/resistor/resistorcal.c | 18 +- .../cmake/r1}/resistor/resistorcal.h | 8 +- submodule/CMakeTutorial | 1 + {c => submodule}/GenericMakefile | 0 cmake/examples => submodule/cmake-examples | 0 250 files changed, 2086 insertions(+), 78 deletions(-) rename {cmake => make}/GenericMakefile/.gitignore (100%) rename {cmake => make}/GenericMakefile/LICENSE (100%) rename {cmake => make}/GenericMakefile/README.md (100%) rename {cmake => make}/GenericMakefile/c/hello.c (100%) rename {cmake => make}/GenericMakefile/cpp/hello.cpp (100%) create mode 100644 make/cmake/CMakeTutorial/.gitignore create mode 100644 make/cmake/CMakeTutorial/.gitmodules create mode 100644 make/cmake/CMakeTutorial/CUDA/CMakeLists.txt create mode 100644 make/cmake/CMakeTutorial/CUDA/README.md create mode 100644 make/cmake/CMakeTutorial/CUDA/cmake/FindcuBLAS.cmake create mode 100644 make/cmake/CMakeTutorial/CUDA/cublasMatMul.cu create mode 100644 make/cmake/CMakeTutorial/CUDA/cudaMatMul.cu create mode 100644 make/cmake/CMakeTutorial/CUDA/cudaMatMul.h create mode 100644 make/cmake/CMakeTutorial/CUDA/imgs/cmake_cuda_support.png create mode 100644 make/cmake/CMakeTutorial/CUDA/main.cc create mode 100644 make/cmake/CMakeTutorial/FindPackage/CMakeLists.txt create mode 100644 make/cmake/CMakeTutorial/FindPackage/ModuleMode/libadd.cc create mode 100644 make/cmake/CMakeTutorial/FindPackage/ModuleMode/libadd.h create mode 100644 make/cmake/CMakeTutorial/FindPackage/README.md create mode 100644 make/cmake/CMakeTutorial/FindPackage/addtest.cc create mode 100644 make/cmake/CMakeTutorial/FindPackage/cmake/FindADD.cmake create mode 100644 make/cmake/CMakeTutorial/FindPackage/curltest.cc create mode 100644 make/cmake/CMakeTutorial/FindPackage/glogtest.cc create mode 100644 make/cmake/CMakeTutorial/ImportExternalProject/CMakeLists.txt create mode 100644 make/cmake/CMakeTutorial/ImportExternalProject/README.md create mode 100644 make/cmake/CMakeTutorial/ImportExternalProject/cmake/FetchContentMakeAvaliable.cmake create mode 100644 make/cmake/CMakeTutorial/ImportExternalProject/cmake/spdlog.cmake create mode 100644 make/cmake/CMakeTutorial/ImportExternalProject/cmake/spdlog2.cmake create mode 100644 make/cmake/CMakeTutorial/ImportExternalProject/testspdlog.cc create mode 100644 make/cmake/CMakeTutorial/Installation/CMakeLists.txt create mode 100644 make/cmake/CMakeTutorial/Installation/MyMathConfig.cmake.in create mode 100644 make/cmake/CMakeTutorial/Installation/README.md create mode 100644 make/cmake/CMakeTutorial/Installation/include/mymath.h create mode 100644 make/cmake/CMakeTutorial/Installation/mymath.cc create mode 100644 make/cmake/CMakeTutorial/Installation/mymathApp.cc create mode 100644 make/cmake/CMakeTutorial/Installation/test_folder/CMakeLists.txt create mode 100644 make/cmake/CMakeTutorial/Installation/test_folder/mymathApp.cc create mode 100644 make/cmake/CMakeTutorial/LICENSE create mode 100644 make/cmake/CMakeTutorial/PackageManage/CMakeLists.txt create mode 100644 make/cmake/CMakeTutorial/PackageManage/DisplayImage.cpp create mode 100644 make/cmake/CMakeTutorial/PackageManage/README.md create mode 100644 make/cmake/CMakeTutorial/PythonExtention/CMakeLists.txt create mode 100644 make/cmake/CMakeTutorial/PythonExtention/README.md create mode 100644 make/cmake/CMakeTutorial/PythonExtention/python_matrix.cc create mode 100644 make/cmake/CMakeTutorial/PythonExtention/setup.py create mode 100644 make/cmake/CMakeTutorial/PythonExtention/stub.cc create mode 100644 make/cmake/CMakeTutorial/PythonExtention/test_matrix.py create mode 100644 make/cmake/CMakeTutorial/README.md create mode 100644 make/cmake/CMakeTutorial/_config.yml rename {cmake/example => make/cmake/cmake-examples}/.gitignore (100%) rename {cmake/example => make/cmake/cmake-examples}/.travis.yml (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/A-hello-cmake/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/A-hello-cmake/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/A-hello-cmake/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/B-hello-headers/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/B-hello-headers/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/B-hello-headers/include/Hello.h (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/B-hello-headers/src/Hello.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/B-hello-headers/src/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/C-static-library/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/C-static-library/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/C-static-library/include/static/Hello.h (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/C-static-library/src/Hello.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/C-static-library/src/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/D-shared-library/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/D-shared-library/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/D-shared-library/include/shared/Hello.h (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/D-shared-library/src/Hello.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/D-shared-library/src/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/E-installing/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/E-installing/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/E-installing/cmake-examples.conf (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/E-installing/include/installing/Hello.h (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/E-installing/src/Hello.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/E-installing/src/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/F-build-type/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/F-build-type/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/F-build-type/cmake-gui-build-type.png (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/F-build-type/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/G-compile-flags/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/G-compile-flags/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/G-compile-flags/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/H-third-party-library/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/H-third-party-library/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/H-third-party-library/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/I-compiling-with-clang/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/I-compiling-with-clang/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/I-compiling-with-clang/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/I-compiling-with-clang/pre_test.sh (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/01-basic/I-compiling-with-clang/run_test.sh (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/01-basic/J-building-with-ninja/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/J-building-with-ninja/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/J-building-with-ninja/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/J-building-with-ninja/pre_test.sh (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/01-basic/J-building-with-ninja/run_test.sh (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/01-basic/K-imported-targets/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/K-imported-targets/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/K-imported-targets/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/K-imported-targets/run_test.sh (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/01-basic/L-cpp-standard/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/L-cpp-standard/i-common-method/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/L-cpp-standard/i-common-method/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/L-cpp-standard/i-common-method/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/L-cpp-standard/ii-cxx-standard/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/L-cpp-standard/ii-cxx-standard/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/L-cpp-standard/ii-cxx-standard/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/L-cpp-standard/iii-compile-features/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/L-cpp-standard/iii-compile-features/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/L-cpp-standard/iii-compile-features/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/01-basic/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/02-sub-projects/A-basic/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/02-sub-projects/A-basic/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/02-sub-projects/A-basic/subbinary/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/02-sub-projects/A-basic/subbinary/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/02-sub-projects/A-basic/sublibrary1/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/02-sub-projects/A-basic/sublibrary1/include/sublib1/sublib1.h (100%) rename {cmake/example => make/cmake/cmake-examples}/02-sub-projects/A-basic/sublibrary1/src/sublib1.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/02-sub-projects/A-basic/sublibrary2/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/02-sub-projects/A-basic/sublibrary2/include/sublib2/sublib2.h (100%) rename {cmake/example => make/cmake/cmake-examples}/02-sub-projects/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/03-code-generation/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/03-code-generation/configure-files/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/03-code-generation/configure-files/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/03-code-generation/configure-files/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/03-code-generation/configure-files/path.h.in (100%) rename {cmake/example => make/cmake/cmake-examples}/03-code-generation/configure-files/ver.h.in (100%) rename {cmake/example => make/cmake/cmake-examples}/03-code-generation/protobuf/AddressBook.proto (100%) rename {cmake/example => make/cmake/cmake-examples}/03-code-generation/protobuf/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/03-code-generation/protobuf/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/03-code-generation/protobuf/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-analyzer/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-analyzer/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-analyzer/run_test.sh (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-analyzer/subproject1/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-analyzer/subproject1/main1.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-analyzer/subproject2/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-analyzer/subproject2/main2.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-format/.clang-format (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-format/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-format/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-format/cmake/modules/FindClangFormat.cmake (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-format/cmake/modules/clang-format.cmake (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed.py (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-format/run_test.sh (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-format/subproject1/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-format/subproject1/main1.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-format/subproject2/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/clang-format/subproject2/main2.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck-compile-commands/.cppcheck_suppressions (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck-compile-commands/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck-compile-commands/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck-compile-commands/cmake/modules/FindCppCheck.cmake (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck-compile-commands/run_test.sh (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck-compile-commands/subproject1/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck-compile-commands/subproject1/main1.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck-compile-commands/subproject2/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck-compile-commands/subproject2/main2.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck/cmake/analysis.cmake (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck/cmake/modules/FindCppCheck.cmake (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck/run_test.sh (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck/subproject1/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck/subproject1/main1.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck/subproject2/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/04-static-analysis/cppcheck/subproject2/main2.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/boost/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/boost/Palindrome.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/boost/Palindrome.h (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/boost/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/boost/Reverse.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/boost/Reverse.h (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/boost/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/boost/post_test.sh (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/boost/unit_tests.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/catch2-vendored/3rd_party/catch2/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/catch2-vendored/3rd_party/catch2/catch2/catch.hpp (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/catch2-vendored/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/catch2-vendored/Palindrome.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/catch2-vendored/Palindrome.h (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/catch2-vendored/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/catch2-vendored/Reverse.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/catch2-vendored/Reverse.h (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/catch2-vendored/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/catch2-vendored/post_test.sh (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/catch2-vendored/unit_tests.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt.in (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/google-test-download/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/google-test-download/Palindrome.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/google-test-download/Palindrome.h (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/google-test-download/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/google-test-download/Reverse.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/google-test-download/Reverse.h (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/google-test-download/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/google-test-download/post_test.sh (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/google-test-download/run_test.sh (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/05-unit-testing/google-test-download/unit_tests.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/06-installer/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/06-installer/deb/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/06-installer/deb/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/06-installer/deb/cmake-examples.conf (100%) rename {cmake/example => make/cmake/cmake-examples}/06-installer/deb/include/Hello.h (100%) rename {cmake/example => make/cmake/cmake-examples}/06-installer/deb/post_test.sh (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/06-installer/deb/src/Hello.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/06-installer/deb/src/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/07-package-management/A-using-system-provide-packages/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/07-package-management/B-vendoring-code/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/07-package-management/C-external-project-add/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/07-package-management/D-conan/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/07-package-management/D-conan/i-basic/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/07-package-management/D-conan/i-basic/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/07-package-management/D-conan/i-basic/conanfile.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/07-package-management/D-conan/i-basic/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/07-package-management/D-conan/i-basic/run_test.sh (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/07-package-management/D-conan/ii-basic-targets/CMakeLists.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/07-package-management/D-conan/ii-basic-targets/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/07-package-management/D-conan/ii-basic-targets/conanfile.txt (100%) rename {cmake/example => make/cmake/cmake-examples}/07-package-management/D-conan/ii-basic-targets/main.cpp (100%) rename {cmake/example => make/cmake/cmake-examples}/07-package-management/D-conan/ii-basic-targets/run_test.sh (100%) mode change 100755 => 100644 rename {cmake/example => make/cmake/cmake-examples}/07-package-management/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/LICENSE (100%) rename {cmake/example => make/cmake/cmake-examples}/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/cmake-examples.sublime-project (100%) rename {cmake/example => make/cmake/cmake-examples}/dockerfiles/README.adoc (100%) rename {cmake/example => make/cmake/cmake-examples}/dockerfiles/setup.sh (100%) rename {cmake/example => make/cmake/cmake-examples}/dockerfiles/ubuntu14.04-cmake-3.4.3 (100%) rename {cmake/example => make/cmake/cmake-examples}/dockerfiles/ubuntu14.04-default-2.8.12.2 (100%) rename {cmake/example => make/cmake/cmake-examples}/dockerfiles/ubuntu16.04-cmake-3.10.3 (100%) rename {cmake/example => make/cmake/cmake-examples}/dockerfiles/ubuntu16.04-default-cmake-3.5.1 (100%) rename {cmake/example => make/cmake/cmake-examples}/test.sh (100%) mode change 100755 => 100644 rename {cmake => make/cmake}/r/CMakeLists.txt (100%) rename {cmake => make/cmake}/r/main.c (97%) rename {cmake => make/cmake}/r/resistor/CMakeLists.txt (100%) rename {cmake => make/cmake}/r/resistor/build.sh (100%) rename {cmake/r1 => make/cmake/r}/resistor/resistorcal.c (96%) rename {cmake/r1 => make/cmake/r}/resistor/resistorcal.h (96%) rename {cmake => make/cmake}/r1/CMakeLists.txt (100%) rename {cmake => make/cmake}/r1/main.c (97%) rename {cmake => make/cmake}/r1/resistor/CMakeLists.txt (100%) rename {cmake => make/cmake}/r1/resistor/build.sh (100%) rename {cmake/r => make/cmake/r1}/resistor/resistorcal.c (96%) rename {cmake/r => make/cmake/r1}/resistor/resistorcal.h (96%) create mode 160000 submodule/CMakeTutorial rename {c => submodule}/GenericMakefile (100%) rename cmake/examples => submodule/cmake-examples (100%) diff --git a/.gitmodules b/.gitmodules index 318f01c..70cd533 100644 --- a/.gitmodules +++ b/.gitmodules @@ -5,3 +5,12 @@ [submodule "cmake/examples"] path = cmake/examples url = https://github.com/ttroy50/cmake-examples.git +[submodule "submodule/cmake-examples"] + path = submodule/cmake-examples + url = https://github.com/ttroy50/cmake-examples +[submodule "submodule/GenericMakefile"] + path = submodule/GenericMakefile + url = https://github.com/mbcrawfo/GenericMakefile +[submodule "submodule/CMakeTutorial"] + path = submodule/CMakeTutorial + url = https://github.com/BrightXiaoHan/CMakeTutorial diff --git a/cmake/GenericMakefile/.gitignore b/make/GenericMakefile/.gitignore similarity index 100% rename from cmake/GenericMakefile/.gitignore rename to make/GenericMakefile/.gitignore diff --git a/cmake/GenericMakefile/LICENSE b/make/GenericMakefile/LICENSE similarity index 100% rename from cmake/GenericMakefile/LICENSE rename to make/GenericMakefile/LICENSE diff --git a/cmake/GenericMakefile/README.md b/make/GenericMakefile/README.md similarity index 100% rename from cmake/GenericMakefile/README.md rename to make/GenericMakefile/README.md diff --git a/cmake/GenericMakefile/c/hello.c b/make/GenericMakefile/c/hello.c similarity index 100% rename from cmake/GenericMakefile/c/hello.c rename to make/GenericMakefile/c/hello.c diff --git a/cmake/GenericMakefile/cpp/hello.cpp b/make/GenericMakefile/cpp/hello.cpp similarity index 100% rename from cmake/GenericMakefile/cpp/hello.cpp rename to make/GenericMakefile/cpp/hello.cpp diff --git a/make/cmake/CMakeTutorial/.gitignore b/make/cmake/CMakeTutorial/.gitignore new file mode 100644 index 0000000..a9c9391 --- /dev/null +++ b/make/cmake/CMakeTutorial/.gitignore @@ -0,0 +1,42 @@ +# Prerequisites +*.d + +# Compiled Object files +*.slo +*.lo +*.o +*.obj + +# Precompiled Headers +*.gch +*.pch + +# Compiled Dynamic libraries +*.so +*.dylib +*.dll + +# Fortran module files +*.mod +*.smod + +# Compiled Static libraries +*.lai +*.la +*.a +*.lib + +# Executables +*.exe +*.out +*.app + +# Generate Config files +src/config +include/config + +# ide +.vscode + +# build +build/ \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/.gitmodules b/make/cmake/CMakeTutorial/.gitmodules new file mode 100644 index 0000000..a591fb1 --- /dev/null +++ b/make/cmake/CMakeTutorial/.gitmodules @@ -0,0 +1,3 @@ +[submodule "ImportExternalProject/spdlog"] + path = ImportExternalProject/spdlog + url = https://github.com/gabime/spdlog.git diff --git a/make/cmake/CMakeTutorial/CUDA/CMakeLists.txt b/make/cmake/CMakeTutorial/CUDA/CMakeLists.txt new file mode 100644 index 0000000..0136b5b --- /dev/null +++ b/make/cmake/CMakeTutorial/CUDA/CMakeLists.txt @@ -0,0 +1,14 @@ +cmake_minimum_required(VERSION 3.8) +project(CUDA_MAT_MUL LANGUAGES CXX CUDA) + +add_library(cudaMatMul cudaMatMul.cu cudaMatMul.h) +target_compile_features(cudaMatMul PUBLIC cxx_std_11) + +add_executable(main main.cc) +target_link_libraries(main cudaMatMul) + +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}") +find_package(cuBLAS) +add_executable(cublasMatMul cublasMatMul.cu) +target_compile_features(cublasMatMul PRIVATE cxx_std_11) +target_link_libraries(cublasMatMul PRIVATE ${CUBLAS_LIBRARIES}) \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/CUDA/README.md b/make/cmake/CMakeTutorial/CUDA/README.md new file mode 100644 index 0000000..b892b5a --- /dev/null +++ b/make/cmake/CMakeTutorial/CUDA/README.md @@ -0,0 +1,130 @@ +# CMake 编写 CUDA 应用程序 +从cmake 3.9版本开始,cmake就原生支持了cuda c/c++。再这之前,是通过find_package(CUDA REQUIRED)来间接支持cuda c/c++的。这种写法不仅繁琐而且丑陋。所以这里主要介绍3.9版本之后引入的方法,cuda c/c++程序可以使用和普通的c/c++程序完全一样的操作,甚至两者可以混合使用,非常的方便,清晰明了。 +![](./imgs/cmake_cuda_support.png) +本文便通过一个例子(矩阵乘法运算)来具体讲解。 + +## 准备工作 +#### 安装cuda driver与cuda toolkit +具体参考nvidia官方文档,这里不再赘述。 +安装完成后测试nvcc命令是否可以正常运行 +```bash +nvcc --version +``` +如果不能正常运行,将cudatoolkit下的bin目录加入到环境变量中(linux下通常为/usr/local/cuda/bin) + +## 开启CUDA支持的选项 +想要cmake支持.cu文件的编译,需要在CMakeLists.txt中开启CUDA的支持选项 +```cmake +project(CUDA_MAT_MUL LANGUAGES CXX CUDA) +``` +如果需要编译选项支持是否开启cuda支持(即cuda为可选项),也可以使用如下方法 +```cmake +project(CUDA_MAT_MUL) +if(CUDA_ENABLE) + enable_language(CUDA) +endif() +``` +你可以像往常一样添加一个库 +``` +add_library(cudaMatMul cudaMatMul.cu cudaMatMul.h) +target_compile_features(cudaMatMul PUBLIC cxx_std_11) +``` +可以链接到普通的c++程序中 +``` +add_executable(main main.cc) +target_link_libraries(main cudaMatMul) +``` + +## 引入cuda依赖库 +如果我们想引入英伟达官方或者第三方的cuda库时,我们也可以编写一个供find_package调用的模块。这里以引入cublas库为例,新建一个FindcuBLAS.cmake(参考Github [CLblast](https://github.com/CNugteren/CLBlast/blob/master/cmake/Modules/FindcuBLAS.cmake)) +```cmake +# ================================================================================================== +# This file is part of the cuBLASt project. The project is licensed under Apache Version 2.0. This +# project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max- +# width of 100 characters per line. +# +# Author(s): +# Cedric Nugteren +# +# ================================================================================================== +# +# Defines the following variables: +# CUBLAS_FOUND Boolean holding whether or not the cuBLAS library was found +# CUBLAS_INCLUDE_DIRS The CUDA and cuBLAS include directory +# CUDA_LIBRARIES The CUDA library +# CUBLAS_LIBRARIES The cuBLAS library +# +# In case CUDA is not installed in the default directory, set the CUDA_ROOT variable to point to +# the root of cuBLAS, such that 'cublas_v2.h' can be found in $CUDA_ROOT/include. This can either be +# done using an environmental variable (e.g. export CUDA_ROOT=/path/to/cuBLAS) or using a CMake +# variable (e.g. cmake -DCUDA_ROOT=/path/to/cuBLAS ..). +# +# ================================================================================================== + +# Sets the possible install locations +set(CUBLAS_HINTS + ${CUDA_ROOT} + $ENV{CUDA_ROOT} + $ENV{CUDA_TOOLKIT_ROOT_DIR} +) +set(CUBLAS_PATHS + /usr + /usr/local + /usr/local/cuda +) + +# Finds the include directories +find_path(CUBLAS_INCLUDE_DIRS + NAMES cublas_v2.h cuda.h + HINTS ${CUBLAS_HINTS} + PATH_SUFFIXES include inc include/x86_64 include/x64 + PATHS ${CUBLAS_PATHS} + DOC "cuBLAS include header cublas_v2.h" +) +mark_as_advanced(CUBLAS_INCLUDE_DIRS) + +# Finds the libraries +find_library(CUDA_LIBRARIES + NAMES cudart + HINTS ${CUBLAS_HINTS} + PATH_SUFFIXES lib lib64 lib/x86_64 lib/x64 lib/x86 lib/Win32 lib/import lib64/import + PATHS ${CUBLAS_PATHS} + DOC "CUDA library" +) +mark_as_advanced(CUDA_LIBRARIES) +find_library(CUBLAS_LIBRARIES + NAMES cublas + HINTS ${CUBLAS_HINTS} + PATH_SUFFIXES lib lib64 lib/x86_64 lib/x64 lib/x86 lib/Win32 lib/import lib64/import + PATHS ${CUBLAS_PATHS} + DOC "cuBLAS library" +) +mark_as_advanced(CUBLAS_LIBRARIES) + +# ================================================================================================== + +# Notification messages +if(NOT CUBLAS_INCLUDE_DIRS) + message(STATUS "Could NOT find 'cuBLAS.h', install CUDA/cuBLAS or set CUDA_ROOT") +endif() +if(NOT CUDA_LIBRARIES) + message(STATUS "Could NOT find CUDA library, install it or set CUDA_ROOT") +endif() +if(NOT CUBLAS_LIBRARIES) + message(STATUS "Could NOT find cuBLAS library, install it or set CUDA_ROOT") +endif() + +# Determines whether or not cuBLAS was found +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(cuBLAS DEFAULT_MSG CUBLAS_INCLUDE_DIRS CUDA_LIBRARIES CUBLAS_LIBRARIES) + +# ================================================================================================== +``` +当我们编写需要依赖cublas库的程序时便可以这样写 +```cmake +find_package(cuBLAS) +add_executable(cublasMatMul cublasMatMul.cu) +target_compile_features(cublasMatMul PRIVATE cxx_std_11) +target_link_libraries(cublasMatMul PRIVATE ${CUBLAS_LIBRARIES}) +``` +完全和编写普通c++程序一样的体验,非常棒。 \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/CUDA/cmake/FindcuBLAS.cmake b/make/cmake/CMakeTutorial/CUDA/cmake/FindcuBLAS.cmake new file mode 100644 index 0000000..d59b399 --- /dev/null +++ b/make/cmake/CMakeTutorial/CUDA/cmake/FindcuBLAS.cmake @@ -0,0 +1,81 @@ +# ================================================================================================== +# This file is part of the cuBLASt project. The project is licensed under Apache Version 2.0. This +# project loosely follows the Google C++ styleguide and uses a tab-size of two spaces and a max- +# width of 100 characters per line. +# +# Author(s): +# Cedric Nugteren +# +# ================================================================================================== +# +# Defines the following variables: +# CUBLAS_FOUND Boolean holding whether or not the cuBLAS library was found +# CUBLAS_INCLUDE_DIRS The CUDA and cuBLAS include directory +# CUDA_LIBRARIES The CUDA library +# CUBLAS_LIBRARIES The cuBLAS library +# +# In case CUDA is not installed in the default directory, set the CUDA_ROOT variable to point to +# the root of cuBLAS, such that 'cublas_v2.h' can be found in $CUDA_ROOT/include. This can either be +# done using an environmental variable (e.g. export CUDA_ROOT=/path/to/cuBLAS) or using a CMake +# variable (e.g. cmake -DCUDA_ROOT=/path/to/cuBLAS ..). +# +# ================================================================================================== + +# Sets the possible install locations +set(CUBLAS_HINTS + ${CUDA_ROOT} + $ENV{CUDA_ROOT} + $ENV{CUDA_TOOLKIT_ROOT_DIR} +) +set(CUBLAS_PATHS + /usr + /usr/local + /usr/local/cuda +) + +# Finds the include directories +find_path(CUBLAS_INCLUDE_DIRS + NAMES cublas_v2.h cuda.h + HINTS ${CUBLAS_HINTS} + PATH_SUFFIXES include inc include/x86_64 include/x64 + PATHS ${CUBLAS_PATHS} + DOC "cuBLAS include header cublas_v2.h" +) +mark_as_advanced(CUBLAS_INCLUDE_DIRS) + +# Finds the libraries +find_library(CUDA_LIBRARIES + NAMES cudart + HINTS ${CUBLAS_HINTS} + PATH_SUFFIXES lib lib64 lib/x86_64 lib/x64 lib/x86 lib/Win32 lib/import lib64/import + PATHS ${CUBLAS_PATHS} + DOC "CUDA library" +) +mark_as_advanced(CUDA_LIBRARIES) +find_library(CUBLAS_LIBRARIES + NAMES cublas + HINTS ${CUBLAS_HINTS} + PATH_SUFFIXES lib lib64 lib/x86_64 lib/x64 lib/x86 lib/Win32 lib/import lib64/import + PATHS ${CUBLAS_PATHS} + DOC "cuBLAS library" +) +mark_as_advanced(CUBLAS_LIBRARIES) + +# ================================================================================================== + +# Notification messages +if(NOT CUBLAS_INCLUDE_DIRS) + message(STATUS "Could NOT find 'cuBLAS.h', install CUDA/cuBLAS or set CUDA_ROOT") +endif() +if(NOT CUDA_LIBRARIES) + message(STATUS "Could NOT find CUDA library, install it or set CUDA_ROOT") +endif() +if(NOT CUBLAS_LIBRARIES) + message(STATUS "Could NOT find cuBLAS library, install it or set CUDA_ROOT") +endif() + +# Determines whether or not cuBLAS was found +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(cuBLAS DEFAULT_MSG CUBLAS_INCLUDE_DIRS CUDA_LIBRARIES CUBLAS_LIBRARIES) + +# ================================================================================================== \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/CUDA/cublasMatMul.cu b/make/cmake/CMakeTutorial/CUDA/cublasMatMul.cu new file mode 100644 index 0000000..c45cd2b --- /dev/null +++ b/make/cmake/CMakeTutorial/CUDA/cublasMatMul.cu @@ -0,0 +1,71 @@ +#include +#include +#include +#include +#include +#include + +using namespace std; +using namespace std::chrono; + +#define M 10000 +#define K 1000 +#define N 10000 + +int main() +{ + double *A = new double[M * K]; + double *B = new double[K * N]; + double *C = new double[M * N]; + + for (int i = 0; i < M * K; i++) + { + A[i] = sin(i); + } + + for (int i = 0; i < K*N; i++){ + B[i] = cos(i); + } + + for (int i = 0; i < M * N; i++) + { + C[i] = 0.5; + } + + cublasStatus_t stat; + cudaError_t cudaStat; + cublasHandle_t handle; // CUBLAS context + + double *d_A; + double *d_B; + double *d_C; + cudaStat = cudaMalloc((void **)&d_A, M * K * sizeof(*A)); + cudaStat = cudaMalloc((void **)&d_B, K * N * sizeof(*B)); + cudaStat = cudaMalloc((void **)&d_C, M * N * sizeof(*C)); + + stat = cublasCreate(&handle); // initialize CUBLAS context + + // copy matrices from the host to the device + stat = cublasSetMatrix(M, K, sizeof(*A), A, M, d_A, M); //a -> d_a + stat = cublasSetMatrix(K, N, sizeof(*B), B, K, d_B, K); //b -> d_b + stat = cublasSetMatrix(M, N, sizeof(*C), C, M, d_C, M); //c -> d_c + + auto startTime = high_resolution_clock::now(); + double alpha = 1.0; + double beta = 1.0; + stat = cublasDgemm(handle, CUBLAS_OP_N, CUBLAS_OP_N, M, N, K, &alpha, d_A, + M, d_B, K, &beta, d_C, M); + cudaDeviceSynchronize(); + auto endTime = high_resolution_clock::now(); + auto duration = duration_cast(endTime - startTime); + cout << "cblas计算用时" <c + cudaFree(d_A); // free device memory + cudaFree(d_B); // free device memory + cudaFree(d_C); // free device memory + cublasDestroy(handle); // destroy CUBLAS context + free(A); + free(B); + free(C); +} \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/CUDA/cudaMatMul.cu b/make/cmake/CMakeTutorial/CUDA/cudaMatMul.cu new file mode 100644 index 0000000..37dd65e --- /dev/null +++ b/make/cmake/CMakeTutorial/CUDA/cudaMatMul.cu @@ -0,0 +1,132 @@ +#include "cudaMatMul.h" + +#define BLOCK_SIZE 16 + +// Get a matrix element +__device__ float GetElement(const Matrix A, int row, int col) +{ + return A.elements[row * A.stride + col]; +} + +// Set a matrix element +__device__ void SetElement(Matrix A, int row, int col, + float value) +{ + A.elements[row * A.stride + col] = value; +} + +// Get the BLOCK_SIZExBLOCK_SIZE sub-matrix Asub of A that is +// located col sub-matrices to the right and row sub-matrices down +// from the upper-left corner of A + __device__ Matrix GetSubMatrix(Matrix A, int row, int col) +{ + Matrix Asub; + Asub.width = BLOCK_SIZE; + Asub.height = BLOCK_SIZE; + Asub.stride = A.stride; + Asub.elements = &A.elements[A.stride * BLOCK_SIZE * row + + BLOCK_SIZE * col]; + return Asub; +} + +// Thread block size +#define BLOCK_SIZE 16 + +// Forward declaration of the matrix multiplication kernel +__global__ void MatMulKernel(const Matrix, const Matrix, Matrix); + +// Matrix multiplication - Host code +// Matrix dimensions are assumed to be multiples of BLOCK_SIZE +void MatMul(const Matrix A, const Matrix B, Matrix C) +{ + // Load A and B to device memory + Matrix d_A; + d_A.width = d_A.stride = A.width; d_A.height = A.height; + size_t size = A.width * A.height * sizeof(float); + cudaMalloc(&d_A.elements, size); + cudaMemcpy(d_A.elements, A.elements, size, + cudaMemcpyHostToDevice); + Matrix d_B; + d_B.width = d_B.stride = B.width; d_B.height = B.height; + size = B.width * B.height * sizeof(float); + cudaMalloc(&d_B.elements, size); + cudaMemcpy(d_B.elements, B.elements, size, + cudaMemcpyHostToDevice); + + // Allocate C in device memory + Matrix d_C; + d_C.width = d_C.stride = C.width; d_C.height = C.height; + size = C.width * C.height * sizeof(float); + cudaMalloc(&d_C.elements, size); + + // Invoke kernel + dim3 dimBlock(BLOCK_SIZE, BLOCK_SIZE); + dim3 dimGrid(B.width / dimBlock.x, A.height / dimBlock.y); + MatMulKernel<<>>(d_A, d_B, d_C); + + // Read C from device memory + cudaMemcpy(C.elements, d_C.elements, size, + cudaMemcpyDeviceToHost); + + // Free device memory + cudaFree(d_A.elements); + cudaFree(d_B.elements); + cudaFree(d_C.elements); +} + +// Matrix multiplication kernel called by MatMul() + __global__ void MatMulKernel(Matrix A, Matrix B, Matrix C) +{ + // Block row and column + int blockRow = blockIdx.y; + int blockCol = blockIdx.x; + + // Each thread block computes one sub-matrix Csub of C + Matrix Csub = GetSubMatrix(C, blockRow, blockCol); + + // Each thread computes one element of Csub + // by accumulating results into Cvalue + float Cvalue = 0; + + // Thread row and column within Csub + int row = threadIdx.y; + int col = threadIdx.x; + + // Loop over all the sub-matrices of A and B that are + // required to compute Csub + // Multiply each pair of sub-matrices together + // and accumulate the results + for (int m = 0; m < (A.width / BLOCK_SIZE); ++m) { + + // Get sub-matrix Asub of A + Matrix Asub = GetSubMatrix(A, blockRow, m); + + // Get sub-matrix Bsub of B + Matrix Bsub = GetSubMatrix(B, m, blockCol); + + // Shared memory used to store Asub and Bsub respectively + __shared__ float As[BLOCK_SIZE][BLOCK_SIZE]; + __shared__ float Bs[BLOCK_SIZE][BLOCK_SIZE]; + + // Load Asub and Bsub from device memory to shared memory + // Each thread loads one element of each sub-matrix + As[row][col] = GetElement(Asub, row, col); + Bs[row][col] = GetElement(Bsub, row, col); + + // Synchronize to make sure the sub-matrices are loaded + // before starting the computation + __syncthreads(); + // Multiply Asub and Bsub together + for (int e = 0; e < BLOCK_SIZE; ++e) + Cvalue += As[row][e] * Bs[e][col]; + + // Synchronize to make sure that the preceding + // computation is done before loading two new + // sub-matrices of A and B in the next iteration + __syncthreads(); + } + + // Write Csub to device memory + // Each thread writes one element + SetElement(Csub, row, col, Cvalue); +} \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/CUDA/cudaMatMul.h b/make/cmake/CMakeTutorial/CUDA/cudaMatMul.h new file mode 100644 index 0000000..f616c70 --- /dev/null +++ b/make/cmake/CMakeTutorial/CUDA/cudaMatMul.h @@ -0,0 +1,10 @@ +// Matrices are stored in row-major order: +// M(row, col) = *(M.elements + row * M.stride + col) +typedef struct { + int width; + int height; + int stride; + float* elements; +} Matrix; + +void MatMul(const Matrix A, const Matrix B, Matrix C); \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/CUDA/imgs/cmake_cuda_support.png b/make/cmake/CMakeTutorial/CUDA/imgs/cmake_cuda_support.png new file mode 100644 index 0000000000000000000000000000000000000000..094b85cc7d0ced919ea2587b9019b4f16f715a40 GIT binary patch literal 162762 zcmeFZcT`hp_cpBKIEV!lMMMNFAW8^~AiXIH2neWjLQ#<#2pxn_Mg@_sAVEMtK$@Yq z03o2DAiakg5a}feH335T?&Cba->38Z)_T|a*0LE=e~-uGPaOYpX2{uX%4;fdl}_iSqu^*Qtp3Us1i^~Dp_smB&o|>#zTfxkdD2m6 zApkQd{IKTZ%y;hdvy$1Kx)97IhePJ(ZadnS_v|UhTw>n4=i1p46sdkr($-c$k--J- zYeAIO@ibz(tyWr^4J=UMXzcnM?u z>7~DX6Xi6W9qB;%Kqi(_?bp!(5eu_ncN;cw(*|Lw;A<gyh;`bZ|e8A=F#TK)2T#B4o^PnOV8HdY0jc4MgiS6E7~lldH%*v z2fzdywK${dUl`6bT3Xo6VVo#{Fr;h+!i_>+)9!Z#E$lEw2SoK0O*UDt#mhN}VeH+M zAFNl4)RYY-kvrR)bU&a7e?%7Y>{BsL`JN8fi+A%F-DVvmq)fCRKE{{K9rX?mvZv3s zf2W`)7Ff$rqqcNoqe|*`jTc-m{^=>X$(Hi-o;u^iIopQ@IjM!?i z!h#=>DT=Q&C@Qny=@*TP^QgK{p7y(V^W9P3cAxpC$~M9uM%l}HLY8wSlxZKSRliA* zd$q@ zhRlu-8qlLVwGqBs90u#z?@daalh+&{4Hji0L)8ASy}eIe!FFT6)7h&M1Zw`Pp& zbZLEtoodYg`Mf#hs@Jv#jpD9bm>0Um@f6xuEE~@r?9FkXo;D56@F)5f1zI*HHQ&o@ z{&w)=Kr`+$$)I?3?y7fF%p<{#)$PF}@kXK6l}5#7i8&9$8{n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ryeAv!Ogn+YucJ2T$| zmX|p_Kh=F5*pz&?{pu>;ML+W!mCkupc|F+FT^LNJW(A~RrPIB)5x2Nd(%R6nL+^_~w(Sk|}t4M2iPx)%L#~&_f zTI?=d%~qB;71$>D25j$Sr|e6XjJP!Eg4dDUmuvQU0+*oW703e5RXn{zdFA4igxOV% zZ&%;-xWzB2x*9mOnCG5Q_IN|5;~6VpbM073d$AB(@S@z)Q{HURG};n=FV}VM${%;q zZthsH|I3RT8XSrh2G1j-7#afcsuk}Xw=2DCI(GWD8_1~! z$O)}u{-k-Ad}Pw&zd7vLlMBw~C?1QcxvA*wRx*8NW} +#include +#include + +#include "cudaMatMul.h" + +using namespace std; +using namespace std::chrono; + +#define M 10000 +#define K 1000 +#define N 10000 + +int main() +{ + float *A = new float[M * K]; + float *B = new float[K * N]; + float *C = new float[M * N]; + + for (int i = 0; i < M * K; i++) + { + A[i] = sin(i); + } + + for (int i = 0; i < K*N; i++){ + B[i] = cos(i); + } + + for (int i = 0; i < M * N; i++) + { + C[i] = 0.5; + } + + Matrix h_a, h_b, h_c; + h_a.width = h_a.stride = M; h_a.height = K; h_a.elements = A; + h_b.width = h_b.stride = K; h_b.height = N; h_b.elements = B; + h_c.width = h_c.stride = M; h_c.height = N; h_c.elements = C; + + auto startTime = high_resolution_clock::now(); + MatMul(h_a, h_b, h_c); + auto endTime = high_resolution_clock::now(); + auto duration = duration_cast(endTime - startTime); + cout << "cuda计算用时" < + +int add(int a, int b){ + return a+b; +} + diff --git a/make/cmake/CMakeTutorial/FindPackage/ModuleMode/libadd.h b/make/cmake/CMakeTutorial/FindPackage/ModuleMode/libadd.h new file mode 100644 index 0000000..f226245 --- /dev/null +++ b/make/cmake/CMakeTutorial/FindPackage/ModuleMode/libadd.h @@ -0,0 +1,6 @@ +#ifndef LIBADD +#define LIBADD + +int add(int, int); + +#endif \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/FindPackage/README.md b/make/cmake/CMakeTutorial/FindPackage/README.md new file mode 100644 index 0000000..d69ee0c --- /dev/null +++ b/make/cmake/CMakeTutorial/FindPackage/README.md @@ -0,0 +1,135 @@ +# 使用find_package引入外部依赖包 +本章节通过示例演示Cmake中find_package的用法。 + +**注**:所有教程均在linux系统下测试通过,如果是windows和mac系统,可能会出现错误,需要自行调试修改 + +## 通过Cmake内置模块引入依赖包 +为了方便我们在项目中引入外部依赖包,cmake官方为我们预定义了许多寻找依赖包的Module,他们存储在`path_to_your_cmake/share/cmake-/Modules`目录下。每个以Find.cmake命名的文件都可以帮我们找到一个包。我们也可以在官方文档中查看到哪些库官方已经为我们定义好了,我们可以直接使用find_package函数进行引用[官方文档:Find Modules](https://cmake.org/cmake/help/latest/manual/cmake-modules.7.html)。 + +我们以curl库为例,假设我们项目需要引入这个库,从网站中请求网页到本地,我们看到官方已经定义好了FindCURL.cmake。所以我们在CMakeLists.txt中可以直接用find_pakcage进行引用。 +```cmake +find_package(CURL) +add_executable(curltest curltest.cc) +if(CURL_FOUND) + target_include_directories(clib PRIVATE ${CURL_INCLUDE_DIR}) + target_link_libraries(curltest ${CURL_LIBRARY}) +else(CURL_FOUND) + message(FATAL_ERROR ”CURL library not found”) +endif(CURL_FOUND) +``` +对于系统预定义的 `Find.cmake` 模块,使用方法一般如上例所示。 + +每一个模块都会定义以下几个变量 +- `_FOUND` +- `_INCLUDE_DIR or _INCLUDES` +- `_LIBRARY or _LIBRARIES` + +你可以通过`_FOUND` 来判断模块是否被找到,如果没有找到,按照工程的需要关闭 +某些特性、给出提醒或者中止编译,上面的例子就是报出致命错误并终止构建。 +如果`_FOUND` 为真,则将`_INCLUDE_DIR` 加入 INCLUDE_DIRECTORIES, + + +## 通过find_package引入非官方的库(该方式只对支持cmake编译安装的库有效) +假设此时我们需要引入glog库来进行日志的记录,我们在Module目录下并没有找到 FindGlog.cmake。所以我们需要自行安装glog库,再进行引用。 + +安装 +```bash +# clone该项目 +git clone https://github.com/google/glog.git +# 切换到需要的版本 +cd glog +git checkout v0.40 + +# 根据官网的指南进行安装 +cmake -H. -Bbuild -G "Unix Makefiles" +cmake --build build +cmake --build build --target install +``` +此时我们便可以通过与引入curl库一样的方式引入glog库了 +```cmake +find_package(glog) +add_executable(glogtest glogtest.cc) +if(GLOG_FOUND) + # 由于glog在连接时将头文件直接链接到了库里面,所以这里不用显示调用target_include_directories + target_link_libraries(glogtest glog::glog) +else(GLOG_FOUND) + message(FATAL_ERROR ”glog library not found”) +endif(GLOG_FOUND) +``` + +## Module模式与Config模式 +通过上文我们了解了通过Cmake引入依赖库的基本用法。知其然也要知其所以然,find_package对我们来说是一个黑盒子,那么它是具体通过什么方式来查找到我们依赖的库文件的路径的呢。到这里我们就不得不聊到find_package的两种模式,一种是Module模式,也就是我们引入curl库的方式。另一种叫做Config模式,也就是引入glog库的模式。下面我们来详细介绍着两种方式的运行机制。 + +在Module模式中,cmake需要找到一个叫做`Find.cmake`的文件。这个文件负责找到库所在的路径,为我们的项目引入头文件路径和库文件路径。cmake搜索这个文件的路径有两个,一个是上文提到的cmake安装目录下的`share/cmake-/Modules`目录,另一个使我们指定的`CMAKE_MODULE_PATH`的所在目录。 + +如果Module模式搜索失败,没有找到对应的`Find.cmake`文件,则转入Config模式进行搜索。它主要通过`Config.cmake` or `-config.cmake`这两个文件来引入我们需要的库。以我们刚刚安装的glog库为例,在我们安装之后,它在`/usr/local/lib/cmake/glog/`目录下生成了`glog-config.cmake`文件,而`/usr/local/lib/cmake//`正是find_package函数的搜索路径之一。(find_package的搜索路径是一系列的集合,而且在linux,windows,mac上都会有所区别,需要的可以参考官方文档[find_package](https://cmake.org/cmake/help/latest/command/find_package.html)) + +由以上的例子可以看到,对于原生支持Cmake编译和安装的库通常会安装Config模式的配置文件到对应目录,这个配置文件直接配置了头文件库文件的路径以及各种cmake变量供find_package使用。而对于非由cmake编译的项目,我们通常会编写一个`Find.cmake`,通过脚本来获取头文件、库文件等信息。通常,原生支持cmake的项目库安装时会拷贝一份XXXConfig.cmake到系统目录中,因此在没有显式指定搜索路径时也可以顺利找到。 + +## 编写自己的`Find.cmake`模块 +假设我们编写了一个新的函数库,我们希望别的项目可以通过find_package对它进行引用我们应该怎么办呢。 + +我们在当前目录下新建一个`ModuleMode`的文件夹,在里面我们编写一个计算两个整数之和的一个简单的函数库。库函数以手工编写Makefile的方式进行安装,库文件安装在/usr/lib目录下,头文件放在/usr/include目录下。其中的Makefile文件如下: +```Makefile +# 1、准备工作,编译方式、目标文件名、依赖库路径的定义。 +CC = g++ +CFLAGS := -Wall -O3 -std=c++11 + +OBJS = libadd.o #.o文件与.cpp文件同名 +LIB = libadd.so # 目标文件名 +INCLUDE = ./ # 头文件目录 +HEADER = libadd.h # 头文件 + +all : $(LIB) + +# 2. 生成.o文件 +$(OBJS) : libadd.cc + $(CC) $(CFLAGS) -I ./ -fpic -c $< -o $@ + +# 3. 生成动态库文件 +$(LIB) : $(OBJS) + rm -f $@ + g++ $(OBJS) -shared -o $@ + rm -f $(OBJS) + + +# 4. 删除中间过程生成的文件 +clean: + rm -f $(OBJS) $(TARGET) $(LIB) + +# 5.安装文件 +install: + cp $(LIB) /usr/lib + cp $(HEADER) /usr/include +``` +编译安装 +```bash +make +sudo make install +``` +接下来我们回到我们的Cmake项目中来,在`cmake`文件夹下新建一个FindAdd.cmake的文件。我们的目标是找到库的头文件所在目录和共享库文件的所在位置。 +```cmake +# 在指定目录下寻找头文件和动态库文件的位置,可以指定多个目标路径 +find_path(ADD_INCLUDE_DIR libadd.h /usr/include/ /usr/local/include ${CMAKE_SOURCE_DIR}/ModuleMode) +find_library(ADD_LIBRARY NAMES add PATHS /usr/lib/add /usr/local/lib/add ${CMAKE_SOURCE_DIR}/ModuleMode) + +if (ADD_INCLUDE_DIR AND ADD_LIBRARY) + set(ADD_FOUND TRUE) +endif (ADD_INCLUDE_DIR AND ADD_LIBRARY) +``` +这时我们便可以像引用curl一样引入我们自定义的库了。 + +在CMakeLists.txt中添加 +```cmake +# 将项目目录下的cmake文件夹加入到CMAKE_MODULE_PATH中,让find_pakcage能够找到我们自定义的函数库 +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}") +add_executable(addtest addtest.cc) +find_package(ADD) +if(ADD_FOUND) + target_include_directories(addtest PRIVATE ${ADD_INCLUDE_DIR}) + target_link_libraries(addtest ${ADD_LIBRARY}) +else(ADD_FOUND) + message(FATAL_ERROR "ADD library not found") +endif(ADD_FOUND) +``` + diff --git a/make/cmake/CMakeTutorial/FindPackage/addtest.cc b/make/cmake/CMakeTutorial/FindPackage/addtest.cc new file mode 100644 index 0000000..70ee6a2 --- /dev/null +++ b/make/cmake/CMakeTutorial/FindPackage/addtest.cc @@ -0,0 +1,13 @@ +#include +#include "libadd.h" + +int main(int argc, char const *argv[]) +{ + int a = 2; + int b = 3; + int result; + result = add(a, b); + std::cout << a << "加" << b << "等于" < +#include +#include + + +static size_t WriteCallback(void *contents, size_t size, size_t nmemb, void *userp) +{ + ((std::string*)userp)->append((char*)contents, size * nmemb); + return size * nmemb; +} + +int main(void) +{ + CURL *curl; + CURLcode res; + std::string readBuffer; + + curl = curl_easy_init(); + if(curl) { + curl_easy_setopt(curl, CURLOPT_URL, "http://www.linux-ren.org"); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteCallback); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &readBuffer); + res = curl_easy_perform(curl); + curl_easy_cleanup(curl); + + std::cout << readBuffer << std::endl; + std::cout << "请求网页完成!" << std::endl; + } + return 0; +} \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/FindPackage/glogtest.cc b/make/cmake/CMakeTutorial/FindPackage/glogtest.cc new file mode 100644 index 0000000..cb1fb5b --- /dev/null +++ b/make/cmake/CMakeTutorial/FindPackage/glogtest.cc @@ -0,0 +1,12 @@ +#include +#include "glog/logging.h" + +int main(int argc, char const *argv[]) +{ + google::InitGoogleLogging(argv[0]); // 初始化 + double input, result; + LOG(INFO) << "测试glog"; + std::cout << "测试glog成功" << std::endl; + + return 0; +} diff --git a/make/cmake/CMakeTutorial/ImportExternalProject/CMakeLists.txt b/make/cmake/CMakeTutorial/ImportExternalProject/CMakeLists.txt new file mode 100644 index 0000000..3c64477 --- /dev/null +++ b/make/cmake/CMakeTutorial/ImportExternalProject/CMakeLists.txt @@ -0,0 +1,33 @@ +project(ImportExternalProject) +cmake_minimum_required(VERSION 3.11) + +add_definitions(-std=c++11) # 指定采用c++11进行编译(spdlog需要c++11) +add_executable(test_spdlog testspdlog.cc) + +# 测试时可以取消注释相应的内容 + +###################################### +# 采用添加submodules的方式引入项目 # +###################################### + +# add_subdirectory(spdlog) +# add_executable(test_spdlog testspdlog.cc) +# target_link_libraries(test_spdlog spdlog::spdlog) + +######################################## +# 采用ExternalProject_Add的方式引入项目 # +####################################### + +# set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}") +# include(spdlog) + +# target_link_libraries(test_spdlog ${SPDLOG_LIB}) +# target_include_directories(test_spdlog PRIVATE ${SPDLOG_INCLUDE_DIR}) + +######################################## +# 采用ExternalProject_Add的方式引入项目 # +####################################### +# set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}") +# include(spdlog2) + +# target_link_libraries(test_spdlog PRIVATE spdlog) \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/ImportExternalProject/README.md b/make/cmake/CMakeTutorial/ImportExternalProject/README.md new file mode 100644 index 0000000..31945ca --- /dev/null +++ b/make/cmake/CMakeTutorial/ImportExternalProject/README.md @@ -0,0 +1,126 @@ +# 引入外部项目 +本节主要介绍如何引入外部项目源码作为自己项目的Library。与[FindPackage](FindPackage/README.md)引入头文件编译好的库不同的是,本节介绍的方法直接将第三方库源码引入到项目中,编译自己的项目时也会连同第三方库的源码一同编译。特别是当我们使用git等工具引入代码时,我们可以很方便地控制第三方代码的版本,防止本地安装的库文件版本与项目存在冲突。下面我们逐一介绍引入外部项目的几种方式,并对比他们的优劣。(以[spdlog](https://github.com/gabime/spdlog)为例) + +## 通过Submodle的方式引入 +克隆spdlog作为项目的子项目 +```bash +git submodule add https://github.com/gabime/spdlog.git +``` +本项目已经添加了submodule,所以在项目根目录执行以下命令初始化 +```bash +git submodule init +git submodule update +``` +切换到我们需要的版本 +```bash +git checkout v1.4.2 +``` +我们已经clone好了,现在只需要将spdlog作为subdirectory加入CMakeLists.txt当中就行了 +```cmake +project(ImportExternalProject) +cmake_minimum_required(VERSION 3.5) + +add_definitions(-std=c++11) # 指定采用c++11进行编译(spdlog需要c++11) +add_subdirectory(spdlog) +``` + +## 在编译时下载项目并引入 +首先新建cmake目录,在目录下创建spdlog.cmake并加入以下内容 +```cmake +include(ExternalProject) + +set(SPDLOG_ROOT ${CMAKE_BINARY_DIR}/thirdparty/SPDLOG) +set(SPDLOG_GIT_TAG v1.4.1) # 指定版本 +set(SPDLOG_GIT_URL https://github.com/gabime/spdlog.git) # 指定git仓库地址 +set(SPDLOG_CONFIGURE cd ${SPDLOG_ROOT}/src/SPDLOG && cmake -D CMAKE_INSTALL_PREFIX=${SPDLOG_ROOT} .) # 指定配置指令(注意此处修改了安装目录,否则默认情况下回安装到系统目录) +set(SPDLOG_MAKE cd ${SPDLOG_ROOT}/src/SPDLOG && make) # 指定编译指令(需要覆盖默认指令,进入我们指定的SPDLOG_ROOT目录下) +set(SPDLOG_INSTALL cd ${SPDLOG_ROOT}/src/SPDLOG && make install) # 指定安装指令(需要覆盖默认指令,进入我们指定的SPDLOG_ROOT目录下) + +ExternalProject_Add(SPDLOG + PREFIX ${SPDLOG_ROOT} + GIT_REPOSITORY ${SPDLOG_GIT_URL} + GIT_TAG ${SPDLOG_GIT_TAG} + CONFIGURE_COMMAND ${SPDLOG_CONFIGURE} + BUILD_COMMAND ${SPDLOG_MAKE} + INSTALL_COMMAND ${SPDLOG_INSTALL} +) + +# 指定编译好的静态库文件的路径 +set(SPDLOG_LIB ${SPDLOG_ROOT}/lib/spdlog/libspdlog.a) +# 指定头文件所在的目录 +set(SPDLOG_INCLUDE_DIR ${SPDLOG_ROOT}/include) +``` +需要注意的是,我们此处指定了配置、编译、安装的指令,如果不这样做的话,cmake默认将编译好的库和头文件安装在系统目录,而我们希望他安装在build目录下的指定位置。最后我们设置了静态库文件的位置和头文件所在目录,这样我们在CMakeLists.txt中就可以通过target_link_libraries和target_include_directories进行引用了。 +```cmake +project(ImportExternalProject) +cmake_minimum_required(VERSION 3.5) + +add_definitions(-std=c++11) # 指定采用c++11进行编译(spdlog需要c++11) +add_executable(test_spdlog testspdlog.cc) + +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}") +include(spdlog) + +target_link_libraries(test_spdlog ${SPDLOG_LIB}) +target_include_directories(test_spdlog PRIVATE ${SPDLOG_INCLUDE_DIR}) +``` + +## 使用FetchContent (CMake 3.11+) +细心的朋友已经发现了,上述使用ExternalProject_Add的方式引入spdlog是在编译时进行的,也就是说在Configure过程中我们并没有从git上下载项目,这就导致我们无法像submodule那样直接通过add_subdirectory引入项目,而是要预先定义好编译后库文件和头文件的位置,通过target_link_libraries和target_include_directories进行引入。在cmake3.11以及以上的版本,cmake又为我们提供了一种Configure过程引入外部项目的方法--FetchContent。 + +使用FetchContent的步骤总结起来就是: + +- 使用FetchContent_Declare(MyName) 获取项目。可以是一个URL也可以是一个Git仓库。 +- 使用FetchContent_GetProperties(MyName) 获取我们需要的变量MyName_*。 +- 使用add_subdirectory(${MyName_SOURCE_DIR} ${MyName_BINARY_DIR})引入项目。 + +在cmake3.14版本,官方又为我们提供了更方便的FetchContent_MakeAvailable方法,将步骤2,3集成在了一起。为了兼容3.11版本,我们可以把它封装成一个宏,这样我们就可以统一使用FetchContent_MakeAvailable方法了。 +```cmake +# Campatible with cmake 3.11 and above. +macro(FetchContent_MakeAvailable NAME) +FetchContent_GetProperties(${NAME}) +if(NOT ${NAME}_POPULATED) + FetchContent_Populate(${NAME}) + add_subdirectory(${${NAME}_SOURCE_DIR} ${${NAME}_BINARY_DIR}) +endif() +endmacro()macro(FetchContent_MakeAvailable NAME) + FetchContent_GetProperties(${NAME}) + if(NOT ${NAME}_POPULATED) + FetchContent_Populate(${NAME}) + add_subdirectory(${${NAME}_SOURCE_DIR} ${${NAME}_BINARY_DIR}) + endif() +endmacro() +``` +与前面类似,我们在cmake目录下新建spdlog2.cmake,使用FetchContent引入spdlog +```cmake +# 添加第三方依赖包 +include(FetchContent) +# FetchContent_MakeAvailable was not added until CMake 3.14 +if(${CMAKE_VERSION} VERSION_LESS 3.14) + include(add_FetchContent_MakeAvailable.cmake) +endif() + +set(SPDLOG_GIT_TAG v1.4.1) # 指定版本 +set(SPDLOG_GIT_URL https://github.com/gabime/spdlog.git) # 指定git仓库地址 + +FetchContent_Declare( + spdlog + GIT_REPOSITORY ${SPDLOG_GIT_URL} + GIT_TAG ${SPDLOG_GIT_TAG} +) + +FetchContent_MakeAvailable(spdlog) +``` +在CMakeLists.txt中,包含cmake/spdlog2.cmake,便可将spdlog作为library来使用了(主义cmake最小版本应当设置为3.11) +```cmake +project(ImportExternalProject) +cmake_minimum_required(VERSION 3.11) + +add_definitions(-std=c++11) # 指定采用c++11进行编译(spdlog需要c++11) +add_executable(test_spdlog testspdlog.cc) + +set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake;${CMAKE_MODULE_PATH}") +include(spdlog2) + +target_link_libraries(test_spdlog PRIVATE spdlog) +``` \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/ImportExternalProject/cmake/FetchContentMakeAvaliable.cmake b/make/cmake/CMakeTutorial/ImportExternalProject/cmake/FetchContentMakeAvaliable.cmake new file mode 100644 index 0000000..8721797 --- /dev/null +++ b/make/cmake/CMakeTutorial/ImportExternalProject/cmake/FetchContentMakeAvaliable.cmake @@ -0,0 +1,14 @@ +# Campatible with cmake 3.11 and above. +macro(FetchContent_MakeAvailable NAME) +FetchContent_GetProperties(${NAME}) +if(NOT ${NAME}_POPULATED) + FetchContent_Populate(${NAME}) + add_subdirectory(${${NAME}_SOURCE_DIR} ${${NAME}_BINARY_DIR}) +endif() +endmacro()macro(FetchContent_MakeAvailable NAME) + FetchContent_GetProperties(${NAME}) + if(NOT ${NAME}_POPULATED) + FetchContent_Populate(${NAME}) + add_subdirectory(${${NAME}_SOURCE_DIR} ${${NAME}_BINARY_DIR}) + endif() +endmacro() \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/ImportExternalProject/cmake/spdlog.cmake b/make/cmake/CMakeTutorial/ImportExternalProject/cmake/spdlog.cmake new file mode 100644 index 0000000..9503a08 --- /dev/null +++ b/make/cmake/CMakeTutorial/ImportExternalProject/cmake/spdlog.cmake @@ -0,0 +1,22 @@ +include(ExternalProject) + +set(SPDLOG_ROOT ${CMAKE_BINARY_DIR}/thirdparty/SPDLOG) +set(SPDLOG_GIT_TAG v1.4.1) # 指定版本 +set(SPDLOG_GIT_URL https://github.com/gabime/spdlog.git) # 指定git仓库地址 +set(SPDLOG_CONFIGURE cd ${SPDLOG_ROOT}/src/SPDLOG && cmake -D CMAKE_INSTALL_PREFIX=${SPDLOG_ROOT} .) # 指定配置指令(注意此处修改了安装目录,否则默认情况下回安装到系统目录) +set(SPDLOG_MAKE cd ${SPDLOG_ROOT}/src/SPDLOG && make) # 指定编译指令(需要覆盖默认指令,进入我们指定的SPDLOG_ROOT目录下) +set(SPDLOG_INSTALL cd ${SPDLOG_ROOT}/src/SPDLOG && make install) # 指定安装指令(需要覆盖默认指令,进入我们指定的SPDLOG_ROOT目录下) + +ExternalProject_Add(SPDLOG + PREFIX ${SPDLOG_ROOT} + GIT_REPOSITORY ${SPDLOG_GIT_URL} + GIT_TAG ${SPDLOG_GIT_TAG} + CONFIGURE_COMMAND ${SPDLOG_CONFIGURE} + BUILD_COMMAND ${SPDLOG_MAKE} + INSTALL_COMMAND ${SPDLOG_INSTALL} +) + +# 指定编译好的静态库文件的路径 +set(SPDLOG_LIB ${SPDLOG_ROOT}/lib/spdlog/libspdlog.a) +# 指定头文件所在的目录 +set(SPDLOG_INCLUDE_DIR ${SPDLOG_ROOT}/include) \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/ImportExternalProject/cmake/spdlog2.cmake b/make/cmake/CMakeTutorial/ImportExternalProject/cmake/spdlog2.cmake new file mode 100644 index 0000000..125f5a8 --- /dev/null +++ b/make/cmake/CMakeTutorial/ImportExternalProject/cmake/spdlog2.cmake @@ -0,0 +1,17 @@ +# 添加第三方依赖包 +include(FetchContent) +# FetchContent_MakeAvailable was not added until CMake 3.14 +if(${CMAKE_VERSION} VERSION_LESS 3.14) + include(add_FetchContent_MakeAvailable.cmake) +endif() + +set(SPDLOG_GIT_TAG v1.4.1) # 指定版本 +set(SPDLOG_GIT_URL https://github.com/gabime/spdlog.git) # 指定git仓库地址 + +FetchContent_Declare( + spdlog + GIT_REPOSITORY ${SPDLOG_GIT_URL} + GIT_TAG ${SPDLOG_GIT_TAG} +) + +FetchContent_MakeAvailable(spdlog) \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/ImportExternalProject/testspdlog.cc b/make/cmake/CMakeTutorial/ImportExternalProject/testspdlog.cc new file mode 100644 index 0000000..469c400 --- /dev/null +++ b/make/cmake/CMakeTutorial/ImportExternalProject/testspdlog.cc @@ -0,0 +1,29 @@ +#include "spdlog/spdlog.h" +#include "spdlog/sinks/basic_file_sink.h" + +int main() +{ + spdlog::info("Welcome to spdlog!"); + spdlog::error("Some error message with arg: {}", 1); + + spdlog::warn("Easy padding in numbers like {:08d}", 12); + spdlog::critical("Support for int: {0:d}; hex: {0:x}; oct: {0:o}; bin: {0:b}", 42); + spdlog::info("Support for floats {:03.2f}", 1.23456); + spdlog::info("Positional args are {1} {0}..", "too", "supported"); + spdlog::info("{:<30}", "left aligned"); + + spdlog::set_level(spdlog::level::debug); // Set global log level to debug + spdlog::debug("This message should be displayed.."); + + // change log pattern + spdlog::set_pattern("[%H:%M:%S %z] [%n] [%^---%L---%$] [thread %t] %v"); + + // Compile time log levels + // define SPDLOG_ACTIVE_LEVEL to desired level + SPDLOG_TRACE("Some trace message with param {}", 42); + SPDLOG_DEBUG("Some debug message"); + + // Set the default logger to file logger + auto file_logger = spdlog::basic_logger_mt("basic_logger", "basic.txt"); + spdlog::set_default_logger(file_logger); +} \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/Installation/CMakeLists.txt b/make/cmake/CMakeTutorial/Installation/CMakeLists.txt new file mode 100644 index 0000000..178fde8 --- /dev/null +++ b/make/cmake/CMakeTutorial/Installation/CMakeLists.txt @@ -0,0 +1,49 @@ +cmake_minimum_required(VERSION 3.0) +project(Installation VERSION 1.0) + +# 如果想生成静态库,使用下面的语句 +# add_library(mymath mymath.cc) +# target_include_directories(mymath PUBLIC ${CMAKE_SOURCE_DIR}/include) + +# 如果想生成动态库,使用下面的语句 +add_library(mymath SHARED mymath.cc) +target_include_directories(mymath PRIVATE ${CMAKE_SOURCE_DIR}/include) +set_target_properties(mymath PROPERTIES PUBLIC_HEADER ${CMAKE_SOURCE_DIR}/include/mymath.h) + +# 生成可执行文件 +add_executable(mymathapp mymathApp.cc) +target_link_libraries(mymathapp mymath) +target_include_directories(mymathapp PRIVATE ${CMAKE_SOURCE_DIR}/include) + +# 改变安装路径可以使用下面的语句,Unix: "/usr/local", Windows: "c:/Program Files/${PROJECT_NAME}" 为默认值,所有的DESTINATION均以此目录为根目录 +# set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}/mymath) + +# 写入库的版本信息 +include(CMakePackageConfigHelpers) +write_basic_package_version_file( + MyMathConfigVersion.cmake + VERSION ${PACKAGE_VERSION} + COMPATIBILITY AnyNewerVersion + ) + +# 将库文件,可执行文件,头文件安装到指定目录 +install(TARGETS mymath mymathapp + EXPORT MyMathTargets + LIBRARY DESTINATION lib + ARCHIVE DESTINATION lib + RUNTIME DESTINATION bin + PUBLIC_HEADER DESTINATION include + ) + +# 将库的相关信息输出为MyMathConfig.cmake,供find_package查找 +install(EXPORT MyMathTargets + FILE MyMathTargets.cmake + NAMESPACE MyMath:: + DESTINATION lib/cmake/MyMath + ) + +configure_file(MyMathConfig.cmake.in MyMathConfig.cmake @ONLY) +install(FILES "${CMAKE_CURRENT_BINARY_DIR}/MyMathConfig.cmake" + "${CMAKE_CURRENT_BINARY_DIR}/MyMathConfigVersion.cmake" + DESTINATION lib/cmake/MyMath + ) diff --git a/make/cmake/CMakeTutorial/Installation/MyMathConfig.cmake.in b/make/cmake/CMakeTutorial/Installation/MyMathConfig.cmake.in new file mode 100644 index 0000000..42884ca --- /dev/null +++ b/make/cmake/CMakeTutorial/Installation/MyMathConfig.cmake.in @@ -0,0 +1,12 @@ +include(CMakeFindDependencyMacro) + +# 如果想要获取Config阶段的变量,可以使用这个 +# set(my-config-var @my-config-var@) + +# 如果你的项目需要依赖其他的库,可以使用下面语句,用法与find_package相同 +# find_dependency(MYDEP REQUIRED) + +# Any extra setup + +# Add the targets file +include("${CMAKE_CURRENT_LIST_DIR}/MyMathTargets.cmake") \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/Installation/README.md b/make/cmake/CMakeTutorial/Installation/README.md new file mode 100644 index 0000000..428da36 --- /dev/null +++ b/make/cmake/CMakeTutorial/Installation/README.md @@ -0,0 +1,137 @@ +# 安装 +本文主要介绍如何将项目生成的库文件、头文件、可执行文件或相关文件等安装到指定位置(系统目录,或发行包目录)。在cmake中,这主要是通过`install`方法在CMakeLists.txt中配置,`make install`命令安装相关文件来实现的。 + +## 编写一个简单的库 +编写一个计算整数和浮点数之和的库函数mymath + +mymath.h +```cpp +#ifndef MYMATH_H +#define MYMATH_H + +int add(int, int); +double add(double, double); +#endif +``` +mymath.cc +```cpp +#include "mymath.h" + +int add(int a, int b){ + return a+b; +} + +double add(double a, double b){ + return a+b; +} +``` +可执行程序mymathApp.cc +```cpp +#include +#include "mymath.h" + +using namespace std; + +int main(int argc, char const *argv[]) +{ + double a = add(1.1, 1.1); + int b = add(1, 1); + cout << "1.1加1.1等于" << a < +#include "mymath.h" + +using namespace std; + +int main(int argc, char const *argv[]) +{ + double a = add(1.1, 1.1); + int b = add(1, 1); + cout << "1.1加1.1等于" << a < +#include "mymath.h" + +using namespace std; + +int main(int argc, char const *argv[]) +{ + double a = add(1.1, 1.1); + int b = add(1, 1); + cout << "1.1加1.1等于" << a < +#include +using namespace cv; +int main(int argc, char** argv ) +{ + if ( argc != 2 ) + { + printf("usage: DisplayImage.out \n"); + return -1; + } + Mat image; + image = imread( argv[1], 1 ); + if ( !image.data ) + { + printf("No image data \n"); + return -1; + } + namedWindow("Display Image", WINDOW_AUTOSIZE ); + imshow("Display Image", image); + waitKey(0); + return 0; +} \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/PackageManage/README.md b/make/cmake/CMakeTutorial/PackageManage/README.md new file mode 100644 index 0000000..da275ae --- /dev/null +++ b/make/cmake/CMakeTutorial/PackageManage/README.md @@ -0,0 +1,126 @@ +# 使用包管理工具管理你的依赖库 +当依赖的项目较多时,手动安装相关依赖包较为复杂,并且多个项目多个版本的依赖包安装在系统中及容易造成冲突。若通过submodule的方式引入,下载编译耗时较长,同时也不好管理,对于还在开发过程中的项目来说影像效率。本文主要介绍两个帮助我们管理依赖库的工具的基本使用方法,抛砖引玉。它们分别是[vcpkg](https://github.com/microsoft/vcpkg),Anaconda(https://www.anaconda.com/) + +## 一个简单的小程序 +我们写一个简单的展示图片的小程序 +```cpp +#include +#include +using namespace cv; +int main(int argc, char** argv ) +{ + if ( argc != 2 ) + { + printf("usage: DisplayImage.out \n"); + return -1; + } + Mat image; + image = imread( argv[1], 1 ); + if ( !image.data ) + { + printf("No image data \n"); + return -1; + } + namedWindow("Display Image", WINDOW_AUTOSIZE ); + imshow("Display Image", image); + waitKey(0); + return 0; +} +``` +在CMakeLists.txt中,我们使用find_package(详见[find_package的使用指南](FindPackage/README.md))来引入opencv的库。 +```cmake +cmake_minimum_required(VERSION 3.0) +project( DisplayImage ) +find_package( OpenCV REQUIRED ) +include_directories( ${OpenCV_INCLUDE_DIRS} ) +add_executable( DisplayImage DisplayImage.cpp ) +target_link_libraries( DisplayImage ${OpenCV_LIBS} ) +``` +接下来我们使用vcpkg与anaconda两个工具安装opencv,并编译我们的项目。 + +## 使用vcpkg +[vcpkg](https://github.com/microsoft/vcpkg) 是微软开源的一个库管理工具,并原生支持与cmake集成。vcpkg支持常见依赖库的一键安装,并支持cmake通过find_package一键引入。以下只介绍它的基础用法,具体文档请参考github [vcpkg](https://github.com/microsoft/vcpkg) +### 安装vcpkg +``` +> git clone https://github.com/Microsoft/vcpkg.git +> cd vcpkg + +PS> .\bootstrap-vcpkg.bat +Linux:~/$ ./bootstrap-vcpkg.sh +``` + +然后,[集成](docs/users/integration.md)至本机环境中,执行 (注意: 首次启动需要管理员权限) +``` +PS> .\vcpkg integrate install +Linux:~/$ ./vcpkg integrate install +``` + +使用以下命令安装任意包 +``` +PS> .\vcpkg install sdl2 curl +Linux:~/$ ./vcpkg install sdl2 curl +``` + +## Tab补全/自动补全 +`vcpkg`支持在 Powershell 和 bash 中自动补全命令、程序包名称、选项等。如需启用自动补全功能,请使用以下命令: +``` +PS> .\vcpkg integrate powershell +Linux:~/$ ./vcpkg integrate bash +``` +并重启您的控制台。 +最后将vcpkg加入环境变量,便于在任何地方执行vcpkg的命令 +### 使用vcpkg安装opencv并测试 +众所周知,编译和安装opencv是一件苦差事,使用vcpkg便会变的十分简单。 +首先我们查看vcpkg是否支持安装opencv +```bash +vcpkg search opencv +``` +确认支持后进行安装 +```bash +vcpkg install opencv +``` +安装完成后可以使用下面的命令查看安装情况 +``` +vcpkg list +``` +在配置的过程中,将vcpkg.cmake的路径赋值给`CMAKE_TOOLCHAIN_FILE`变量即可。 +```bash +VCPKG_HOME=/path/to/your_vcpkg/ +cmake .. "-DCMAKE_TOOLCHAIN_FILE=${VCPKG_HOME}/scripts/buildsystems/vcpkg.cmake" +``` +如果我们想卸载掉opencv,也只需执行一个命令 +```bash +vcpkg remove opencv +``` +### 处理安装包的版本问题 +如果要指定依赖包的版本,这里不再赘述,请参考微软的博客[Vcpkg: Using multiple enlistments to handle multiple versions of a library](https://devblogs.microsoft.com/cppblog/vcpkg-using-multiple-enlistments/) + +## 使用Conda环境 +anaconda被大多数人所认为的是一个python的科学计算环境,其实它也可以被用作c,c++虚拟环境的管理。他的优点是可以不使用管理员权限进行安装,并且可以创建多个虚拟环境,不同环境中安装的库之间相互隔离互不干扰。对于需要开发c++扩展的python项目特别适合使用conda环境。 +### 安装 +国内可以到[清华镜像站](https://mirrors.tuna.tsinghua.edu.cn/anaconda/archive/)下载安装包进行安装,如果不需要python环境,可以选择对应的miniconda安装包进行安装。具体安装过程这里不再赘述。 +### 创建虚拟环境 +与上面一样,假设此时我们需要开发一个名为 DisplayImage 的项目,我们可以为该项目单独建立一个虚拟环境 +```bash +conda create -n DisplayImage +``` +激活虚拟环境 +```bash +source activate DisplayImage +# windows下 +# activate DisplayImage +``` +我们可以在当前环境下安装cmake并指定版本3.14,与系统安装的cmake相隔离 +```bash +conda install cmake=3.14.0 +# 卸载使用conda uninstall cmake +``` +接下来我们安装项目的以来库opencv +```bash +conda install opencv +# 卸载使用 conda uninstall opencv +``` +配置项目时设置`CMAKE_PREFIX_PATH`变量为虚拟环境的根目录即可 +``` +cmake .. "-DCMAKE_PREFIX_PATH=/path/to/anaconda/envs/DisplayImage" +``` diff --git a/make/cmake/CMakeTutorial/PythonExtention/CMakeLists.txt b/make/cmake/CMakeTutorial/PythonExtention/CMakeLists.txt new file mode 100644 index 0000000..a1b47fd --- /dev/null +++ b/make/cmake/CMakeTutorial/PythonExtention/CMakeLists.txt @@ -0,0 +1,10 @@ +cmake_minimum_required (VERSION 3.0) +project (PybindMatrix) + +find_package (Eigen3 REQUIRED NO_MODULE) +find_package(PythonLibs REQUIRED) + +include_directories(${PYTHON_INCLUDE_DIRS}) +add_library(matrix python_matrix.cc) +target_compile_features(matrix PRIVATE cxx_std_11) +target_link_libraries (matrix ${PYTHON_LIBRARIES} Eigen3::Eigen) \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/PythonExtention/README.md b/make/cmake/CMakeTutorial/PythonExtention/README.md new file mode 100644 index 0000000..4af356a --- /dev/null +++ b/make/cmake/CMakeTutorial/PythonExtention/README.md @@ -0,0 +1,14 @@ +# 编写Python的C++扩展类型 + +本章节代码的详细解释见 [使用c/c++编写python扩展(三):自定义Python内置类型](https://zhuanlan.zhihu.com/p/106773873) + +## 代码运行方法 +```bash +conda install eigin +export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"} +python setup.py build_ext --inplace +``` +测试代码 +```bash +python test_matrix.py +``` diff --git a/make/cmake/CMakeTutorial/PythonExtention/python_matrix.cc b/make/cmake/CMakeTutorial/PythonExtention/python_matrix.cc new file mode 100644 index 0000000..1ac695e --- /dev/null +++ b/make/cmake/CMakeTutorial/PythonExtention/python_matrix.cc @@ -0,0 +1,359 @@ +#include +#include +#include + +using namespace Eigen; + +typedef struct +{ + PyObject_HEAD + MatrixXd *matrix=nullptr; +} PyMatrixObject; + +static PyObject * +PyMatrix_new(PyTypeObject *type, PyObject *args, PyObject *kwds) +{ + PyMatrixObject *self; + self = (PyMatrixObject *)type->tp_alloc(type, 0); + + char *kwlist[] = {"width", "height", NULL}; + int width = 0; + int height = 0; + + if (!PyArg_ParseTupleAndKeywords(args, kwds, "ii", kwlist, + &width, &height)) + { + Py_DECREF(self); + return NULL; + } + if (width <= 0 or height <= 0) + { + PyErr_SetString(PyExc_ValueError, "The height and width must be greater than 0."); + return NULL; + } + + self->matrix = new MatrixXd(width, height); + return (PyObject *)self; +} + +static void +*PyMatrix_dealloc(PyObject *obj) +{ + delete ((PyMatrixObject *)obj)->matrix; + Py_TYPE(obj)->tp_free(obj); +} + + +inline MatrixXd *ParseMatrix(PyObject *obj){ + return ((PyMatrixObject *)obj)->matrix; +} + +inline PyObject *ReturnMatrix(MatrixXd *m, PyTypeObject *type){ + PyMatrixObject *obj = PyObject_NEW(PyMatrixObject, type); + obj->matrix = m; + return (PyObject *)obj; +} + +static PyObject * +PyMatrix_add(PyObject *a, PyObject *b) +{ + MatrixXd *matrix_a = ParseMatrix(a); + MatrixXd *matrix_b = ParseMatrix(b); + + if (matrix_a->cols() != matrix_b->cols() or matrix_a->rows() != matrix_b->rows()){ + PyErr_SetString(PyExc_ValueError, "The input matrix must be the same shape."); + return NULL; + } + + MatrixXd *matrix_c = new MatrixXd(matrix_a->cols(), matrix_b->rows()); + *matrix_c = *matrix_a + *matrix_b; + + return ReturnMatrix(matrix_c, a->ob_type); +} + +static PyObject * +PyMatrix_minus(PyObject *a, PyObject *b) +{ + MatrixXd *matrix_a = ParseMatrix(a); + MatrixXd *matrix_b = ParseMatrix(b); + + if (matrix_a->cols() != matrix_b->cols() or matrix_a->rows() != matrix_b->rows()){ + PyErr_SetString(PyExc_ValueError, "The input matrix must be the same shape."); + return NULL; + } + + MatrixXd *matrix_c = new MatrixXd(matrix_a->cols(), matrix_b->rows()); + *matrix_c = *matrix_a + *matrix_b; + return ReturnMatrix(matrix_c, a->ob_type); +} + +static PyObject * +PyMatrix_multiply(PyObject *a, PyObject *b) +{ + MatrixXd *matrix_a = ParseMatrix(a); + MatrixXd *matrix_b = ParseMatrix(b); + + if (matrix_a->cols() != matrix_b->rows()){ + PyErr_SetString(PyExc_ValueError, "The colonm rank of matrix A must be the same as the row rank of matrix B."); + return NULL; + } + MatrixXd *matrix_c = new MatrixXd(matrix_a->rows(), matrix_b->cols()); + *matrix_c = (*matrix_a) * (*matrix_b); + return ReturnMatrix(matrix_c, a->ob_type); +} + +static PyObject *PyMatrix_str(PyObject *a) +{ + MatrixXd *matrix = ParseMatrix(a); + std::stringstream ss; + ss << *matrix; + return Py_BuildValue("s", ss.str().c_str()); +} + +static PyNumberMethods numberMethods = { + PyMatrix_add, //nb_add + PyMatrix_minus, //nb_subtract; + PyMatrix_multiply, //nb_multiply + nullptr, //nb_remainder; + nullptr, //nb_divmod; + nullptr, // nb_power; + nullptr, // nb_negative; + nullptr, // nb_positive; + nullptr, // nb_absolute; + nullptr, // nb_bool; + nullptr, // nb_invert; + nullptr, // nb_lshift; + nullptr, // nb_rshift; + nullptr, // nb_and; + nullptr, // nb_xor; + nullptr, // nb_or; + nullptr, // nb_int; + nullptr, // nb_reserved; + nullptr, // nb_float; + + nullptr, // nb_inplace_add; + nullptr, // nb_inplace_subtract; + nullptr, // nb_inplace_multiply; + nullptr, // nb_inplace_remainder; + nullptr, // nb_inplace_power; + nullptr, // nb_inplace_lshift; + nullptr, // nb_inplace_rshift; + nullptr, // nb_inplace_and; + nullptr, // nb_inplace_xor; + nullptr, // nb_inplace_or; + + nullptr, // nb_floor_divide; + nullptr, // nb_true_divide; + nullptr, // nb_inplace_floor_divide; + nullptr, // nb_inplace_true_divide; + + nullptr, // nb_index; + + nullptr, //nb_matrix_multiply; + nullptr //nb_inplace_matrix_multiply; + +}; + +PyObject *PyMatrix_data(PyObject *self, void *closure) +{ + + PyMatrixObject *obj = (PyMatrixObject *)self; + Py_ssize_t width = obj->matrix->cols(); + Py_ssize_t height = obj->matrix->rows(); + + PyObject *list = PyList_New(height); + for (int i = 0; i < height; i++) + { + PyObject *internal = PyList_New(width); + + for (int j = 0; j < width; j++) + { + PyObject *value = PyFloat_FromDouble((*obj->matrix)(i, j)); + PyList_SetItem(internal, j, value); + } + + PyList_SetItem(list, i, internal); + } + return list; +} + +PyObject *PyMatrix_rows(PyObject *self, void *closure) +{ + PyMatrixObject *obj = (PyMatrixObject *)self; + return Py_BuildValue("i", obj->matrix->rows()); +} + +PyObject *PyMatrix_cols(PyObject *self, void *closure) +{ + PyMatrixObject *obj = (PyMatrixObject *)self; + return Py_BuildValue("i", obj->matrix->cols()); +} + +static PyGetSetDef MatrixGetSet[] = { + {"data", (getter)PyMatrix_data, nullptr, nullptr}, + {"row", (getter)PyMatrix_rows, nullptr, nullptr}, + {"colunm", (getter)PyMatrix_cols, nullptr, nullptr}, + {nullptr}}; + +PyObject *PyMatrix_tolist(PyObject *self, PyObject *args) +{ + return PyMatrix_data(self, nullptr); +} + +static PyMethodDef MatrixMethods[] = { + {"to_list", (PyCFunction)PyMatrix_tolist, METH_VARARGS, "Return the matrix data to a list object."}, + {nullptr}}; + +static PyTypeObject MatrixType = { + PyVarObject_HEAD_INIT(nullptr, 0) "matrix.Matrix", /* tp_name */ + sizeof(PyMatrixObject), /* tp_basicsize */ + 0, /* tp_itemsize */ + (destructor)PyMatrix_dealloc, /* tp_dealloc */ + nullptr, /* tp_print */ + nullptr, /* tp_getattr */ + nullptr, /* tp_setattr */ + nullptr, /* tp_reserved */ + nullptr, /* tp_repr */ + &numberMethods, /* tp_as_number */ + nullptr, /* tp_as_sequence */ + nullptr, /* tp_as_mapping */ + nullptr, /* tp_hash */ + nullptr, /* tp_call */ + PyMatrix_str, /* tp_str */ + nullptr, /* tp_getattro */ + nullptr, /* tp_setattro */ + nullptr, /* tp_as_buffer */ + Py_TPFLAGS_DEFAULT | Py_TPFLAGS_BASETYPE, /* tp_flags */ + "Coustom matrix class.", /* tp_doc */ + nullptr, /* tp_traverse */ + nullptr, /* tp_clear */ + nullptr, /* tp_richcompare */ + 0, /* tp_weaklistoffset */ + nullptr, /* tp_iter */ + nullptr, /* tp_iternext */ + MatrixMethods, /* tp_methods */ + nullptr, /* tp_members */ + MatrixGetSet, /* tp_getset */ + nullptr, /* tp_base */ + nullptr, /* tp_dict */ + nullptr, /* tp_descr_get */ + nullptr, /* tp_descr_set */ + 0, /* tp_dictoffset */ + nullptr, /* tp_init */ + nullptr, /* tp_alloc */ + PyMatrix_new /* tp_new */ +}; + +static PyObject *PyMatrix_ones(PyObject *self, PyObject *args, PyObject *kwargs) +{ + PyMatrixObject *m = (PyMatrixObject *)PyMatrix_new(&MatrixType, args, kwargs); + m->matrix->setOnes(); + return (PyObject *)m; +} + +static PyObject *PyMatrix_zeros(PyObject *self, PyObject *args, PyObject *kwargs) +{ + PyMatrixObject *m = (PyMatrixObject *)PyMatrix_new(&MatrixType, args, kwargs); + m->matrix->setZero(); + return (PyObject *)m; +} + +static PyObject *PyMatrix_random(PyObject *self, PyObject *args, PyObject *kwargs) +{ + PyMatrixObject *m = (PyMatrixObject *)PyMatrix_new(&MatrixType, args, kwargs); + m->matrix->setRandom(); + return (PyObject *)m; +} + +static PyObject *PyMatrix_matrix(PyObject *self, PyObject *args) +{ + PyObject *data = nullptr; + if (!PyArg_ParseTuple(args, "O", &data)) + { + PyErr_SetString(PyExc_ValueError, "Please pass a 2 dimensions list object. 1"); + return nullptr; + } + if (!PyList_Check(data)) + { + PyErr_SetString(PyExc_ValueError, "Please pass a 2 dimensions list object. 2"); + return nullptr; + } + int height = PyList_GET_SIZE(data); + if (height <= 0) + { + PyErr_SetString(PyExc_ValueError, "Please pass a 2 dimensions list object. 2"); + return nullptr; + } + PyObject *list = PyList_GET_ITEM(data, 0); + if (!PyList_Check(list)) + { + PyErr_SetString(PyExc_ValueError, "Please pass a 2 dimensions list object. 3"); + return nullptr; + } + int width = PyList_GET_SIZE(list); + MatrixXd *p_mat = new MatrixXd(width, height); + for (int i = 0; i < height; i++) + { + PyObject *list = PyList_GET_ITEM(data, i); + if (!PyList_Check(list)) + { + PyErr_SetString(PyExc_ValueError, "Please pass a 2 dimensions list object. 3"); + return nullptr; + } + int tmp = PyList_GET_SIZE(list); + if (width != tmp) + { + PyErr_SetString(PyExc_ValueError, "Please pass a 2 dimensions list object. Each elements of it must be the same length."); + return nullptr; + } + width = tmp; + + for (int j = 0; j < width; j++) + { + PyObject *num = PyList_GET_ITEM(list, j); + if (!PyFloat_Check(num)) + { + PyErr_SetString(PyExc_ValueError, "Every elements of the matrix must float."); + return nullptr; + } + (*p_mat)(i, j) = ((PyFloatObject *)num)->ob_fval; + } + } + + return ReturnMatrix(p_mat, &MatrixType); +} + +static PyMethodDef matrixMethods[] = { + {"ones", (PyCFunction)PyMatrix_ones, METH_VARARGS | METH_KEYWORDS, "Return a new matrix with initial values one."}, + {"zeros", (PyCFunction)PyMatrix_zeros, METH_VARARGS | METH_KEYWORDS, "Return a new matrix with initial values zero."}, + {"random", (PyCFunction)PyMatrix_random, METH_VARARGS | METH_KEYWORDS, "Return a new matrix with random values"}, + {"matrix", (PyCFunction)PyMatrix_matrix, METH_VARARGS, "Return a new matrix with given values"}, + {nullptr}}; + +static struct PyModuleDef module = { + PyModuleDef_HEAD_INIT, + "matrix", + "Python interface for Matrix calculation", + -1, + matrixMethods}; + +PyObject *initModule(void) +{ + PyObject *m; + if (PyType_Ready(&MatrixType) < 0) + return NULL; + + m = PyModule_Create(&module); + if (m == NULL) + return NULL; + + Py_INCREF(&MatrixType); + if (PyModule_AddObject(m, "Matrix", (PyObject *)&MatrixType) < 0) + { + Py_DECREF(&MatrixType); + Py_DECREF(m); + return NULL; + } + + return m; +} \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/PythonExtention/setup.py b/make/cmake/CMakeTutorial/PythonExtention/setup.py new file mode 100644 index 0000000..cb2446d --- /dev/null +++ b/make/cmake/CMakeTutorial/PythonExtention/setup.py @@ -0,0 +1,87 @@ +import os +import shlex +import subprocess +import datetime +import time +import shutil +from setuptools import setup, Extension + +cwd = os.path.dirname(os.path.abspath(__file__)) + + +def execute_command(cmdstring, cwd=None, timeout=None, shell=False): + """执行一个SHELL命令封装了subprocess的Popen方法, 支持超时判断,支持读取stdout和stderr + + Arguments: + cmdstring {[type]} -- 命令字符创 + + Keyword Arguments: + cwd {str} -- 运行命令时更改路径,如果被设定,子进程会直接先更改当前路径到cwd (default: {None}) + timeout {str} -- 超时时间,秒,支持小数,精度0.1秒 (default: {None}) + shell {bool} -- 是否通过shell运行 (default: {False}) + """ + + if shell: + cmdstring_list = cmdstring + else: + cmdstring_list = shlex.split(cmdstring) + if timeout: + end_time = datetime.datetime.now() + datetime.timedelta(seconds=timeout) + + # 没有指定标准输出和错误输出的管道,因此会打印到屏幕上; + sub = subprocess.Popen(cmdstring_list, cwd=cwd, stdin=subprocess.PIPE,shell=shell,bufsize=4096) + + # subprocess.poll()方法:检查子进程是否结束了,如果结束了,设定并返回码,放在subprocess.returncode变量中 + while sub.poll() is None: + time.sleep(0.1) + if timeout: + if end_time <= datetime.datetime.now(): + raise Exception("Timeout:%s"%cmdstring) + + return sub.returncode + +def build_library(): + envs = os.environ + cmake_prefix_path = envs.get('CMAKE_PREFIX_PATH', None) + if cmake_prefix_path is None: + raise EnvironmentError("Please specify CMAKE_PREFIX_PATH env.") + + config_command = "cmake -DCMAKE_PREFIX_PATH={} -S {} -B {}" + path_to_source = cwd + path_to_build = os.path.join(cwd, "build") + + if os.path.exists(path_to_build): + shutil.rmtree(path_to_build) + config_command = config_command.format(cmake_prefix_path, path_to_source, path_to_build) + + code = execute_command(config_command) + if code != 0: + raise RuntimeError("Run configure command fail.") + + build_command = "cmake --build {}".format(os.path.join(cwd, "build")) + code = execute_command(build_command) + if code != 0: + raise RuntimeError("Run build Command fail.") + +def main(): + build_library() + extention = Extension( + "matrix", + libraries=["matrix"], + sources=["stub.cc"], + language="c++", + extra_compile_args=['-std=c++11'], + include_dirs=[cwd], + library_dirs=[os.path.join(cwd, "build")] + ) + setup(name="fputs", + version="1.0.0", + description="A Simple Matrix Library.", + author="hanbing", + author_email="beatmight@gmail.com", + ext_modules=[extention] + + ) + +if __name__ == "__main__": + main() \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/PythonExtention/stub.cc b/make/cmake/CMakeTutorial/PythonExtention/stub.cc new file mode 100644 index 0000000..1012e1b --- /dev/null +++ b/make/cmake/CMakeTutorial/PythonExtention/stub.cc @@ -0,0 +1,10 @@ +#define PY_SSIZE_T_CLEAN +#include + +extern PyObject* initModule(); + +PyMODINIT_FUNC +PyInit_matrix(void) +{ + return initModule(); +} \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/PythonExtention/test_matrix.py b/make/cmake/CMakeTutorial/PythonExtention/test_matrix.py new file mode 100644 index 0000000..fa36a1d --- /dev/null +++ b/make/cmake/CMakeTutorial/PythonExtention/test_matrix.py @@ -0,0 +1,68 @@ +import unittest +import matrix +import random + +import numpy as np + + +class TestMatrix(unittest.TestCase): + + def test_initialize(self): + mat_a = matrix.random(2, 3) + mat_b = matrix.ones(2, 3) + mat_c = matrix.zeros(2, 3) + + assert mat_a.colunm == mat_b.colunm == mat_c.colunm == 3 + assert mat_a.row == mat_b.row == mat_c.row == 2 + + def test_matmul(self): + m = random.randint(2, 100) + k = random.randint(2, 100) + n = random.randint(2, 100) + + mat_a = matrix.random(m, k) + mat_b = matrix.random(k, n) + mat_c = mat_a * mat_b + + self.assertEqual( + [mat_c.colunm, mat_c.row], + [n, m] + ) + + def test_add(self): + m = random.randint(2, 100) + n = random.randint(2, 100) + + mat_a = matrix.random(m, n) + mat_b = matrix.random(m, n) + mat_c = mat_a + mat_b + + self.assertEqual( + [mat_c.colunm, mat_c.row], + [n, m] + ) + + def test_minus(self): + m = random.randint(2, 100) + n = random.randint(2, 100) + + mat_a = matrix.random(m, n) + mat_b = matrix.random(m, n) + mat_c = mat_a - mat_b + + self.assertEqual( + [mat_c.colunm, mat_c.row], + [n, m] + ) + + def test_attr(self): + m = np.ones((10, 10)) + n = matrix.ones(10, 10) + + assert n.colunm == 10 + assert n.row == 10 + self.assertEqual(n.data, m.tolist()) + + +if __name__ == "__main__": + unittest.main() diff --git a/make/cmake/CMakeTutorial/README.md b/make/cmake/CMakeTutorial/README.md new file mode 100644 index 0000000..6571a1f --- /dev/null +++ b/make/cmake/CMakeTutorial/README.md @@ -0,0 +1,16 @@ +# Cmake中文实战教程 +本项目以代码讲用法,旨在帮助初学者学习CMake的基本用法,也会结合实际开发经验将最核心最常用的用法使用实际的代码案例进行讲解。该项目很难涵盖CMake的所有用法,本项目只会扮演一个引路者的角色,在实际的项目开发中,要学会根据需求灵活查阅官方文档解决问题。(本教程的所有章节使用c++以及linux环境演示) + +## 目录 +- [find_package的使用指南](FindPackage/README.md) +- [引入外部项目的几种方式](ImportExternalProject/README.md) +- [安装](Installation/README.md) +- [使用包管理工具管理你的依赖库](PackageManage/README.md) +- [编写cuda应用程序](CUDA/README.md) +- [编写Python的c/c++扩展](PythonExtention/README.md) + +## Github Pages +[https://brightxiaohan.github.io/CMakeTutorial/](https://brightxiaohan.github.io/CMakeTutorial/) + +## 知乎博客地址 +[cmake 实用指南](https://zhuanlan.zhihu.com/c_200294809) \ No newline at end of file diff --git a/make/cmake/CMakeTutorial/_config.yml b/make/cmake/CMakeTutorial/_config.yml new file mode 100644 index 0000000..c419263 --- /dev/null +++ b/make/cmake/CMakeTutorial/_config.yml @@ -0,0 +1 @@ +theme: jekyll-theme-cayman \ No newline at end of file diff --git a/cmake/example/.gitignore b/make/cmake/cmake-examples/.gitignore similarity index 100% rename from cmake/example/.gitignore rename to make/cmake/cmake-examples/.gitignore diff --git a/cmake/example/.travis.yml b/make/cmake/cmake-examples/.travis.yml similarity index 100% rename from cmake/example/.travis.yml rename to make/cmake/cmake-examples/.travis.yml diff --git a/cmake/example/01-basic/A-hello-cmake/CMakeLists.txt b/make/cmake/cmake-examples/01-basic/A-hello-cmake/CMakeLists.txt similarity index 100% rename from cmake/example/01-basic/A-hello-cmake/CMakeLists.txt rename to make/cmake/cmake-examples/01-basic/A-hello-cmake/CMakeLists.txt diff --git a/cmake/example/01-basic/A-hello-cmake/README.adoc b/make/cmake/cmake-examples/01-basic/A-hello-cmake/README.adoc similarity index 100% rename from cmake/example/01-basic/A-hello-cmake/README.adoc rename to make/cmake/cmake-examples/01-basic/A-hello-cmake/README.adoc diff --git a/cmake/example/01-basic/A-hello-cmake/main.cpp b/make/cmake/cmake-examples/01-basic/A-hello-cmake/main.cpp similarity index 100% rename from cmake/example/01-basic/A-hello-cmake/main.cpp rename to make/cmake/cmake-examples/01-basic/A-hello-cmake/main.cpp diff --git a/cmake/example/01-basic/B-hello-headers/CMakeLists.txt b/make/cmake/cmake-examples/01-basic/B-hello-headers/CMakeLists.txt similarity index 100% rename from cmake/example/01-basic/B-hello-headers/CMakeLists.txt rename to make/cmake/cmake-examples/01-basic/B-hello-headers/CMakeLists.txt diff --git a/cmake/example/01-basic/B-hello-headers/README.adoc b/make/cmake/cmake-examples/01-basic/B-hello-headers/README.adoc similarity index 100% rename from cmake/example/01-basic/B-hello-headers/README.adoc rename to make/cmake/cmake-examples/01-basic/B-hello-headers/README.adoc diff --git a/cmake/example/01-basic/B-hello-headers/include/Hello.h b/make/cmake/cmake-examples/01-basic/B-hello-headers/include/Hello.h similarity index 100% rename from cmake/example/01-basic/B-hello-headers/include/Hello.h rename to make/cmake/cmake-examples/01-basic/B-hello-headers/include/Hello.h diff --git a/cmake/example/01-basic/B-hello-headers/src/Hello.cpp b/make/cmake/cmake-examples/01-basic/B-hello-headers/src/Hello.cpp similarity index 100% rename from cmake/example/01-basic/B-hello-headers/src/Hello.cpp rename to make/cmake/cmake-examples/01-basic/B-hello-headers/src/Hello.cpp diff --git a/cmake/example/01-basic/B-hello-headers/src/main.cpp b/make/cmake/cmake-examples/01-basic/B-hello-headers/src/main.cpp similarity index 100% rename from cmake/example/01-basic/B-hello-headers/src/main.cpp rename to make/cmake/cmake-examples/01-basic/B-hello-headers/src/main.cpp diff --git a/cmake/example/01-basic/C-static-library/CMakeLists.txt b/make/cmake/cmake-examples/01-basic/C-static-library/CMakeLists.txt similarity index 100% rename from cmake/example/01-basic/C-static-library/CMakeLists.txt rename to make/cmake/cmake-examples/01-basic/C-static-library/CMakeLists.txt diff --git a/cmake/example/01-basic/C-static-library/README.adoc b/make/cmake/cmake-examples/01-basic/C-static-library/README.adoc similarity index 100% rename from cmake/example/01-basic/C-static-library/README.adoc rename to make/cmake/cmake-examples/01-basic/C-static-library/README.adoc diff --git a/cmake/example/01-basic/C-static-library/include/static/Hello.h b/make/cmake/cmake-examples/01-basic/C-static-library/include/static/Hello.h similarity index 100% rename from cmake/example/01-basic/C-static-library/include/static/Hello.h rename to make/cmake/cmake-examples/01-basic/C-static-library/include/static/Hello.h diff --git a/cmake/example/01-basic/C-static-library/src/Hello.cpp b/make/cmake/cmake-examples/01-basic/C-static-library/src/Hello.cpp similarity index 100% rename from cmake/example/01-basic/C-static-library/src/Hello.cpp rename to make/cmake/cmake-examples/01-basic/C-static-library/src/Hello.cpp diff --git a/cmake/example/01-basic/C-static-library/src/main.cpp b/make/cmake/cmake-examples/01-basic/C-static-library/src/main.cpp similarity index 100% rename from cmake/example/01-basic/C-static-library/src/main.cpp rename to make/cmake/cmake-examples/01-basic/C-static-library/src/main.cpp diff --git a/cmake/example/01-basic/D-shared-library/CMakeLists.txt b/make/cmake/cmake-examples/01-basic/D-shared-library/CMakeLists.txt similarity index 100% rename from cmake/example/01-basic/D-shared-library/CMakeLists.txt rename to make/cmake/cmake-examples/01-basic/D-shared-library/CMakeLists.txt diff --git a/cmake/example/01-basic/D-shared-library/README.adoc b/make/cmake/cmake-examples/01-basic/D-shared-library/README.adoc similarity index 100% rename from cmake/example/01-basic/D-shared-library/README.adoc rename to make/cmake/cmake-examples/01-basic/D-shared-library/README.adoc diff --git a/cmake/example/01-basic/D-shared-library/include/shared/Hello.h b/make/cmake/cmake-examples/01-basic/D-shared-library/include/shared/Hello.h similarity index 100% rename from cmake/example/01-basic/D-shared-library/include/shared/Hello.h rename to make/cmake/cmake-examples/01-basic/D-shared-library/include/shared/Hello.h diff --git a/cmake/example/01-basic/D-shared-library/src/Hello.cpp b/make/cmake/cmake-examples/01-basic/D-shared-library/src/Hello.cpp similarity index 100% rename from cmake/example/01-basic/D-shared-library/src/Hello.cpp rename to make/cmake/cmake-examples/01-basic/D-shared-library/src/Hello.cpp diff --git a/cmake/example/01-basic/D-shared-library/src/main.cpp b/make/cmake/cmake-examples/01-basic/D-shared-library/src/main.cpp similarity index 100% rename from cmake/example/01-basic/D-shared-library/src/main.cpp rename to make/cmake/cmake-examples/01-basic/D-shared-library/src/main.cpp diff --git a/cmake/example/01-basic/E-installing/CMakeLists.txt b/make/cmake/cmake-examples/01-basic/E-installing/CMakeLists.txt similarity index 100% rename from cmake/example/01-basic/E-installing/CMakeLists.txt rename to make/cmake/cmake-examples/01-basic/E-installing/CMakeLists.txt diff --git a/cmake/example/01-basic/E-installing/README.adoc b/make/cmake/cmake-examples/01-basic/E-installing/README.adoc similarity index 100% rename from cmake/example/01-basic/E-installing/README.adoc rename to make/cmake/cmake-examples/01-basic/E-installing/README.adoc diff --git a/cmake/example/01-basic/E-installing/cmake-examples.conf b/make/cmake/cmake-examples/01-basic/E-installing/cmake-examples.conf similarity index 100% rename from cmake/example/01-basic/E-installing/cmake-examples.conf rename to make/cmake/cmake-examples/01-basic/E-installing/cmake-examples.conf diff --git a/cmake/example/01-basic/E-installing/include/installing/Hello.h b/make/cmake/cmake-examples/01-basic/E-installing/include/installing/Hello.h similarity index 100% rename from cmake/example/01-basic/E-installing/include/installing/Hello.h rename to make/cmake/cmake-examples/01-basic/E-installing/include/installing/Hello.h diff --git a/cmake/example/01-basic/E-installing/src/Hello.cpp b/make/cmake/cmake-examples/01-basic/E-installing/src/Hello.cpp similarity index 100% rename from cmake/example/01-basic/E-installing/src/Hello.cpp rename to make/cmake/cmake-examples/01-basic/E-installing/src/Hello.cpp diff --git a/cmake/example/01-basic/E-installing/src/main.cpp b/make/cmake/cmake-examples/01-basic/E-installing/src/main.cpp similarity index 100% rename from cmake/example/01-basic/E-installing/src/main.cpp rename to make/cmake/cmake-examples/01-basic/E-installing/src/main.cpp diff --git a/cmake/example/01-basic/F-build-type/CMakeLists.txt b/make/cmake/cmake-examples/01-basic/F-build-type/CMakeLists.txt similarity index 100% rename from cmake/example/01-basic/F-build-type/CMakeLists.txt rename to make/cmake/cmake-examples/01-basic/F-build-type/CMakeLists.txt diff --git a/cmake/example/01-basic/F-build-type/README.adoc b/make/cmake/cmake-examples/01-basic/F-build-type/README.adoc similarity index 100% rename from cmake/example/01-basic/F-build-type/README.adoc rename to make/cmake/cmake-examples/01-basic/F-build-type/README.adoc diff --git a/cmake/example/01-basic/F-build-type/cmake-gui-build-type.png b/make/cmake/cmake-examples/01-basic/F-build-type/cmake-gui-build-type.png similarity index 100% rename from cmake/example/01-basic/F-build-type/cmake-gui-build-type.png rename to make/cmake/cmake-examples/01-basic/F-build-type/cmake-gui-build-type.png diff --git a/cmake/example/01-basic/F-build-type/main.cpp b/make/cmake/cmake-examples/01-basic/F-build-type/main.cpp similarity index 100% rename from cmake/example/01-basic/F-build-type/main.cpp rename to make/cmake/cmake-examples/01-basic/F-build-type/main.cpp diff --git a/cmake/example/01-basic/G-compile-flags/CMakeLists.txt b/make/cmake/cmake-examples/01-basic/G-compile-flags/CMakeLists.txt similarity index 100% rename from cmake/example/01-basic/G-compile-flags/CMakeLists.txt rename to make/cmake/cmake-examples/01-basic/G-compile-flags/CMakeLists.txt diff --git a/cmake/example/01-basic/G-compile-flags/README.adoc b/make/cmake/cmake-examples/01-basic/G-compile-flags/README.adoc similarity index 100% rename from cmake/example/01-basic/G-compile-flags/README.adoc rename to make/cmake/cmake-examples/01-basic/G-compile-flags/README.adoc diff --git a/cmake/example/01-basic/G-compile-flags/main.cpp b/make/cmake/cmake-examples/01-basic/G-compile-flags/main.cpp similarity index 100% rename from cmake/example/01-basic/G-compile-flags/main.cpp rename to make/cmake/cmake-examples/01-basic/G-compile-flags/main.cpp diff --git a/cmake/example/01-basic/H-third-party-library/CMakeLists.txt b/make/cmake/cmake-examples/01-basic/H-third-party-library/CMakeLists.txt similarity index 100% rename from cmake/example/01-basic/H-third-party-library/CMakeLists.txt rename to make/cmake/cmake-examples/01-basic/H-third-party-library/CMakeLists.txt diff --git a/cmake/example/01-basic/H-third-party-library/README.adoc b/make/cmake/cmake-examples/01-basic/H-third-party-library/README.adoc similarity index 100% rename from cmake/example/01-basic/H-third-party-library/README.adoc rename to make/cmake/cmake-examples/01-basic/H-third-party-library/README.adoc diff --git a/cmake/example/01-basic/H-third-party-library/main.cpp b/make/cmake/cmake-examples/01-basic/H-third-party-library/main.cpp similarity index 100% rename from cmake/example/01-basic/H-third-party-library/main.cpp rename to make/cmake/cmake-examples/01-basic/H-third-party-library/main.cpp diff --git a/cmake/example/01-basic/I-compiling-with-clang/CMakeLists.txt b/make/cmake/cmake-examples/01-basic/I-compiling-with-clang/CMakeLists.txt similarity index 100% rename from cmake/example/01-basic/I-compiling-with-clang/CMakeLists.txt rename to make/cmake/cmake-examples/01-basic/I-compiling-with-clang/CMakeLists.txt diff --git a/cmake/example/01-basic/I-compiling-with-clang/README.adoc b/make/cmake/cmake-examples/01-basic/I-compiling-with-clang/README.adoc similarity index 100% rename from cmake/example/01-basic/I-compiling-with-clang/README.adoc rename to make/cmake/cmake-examples/01-basic/I-compiling-with-clang/README.adoc diff --git a/cmake/example/01-basic/I-compiling-with-clang/main.cpp b/make/cmake/cmake-examples/01-basic/I-compiling-with-clang/main.cpp similarity index 100% rename from cmake/example/01-basic/I-compiling-with-clang/main.cpp rename to make/cmake/cmake-examples/01-basic/I-compiling-with-clang/main.cpp diff --git a/cmake/example/01-basic/I-compiling-with-clang/pre_test.sh b/make/cmake/cmake-examples/01-basic/I-compiling-with-clang/pre_test.sh old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/01-basic/I-compiling-with-clang/pre_test.sh rename to make/cmake/cmake-examples/01-basic/I-compiling-with-clang/pre_test.sh diff --git a/cmake/example/01-basic/I-compiling-with-clang/run_test.sh b/make/cmake/cmake-examples/01-basic/I-compiling-with-clang/run_test.sh old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/01-basic/I-compiling-with-clang/run_test.sh rename to make/cmake/cmake-examples/01-basic/I-compiling-with-clang/run_test.sh diff --git a/cmake/example/01-basic/J-building-with-ninja/CMakeLists.txt b/make/cmake/cmake-examples/01-basic/J-building-with-ninja/CMakeLists.txt similarity index 100% rename from cmake/example/01-basic/J-building-with-ninja/CMakeLists.txt rename to make/cmake/cmake-examples/01-basic/J-building-with-ninja/CMakeLists.txt diff --git a/cmake/example/01-basic/J-building-with-ninja/README.adoc b/make/cmake/cmake-examples/01-basic/J-building-with-ninja/README.adoc similarity index 100% rename from cmake/example/01-basic/J-building-with-ninja/README.adoc rename to make/cmake/cmake-examples/01-basic/J-building-with-ninja/README.adoc diff --git a/cmake/example/01-basic/J-building-with-ninja/main.cpp b/make/cmake/cmake-examples/01-basic/J-building-with-ninja/main.cpp similarity index 100% rename from cmake/example/01-basic/J-building-with-ninja/main.cpp rename to make/cmake/cmake-examples/01-basic/J-building-with-ninja/main.cpp diff --git a/cmake/example/01-basic/J-building-with-ninja/pre_test.sh b/make/cmake/cmake-examples/01-basic/J-building-with-ninja/pre_test.sh old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/01-basic/J-building-with-ninja/pre_test.sh rename to make/cmake/cmake-examples/01-basic/J-building-with-ninja/pre_test.sh diff --git a/cmake/example/01-basic/J-building-with-ninja/run_test.sh b/make/cmake/cmake-examples/01-basic/J-building-with-ninja/run_test.sh old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/01-basic/J-building-with-ninja/run_test.sh rename to make/cmake/cmake-examples/01-basic/J-building-with-ninja/run_test.sh diff --git a/cmake/example/01-basic/K-imported-targets/CMakeLists.txt b/make/cmake/cmake-examples/01-basic/K-imported-targets/CMakeLists.txt similarity index 100% rename from cmake/example/01-basic/K-imported-targets/CMakeLists.txt rename to make/cmake/cmake-examples/01-basic/K-imported-targets/CMakeLists.txt diff --git a/cmake/example/01-basic/K-imported-targets/README.adoc b/make/cmake/cmake-examples/01-basic/K-imported-targets/README.adoc similarity index 100% rename from cmake/example/01-basic/K-imported-targets/README.adoc rename to make/cmake/cmake-examples/01-basic/K-imported-targets/README.adoc diff --git a/cmake/example/01-basic/K-imported-targets/main.cpp b/make/cmake/cmake-examples/01-basic/K-imported-targets/main.cpp similarity index 100% rename from cmake/example/01-basic/K-imported-targets/main.cpp rename to make/cmake/cmake-examples/01-basic/K-imported-targets/main.cpp diff --git a/cmake/example/01-basic/K-imported-targets/run_test.sh b/make/cmake/cmake-examples/01-basic/K-imported-targets/run_test.sh old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/01-basic/K-imported-targets/run_test.sh rename to make/cmake/cmake-examples/01-basic/K-imported-targets/run_test.sh diff --git a/cmake/example/01-basic/L-cpp-standard/README.adoc b/make/cmake/cmake-examples/01-basic/L-cpp-standard/README.adoc similarity index 100% rename from cmake/example/01-basic/L-cpp-standard/README.adoc rename to make/cmake/cmake-examples/01-basic/L-cpp-standard/README.adoc diff --git a/cmake/example/01-basic/L-cpp-standard/i-common-method/CMakeLists.txt b/make/cmake/cmake-examples/01-basic/L-cpp-standard/i-common-method/CMakeLists.txt similarity index 100% rename from cmake/example/01-basic/L-cpp-standard/i-common-method/CMakeLists.txt rename to make/cmake/cmake-examples/01-basic/L-cpp-standard/i-common-method/CMakeLists.txt diff --git a/cmake/example/01-basic/L-cpp-standard/i-common-method/README.adoc b/make/cmake/cmake-examples/01-basic/L-cpp-standard/i-common-method/README.adoc similarity index 100% rename from cmake/example/01-basic/L-cpp-standard/i-common-method/README.adoc rename to make/cmake/cmake-examples/01-basic/L-cpp-standard/i-common-method/README.adoc diff --git a/cmake/example/01-basic/L-cpp-standard/i-common-method/main.cpp b/make/cmake/cmake-examples/01-basic/L-cpp-standard/i-common-method/main.cpp similarity index 100% rename from cmake/example/01-basic/L-cpp-standard/i-common-method/main.cpp rename to make/cmake/cmake-examples/01-basic/L-cpp-standard/i-common-method/main.cpp diff --git a/cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/CMakeLists.txt b/make/cmake/cmake-examples/01-basic/L-cpp-standard/ii-cxx-standard/CMakeLists.txt similarity index 100% rename from cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/CMakeLists.txt rename to make/cmake/cmake-examples/01-basic/L-cpp-standard/ii-cxx-standard/CMakeLists.txt diff --git a/cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/README.adoc b/make/cmake/cmake-examples/01-basic/L-cpp-standard/ii-cxx-standard/README.adoc similarity index 100% rename from cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/README.adoc rename to make/cmake/cmake-examples/01-basic/L-cpp-standard/ii-cxx-standard/README.adoc diff --git a/cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/main.cpp b/make/cmake/cmake-examples/01-basic/L-cpp-standard/ii-cxx-standard/main.cpp similarity index 100% rename from cmake/example/01-basic/L-cpp-standard/ii-cxx-standard/main.cpp rename to make/cmake/cmake-examples/01-basic/L-cpp-standard/ii-cxx-standard/main.cpp diff --git a/cmake/example/01-basic/L-cpp-standard/iii-compile-features/CMakeLists.txt b/make/cmake/cmake-examples/01-basic/L-cpp-standard/iii-compile-features/CMakeLists.txt similarity index 100% rename from cmake/example/01-basic/L-cpp-standard/iii-compile-features/CMakeLists.txt rename to make/cmake/cmake-examples/01-basic/L-cpp-standard/iii-compile-features/CMakeLists.txt diff --git a/cmake/example/01-basic/L-cpp-standard/iii-compile-features/README.adoc b/make/cmake/cmake-examples/01-basic/L-cpp-standard/iii-compile-features/README.adoc similarity index 100% rename from cmake/example/01-basic/L-cpp-standard/iii-compile-features/README.adoc rename to make/cmake/cmake-examples/01-basic/L-cpp-standard/iii-compile-features/README.adoc diff --git a/cmake/example/01-basic/L-cpp-standard/iii-compile-features/main.cpp b/make/cmake/cmake-examples/01-basic/L-cpp-standard/iii-compile-features/main.cpp similarity index 100% rename from cmake/example/01-basic/L-cpp-standard/iii-compile-features/main.cpp rename to make/cmake/cmake-examples/01-basic/L-cpp-standard/iii-compile-features/main.cpp diff --git a/cmake/example/01-basic/README.adoc b/make/cmake/cmake-examples/01-basic/README.adoc similarity index 100% rename from cmake/example/01-basic/README.adoc rename to make/cmake/cmake-examples/01-basic/README.adoc diff --git a/cmake/example/02-sub-projects/A-basic/CMakeLists.txt b/make/cmake/cmake-examples/02-sub-projects/A-basic/CMakeLists.txt similarity index 100% rename from cmake/example/02-sub-projects/A-basic/CMakeLists.txt rename to make/cmake/cmake-examples/02-sub-projects/A-basic/CMakeLists.txt diff --git a/cmake/example/02-sub-projects/A-basic/README.adoc b/make/cmake/cmake-examples/02-sub-projects/A-basic/README.adoc similarity index 100% rename from cmake/example/02-sub-projects/A-basic/README.adoc rename to make/cmake/cmake-examples/02-sub-projects/A-basic/README.adoc diff --git a/cmake/example/02-sub-projects/A-basic/subbinary/CMakeLists.txt b/make/cmake/cmake-examples/02-sub-projects/A-basic/subbinary/CMakeLists.txt similarity index 100% rename from cmake/example/02-sub-projects/A-basic/subbinary/CMakeLists.txt rename to make/cmake/cmake-examples/02-sub-projects/A-basic/subbinary/CMakeLists.txt diff --git a/cmake/example/02-sub-projects/A-basic/subbinary/main.cpp b/make/cmake/cmake-examples/02-sub-projects/A-basic/subbinary/main.cpp similarity index 100% rename from cmake/example/02-sub-projects/A-basic/subbinary/main.cpp rename to make/cmake/cmake-examples/02-sub-projects/A-basic/subbinary/main.cpp diff --git a/cmake/example/02-sub-projects/A-basic/sublibrary1/CMakeLists.txt b/make/cmake/cmake-examples/02-sub-projects/A-basic/sublibrary1/CMakeLists.txt similarity index 100% rename from cmake/example/02-sub-projects/A-basic/sublibrary1/CMakeLists.txt rename to make/cmake/cmake-examples/02-sub-projects/A-basic/sublibrary1/CMakeLists.txt diff --git a/cmake/example/02-sub-projects/A-basic/sublibrary1/include/sublib1/sublib1.h b/make/cmake/cmake-examples/02-sub-projects/A-basic/sublibrary1/include/sublib1/sublib1.h similarity index 100% rename from cmake/example/02-sub-projects/A-basic/sublibrary1/include/sublib1/sublib1.h rename to make/cmake/cmake-examples/02-sub-projects/A-basic/sublibrary1/include/sublib1/sublib1.h diff --git a/cmake/example/02-sub-projects/A-basic/sublibrary1/src/sublib1.cpp b/make/cmake/cmake-examples/02-sub-projects/A-basic/sublibrary1/src/sublib1.cpp similarity index 100% rename from cmake/example/02-sub-projects/A-basic/sublibrary1/src/sublib1.cpp rename to make/cmake/cmake-examples/02-sub-projects/A-basic/sublibrary1/src/sublib1.cpp diff --git a/cmake/example/02-sub-projects/A-basic/sublibrary2/CMakeLists.txt b/make/cmake/cmake-examples/02-sub-projects/A-basic/sublibrary2/CMakeLists.txt similarity index 100% rename from cmake/example/02-sub-projects/A-basic/sublibrary2/CMakeLists.txt rename to make/cmake/cmake-examples/02-sub-projects/A-basic/sublibrary2/CMakeLists.txt diff --git a/cmake/example/02-sub-projects/A-basic/sublibrary2/include/sublib2/sublib2.h b/make/cmake/cmake-examples/02-sub-projects/A-basic/sublibrary2/include/sublib2/sublib2.h similarity index 100% rename from cmake/example/02-sub-projects/A-basic/sublibrary2/include/sublib2/sublib2.h rename to make/cmake/cmake-examples/02-sub-projects/A-basic/sublibrary2/include/sublib2/sublib2.h diff --git a/cmake/example/02-sub-projects/README.adoc b/make/cmake/cmake-examples/02-sub-projects/README.adoc similarity index 100% rename from cmake/example/02-sub-projects/README.adoc rename to make/cmake/cmake-examples/02-sub-projects/README.adoc diff --git a/cmake/example/03-code-generation/README.adoc b/make/cmake/cmake-examples/03-code-generation/README.adoc similarity index 100% rename from cmake/example/03-code-generation/README.adoc rename to make/cmake/cmake-examples/03-code-generation/README.adoc diff --git a/cmake/example/03-code-generation/configure-files/CMakeLists.txt b/make/cmake/cmake-examples/03-code-generation/configure-files/CMakeLists.txt similarity index 100% rename from cmake/example/03-code-generation/configure-files/CMakeLists.txt rename to make/cmake/cmake-examples/03-code-generation/configure-files/CMakeLists.txt diff --git a/cmake/example/03-code-generation/configure-files/README.adoc b/make/cmake/cmake-examples/03-code-generation/configure-files/README.adoc similarity index 100% rename from cmake/example/03-code-generation/configure-files/README.adoc rename to make/cmake/cmake-examples/03-code-generation/configure-files/README.adoc diff --git a/cmake/example/03-code-generation/configure-files/main.cpp b/make/cmake/cmake-examples/03-code-generation/configure-files/main.cpp similarity index 100% rename from cmake/example/03-code-generation/configure-files/main.cpp rename to make/cmake/cmake-examples/03-code-generation/configure-files/main.cpp diff --git a/cmake/example/03-code-generation/configure-files/path.h.in b/make/cmake/cmake-examples/03-code-generation/configure-files/path.h.in similarity index 100% rename from cmake/example/03-code-generation/configure-files/path.h.in rename to make/cmake/cmake-examples/03-code-generation/configure-files/path.h.in diff --git a/cmake/example/03-code-generation/configure-files/ver.h.in b/make/cmake/cmake-examples/03-code-generation/configure-files/ver.h.in similarity index 100% rename from cmake/example/03-code-generation/configure-files/ver.h.in rename to make/cmake/cmake-examples/03-code-generation/configure-files/ver.h.in diff --git a/cmake/example/03-code-generation/protobuf/AddressBook.proto b/make/cmake/cmake-examples/03-code-generation/protobuf/AddressBook.proto similarity index 100% rename from cmake/example/03-code-generation/protobuf/AddressBook.proto rename to make/cmake/cmake-examples/03-code-generation/protobuf/AddressBook.proto diff --git a/cmake/example/03-code-generation/protobuf/CMakeLists.txt b/make/cmake/cmake-examples/03-code-generation/protobuf/CMakeLists.txt similarity index 100% rename from cmake/example/03-code-generation/protobuf/CMakeLists.txt rename to make/cmake/cmake-examples/03-code-generation/protobuf/CMakeLists.txt diff --git a/cmake/example/03-code-generation/protobuf/README.adoc b/make/cmake/cmake-examples/03-code-generation/protobuf/README.adoc similarity index 100% rename from cmake/example/03-code-generation/protobuf/README.adoc rename to make/cmake/cmake-examples/03-code-generation/protobuf/README.adoc diff --git a/cmake/example/03-code-generation/protobuf/main.cpp b/make/cmake/cmake-examples/03-code-generation/protobuf/main.cpp similarity index 100% rename from cmake/example/03-code-generation/protobuf/main.cpp rename to make/cmake/cmake-examples/03-code-generation/protobuf/main.cpp diff --git a/cmake/example/04-static-analysis/README.adoc b/make/cmake/cmake-examples/04-static-analysis/README.adoc similarity index 100% rename from cmake/example/04-static-analysis/README.adoc rename to make/cmake/cmake-examples/04-static-analysis/README.adoc diff --git a/cmake/example/04-static-analysis/clang-analyzer/CMakeLists.txt b/make/cmake/cmake-examples/04-static-analysis/clang-analyzer/CMakeLists.txt similarity index 100% rename from cmake/example/04-static-analysis/clang-analyzer/CMakeLists.txt rename to make/cmake/cmake-examples/04-static-analysis/clang-analyzer/CMakeLists.txt diff --git a/cmake/example/04-static-analysis/clang-analyzer/README.adoc b/make/cmake/cmake-examples/04-static-analysis/clang-analyzer/README.adoc similarity index 100% rename from cmake/example/04-static-analysis/clang-analyzer/README.adoc rename to make/cmake/cmake-examples/04-static-analysis/clang-analyzer/README.adoc diff --git a/cmake/example/04-static-analysis/clang-analyzer/run_test.sh b/make/cmake/cmake-examples/04-static-analysis/clang-analyzer/run_test.sh old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/04-static-analysis/clang-analyzer/run_test.sh rename to make/cmake/cmake-examples/04-static-analysis/clang-analyzer/run_test.sh diff --git a/cmake/example/04-static-analysis/clang-analyzer/subproject1/CMakeLists.txt b/make/cmake/cmake-examples/04-static-analysis/clang-analyzer/subproject1/CMakeLists.txt similarity index 100% rename from cmake/example/04-static-analysis/clang-analyzer/subproject1/CMakeLists.txt rename to make/cmake/cmake-examples/04-static-analysis/clang-analyzer/subproject1/CMakeLists.txt diff --git a/cmake/example/04-static-analysis/clang-analyzer/subproject1/main1.cpp b/make/cmake/cmake-examples/04-static-analysis/clang-analyzer/subproject1/main1.cpp similarity index 100% rename from cmake/example/04-static-analysis/clang-analyzer/subproject1/main1.cpp rename to make/cmake/cmake-examples/04-static-analysis/clang-analyzer/subproject1/main1.cpp diff --git a/cmake/example/04-static-analysis/clang-analyzer/subproject2/CMakeLists.txt b/make/cmake/cmake-examples/04-static-analysis/clang-analyzer/subproject2/CMakeLists.txt similarity index 100% rename from cmake/example/04-static-analysis/clang-analyzer/subproject2/CMakeLists.txt rename to make/cmake/cmake-examples/04-static-analysis/clang-analyzer/subproject2/CMakeLists.txt diff --git a/cmake/example/04-static-analysis/clang-analyzer/subproject2/main2.cpp b/make/cmake/cmake-examples/04-static-analysis/clang-analyzer/subproject2/main2.cpp similarity index 100% rename from cmake/example/04-static-analysis/clang-analyzer/subproject2/main2.cpp rename to make/cmake/cmake-examples/04-static-analysis/clang-analyzer/subproject2/main2.cpp diff --git a/cmake/example/04-static-analysis/clang-format/.clang-format b/make/cmake/cmake-examples/04-static-analysis/clang-format/.clang-format similarity index 100% rename from cmake/example/04-static-analysis/clang-format/.clang-format rename to make/cmake/cmake-examples/04-static-analysis/clang-format/.clang-format diff --git a/cmake/example/04-static-analysis/clang-format/CMakeLists.txt b/make/cmake/cmake-examples/04-static-analysis/clang-format/CMakeLists.txt similarity index 100% rename from cmake/example/04-static-analysis/clang-format/CMakeLists.txt rename to make/cmake/cmake-examples/04-static-analysis/clang-format/CMakeLists.txt diff --git a/cmake/example/04-static-analysis/clang-format/README.adoc b/make/cmake/cmake-examples/04-static-analysis/clang-format/README.adoc similarity index 100% rename from cmake/example/04-static-analysis/clang-format/README.adoc rename to make/cmake/cmake-examples/04-static-analysis/clang-format/README.adoc diff --git a/cmake/example/04-static-analysis/clang-format/cmake/modules/FindClangFormat.cmake b/make/cmake/cmake-examples/04-static-analysis/clang-format/cmake/modules/FindClangFormat.cmake similarity index 100% rename from cmake/example/04-static-analysis/clang-format/cmake/modules/FindClangFormat.cmake rename to make/cmake/cmake-examples/04-static-analysis/clang-format/cmake/modules/FindClangFormat.cmake diff --git a/cmake/example/04-static-analysis/clang-format/cmake/modules/clang-format.cmake b/make/cmake/cmake-examples/04-static-analysis/clang-format/cmake/modules/clang-format.cmake similarity index 100% rename from cmake/example/04-static-analysis/clang-format/cmake/modules/clang-format.cmake rename to make/cmake/cmake-examples/04-static-analysis/clang-format/cmake/modules/clang-format.cmake diff --git a/cmake/example/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed b/make/cmake/cmake-examples/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed rename to make/cmake/cmake-examples/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed diff --git a/cmake/example/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed.py b/make/cmake/cmake-examples/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed.py old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed.py rename to make/cmake/cmake-examples/04-static-analysis/clang-format/cmake/scripts/clang-format-check-changed.py diff --git a/cmake/example/04-static-analysis/clang-format/run_test.sh b/make/cmake/cmake-examples/04-static-analysis/clang-format/run_test.sh old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/04-static-analysis/clang-format/run_test.sh rename to make/cmake/cmake-examples/04-static-analysis/clang-format/run_test.sh diff --git a/cmake/example/04-static-analysis/clang-format/subproject1/CMakeLists.txt b/make/cmake/cmake-examples/04-static-analysis/clang-format/subproject1/CMakeLists.txt similarity index 100% rename from cmake/example/04-static-analysis/clang-format/subproject1/CMakeLists.txt rename to make/cmake/cmake-examples/04-static-analysis/clang-format/subproject1/CMakeLists.txt diff --git a/cmake/example/04-static-analysis/clang-format/subproject1/main1.cpp b/make/cmake/cmake-examples/04-static-analysis/clang-format/subproject1/main1.cpp similarity index 100% rename from cmake/example/04-static-analysis/clang-format/subproject1/main1.cpp rename to make/cmake/cmake-examples/04-static-analysis/clang-format/subproject1/main1.cpp diff --git a/cmake/example/04-static-analysis/clang-format/subproject2/CMakeLists.txt b/make/cmake/cmake-examples/04-static-analysis/clang-format/subproject2/CMakeLists.txt similarity index 100% rename from cmake/example/04-static-analysis/clang-format/subproject2/CMakeLists.txt rename to make/cmake/cmake-examples/04-static-analysis/clang-format/subproject2/CMakeLists.txt diff --git a/cmake/example/04-static-analysis/clang-format/subproject2/main2.cpp b/make/cmake/cmake-examples/04-static-analysis/clang-format/subproject2/main2.cpp similarity index 100% rename from cmake/example/04-static-analysis/clang-format/subproject2/main2.cpp rename to make/cmake/cmake-examples/04-static-analysis/clang-format/subproject2/main2.cpp diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/.cppcheck_suppressions b/make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/.cppcheck_suppressions similarity index 100% rename from cmake/example/04-static-analysis/cppcheck-compile-commands/.cppcheck_suppressions rename to make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/.cppcheck_suppressions diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/CMakeLists.txt b/make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/CMakeLists.txt similarity index 100% rename from cmake/example/04-static-analysis/cppcheck-compile-commands/CMakeLists.txt rename to make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/CMakeLists.txt diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/README.adoc b/make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/README.adoc similarity index 100% rename from cmake/example/04-static-analysis/cppcheck-compile-commands/README.adoc rename to make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/README.adoc diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/cmake/modules/FindCppCheck.cmake b/make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/cmake/modules/FindCppCheck.cmake similarity index 100% rename from cmake/example/04-static-analysis/cppcheck-compile-commands/cmake/modules/FindCppCheck.cmake rename to make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/cmake/modules/FindCppCheck.cmake diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/run_test.sh b/make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/run_test.sh old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/04-static-analysis/cppcheck-compile-commands/run_test.sh rename to make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/run_test.sh diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/subproject1/CMakeLists.txt b/make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/subproject1/CMakeLists.txt similarity index 100% rename from cmake/example/04-static-analysis/cppcheck-compile-commands/subproject1/CMakeLists.txt rename to make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/subproject1/CMakeLists.txt diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/subproject1/main1.cpp b/make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/subproject1/main1.cpp similarity index 100% rename from cmake/example/04-static-analysis/cppcheck-compile-commands/subproject1/main1.cpp rename to make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/subproject1/main1.cpp diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/subproject2/CMakeLists.txt b/make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/subproject2/CMakeLists.txt similarity index 100% rename from cmake/example/04-static-analysis/cppcheck-compile-commands/subproject2/CMakeLists.txt rename to make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/subproject2/CMakeLists.txt diff --git a/cmake/example/04-static-analysis/cppcheck-compile-commands/subproject2/main2.cpp b/make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/subproject2/main2.cpp similarity index 100% rename from cmake/example/04-static-analysis/cppcheck-compile-commands/subproject2/main2.cpp rename to make/cmake/cmake-examples/04-static-analysis/cppcheck-compile-commands/subproject2/main2.cpp diff --git a/cmake/example/04-static-analysis/cppcheck/CMakeLists.txt b/make/cmake/cmake-examples/04-static-analysis/cppcheck/CMakeLists.txt similarity index 100% rename from cmake/example/04-static-analysis/cppcheck/CMakeLists.txt rename to make/cmake/cmake-examples/04-static-analysis/cppcheck/CMakeLists.txt diff --git a/cmake/example/04-static-analysis/cppcheck/README.adoc b/make/cmake/cmake-examples/04-static-analysis/cppcheck/README.adoc similarity index 100% rename from cmake/example/04-static-analysis/cppcheck/README.adoc rename to make/cmake/cmake-examples/04-static-analysis/cppcheck/README.adoc diff --git a/cmake/example/04-static-analysis/cppcheck/cmake/analysis.cmake b/make/cmake/cmake-examples/04-static-analysis/cppcheck/cmake/analysis.cmake similarity index 100% rename from cmake/example/04-static-analysis/cppcheck/cmake/analysis.cmake rename to make/cmake/cmake-examples/04-static-analysis/cppcheck/cmake/analysis.cmake diff --git a/cmake/example/04-static-analysis/cppcheck/cmake/modules/FindCppCheck.cmake b/make/cmake/cmake-examples/04-static-analysis/cppcheck/cmake/modules/FindCppCheck.cmake similarity index 100% rename from cmake/example/04-static-analysis/cppcheck/cmake/modules/FindCppCheck.cmake rename to make/cmake/cmake-examples/04-static-analysis/cppcheck/cmake/modules/FindCppCheck.cmake diff --git a/cmake/example/04-static-analysis/cppcheck/run_test.sh b/make/cmake/cmake-examples/04-static-analysis/cppcheck/run_test.sh old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/04-static-analysis/cppcheck/run_test.sh rename to make/cmake/cmake-examples/04-static-analysis/cppcheck/run_test.sh diff --git a/cmake/example/04-static-analysis/cppcheck/subproject1/CMakeLists.txt b/make/cmake/cmake-examples/04-static-analysis/cppcheck/subproject1/CMakeLists.txt similarity index 100% rename from cmake/example/04-static-analysis/cppcheck/subproject1/CMakeLists.txt rename to make/cmake/cmake-examples/04-static-analysis/cppcheck/subproject1/CMakeLists.txt diff --git a/cmake/example/04-static-analysis/cppcheck/subproject1/main1.cpp b/make/cmake/cmake-examples/04-static-analysis/cppcheck/subproject1/main1.cpp similarity index 100% rename from cmake/example/04-static-analysis/cppcheck/subproject1/main1.cpp rename to make/cmake/cmake-examples/04-static-analysis/cppcheck/subproject1/main1.cpp diff --git a/cmake/example/04-static-analysis/cppcheck/subproject2/CMakeLists.txt b/make/cmake/cmake-examples/04-static-analysis/cppcheck/subproject2/CMakeLists.txt similarity index 100% rename from cmake/example/04-static-analysis/cppcheck/subproject2/CMakeLists.txt rename to make/cmake/cmake-examples/04-static-analysis/cppcheck/subproject2/CMakeLists.txt diff --git a/cmake/example/04-static-analysis/cppcheck/subproject2/main2.cpp b/make/cmake/cmake-examples/04-static-analysis/cppcheck/subproject2/main2.cpp similarity index 100% rename from cmake/example/04-static-analysis/cppcheck/subproject2/main2.cpp rename to make/cmake/cmake-examples/04-static-analysis/cppcheck/subproject2/main2.cpp diff --git a/cmake/example/05-unit-testing/README.adoc b/make/cmake/cmake-examples/05-unit-testing/README.adoc similarity index 100% rename from cmake/example/05-unit-testing/README.adoc rename to make/cmake/cmake-examples/05-unit-testing/README.adoc diff --git a/cmake/example/05-unit-testing/boost/CMakeLists.txt b/make/cmake/cmake-examples/05-unit-testing/boost/CMakeLists.txt similarity index 100% rename from cmake/example/05-unit-testing/boost/CMakeLists.txt rename to make/cmake/cmake-examples/05-unit-testing/boost/CMakeLists.txt diff --git a/cmake/example/05-unit-testing/boost/Palindrome.cpp b/make/cmake/cmake-examples/05-unit-testing/boost/Palindrome.cpp similarity index 100% rename from cmake/example/05-unit-testing/boost/Palindrome.cpp rename to make/cmake/cmake-examples/05-unit-testing/boost/Palindrome.cpp diff --git a/cmake/example/05-unit-testing/boost/Palindrome.h b/make/cmake/cmake-examples/05-unit-testing/boost/Palindrome.h similarity index 100% rename from cmake/example/05-unit-testing/boost/Palindrome.h rename to make/cmake/cmake-examples/05-unit-testing/boost/Palindrome.h diff --git a/cmake/example/05-unit-testing/boost/README.adoc b/make/cmake/cmake-examples/05-unit-testing/boost/README.adoc similarity index 100% rename from cmake/example/05-unit-testing/boost/README.adoc rename to make/cmake/cmake-examples/05-unit-testing/boost/README.adoc diff --git a/cmake/example/05-unit-testing/boost/Reverse.cpp b/make/cmake/cmake-examples/05-unit-testing/boost/Reverse.cpp similarity index 100% rename from cmake/example/05-unit-testing/boost/Reverse.cpp rename to make/cmake/cmake-examples/05-unit-testing/boost/Reverse.cpp diff --git a/cmake/example/05-unit-testing/boost/Reverse.h b/make/cmake/cmake-examples/05-unit-testing/boost/Reverse.h similarity index 100% rename from cmake/example/05-unit-testing/boost/Reverse.h rename to make/cmake/cmake-examples/05-unit-testing/boost/Reverse.h diff --git a/cmake/example/05-unit-testing/boost/main.cpp b/make/cmake/cmake-examples/05-unit-testing/boost/main.cpp similarity index 100% rename from cmake/example/05-unit-testing/boost/main.cpp rename to make/cmake/cmake-examples/05-unit-testing/boost/main.cpp diff --git a/cmake/example/05-unit-testing/boost/post_test.sh b/make/cmake/cmake-examples/05-unit-testing/boost/post_test.sh old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/05-unit-testing/boost/post_test.sh rename to make/cmake/cmake-examples/05-unit-testing/boost/post_test.sh diff --git a/cmake/example/05-unit-testing/boost/unit_tests.cpp b/make/cmake/cmake-examples/05-unit-testing/boost/unit_tests.cpp similarity index 100% rename from cmake/example/05-unit-testing/boost/unit_tests.cpp rename to make/cmake/cmake-examples/05-unit-testing/boost/unit_tests.cpp diff --git a/cmake/example/05-unit-testing/catch2-vendored/3rd_party/catch2/CMakeLists.txt b/make/cmake/cmake-examples/05-unit-testing/catch2-vendored/3rd_party/catch2/CMakeLists.txt similarity index 100% rename from cmake/example/05-unit-testing/catch2-vendored/3rd_party/catch2/CMakeLists.txt rename to make/cmake/cmake-examples/05-unit-testing/catch2-vendored/3rd_party/catch2/CMakeLists.txt diff --git a/cmake/example/05-unit-testing/catch2-vendored/3rd_party/catch2/catch2/catch.hpp b/make/cmake/cmake-examples/05-unit-testing/catch2-vendored/3rd_party/catch2/catch2/catch.hpp similarity index 100% rename from cmake/example/05-unit-testing/catch2-vendored/3rd_party/catch2/catch2/catch.hpp rename to make/cmake/cmake-examples/05-unit-testing/catch2-vendored/3rd_party/catch2/catch2/catch.hpp diff --git a/cmake/example/05-unit-testing/catch2-vendored/CMakeLists.txt b/make/cmake/cmake-examples/05-unit-testing/catch2-vendored/CMakeLists.txt similarity index 100% rename from cmake/example/05-unit-testing/catch2-vendored/CMakeLists.txt rename to make/cmake/cmake-examples/05-unit-testing/catch2-vendored/CMakeLists.txt diff --git a/cmake/example/05-unit-testing/catch2-vendored/Palindrome.cpp b/make/cmake/cmake-examples/05-unit-testing/catch2-vendored/Palindrome.cpp similarity index 100% rename from cmake/example/05-unit-testing/catch2-vendored/Palindrome.cpp rename to make/cmake/cmake-examples/05-unit-testing/catch2-vendored/Palindrome.cpp diff --git a/cmake/example/05-unit-testing/catch2-vendored/Palindrome.h b/make/cmake/cmake-examples/05-unit-testing/catch2-vendored/Palindrome.h similarity index 100% rename from cmake/example/05-unit-testing/catch2-vendored/Palindrome.h rename to make/cmake/cmake-examples/05-unit-testing/catch2-vendored/Palindrome.h diff --git a/cmake/example/05-unit-testing/catch2-vendored/README.adoc b/make/cmake/cmake-examples/05-unit-testing/catch2-vendored/README.adoc similarity index 100% rename from cmake/example/05-unit-testing/catch2-vendored/README.adoc rename to make/cmake/cmake-examples/05-unit-testing/catch2-vendored/README.adoc diff --git a/cmake/example/05-unit-testing/catch2-vendored/Reverse.cpp b/make/cmake/cmake-examples/05-unit-testing/catch2-vendored/Reverse.cpp similarity index 100% rename from cmake/example/05-unit-testing/catch2-vendored/Reverse.cpp rename to make/cmake/cmake-examples/05-unit-testing/catch2-vendored/Reverse.cpp diff --git a/cmake/example/05-unit-testing/catch2-vendored/Reverse.h b/make/cmake/cmake-examples/05-unit-testing/catch2-vendored/Reverse.h similarity index 100% rename from cmake/example/05-unit-testing/catch2-vendored/Reverse.h rename to make/cmake/cmake-examples/05-unit-testing/catch2-vendored/Reverse.h diff --git a/cmake/example/05-unit-testing/catch2-vendored/main.cpp b/make/cmake/cmake-examples/05-unit-testing/catch2-vendored/main.cpp similarity index 100% rename from cmake/example/05-unit-testing/catch2-vendored/main.cpp rename to make/cmake/cmake-examples/05-unit-testing/catch2-vendored/main.cpp diff --git a/cmake/example/05-unit-testing/catch2-vendored/post_test.sh b/make/cmake/cmake-examples/05-unit-testing/catch2-vendored/post_test.sh old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/05-unit-testing/catch2-vendored/post_test.sh rename to make/cmake/cmake-examples/05-unit-testing/catch2-vendored/post_test.sh diff --git a/cmake/example/05-unit-testing/catch2-vendored/unit_tests.cpp b/make/cmake/cmake-examples/05-unit-testing/catch2-vendored/unit_tests.cpp similarity index 100% rename from cmake/example/05-unit-testing/catch2-vendored/unit_tests.cpp rename to make/cmake/cmake-examples/05-unit-testing/catch2-vendored/unit_tests.cpp diff --git a/cmake/example/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt b/make/cmake/cmake-examples/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt similarity index 100% rename from cmake/example/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt rename to make/cmake/cmake-examples/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt diff --git a/cmake/example/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt.in b/make/cmake/cmake-examples/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt.in similarity index 100% rename from cmake/example/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt.in rename to make/cmake/cmake-examples/05-unit-testing/google-test-download/3rd_party/google-test/CMakeLists.txt.in diff --git a/cmake/example/05-unit-testing/google-test-download/CMakeLists.txt b/make/cmake/cmake-examples/05-unit-testing/google-test-download/CMakeLists.txt similarity index 100% rename from cmake/example/05-unit-testing/google-test-download/CMakeLists.txt rename to make/cmake/cmake-examples/05-unit-testing/google-test-download/CMakeLists.txt diff --git a/cmake/example/05-unit-testing/google-test-download/Palindrome.cpp b/make/cmake/cmake-examples/05-unit-testing/google-test-download/Palindrome.cpp similarity index 100% rename from cmake/example/05-unit-testing/google-test-download/Palindrome.cpp rename to make/cmake/cmake-examples/05-unit-testing/google-test-download/Palindrome.cpp diff --git a/cmake/example/05-unit-testing/google-test-download/Palindrome.h b/make/cmake/cmake-examples/05-unit-testing/google-test-download/Palindrome.h similarity index 100% rename from cmake/example/05-unit-testing/google-test-download/Palindrome.h rename to make/cmake/cmake-examples/05-unit-testing/google-test-download/Palindrome.h diff --git a/cmake/example/05-unit-testing/google-test-download/README.adoc b/make/cmake/cmake-examples/05-unit-testing/google-test-download/README.adoc similarity index 100% rename from cmake/example/05-unit-testing/google-test-download/README.adoc rename to make/cmake/cmake-examples/05-unit-testing/google-test-download/README.adoc diff --git a/cmake/example/05-unit-testing/google-test-download/Reverse.cpp b/make/cmake/cmake-examples/05-unit-testing/google-test-download/Reverse.cpp similarity index 100% rename from cmake/example/05-unit-testing/google-test-download/Reverse.cpp rename to make/cmake/cmake-examples/05-unit-testing/google-test-download/Reverse.cpp diff --git a/cmake/example/05-unit-testing/google-test-download/Reverse.h b/make/cmake/cmake-examples/05-unit-testing/google-test-download/Reverse.h similarity index 100% rename from cmake/example/05-unit-testing/google-test-download/Reverse.h rename to make/cmake/cmake-examples/05-unit-testing/google-test-download/Reverse.h diff --git a/cmake/example/05-unit-testing/google-test-download/main.cpp b/make/cmake/cmake-examples/05-unit-testing/google-test-download/main.cpp similarity index 100% rename from cmake/example/05-unit-testing/google-test-download/main.cpp rename to make/cmake/cmake-examples/05-unit-testing/google-test-download/main.cpp diff --git a/cmake/example/05-unit-testing/google-test-download/post_test.sh b/make/cmake/cmake-examples/05-unit-testing/google-test-download/post_test.sh old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/05-unit-testing/google-test-download/post_test.sh rename to make/cmake/cmake-examples/05-unit-testing/google-test-download/post_test.sh diff --git a/cmake/example/05-unit-testing/google-test-download/run_test.sh b/make/cmake/cmake-examples/05-unit-testing/google-test-download/run_test.sh old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/05-unit-testing/google-test-download/run_test.sh rename to make/cmake/cmake-examples/05-unit-testing/google-test-download/run_test.sh diff --git a/cmake/example/05-unit-testing/google-test-download/unit_tests.cpp b/make/cmake/cmake-examples/05-unit-testing/google-test-download/unit_tests.cpp similarity index 100% rename from cmake/example/05-unit-testing/google-test-download/unit_tests.cpp rename to make/cmake/cmake-examples/05-unit-testing/google-test-download/unit_tests.cpp diff --git a/cmake/example/06-installer/README.adoc b/make/cmake/cmake-examples/06-installer/README.adoc similarity index 100% rename from cmake/example/06-installer/README.adoc rename to make/cmake/cmake-examples/06-installer/README.adoc diff --git a/cmake/example/06-installer/deb/CMakeLists.txt b/make/cmake/cmake-examples/06-installer/deb/CMakeLists.txt similarity index 100% rename from cmake/example/06-installer/deb/CMakeLists.txt rename to make/cmake/cmake-examples/06-installer/deb/CMakeLists.txt diff --git a/cmake/example/06-installer/deb/README.adoc b/make/cmake/cmake-examples/06-installer/deb/README.adoc similarity index 100% rename from cmake/example/06-installer/deb/README.adoc rename to make/cmake/cmake-examples/06-installer/deb/README.adoc diff --git a/cmake/example/06-installer/deb/cmake-examples.conf b/make/cmake/cmake-examples/06-installer/deb/cmake-examples.conf similarity index 100% rename from cmake/example/06-installer/deb/cmake-examples.conf rename to make/cmake/cmake-examples/06-installer/deb/cmake-examples.conf diff --git a/cmake/example/06-installer/deb/include/Hello.h b/make/cmake/cmake-examples/06-installer/deb/include/Hello.h similarity index 100% rename from cmake/example/06-installer/deb/include/Hello.h rename to make/cmake/cmake-examples/06-installer/deb/include/Hello.h diff --git a/cmake/example/06-installer/deb/post_test.sh b/make/cmake/cmake-examples/06-installer/deb/post_test.sh old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/06-installer/deb/post_test.sh rename to make/cmake/cmake-examples/06-installer/deb/post_test.sh diff --git a/cmake/example/06-installer/deb/src/Hello.cpp b/make/cmake/cmake-examples/06-installer/deb/src/Hello.cpp similarity index 100% rename from cmake/example/06-installer/deb/src/Hello.cpp rename to make/cmake/cmake-examples/06-installer/deb/src/Hello.cpp diff --git a/cmake/example/06-installer/deb/src/main.cpp b/make/cmake/cmake-examples/06-installer/deb/src/main.cpp similarity index 100% rename from cmake/example/06-installer/deb/src/main.cpp rename to make/cmake/cmake-examples/06-installer/deb/src/main.cpp diff --git a/cmake/example/07-package-management/A-using-system-provide-packages/README.adoc b/make/cmake/cmake-examples/07-package-management/A-using-system-provide-packages/README.adoc similarity index 100% rename from cmake/example/07-package-management/A-using-system-provide-packages/README.adoc rename to make/cmake/cmake-examples/07-package-management/A-using-system-provide-packages/README.adoc diff --git a/cmake/example/07-package-management/B-vendoring-code/README.adoc b/make/cmake/cmake-examples/07-package-management/B-vendoring-code/README.adoc similarity index 100% rename from cmake/example/07-package-management/B-vendoring-code/README.adoc rename to make/cmake/cmake-examples/07-package-management/B-vendoring-code/README.adoc diff --git a/cmake/example/07-package-management/C-external-project-add/README.adoc b/make/cmake/cmake-examples/07-package-management/C-external-project-add/README.adoc similarity index 100% rename from cmake/example/07-package-management/C-external-project-add/README.adoc rename to make/cmake/cmake-examples/07-package-management/C-external-project-add/README.adoc diff --git a/cmake/example/07-package-management/D-conan/README.adoc b/make/cmake/cmake-examples/07-package-management/D-conan/README.adoc similarity index 100% rename from cmake/example/07-package-management/D-conan/README.adoc rename to make/cmake/cmake-examples/07-package-management/D-conan/README.adoc diff --git a/cmake/example/07-package-management/D-conan/i-basic/CMakeLists.txt b/make/cmake/cmake-examples/07-package-management/D-conan/i-basic/CMakeLists.txt similarity index 100% rename from cmake/example/07-package-management/D-conan/i-basic/CMakeLists.txt rename to make/cmake/cmake-examples/07-package-management/D-conan/i-basic/CMakeLists.txt diff --git a/cmake/example/07-package-management/D-conan/i-basic/README.adoc b/make/cmake/cmake-examples/07-package-management/D-conan/i-basic/README.adoc similarity index 100% rename from cmake/example/07-package-management/D-conan/i-basic/README.adoc rename to make/cmake/cmake-examples/07-package-management/D-conan/i-basic/README.adoc diff --git a/cmake/example/07-package-management/D-conan/i-basic/conanfile.txt b/make/cmake/cmake-examples/07-package-management/D-conan/i-basic/conanfile.txt similarity index 100% rename from cmake/example/07-package-management/D-conan/i-basic/conanfile.txt rename to make/cmake/cmake-examples/07-package-management/D-conan/i-basic/conanfile.txt diff --git a/cmake/example/07-package-management/D-conan/i-basic/main.cpp b/make/cmake/cmake-examples/07-package-management/D-conan/i-basic/main.cpp similarity index 100% rename from cmake/example/07-package-management/D-conan/i-basic/main.cpp rename to make/cmake/cmake-examples/07-package-management/D-conan/i-basic/main.cpp diff --git a/cmake/example/07-package-management/D-conan/i-basic/run_test.sh b/make/cmake/cmake-examples/07-package-management/D-conan/i-basic/run_test.sh old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/07-package-management/D-conan/i-basic/run_test.sh rename to make/cmake/cmake-examples/07-package-management/D-conan/i-basic/run_test.sh diff --git a/cmake/example/07-package-management/D-conan/ii-basic-targets/CMakeLists.txt b/make/cmake/cmake-examples/07-package-management/D-conan/ii-basic-targets/CMakeLists.txt similarity index 100% rename from cmake/example/07-package-management/D-conan/ii-basic-targets/CMakeLists.txt rename to make/cmake/cmake-examples/07-package-management/D-conan/ii-basic-targets/CMakeLists.txt diff --git a/cmake/example/07-package-management/D-conan/ii-basic-targets/README.adoc b/make/cmake/cmake-examples/07-package-management/D-conan/ii-basic-targets/README.adoc similarity index 100% rename from cmake/example/07-package-management/D-conan/ii-basic-targets/README.adoc rename to make/cmake/cmake-examples/07-package-management/D-conan/ii-basic-targets/README.adoc diff --git a/cmake/example/07-package-management/D-conan/ii-basic-targets/conanfile.txt b/make/cmake/cmake-examples/07-package-management/D-conan/ii-basic-targets/conanfile.txt similarity index 100% rename from cmake/example/07-package-management/D-conan/ii-basic-targets/conanfile.txt rename to make/cmake/cmake-examples/07-package-management/D-conan/ii-basic-targets/conanfile.txt diff --git a/cmake/example/07-package-management/D-conan/ii-basic-targets/main.cpp b/make/cmake/cmake-examples/07-package-management/D-conan/ii-basic-targets/main.cpp similarity index 100% rename from cmake/example/07-package-management/D-conan/ii-basic-targets/main.cpp rename to make/cmake/cmake-examples/07-package-management/D-conan/ii-basic-targets/main.cpp diff --git a/cmake/example/07-package-management/D-conan/ii-basic-targets/run_test.sh b/make/cmake/cmake-examples/07-package-management/D-conan/ii-basic-targets/run_test.sh old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/07-package-management/D-conan/ii-basic-targets/run_test.sh rename to make/cmake/cmake-examples/07-package-management/D-conan/ii-basic-targets/run_test.sh diff --git a/cmake/example/07-package-management/README.adoc b/make/cmake/cmake-examples/07-package-management/README.adoc similarity index 100% rename from cmake/example/07-package-management/README.adoc rename to make/cmake/cmake-examples/07-package-management/README.adoc diff --git a/cmake/example/LICENSE b/make/cmake/cmake-examples/LICENSE similarity index 100% rename from cmake/example/LICENSE rename to make/cmake/cmake-examples/LICENSE diff --git a/cmake/example/README.adoc b/make/cmake/cmake-examples/README.adoc similarity index 100% rename from cmake/example/README.adoc rename to make/cmake/cmake-examples/README.adoc diff --git a/cmake/example/cmake-examples.sublime-project b/make/cmake/cmake-examples/cmake-examples.sublime-project similarity index 100% rename from cmake/example/cmake-examples.sublime-project rename to make/cmake/cmake-examples/cmake-examples.sublime-project diff --git a/cmake/example/dockerfiles/README.adoc b/make/cmake/cmake-examples/dockerfiles/README.adoc similarity index 100% rename from cmake/example/dockerfiles/README.adoc rename to make/cmake/cmake-examples/dockerfiles/README.adoc diff --git a/cmake/example/dockerfiles/setup.sh b/make/cmake/cmake-examples/dockerfiles/setup.sh similarity index 100% rename from cmake/example/dockerfiles/setup.sh rename to make/cmake/cmake-examples/dockerfiles/setup.sh diff --git a/cmake/example/dockerfiles/ubuntu14.04-cmake-3.4.3 b/make/cmake/cmake-examples/dockerfiles/ubuntu14.04-cmake-3.4.3 similarity index 100% rename from cmake/example/dockerfiles/ubuntu14.04-cmake-3.4.3 rename to make/cmake/cmake-examples/dockerfiles/ubuntu14.04-cmake-3.4.3 diff --git a/cmake/example/dockerfiles/ubuntu14.04-default-2.8.12.2 b/make/cmake/cmake-examples/dockerfiles/ubuntu14.04-default-2.8.12.2 similarity index 100% rename from cmake/example/dockerfiles/ubuntu14.04-default-2.8.12.2 rename to make/cmake/cmake-examples/dockerfiles/ubuntu14.04-default-2.8.12.2 diff --git a/cmake/example/dockerfiles/ubuntu16.04-cmake-3.10.3 b/make/cmake/cmake-examples/dockerfiles/ubuntu16.04-cmake-3.10.3 similarity index 100% rename from cmake/example/dockerfiles/ubuntu16.04-cmake-3.10.3 rename to make/cmake/cmake-examples/dockerfiles/ubuntu16.04-cmake-3.10.3 diff --git a/cmake/example/dockerfiles/ubuntu16.04-default-cmake-3.5.1 b/make/cmake/cmake-examples/dockerfiles/ubuntu16.04-default-cmake-3.5.1 similarity index 100% rename from cmake/example/dockerfiles/ubuntu16.04-default-cmake-3.5.1 rename to make/cmake/cmake-examples/dockerfiles/ubuntu16.04-default-cmake-3.5.1 diff --git a/cmake/example/test.sh b/make/cmake/cmake-examples/test.sh old mode 100755 new mode 100644 similarity index 100% rename from cmake/example/test.sh rename to make/cmake/cmake-examples/test.sh diff --git a/cmake/r/CMakeLists.txt b/make/cmake/r/CMakeLists.txt similarity index 100% rename from cmake/r/CMakeLists.txt rename to make/cmake/r/CMakeLists.txt diff --git a/cmake/r/main.c b/make/cmake/r/main.c similarity index 97% rename from cmake/r/main.c rename to make/cmake/r/main.c index b4ed5bb..19f2a3d 100644 --- a/cmake/r/main.c +++ b/make/cmake/r/main.c @@ -1,26 +1,26 @@ -#include -#include "resistor/resistorcal.h" -int main(){ - printf("Welcome to Mayuri's Resistor Calculator(Only for separate routes and 2 resistor in it)\n"); - printf("Make your choice\n> 1.Your have the two resistors of separate routes\n> 2. Your have one of the resistors in the separate routes and the total resistor\nAny other choice is to exit\n"); - char choice; - scanf("%c",&choice); - switch (choice){ - case '1' : printf("Please input your args as [R1 R2]:\n");break; - case '2' : printf("Please input your args as [R1 R]:\n");break; - default : printf("exiting\n");return 0;break; - } - double r1 = -1 ,r2 = -1; - scanf("%lf %lf",&r1,&r2); - while ((r1<0)||(r2<0)) { - printf("args don't meet the requirement(R>0)\n"); - printf("please input them again:\n"); - scanf("%lf %lf",&r1,&r2); - - } - switch (choice){ - case '1' : printf("R=%lf\n",resistorcal(r1,r2,choice));break; - case '2' : printf("R2=%lf\n",resistorcal(r1,r2,choice));break; - } - return 0; -} +#include +#include "resistor/resistorcal.h" +int main(){ + printf("Welcome to Mayuri's Resistor Calculator(Only for separate routes and 2 resistor in it)\n"); + printf("Make your choice\n> 1.Your have the two resistors of separate routes\n> 2. Your have one of the resistors in the separate routes and the total resistor\nAny other choice is to exit\n"); + char choice; + scanf("%c",&choice); + switch (choice){ + case '1' : printf("Please input your args as [R1 R2]:\n");break; + case '2' : printf("Please input your args as [R1 R]:\n");break; + default : printf("exiting\n");return 0;break; + } + double r1 = -1 ,r2 = -1; + scanf("%lf %lf",&r1,&r2); + while ((r1<0)||(r2<0)) { + printf("args don't meet the requirement(R>0)\n"); + printf("please input them again:\n"); + scanf("%lf %lf",&r1,&r2); + + } + switch (choice){ + case '1' : printf("R=%lf\n",resistorcal(r1,r2,choice));break; + case '2' : printf("R2=%lf\n",resistorcal(r1,r2,choice));break; + } + return 0; +} diff --git a/cmake/r/resistor/CMakeLists.txt b/make/cmake/r/resistor/CMakeLists.txt similarity index 100% rename from cmake/r/resistor/CMakeLists.txt rename to make/cmake/r/resistor/CMakeLists.txt diff --git a/cmake/r/resistor/build.sh b/make/cmake/r/resistor/build.sh similarity index 100% rename from cmake/r/resistor/build.sh rename to make/cmake/r/resistor/build.sh diff --git a/cmake/r1/resistor/resistorcal.c b/make/cmake/r/resistor/resistorcal.c similarity index 96% rename from cmake/r1/resistor/resistorcal.c rename to make/cmake/r/resistor/resistorcal.c index 1b30fb3..38c8f73 100644 --- a/cmake/r1/resistor/resistorcal.c +++ b/make/cmake/r/resistor/resistorcal.c @@ -1,9 +1,9 @@ -#include -#include "resistorcal.h" -double resistorcal(double R1,double R2,char type){ - switch (type){ - case '1' : return (R1*R2)/(R1+R2); break; - case '2' : return (R1*R2)/(R1-R2); break; - } - return (double)0; -} +#include +#include "resistorcal.h" +double resistorcal(double R1,double R2,char type){ + switch (type){ + case '1' : return (R1*R2)/(R1+R2); break; + case '2' : return (R1*R2)/(R1-R2); break; + } + return (double)0; +} diff --git a/cmake/r1/resistor/resistorcal.h b/make/cmake/r/resistor/resistorcal.h similarity index 96% rename from cmake/r1/resistor/resistorcal.h rename to make/cmake/r/resistor/resistorcal.h index d2846d0..c77c228 100644 --- a/cmake/r1/resistor/resistorcal.h +++ b/make/cmake/r/resistor/resistorcal.h @@ -1,4 +1,4 @@ -#ifndef _RESISTOR_H -#define _RESISTOR_H -double resistorcal(double R1,double R2,char type); -#endif +#ifndef _RESISTOR_H +#define _RESISTOR_H +double resistorcal(double R1,double R2,char type); +#endif diff --git a/cmake/r1/CMakeLists.txt b/make/cmake/r1/CMakeLists.txt similarity index 100% rename from cmake/r1/CMakeLists.txt rename to make/cmake/r1/CMakeLists.txt diff --git a/cmake/r1/main.c b/make/cmake/r1/main.c similarity index 97% rename from cmake/r1/main.c rename to make/cmake/r1/main.c index b4ed5bb..19f2a3d 100644 --- a/cmake/r1/main.c +++ b/make/cmake/r1/main.c @@ -1,26 +1,26 @@ -#include -#include "resistor/resistorcal.h" -int main(){ - printf("Welcome to Mayuri's Resistor Calculator(Only for separate routes and 2 resistor in it)\n"); - printf("Make your choice\n> 1.Your have the two resistors of separate routes\n> 2. Your have one of the resistors in the separate routes and the total resistor\nAny other choice is to exit\n"); - char choice; - scanf("%c",&choice); - switch (choice){ - case '1' : printf("Please input your args as [R1 R2]:\n");break; - case '2' : printf("Please input your args as [R1 R]:\n");break; - default : printf("exiting\n");return 0;break; - } - double r1 = -1 ,r2 = -1; - scanf("%lf %lf",&r1,&r2); - while ((r1<0)||(r2<0)) { - printf("args don't meet the requirement(R>0)\n"); - printf("please input them again:\n"); - scanf("%lf %lf",&r1,&r2); - - } - switch (choice){ - case '1' : printf("R=%lf\n",resistorcal(r1,r2,choice));break; - case '2' : printf("R2=%lf\n",resistorcal(r1,r2,choice));break; - } - return 0; -} +#include +#include "resistor/resistorcal.h" +int main(){ + printf("Welcome to Mayuri's Resistor Calculator(Only for separate routes and 2 resistor in it)\n"); + printf("Make your choice\n> 1.Your have the two resistors of separate routes\n> 2. Your have one of the resistors in the separate routes and the total resistor\nAny other choice is to exit\n"); + char choice; + scanf("%c",&choice); + switch (choice){ + case '1' : printf("Please input your args as [R1 R2]:\n");break; + case '2' : printf("Please input your args as [R1 R]:\n");break; + default : printf("exiting\n");return 0;break; + } + double r1 = -1 ,r2 = -1; + scanf("%lf %lf",&r1,&r2); + while ((r1<0)||(r2<0)) { + printf("args don't meet the requirement(R>0)\n"); + printf("please input them again:\n"); + scanf("%lf %lf",&r1,&r2); + + } + switch (choice){ + case '1' : printf("R=%lf\n",resistorcal(r1,r2,choice));break; + case '2' : printf("R2=%lf\n",resistorcal(r1,r2,choice));break; + } + return 0; +} diff --git a/cmake/r1/resistor/CMakeLists.txt b/make/cmake/r1/resistor/CMakeLists.txt similarity index 100% rename from cmake/r1/resistor/CMakeLists.txt rename to make/cmake/r1/resistor/CMakeLists.txt diff --git a/cmake/r1/resistor/build.sh b/make/cmake/r1/resistor/build.sh similarity index 100% rename from cmake/r1/resistor/build.sh rename to make/cmake/r1/resistor/build.sh diff --git a/cmake/r/resistor/resistorcal.c b/make/cmake/r1/resistor/resistorcal.c similarity index 96% rename from cmake/r/resistor/resistorcal.c rename to make/cmake/r1/resistor/resistorcal.c index 1b30fb3..38c8f73 100644 --- a/cmake/r/resistor/resistorcal.c +++ b/make/cmake/r1/resistor/resistorcal.c @@ -1,9 +1,9 @@ -#include -#include "resistorcal.h" -double resistorcal(double R1,double R2,char type){ - switch (type){ - case '1' : return (R1*R2)/(R1+R2); break; - case '2' : return (R1*R2)/(R1-R2); break; - } - return (double)0; -} +#include +#include "resistorcal.h" +double resistorcal(double R1,double R2,char type){ + switch (type){ + case '1' : return (R1*R2)/(R1+R2); break; + case '2' : return (R1*R2)/(R1-R2); break; + } + return (double)0; +} diff --git a/cmake/r/resistor/resistorcal.h b/make/cmake/r1/resistor/resistorcal.h similarity index 96% rename from cmake/r/resistor/resistorcal.h rename to make/cmake/r1/resistor/resistorcal.h index d2846d0..c77c228 100644 --- a/cmake/r/resistor/resistorcal.h +++ b/make/cmake/r1/resistor/resistorcal.h @@ -1,4 +1,4 @@ -#ifndef _RESISTOR_H -#define _RESISTOR_H -double resistorcal(double R1,double R2,char type); -#endif +#ifndef _RESISTOR_H +#define _RESISTOR_H +double resistorcal(double R1,double R2,char type); +#endif diff --git a/submodule/CMakeTutorial b/submodule/CMakeTutorial new file mode 160000 index 0000000..ce8e8b9 --- /dev/null +++ b/submodule/CMakeTutorial @@ -0,0 +1 @@ +Subproject commit ce8e8b9d71cf5080b164f1163c31623b5e344c84 diff --git a/c/GenericMakefile b/submodule/GenericMakefile similarity index 100% rename from c/GenericMakefile rename to submodule/GenericMakefile diff --git a/cmake/examples b/submodule/cmake-examples similarity index 100% rename from cmake/examples rename to submodule/cmake-examples From c2c4ac78be00bca423f99af21fb6f76190d125fd Mon Sep 17 00:00:00 2001 From: MayuriNFC <1770747317@qq.com> Date: Sat, 9 Apr 2022 20:03:20 +0800 Subject: [PATCH 73/82] new file: c/bubblesort/CMakeLists.txt new file: c/bubblesort/include/bubblesort.h new file: c/bubblesort/src/bubble.c new file: cpp/websocket/CMakeLists.txt new file: cpp/websocket/build.sh new file: cpp/websocket/include/websocket.h new file: cpp/websocket/src/websocket.c --- c/bubblesort/CMakeLists.txt | 12 ++++++++++++ c/bubblesort/include/bubblesort.h | 6 ++++++ c/bubblesort/src/bubble.c | 18 ++++++++++++++++++ cpp/websocket/CMakeLists.txt | 5 +++++ cpp/websocket/build.sh | 7 +++++++ cpp/websocket/include/websocket.h | 0 cpp/websocket/src/websocket.c | 0 7 files changed, 48 insertions(+) create mode 100644 c/bubblesort/CMakeLists.txt create mode 100644 c/bubblesort/include/bubblesort.h create mode 100644 c/bubblesort/src/bubble.c create mode 100644 cpp/websocket/CMakeLists.txt create mode 100644 cpp/websocket/build.sh create mode 100644 cpp/websocket/include/websocket.h create mode 100644 cpp/websocket/src/websocket.c diff --git a/c/bubblesort/CMakeLists.txt b/c/bubblesort/CMakeLists.txt new file mode 100644 index 0000000..335fdd2 --- /dev/null +++ b/c/bubblesort/CMakeLists.txt @@ -0,0 +1,12 @@ +PROJECT(BUBBLESORT) +CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +INCLUDE_DIRECTORIES( + ${CMAKE_BINARY_DIR}/../include +) +AUX_SOURCE_DIRECTORY( + ${CMAKE_BINARY_DIR}/../src +) +ADD_EXECUTABLE( + bubblesort + bubblesort.cpp +) diff --git a/c/bubblesort/include/bubblesort.h b/c/bubblesort/include/bubblesort.h new file mode 100644 index 0000000..ecc8199 --- /dev/null +++ b/c/bubblesort/include/bubblesort.h @@ -0,0 +1,6 @@ +#ifndef _bubblessort_h +#define _bubblessort_h +#include +#include +int *bubblesort(int *array); +#endif \ No newline at end of file diff --git a/c/bubblesort/src/bubble.c b/c/bubblesort/src/bubble.c new file mode 100644 index 0000000..84ac878 --- /dev/null +++ b/c/bubblesort/src/bubble.c @@ -0,0 +1,18 @@ +#include "bubblesort.h" +int main(){ + int a[] = {1,2,3,4,5,6,7,8,9,10}; + bubblesort(a); + return 0; +} +int *bubblesort(int *array){ + int i,j,temp; + for (i=0;iarray[j+1]){ + temp =array[j]; + array[j]=array[j+1]; + array[j+1]=temp; + } + } + } +} \ No newline at end of file diff --git a/cpp/websocket/CMakeLists.txt b/cpp/websocket/CMakeLists.txt new file mode 100644 index 0000000..06ba55c --- /dev/null +++ b/cpp/websocket/CMakeLists.txt @@ -0,0 +1,5 @@ +CMAKE_MINIMUM_REQUIRED(VERSION 2.9) +PROJECT(WEBSOCKET_CPP) +INCLUDE_DIRECTORIES(./include) +AUX_SOURCE_DIRECTORY(./src DIR_SRC) +ADD_EXECUTABLE(./bin ${DIR_SRC}) diff --git a/cpp/websocket/build.sh b/cpp/websocket/build.sh new file mode 100644 index 0000000..cf49c9f --- /dev/null +++ b/cpp/websocket/build.sh @@ -0,0 +1,7 @@ + +rm -rf build +mkdir build +cd build +cmake .. -G "MinGW Makefiles" +make +./bin diff --git a/cpp/websocket/include/websocket.h b/cpp/websocket/include/websocket.h new file mode 100644 index 0000000..e69de29 diff --git a/cpp/websocket/src/websocket.c b/cpp/websocket/src/websocket.c new file mode 100644 index 0000000..e69de29 From c876e108204008dbea1b66559bfe2f3896dd31f2 Mon Sep 17 00:00:00 2001 From: MayuriNFC <1770747317@qq.com> Date: Sat, 9 Apr 2022 20:54:49 +0800 Subject: [PATCH 74/82] fix compile error --- c/bubblesort/CMakeLists.txt | 5 +++-- c/bubblesort/src/bubble.c | 8 ++++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/c/bubblesort/CMakeLists.txt b/c/bubblesort/CMakeLists.txt index 335fdd2..c4e9105 100644 --- a/c/bubblesort/CMakeLists.txt +++ b/c/bubblesort/CMakeLists.txt @@ -1,12 +1,13 @@ PROJECT(BUBBLESORT) -CMAKE_MINIMUM_REQUIRED(VERSION 2.8) +CMAKE_MINIMUM_REQUIRED(VERSION 2.9) INCLUDE_DIRECTORIES( ${CMAKE_BINARY_DIR}/../include ) AUX_SOURCE_DIRECTORY( ${CMAKE_BINARY_DIR}/../src + DIR_SRC ) ADD_EXECUTABLE( bubblesort - bubblesort.cpp + ${DIR_SRC} ) diff --git a/c/bubblesort/src/bubble.c b/c/bubblesort/src/bubble.c index 84ac878..486c6d0 100644 --- a/c/bubblesort/src/bubble.c +++ b/c/bubblesort/src/bubble.c @@ -1,7 +1,10 @@ -#include "bubblesort.h" +#include "../include/bubblesort.h" int main(){ int a[] = {1,2,3,4,5,6,7,8,9,10}; - bubblesort(a); + int i; + for (i=0;i Date: Sun, 24 Apr 2022 16:49:15 +0800 Subject: [PATCH 75/82] fix type warning --- c/bubblesort/include/bubblesort.h | 2 +- c/bubblesort/src/bubble.c | 31 ++++++++++++++++++------------- 2 files changed, 19 insertions(+), 14 deletions(-) diff --git a/c/bubblesort/include/bubblesort.h b/c/bubblesort/include/bubblesort.h index ecc8199..616767d 100644 --- a/c/bubblesort/include/bubblesort.h +++ b/c/bubblesort/include/bubblesort.h @@ -2,5 +2,5 @@ #define _bubblessort_h #include #include -int *bubblesort(int *array); +void *bubblesort(int *array); #endif \ No newline at end of file diff --git a/c/bubblesort/src/bubble.c b/c/bubblesort/src/bubble.c index 486c6d0..77854af 100644 --- a/c/bubblesort/src/bubble.c +++ b/c/bubblesort/src/bubble.c @@ -1,22 +1,27 @@ #include "../include/bubblesort.h" -int main(){ - int a[] = {1,2,3,4,5,6,7,8,9,10}; +int main() +{ + int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; int i; - for (i=0;iarray[j+1]){ - temp =array[j]; - array[j]=array[j+1]; - array[j+1]=temp; +void *bubblesort(int array[]) +{ + int i, j, temp; + for (i = 0; i < sizeof(array) / sizeof(array[0]); i++) + { + for (j = 0; j < sizeof(array) / sizeof(array[0]) - i - 1; j++) + { + if (array[j] > array[j + 1]) + { + temp = array[j]; + array[j] = array[j + 1]; + array[j + 1] = temp; } } } - return *array; } \ No newline at end of file From 54c591fd9f4ea222cc4f6b98644d273d0cbf55a2 Mon Sep 17 00:00:00 2001 From: MayuriNFC <1770747317@qq.com> Date: Mon, 25 Apr 2022 08:03:21 +0000 Subject: [PATCH 76/82] modified: c/bubblesort/include/bubblesort.h modified: c/bubblesort/src/bubble.c --- c/bubblesort/include/bubblesort.h | 4 ++-- c/bubblesort/src/bubble.c | 14 ++++++++------ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/c/bubblesort/include/bubblesort.h b/c/bubblesort/include/bubblesort.h index 616767d..8d77b72 100644 --- a/c/bubblesort/include/bubblesort.h +++ b/c/bubblesort/include/bubblesort.h @@ -2,5 +2,5 @@ #define _bubblessort_h #include #include -void *bubblesort(int *array); -#endif \ No newline at end of file +void bubblesort(int *array, int size); +#endif diff --git a/c/bubblesort/src/bubble.c b/c/bubblesort/src/bubble.c index 77854af..65f064a 100644 --- a/c/bubblesort/src/bubble.c +++ b/c/bubblesort/src/bubble.c @@ -1,20 +1,22 @@ #include "../include/bubblesort.h" int main() { - int a[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; + int a[] = {5, 3, 7, 9, 6, 8, 1, 4, 2, 10}; int i; - for (i = 0; i < sizeof(a) / sizeof(a[0]); i++) + int size = sizeof(a)/sizeof(a[0]); + for (i = 0; i < size; i++) { + bubblesort(a,10); printf("%d\n", a[i]); } return 0; } -void *bubblesort(int array[]) +void bubblesort(int array[],int size) { int i, j, temp; - for (i = 0; i < sizeof(array) / sizeof(array[0]); i++) + for (i = 0; i < size; i++) { - for (j = 0; j < sizeof(array) / sizeof(array[0]) - i - 1; j++) + for (j = 0; j < size - i - 1; j++) { if (array[j] > array[j + 1]) { @@ -24,4 +26,4 @@ void *bubblesort(int array[]) } } } -} \ No newline at end of file +} From 7f69b1efd8347e4d407b547775195cc21de1f478 Mon Sep 17 00:00:00 2001 From: MayuriNFC <1770747317@qq.com> Date: Thu, 28 Apr 2022 19:22:31 +0800 Subject: [PATCH 77/82] new file: .vscode/launch.json new file: .vscode/tasks.json modified: src/bubble.c new file: src/bubblesort.code-workspace --- c/bubblesort/.vscode/launch.json | 34 ++++++++++++++++++++++ c/bubblesort/.vscode/tasks.json | 28 ++++++++++++++++++ c/bubblesort/src/bubble.c | 10 +++++-- c/bubblesort/src/bubblesort.code-workspace | 10 +++++++ 4 files changed, 80 insertions(+), 2 deletions(-) create mode 100644 c/bubblesort/.vscode/launch.json create mode 100644 c/bubblesort/.vscode/tasks.json create mode 100644 c/bubblesort/src/bubblesort.code-workspace diff --git a/c/bubblesort/.vscode/launch.json b/c/bubblesort/.vscode/launch.json new file mode 100644 index 0000000..e72133c --- /dev/null +++ b/c/bubblesort/.vscode/launch.json @@ -0,0 +1,34 @@ +{ + // 使用 IntelliSense 了解相关属性。 + // 悬停以查看现有属性的描述。 + // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 + "version": "0.2.0", + "configurations": [ + { + "name": "(gdb) 启动", + "type": "cppdbg", + "request": "launch", + "program": "${workspaceFolder}/build/bubblesort.exe", + "args": [], + "stopAtEntry": false, + "cwd": "${fileDirname}", + "environment": [], + "externalConsole": false, + "MIMode": "gdb", + "miDebuggerPath": "C:/Users/beaut/scoop/shims/gdb.exe", + "setupCommands": [ + { + "description": "为 gdb 启用整齐打印", + "text": "-enable-pretty-printing", + "ignoreFailures": true + }, + { + "description": "将反汇编风格设置为 Intel", + "text": "-gdb-set disassembly-flavor intel", + "ignoreFailures": true + } + ] + } + + ] +} \ No newline at end of file diff --git a/c/bubblesort/.vscode/tasks.json b/c/bubblesort/.vscode/tasks.json new file mode 100644 index 0000000..4698216 --- /dev/null +++ b/c/bubblesort/.vscode/tasks.json @@ -0,0 +1,28 @@ +{ + "tasks": [ + { + "type": "cppbuild", + "label": "C/C++: gcc.exe 生成活动文件", + "command": "C:\\Users\\beaut\\scoop\\apps\\gcc\\current\\bin\\gcc.exe", + "args": [ + "-fdiagnostics-color=always", + "-g", + "${file}", + "-o", + "${fileDirname}\\${fileBasenameNoExtension}.exe" + ], + "options": { + "cwd": "${fileDirname}" + }, + "problemMatcher": [ + "$gcc" + ], + "group": { + "kind": "build", + "isDefault": true + }, + "detail": "调试器生成的任务。" + } + ], + "version": "2.0.0" +} \ No newline at end of file diff --git a/c/bubblesort/src/bubble.c b/c/bubblesort/src/bubble.c index 65f064a..a904add 100644 --- a/c/bubblesort/src/bubble.c +++ b/c/bubblesort/src/bubble.c @@ -1,12 +1,18 @@ #include "../include/bubblesort.h" int main() { - int a[] = {5, 3, 7, 9, 6, 8, 1, 4, 2, 10}; + int a[] = {5, 10, 3, 7, 9, 6, 8, 1, 4, 2}; int i; int size = sizeof(a)/sizeof(a[0]); + printf("Before sorting:\n"); + for (i = 0; i < size; i++) + { + printf("%d\n", a[i]); + } + bubblesort(a,size); + printf("After sorting:\n"); for (i = 0; i < size; i++) { - bubblesort(a,10); printf("%d\n", a[i]); } return 0; diff --git a/c/bubblesort/src/bubblesort.code-workspace b/c/bubblesort/src/bubblesort.code-workspace new file mode 100644 index 0000000..dd7b99c --- /dev/null +++ b/c/bubblesort/src/bubblesort.code-workspace @@ -0,0 +1,10 @@ +{ + "folders": [ + { + "path": ".." + } + ], + "settings": { + "cmake.generator": "MinGW Makefiles", + } +} \ No newline at end of file From 94a31e4832fe942ac5b34e58ca8dfcc3ef33d2cd Mon Sep 17 00:00:00 2001 From: MayuriNFC <1770747317@qq.com> Date: Thu, 28 Apr 2022 19:27:35 +0800 Subject: [PATCH 78/82] update workspace --- c/bubblesort/.vscode/tasks.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/c/bubblesort/.vscode/tasks.json b/c/bubblesort/.vscode/tasks.json index 4698216..6a19a6f 100644 --- a/c/bubblesort/.vscode/tasks.json +++ b/c/bubblesort/.vscode/tasks.json @@ -9,7 +9,7 @@ "-g", "${file}", "-o", - "${fileDirname}\\${fileBasenameNoExtension}.exe" + "${fileDirname}\\..\\build\\${fileBasenameNoExtension}.exe" ], "options": { "cwd": "${fileDirname}" From 518a2187278f42844654a0556a8b59e88b1d9257 Mon Sep 17 00:00:00 2001 From: DataEraser Date: Fri, 29 Apr 2022 11:08:37 +0800 Subject: [PATCH 79/82] add rewrite script --- rewrite.sh | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 rewrite.sh diff --git a/rewrite.sh b/rewrite.sh new file mode 100644 index 0000000..b356298 --- /dev/null +++ b/rewrite.sh @@ -0,0 +1,2 @@ +git filter-branch -f --env-filter "GIT_COMMITTER_NAME=DataEraser; GIT_COMMITTER_EMAIL=MayuriNFC@outlook.com;" +git filter-branch -f --env-filter "GIT_AUTHOR_NAME=DataEraser; GIT_AUTHOR_EMAIL=MayuriNFC@outlook.com; " From b38bcd49259657af3b29496d08c089ad830d252a Mon Sep 17 00:00:00 2001 From: DataEraser Date: Fri, 29 Apr 2022 11:17:43 +0800 Subject: [PATCH 80/82] modified: rewrite.sh --- rewrite.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/rewrite.sh b/rewrite.sh index b356298..b42b4da 100644 --- a/rewrite.sh +++ b/rewrite.sh @@ -1,2 +1,3 @@ git filter-branch -f --env-filter "GIT_COMMITTER_NAME=DataEraser; GIT_COMMITTER_EMAIL=MayuriNFC@outlook.com;" git filter-branch -f --env-filter "GIT_AUTHOR_NAME=DataEraser; GIT_AUTHOR_EMAIL=MayuriNFC@outlook.com; " +git filter-branch -f --env-filter "GIT_COMMITTER_NAME=DataEraser; " From a4e3756a5aba08a064cf79107b4ec3d3fe41ea7a Mon Sep 17 00:00:00 2001 From: DataEraser Date: Fri, 29 Apr 2022 11:21:05 +0800 Subject: [PATCH 81/82] modified: rewrite.sh --- rewrite.sh | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/rewrite.sh b/rewrite.sh index b42b4da..78892dd 100644 --- a/rewrite.sh +++ b/rewrite.sh @@ -1,3 +1,11 @@ git filter-branch -f --env-filter "GIT_COMMITTER_NAME=DataEraser; GIT_COMMITTER_EMAIL=MayuriNFC@outlook.com;" git filter-branch -f --env-filter "GIT_AUTHOR_NAME=DataEraser; GIT_AUTHOR_EMAIL=MayuriNFC@outlook.com; " git filter-branch -f --env-filter "GIT_COMMITTER_NAME=DataEraser; " + +git filter-branch -f --env-filter "if [ $GIT_COMMITTER_NAME == ‘CommitName’ ]; then GIT_COMMITTER_NAME=‘Demo’; fi " + +git filter-branch -f --env-filter "if [ $GIT_AUTHOR_NAME == ‘AuthName’ ]; then GIT_AUTHOR_NAME=‘Demo’; fi " + +git filter-branch -f --env-filter "if [ $GIT_COMMITTER_EMAIL == ‘CommitEmail’ ]; then GIT_COMMITTER_EMAIL=‘Demo’; fi " + +git filter-branch -f --env-filter "if [ $GIT_AUTHOR_EMAIL == ‘AuthEmail’ ]; then GIT_AUTHOR_EMAIL=‘Demo’; fi " From ac735852fad4ce1f71a228b62f91a708c656ce99 Mon Sep 17 00:00:00 2001 From: DataEraser Date: Fri, 29 Apr 2022 11:37:54 +0800 Subject: [PATCH 82/82] new file: r.sh --- r.sh | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 r.sh diff --git a/r.sh b/r.sh new file mode 100644 index 0000000..1828f09 --- /dev/null +++ b/r.sh @@ -0,0 +1,17 @@ +#!/bin/sh + +git filter-branch --env-filter ' +OLD_EMAIL="1770747317@qq.com" +CORRECT_NAME="DataEraser" +CORRECT_EMAIL="MayuriNFC@outlook.com" +if [ "$GIT_COMMITTER_EMAIL" = "$OLD_EMAIL" ] +then + export GIT_COMMITTER_NAME="$CORRECT_NAME" + export GIT_COMMITTER_EMAIL="$CORRECT_EMAIL" +fi +if [ "$GIT_AUTHOR_EMAIL" = "$OLD_EMAIL" ] +then + export GIT_AUTHOR_NAME="$CORRECT_NAME" + export GIT_AUTHOR_EMAIL="$CORRECT_EMAIL" +fi +' --tag-name-filter cat -- --branches --tags