From 74fe6e421fa3b0c5b0ad6ac7aeb6f4004b59b62f Mon Sep 17 00:00:00 2001 From: eidheim Date: Thu, 20 Aug 2020 09:37:54 +0200 Subject: [PATCH] Meson: now reads build/meson-info/intro-targets.json available in newer meson versions --- src/cmake.cpp | 38 +++++----- src/meson.cpp | 48 +++++++++++-- tests/compile_commands_test.cpp | 6 +- tests/meson_build_test.cpp | 70 ++++++++++++++----- tests/meson_old_test_files/a_subdir/main.cpp | 5 ++ .../meson_old_test_files/a_subdir/meson.build | 1 + tests/meson_old_test_files/another_file.cpp | 5 ++ .../build/compile_commands.json | 27 +++++++ tests/meson_old_test_files/main.cpp | 5 ++ tests/meson_old_test_files/meson.build | 11 +++ .../build/compile_commands.json | 33 +++++---- .../build/meson-info/intro-targets.json | 1 + 12 files changed, 187 insertions(+), 63 deletions(-) create mode 100644 tests/meson_old_test_files/a_subdir/main.cpp create mode 100644 tests/meson_old_test_files/a_subdir/meson.build create mode 100644 tests/meson_old_test_files/another_file.cpp create mode 100644 tests/meson_old_test_files/build/compile_commands.json create mode 100644 tests/meson_old_test_files/main.cpp create mode 100644 tests/meson_old_test_files/meson.build create mode 100644 tests/meson_test_files/build/meson-info/intro-targets.json diff --git a/src/cmake.cpp b/src/cmake.cpp index 31e4293..bdfd55e 100644 --- a/src/cmake.cpp +++ b/src/cmake.cpp @@ -63,7 +63,7 @@ bool CMake::update_default_build(const boost::filesystem::path &default_build_pa auto exit_status = Terminal::get().process(Config::get().project.cmake.command + ' ' + filesystem::escape_argument(project_path.string()) + " -DCMAKE_EXPORT_COMPILE_COMMANDS=ON", default_build_path); message.hide(); - if(exit_status == EXIT_SUCCESS) { + if(exit_status == 0) { #ifdef _WIN32 //Temporary fix to MSYS2's libclang auto compile_commands_file = filesystem::read(compile_commands_path); auto replace_drive = [&compile_commands_file](const std::string ¶m) { @@ -106,7 +106,7 @@ bool CMake::update_debug_build(const boost::filesystem::path &debug_build_path, auto exit_status = Terminal::get().process(Config::get().project.cmake.command + ' ' + filesystem::escape_argument(project_path.string()) + " -DCMAKE_BUILD_TYPE=Debug", debug_build_path); message.hide(); - if(exit_status == EXIT_SUCCESS) + if(exit_status == 0) return true; return false; } @@ -117,9 +117,9 @@ boost::filesystem::path CMake::get_executable(const boost::filesystem::path &bui // are then used to identify if a file in compile_commands.json is part of an executable or not CompileCommands compile_commands(build_path); - std::vector> command_files_and_maybe_executables; + std::vector> source_files_and_maybe_executables; for(auto &command : compile_commands.commands) { - auto command_file = filesystem::get_normal_path(command.file); + auto source_file = filesystem::get_normal_path(command.file); auto values = command.parameter_values("-o"); if(!values.empty()) { size_t pos; @@ -127,7 +127,7 @@ boost::filesystem::path CMake::get_executable(const boost::filesystem::path &bui values[0].erase(pos, 11); if((pos = values[0].find(".dir")) != std::string::npos) { auto executable = command.directory / values[0].substr(0, pos); - command_files_and_maybe_executables.emplace_back(command_file, executable); + source_files_and_maybe_executables.emplace_back(source_file, executable); } } } @@ -155,15 +155,15 @@ boost::filesystem::path CMake::get_executable(const boost::filesystem::path &bui boost::filesystem::path best_match_executable; for(auto &cmake_executable : cmake_executables) { - for(auto &command_file_and_maybe_executable : command_files_and_maybe_executables) { - auto &command_file = command_file_and_maybe_executable.first; - auto &maybe_executable = command_file_and_maybe_executable.second; + for(auto &source_file_and_maybe_executable : source_files_and_maybe_executables) { + auto &source_file = source_file_and_maybe_executable.first; + auto &maybe_executable = source_file_and_maybe_executable.second; if(cmake_executable == maybe_executable) { - if(command_file == file_path) + if(source_file == file_path) return maybe_executable; - auto command_file_directory = command_file.parent_path(); - if(filesystem::file_in_path(file_path, command_file_directory)) { - auto size = std::distance(command_file_directory.begin(), command_file_directory.end()); + auto source_file_directory = source_file.parent_path(); + if(filesystem::file_in_path(file_path, source_file_directory)) { + auto size = std::distance(source_file_directory.begin(), source_file_directory.end()); if(size > best_match_size) { best_match_size = size; best_match_executable = maybe_executable; @@ -175,14 +175,14 @@ boost::filesystem::path CMake::get_executable(const boost::filesystem::path &bui if(!best_match_executable.empty()) return best_match_executable; - for(auto &command_file_and_maybe_executable : command_files_and_maybe_executables) { - auto &command_file = command_file_and_maybe_executable.first; - auto &maybe_executable = command_file_and_maybe_executable.second; - if(command_file == file_path) + for(auto &source_file_and_maybe_executable : source_files_and_maybe_executables) { + auto &source_file = source_file_and_maybe_executable.first; + auto &maybe_executable = source_file_and_maybe_executable.second; + if(source_file == file_path) return maybe_executable; - auto command_file_directory = command_file.parent_path(); - if(filesystem::file_in_path(file_path, command_file_directory)) { - auto size = std::distance(command_file_directory.begin(), command_file_directory.end()); + auto source_file_directory = source_file.parent_path(); + if(filesystem::file_in_path(file_path, source_file_directory)) { + auto size = std::distance(source_file_directory.begin(), source_file_directory.end()); if(size > best_match_size) { best_match_size = size; best_match_executable = maybe_executable; diff --git a/src/meson.cpp b/src/meson.cpp index 85e1dda..c9faeb5 100644 --- a/src/meson.cpp +++ b/src/meson.cpp @@ -6,6 +6,7 @@ #include "terminal.hpp" #include "utility.hpp" #include +#include #include Meson::Meson(const boost::filesystem::path &path) { @@ -63,7 +64,7 @@ bool Meson::update_default_build(const boost::filesystem::path &default_build_pa (compile_commands_exists ? "--internal regenerate " : "") + "--buildtype plain " + filesystem::escape_argument(project_path.string()), default_build_path); message.hide(); - if(exit_status == EXIT_SUCCESS) + if(exit_status == 0) return true; return false; } @@ -91,7 +92,7 @@ bool Meson::update_debug_build(const boost::filesystem::path &debug_build_path, (compile_commands_exists ? "--internal regenerate " : "") + "--buildtype debug " + filesystem::escape_argument(project_path.string()), debug_build_path); message.hide(); - if(exit_status == EXIT_SUCCESS) + if(exit_status == 0) return true; return false; } @@ -101,19 +102,20 @@ boost::filesystem::path Meson::get_executable(const boost::filesystem::path &bui ssize_t best_match_size = -1; boost::filesystem::path best_match_executable; + for(auto &command : compile_commands.commands) { - auto command_file = filesystem::get_normal_path(command.file); + auto source_file = filesystem::get_normal_path(command.file); auto values = command.parameter_values("-o"); if(!values.empty()) { size_t pos; if((pos = values[0].find('@')) != std::string::npos) { if(starts_with(values[0], pos + 1, "exe")) { auto executable = build_path / values[0].substr(0, pos); - if(command_file == file_path) + if(source_file == file_path) return executable; - auto command_file_directory = command_file.parent_path(); - if(filesystem::file_in_path(file_path, command_file_directory)) { - auto size = std::distance(command_file_directory.begin(), command_file_directory.end()); + auto source_file_directory = source_file.parent_path(); + if(filesystem::file_in_path(file_path, source_file_directory)) { + auto size = std::distance(source_file_directory.begin(), source_file_directory.end()); if(size > best_match_size) { best_match_size = size; best_match_executable = executable; @@ -124,5 +126,37 @@ boost::filesystem::path Meson::get_executable(const boost::filesystem::path &bui } } + if(best_match_executable.empty()) { // Newer Meson outputs intro-targets.json that can be used to find executable + boost::property_tree::ptree pt; + try { + boost::property_tree::json_parser::read_json((build_path / "meson-info" / "intro-targets.json").string(), pt); + for(auto &target : pt) { + if(target.second.get("type") == "executable") { + auto filenames = target.second.get_child("filename"); + if(filenames.empty()) // No executable file found + break; + auto executable = filesystem::get_normal_path(filenames.begin()->second.get("")); + for(auto &target_source : target.second.get_child("target_sources")) { + for(auto &source : target_source.second.get_child("sources")) { + auto source_file = filesystem::get_normal_path(source.second.get("")); + if(source_file == file_path) + return executable; + auto source_file_directory = source_file.parent_path(); + if(filesystem::file_in_path(file_path, source_file_directory)) { + auto size = std::distance(source_file_directory.begin(), source_file_directory.end()); + if(size > best_match_size) { + best_match_size = size; + best_match_executable = executable; + } + } + } + } + } + } + } + catch(...) { + } + } + return best_match_executable; } diff --git a/tests/compile_commands_test.cpp b/tests/compile_commands_test.cpp index fd0f5b2..fa1ebbc 100644 --- a/tests/compile_commands_test.cpp +++ b/tests/compile_commands_test.cpp @@ -15,9 +15,9 @@ int main() { g_assert(!system_include_paths.include_paths.empty()); } { - CompileCommands compile_commands(tests_path / "meson_test_files" / "build"); + CompileCommands compile_commands(tests_path / "meson_old_test_files" / "build"); - g_assert(compile_commands.commands.at(0).directory == "jucipp/tests/meson_test_files/build"); + g_assert(compile_commands.commands.at(0).directory == "jucipp/tests/meson_old_test_files/build"); g_assert_cmpuint(compile_commands.commands.size(), ==, 5); @@ -31,7 +31,7 @@ int main() { g_assert_cmpuint(parameter_values.size(), ==, 1); g_assert_cmpstr(parameter_values.at(0).c_str(), ==, "hello_lib@sta/main.cpp.o"); - g_assert(boost::filesystem::canonical(compile_commands.commands.at(0).file) == tests_path / "meson_test_files" / "main.cpp"); + g_assert(boost::filesystem::canonical(compile_commands.commands.at(0).file) == tests_path / "meson_old_test_files" / "main.cpp"); } { diff --git a/tests/meson_build_test.cpp b/tests/meson_build_test.cpp index e043fe1..7a0418b 100644 --- a/tests/meson_build_test.cpp +++ b/tests/meson_build_test.cpp @@ -4,31 +4,67 @@ int main() { auto tests_path = boost::filesystem::canonical(JUCI_TESTS_PATH); - auto meson_test_files_path = boost::filesystem::canonical(tests_path / "meson_test_files"); + // Test old meson versions { - Meson meson(meson_test_files_path / "a_subdir"); - g_assert(meson.project_path == meson_test_files_path); + auto meson_test_files_path = boost::filesystem::canonical(tests_path / "meson_old_test_files"); + { + Meson meson(meson_test_files_path / "a_subdir"); + g_assert(meson.project_path == meson_test_files_path); + } + + { + Meson meson(meson_test_files_path); + g_assert(meson.project_path == meson_test_files_path); + + g_assert(meson.get_executable(meson_test_files_path / "build", meson_test_files_path / "main.cpp") == meson_test_files_path / "build" / "hello"); + g_assert(meson.get_executable(meson_test_files_path / "build", meson_test_files_path / "another_file.cpp") == meson_test_files_path / "build" / "another_executable"); + g_assert(meson.get_executable(meson_test_files_path / "build", meson_test_files_path / "a_subdir" / "main.cpp") == meson_test_files_path / "build" / "a_subdir" / "hello2"); + + g_assert(meson.get_executable(meson_test_files_path / "build", meson_test_files_path / "non_existing_file.cpp") == meson_test_files_path / "build" / "hello"); + g_assert(meson.get_executable(meson_test_files_path / "build", meson_test_files_path) == meson_test_files_path / "build" / "hello"); + + g_assert(meson.get_executable(meson_test_files_path / "build", meson_test_files_path / "a_subdir") == meson_test_files_path / "build" / "a_subdir" / "hello2"); + g_assert(meson.get_executable(meson_test_files_path / "build", meson_test_files_path / "a_subdir" / "non_existing_file.cpp") == meson_test_files_path / "build" / "a_subdir" / "hello2"); + } + + auto build = Project::Build::create(meson_test_files_path); + g_assert(dynamic_cast(build.get())); + + build = Project::Build::create(meson_test_files_path / "a_subdir"); + g_assert(dynamic_cast(build.get())); } + // Test new meson versions { - Meson meson(meson_test_files_path); - g_assert(meson.project_path == meson_test_files_path); + auto meson_test_files_path = boost::filesystem::canonical(tests_path / "meson_test_files"); + /// Paths in meson-info are absolute, and this path is used in intro-targets.json + auto virtual_test_files_path = boost::filesystem::path("/") / "home" / "test" / "meson_test_files"; - g_assert(meson.get_executable(meson_test_files_path / "build", meson_test_files_path / "main.cpp") == meson_test_files_path / "build" / "hello"); - g_assert(meson.get_executable(meson_test_files_path / "build", meson_test_files_path / "another_file.cpp") == meson_test_files_path / "build" / "another_executable"); - g_assert(meson.get_executable(meson_test_files_path / "build", meson_test_files_path / "a_subdir" / "main.cpp") == meson_test_files_path / "build" / "a_subdir" / "hello2"); + { + Meson meson(meson_test_files_path / "a_subdir"); + g_assert(meson.project_path == meson_test_files_path); + } - g_assert(meson.get_executable(meson_test_files_path / "build", meson_test_files_path / "non_existing_file.cpp") == meson_test_files_path / "build" / "hello"); - g_assert(meson.get_executable(meson_test_files_path / "build", meson_test_files_path) == meson_test_files_path / "build" / "hello"); + { + Meson meson(meson_test_files_path); + g_assert(meson.project_path == meson_test_files_path); - g_assert(meson.get_executable(meson_test_files_path / "build", meson_test_files_path / "a_subdir") == meson_test_files_path / "build" / "a_subdir" / "hello2"); - g_assert(meson.get_executable(meson_test_files_path / "build", meson_test_files_path / "a_subdir" / "non_existing_file.cpp") == meson_test_files_path / "build" / "a_subdir" / "hello2"); - } + g_assert(meson.get_executable(meson_test_files_path / "build", virtual_test_files_path / "main.cpp") == virtual_test_files_path / "build" / "hello"); + g_assert(meson.get_executable(meson_test_files_path / "build", virtual_test_files_path / "another_file.cpp") == virtual_test_files_path / "build" / "another_executable"); + g_assert(meson.get_executable(meson_test_files_path / "build", virtual_test_files_path / "a_subdir" / "main.cpp") == virtual_test_files_path / "build" / "a_subdir" / "hello2"); + + g_assert(meson.get_executable(meson_test_files_path / "build", virtual_test_files_path / "non_existing_file.cpp") == virtual_test_files_path / "build" / "hello"); + g_assert(meson.get_executable(meson_test_files_path / "build", virtual_test_files_path) == virtual_test_files_path / "build" / "hello"); - auto build = Project::Build::create(meson_test_files_path); - g_assert(dynamic_cast(build.get())); + g_assert(meson.get_executable(meson_test_files_path / "build", virtual_test_files_path / "a_subdir") == virtual_test_files_path / "build" / "a_subdir" / "hello2"); + g_assert(meson.get_executable(meson_test_files_path / "build", virtual_test_files_path / "a_subdir" / "non_existing_file.cpp") == virtual_test_files_path / "build" / "a_subdir" / "hello2"); + } - build = Project::Build::create(meson_test_files_path / "a_subdir"); - g_assert(dynamic_cast(build.get())); + auto build = Project::Build::create(meson_test_files_path); + g_assert(dynamic_cast(build.get())); + + build = Project::Build::create(meson_test_files_path / "a_subdir"); + g_assert(dynamic_cast(build.get())); + } } diff --git a/tests/meson_old_test_files/a_subdir/main.cpp b/tests/meson_old_test_files/a_subdir/main.cpp new file mode 100644 index 0000000..1527da0 --- /dev/null +++ b/tests/meson_old_test_files/a_subdir/main.cpp @@ -0,0 +1,5 @@ +#include + +int main() { + std::cout << "Hello World\n"; +} diff --git a/tests/meson_old_test_files/a_subdir/meson.build b/tests/meson_old_test_files/a_subdir/meson.build new file mode 100644 index 0000000..fa1e3aa --- /dev/null +++ b/tests/meson_old_test_files/a_subdir/meson.build @@ -0,0 +1 @@ +executable('hello2', 'main.cpp', cpp_args: compiler_args) diff --git a/tests/meson_old_test_files/another_file.cpp b/tests/meson_old_test_files/another_file.cpp new file mode 100644 index 0000000..1527da0 --- /dev/null +++ b/tests/meson_old_test_files/another_file.cpp @@ -0,0 +1,5 @@ +#include + +int main() { + std::cout << "Hello World\n"; +} diff --git a/tests/meson_old_test_files/build/compile_commands.json b/tests/meson_old_test_files/build/compile_commands.json new file mode 100644 index 0000000..06f1990 --- /dev/null +++ b/tests/meson_old_test_files/build/compile_commands.json @@ -0,0 +1,27 @@ +[ + { + "directory": "jucipp/tests/meson_old_test_files/build", + "command": "c++ '-Ihello_lib@sta' '-I..' '-I.' '-Wall' '-Winvalid-pch' '-Wnon-virtual-dtor' '-std=c++11' '-Wall' '-Wextra' '-O0' '-g' '-MMD' '-MQ' 'hello_lib@sta/main.cpp.o' '-MF' 'hello_lib@sta/main.cpp.o.d' -o 'hello_lib@sta/main.cpp.o' -c ../main.cpp", + "file": "../main.cpp" + }, + { + "directory": "jucipp/tests/meson_old_test_files/build", + "command": "c++ '-Ihello@exe' '-I..' '-I.' '-Wall' '-Winvalid-pch' '-Wnon-virtual-dtor' '-std=c++11' '-Wall' '-Wextra' '-O0' '-g' '-MMD' '-MQ' 'hello@exe/main.cpp.o' '-MF' 'hello@exe/main.cpp.o.d' -o 'hello@exe/main.cpp.o' -c ../main.cpp", + "file": "../main.cpp" + }, + { + "directory": "jucipp/tests/meson_old_test_files/build", + "command": "c++ '-Ia_subdir/hello2@exe' '-I../a_subdir' '-Ia_subdir' '-Wall' '-Winvalid-pch' '-Wnon-virtual-dtor' '-std=c++11' '-Wall' '-Wextra' '-O0' '-g' '-MMD' '-MQ' 'a_subdir/hello2@exe/main.cpp.o' '-MF' 'a_subdir/hello2@exe/main.cpp.o.d' -o 'a_subdir/hello2@exe/main.cpp.o' -c ../a_subdir/main.cpp", + "file": "../a_subdir/main.cpp" + }, + { + "directory": "jucipp/tests/meson_old_test_files/build", + "command": "c++ '-Ianother_executable@exe' '-I..' '-I.' '-Wall' '-Winvalid-pch' '-Wnon-virtual-dtor' '-std=c++11' '-Wall' '-Wextra' '-O0' '-g' '-MMD' '-MQ' 'another_executable@exe/another_file.cpp.o' '-MF' 'another_executable@exe/another_file.cpp.o.d' -o 'another_executable@exe/another_file.cpp.o' -c ../another_file.cpp", + "file": "../another_file.cpp" + }, + { + "directory": "jucipp/tests/meson_old_test_files/build", + "command": "'te\\'s\"t' te\\ st test te\\\\st te\\\\\\\\st", + "file": "../parse_test.cpp" + } +] diff --git a/tests/meson_old_test_files/main.cpp b/tests/meson_old_test_files/main.cpp new file mode 100644 index 0000000..1527da0 --- /dev/null +++ b/tests/meson_old_test_files/main.cpp @@ -0,0 +1,5 @@ +#include + +int main() { + std::cout << "Hello World\n"; +} diff --git a/tests/meson_old_test_files/meson.build b/tests/meson_old_test_files/meson.build new file mode 100644 index 0000000..c7a3cb9 --- /dev/null +++ b/tests/meson_old_test_files/meson.build @@ -0,0 +1,11 @@ +project('hello.world', 'cpp') + +compiler_args = ['-std=c++11', '-Wall', '-Wextra'] + +static_library('hello_lib', 'main.cpp', cpp_args: compiler_args) + +executable('hello', 'main.cpp', cpp_args: compiler_args) + +executable('another_executable', 'another_file.cpp', cpp_args: compiler_args) + +subdir('a_subdir') diff --git a/tests/meson_test_files/build/compile_commands.json b/tests/meson_test_files/build/compile_commands.json index a99e681..aea947b 100644 --- a/tests/meson_test_files/build/compile_commands.json +++ b/tests/meson_test_files/build/compile_commands.json @@ -1,27 +1,26 @@ [ { - "directory": "jucipp/tests/meson_test_files/build", - "command": "c++ '-Ihello_lib@sta' '-I..' '-I.' '-Wall' '-Winvalid-pch' '-Wnon-virtual-dtor' '-std=c++11' '-Wall' '-Wextra' '-O0' '-g' '-MMD' '-MQ' 'hello_lib@sta/main.cpp.o' '-MF' 'hello_lib@sta/main.cpp.o.d' -o 'hello_lib@sta/main.cpp.o' -c ../main.cpp", - "file": "../main.cpp" + "directory": "/home/test/meson_test_files/build", + "command": "c++ -Ilibhello_lib.a.p -I. -I.. -Xclang -fcolor-diagnostics -pipe -std=c++11 -Wall -Wextra -MD -MQ libhello_lib.a.p/main.cpp.o -MF libhello_lib.a.p/main.cpp.o.d -o libhello_lib.a.p/main.cpp.o -c ../main.cpp", + "file": "../main.cpp", + "output": "libhello_lib.a.p/main.cpp.o" }, { - "directory": "jucipp/tests/meson_test_files/build", - "command": "c++ '-Ihello@exe' '-I..' '-I.' '-Wall' '-Winvalid-pch' '-Wnon-virtual-dtor' '-std=c++11' '-Wall' '-Wextra' '-O0' '-g' '-MMD' '-MQ' 'hello@exe/main.cpp.o' '-MF' 'hello@exe/main.cpp.o.d' -o 'hello@exe/main.cpp.o' -c ../main.cpp", - "file": "../main.cpp" + "directory": "/home/test/meson_test_files/build", + "command": "c++ -Ihello.p -I. -I.. -Xclang -fcolor-diagnostics -pipe -std=c++11 -Wall -Wextra -MD -MQ hello.p/main.cpp.o -MF hello.p/main.cpp.o.d -o hello.p/main.cpp.o -c ../main.cpp", + "file": "../main.cpp", + "output": "hello.p/main.cpp.o" }, { - "directory": "jucipp/tests/meson_test_files/build", - "command": "c++ '-Ia_subdir/hello2@exe' '-I../a_subdir' '-Ia_subdir' '-Wall' '-Winvalid-pch' '-Wnon-virtual-dtor' '-std=c++11' '-Wall' '-Wextra' '-O0' '-g' '-MMD' '-MQ' 'a_subdir/hello2@exe/main.cpp.o' '-MF' 'a_subdir/hello2@exe/main.cpp.o.d' -o 'a_subdir/hello2@exe/main.cpp.o' -c ../a_subdir/main.cpp", - "file": "../a_subdir/main.cpp" + "directory": "/home/test/meson_test_files/build", + "command": "c++ -Ianother_executable.p -I. -I.. -Xclang -fcolor-diagnostics -pipe -std=c++11 -Wall -Wextra -MD -MQ another_executable.p/another_file.cpp.o -MF another_executable.p/another_file.cpp.o.d -o another_executable.p/another_file.cpp.o -c ../another_file.cpp", + "file": "../another_file.cpp", + "output": "another_executable.p/another_file.cpp.o" }, { - "directory": "jucipp/tests/meson_test_files/build", - "command": "c++ '-Ianother_executable@exe' '-I..' '-I.' '-Wall' '-Winvalid-pch' '-Wnon-virtual-dtor' '-std=c++11' '-Wall' '-Wextra' '-O0' '-g' '-MMD' '-MQ' 'another_executable@exe/another_file.cpp.o' '-MF' 'another_executable@exe/another_file.cpp.o.d' -o 'another_executable@exe/another_file.cpp.o' -c ../another_file.cpp", - "file": "../another_file.cpp" - }, - { - "directory": "jucipp/tests/meson_test_files/build", - "command": "'te\\'s\"t' te\\ st test te\\\\st te\\\\\\\\st", - "file": "../parse_test.cpp" + "directory": "/home/test/meson_test_files/build", + "command": "c++ -Ia_subdir/hello2.p -Ia_subdir -I../a_subdir -Xclang -fcolor-diagnostics -pipe -std=c++11 -Wall -Wextra -MD -MQ a_subdir/hello2.p/main.cpp.o -MF a_subdir/hello2.p/main.cpp.o.d -o a_subdir/hello2.p/main.cpp.o -c ../a_subdir/main.cpp", + "file": "../a_subdir/main.cpp", + "output": "a_subdir/hello2.p/main.cpp.o" } ] diff --git a/tests/meson_test_files/build/meson-info/intro-targets.json b/tests/meson_test_files/build/meson-info/intro-targets.json new file mode 100644 index 0000000..fa8f51c --- /dev/null +++ b/tests/meson_test_files/build/meson-info/intro-targets.json @@ -0,0 +1 @@ +[{"name": "hello_lib", "id": "hello_lib@sta", "type": "static library", "defined_in": "/home/test/meson_test_files/meson.build", "filename": ["/home/test/meson_test_files/build/libhello_lib.a"], "build_by_default": true, "target_sources": [{"language": "cpp", "compiler": ["c++"], "parameters": ["-I/home/test/meson_test_files/build/libhello_lib.a.p", "-I/home/test/meson_test_files/build", "-I/home/test/meson_test_files", "-Xclang", "-fcolor-diagnostics", "-pipe", "-std=c++11", "-Wall", "-Wextra"], "sources": ["/home/test/meson_test_files/main.cpp"], "generated_sources": []}], "subproject": null, "installed": false}, {"name": "hello", "id": "hello@exe", "type": "executable", "defined_in": "/home/test/meson_test_files/meson.build", "filename": ["/home/test/meson_test_files/build/hello"], "build_by_default": true, "target_sources": [{"language": "cpp", "compiler": ["c++"], "parameters": ["-I/home/test/meson_test_files/build/hello.p", "-I/home/test/meson_test_files/build", "-I/home/test/meson_test_files", "-Xclang", "-fcolor-diagnostics", "-pipe", "-std=c++11", "-Wall", "-Wextra"], "sources": ["/home/test/meson_test_files/main.cpp"], "generated_sources": []}], "subproject": null, "installed": false}, {"name": "another_executable", "id": "another_executable@exe", "type": "executable", "defined_in": "/home/test/meson_test_files/meson.build", "filename": ["/home/test/meson_test_files/build/another_executable"], "build_by_default": true, "target_sources": [{"language": "cpp", "compiler": ["c++"], "parameters": ["-I/home/test/meson_test_files/build/another_executable.p", "-I/home/test/meson_test_files/build", "-I/home/test/meson_test_files", "-Xclang", "-fcolor-diagnostics", "-pipe", "-std=c++11", "-Wall", "-Wextra"], "sources": ["/home/test/meson_test_files/another_file.cpp"], "generated_sources": []}], "subproject": null, "installed": false}, {"name": "hello2", "id": "f94d950@@hello2@exe", "type": "executable", "defined_in": "/home/test/meson_test_files/a_subdir/meson.build", "filename": ["/home/test/meson_test_files/build/a_subdir/hello2"], "build_by_default": true, "target_sources": [{"language": "cpp", "compiler": ["c++"], "parameters": ["-I/home/test/meson_test_files/build/a_subdir/hello2.p", "-I/home/test/meson_test_files/build/a_subdir", "-I/home/test/meson_test_files/a_subdir", "-Xclang", "-fcolor-diagnostics", "-pipe", "-std=c++11", "-Wall", "-Wextra"], "sources": ["/home/test/meson_test_files/a_subdir/main.cpp"], "generated_sources": []}], "subproject": null, "installed": false}] \ No newline at end of file