mirror of
https://github.com/mesonbuild/meson.git
synced 2026-11-06 05:16:42 +00:00
cmake: Add cross tests
This commit is contained in:
24 files changed
+95
-14
No files matched your search
@@ -16,4 +16,4 @@ jobs:
|
||||
apt-get -y autoremove
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run tests
|
||||
run: bash -c 'source /ci/env_vars.sh; cd $GITHUB_WORKSPACE; ./run_tests.py $CI_ARGS --cross ubuntu-armhf.txt --cross-only'
|
||||
run: bash -c 'source /ci/env_vars.sh; cd $GITHUB_WORKSPACE; ./run_tests.py $CI_ARGS --cross ubuntu-armhf.json --cross-only'
|
||||
+2
-2
@@ -34,10 +34,10 @@ matrix:
|
||||
# Also hijack one cross build to test long commandline handling codepath (and avoid overloading Travis)
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: RUN_TESTS_ARGS="--cross ubuntu-armhf.txt --cross linux-mingw-w64-64bit.txt" MESON_RSP_THRESHOLD=0
|
||||
env: RUN_TESTS_ARGS="--cross ubuntu-armhf.json --cross linux-mingw-w64-64bit.json" MESON_RSP_THRESHOLD=0
|
||||
- os: linux
|
||||
compiler: gcc
|
||||
env: RUN_TESTS_ARGS="--cross ubuntu-armhf.txt --cross linux-mingw-w64-64bit.txt" MESON_ARGS="--unity=on"
|
||||
env: RUN_TESTS_ARGS="--cross ubuntu-armhf.json --cross linux-mingw-w64-64bit.json" MESON_ARGS="--unity=on"
|
||||
|
||||
before_install:
|
||||
- python ./skip_ci.py --base-branch-env=TRAVIS_BRANCH --is-pull-env=TRAVIS_PULL_REQUEST
|
||||
|
||||
@@ -31,6 +31,11 @@ fi
|
||||
source /ci/env_vars.sh
|
||||
cd /root
|
||||
|
||||
update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
|
||||
update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix
|
||||
update-alternatives --set i686-w64-mingw32-gcc /usr/bin/i686-w64-mingw32-gcc-posix
|
||||
update-alternatives --set i686-w64-mingw32-g++ /usr/bin/i686-w64-mingw32-g++-posix
|
||||
|
||||
./run_tests.py $RUN_TESTS_ARGS -- $MESON_ARGS
|
||||
#./upload.sh
|
||||
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"file": "linux-mingw-w64-32bit.txt",
|
||||
"tests": ["common", "cmake"],
|
||||
"env": {
|
||||
"WINEPATH": "/usr/lib/gcc/i686-w64-mingw32/9.2-posix;/usr/i686-w64-mingw32/bin;/usr/i686-w64-mingw32/lib"
|
||||
}
|
||||
}
|
||||
@@ -19,3 +19,11 @@ system = 'windows'
|
||||
cpu_family = 'x86'
|
||||
cpu = 'i686'
|
||||
endian = 'little'
|
||||
|
||||
[cmake]
|
||||
|
||||
CMAKE_BUILD_WITH_INSTALL_RPATH = 'ON'
|
||||
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = 'NEVER'
|
||||
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = 'ONLY'
|
||||
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = 'ONLY'
|
||||
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = 'ONLY'
|
||||
@@ -0,0 +1,7 @@
|
||||
{
|
||||
"file": "linux-mingw-w64-64bit.txt",
|
||||
"tests": ["common", "cmake"],
|
||||
"env": {
|
||||
"WINEPATH": "/usr/lib/gcc/x86_64-w64-mingw32/9.2-posix;/usr/x86_64-w64-mingw32/bin;/usr/x86_64-w64-mingw32/lib"
|
||||
}
|
||||
}
|
||||
@@ -18,3 +18,11 @@ system = 'windows'
|
||||
cpu_family = 'x86_64'
|
||||
cpu = 'x86_64'
|
||||
endian = 'little'
|
||||
|
||||
[cmake]
|
||||
|
||||
CMAKE_BUILD_WITH_INSTALL_RPATH = 'ON'
|
||||
CMAKE_FIND_ROOT_PATH_MODE_PROGRAM = 'NEVER'
|
||||
CMAKE_FIND_ROOT_PATH_MODE_LIBRARY = 'ONLY'
|
||||
CMAKE_FIND_ROOT_PATH_MODE_INCLUDE = 'ONLY'
|
||||
CMAKE_FIND_ROOT_PATH_MODE_PACKAGE = 'ONLY'
|
||||
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"file": "ubuntu-armhf.txt",
|
||||
"tests": ["common"],
|
||||
"env": {}
|
||||
}
|
||||
+16
-4
@@ -23,10 +23,13 @@ import argparse
|
||||
import subprocess
|
||||
from mesonbuild import mesonlib
|
||||
from mesonbuild.coredata import version as meson_version
|
||||
from pathlib import Path
|
||||
import json
|
||||
import os
|
||||
|
||||
|
||||
def runtests(cross_file, failfast, cross_only):
|
||||
tests = ['--only', 'common']
|
||||
def runtests(cross_file, failfast, cross_only, test_list, env=None):
|
||||
tests = ['--only'] + test_list
|
||||
if not cross_only:
|
||||
tests.append('native')
|
||||
cmd = mesonlib.python_command + ['run_project_tests.py', '--backend', 'ninja']
|
||||
@@ -36,7 +39,7 @@ def runtests(cross_file, failfast, cross_only):
|
||||
cmd += ['--cross-file', cross_file]
|
||||
if cross_only:
|
||||
cmd += ['--native-file', 'cross/none.txt']
|
||||
return subprocess.call(cmd)
|
||||
return subprocess.call(cmd, env=env)
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser()
|
||||
@@ -44,7 +47,16 @@ def main():
|
||||
parser.add_argument('--cross-only', action='store_true')
|
||||
parser.add_argument('cross_file')
|
||||
options = parser.parse_args()
|
||||
return runtests(options.cross_file, options.failfast, options.cross_only)
|
||||
cf_path = Path(options.cross_file)
|
||||
try:
|
||||
data = json.loads(cf_path.read_text())
|
||||
real_cf = cf_path.resolve().parent / data['file']
|
||||
assert real_cf.exists()
|
||||
env = os.environ.copy()
|
||||
env.update(data['env'])
|
||||
return runtests(real_cf.as_posix(), options.failfast, options.cross_only, data['tests'], env=env)
|
||||
except Exception:
|
||||
return runtests(options.cross_file, options.failfast, options.cross_only, ['common'])
|
||||
|
||||
if __name__ == '__main__':
|
||||
print('Meson build system', meson_version, 'Cross Tests')
|
||||
|
||||
@@ -1163,6 +1163,7 @@ def check_format():
|
||||
'.dub', # external deps are here
|
||||
'.pytest_cache',
|
||||
'meson-logs', 'meson-private',
|
||||
'work area',
|
||||
'.eggs', '_cache', # e.g. .mypy_cache
|
||||
'venv', # virtualenvs have DOS line endings
|
||||
}
|
||||
|
||||
@@ -25,4 +25,4 @@ target_link_libraries(testEXE cmModLib)
|
||||
|
||||
target_compile_definitions(cmModLibStatic PUBLIC CMMODLIB_STATIC_DEFINE)
|
||||
|
||||
install(TARGETS cmModLib testEXE LIBRARY DESTINATION lib RUNTIME DESTINATION bin)
|
||||
install(TARGETS testEXE LIBRARY DESTINATION lib RUNTIME DESTINATION bin)
|
||||
@@ -1,7 +1,5 @@
|
||||
{
|
||||
"installed": [
|
||||
{"type": "expr", "file": "usr/?lib/libcm_cmModLib?so"},
|
||||
{"type": "implib", "file": "usr/lib/libcm_cmModLib"},
|
||||
{"type": "exe", "file": "usr/bin/cm_testEXE"}
|
||||
],
|
||||
"tools": {
|
||||
|
||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1 @@
|
||||
set(MESON_TEST_VAR2 VAR2)
|
||||
@@ -0,0 +1,9 @@
|
||||
project('cmake toolchain test', ['c', 'cpp'])
|
||||
|
||||
if meson.is_cross_build()
|
||||
error('MESON_SKIP_TEST: skip this on cross builds')
|
||||
endif
|
||||
|
||||
cm = import('cmake')
|
||||
|
||||
sub_pro = cm.subproject('cmMod')
|
||||
@@ -0,0 +1,8 @@
|
||||
[properties]
|
||||
|
||||
cmake_toolchain_file = '@MESON_TEST_ROOT@/CMakeToolchain.cmake'
|
||||
|
||||
[cmake]
|
||||
|
||||
MESON_TEST_VAR1 = 'VAR1 space'
|
||||
MESON_TEST_VAR2 = 'VAR2 error'
|
||||
@@ -0,0 +1,11 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
project(cmMod)
|
||||
|
||||
if(NOT "${MESON_TEST_VAR1}" STREQUAL "VAR1 space")
|
||||
message(FATAL_ERROR "MESON_TEST_VAR1 -- '${MESON_TEST_VAR1}' != 'VAR1 space'")
|
||||
endif()
|
||||
|
||||
if(NOT "${MESON_TEST_VAR2}" STREQUAL "VAR2")
|
||||
message(FATAL_ERROR "MESON_TEST_VAR2 -- '${MESON_TEST_VAR2}' != 'VAR2'")
|
||||
endif()
|
||||
@@ -23,4 +23,4 @@ target_link_libraries(testEXE2 cmModLib)
|
||||
|
||||
target_compile_definitions(cmModLibStatic PUBLIC CMMODLIB_STATIC_DEFINE)
|
||||
|
||||
install(TARGETS cmModLib testEXE testEXE2 LIBRARY DESTINATION lib RUNTIME DESTINATION bin)
|
||||
install(TARGETS testEXE testEXE2 LIBRARY DESTINATION lib RUNTIME DESTINATION bin)
|
||||
@@ -1,8 +1,5 @@
|
||||
{
|
||||
"installed": [
|
||||
{"type": "expr", "file": "usr/?lib/libcm_cmModLib?so"},
|
||||
{"type": "implib", "file": "usr/lib/libcm_cmModLib"},
|
||||
{"type": "pdb", "file": "usr/bin/cm_cmModLib"},
|
||||
{"type": "pdb", "file": "usr/bin/cm_testEXE"},
|
||||
{"type": "exe", "file": "usr/bin/cm_testEXE"},
|
||||
{"type": "pdb", "file": "usr/bin/cm_testEXE2"},
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
cmake_minimum_required(VERSION 3.7)
|
||||
|
||||
project(CMCodeGen)
|
||||
set(CMAKE_CXX_STANDARD 14)
|
||||
|
||||
add_executable(genA main.cpp)
|
||||
@@ -3,6 +3,9 @@
|
||||
"options": {
|
||||
"cmake_prefix_path": [
|
||||
{ "val": ["val1", "val2"] }
|
||||
],
|
||||
"build.cmake_prefix_path": [
|
||||
{ "val": ["val1", "val2"] }
|
||||
]
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user