From 43d338d2e9a7f1017016b873abf72de095512b9b Mon Sep 17 00:00:00 2001 From: Thomas Steeples Date: Thu, 29 Oct 2020 02:01:34 +0000 Subject: [PATCH 1/6] =?UTF-8?q?Added=20CMake=20support.=20Created=20new=20?= =?UTF-8?q?src=20and=20include=20directories=20to=20help=20facilitate=20th?= =?UTF-8?q?is.=20Updated=20meson.build=20and=20Makefile=20to=20reflect=20n?= =?UTF-8?q?ew=20directory=20structure.=20Updated=20README.md=20to=20explai?= =?UTF-8?q?n=20how=20to=20integrate=20=C2=B5nit=20into=20a=20project=20usi?= =?UTF-8?q?ng=20CMake.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .DS_Store | Bin 0 -> 6148 bytes .gitignore | 3 ++ CMakeLists.txt | 67 +++++++++++++++++++++++++++++++++++++ Makefile | 4 +-- README.md | 46 +++++++++++++++++-------- munit.h => include/munit.h | 0 meson.build | 13 ++++--- munit.pc.in | 9 +++++ example.c => src/example.c | 0 munit.c => src/munit.c | 0 10 files changed, 119 insertions(+), 23 deletions(-) create mode 100644 .DS_Store create mode 100644 CMakeLists.txt rename munit.h => include/munit.h (100%) create mode 100644 munit.pc.in rename example.c => src/example.c (100%) rename munit.c => src/munit.c (100%) diff --git a/.DS_Store b/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..b827be388b8048c25ed9304d28fed97c5c921bdd GIT binary patch literal 6148 zcmeHK%Wl&^6g|@f>ZAg)Kx&uXAhD>T6iT{4NFhyxBJrpQ0wF+c90zLQ*iq~dAOvN@ zKLCHgr|<=Q2p<4v9;xzT8v&Xt&7A9*d*=Ec$uk}RqB`*RfC2!AO=33BZiUHt*_Ld> zj7XkPYjkiI0TQHa)~o_nfxle=`R!iBA?~4t*O>i&i~Ne;B5j0m+Y4iladMNm$#(UZ zGJ3!!xesuJr)c0l?kq%qTZ#@4p^Xp&_~^_>i|vJI=j^Rsa#snL;y*3KZ=uTy62#0= zgvT6`wyBVfHn^!Ro~`q4Z~)%|&Bd~*9(IrEtP(VjZF63`Ax^kJNXOw7tPan*i2jLAgQ+c&*allD?Rm$ z|0s^bGr#3M4m!i*!sWv_N?SqH=__*JcNp^gNf7z*uo@2{KT+#6^@QW(oZN9?XEfR` zmv-H2H_GE(cXV(-fB$-UJkB}WSN3i-PP*^jk3Nh)eqq5h!J|OgC4*D=O2>%srrD3e zIC{mAY4kM8;@T82(mPvg%V-l>1*`)9iUM+faM>hQ3{Etvt%IGq0uZwtRz_d`CPFs~DVU)N}}Q`4A?vFgFyTvU7b`g+o*{+TJQ)6_{5b zqaO?M{ICD{{y$H$PgVh|z<;HH$kv**DoZkF>r!#@taaH=*rdt0iAF_XXO3g#$fJ0N bO&RB0=@2UhCmK0Ivp)h#2HRN$)~dj76&Sb? literal 0 HcmV?d00001 diff --git a/.gitignore b/.gitignore index 115d637..d10c4de 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ /example /*.exe /*.dll +build/ +lib/ +bin/ \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..8aeea45 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,67 @@ +cmake_minimum_required(VERSION 3.7...3.18) + +if(${CMAKE_VERSION} VERSION_LESS 3.12) + cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) +endif() + +project("munit" VERSION 0.2.0 + DESCRIPTION "µnit Testing Library for C" + LANGUAGES C + ) + +# Options +option(BUILD_SHARED_LIBS "Build shared library" ON) +option(BUILD_STATIC_LIBS "Build static library" ON) +option(BUILD_EXAMPLE "Build example program" OFF) + +if(NOT(${BUILD_SHARED_LIBS} OR ${BUILD_STATIC_LIBS})) + message(FATAL_ERROR "Error: At least one of the static library and the shared library must be built.") +endif() + +set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/lib) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_SOURCE_DIR}/bin) +configure_file(munit.pc.in ${CMAKE_SOURCE_DIR}/lib/pkgconfig/munit.pc @ONLY) + +set(CMAKE_C_STANDARD 99) +set(CMAKE_C_FLAGS_DEBUG "-g -Wall -Wextra -Wpedantic") +set(CMAKE_BUILD_TYPE Release) + +add_library(munit_mod MODULE) +target_sources(munit_mod PRIVATE src/munit.c) +target_include_directories(munit_mod PRIVATE include) + +if(${BUILD_SHARED_LIBS}) + add_library(munit SHARED $) + target_include_directories(munit PUBLIC include) + set_target_properties(munit PROPERTIES OUTPUT_NAME "munit") +endif() + +if(${BUILD_STATIC_LIBS}) + add_library(munit_static STATIC $) + target_include_directories(munit_static PUBLIC include) + set_target_properties(munit_static PROPERTIES OUTPUT_NAME "munit") + install(TARGETS munit_static ARCHIVE) +endif() + +if(${BUILD_EXAMPLE}) + add_executable(munit_example) + target_sources(munit_example PRIVATE src/example.c) + if(${BUILD_STATIC_LIBS}) + target_link_libraries(munit_example munit_static) + else() + target_link_libraries(munit_example munit) + endif() +endif() + +# Installation +install(FILES ${CMAKE_SOURCE_DIR}/lib/pkgconfig/munit.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig) +install(FILES include/munit.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include) + +if(${BUILD_SHARED_LIBS}) + install(TARGETS munit LIBRARY) +endif() + +if(${BUILD_STATIC_LIBS}) + install(TARGETS munit_static LIBRARY) +endif() diff --git a/Makefile b/Makefile index 65d33fc..e03bd87 100644 --- a/Makefile +++ b/Makefile @@ -43,8 +43,8 @@ ifneq ($(CC),pgcc) endif endif -example$(EXTENSION): munit.h munit.c example.c - $(CC) $(CFLAGS) -o $@ munit.c example.c +example$(EXTENSION): include/munit.h src/munit.c src/example.c + $(CC) $(CFLAGS) -o $@ src/munit.c src/example.c test: $(TEST_ENV) ./example$(EXTENSION) diff --git a/README.md b/README.md index 9f861f2..accf58d 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # µnit -µnit is a small but full-featured unit testing framework for C. It has +µnit is a small but full-featured unit testing framework for C. It has no dependencies (beyond libc), is permissively licensed (MIT), and is easy to include into any project. @@ -14,24 +14,24 @@ For more information, see Features µnit currently includes include: - * Handy assertion macros which make for nice error messages. - * Reproducible cross-platform random number generation, including - support for supplying a seed via CLI. - * Timing of both wall-clock and CPU time. - * Parameterized tests. - * Nested test suites. - * Flexible CLI. - * Forking - ([except on Windows](https://github.com/nemequ/munit/issues/2)). - * Hiding output of successful tests. +- Handy assertion macros which make for nice error messages. +- Reproducible cross-platform random number generation, including + support for supplying a seed via CLI. +- Timing of both wall-clock and CPU time. +- Parameterized tests. +- Nested test suites. +- Flexible CLI. +- Forking + ([except on Windows](https://github.com/nemequ/munit/issues/2)). +- Hiding output of successful tests. Features µnit does not currently include, but some day may include (a.k.a., if you file a PR…), include: - * [TAP](http://testanything.org/) support; feel free to discuss in - [issue #1](https://github.com/nemequ/munit/issues/1) +- [TAP](http://testanything.org/) support; feel free to discuss in + [issue #1](https://github.com/nemequ/munit/issues/1) -### Include into your project with meson +### Integrate µnit into your project with meson In your `subprojects` folder put a `munit.wrap` file containing: @@ -45,6 +45,24 @@ revision=head Then you can use a subproject fallback when you include munit as a dependency to your project: `dependency('munit', fallback: ['munit', 'munit_dep'])` +### Integrate µnit into your project with CMake + +You can include µnit as a git submodule and this will expose a `munit` target which can be linked to in your project. Assuming your project is located at `$PROJECT_ROOT`, first add µnit as a submodule: + +``` +cd $PROJECT_ROOT +mkdir extern && cd extern +> git submodule add https://github.com/nemequ/munit +``` + +Then, in your `CMakeLists.txt` file (again, assumed to be located in `$PROJECT_ROOT`), add the following line: + +``` +add_subdirectory(${CMAKE_SOURCE_DIR}/extern/munit) +``` + +and this will expose the `munit` and `munit_static` targets, which can be linked against in your project with `target_link_libraries`. These targets also have the relevant header file embedded within them. + ## Documentation See [the µnit web site](https://nemequ.github.io/munit). diff --git a/munit.h b/include/munit.h similarity index 100% rename from munit.h rename to include/munit.h diff --git a/meson.build b/meson.build index c15b405..4237b7d 100644 --- a/meson.build +++ b/meson.build @@ -1,16 +1,15 @@ -project('munit', 'c') +project('munit', 'c', default_options : ['c_std=c99']) conf_data = configuration_data() conf_data.set('version', '0.2.0') -add_project_arguments('-std=c99', language : 'c') - cc = meson.get_compiler('c') -root_include = include_directories('.') +root_include = include_directories('include') munit = library('munit', - ['munit.c'], + ['src/munit.c'], + include_directories: root_include, install: meson.is_subproject()) if meson.is_subproject() @@ -19,7 +18,7 @@ if meson.is_subproject() link_with : munit) else # standalone install - install_headers('munit.h') + install_headers('include/munit.h') pkg = import('pkgconfig') pkg.generate(name: 'munit', @@ -28,7 +27,7 @@ else libraries: munit) # compile the demo project - munit_example_src = files('example.c') + munit_example_src = files('src/example.c') munit_example = executable('munit_example', munit_example_src, include_directories: root_include, link_with: munit) diff --git a/munit.pc.in b/munit.pc.in new file mode 100644 index 0000000..2574342 --- /dev/null +++ b/munit.pc.in @@ -0,0 +1,9 @@ +prefix=@CMAKE_INSTALL_PREFIX@ +libdir=${prefix}/lib +includedir=${prefix}/include + +Name: munit +Description: µnit Testing Library for C +Version: 0.2.0 +Libs: -L${libdir} -lmunit +Cflags: -I${includedir} \ No newline at end of file diff --git a/example.c b/src/example.c similarity index 100% rename from example.c rename to src/example.c diff --git a/munit.c b/src/munit.c similarity index 100% rename from munit.c rename to src/munit.c From 38a5a9d55dfc040fb85913aa0b95521cbeceb7a4 Mon Sep 17 00:00:00 2001 From: Thomas Steeples Date: Thu, 29 Oct 2020 02:13:01 +0000 Subject: [PATCH 2/6] Tweaked .appveyor.yml to have new correct paths --- .appveyor.yml | 30 +++++++++++++++--------------- .gitignore | 2 +- README.md | 13 +++++++------ 3 files changed, 23 insertions(+), 22 deletions(-) diff --git a/.appveyor.yml b/.appveyor.yml index 5572092..8cc24b0 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -2,20 +2,20 @@ version: "{build}" environment: matrix: - - ARCHITECTURE: x64 - MSVC_VER: 14 - - ARCHITECTURE: x86 - MSVC_VER: 14 - - ARCHITECTURE: x64 - MSVC_VER: 12 - - ARCHITECTURE: x86 - MSVC_VER: 12 - - ARCHITECTURE: x86 - MSVC_VER: 11 - - ARCHITECTURE: x86 - MSVC_VER: 10 - - ARCHITECTURE: x86 - MSVC_VER: 9 + - ARCHITECTURE: x64 + MSVC_VER: 14 + - ARCHITECTURE: x86 + MSVC_VER: 14 + - ARCHITECTURE: x64 + MSVC_VER: 12 + - ARCHITECTURE: x86 + MSVC_VER: 12 + - ARCHITECTURE: x86 + MSVC_VER: 11 + - ARCHITECTURE: x86 + MSVC_VER: 10 + - ARCHITECTURE: x86 + MSVC_VER: 9 branches: except: @@ -29,6 +29,6 @@ install: before_build: - call "C:\Program Files (x86)\Microsoft Visual Studio %MSVC_VER%.0\VC\vcvarsall.bat" %ARCHITECTURE% -build_script: cl.exe /W4 /WX /Feexample munit.c example.c +build_script: cl.exe /W4 /WX /Feexample /I \include src\munit.c src\example.c test_script: example.exe --color always diff --git a/.gitignore b/.gitignore index d10c4de..c4cde82 100644 --- a/.gitignore +++ b/.gitignore @@ -6,4 +6,4 @@ /*.dll build/ lib/ -bin/ \ No newline at end of file +bin/ diff --git a/README.md b/README.md index accf58d..06011a3 100644 --- a/README.md +++ b/README.md @@ -17,13 +17,14 @@ Features µnit currently includes include: - Handy assertion macros which make for nice error messages. - Reproducible cross-platform random number generation, including support for supplying a seed via CLI. -- Timing of both wall-clock and CPU time. -- Parameterized tests. -- Nested test suites. -- Flexible CLI. -- Forking + +* Timing of both wall-clock and CPU time. +* Parameterized tests. +* Nested test suites. +* Flexible CLI. +* Forking ([except on Windows](https://github.com/nemequ/munit/issues/2)). -- Hiding output of successful tests. +* Hiding output of successful tests. Features µnit does not currently include, but some day may include (a.k.a., if you file a PR…), include: From 22a89fa223bd0814470fd536c1c4381a5d1e1d83 Mon Sep 17 00:00:00 2001 From: Thomas Steeples Date: Thu, 29 Oct 2020 02:14:56 +0000 Subject: [PATCH 3/6] Updated README.md --- README.md | 37 +++++++++++++------------------------ 1 file changed, 13 insertions(+), 24 deletions(-) diff --git a/README.md b/README.md index 06011a3..ad0ec7f 100644 --- a/README.md +++ b/README.md @@ -1,11 +1,8 @@ # µnit -µnit is a small but full-featured unit testing framework for C. It has -no dependencies (beyond libc), is permissively licensed (MIT), and is -easy to include into any project. +µnit is a small but full-featured unit testing framework for C. It has no dependencies (beyond libc), is permissively licensed (MIT), and is easy to include into any project. -For more information, see -[the µnit web site](https://nemequ.github.io/munit). +For more information, see [the µnit web site](https://nemequ.github.io/munit). [![Build status](https://travis-ci.org/nemequ/munit.svg?branch=master)](https://travis-ci.org/nemequ/munit) [![Windows build status](https://ci.appveyor.com/api/projects/status/db515g5ifcwjohq7/branch/master?svg=true)](https://ci.appveyor.com/project/quixdb/munit/branch/master) @@ -15,22 +12,17 @@ For more information, see Features µnit currently includes include: - Handy assertion macros which make for nice error messages. -- Reproducible cross-platform random number generation, including - support for supplying a seed via CLI. +- Reproducible cross-platform random number generation, including support for supplying a seed via CLI. +- Timing of both wall-clock and CPU time. +- Parameterized tests. +- Nested test suites. +- Flexible CLI. +- Forking ([except on Windows](https://github.com/nemequ/munit/issues/2)). +- Hiding output of successful tests. -* Timing of both wall-clock and CPU time. -* Parameterized tests. -* Nested test suites. -* Flexible CLI. -* Forking - ([except on Windows](https://github.com/nemequ/munit/issues/2)). -* Hiding output of successful tests. +Features µnit does not currently include, but some day may include (a.k.a., if you file a PR…), include: -Features µnit does not currently include, but some day may include -(a.k.a., if you file a PR…), include: - -- [TAP](http://testanything.org/) support; feel free to discuss in - [issue #1](https://github.com/nemequ/munit/issues/1) +- [TAP](http://testanything.org/) support; feel free to discuss in [issue #1](https://github.com/nemequ/munit/issues/1) ### Integrate µnit into your project with meson @@ -43,8 +35,7 @@ url=https://github.com/nemequ/munit/ revision=head ``` -Then you can use a subproject fallback when you include munit as a -dependency to your project: `dependency('munit', fallback: ['munit', 'munit_dep'])` +Then you can use a subproject fallback when you include munit as a dependency to your project: `dependency('munit', fallback: ['munit', 'munit_dep'])` ### Integrate µnit into your project with CMake @@ -68,6 +59,4 @@ and this will expose the `munit` and `munit_static` targets, which can be linked See [the µnit web site](https://nemequ.github.io/munit). -Additionally, there is a heavily-commented -[example.c](https://github.com/nemequ/munit/blob/master/example.c) in -the repository. +Additionally, there is a heavily-commented [example.c](https://github.com/nemequ/munit/blob/master/example.c) in the repository. From 2664972e64835c4a3e5c9db879e34d99cc369dea Mon Sep 17 00:00:00 2001 From: Thomas Steeples Date: Thu, 29 Oct 2020 09:58:52 +0000 Subject: [PATCH 4/6] Tweaked makefile --- .gitignore | 1 + Makefile | 4 ++-- munit.pc.in | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/.gitignore b/.gitignore index c4cde82..10ece21 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ build/ lib/ bin/ +.DS_Store diff --git a/Makefile b/Makefile index e03bd87..af98edd 100644 --- a/Makefile +++ b/Makefile @@ -43,8 +43,8 @@ ifneq ($(CC),pgcc) endif endif -example$(EXTENSION): include/munit.h src/munit.c src/example.c - $(CC) $(CFLAGS) -o $@ src/munit.c src/example.c +example$(EXTENSION): + $(CC) $(CFLAGS) -o $@ -I include src/munit.c src/example.c test: $(TEST_ENV) ./example$(EXTENSION) diff --git a/munit.pc.in b/munit.pc.in index 2574342..4875138 100644 --- a/munit.pc.in +++ b/munit.pc.in @@ -6,4 +6,4 @@ Name: munit Description: µnit Testing Library for C Version: 0.2.0 Libs: -L${libdir} -lmunit -Cflags: -I${includedir} \ No newline at end of file +Cflags: -I${includedir} From 6c4f7c849bf47e223c2dacc2230649338bdb489f Mon Sep 17 00:00:00 2001 From: Thomas Steeples Date: Thu, 29 Oct 2020 14:07:09 +0000 Subject: [PATCH 5/6] Removed .DS_Store --- .DS_Store | Bin 6148 -> 0 bytes 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100644 .DS_Store diff --git a/.DS_Store b/.DS_Store deleted file mode 100644 index b827be388b8048c25ed9304d28fed97c5c921bdd..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 6148 zcmeHK%Wl&^6g|@f>ZAg)Kx&uXAhD>T6iT{4NFhyxBJrpQ0wF+c90zLQ*iq~dAOvN@ zKLCHgr|<=Q2p<4v9;xzT8v&Xt&7A9*d*=Ec$uk}RqB`*RfC2!AO=33BZiUHt*_Ld> zj7XkPYjkiI0TQHa)~o_nfxle=`R!iBA?~4t*O>i&i~Ne;B5j0m+Y4iladMNm$#(UZ zGJ3!!xesuJr)c0l?kq%qTZ#@4p^Xp&_~^_>i|vJI=j^Rsa#snL;y*3KZ=uTy62#0= zgvT6`wyBVfHn^!Ro~`q4Z~)%|&Bd~*9(IrEtP(VjZF63`Ax^kJNXOw7tPan*i2jLAgQ+c&*allD?Rm$ z|0s^bGr#3M4m!i*!sWv_N?SqH=__*JcNp^gNf7z*uo@2{KT+#6^@QW(oZN9?XEfR` zmv-H2H_GE(cXV(-fB$-UJkB}WSN3i-PP*^jk3Nh)eqq5h!J|OgC4*D=O2>%srrD3e zIC{mAY4kM8;@T82(mPvg%V-l>1*`)9iUM+faM>hQ3{Etvt%IGq0uZwtRz_d`CPFs~DVU)N}}Q`4A?vFgFyTvU7b`g+o*{+TJQ)6_{5b zqaO?M{ICD{{y$H$PgVh|z<;HH$kv**DoZkF>r!#@taaH=*rdt0iAF_XXO3g#$fJ0N bO&RB0=@2UhCmK0Ivp)h#2HRN$)~dj76&Sb? From fad95f1df81182300c9b8c66091ff6aee3a997c9 Mon Sep 17 00:00:00 2001 From: Thomas Steeples Date: Tue, 10 Nov 2020 20:29:18 +0000 Subject: [PATCH 6/6] Deleted src and include directories and placed source files in their original locations --- .appveyor.yml | 2 +- CMakeLists.txt | 12 ++++++------ Makefile | 2 +- src/example.c => example.c | 0 meson.build | 8 ++++---- src/munit.c => munit.c | 0 include/munit.h => munit.h | 0 munit.pc.in | 2 +- 8 files changed, 13 insertions(+), 13 deletions(-) rename src/example.c => example.c (100%) rename src/munit.c => munit.c (100%) rename include/munit.h => munit.h (100%) diff --git a/.appveyor.yml b/.appveyor.yml index 8cc24b0..bacdae5 100644 --- a/.appveyor.yml +++ b/.appveyor.yml @@ -29,6 +29,6 @@ install: before_build: - call "C:\Program Files (x86)\Microsoft Visual Studio %MSVC_VER%.0\VC\vcvarsall.bat" %ARCHITECTURE% -build_script: cl.exe /W4 /WX /Feexample /I \include src\munit.c src\example.c +build_script: cl.exe /W4 /WX /Feexample /I .\ munit.c example.c test_script: example.exe --color always diff --git a/CMakeLists.txt b/CMakeLists.txt index 8aeea45..eb2acc2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -28,25 +28,25 @@ set(CMAKE_C_FLAGS_DEBUG "-g -Wall -Wextra -Wpedantic") set(CMAKE_BUILD_TYPE Release) add_library(munit_mod MODULE) -target_sources(munit_mod PRIVATE src/munit.c) -target_include_directories(munit_mod PRIVATE include) +target_sources(munit_mod PRIVATE munit.c) +target_include_directories(munit_mod PRIVATE ./) if(${BUILD_SHARED_LIBS}) add_library(munit SHARED $) - target_include_directories(munit PUBLIC include) + target_include_directories(munit PUBLIC ./) set_target_properties(munit PROPERTIES OUTPUT_NAME "munit") endif() if(${BUILD_STATIC_LIBS}) add_library(munit_static STATIC $) - target_include_directories(munit_static PUBLIC include) + target_include_directories(munit_static PUBLIC ./) set_target_properties(munit_static PROPERTIES OUTPUT_NAME "munit") install(TARGETS munit_static ARCHIVE) endif() if(${BUILD_EXAMPLE}) add_executable(munit_example) - target_sources(munit_example PRIVATE src/example.c) + target_sources(munit_example PRIVATE example.c) if(${BUILD_STATIC_LIBS}) target_link_libraries(munit_example munit_static) else() @@ -56,7 +56,7 @@ endif() # Installation install(FILES ${CMAKE_SOURCE_DIR}/lib/pkgconfig/munit.pc DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/pkgconfig) -install(FILES include/munit.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include) +install(FILES munit.h DESTINATION ${CMAKE_INSTALL_PREFIX}/include) if(${BUILD_SHARED_LIBS}) install(TARGETS munit LIBRARY) diff --git a/Makefile b/Makefile index af98edd..bd92cb0 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ ifneq ($(CC),pgcc) endif example$(EXTENSION): - $(CC) $(CFLAGS) -o $@ -I include src/munit.c src/example.c + $(CC) $(CFLAGS) -o $@ -I ./ munit.c example.c test: $(TEST_ENV) ./example$(EXTENSION) diff --git a/src/example.c b/example.c similarity index 100% rename from src/example.c rename to example.c diff --git a/meson.build b/meson.build index 4237b7d..3f48238 100644 --- a/meson.build +++ b/meson.build @@ -5,10 +5,10 @@ conf_data.set('version', '0.2.0') cc = meson.get_compiler('c') -root_include = include_directories('include') +root_include = include_directories('.') munit = library('munit', - ['src/munit.c'], + ['munit.c'], include_directories: root_include, install: meson.is_subproject()) @@ -18,7 +18,7 @@ if meson.is_subproject() link_with : munit) else # standalone install - install_headers('include/munit.h') + install_headers('munit.h') pkg = import('pkgconfig') pkg.generate(name: 'munit', @@ -27,7 +27,7 @@ else libraries: munit) # compile the demo project - munit_example_src = files('src/example.c') + munit_example_src = files('example.c') munit_example = executable('munit_example', munit_example_src, include_directories: root_include, link_with: munit) diff --git a/src/munit.c b/munit.c similarity index 100% rename from src/munit.c rename to munit.c diff --git a/include/munit.h b/munit.h similarity index 100% rename from include/munit.h rename to munit.h diff --git a/munit.pc.in b/munit.pc.in index 4875138..8cfa49b 100644 --- a/munit.pc.in +++ b/munit.pc.in @@ -4,6 +4,6 @@ includedir=${prefix}/include Name: munit Description: µnit Testing Library for C -Version: 0.2.0 +Version: 0.4.1 Libs: -L${libdir} -lmunit Cflags: -I${includedir}