summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEmanuel Schmidt <eschmidt216@gmail.com>2023-02-01 19:31:13 +0100
committerEmanuel Schmidt <eschmidt216@gmail.com>2023-02-08 20:56:05 +0100
commiteb998d7b6510b04f02259856c135a4083f8e6184 (patch)
tree231ec9ecefc23bbc6cd99acd1797118fd97d308e
parent713077d0a3c310ca1955bc331d46d55d0ae4a72b (diff)
downloadpixman-eb998d7b6510b04f02259856c135a4083f8e6184.tar.gz
Separate meson build options for demos and tests
-rw-r--r--demos/Makefile.am6
-rw-r--r--demos/conical-test.c2
-rw-r--r--demos/dither.c2
-rw-r--r--demos/gtk-utils.c2
-rw-r--r--demos/linear-gradient.c2
-rw-r--r--demos/meson.build4
-rw-r--r--demos/radial-test.c2
-rw-r--r--demos/tri-test.c2
-rw-r--r--meson.build13
-rw-r--r--meson_options.txt7
-rw-r--r--test/Makefile.am3
-rw-r--r--test/Makefile.sources8
-rw-r--r--test/meson.build13
-rw-r--r--test/utils/meson.build31
-rw-r--r--test/utils/utils-prng.c (renamed from test/utils-prng.c)0
-rw-r--r--test/utils/utils-prng.h (renamed from test/utils-prng.h)0
-rw-r--r--test/utils/utils.c (renamed from test/utils.c)0
-rw-r--r--test/utils/utils.h (renamed from test/utils.h)0
18 files changed, 67 insertions, 30 deletions
diff --git a/demos/Makefile.am b/demos/Makefile.am
index c58e359..f3ea0e4 100644
--- a/demos/Makefile.am
+++ b/demos/Makefile.am
@@ -12,10 +12,10 @@ AM_CFLAGS = $(OPENMP_CFLAGS)
AM_LDFLAGS = $(OPENMP_CFLAGS)
LDADD = $(top_builddir)/pixman/libpixman-1.la -lm $(GTK_LIBS) $(PNG_LIBS)
-AM_CPPFLAGS = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman $(GTK_CFLAGS) $(PNG_CFLAGS)
+AM_CPPFLAGS = -I$(top_srcdir)/pixman -I$(top_srcdir)/test/utils -I$(top_builddir)/pixman $(GTK_CFLAGS) $(PNG_CFLAGS)
-GTK_UTILS = gtk-utils.c gtk-utils.h ../test/utils.c ../test/utils.h \
- ../test/utils-prng.c ../test/utils-prng.h
+GTK_UTILS = gtk-utils.c gtk-utils.h ../test/utils/utils.c ../test/utils/utils.h \
+ ../test/utils/utils-prng.c ../test/utils/utils-prng.h
DEMOS = \
clip-test \
diff --git a/demos/conical-test.c b/demos/conical-test.c
index 6b32430..5ff1be9 100644
--- a/demos/conical-test.c
+++ b/demos/conical-test.c
@@ -1,4 +1,4 @@
-#include "../test/utils.h"
+#include "utils.h"
#include "gtk-utils.h"
#define SIZE 128
diff --git a/demos/dither.c b/demos/dither.c
index 2ab8270..63ba248 100644
--- a/demos/dither.c
+++ b/demos/dither.c
@@ -28,7 +28,7 @@
#include <math.h>
#include <gtk/gtk.h>
#include <stdlib.h>
-#include "../test/utils.h"
+#include "utils.h"
#include "gtk-utils.h"
#define WIDTH 1024
diff --git a/demos/gtk-utils.c b/demos/gtk-utils.c
index b3a60ff..cac8a8d 100644
--- a/demos/gtk-utils.c
+++ b/demos/gtk-utils.c
@@ -1,6 +1,6 @@
#include <gtk/gtk.h>
#include <config.h>
-#include "../test/utils.h"
+#include "utils.h"
#include "gtk-utils.h"
pixman_image_t *
diff --git a/demos/linear-gradient.c b/demos/linear-gradient.c
index 46433a6..03807a6 100644
--- a/demos/linear-gradient.c
+++ b/demos/linear-gradient.c
@@ -1,4 +1,4 @@
-#include "../test/utils.h"
+#include "utils.h"
#include "gtk-utils.h"
#define WIDTH 1024
diff --git a/demos/meson.build b/demos/meson.build
index 3f9d306..c844e92 100644
--- a/demos/meson.build
+++ b/demos/meson.build
@@ -57,8 +57,8 @@ if dep_gtk.found()
d,
[d + '.c', config_h, version_h],
c_args : extra_demo_cflags,
- link_with : [libdemo, libtestutils],
- dependencies : [dep_glib, dep_gtk, dep_openmp, idep_pixman],
+ link_with : [libdemo],
+ dependencies : [idep_pixman, libtestutils_dep, dep_glib, dep_gtk, dep_openmp, dep_png],
)
endforeach
endif
diff --git a/demos/radial-test.c b/demos/radial-test.c
index 08a367c..52292eb 100644
--- a/demos/radial-test.c
+++ b/demos/radial-test.c
@@ -1,4 +1,4 @@
-#include "../test/utils.h"
+#include "utils.h"
#include "gtk-utils.h"
#define NUM_GRADIENTS 9
diff --git a/demos/tri-test.c b/demos/tri-test.c
index a71869a..9d213eb 100644
--- a/demos/tri-test.c
+++ b/demos/tri-test.c
@@ -1,7 +1,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include "../test/utils.h"
+#include "utils.h"
#include "gtk-utils.h"
int
diff --git a/meson.build b/meson.build
index 14de9aa..42dbe93 100644
--- a/meson.build
+++ b/meson.build
@@ -412,8 +412,8 @@ else
dep_openmp = null_dep
endif
-dep_gtk = dependency('gtk+-3.0', required : get_option('gtk'))
-dep_glib = dependency('glib-2.0', required : get_option('gtk'))
+dep_gtk = dependency('gtk+-3.0', required : get_option('gtk'), required: get_option('demos'))
+dep_glib = dependency('glib-2.0', required : get_option('gtk'), required: get_option('demos'))
dep_png = null_dep
if not get_option('libpng').disabled()
@@ -559,9 +559,16 @@ add_project_arguments('-DHAVE_CONFIG_H', language : ['c'])
subdir('pixman')
+if not get_option('tests').disabled() or not get_option('demos').disabled()
+ subdir(join_paths('test', 'utils'))
+endif
+
+if not get_option('demos').disabled()
+ subdir('demos')
+endif
+
if not get_option('tests').disabled()
subdir('test')
- subdir('demos')
endif
pkg = import('pkgconfig')
diff --git a/meson_options.txt b/meson_options.txt
index 99dbb4e..df10889 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -119,5 +119,10 @@ option(
option(
'tests',
type : 'feature',
- description : 'Build tests and demos'
+ description : 'Build tests'
+)
+option(
+ 'demos',
+ type : 'feature',
+ description : 'Build demos'
)
diff --git a/test/Makefile.am b/test/Makefile.am
index 6dbed88..6b0e753 100644
--- a/test/Makefile.am
+++ b/test/Makefile.am
@@ -3,7 +3,7 @@ include $(top_srcdir)/test/Makefile.sources
AM_CFLAGS = $(OPENMP_CFLAGS) $(PTHREAD_CFLAGS)
AM_LDFLAGS = $(OPENMP_CFLAGS) $(TESTPROGS_EXTRA_LDFLAGS) $(PTHREAD_LDFLAGS)
LDADD = libutils.la $(top_builddir)/pixman/libpixman-1.la -lm $(PNG_LIBS) $(PTHREAD_LIBS)
-AM_CPPFLAGS = -I$(top_srcdir)/pixman -I$(top_builddir)/pixman $(PNG_CFLAGS)
+AM_CPPFLAGS = -I$(top_srcdir)/pixman -I$(top_srcdir)/test/utils -I$(top_builddir)/pixman $(PNG_CFLAGS)
libutils_la_SOURCES = $(libutils_sources) $(libutils_headers)
@@ -14,4 +14,5 @@ TESTS = $(TESTPROGRAMS)
EXTRA_DIST = \
meson.build \
+ utils/meson.build \
$(NULL)
diff --git a/test/Makefile.sources b/test/Makefile.sources
index 0a56231..c9c6c4d 100644
--- a/test/Makefile.sources
+++ b/test/Makefile.sources
@@ -46,11 +46,11 @@ OTHERPROGRAMS = \
# Utility functions
libutils_sources = \
- utils.c \
- utils-prng.c \
+ utils/utils.c \
+ utils/utils-prng.c \
$(NULL)
libutils_headers = \
- utils.h \
- utils-prng.h \
+ utils/utils.h \
+ utils/utils-prng.h \
$(NULL)
diff --git a/test/meson.build b/test/meson.build
index 59a0d42..47dd33c 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -67,20 +67,13 @@ progs = [
'affine-bench',
]
-libtestutils = static_library(
- 'testutils',
- ['utils.c', 'utils-prng.c', config_h],
- dependencies : [dep_openmp, dep_m, dep_png, idep_pixman],
-)
-
foreach t : tests
test(
t,
executable(
t,
[t + '.c', config_h],
- link_with : libtestutils,
- dependencies : [dep_threads, dep_openmp, idep_pixman],
+ dependencies : [idep_pixman, libtestutils_dep, dep_threads, dep_openmp, dep_png],
),
timeout : 120,
is_parallel : true,
@@ -91,7 +84,7 @@ foreach p : progs
executable(
p,
p + '.c',
- link_with : libtestutils,
- dependencies : [dep_openmp, idep_pixman],
+ dependencies : [idep_pixman, libtestutils_dep, dep_openmp],
)
endforeach
+
diff --git a/test/utils/meson.build b/test/utils/meson.build
new file mode 100644
index 0000000..9a6e820
--- /dev/null
+++ b/test/utils/meson.build
@@ -0,0 +1,31 @@
+# Copyright © 2018 Intel Corporation
+
+# 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.
+
+libtestutils = static_library(
+ 'testutils',
+ ['utils.c', 'utils-prng.c', config_h],
+ dependencies : [idep_pixman, dep_openmp, dep_m, dep_png],
+)
+
+libtestutils_dep = declare_dependency(
+ link_with: libtestutils,
+ include_directories: include_directories('.'),
+)
+
diff --git a/test/utils-prng.c b/test/utils/utils-prng.c
index 0cf53dd..0cf53dd 100644
--- a/test/utils-prng.c
+++ b/test/utils/utils-prng.c
diff --git a/test/utils-prng.h b/test/utils/utils-prng.h
index f9ae8dd..f9ae8dd 100644
--- a/test/utils-prng.h
+++ b/test/utils/utils-prng.h
diff --git a/test/utils.c b/test/utils/utils.c
index 23bf019..23bf019 100644
--- a/test/utils.c
+++ b/test/utils/utils.c
diff --git a/test/utils.h b/test/utils/utils.h
index 701417f..701417f 100644
--- a/test/utils.h
+++ b/test/utils/utils.h