From fbe1e5177b9703366d121d9b5857a2d72e895590 Mon Sep 17 00:00:00 2001
From: David Runge <dave@sleepmap.de>
Date: Sun, 19 Jul 2020 10:25:29 +0200
Subject: [PATCH] Allow system cpptoml

meson.build:
When the 'wrap_mode' option is set to 'nodownload' use a system version
of cpptoml. This does not require using git and having a network
connection during build, which is important for Linux packaging
infrastructure.

subprojects/cpptoml.wrap:
Pin revision to last release tag (v0.1.1).

lib/wptoml/*.cpp:
Remove 'include/' prefix from all cpptoml related includes, at is not
required.

Closes #17
---
 lib/wptoml/array.cpp     |  2 +-
 lib/wptoml/file.cpp      |  2 +-
 lib/wptoml/table.cpp     |  2 +-
 meson.build              | 10 +++++++---
 subprojects/cpptoml.wrap |  2 +-
 5 files changed, 11 insertions(+), 7 deletions(-)

diff --git a/lib/wptoml/array.cpp b/lib/wptoml/array.cpp
index a907d262..92b51803 100644
--- a/lib/wptoml/array.cpp
+++ b/lib/wptoml/array.cpp
@@ -10,7 +10,7 @@
 #include <functional>
 
 /* CPPTOML */
-#include <include/cpptoml.h>
+#include <cpptoml.h>
 
 /* TOML */
 #include "private.h"
diff --git a/lib/wptoml/file.cpp b/lib/wptoml/file.cpp
index d39e468b..4b53e036 100644
--- a/lib/wptoml/file.cpp
+++ b/lib/wptoml/file.cpp
@@ -7,7 +7,7 @@
  */
 
 /* CPPTOML */
-#include <include/cpptoml.h>
+#include <cpptoml.h>
 
 /* TOML */
 #include "private.h"
diff --git a/lib/wptoml/table.cpp b/lib/wptoml/table.cpp
index 3224826b..40368f58 100644
--- a/lib/wptoml/table.cpp
+++ b/lib/wptoml/table.cpp
@@ -10,7 +10,7 @@
 #include <functional>
 
 /* CPPTOML */
-#include <include/cpptoml.h>
+#include <cpptoml.h>
 
 /* TOML */
 #include "private.h"
diff --git a/meson.build b/meson.build
index 650daa7c..9f71356f 100644
--- a/meson.build
+++ b/meson.build
@@ -26,9 +26,13 @@ else
   wireplumber_config_dir = join_paths(get_option('prefix'), get_option('sysconfdir'), 'wireplumber')
 endif
 
-cmake = import('cmake')
-cpptoml = cmake.subproject('cpptoml')
-cpptoml_dep = cpptoml.dependency('cpptoml')
+if get_option('wrap_mode') == 'nodownload'
+  cpptoml_dep = dependency('cpptoml')
+else
+  cmake = import('cmake')
+  cpptoml = cmake.subproject('cpptoml')
+  cpptoml_dep = cpptoml.dependency('cpptoml')
+endif
 
 gobject_dep = dependency('gobject-2.0', version : '>= 2.58')
 gmodule_dep = dependency('gmodule-2.0', version : '== ' + gobject_dep.version())
diff --git a/subprojects/cpptoml.wrap b/subprojects/cpptoml.wrap
index 7fa60bd9..a342dcbd 100644
--- a/subprojects/cpptoml.wrap
+++ b/subprojects/cpptoml.wrap
@@ -1,4 +1,4 @@
 [wrap-git]
 directory=cpptoml
 url=https://github.com/skystrife/cpptoml.git
-revision=master
+revision=v0.1.1
-- 
GitLab