www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - How to setup dub to use x86 and x64 dll's when appropriate?

reply Michelle Long <HappyDance321 gmail.com> writes:
e.g., using sdl for different versions and have it automatically 
switch.

What would be nice is if one could stick all the files for x86 in 
one dir and x64 in the others and they will be used depending on 
the build(and copied)

Ideally one can do it for debug and release versions too.
Feb 25 2019
next sibling parent reply Michelle Long <HappyDance321 gmail.com> writes:
On Tuesday, 26 February 2019 at 04:17:04 UTC, Michelle Long wrote:
 e.g., using sdl for different versions and have it 
 automatically switch.

 What would be nice is if one could stick all the files for x86 
 in one dir and x64 in the others and they will be used 
 depending on the build(and copied)

 Ideally one can do it for debug and release versions too.
It seems also that dub is shit for swapping between different archs... I added the -m64 flag and then get build errors for lib format errors, compiles fine for x86...
Feb 25 2019
parent JN <666total wp.pl> writes:
On Tuesday, 26 February 2019 at 04:20:27 UTC, Michelle Long wrote:
 On Tuesday, 26 February 2019 at 04:17:04 UTC, Michelle Long 
 wrote:
 e.g., using sdl for different versions and have it 
 automatically switch.

 What would be nice is if one could stick all the files for x86 
 in one dir and x64 in the others and they will be used 
 depending on the build(and copied)

 Ideally one can do it for debug and release versions too.
It seems also that dub is shit for swapping between different archs... I added the -m64 flag and then get build errors for lib format errors, compiles fine for x86...
Why add -m64 rather than --arch=x86_64? Also: https://github.com/dlang/dub/wiki/Cookbook#creating-windows-package-that-has-32-and-64-bit-dlls
Feb 25 2019
prev sibling next sibling parent Jonathan M Davis <newsgroup.d jmdavisprog.com> writes:
On Monday, February 25, 2019 9:17:04 PM MST Michelle Long via Digitalmars-d-
learn wrote:
 e.g., using sdl for different versions and have it automatically
 switch.

 What would be nice is if one could stick all the files for x86 in
 one dir and x64 in the others and they will be used depending on
 the build(and copied)

 Ideally one can do it for debug and release versions too.
You have to set up different build settings for each architecture if you want something like that. The documentation on it isn't great, but I believe that this is the relevant section: https://dub.pm/package-format-json#build-settings You'd probably end up with something like "libs-x86_64" and "libs-x86" with them pointing to the different spots, but I don't know exactly what you'll need. In general, the documentation hints at what's needed in situations like this but doesn't manage to make it clear exactly how to go about it, so whenever I need to do much interesting with dub, I tend to have to muck around with the dub.json file until I manage to hit upon the right combination of settings that do what I need. Usually, it's possible to do what you need to do with dub, but it's a pain to figure it out. You can also ask questions in the dub-specific forum: http://forum.rejectedsoftware.com/groups/rejectedsoftware.dub/ - Jonathan M Davis
Feb 25 2019
prev sibling parent Jacob Carlborg <doob me.com> writes:
On 2019-02-26 05:17, Michelle Long wrote:
 e.g., using sdl for different versions and have it automatically switch.
 
 What would be nice is if one could stick all the files for x86 in one 
 dir and x64 in the others and they will be used depending on the 
 build(and copied)
 
 Ideally one can do it for debug and release versions too.
You can use a combination of "sourcePaths" and "excludedSourceFiles" (see the documentation of Dub for this [1]). You can also have a look at the DWT project as an example [2]. It uses two separate configurations, one for Linux and one for Windows. It's use in the case of DWT because the whole source tree is different. You might not need to do this. [1] https://dub.pm/package-format-json [2] https://github.com/d-widget-toolkit/dwt/blob/master/dub.sdl -- /Jacob Carlborg
Feb 26 2019