Skip to content

Setting up multiple subpackages #3003

@alanondra

Description

@alanondra

I'm aiming to create a project with multiple sub-packages using Dub. This seems to work for the most part, except in the case of Linux, I need to manually set LD_LIBRARY_PATH in the command line since the compiled executables don't look in the current directory:

D_LIBRARY_PATH="$LD_LIBRARY_PATH:$(pwd)/build" ./build/app

Is there anything I need to change for that to work? Are there any best practices I need to more closely follow? I've pieced this together looking at some other issues here.


dub.json

{
	"name": "example",
	"targetType": "none",
	"dependencies": {
		"example:app": "*"
	},
	"subPackages": [
		"packages/common",
		"packages/app"
	]
}

packages/common/dub.json

{
	"name": "common",
	"targetType": "dynamicLibrary",
	"targetPath": "../../build"
}

packages/app/dub.json

{
	"name": "app",
	"targetType": "executable",
	"targetName": "app",
	"targetPath": "../../build",
	"dependencies": {
		"example:common": "*"
	}
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions