Is it possible to get Microsoft build.exe to include sources from remote directories?

Adding source files to more than one directory (e.g. .. / .. / source.cpp or .. /../../somewhere_else/source.cpp, not just source.cpp or .. / source. Cpp) in SOURCES = a declaration in the WDK / DDK assembly results in the following error:

Ignoring invalid directory prefix in SOURCES= entry 

Can remote source files be included in an assembly?

+4
source share
3 answers

This cannot be done directly. build explicitly designed only for source code in the same or parent directory of the sources file. It cannot use source files from arbitrary places. In particular, its dependency tracking system seems unable to analyze and track deleted files, and therefore it explicitly checks and ensures that all files are local.

There are two general solutions:

  • Create the remote code as a separate lib (either through another subproject / directory in the same build project, or using an independent build step).

  • Put a local stub for each remote source file that #include "../../remote_source.cpp , and add this local stub to the SOURCES= list. This will work, but build / nmake will not track the dependencies in remote_source.cpp . If remote_source.cpp changes, you will either have to touch local proxy source or force rebuild otherwise (delete the local obj proxy, run build with -cZ or otherwise).

+5
source

An alternative way is to use source.inc to include these files.

+1
source

I hate to resurrect a super old theme, but I just ran into this.

An alternative alternative way is to create another source file inside which only the remote source object files are built, so basically a file with the name somewhere else \ sources and assigns it the same intermediate directory.

Then add the file 'dirs' to your source directory and specify this remote folder inside. Then connect directly to the object by adding something like this to the source file:

 $(TARGETLIBS) = $(PROJECT_OBJ_ROOT)\$(O)\source.obj 

This way you don't need to compile as lib, but build treats it as one and links without any dependency checking or location care.

Naturally, you may run into some problems if you give them the same staging directory and the same source name of the source file (source.cpp)

0
source

All Articles