Thread overview |
---|
February 25, 2016 How to better organize dub project to get 3 exe from same codebase? | ||||
---|---|---|---|---|
| ||||
I have got 3 small projects that have shared code base. At compile time they use few same classes. On runtime they use same config file. How to better to organize work with dub? |
February 25, 2016 Re: How to better organize dub project to get 3 exe from same codebase? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suliman | On Thursday, 25 February 2016 at 18:57:08 UTC, Suliman wrote: > I have got 3 small projects that have shared code base. At compile time they use few same classes. On runtime they use same config file. How to better to organize work with dub? Try with subpacjages like I did : name "dedcpu" authors "Luis Panadero Guardeño" targetType "none" license "BSD 3-clause" description "DCPU-16 tools" subPackage { name "lem1802" description "Visual LEM1802 font editor" excludedSourceFiles "src/bconv.d" excludedSourceFiles "src/ddis.d" targetType "executable" targetName "lem1802" libs "gtkd" platform="windows" configuration "nogtk" { platforms "windows" } configuration "gtk" { platforms "posix" dependency "gtk-d:gtkd" version="~>3.2.0" } } subPackage { name "bconv" description "Binary file conversor. Converts between different data files for DCPU-16 emulators" targetType "executable" targetName "bconv" excludedSourceFiles "src/lem1802_fontview.d" excludedSourceFiles "src/ddis.d" excludedSourceFiles "src/ui/*" } subPackage { name "ddis" description "Dis-assembler for DCPU-16. Generates a DCPU-16 assembly dump from a binary file." targetType "executable" targetName "ddis" excludedSourceFiles "src/lem1802_fontview.d" excludedSourceFiles "src/bconv.d" excludedSourceFiles "src/ui/*" } https://github.com/Zardoz89/DEDCPU-16/blob/master/dub.sdl |
February 25, 2016 Re: How to better organize dub project to get 3 exe from same codebase? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Zardoz | Where to store shared classes? |
February 25, 2016 Re: How to better organize dub project to get 3 exe from same codebase? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suliman | On Thursday, 25 February 2016 at 19:09:59 UTC, Suliman wrote:
> Where to store shared classes?
{
"name": "123",
"authors": [
"Suliman"
],
"description": "A minimal D application.",
"copyright": "Copyright © 2016, Suliman",
"license": "proprietary",
"subPackages": [
{
"name": "App1",
"description": "App1",
"targetType": "executable",
"sourcePaths": ["source/App1"]
},
{
"name": "App2",
"description": "App2",
"targetType": "executable",
"sourcePaths": ["source/App2"]
},
{
"name": "App3",
"description": "App3",
"targetType": "executable",
"sourcePaths": ["source/App3"]
}
}
Should I link from subPackages to general source/ folder ?
|
February 25, 2016 Re: How to better organize dub project to get 3 exe from same codebase? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suliman | On Thursday, 25 February 2016 at 20:55:33 UTC, Suliman wrote: > On Thursday, 25 February 2016 at 19:09:59 UTC, Suliman wrote: >> Where to store shared classes? > > { > "name": "123", > "authors": [ > "Suliman" > ], > "description": "A minimal D application.", > "copyright": "Copyright © 2016, Suliman", > "license": "proprietary", > "subPackages": [ > { > "name": "App1", > "description": "App1", > "targetType": "executable", > "sourcePaths": ["source/App1"] > }, > > { > "name": "App2", > "description": "App2", > "targetType": "executable", > "sourcePaths": ["source/App2"] > }, > { > "name": "App3", > "description": "App3", > "targetType": "executable", > "sourcePaths": ["source/App3"] > } > > > } > > Should I link from subPackages to general source/ folder ? I don't link nothing. I have some shared D source code files between the 3 files (on src/dcpu). So each subpackage generates a executable file, excluding the not common files of the other subpackages. It isn't the best way of doing this, but just works for my case. Eventually i would change this. I think that alphaPhobos does what you are asking : https://github.com/rikkimax/alphaPhobos/blob/master/dub.sdl |
February 27, 2016 Re: How to better organize dub project to get 3 exe from same codebase? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Luis | What I am doing wrong? http://img.ctrlv.in/img/16/02/27/56d1aae37b77a.png |
February 27, 2016 Re: How to better organize dub project to get 3 exe from same codebase? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Suliman | On Saturday, 27 February 2016 at 13:56:21 UTC, Suliman wrote:
> What I am doing wrong? http://img.ctrlv.in/img/16/02/27/56d1aae37b77a.png
Try :
dub build code1:App1
dub build code1:App2
|
Copyright © 1999-2021 by the D Language Foundation