Re: How can I restrict a library to be only included under a certain OS?

2023-03-28 Thread ryuukk_ via Digitalmars-d-learn

On Tuesday, 28 March 2023 at 21:10:08 UTC, solidstate1991 wrote:

I added this line to my SDLang formatted dub build file:

```
dependency "libx11" version="0.0.1" platform="posix"
```

Yet it's included even on Windows, even if I change it to 
"linux".


Since there's a fatal bug in the library that disallows it to 
be built, I'll be leaving it out for now, and instead move onto 
something else, or try to issue a correction.


I think the way to go is with configuration

``dub build`` // will default to config "posix" since it's the 
1st one
``dub build -c windows`` // will use "windows" config, without 
the dependency


https://dub.pm/package-format-sdl.html#configurations

```
configuration "posix" {
dependency "libx11" version="0.0.1"
}
configuration "windows" {
platforms "windows"
}
```

My dub knowledge is pretty limited, maybe there is a better way?


How can I restrict a library to be only included under a certain OS?

2023-03-28 Thread solidstate1991 via Digitalmars-d-learn

I added this line to my SDLang formatted dub build file:

```
dependency "libx11" version="0.0.1" platform="posix"
```

Yet it's included even on Windows, even if I change it to "linux".

Since there's a fatal bug in the library that disallows it to be 
built, I'll be leaving it out for now, and instead move onto 
something else, or try to issue a correction.