Add to dub.sdl of autowrap a post generate command: "postGenerateCommands": ["$DUB postgen.d $ROOT_PACKAGE_DIR"],
Create in autowrap folder a new file postgen.d. Every dub package which has a dependency to autowrap will automatically call the postgen.d application while executing dub build.
The app postgen.d gets the folder path to the dub package, which has a dependency to autowrap, as console argument. In addition it reads the 3 new environment variables DUB_ROOT_PACKAGE_TARGET_TYPE, DUB_ROOT_PACKAGE_TARGET_PATH and DUB_ROOT_PACKAGE_TARGET_NAME. Therefore it knows the shared object file which was built and can call the metadata function. The metadata can now be used to create the `cs´ files.
The benefit is, you do not longer need 2 different configurations (wrap and emit). Just executing dub build will create the SO and also the cs files are automatically created.
The drawback is, you need a very recent dub version (The 3 new environment variable were just added to master).
I might have a solution for the missing
write files on CTFE issue
. Or more precise, with next version of Dub it will be possible.dub.sdl
ofautowrap
a post generate command:"postGenerateCommands": ["$DUB postgen.d $ROOT_PACKAGE_DIR"],
autowrap
folder a new filepostgen.d
. Every dub package which has a dependency toautowrap
will automatically call thepostgen.d
application while executingdub build
.The app postgen.d gets the folder path to the dub package, which has a dependency to autowrap, as console argument. In addition it reads the 3 new environment variables
DUB_ROOT_PACKAGE_TARGET_TYPE
,DUB_ROOT_PACKAGE_TARGET_PATH
andDUB_ROOT_PACKAGE_TARGET_NAME
. Therefore it knows the shared object file which was built and can call the metadata function. The metadata can now be used to create the `cs´ files.The benefit is, you do not longer need 2 different configurations (wrap and emit). Just executing
dub build
will create the SO and also thecs
files are automatically created.The drawback is, you need a very recent dub version (The 3 new environment variable were just added to master).