mirror of
https://github.com/compiler-explorer/compiler-explorer.git
synced 2025-12-27 10:33:59 -05:00
Headers via conan (#5179)
This commit is contained in:
@@ -2499,7 +2499,7 @@ compiler.nvcxx_arm_cxx23_5.semver=23.5
|
||||
#################################
|
||||
#################################
|
||||
# Installed libs
|
||||
libs=abseil:belleviews:benchmark:benri:blaze:boost:bmulti:brigand:catch2:cctz:cereal:cmcstl2:cnl:cppcoro:cppitertools:crosscables:ctbignum:cthash:ctre:date:dataframe:dawjson:dlib:doctest:eastl:eigen:enoki:entt:etl:eve:expected_lite:fastor:fmt:gemmlowp:glm:gnufs:gnulibbacktrace:googletest:gsl:hdf5:hedley:hfsm:highfive:highway:hotels-template-library:immer:jsoncons:jsoncpp:kiwaku:kokkos:kumi:kvasir:lager:lagom:lexy:libassert:libguarded:libsimdpp:libuv:llvm:llvmfs:lua:magic_enum:mfem:mlir:mp-coro:mp-units:namedtype:nanorange:nlohmann_json:nsimd:ofw:openssl:outcome:pegtl:pipes:pugixml:python:rangesv3:raberu:scnlib:seastar:seqan3:simde:simdjson:sol2:spdlog:spy:stdexec:strong_type:taojson:tbb:thinkcell:tlexpected:toml11:tomlplusplus:trompeloeil:tts:type_safe:unifex:vcl:xercesc:xsimd:xtensor:xtl:zug:cli11:avr-libstdcpp:curl:copperspice:sqlite:ztdcuneicode:ztdencodingtables:ztdidk:ztdstaticcontainers:ztdtext:ztdplatform
|
||||
libs=abseil:belleviews:benchmark:benri:blaze:boost:bmulti:brigand:catch2:cctz:cereal:cmcstl2:cnl:cppcoro:cppitertools:crosscables:ctbignum:cthash:ctre:date:dataframe:dawjson:dlib:doctest:eastl:eigen:enoki:entt:etl:eve:expected_lite:fastor:fmt:gemmlowp:glm:gnufs:gnulibbacktrace:googletest:gsl:hdf5:hedley:hfsm:highfive:highway:hotels-template-library:immer:jsoncons:jsoncpp:kiwaku:kokkos:kumi:kvasir:lager:lagom:lexy:libassert:libguarded:libsimdpp:libuv:llvm:llvmfs:lua:magic_enum:mfem:mlir:mp-coro:mp-units:namedtype:nanorange:nlohmann_json:nsimd:ofw:openssl:outcome:pegtl:pipes:pugixml:python:rangesv3:raberu:scnlib:seastar:seqan3:simde:simdjson:sol2:spdlog:spy:stdexec:strong_type:taojson:tbb:thinkcell:tlexpected:toml11:tomlplusplus:trompeloeil:tts:type_safe:unifex:vcl:xercesc:xsimd:xtensor:xtl:zug:cli11:avr-libstdcpp:curl:copperspice:sqlite:ztdcuneicode:ztdencodingtables:ztdidk:ztdstaticcontainers:ztdtext:ztdplatform:qt
|
||||
|
||||
libs.abseil.name=Abseil
|
||||
libs.abseil.versions=trunk
|
||||
@@ -3532,6 +3532,14 @@ libs.python.versions.376.path=/opt/compiler-explorer/python-3.7.6/include/python
|
||||
libs.python.versions.381.version=3.8.1
|
||||
libs.python.versions.381.path=/opt/compiler-explorer/python-3.8.1/include/python3.8
|
||||
|
||||
libs.qt.name=Qt
|
||||
libs.qt.url=https://www.qt.io
|
||||
libs.qt.packagedheaders=true
|
||||
libs.qt.liblink=Qt6Core
|
||||
libs.qt.options=-DQT_NO_VERSION_TAGGING
|
||||
libs.qt.versions=642
|
||||
libs.qt.versions.642.version=6.4.2
|
||||
|
||||
libs.rangesv3.name=range-v3
|
||||
libs.rangesv3.versions=trunk:030:035:036:091:0100:0110:0120
|
||||
libs.rangesv3.url=https://github.com/ericniebler/range-v3
|
||||
|
||||
@@ -867,7 +867,11 @@ export class BaseCompiler implements ICompiler {
|
||||
const foundVersion = this.findLibVersion(selectedLib);
|
||||
if (!foundVersion) return false;
|
||||
|
||||
return foundVersion.libpath;
|
||||
const paths = [...foundVersion.libpath];
|
||||
if (!this.buildenvsetup.extractAllToRoot) {
|
||||
paths.push(`./${selectedLib.id}/lib`);
|
||||
}
|
||||
return paths;
|
||||
}),
|
||||
) as string[];
|
||||
}
|
||||
@@ -882,7 +886,7 @@ export class BaseCompiler implements ICompiler {
|
||||
}
|
||||
|
||||
if (!libDownloadPath) {
|
||||
libDownloadPath = '.';
|
||||
libDownloadPath = './lib';
|
||||
}
|
||||
|
||||
return _.union(
|
||||
@@ -926,7 +930,11 @@ export class BaseCompiler implements ICompiler {
|
||||
const foundVersion = this.findLibVersion(selectedLib);
|
||||
if (!foundVersion) return [];
|
||||
|
||||
return foundVersion.path.map(path => includeFlag + path);
|
||||
const paths = foundVersion.path.map(path => includeFlag + path);
|
||||
if (foundVersion.packagedheaders) {
|
||||
paths.push(includeFlag + `./${selectedLib.id}/include`);
|
||||
}
|
||||
return paths;
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1621,7 +1629,7 @@ export class BaseCompiler implements ICompiler {
|
||||
return this.runCompiler(compiler, options, inputFilename, execOptions);
|
||||
}
|
||||
|
||||
async getRequiredLibraryVersions(libraries) {
|
||||
async getRequiredLibraryVersions(libraries): Promise<Record<string, LibraryVersion>> {
|
||||
const libraryDetails = {};
|
||||
_.each(libraries, selectedLib => {
|
||||
const foundVersion = this.findLibVersion(selectedLib);
|
||||
@@ -1631,9 +1639,9 @@ export class BaseCompiler implements ICompiler {
|
||||
}
|
||||
|
||||
async setupBuildEnvironment(key: any, dirPath: string, binary: boolean): Promise<BuildEnvDownloadInfo[]> {
|
||||
if (this.buildenvsetup && binary) {
|
||||
if (this.buildenvsetup) {
|
||||
const libraryDetails = await this.getRequiredLibraryVersions(key.libraries);
|
||||
return this.buildenvsetup.setup(key, dirPath, libraryDetails);
|
||||
return this.buildenvsetup.setup(key, dirPath, libraryDetails, binary);
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
|
||||
@@ -30,12 +30,13 @@ import {logger} from '../logger.js';
|
||||
import * as utils from '../utils.js';
|
||||
|
||||
import type {BuildEnvDownloadInfo} from './buildenv.interfaces.js';
|
||||
import {LibraryVersion} from '../../types/libraries/libraries.interfaces.js';
|
||||
|
||||
export class BuildEnvSetupBase {
|
||||
protected compiler: any;
|
||||
protected env: any;
|
||||
protected compilerOptionsArr: string[];
|
||||
public compilerArch: string | boolean;
|
||||
public compilerArch: string | false;
|
||||
protected compilerTypeOrGCC: any;
|
||||
public compilerSupportsX86: boolean;
|
||||
|
||||
@@ -95,11 +96,16 @@ export class BuildEnvSetupBase {
|
||||
return false;
|
||||
}
|
||||
|
||||
async setup(key, dirPath, selectedLibraries): Promise<BuildEnvDownloadInfo[]> {
|
||||
async setup(
|
||||
key,
|
||||
dirPath: string,
|
||||
selectedLibraries: Record<string, LibraryVersion>,
|
||||
binary: boolean,
|
||||
): Promise<BuildEnvDownloadInfo[]> {
|
||||
return [];
|
||||
}
|
||||
|
||||
getCompilerArch() {
|
||||
getCompilerArch(): string | false {
|
||||
let arch = _.find(this.compilerOptionsArr, option => {
|
||||
return option.startsWith('-march=');
|
||||
});
|
||||
@@ -109,7 +115,7 @@ export class BuildEnvSetupBase {
|
||||
});
|
||||
|
||||
if (target) {
|
||||
target = target.substr(target.indexOf('=') + 1);
|
||||
target = target.substring(target.indexOf('=') + 1);
|
||||
} else {
|
||||
const targetIdx = this.compilerOptionsArr.indexOf('-target');
|
||||
if (targetIdx !== -1) {
|
||||
@@ -118,7 +124,7 @@ export class BuildEnvSetupBase {
|
||||
}
|
||||
|
||||
if (arch) {
|
||||
arch = arch.substr(7);
|
||||
arch = arch.substring(7);
|
||||
}
|
||||
|
||||
if (target && arch) {
|
||||
@@ -140,34 +146,50 @@ export class BuildEnvSetupBase {
|
||||
if (match) {
|
||||
return match[1];
|
||||
} else {
|
||||
const stdlibOption = _.find(key.options, option => {
|
||||
const stdlibOption: string | undefined = _.find(key.options, option => {
|
||||
return option.startsWith('-stdlib=');
|
||||
});
|
||||
|
||||
if (stdlibOption) {
|
||||
return stdlibOption.substr(8);
|
||||
return stdlibOption.substring(8);
|
||||
}
|
||||
|
||||
return 'libstdc++';
|
||||
}
|
||||
}
|
||||
|
||||
getTarget(key) {
|
||||
getTarget(key): string {
|
||||
if (!this.compilerSupportsX86) return '';
|
||||
if (this.compilerArch) return this.compilerArch;
|
||||
|
||||
if (key.options.includes('-m32')) {
|
||||
return 'x86';
|
||||
} else {
|
||||
const target = _.find(key.options, option => {
|
||||
const target: string | undefined = _.find(key.options, option => {
|
||||
return option.startsWith('-target=') || option.startsWith('--target=');
|
||||
});
|
||||
|
||||
if (target) {
|
||||
return target.substr(target.indexOf('=') + 1);
|
||||
return target.substring(target.indexOf('=') + 1);
|
||||
}
|
||||
}
|
||||
|
||||
return 'x86_64';
|
||||
}
|
||||
|
||||
hasBinariesToLink(details: LibraryVersion) {
|
||||
return (
|
||||
details.libpath.length === 0 &&
|
||||
(details.staticliblink.length > 0 || details.liblink.length > 0) &&
|
||||
details.version !== 'autodetect'
|
||||
);
|
||||
}
|
||||
|
||||
hasPackagedHeaders(details: LibraryVersion) {
|
||||
return !!details.packagedheaders;
|
||||
}
|
||||
|
||||
shouldDownloadPackage(details: LibraryVersion) {
|
||||
return this.hasPackagedHeaders(details) || this.hasBinariesToLink(details);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -86,7 +86,7 @@ export class BuildEnvSetupCeConanRustDirect extends BuildEnvSetupCeConanDirect {
|
||||
return true;
|
||||
}
|
||||
|
||||
override hasAtLeastOneBinaryToLink(libraryDetails) {
|
||||
override shouldDownloadPackage(details) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import {logger} from '../logger.js';
|
||||
|
||||
import {BuildEnvSetupBase} from './base.js';
|
||||
import type {BuildEnvDownloadInfo} from './buildenv.interfaces.js';
|
||||
import {LibraryVersion} from '../../types/libraries/libraries.interfaces.js';
|
||||
|
||||
export type ConanBuildProperties = {
|
||||
os: string;
|
||||
@@ -60,7 +61,7 @@ export class BuildEnvSetupCeConanDirect extends BuildEnvSetupBase {
|
||||
|
||||
this.host = compilerInfo.buildenvsetup.props('host', false);
|
||||
this.onlyonstaticliblink = compilerInfo.buildenvsetup.props('onlyonstaticliblink', false);
|
||||
this.extractAllToRoot = true;
|
||||
this.extractAllToRoot = false;
|
||||
|
||||
if (env.debug) request.debug = true;
|
||||
}
|
||||
@@ -125,7 +126,7 @@ export class BuildEnvSetupCeConanDirect extends BuildEnvSetupBase {
|
||||
filepath = path.join(downloadPath, filename);
|
||||
} else {
|
||||
const filename = header.name;
|
||||
filepath = path.join(downloadPath, filename);
|
||||
filepath = path.join(downloadPath, libId, filename);
|
||||
const resolved = path.resolve(path.dirname(filepath));
|
||||
if (!resolved.startsWith(downloadPath)) {
|
||||
logger.error(`Library ${libId}/${version} is using a zip-slip, skipping file`);
|
||||
@@ -236,7 +237,7 @@ export class BuildEnvSetupCeConanDirect extends BuildEnvSetupBase {
|
||||
const allLibraryBuilds: any = [];
|
||||
|
||||
_.each(libraryDetails, (details, libId) => {
|
||||
if (this.hasBinariesToLink(details)) {
|
||||
if (details.packagedheaders || this.hasBinariesToLink(details)) {
|
||||
const lookupversion = details.lookupversion || details.version;
|
||||
allLibraryBuilds.push({
|
||||
id: libId,
|
||||
@@ -273,23 +274,20 @@ export class BuildEnvSetupCeConanDirect extends BuildEnvSetupBase {
|
||||
return Promise.all(allDownloads);
|
||||
}
|
||||
|
||||
override async setup(key, dirPath, libraryDetails): Promise<BuildEnvDownloadInfo[]> {
|
||||
if (this.host && (!this.onlyonstaticliblink || this.hasAtLeastOneBinaryToLink(libraryDetails))) {
|
||||
return this.download(key, dirPath, libraryDetails);
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
override async setup(
|
||||
key,
|
||||
dirPath,
|
||||
libraryDetails: Record<string, LibraryVersion>,
|
||||
binary,
|
||||
): Promise<BuildEnvDownloadInfo[]> {
|
||||
if (!this.host) return [];
|
||||
|
||||
hasBinariesToLink(details) {
|
||||
return (
|
||||
details.libpath.length === 0 &&
|
||||
(details.staticliblink.length > 0 || details.liblink.length > 0) &&
|
||||
details.version !== 'autodetect'
|
||||
);
|
||||
}
|
||||
if (this.onlyonstaticliblink && !binary) return [];
|
||||
|
||||
hasAtLeastOneBinaryToLink(libraryDetails) {
|
||||
return _.some(libraryDetails, details => this.hasBinariesToLink(details));
|
||||
const librariesToDownload = _.pick(libraryDetails, details => {
|
||||
return this.shouldDownloadPackage(details);
|
||||
}) as Record<string, LibraryVersion>;
|
||||
|
||||
return this.download(key, dirPath, librariesToDownload);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,21 +50,13 @@ export class BuildEnvSetupCliConan extends BuildEnvSetupBase {
|
||||
this.onlyonstaticliblink = compilerInfo.buildenvsetup.props('onlyonstaticliblink', true);
|
||||
}
|
||||
|
||||
override async setup(key, dirPath, libraryDetails): Promise<BuildEnvDownloadInfo[]> {
|
||||
if (!this.onlyonstaticliblink || this.hasAtLeastOneBinaryToLink(libraryDetails)) {
|
||||
await this.prepareConanRequest(libraryDetails, dirPath);
|
||||
return this.installLibrariesViaConan(key, dirPath);
|
||||
} else {
|
||||
return [];
|
||||
}
|
||||
}
|
||||
override async setup(key, dirPath, libraryDetails, binary): Promise<BuildEnvDownloadInfo[]> {
|
||||
if (this.onlyonstaticliblink && !binary) return [];
|
||||
|
||||
hasBinariesToLink(details) {
|
||||
return details.libpath.length === 0 && details.staticliblink.length > 0;
|
||||
}
|
||||
const librariesToDownload = _.filter(libraryDetails, details => this.shouldDownloadPackage(details));
|
||||
|
||||
hasAtLeastOneBinaryToLink(libraryDetails) {
|
||||
return _.some(libraryDetails, details => this.hasBinariesToLink(details));
|
||||
await this.prepareConanRequest(librariesToDownload, dirPath);
|
||||
return this.installLibrariesViaConan(key, dirPath);
|
||||
}
|
||||
|
||||
async prepareConanRequest(libraryDetails, dirPath) {
|
||||
|
||||
@@ -273,6 +273,7 @@ export class ClientOptionsHandler {
|
||||
lookupversion?: PropertyValue;
|
||||
options: string[];
|
||||
hidden: boolean;
|
||||
packagedheaders?: boolean;
|
||||
};
|
||||
type Library = {
|
||||
name: string;
|
||||
@@ -284,6 +285,7 @@ export class ClientOptionsHandler {
|
||||
versions: Record<string, VersionInfo>;
|
||||
examples: string[];
|
||||
options: string[];
|
||||
packagedheaders?: boolean;
|
||||
};
|
||||
// Record language -> {Record lib name -> lib}
|
||||
const libraries: Record<string, Record<string, Library>> = {};
|
||||
@@ -302,6 +304,7 @@ export class ClientOptionsHandler {
|
||||
versions: {},
|
||||
examples: splitIntoArray(this.compilerProps<string>(lang, libBaseName + '.examples')),
|
||||
options: splitArguments(this.compilerProps(lang, libBaseName + '.options', '')),
|
||||
packagedheaders: this.compilerProps<boolean>(lang, libBaseName + '.packagedheaders', false),
|
||||
};
|
||||
const listedVersions = `${this.compilerProps(lang, libBaseName + '.versions')}`;
|
||||
if (listedVersions) {
|
||||
@@ -327,6 +330,7 @@ export class ClientOptionsHandler {
|
||||
// Library options might get overridden later
|
||||
options: libraries[lang][lib].options,
|
||||
hidden: this.compilerProps(lang, libVersionName + '.hidden', false),
|
||||
packagedheaders: libraries[lang][lib].packagedheaders,
|
||||
};
|
||||
|
||||
const lookupversion = this.compilerProps(lang, libVersionName + '.lookupversion');
|
||||
@@ -351,6 +355,12 @@ export class ClientOptionsHandler {
|
||||
versionObject.options = splitArguments(options);
|
||||
}
|
||||
|
||||
versionObject.packagedheaders = this.compilerProps<boolean>(
|
||||
lang,
|
||||
libVersionName + '.packagedheaders',
|
||||
libraries[lang][lib].packagedheaders,
|
||||
);
|
||||
|
||||
libraries[lang][lib].versions[version] = versionObject;
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -169,6 +169,7 @@ describe('Options handler', () => {
|
||||
staticliblink: [],
|
||||
examples: ['abc', 'def'],
|
||||
options: [],
|
||||
packagedheaders: false,
|
||||
versions: {
|
||||
noPaths: {
|
||||
$order: 2,
|
||||
@@ -182,6 +183,7 @@ describe('Options handler', () => {
|
||||
lookupversion: 'no-paths123',
|
||||
options: ['-DHELLO123', '-DETC', '--some thing with spaces'],
|
||||
hidden: false,
|
||||
packagedheaders: false,
|
||||
},
|
||||
onePath: {
|
||||
$order: 0,
|
||||
@@ -194,6 +196,7 @@ describe('Options handler', () => {
|
||||
alias: [],
|
||||
options: [],
|
||||
hidden: false,
|
||||
packagedheaders: false,
|
||||
},
|
||||
twoPaths: {
|
||||
$order: 1,
|
||||
@@ -206,6 +209,7 @@ describe('Options handler', () => {
|
||||
alias: [],
|
||||
options: [],
|
||||
hidden: false,
|
||||
packagedheaders: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -218,6 +222,7 @@ describe('Options handler', () => {
|
||||
staticliblink: [],
|
||||
examples: [],
|
||||
options: [],
|
||||
packagedheaders: false,
|
||||
versions: {
|
||||
std: {
|
||||
$order: 0,
|
||||
@@ -230,6 +235,7 @@ describe('Options handler', () => {
|
||||
dependencies: ['pthread'],
|
||||
options: [],
|
||||
hidden: false,
|
||||
packagedheaders: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
@@ -242,6 +248,7 @@ describe('Options handler', () => {
|
||||
staticliblink: [],
|
||||
examples: [],
|
||||
options: [],
|
||||
packagedheaders: false,
|
||||
versions: {
|
||||
trunk: {
|
||||
$order: 0,
|
||||
@@ -254,6 +261,7 @@ describe('Options handler', () => {
|
||||
dependencies: ['c++fs'],
|
||||
options: [],
|
||||
hidden: true,
|
||||
packagedheaders: false,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@@ -8,6 +8,7 @@ export type LibraryVersion = {
|
||||
libpath: string[];
|
||||
path: string[];
|
||||
options: string[];
|
||||
packagedheaders?: boolean;
|
||||
};
|
||||
|
||||
export type Library = {
|
||||
|
||||
Reference in New Issue
Block a user