vibe coding an orbital mechanics simulation to try out claude code
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

81 lines
1.9 KiB

# Compiler and flags
CXX = g++
CXXFLAGS = -Wall -Wextra -std=c++14 -I./src -isystem./ext/raylib/src
LDFLAGS = -L./ext/raylib/src -lraylib -lm -lpthread -ldl -lrt -lX11
# Directories
SRC_DIR = src
BUILD_DIR = build
RAYLIB_DIR = ext/raylib/src
TARGET = orbit_sim
TEST_DIR = tests
TEST_TARGET = orbit_test
# Source files
SOURCES = $(SRC_DIR)/main.cpp \
$(SRC_DIR)/physics.cpp \
$(SRC_DIR)/bodies.cpp \
$(SRC_DIR)/config_loader.cpp \
$(SRC_DIR)/renderer.cpp
# Object files
OBJECTS = $(SOURCES:$(SRC_DIR)/%.cpp=$(BUILD_DIR)/%.o)
# Default target
all: raylib $(BUILD_DIR) $(TARGET)
# Build raylib
raylib:
@if [ ! -f $(RAYLIB_DIR)/libraylib.a ]; then \
echo "Building raylib..."; \
cd $(RAYLIB_DIR) && $(MAKE) PLATFORM=PLATFORM_DESKTOP; \
fi
# Create build directory
$(BUILD_DIR):
mkdir -p $(BUILD_DIR)
# Link the executable
$(TARGET): $(OBJECTS) raylib
$(CXX) $(OBJECTS) -o $(TARGET) $(LDFLAGS)
# Compile source files
$(BUILD_DIR)/%.o: $(SRC_DIR)/%.cpp
$(CXX) $(CXXFLAGS) -c $< -o $@
# Clean build files
clean:
rm -rf $(BUILD_DIR) $(TARGET)
# Clean everything including raylib
clean-all: clean
cd $(RAYLIB_DIR) && $(MAKE) clean
# Rebuild
rebuild: clean all
# Run the simulation
run: $(TARGET)
./$(TARGET)
# Run manual integration test with simulation
test-manual: $(TARGET)
./$(TARGET) configs/test_simple.txt --headless --readable --days 365
# Build automated test suite
test-build:
$(CXX) $(CXXFLAGS) -I/usr/include/catch2 \
$(TEST_DIR)/test_main.cpp \
$(TEST_DIR)/test_integration.cpp \
$(TEST_DIR)/test_energy.cpp \
$(TEST_DIR)/test_orbital_period.cpp \
$(SRC_DIR)/test_utilities.cpp \
$(SRC_DIR)/physics.cpp \
$(SRC_DIR)/bodies.cpp \
-o $(TEST_TARGET) -lCatch2Main -lCatch2 -lm
# Run automated test suite
test: test-build
./$(TEST_TARGET)
.PHONY: all clean clean-all rebuild run test test-build test-manual raylib