cancel
Showing results for 
Search instead for 
Did you mean: 

Share source files between multiple projects

ErX
Associate II

Hi,

at this moment I have two projects (BootLoader and Application), but I have some shared files.

What is the best solution to share those files? Is it possible to create an 'empty' project, with only those shared files, and make the two projects depending on it?

Or is it possible to add a directory, which can be handled by both projects?

Thanks in advance.

Greetings,

ErX

1 ACCEPTED SOLUTION

Accepted Solutions
Andrew Neil
Super User

@ErX wrote:

is it possible to add a directory, which can be handled by both projects?


Yes!

Here's how I do it:

https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/same-touchgfx-project-for-multiple-cubemx-files-in-the-same/m-p/672534/highlight/true#M37503

Also:

https://community.st.com/t5/stm32cubeide-mcus/how-to-use-common-sources-in-multiple-stm32cube-ide-projects/m-p/103512/highlight/true#M3137

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.

View solution in original post

3 REPLIES 3
mfgkw
Senior II

Hi,

if you use Windows you can stop reading here.

 

If you have a more capable OS you can use links to duplicate files.

- Either hard links: create one set of the files, and copy this to the other project with cp -l ...
This makes two views to the the same files. Changing a file on one side changes the other one as well.

- Or symbolic links: create one set as usual, and make the second view as soft links with ln -s ...

I would prefer hard links.

 

If you keep your files in a version control system (even on Windows) there is one more option: check them out in two places in parallel.

padawan
Senior II

Hi mfgkw

Windows has this as "mlink"

hth

padawan

Andrew Neil
Super User

@ErX wrote:

is it possible to add a directory, which can be handled by both projects?


Yes!

Here's how I do it:

https://community.st.com/t5/stm32-mcus-touchgfx-and-gui/same-touchgfx-project-for-multiple-cubemx-files-in-the-same/m-p/672534/highlight/true#M37503

Also:

https://community.st.com/t5/stm32cubeide-mcus/how-to-use-common-sources-in-multiple-stm32cube-ide-projects/m-p/103512/highlight/true#M3137

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.