| 1791 | "\n" |
| 1792 | "namespace SC\n" |
| 1793 | "{{\n" |
| 1794 | "namespace Build\n" |
| 1795 | "{{\n" |
| 1796 | "Result configure(Definition& definition, const Parameters& parameters)\n" |
| 1797 | "{{\n" |
| 1798 | " Project project = {{\"{}\", TargetType::ConsoleExecutable}};\n" |
| 1799 | " SC_TRY(project.setRootDirectory(parameters.directories.projectDirectory.view()));\n" |
| 1800 | " SC_TRY(project.addPresetConfiguration(Configuration::Preset::Debug, parameters));\n" |
| 1801 | " SC_TRY(project.addPresetConfiguration(Configuration::Preset::Release, parameters));\n" |
| 1802 | " SC_TRY(project.addFile(\"SC-build.cpp\"));\n" |
| 1803 | " return definition.addProject(move(project));\n" |
| 1804 | "}}\n" |
| 1805 | "}} // namespace Build\n" |
| 1806 | "}} // namespace SC\n" |
| 1807 | "#else\n" |
| 1808 | "#include <stdio.h>\n" |
| 1809 | "\n" |
| 1810 | "int main()\n" |
| 1811 | "{{\n" |
| 1812 | " puts(\"self-hosting-build-file\");\n" |
| 1813 | " return 0;\n" |
| 1814 | "}}\n" |
| 1815 | "#endif\n", |
| 1816 | SelfHostingFixtureProjectName)); |
| 1817 | |
| 1818 | SC_TRY(fs.writeString(buildDefinitionPath.view(), buildDefinitionContents.view())); |
| 1819 | return Result(true); |
| 1820 | } |
| 1821 | |
| 1822 | static Result writeStaticLibraryFixture(FileSystem& fs, StringView sourceRoot) |
| 1823 | { |
| 1824 | SC_TRY(fs.makeDirectoryRecursive(sourceRoot)); |
| 1825 | |
| 1826 | String sourcePath = StringEncoding::Utf8; |
| 1827 | SC_TRY(Path::join(sourcePath, {sourceRoot, "library.cpp"})); |
| 1828 | SC_TRY(fs.writeString(sourcePath.view(), "int fixture_library_value()\n" |
| 1829 | "{\n" |
| 1830 | " return 42;\n" |
| 1831 | "}\n")); |
| 1832 | return Result(true); |
| 1833 | } |
| 1834 | |
| 1835 | static Result writeStaticLibraryConsumerFixture(FileSystem& fs, StringView sourceRoot) |
| 1836 | { |
| 1837 | SC_TRY(fs.makeDirectoryRecursive(sourceRoot)); |
| 1838 | |
| 1839 | String sourcePath = StringEncoding::Utf8; |
| 1840 | SC_TRY(Path::join(sourcePath, {sourceRoot, "main.cpp"})); |
| 1841 | SC_TRY(fs.writeString(sourcePath.view(), "#include <stdio.h>\n" |
| 1842 | "\n" |
| 1843 | "int fixture_library_value();\n" |
| 1844 | "\n" |
| 1845 | "int main()\n" |
| 1846 | "{\n" |
| 1847 | " printf(\"%d\\n\", fixture_library_value());\n" |
| 1848 | " return 0;\n" |
| 1849 | "}\n")); |
| 1850 | return Result(true); |
no test coverage detected