Skip to content
This repository has been archived by the owner on Dec 2, 2024. It is now read-only.

Commit

Permalink
Fix glew link problem, prep CI stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
LunarWatcher committed Oct 14, 2023
1 parent 2cf4791 commit 944c7a0
Show file tree
Hide file tree
Showing 8 changed files with 97 additions and 34 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Test workflow
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
tests:
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest, ubuntu-latest]
runs-on: ${{matrix.os}}
steps:
- uses: actions/checkout@main
- uses: Run build
run: |
mkdir build && cd build
cmake ..
cmake --build .
- uses: Run test
run: |
cd build
cmake --build . --target test
17 changes: 7 additions & 10 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,6 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)

find_package(Git)
if (EXISTS ${GIT_EXECUTABLE})
message(STATUS "Checking if Git submodules are initialised...")
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update --init --recursive)
execute_process(COMMAND ${GIT_EXECUTABLE} submodule update)
else()
message(WARNING "GIT_EXECUTABLE isn't saved. Make sure you have Git on your path")
endif()


set (CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -DAPI_DEBUG")

if (NOT WIN32)
Expand Down Expand Up @@ -64,6 +54,8 @@ set(ALSOFT_UTILS OFF CACHE STRING "" FORCE)
set(GLFW_BUILD_DOCS OFF CACHE STRING "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE STRING "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE STRING "" FORCE)
set(glew-cmake_BUILD_SHARED ON CACHE STRING "" FORCE)
set(ONLY_LIBS ON CACHE STRING "" FORCE)

set(STB_TAG "5736b15f7ea0ffb08dd38af21067c314d6a3aae9" CACHE STRING "" FORCE)

Expand Down Expand Up @@ -105,6 +97,11 @@ FetchContent_MakeAvailable(_glfw)
FetchContent_MakeAvailable(_glm)
FetchContent_MakeAvailable(openal)

set_target_properties(libglew_shared PROPERTIES
RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_BINARY_DIR}/bin/
RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_BINARY_DIR}/bin/
)

# Has to be set after OpenAL's declaration to make sure it doesn't inherit -fsanitize, as
# this causes undefined references, because reasons :)
if (NOT WIN32)
Expand Down
6 changes: 4 additions & 2 deletions src/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,10 @@ set (SOURCE_FILES
genesis/logging/Loggers.cpp
# }}}
# TODO: place sanely
genesis/core/game/chunks/MapLayers.cpp

genesis/core/game/chunks/MapLayers.cpp
# AI {{{
genesis/core/game/ai/MapAI.cpp
# }}}
)

add_library(genesis-core STATIC ${SOURCE_FILES})
Expand Down
18 changes: 0 additions & 18 deletions src/core/genesis/core/data/EntityGroup.hpp

This file was deleted.

4 changes: 0 additions & 4 deletions src/core/genesis/core/game/ai/AIStructs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,5 @@ static inline constexpr auto GROUP_RANDOM_STARTIDX = 100;

using RelationMap = std::map<std::pair<groupid_t, groupid_t>, CreatureRelations>;

struct AIClass {
int groupId;
CreatureRelations colonyRelation;
};

}
18 changes: 18 additions & 0 deletions src/core/genesis/core/game/ai/CreatureController.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include "CreatureController.hpp"

namespace genesis {
// CreatureGroup {{{
CreatureGroup::CreatureGroup(const std::string& groupName, groupid_t groupId) : groupName(groupName), groupId(groupId) {

}
// }}}
// CreatureController {{{
CreatureController::CreatureController() {

}

groupid_t CreatureController::provisionGroupId() {
return CreatureController::CURR_RANDOM_GROUP_ID.fetch_add(1);
}
// }}}
}
39 changes: 39 additions & 0 deletions src/core/genesis/core/game/ai/CreatureController.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#pragma once

#include <memory>
#include <mutex>
#include <string>
#include <vector>

#include "genesis/core/game/ai/AIStructs.hpp"
#include "genesis/rendering/Entity.hpp"

namespace genesis {

class CreatureGroup {
private:
// TODO: add entity IDs and convert to a map
std::vector<std::shared_ptr<Entity>> entities;
groupid_t groupId;
public:
const std::string groupName;

CreatureGroup(const std::string& groupName, groupid_t groupId);
};

/**
* Contains and manages all the game's entities. AI control is distributed to
* subcontrollers via this class.
*/
class CreatureController {
private:
static std::atomic<groupid_t> CURR_RANDOM_GROUP_ID;
std::map<groupid_t, CreatureGroup> groups;
RelationMap creatureRelations;

groupid_t provisionGroupId();
public:
CreatureController();
};

}
5 changes: 5 additions & 0 deletions src/core/genesis/core/game/entities/GameCreature.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,11 @@

namespace genesis {

struct CreatureData {
AttributeInfo attribs;
};

// TODO: separate out data fields into a separate struct
class GameCreature : public Entity {
private:
AttributeInfo attribs;
Expand Down

0 comments on commit 944c7a0

Please sign in to comment.