RejectedSoftware Forums

Sign up

How to make dub.json with libs and set arch

Hey guys.
I try make simply project and have some questions.

my project have static library "lib/foo.lib", have lib includes "inc/" and i want build my app 64bit (Windows). I know how build my app via cmd line - "dub build --arch=x86_64 --build=release".
Cmd line working fine, but how fill correctly dub.json? How add my static lib "foo.lib"?

Can you make simple example how fill dub.json with "--arch=x86_64" and lib path?

Re: How to make dub.json with libs and set arch

Am 07.10.2016 um 14:55 schrieb Japt:

Hey guys.
I try make simply project and have some questions.

my project have static library "lib/foo.lib", have lib includes "inc/" and i want build my app 64bit (Windows). I know how build my app via cmd line - "dub build --arch=x86_64 --build=release".
Cmd line working fine, but how fill correctly dub.json? How add my static lib "foo.lib"?

Can you make simple example how fill dub.json with "--arch=x86_64" and lib path?

In the simplest case, you'd just add the lib files as source files:

{
   "name": "...",
   "sourceFiles-windows-x86_64": ["lib/foo.lib"],
   "importPaths": ["inc"]
}

I'd recommend putting the libs and includes in a separate dub package
and add that as a dependency to the application package. If the includes
only contain function prototypes, then using import paths is fine.
Otherwise, they also need to be added as "sourcePaths" to avoid linker
errors.