Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,11 @@
[submodule "external/glm"]
path = external/glm
url = https://github.com/g-truc/glm.git
[submodule "external/stb"]
path = external/stb
url = https://github.com/nothings/stb.git
branch = master
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i dont think the branch is necessary
but it can stay ig

[submodule "external/filewatch"]
path = external/filewatch
url = https://github.com/ThomasMonkman/filewatch.git
branch = master
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,8 @@ target_include_directories(glint PRIVATE
${CMAKE_SOURCE_DIR}/external/glad/include
${CMAKE_SOURCE_DIR}/external/glfw/include
${CMAKE_SOURCE_DIR}/external/glm
${CMAKE_SOURCE_DIR}/external/stb
${CMAKE_SOURCE_DIR}/external/filewatch
${CMAKE_SOURCE_DIR}/external/
)

Expand Down
67 changes: 67 additions & 0 deletions SUBMODULE_MIGRATION.md
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea you don't have to do this, just delete the files and let that be in the PR.
Before commiting that, check if it works (you have to also change each file for the imports/includes)

Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
# Submodule Migration Guide

## Overview
This PR migrates STB and FileWatcher from direct file inclusion to Git submodules for better dependency management and version control.

## Changes Made

### 1. Added Git Submodules
- **STB**: Added as submodule from `https://github.com/nothings/stb.git`
- **FileWatcher**: Added as submodule from `https://github.com/ThomasMonkman/filewatch.git`

### 2. Updated Build Configuration
- Modified `CMakeLists.txt` to include submodule paths
- Updated include directories to reference submodule locations

## Migration Steps for Existing Users

If you have an existing clone of this repository, follow these steps:

### 1. Remove Old Files
```bash
# Remove the old standalone files
rm external/FileWatch.hpp
rm src/stb_image.h
```

### 2. Initialize Submodules
```bash
# Update .gitmodules
git pull origin main

# Initialize and update all submodules
git submodule update --init --recursive
```

### 3. Verify Installation
After initialization, you should have:
- `external/stb/` directory with STB headers
- `external/filewatch/` directory with FileWatch headers

### 4. Update Include Paths (if needed)
The CMakeLists.txt has been updated to include the new paths. If you have custom build scripts, update them to reference:
- `external/stb/` for STB headers
- `external/filewatch/` for FileWatch headers

## For New Users

Simply clone with submodules:
```bash
git clone --recursive https://github.com/CGS-IITKGP/OpenGL-template.git
```

Or if already cloned:
```bash
git submodule update --init --recursive
```

## Benefits

1. **Version Control**: Track specific versions of dependencies
2. **Consistency**: All external dependencies managed uniformly
3. **Updates**: Easy to update to newer versions
4. **Size**: Reduces repository size by not duplicating large header files

## Fixes

Closes #17