ref: 6fe2299370b3ad727f11b0cd185b952ca34ab3e5
parent: 1a287c681d4cd2f03dd0b969b75d1f6439cace13
parent: 55fa0e121b388970c2bf351de5cf537a2ce7ab4b
author: guangwei <GuangweiWang@users.noreply.github.com>
date: Wed Dec 18 03:51:31 EST 2019
Merge pull request #3162 from philn/meson-optional-tests meson: New build option to enable/disable tests
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,5 +1,5 @@
language: cpp
-dist: trusty
+dist: xenial
compiler:
- g++
@@ -7,8 +7,8 @@
before_install:
- sudo apt-get update -qq
- - sudo apt-get install -qq nasm g++-multilib gcc-multilib libc6-dev-i386 python3-pip unzip
- - sudo python3 -m pip install meson==0.44.1
+ - sudo apt-get install -qq nasm g++-multilib gcc-multilib libc6-dev-i386 python3-pip python3-setuptools unzip
+ - sudo python3 -m pip install meson==0.47.0
- wget https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-linux.zip
- unzip ninja-linux.zip
- export PATH=$PATH:$PWD
--- a/meson.build
+++ b/meson.build
@@ -1,6 +1,6 @@
project('openh264', ['c', 'cpp'],
version : '2.0.0',
- meson_version : '>= 0.43',
+ meson_version : '>= 0.47',
default_options : [ 'warning_level=1',
'buildtype=debugoptimized' ])
--- /dev/null
+++ b/meson_options.txt
@@ -1,0 +1,1 @@
+option('tests', type : 'feature', value : 'auto', yield : true)
--- a/test/meson.build
+++ b/test/meson.build
@@ -1,15 +1,17 @@
-gtest_main_dep = dependency('gtest', main : true, fallback: ['gtest', 'gtest_main_dep'], required: false)
-gtest_dep = dependency('gtest', fallback: ['gtest', 'gtest_dep'], required: false)
+if not get_option('tests').disabled()
+ gtest_main_dep = dependency('gtest', main : true, fallback: ['gtest', 'gtest_main_dep'], required: true)
+ gtest_dep = dependency('gtest', fallback: ['gtest', 'gtest_dep'], required: true)
-test_inc = include_directories('.')
+ test_inc = include_directories('.')
-test_data_generator_sources = files('api/DataGenerator.cpp')
-test_base_encoder_sources = files('api/BaseEncoderTest.cpp')
+ test_data_generator_sources = files('api/DataGenerator.cpp')
+ test_base_encoder_sources = files('api/BaseEncoderTest.cpp')
-if gtest_dep.found()
- subdir('api')
- subdir('common')
- subdir('decoder')
- subdir('encoder')
- subdir('processing')
-endif
+ if gtest_dep.found()
+ subdir('api')
+ subdir('common')
+ subdir('decoder')
+ subdir('encoder')
+ subdir('processing')
+ endif
+endif
\ No newline at end of file