Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add configuration placeholder %%ldcversion%% #4812

Merged

Conversation

d-musique
Copy link
Contributor

Hi, this introduces a placeholder for ldc2.conf which is set to the version of LDC.

The rationale is: when following the "Cross-compiling with LDC" on a linux system, according to section "Default libraries", it is required to download prebuilt runtimes of the version matching the host compiler.

Since the host compiler is subject to system updates, I might find myself in a situation of version mismatch if I forget to update target libraries.

Favoring versioned directories may work as a preventive measure against such cases.

    lib-dirs = ["/opt/ldc2-%%ldcversion%%-windows-multilib/lib64"];

@JohanEngelen
Copy link
Member

clang does something similar with library folders. Indeed it would help a lot to easily support multiple compiler versions on the same system.

@thewilsonator thewilsonator merged commit f6298a5 into ldc-developers:master Jan 5, 2025
20 checks passed
Copy link
Member

@JohanEngelen JohanEngelen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you please submit a followup PR that fixes my comments? Thanks.

@@ -110,11 +110,18 @@ struct CfgPaths
}
}

extern(C++, "ldc")
{
extern __gshared const(const(char) *) ldc_version;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not needed. Please use global.ldc_version which is already a dstring type (import dmd.globals).

string replacePlaceholders(string str, CfgPaths cfgPaths)
{
const dVersion = ldc_version[0..strlen(ldc_version)];
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As mentioned above, please use dmd.globals.ldc_version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants