I'm targeting multiple platforms. Typically, when I develop an application, I write a firmware for some microcontroller family (AVR, ARM, ...) and a driver library/program (in Visual C++, Qt, C#...) for that piece of hardware. So one application consists of several projects (AVR project with firmware, Qt project with driver, maybe some test projects...).
Currently, I use single Git repository and its structure is following:
Repository
- Library - AVR
- I2C
- Uart
- Spi
- Lcd
- Rtc
- ....
- Cortex M4
- GNU
- Win32
- Qt
- ....
- MyApplication - AnotherApplication - Project
- AVR
- MyApplicationProjectForAvrMcu
- AnotherApplicationProjectForAvrMcu
- VisualC
- Qt
- MyApplicationProjectForQt
- AnotherApplicationProjectForQt
- ...
I can see many difficulties maintaining this big monolithic repository.
I think I need separate repository for each application. Something like this:
MyApplicationRepository
- Library
- AVR
- I2C
- Uart
- Win32
- Uart
- Qt - MyApplication - Project
- AVR
- MyApplicationProjectForAvrMcu
- Qt
- MyApplicationProjectForQt
However new problem arises - for each application I will have most code in Library folder duplicated - platform/compiler specific code (Library/AVR, Library/Win32, Library/Qt, ...) will be duplicated in all repositories.
This is ideal workflow I would like to use: I create an application repository. I pull platform/compiler specific code (shared code) needed by that application from my shared code repository (whole folders or separate files - e.g. Library/AVR/I2C, Library/AVR/Uart, Library/Qt/Something/SomeCode.cpp). I create all application specific code and projects in my application repository. Later I realize that I need to tweak some shared code (e.g. Library/AVR/I2C) so I add some special functionality and test it with my application. Then it would be useful to push that tweak back to the shared repository to be able to pull that tweak from another applications repositories later if needed by that applications.
Can you recommend me some instruments to accomplish this workflow?