GitHub Repo File Structure

I am fairly new to GitHub and completely new to using it in conjunction with JUCE projects. I am currently trying to set up a GitHub repo for my JUCE project and it has highlighted some aspects of the JUCE project folder structure that I am not clear on. I have read “Tutorial: Projucer Part 2: Manage your Projucer projects” but am still shaky on some aspects. I’m probably overcomplicating things, but any help clearing these up is much appreciated.

First, under the Source Control Navigator in Xcode for my application, the highest level folder is currently “MacOSX”, and I can’t seem to find any way to change this. With other Xcode projects, the highest level has always shared its name with the project itself. Since “MacOSX” is located under the “builds” folder of my JUCE project, if I create a remote via Xcode, I will be missing the Source folder, JuceLibraryCode folder, and .jucer file when I create my repo. When I look at other JUCE projects uploaded to GitHub, the builds folder typically isn’t even included. Should I be setting up the GitHub repo outside of Xcode for the entire project and only using Xcode for source control of the MaxOSX build specifically? Should the /Builds folder be included in the repo?

Sorry if these are beginner questions with obvious answers. My experience with JUCE has always been for applications and research code just located on my machine, so this part is new to me.

Edit: removed the second part of this question because I figured it out

When you create your repo, you only need to add the source files and the jucer file.

So, write a .gitignore file in the same folder as your jucer file and add the following to it

**/Builds
**/JuceLibraryCode

Then create your git repo in the folder
If you use Terminal, you can type git status to see which files are unstaged.
If the gitignore file is correctly written, you will only see your source files and jucer file listed as ‘currently unstaged’.

From that point, xcode or whichever tool you use for source control will only record changes to the source code and jucer file. All of those intermediate build files automatically generated whenever you save the jucer file or build the project will NOT be included in the repository, which is what you want. You want a clean repo with only source files and jucer file.

3 Likes

Hmm… did you run git init in the Builds/MacOSX folder instead of the project root directory? AFAIK Projucer doesn’t initialize a git repo for the project automatically.

IMO project structure got a lot cleaner with the introduction of CMake support in JUCE 6.

Here’s an example of a GitHub repository for a JUCE plugin project that uses CMake as the build tool instead of Projucer (and also automatically builds binaries for Win/Mac/Linux on each push with GitHub Actions):

Examples of other project types (GUI, console apps) can be found in the JUCE/examples/CMake directory.

Of course if you prefer to work in Xcode, you can always generate a .xcodeproj from a CMake project by running cmake -G Xcode . in the root directory. But I’ve found the development experience to be quite nice in VS Code with the CMake Tools extension.

1 Like

Thank you! This helps a ton. I’ve almost got the .gitignore working as you’ve described, the only difference is that I can’t seem to properly ignore the .DS_store files. When I ignore Source/.DS_Store/, it properly ignores it, but shows .DS_Store as being modified. When I ignore both Source/.DS_Store/ and .DS_Store, it shows Source/.DS_Store/ being modified… Any idea what’s going on here?

I haven’t messed around with CMake in JUCE 6 just yet. I’ve almost got this working based on @matkatmusic’s post, but in the future, I will definitely look into this method! Thanks!

**/.DS_Store will ignore every DS_Store file in your repo.

You already added it to the repository and you have to remove it from the repo if you want git to stop showing changes to it

1 Like

Got everything working now and linked with my GitHub thanks to you. I seriously appreciate it. This forum is fantastic.