diff options
30 files changed, 180 insertions, 33 deletions
@@ -9,6 +9,9 @@ $env:Path = ($env:Path.Split(';') | Where-Object { $_ -notmatch 'mingw|Strawberr # Rust puts its shared stdlib in a secret place, but it is needed to run tests. $env:Path += ";$HOME/.rustup/toolchains/stable-x86_64-pc-windows-msvc/bin" +# Set the CI env var for the meson test framework +$env:CI = '1' + # download and install prerequisites function DownloadFile([String] $Source, [String] $Destination) { $retries = 10 @@ -32,7 +35,7 @@ function DownloadFile([String] $Source, [String] $Destination) { if ($env:backend -eq 'ninja') { $dmd = $true } else { $dmd = $false } -DownloadFile -Source https://github.com/mesonbuild/cidata/releases/download/ci1/ci_data.zip -Destination $env:AGENT_WORKFOLDER\ci_data.zip +DownloadFile -Source https://github.com/mesonbuild/cidata/releases/download/ci2/ci_data.zip -Destination $env:AGENT_WORKFOLDER\ci_data.zip echo "Extracting ci_data.zip" Expand-Archive $env:AGENT_WORKFOLDER\ci_data.zip -DestinationPath $env:AGENT_WORKFOLDER\ci_data & "$env:AGENT_WORKFOLDER\ci_data\install.ps1" -Arch $env:arch -Compiler $env:compiler -Boost $true -DMD $dmd diff --git a/docs/markdown/Reference-manual.md b/docs/markdown/Reference-manual.md index 033c1c5..5156b5b 100644 --- a/docs/markdown/Reference-manual.md +++ b/docs/markdown/Reference-manual.md @@ -1191,9 +1191,9 @@ The keyword arguments for this are the same as for - `name_prefix` the string that will be used as the prefix for the target output filename by overriding the default (only used for - libraries). By default this is `lib` on all platforms and compilers - except with MSVC shared libraries where it is omitted to follow - convention. + libraries). By default this is `lib` on all platforms and compilers, + except for MSVC shared libraries where it is omitted to follow + convention, and Cygwin shared libraries where it is `cyg`. - `name_suffix` the string that will be used as the suffix for the target output filename by overriding the default (see also: [executable()](#executable)). By default, for shared libraries this @@ -1201,7 +1201,7 @@ The keyword arguments for this are the same as for For static libraries, it is `a` everywhere. By convention MSVC static libraries use the `lib` suffix, but we use `a` to avoid a potential name clash with shared libraries which also generate - `xxx.lib` import files. + import libraries with a `lib` suffix. - `rust_crate_type` specifies the crate type for Rust libraries. Defaults to `dylib` for shared libraries and `rlib` for static libraries. diff --git a/mesonbuild/build.py b/mesonbuild/build.py index 616a183..b1bf9d4 100644 --- a/mesonbuild/build.py +++ b/mesonbuild/build.py @@ -922,16 +922,17 @@ This will become a hard error in a future Meson release.''') name_prefix = kwargs['name_prefix'] if isinstance(name_prefix, list): if name_prefix: - raise InvalidArguments('name_prefix array must be empty to signify null.') - elif not isinstance(name_prefix, str): - raise InvalidArguments('name_prefix must be a string.') - self.prefix = name_prefix - self.name_prefix_set = True + raise InvalidArguments('name_prefix array must be empty to signify default.') + else: + if not isinstance(name_prefix, str): + raise InvalidArguments('name_prefix must be a string.') + self.prefix = name_prefix + self.name_prefix_set = True if 'name_suffix' in kwargs: name_suffix = kwargs['name_suffix'] if isinstance(name_suffix, list): if name_suffix: - raise InvalidArguments('name_suffix array must be empty to signify null.') + raise InvalidArguments('name_suffix array must be empty to signify default.') else: if not isinstance(name_suffix, str): raise InvalidArguments('name_suffix must be a string.') diff --git a/mesonbuild/cmake/interpreter.py b/mesonbuild/cmake/interpreter.py index 2e33be6..f2f635c 100644 --- a/mesonbuild/cmake/interpreter.py +++ b/mesonbuild/cmake/interpreter.py @@ -22,7 +22,7 @@ from .executor import CMakeExecutor from .traceparser import CMakeTraceParser, CMakeGeneratorTarget from .. import mlog from ..environment import Environment -from ..mesonlib import MachineChoice, version_compare +from ..mesonlib import MachineChoice, OrderedSet, version_compare from ..compilers.compilers import lang_suffixes, header_suffixes, obj_suffixes, lib_suffixes, is_header from enum import Enum from functools import lru_cache @@ -441,8 +441,8 @@ class ConverterTarget: return x build_dir_rel = os.path.relpath(self.build_dir, os.path.join(self.env.get_build_dir(), subdir)) - self.includes = list(set([rel_path(x, True, False) for x in set(self.includes)] + [build_dir_rel])) - self.sys_includes = list(set([rel_path(x, True, False) for x in set(self.sys_includes)])) + self.includes = list(OrderedSet([rel_path(x, True, False) for x in OrderedSet(self.includes)] + [build_dir_rel])) + self.sys_includes = list(OrderedSet([rel_path(x, True, False) for x in OrderedSet(self.sys_includes)])) self.sources = [rel_path(x, False, False) for x in self.sources] self.generated = [rel_path(x, False, True) for x in self.generated] @@ -507,7 +507,7 @@ class ConverterTarget: self._append_objlib_sources(i) else: self.includes += i.includes - self.includes = list(set(self.includes)) + self.includes = list(OrderedSet(self.includes)) self.object_libs += [i] break @@ -518,9 +518,9 @@ class ConverterTarget: self.includes += tgt.includes self.sources += tgt.sources self.generated += tgt.generated - self.sources = list(set(self.sources)) - self.generated = list(set(self.generated)) - self.includes = list(set(self.includes)) + self.sources = list(OrderedSet(self.sources)) + self.generated = list(OrderedSet(self.generated)) + self.includes = list(OrderedSet(self.includes)) # Inherit compiler arguments since they may be required for building for lang, opts in tgt.compile_opts.items(): @@ -546,7 +546,7 @@ class ConverterTarget: to_process += [x for x in i.depends if x not in processed] else: new_deps += [i] - self.depends = list(set(new_deps)) + self.depends = list(OrderedSet(new_deps)) def cleanup_dependencies(self): # Clear the dependencies from targets that where moved from @@ -720,7 +720,7 @@ class ConverterCustomTarget: to_process += [x for x in i.depends if x not in processed] else: new_deps += [i] - self.depends = list(set(new_deps)) + self.depends = list(OrderedSet(new_deps)) def get_ref(self, fname: str) -> T.Optional[CustomTargetReference]: fname = os.path.basename(fname) @@ -863,7 +863,7 @@ class CMakeInterpreter: cmake_files = self.fileapi.get_cmake_sources() self.bs_files = [x.file for x in cmake_files if not x.is_cmake and not x.is_temp] self.bs_files = [os.path.relpath(x, self.env.get_source_dir()) for x in self.bs_files] - self.bs_files = list(set(self.bs_files)) + self.bs_files = list(OrderedSet(self.bs_files)) # Load the codemodel configurations self.codemodel_configs = self.fileapi.get_cmake_configurations() @@ -888,7 +888,7 @@ class CMakeInterpreter: src_dir = bs_reply.src_dir self.bs_files = [x.file for x in bs_reply.build_files if not x.is_cmake and not x.is_temp] self.bs_files = [os.path.relpath(os.path.join(src_dir, x), self.env.get_source_dir()) for x in self.bs_files] - self.bs_files = list(set(self.bs_files)) + self.bs_files = list(OrderedSet(self.bs_files)) self.codemodel_configs = cm_reply.configs def analyse(self) -> None: diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index 2caddde..52b9592 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -1201,6 +1201,9 @@ class Compiler: """ return [] + def get_coverage_link_args(self) -> T.List[str]: + return self.linker.get_coverage_args() + def get_largefile_args(compiler): ''' diff --git a/mesonbuild/compilers/d.py b/mesonbuild/compilers/d.py index a86f254..a83e221 100644 --- a/mesonbuild/compilers/d.py +++ b/mesonbuild/compilers/d.py @@ -105,6 +105,9 @@ class DmdLikeCompilerMixin: def get_coverage_args(self): return ['-cov'] + def get_coverage_link_args(self): + return [] + def get_preprocess_only_args(self): return ['-E'] @@ -642,7 +645,7 @@ class GnuDCompiler(GnuCompiler, DCompiler): '1': default_warn_args, '2': default_warn_args + ['-Wextra'], '3': default_warn_args + ['-Wextra', '-Wpedantic']} - self.base_options = ['b_colorout', 'b_sanitize', 'b_staticpic', 'b_vscrt'] + self.base_options = ['b_colorout', 'b_sanitize', 'b_staticpic', 'b_vscrt', 'b_coverage'] self._has_color_support = version_compare(self.version, '>=4.9') # dependencies were implemented before, but broken - support was fixed in GCC 7.1+ @@ -662,9 +665,6 @@ class GnuDCompiler(GnuCompiler, DCompiler): def get_warn_args(self, level): return self.warn_args[level] - def get_coverage_args(self): - return [] - def get_buildtype_args(self, buildtype): return d_gdc_buildtype_args[buildtype] diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py index 93c1a7c..cd16f86 100644 --- a/mesonbuild/compilers/mixins/clike.py +++ b/mesonbuild/compilers/mixins/clike.py @@ -114,12 +114,6 @@ class CLikeCompiler: def get_output_args(self, target): return ['-o', target] - def get_coverage_args(self): - return ['--coverage'] - - def get_coverage_link_args(self) -> T.List[str]: - return self.linker.get_coverage_args() - def get_werror_args(self): return ['-Werror'] diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py index 5072b11..29552f3 100644 --- a/mesonbuild/compilers/mixins/gnu.py +++ b/mesonbuild/compilers/mixins/gnu.py @@ -312,6 +312,9 @@ class GnuLikeCompiler(metaclass=abc.ABCMeta): 'not {}.'.format(linker)) return ['-fuse-ld={}'.format(linker)] + def get_coverage_args(self) -> T.List[str]: + return ['--coverage'] + class GnuCompiler(GnuLikeCompiler): """ diff --git a/mesonbuild/dependencies/dev.py b/mesonbuild/dependencies/dev.py index b6ac331..67d7e65 100644 --- a/mesonbuild/dependencies/dev.py +++ b/mesonbuild/dependencies/dev.py @@ -406,6 +406,9 @@ class LLVMDependencyCMake(CMakeDependency): # Extract extra include directories and definitions inc_dirs = self.traceparser.get_cmake_var('PACKAGE_INCLUDE_DIRS') defs = self.traceparser.get_cmake_var('PACKAGE_DEFINITIONS') + # LLVM explicitly uses space-separated variables rather than semicolon lists + if len(defs) == 1: + defs = defs[0].split(' ') temp = ['-I' + x for x in inc_dirs] + defs self.compile_args += [x for x in temp if x not in self.compile_args] if not self._add_sub_dependency(threads_factory(env, self.for_machine, {})): diff --git a/test cases/cmake/17 include path order/main.cpp b/test cases/cmake/17 include path order/main.cpp new file mode 100644 index 0000000..9507961 --- /dev/null +++ b/test cases/cmake/17 include path order/main.cpp @@ -0,0 +1,10 @@ +#include <iostream> +#include <cmMod.hpp> + +using namespace std; + +int main(void) { + cmModClass obj("Hello"); + cout << obj.getStr() << endl; + return 0; +} diff --git a/test cases/cmake/17 include path order/meson.build b/test cases/cmake/17 include path order/meson.build new file mode 100644 index 0000000..cf3ec96 --- /dev/null +++ b/test cases/cmake/17 include path order/meson.build @@ -0,0 +1,9 @@ +project('include_path_order', ['c', 'cpp']) + +cm = import('cmake') + +sub_pro = cm.subproject('cmMod') +sub_dep = sub_pro.dependency('cmModLib++') + +exe1 = executable('main', ['main.cpp'], dependencies: [sub_dep]) +test('test1', exe1) diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/CMakeLists.txt b/test cases/cmake/17 include path order/subprojects/cmMod/CMakeLists.txt new file mode 100644 index 0000000..9a252df --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/CMakeLists.txt @@ -0,0 +1,34 @@ +cmake_minimum_required(VERSION 3.5) + +project(cmMod) +set (CMAKE_CXX_STANDARD 14) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + + # The one and only correct include dir + ${CMAKE_CURRENT_SOURCE_DIR}/incG + + # All of these are traps + ${CMAKE_CURRENT_SOURCE_DIR}/incL + ${CMAKE_CURRENT_SOURCE_DIR}/incM + ${CMAKE_CURRENT_SOURCE_DIR}/incO + ${CMAKE_CURRENT_SOURCE_DIR}/incF + ${CMAKE_CURRENT_SOURCE_DIR}/incI + ${CMAKE_CURRENT_SOURCE_DIR}/incE + ${CMAKE_CURRENT_SOURCE_DIR}/incD + ${CMAKE_CURRENT_SOURCE_DIR}/incH + ${CMAKE_CURRENT_SOURCE_DIR}/incN + ${CMAKE_CURRENT_SOURCE_DIR}/incA + ${CMAKE_CURRENT_SOURCE_DIR}/incB + ${CMAKE_CURRENT_SOURCE_DIR}/incJ + ${CMAKE_CURRENT_SOURCE_DIR}/incP + ${CMAKE_CURRENT_SOURCE_DIR}/incC + ${CMAKE_CURRENT_SOURCE_DIR}/incK +) + +add_definitions("-DDO_NOTHING_JUST_A_FLAG=1") + +add_library(cmModLib++ SHARED cmMod.cpp) +include(GenerateExportHeader) +generate_export_header(cmModLib++) diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/cmMod.cpp b/test cases/cmake/17 include path order/subprojects/cmMod/cmMod.cpp new file mode 100644 index 0000000..d3141d5 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/cmMod.cpp @@ -0,0 +1,11 @@ +#include "cmMod.hpp" + +using namespace std; + +cmModClass::cmModClass(string foo) { + str = foo + " World"; +} + +string cmModClass::getStr() const { + return str; +} diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incA/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incA/cmMod.hpp new file mode 100644 index 0000000..6228a31 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incA/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (A) +#pragma once + +#error "cmMod.hpp in incA must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incB/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incB/cmMod.hpp new file mode 100644 index 0000000..60bf14c --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incB/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (B) +#pragma once + +#error "cmMod.hpp in incB must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incC/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incC/cmMod.hpp new file mode 100644 index 0000000..3229e07 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incC/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (C) +#pragma once + +#error "cmMod.hpp in incC must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incD/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incD/cmMod.hpp new file mode 100644 index 0000000..b958093 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incD/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (D) +#pragma once + +#error "cmMod.hpp in incD must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incE/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incE/cmMod.hpp new file mode 100644 index 0000000..aea5b6d --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incE/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (E) +#pragma once + +#error "cmMod.hpp in incE must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incF/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incF/cmMod.hpp new file mode 100644 index 0000000..1e1e2cb --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incF/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (F) +#pragma once + +#error "cmMod.hpp in incF must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incG/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incG/cmMod.hpp new file mode 100644 index 0000000..0e6dc04 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incG/cmMod.hpp @@ -0,0 +1,14 @@ +#pragma once + +#include "cmmodlib++_export.h" +#include <string> + +class CMMODLIB___EXPORT cmModClass { +private: + std::string str; + +public: + cmModClass(std::string foo); + + std::string getStr() const; +}; diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incH/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incH/cmMod.hpp new file mode 100644 index 0000000..263e701 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incH/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (H) +#pragma once + +#error "cmMod.hpp in incH must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incI/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incI/cmMod.hpp new file mode 100644 index 0000000..a44a89a --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incI/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (I) +#pragma once + +#error "cmMod.hpp in incI must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incJ/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incJ/cmMod.hpp new file mode 100644 index 0000000..118a809 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incJ/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (J) +#pragma once + +#error "cmMod.hpp in incJ must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incL/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incL/cmMod.hpp new file mode 100644 index 0000000..8294104 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incL/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (L) +#pragma once + +#error "cmMod.hpp in incL must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incM/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incM/cmMod.hpp new file mode 100644 index 0000000..031c5e9 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incM/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (M) +#pragma once + +#error "cmMod.hpp in incM must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incN/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incN/cmMod.hpp new file mode 100644 index 0000000..9dba6da --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incN/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (N) +#pragma once + +#error "cmMod.hpp in incN must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incO/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incO/cmMod.hpp new file mode 100644 index 0000000..233add9 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incO/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (O) +#pragma once + +#error "cmMod.hpp in incO must not be included" diff --git a/test cases/cmake/17 include path order/subprojects/cmMod/incP/cmMod.hpp b/test cases/cmake/17 include path order/subprojects/cmMod/incP/cmMod.hpp new file mode 100644 index 0000000..9578745 --- /dev/null +++ b/test cases/cmake/17 include path order/subprojects/cmMod/incP/cmMod.hpp @@ -0,0 +1,4 @@ +// cmMod.hpp (P) +#pragma once + +#error "cmMod.hpp in incP must not be included" diff --git a/test cases/common/206 install name_prefix name_suffix/meson.build b/test cases/common/206 install name_prefix name_suffix/meson.build index 4539999..044f915 100644 --- a/test cases/common/206 install name_prefix name_suffix/meson.build +++ b/test cases/common/206 install name_prefix name_suffix/meson.build @@ -8,3 +8,6 @@ static_library('qux', 'libfile.c', name_suffix: 'cheese', install : true) shared_library('corge', 'libfile.c', name_prefix: 'bow', name_suffix: 'stern', install : true) static_library('grault', 'libfile.c', name_prefix: 'bow', name_suffix: 'stern', install : true) + +# exercise default name_prefix and name_suffix +shared_library('garply', 'libfile.c', name_prefix: [], name_suffix: [], install : true) diff --git a/test cases/common/206 install name_prefix name_suffix/test.json b/test cases/common/206 install name_prefix name_suffix/test.json index 63032bc..b92a985 100644 --- a/test cases/common/206 install name_prefix name_suffix/test.json +++ b/test cases/common/206 install name_prefix name_suffix/test.json @@ -11,6 +11,9 @@ {"type": "implib", "file": "usr/lib/foo"}, {"type": "expr", "file": "usr/lib/foo?so"}, {"type": "implib", "file": "usr/lib/libbaz"}, - {"type": "file", "file": "usr/lib/libqux.cheese"} + {"type": "file", "file": "usr/lib/libqux.cheese"}, + {"type": "expr", "file": "usr/?lib/libgarply?so"}, + {"type": "implib", "file": "usr/lib/libgarply"}, + {"type": "pdb", "file": "usr/bin/garply"} ] } |