https://github.com/vincent-picaud/meson_starter_script
A simple script to create a messon project skeleton
https://github.com/vincent-picaud/meson_starter_script
bash-script cpp doxygen gtest mesonbuild project-template
Last synced: 8 months ago
JSON representation
A simple script to create a messon project skeleton
- Host: GitHub
- URL: https://github.com/vincent-picaud/meson_starter_script
- Owner: vincent-picaud
- Created: 2019-02-16T07:07:59.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2020-11-04T16:06:06.000Z (over 5 years ago)
- Last Synced: 2025-06-12T22:33:02.899Z (10 months ago)
- Topics: bash-script, cpp, doxygen, gtest, mesonbuild, project-template
- Language: Shell
- Size: 74.2 KB
- Stars: 6
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.org
Awesome Lists containing this project
README
#+BLOG: wordpress
#+POSTID: 862
#+DATE: [2019-07-27 Sat 15:13]
#+TITLE: A Meson starter script for C++ projects
#+CATEGORY: Meson
#+PROPERTY: header-args:sh :eval no-export :results output :wrap EXAMPLE :exports both :session *meson_sh*
* What is it?
A simple script to create a [[https://mesonbuild.com][Meson]] C++ project skeleton with [[http://www.doxygen.nl/][Doxygen]] and
[[https://github.com/google/googletest][gtest]] configured. The whole script can be found [[https://github.com/vincent-picaud/meson_starter_script][in this GitHub repo]].
*Usage:*
# Note: as github does not print command output unless we repeate the
# ":exports both" statement
#+BEGIN_SRC sh :exports both
./create_project
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
Usage: create_project PROJECT_ROOT_DIRECTORY [-f]
Creates a directory 'PROJECT_ROOT_DIRECTORY' and populates it with some configuration files.
By default *never* overwrite files, use the -f extra flag to force overwriting
#+END_EXAMPLE
* Detailed example
** Project creation
To create a skeleton project in =/tmp/MyProject=, run
#+BEGIN_SRC sh :exports both
./create_project /tmp/MyProject
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
Create directory /tmp/MyProject
Create file /tmp/MyProject/meson.build
Create directory /tmp/MyProject/src
Create file /tmp/MyProject/src/meson.build
Create directory /tmp/MyProject/src/MyProject
Create file /tmp/MyProject/src/MyProject/meson.build
Create file /tmp/MyProject/src/MyProject/hello.hpp
Create file /tmp/MyProject/src/MyProject/hello.cpp
Create directory /tmp/MyProject/subprojects
Create file /tmp/MyProject/subprojects/gtest.wrap
Create directory /tmp/MyProject/test
Create file /tmp/MyProject/test/meson.build
Create file /tmp/MyProject/test/hello.cpp
Create directory /tmp/MyProject/bin
Create file /tmp/MyProject/bin/meson.build
Create file /tmp/MyProject/bin/hello.cpp
Create directory /tmp/MyProject/sandbox
Create file /tmp/MyProject/sandbox/meson.build
Create file /tmp/MyProject/sandbox/hello.cpp
Create directory /tmp/MyProject/examples
Create file /tmp/MyProject/examples/meson.build
Create file /tmp/MyProject/examples/hello.cpp
Create directory /tmp/MyProject/doc
Create directory /tmp/MyProject/doc/figures
Create file /tmp/MyProject/doc/meson.build
Create file /tmp/MyProject/doc/Doxyfile.in
Create file /tmp/MyProject/doc/bibliography.bib
#+END_EXAMPLE
You get a basic Meson project with the following directory hierarchy:
#+BEGIN_SRC sh :results output drawer :exports results :eval no-export :wrap EXAMPLE :eval never
/home/picaud/GitLab/WorkingWithOrgMode/Scripts/orgTree.sh /tmp/MyProject/ --noLink -P "*.*"
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
+ meson.build <- root meson file
+ src/
+ MyProject/ <- your "MyProject" library (installed, scanned by Doxygen)
+ hello.cpp
+ hello.hpp
+ meson.build
+ meson.build
+ bin/ <- binaries (installed, scanned by Doxygen)
+ meson.build
+ hello.cpp
+ sandbox/ <- "sandbox" binaries (not installed, not scanned by Doxygen)
+ meson.build
+ hello.cpp
+ examples/ <- "examples" binaries (not installed, Doxygen examples dir)
+ meson.build
+ hello.cpp
+ test/ <- unit tests (not installed)
+ meson.build
+ hello.cpp
+ doc/
+ meson.build
+ bibliography.bib <- doxygen + bibliography file (installed)
+ Doxyfile.in
+ subprojects/ <- subprojects, here gtest (not installed)
+ gtest.wrap
#+END_EXAMPLE
** Build dir creation
To create your project build directory with =/tmp/InstallDirectory= as
installation directory run:
#+BEGIN_SRC sh :exports both :wrap EXAMPLE
cd /tmp/MyProject
meson build --prefix=/tmp/InstallDirectory
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
The Meson build system
Version: 0.49.2
Source dir: /tmp/MyProject
Build dir: /tmp/MyProject/build
Build type: native build
Project name: MyProject
Project version: 0.0.1
Native C++ compiler: ccache c++ (gcc 8.3.0 "c++ (Debian 8.3.0-6) 8.3.0")
Build machine cpu family: x86_64
Build machine cpu: x86_64
Downloading gtest source from https://github.com/google/googletest/archive/release-1.8.0.zip
Downloading file of unknown size.
Downloading gtest patch from https://wrapdb.mesonbuild.com/v1/projects/gtest/1.8.0/5/get_zip
Download size: 2084
Downloading: ..........
|
|Executing subproject gtest
|
|Project name: gtest
|Project version: 1.8.0
|Native C++ compiler: ccache c++ (gcc 8.3.0 "c++ (Debian 8.3.0-6) 8.3.0")
|Dependency threads found: YES
|Dependency threads found: YES (cached)
|Dependency threads found: YES (cached)
|Dependency threads found: YES (cached)
|Build targets in project: 0
|
|Subproject gtest finished.
Program doxygen found: YES (/usr/bin/doxygen)
Program dot found: YES (/usr/bin/dot)
Configuring Doxyfile using configuration
Build targets in project: 6
Found ninja-1.8.2 at /usr/bin/ninja
#+END_EXAMPLE
** Project compilation
To compile your project (with its doxygen documentation) type:
#+BEGIN_SRC sh :exports both :wrap EXAMPLE
cd build
ninja
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
[1/14] Compiling C++ object 'src/MyProject/63d4f26@@MyProject@sha/hello.cpp.o'.
[2/14] Compiling C++ object 'sandbox/b7ad567@@hello@exe/hello.cpp.o'.
[3/14] Compiling C++ object 'test/9f86d08@@hello_exe@exe/.._subprojects_googletest-release-1.8.0_googletest_src_gtest_main.cc.o'.
[4/14] Compiling C++ object 'test/9f86d08@@hello_exe@exe/hello.cpp.o'.
[5/14] Compiling C++ object 'bin/51a1f05@@hello@exe/hello.cpp.o'.
[6/14] Compiling C++ object 'test/9f86d08@@hello_exe@exe/.._subprojects_googletest-release-1.8.0_googletest_src_gtest-all.cc.o'.
[7/14] Compiling C++ object 'examples/c590b3c@@hello@exe/hello.cpp.o'.
[8/14] Linking target src/MyProject/libMyProject.so.
[9/14] Generating doc with a custom command.
warning: ignoring unknown tag `y' at line 2277, file doc/Doxyfile
Searching for include files...
Searching for files in directory /tmp/MyProject/src/MyProject
Searching for files in directory /tmp/MyProject/bin
Searching for example files...
Searching for files in directory /tmp/MyProject/examples
Searching for images...
Searching for files in directory /tmp/MyProject/doc/figures
Searching for dot files...
Searching for msc files...
Searching for dia files...
Searching for files to exclude
Searching INPUT for files to process...
Searching for files in directory /tmp/MyProject/src/MyProject
Searching for files in directory /tmp/MyProject/bin
Reading and parsing tag files
Parsing files
Preprocessing /tmp/MyProject/src/MyProject/hello.cpp...
Parsing file /tmp/MyProject/src/MyProject/hello.cpp...
Preprocessing /tmp/MyProject/src/MyProject/hello.hpp...
Parsing file /tmp/MyProject/src/MyProject/hello.hpp...
Preprocessing /tmp/MyProject/bin/hello.cpp...
Parsing file /tmp/MyProject/bin/hello.cpp...
Building group list...
Building directory list...
Building namespace list...
Building file list...
Building class list...
Associating documentation with classes...
Computing nesting relations for classes...
Building example list...
Searching for enumerations...
Searching for documented typedefs...
Searching for members imported via using declarations...
Searching for included using directives...
Searching for documented variables...
Building interface member list...
Building member list...
Searching for friends...
Searching for documented defines...
Computing class inheritance relations...
Computing class usage relations...
Flushing cached template relations that have become invalid...
Computing class relations...
Add enum values to enums...
Searching for member function documentation...
Creating members for template instances...
Building page list...
Search for main page...
Computing page relations...
Determining the scope of groups...
Sorting lists...
Freeing entry tree
Determining which enums are documented
Computing member relations...
Building full member lists recursively...
Adding members to member groups.
Computing member references...
Inheriting documentation...
Generating disk names...
Adding source references...
Adding xrefitems...
Sorting member lists...
Generating citations page...
Counting data structures...
Resolving user defined references...
Finding anchors and sections in the documentation...
Transferring function references...
Combining using relations...
Adding members to index pages...
Generating style sheet...
Generating search indices...
Generating example documentation...
Generating file sources...
Generating code for file hello.hpp...
Generating file documentation...
Generating docs for file hello.cpp...
Generating docs for file hello.hpp...
Generating page documentation...
Generating docs for page citelist...
Generating group documentation...
Generating class documentation...
Generating namespace index...
Generating graph info page...
Generating directory documentation...
Generating index page...
Generating page index...
Generating module index...
Generating namespace index...
Generating namespace member index...
Generating annotated compound index...
Generating alphabetical compound index...
Generating hierarchical class index...
Generating member index...
Generating file index...
Generating file member index...
Generating example index...
finalizing index lists...
writing tag file...
Running dot...
Running dot for graph 1/1
lookup cache used 5/65536 hits=10 misses=5
finished...
[10/14] Generating symbol file 'src/MyProject/63d4f26@@MyProject@sha/libMyProject.so.symbols'.
[11/14] Linking target bin/hello.
[12/14] Linking target sandbox/hello.
[13/14] Linking target examples/hello.
[14/14] Linking target test/hello_exe.
#+END_EXAMPLE
*Note:*
You can visualize the generated documentation with:
#+BEGIN_SRC sh :exports code
chromium doc/html/index.html
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
Opening in existing browser session.
[13035:13058:0901/071855.479256:ERROR:browser_process_sub_thread.cc(203)] Waited 224 ms for network service
#+END_EXAMPLE
** Running unit tests
To run unit tests, run:
#+BEGIN_SRC sh :exports both :wrap EXAMPLE
ninja test
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
[1/2] Generating doc with a custom command.
warning: ignoring unknown tag `y' at line 2277, file doc/Doxyfile
Searching for include files...
Searching for files in directory /tmp/MyProject/src/MyProject
Searching for files in directory /tmp/MyProject/bin
Searching for example files...
Searching for files in directory /tmp/MyProject/examples
Searching for images...
Searching for files in directory /tmp/MyProject/doc/figures
Searching for dot files...
Searching for msc files...
Searching for dia files...
Searching for files to exclude
Searching INPUT for files to process...
Searching for files in directory /tmp/MyProject/src/MyProject
Searching for files in directory /tmp/MyProject/bin
Reading and parsing tag files
Parsing files
Preprocessing /tmp/MyProject/src/MyProject/hello.cpp...
Parsing file /tmp/MyProject/src/MyProject/hello.cpp...
Preprocessing /tmp/MyProject/src/MyProject/hello.hpp...
Parsing file /tmp/MyProject/src/MyProject/hello.hpp...
Preprocessing /tmp/MyProject/bin/hello.cpp...
Parsing file /tmp/MyProject/bin/hello.cpp...
Building group list...
Building directory list...
Building namespace list...
Building file list...
Building class list...
Associating documentation with classes...
Computing nesting relations for classes...
Building example list...
Searching for enumerations...
Searching for documented typedefs...
Searching for members imported via using declarations...
Searching for included using directives...
Searching for documented variables...
Building interface member list...
Building member list...
Searching for friends...
Searching for documented defines...
Computing class inheritance relations...
Computing class usage relations...
Flushing cached template relations that have become invalid...
Computing class relations...
Add enum values to enums...
Searching for member function documentation...
Creating members for template instances...
Building page list...
Search for main page...
Computing page relations...
Determining the scope of groups...
Sorting lists...
Freeing entry tree
Determining which enums are documented
Computing member relations...
Building full member lists recursively...
Adding members to member groups.
Computing member references...
Inheriting documentation...
Generating disk names...
Adding source references...
Adding xrefitems...
Sorting member lists...
Generating citations page...
Counting data structures...
Resolving user defined references...
Finding anchors and sections in the documentation...
Transferring function references...
Combining using relations...
Adding members to index pages...
Generating style sheet...
Generating search indices...
Generating example documentation...
Generating file sources...
Generating code for file hello.hpp...
Generating file documentation...
Generating docs for file hello.cpp...
Generating docs for file hello.hpp...
Generating page documentation...
Generating docs for page citelist...
Generating group documentation...
Generating class documentation...
Generating namespace index...
Generating graph info page...
Generating directory documentation...
Generating index page...
Generating page index...
Generating module index...
Generating namespace index...
Generating namespace member index...
Generating annotated compound index...
Generating alphabetical compound index...
Generating hierarchical class index...
Generating member index...
Generating file index...
Generating file member index...
Generating example index...
finalizing index lists...
writing tag file...
Running dot...
lookup cache used 5/65536 hits=10 misses=5
finished...
[1/2] Running all tests.
1/1 hello_test OK 0.01 s
Ok: 1
Expected Fail: 0
Fail: 0
Unexpected Pass: 0
Skipped: 0
Timeout: 0
Full log written to /tmp/MyProject/build/meson-logs/testlog.txt
#+END_EXAMPLE
** Project installation
Finally, if you want to install your project, run:
#+BEGIN_SRC sh :exports both :wrap EXAMPLE
ninja install
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
[1/2] Generating doc with a custom command.
warning: ignoring unknown tag `y' at line 2277, file doc/Doxyfile
Searching for include files...
Searching for files in directory /tmp/MyProject/src/MyProject
Searching for files in directory /tmp/MyProject/bin
Searching for example files...
Searching for files in directory /tmp/MyProject/examples
Searching for images...
Searching for files in directory /tmp/MyProject/doc/figures
Searching for dot files...
Searching for msc files...
Searching for dia files...
Searching for files to exclude
Searching INPUT for files to process...
Searching for files in directory /tmp/MyProject/src/MyProject
Searching for files in directory /tmp/MyProject/bin
Reading and parsing tag files
Parsing files
Preprocessing /tmp/MyProject/src/MyProject/hello.cpp...
Parsing file /tmp/MyProject/src/MyProject/hello.cpp...
Preprocessing /tmp/MyProject/src/MyProject/hello.hpp...
Parsing file /tmp/MyProject/src/MyProject/hello.hpp...
Preprocessing /tmp/MyProject/bin/hello.cpp...
Parsing file /tmp/MyProject/bin/hello.cpp...
Building group list...
Building directory list...
Building namespace list...
Building file list...
Building class list...
Associating documentation with classes...
Computing nesting relations for classes...
Building example list...
Searching for enumerations...
Searching for documented typedefs...
Searching for members imported via using declarations...
Searching for included using directives...
Searching for documented variables...
Building interface member list...
Building member list...
Searching for friends...
Searching for documented defines...
Computing class inheritance relations...
Computing class usage relations...
Flushing cached template relations that have become invalid...
Computing class relations...
Add enum values to enums...
Searching for member function documentation...
Creating members for template instances...
Building page list...
Search for main page...
Computing page relations...
Determining the scope of groups...
Sorting lists...
Freeing entry tree
Determining which enums are documented
Computing member relations...
Building full member lists recursively...
Adding members to member groups.
Computing member references...
Inheriting documentation...
Generating disk names...
Adding source references...
Adding xrefitems...
Sorting member lists...
Generating citations page...
Counting data structures...
Resolving user defined references...
Finding anchors and sections in the documentation...
Transferring function references...
Combining using relations...
Adding members to index pages...
Generating style sheet...
Generating search indices...
Generating example documentation...
Generating file sources...
Generating code for file hello.hpp...
Generating file documentation...
Generating docs for file hello.cpp...
Generating docs for file hello.hpp...
Generating page documentation...
Generating docs for page citelist...
Generating group documentation...
Generating class documentation...
Generating namespace index...
Generating graph info page...
Generating directory documentation...
Generating index page...
Generating page index...
Generating module index...
Generating namespace index...
Generating namespace member index...
Generating annotated compound index...
Generating alphabetical compound index...
Generating hierarchical class index...
Generating member index...
Generating file index...
Generating file member index...
Generating example index...
finalizing index lists...
writing tag file...
Running dot...
lookup cache used 5/65536 hits=10 misses=5
finished...
[1/2] Installing files.
Installing src/MyProject/libMyProject.so to /tmp/InstallDirectory/lib/x86_64-linux-gnu
Installing bin/hello to /tmp/InstallDirectory/bin
Installing /tmp/MyProject/build/doc/html/a00005.html to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/tab_h.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/sync_on.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/graph_legend.md5 to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/dir_68267d1309a1af8e8297ef4c3efbcdba.html to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/pages.html to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/jquery.js to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/menu.js to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/folderclosed.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/dir_12739b51ecd9f955b0759ea118dd308c.html to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/nav_f.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/tab_s.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/splitbar.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/graph_legend.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/closed.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/bdwn.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/a00015.html to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/tabs.css to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/doxygen.css to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/index.html to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/tab_a.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/open.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/menudata.js to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/graph_legend.html to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/nav_h.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/a00012.html to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/bc_s.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/doxygen.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/nav_g.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/dynsections.js to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/dir_2ea30aa2956a8db99dd22aa5e597f384.html to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/files.html to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/sync_off.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/folderopen.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/a00005_source.html to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/tab_b.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/doc.png to /tmp/InstallDirectory/share/doc/html
Installing /tmp/MyProject/build/doc/html/search/files_1.js to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/all_1.js to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/search_r.png to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/all_0.js to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/close.png to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/search.js to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/search_l.png to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/files_0.html to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/searchdata.js to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/nomatches.html to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/pages_0.html to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/all_0.html to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/files_1.html to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/mag_sel.png to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/search.css to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/pages_0.js to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/all_1.html to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/search_m.png to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/build/doc/html/search/files_0.js to /tmp/InstallDirectory/share/doc/html/search
Installing /tmp/MyProject/src/MyProject/hello.hpp to /tmp/InstallDirectory/include/MyProject
#+END_EXAMPLE
* Further information
** Project file listings
*** The =MyProject= library
#+BEGIN_SRC sh :exports both
cat /tmp/MyProject/src/MyProject/hello.hpp
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
/// @file
/// @brief Hello lib file
include
namespace MyProject {
/// @brief A function
///
/// A bibtex reference example @cite pakkanen_meson_build_system
///
/// Usage example @include hello.cpp
std::string hello();
}
#+END_EXAMPLE
#+BEGIN_SRC sh :exports both
cat /tmp/MyProject/src/MyProject/hello.cpp
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
include "hello.hpp"
namespace MyProject {
std::string hello() {
return "Hello MyProject";
};
}
#+END_EXAMPLE
*** The project unit tests
#+BEGIN_SRC sh :exports both
cat /tmp/MyProject/test/hello.cpp
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
include "MyProject/hello.hpp"
include
using namespace MyProject;
TEST(Hello, demo)
{
ASSERT_EQ(hello(),"Hello MyProject");
}
#+END_EXAMPLE
*** The =bin/hello.cpp= file
#+BEGIN_SRC sh :exports both
cat /tmp/MyProject/bin/hello.cpp
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
/// @file
/// @brief Hello executable file
include "MyProject/hello.hpp"
include
using namespace MyProject;
int main()
{
std::cout << hello() << " from bin/ " << std::endl;
}
#+END_EXAMPLE
*** The =sandbox/hello.cpp= file
#+BEGIN_SRC sh :exports both
cat /tmp/MyProject/sandbox/hello.cpp
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
/// @file
/// @brief Hello example file
include "MyProject/hello.hpp"
include
using namespace MyProject;
int main()
{
std::cout << hello() << " from sandbox/ " << std::endl;
}
#+END_EXAMPLE
*** The =examples/hello.cpp= file
#+BEGIN_SRC sh :exports both
cat /tmp/MyProject/examples/hello.cpp
#+END_SRC
#+RESULTS:
#+BEGIN_EXAMPLE
/// @file
/// @brief Hello example file
include "MyProject/hello.hpp"
include
using namespace MyProject;
int main()
{
std::cout << hello() << " from examples/ " << std::endl;
}
#+END_EXAMPLE
** More about Meson
Some Meson official site links:
- [[https://mesonbuild.com/howtox.html][How do I do X in Meson?]]
- [[http://mesonbuild.com/Reference-manual.html][Meson's reference manual]]