Skip to content
Merged
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
81 changes: 81 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
name: ci

on:
pull_request:
branches:
- develop
- main
push:
branches:
- develop
- main

jobs:
foundation-tests:
runs-on: ubuntu-latest

steps:
- name: Check out repository
uses: actions/checkout@v5

- name: Configure headless foundation tests
run: >
cmake -S . -B build
-DECOSIM_BUILD_APP=OFF
-DBUILD_TESTING=ON
-DCMAKE_BUILD_TYPE=Release

- name: Build foundation tests
run: cmake --build build --parallel

- name: Run foundation tests
run: ctest --test-dir build --output-on-failure

linux-app-build:
runs-on: ubuntu-22.04

steps:
- name: Check out repository
uses: actions/checkout@v5

- name: Install SFML Linux build dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
xorg-dev \
libxrandr-dev \
libxcursor-dev \
libxi-dev \
libudev-dev \
libflac-dev \
libvorbis-dev \
libgl1-mesa-dev \
libegl1-mesa-dev \
libdrm-dev \
libgbm-dev

- name: Configure full application
run: >
cmake -S . -B build-app
-DBUILD_TESTING=OFF
-DBUILD_SHARED_LIBS=OFF
-DCMAKE_BUILD_TYPE=Release

- name: Build full application
run: cmake --build build-app --parallel

windows-app-build:
runs-on: windows-latest

steps:
- name: Check out repository
uses: actions/checkout@v5

- name: Configure full application
run: >
cmake -S . -B build-app
-DBUILD_TESTING=OFF
-DBUILD_SHARED_LIBS=OFF

- name: Build full application
run: cmake --build build-app --config Release --parallel
37 changes: 26 additions & 11 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,17 +1,32 @@
# Visual Studio temp & settings
# Visual Studio
.vs/
*.vcxproj.user
*.suo
*.user

# Build outputs
Debug/
Release/
*.exe
*.dll
*.lib
*.obj
*.pdb
# CMake and build outputs
/build/
/out/
/cmake-build-*/
CMakeFiles/
CMakeCache.txt
CMakeScripts/
Testing/
Makefile
cmake_install.cmake
install_manifest.txt
compile_commands.json

# OS stuff
# IDE / editor state
.idea/
.vscode/
*.code-workspace
CMakeUserPresets.json

# Runtime-generated files
imgui.ini
/saves/
*.log

# OS metadata
Thumbs.db
.DS_Store
107 changes: 107 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
cmake_minimum_required(VERSION 3.28)

project(EcoSimEngine VERSION 0.1.0 LANGUAGES CXX)

option(ECOSIM_BUILD_APP "Build the EcoSimEngine desktop application" ON)

function(ecosim_enable_warnings target)
if(MSVC)
target_compile_options(${target} PRIVATE /W4 /permissive-)
else()
target_compile_options(${target} PRIVATE -Wall -Wextra -Wpedantic)
endif()
endfunction()

if(ECOSIM_BUILD_APP)
include(FetchContent)

find_package(SFML 3.1 QUIET COMPONENTS Graphics Window System Audio)
if(NOT SFML_FOUND)
message(STATUS "SFML 3.1 not found locally; fetching SFML 3.1.0")
set(SFML_BUILD_NETWORK OFF CACHE BOOL "Do not build unused SFML Network module" FORCE)
set(SFML_USE_SYSTEM_DEPS OFF CACHE BOOL "Use SFML bundled fallback dependencies" FORCE)
FetchContent_Declare(
SFML
GIT_REPOSITORY https://github.com/SFML/SFML.git
GIT_TAG 3.1.0
GIT_SHALLOW TRUE
)
FetchContent_MakeAvailable(SFML)
endif()

find_package(OpenGL REQUIRED)

set(ECOSIM_SOURCES
src/main.cpp
src/SimulationEngine.cpp
src/gui/GUIManager.cpp
src/ecs/Assets.cpp
src/scene/Scene.cpp
src/scene/Scene_Menu.cpp
src/scene/Scene_Simulation.cpp
)

set(IMGUI_SOURCES
external/imgui/imgui.cpp
external/imgui/imgui_draw.cpp
external/imgui/imgui_tables.cpp
external/imgui/imgui_widgets.cpp
external/imgui-sfml/imgui-SFML.cpp
)

add_executable(EcoSimEngine ${ECOSIM_SOURCES} ${IMGUI_SOURCES})
target_compile_features(EcoSimEngine PRIVATE cxx_std_20)
target_include_directories(
EcoSimEngine
PRIVATE
include
external
external/imgui
external/imgui-sfml
external/nlohmann
)
target_link_libraries(
EcoSimEngine
PRIVATE
SFML::Graphics
SFML::Window
SFML::System
SFML::Audio
OpenGL::GL
)
target_compile_definitions(
EcoSimEngine
PRIVATE
$<$<CONFIG:Debug>:DEBUG_BUILD>
)
ecosim_enable_warnings(EcoSimEngine)

add_custom_command(
TARGET EcoSimEngine
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_SOURCE_DIR}/config"
"$<TARGET_FILE_DIR:EcoSimEngine>/config"
COMMAND ${CMAKE_COMMAND} -E copy_directory
"${CMAKE_SOURCE_DIR}/resources"
"$<TARGET_FILE_DIR:EcoSimEngine>/resources"
COMMENT "Copying runtime configuration and resources"
)
endif()

include(CTest)

if(BUILD_TESTING)
add_executable(
EcoSimEngineFoundationTests
tests/foundation_tests.cpp
)
target_compile_features(EcoSimEngineFoundationTests PRIVATE cxx_std_20)
target_include_directories(EcoSimEngineFoundationTests PRIVATE include)
ecosim_enable_warnings(EcoSimEngineFoundationTests)

add_test(
NAME foundation
COMMAND EcoSimEngineFoundationTests
)
endif()
31 changes: 0 additions & 31 deletions EcoSimEngine.sln

This file was deleted.

Loading