Skip to content

rhyolyn/meson-hello

Repository files navigation

meson-hello

A modular C++ project using Meson build system, demonstrating cross-platform dynamic libraries and shared headers.

Table of Contents


Overview

This project demonstrates how to organize and build modular C++ libraries and applications using the Meson build system. It supports both Windows and Linux, with shared headers and cross-platform symbol export macros.

Directory Structure

apps/ 
	├──hello/ 
	│     └── hello.cpp 
	│     └── meson.build
libs/ 
	├── common/ 
	│     └── include/common/meson_hello_api.h
	│     └── meson.build
	├── greetings/ 
	│     └── include/greetings/greetings.h 
	│     └── src/greetings.cpp
	│     └── meson.build
	├── salutations/ │     
	│     └── include/salutations/salutations.h 
	│     └── src/salutations.cpp 
	│     └── meson.build

meson.build
.gitignore

Windows

Windows Prerequisites

Windows Build Instructions

  1. Open a Developer Command Prompt for VS.
  2. Install Meson and Ninja if not already installed:
pip install meson ninja
  1. Configure the build directory:
    Notes:
    • --prefix sets the install directory. <install directory> must be an absolute path
    • Run meson --help setup for additional options
meson setup <build directory> --backend=vs --prefix <install directory>
example: meson setup build/build-win --prefix c:/git/meson-test/install/bin
  1. Build the project:
meson compile -C <build directory>
example: meson compile -C build/build-win
  1. Optionally, run all tests to verify the build:
meson test -C <build directory>
example: meson test -C build/build-win
  1. Install the project:
meson install -C <build directory>
example: meson install -C build/build-win

Windows Run Instructions

To run the built applications, ensure the install directory is in your PATH, or use the full path to the executables. For example:

<install directory>\hello.exe
example: install\bin\hello.exe

Linux (Not yet validated)

Linux Prerequisites

Linux Build Instructions

  1. Install the required tools and libraries. For example, on Ubuntu:
sudo apt install build-essential git
  1. Clone the repository (if you haven't already):
git clone https://github.com/username/meson-test.git
  1. Navigate to the project directory:
cd meson-test
  1. Configure the build directory:
meson setup builddir --prefix=/usr/local
  1. Build the project:
meson compile -C builddir
  1. Optionally, run all tests to verify the build:

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors