From 350c06a128203dd42a12e2c94af6ed95d60240ad Mon Sep 17 00:00:00 2001 From: Joseph Walton-Rivers <joseph@walton-rivers.uk> Date: Sun, 19 Jun 2022 14:18:05 +0100 Subject: [PATCH] ensure that headerfiles have the correct extention (hpp) --- demo/demo/main.cpp | 2 +- demo/demo/rollball.cpp | 4 ++-- demo/include/GameScene.h | 6 +++--- fggl/CMakeLists.txt | 15 ++++++--------- fggl/app.cpp | 4 ++-- fggl/audio/openal/audio.cpp | 2 +- fggl/data/heightmap.cpp | 2 +- fggl/ecs3/fast/Container.cpp | 2 +- fggl/ecs3/module/module.cpp | 2 +- fggl/ecs3/prototype/world.cpp | 2 +- fggl/gfx/ogl/CMakeLists.txt | 5 ----- fggl/gfx/ogl/renderer.cpp | 2 +- fggl/gfx/ogl4/canvas.cpp | 2 +- fggl/gfx/ogl4/models.cpp | 2 +- fggl/input/camera_input.cpp | 2 +- fggl/math/CMakeLists.txt | 9 +++++++++ fggl/phys/bullet/CMakeLists.txt | 17 ++++++++++------- fggl/scenes/game.cpp | 2 +- fggl/scenes/menu.cpp | 2 +- include/fggl/app.hpp | 2 +- .../fggl/data/{heightmap.h => heightmap.hpp} | 0 include/fggl/ecs3/ecs.hpp | 4 ++-- .../ecs3/fast/{Container.h => Container.hpp} | 0 include/fggl/ecs3/fast/ecs.hpp | 2 +- .../fggl/ecs3/module/{module.h => module.hpp} | 0 .../fggl/ecs3/prototype/{world.h => world.hpp} | 6 +++--- include/fggl/gfx/ogl/compat.hpp | 4 ++-- include/fggl/gui/fonts.hpp | 2 +- .../input/{camera_input.h => camera_input.hpp} | 0 include/fggl/phys/bullet/bullet.hpp | 2 +- include/fggl/scenes/{Scene.h => Scene.hpp} | 0 include/fggl/util/{service.h => service.hpp} | 0 32 files changed, 55 insertions(+), 51 deletions(-) create mode 100644 fggl/math/CMakeLists.txt rename include/fggl/data/{heightmap.h => heightmap.hpp} (100%) rename include/fggl/ecs3/fast/{Container.h => Container.hpp} (100%) rename include/fggl/ecs3/module/{module.h => module.hpp} (100%) rename include/fggl/ecs3/prototype/{world.h => world.hpp} (98%) rename include/fggl/input/{camera_input.h => camera_input.hpp} (100%) rename include/fggl/scenes/{Scene.h => Scene.hpp} (100%) rename include/fggl/util/{service.h => service.hpp} (100%) diff --git a/demo/demo/main.cpp b/demo/demo/main.cpp index 95165bf..2e68921 100644 --- a/demo/demo/main.cpp +++ b/demo/demo/main.cpp @@ -31,7 +31,7 @@ #include "fggl/gfx/ogl/compat.hpp" #include "fggl/data/storage.hpp" -#include "fggl/util/service.h" +#include "fggl/util/service.hpp" #include "fggl/ecs3/types.hpp" #include "fggl/phys/bullet/bullet.hpp" diff --git a/demo/demo/rollball.cpp b/demo/demo/rollball.cpp index 4bef822..d22a7ba 100644 --- a/demo/demo/rollball.cpp +++ b/demo/demo/rollball.cpp @@ -22,8 +22,8 @@ #include "fggl/gfx/camera.hpp" #include "fggl/gfx/phong.hpp" -#include "fggl/input/camera_input.h" -#include "fggl/util/service.h" +#include "fggl/input/camera_input.hpp" +#include "fggl/util/service.hpp" #include "fggl/ecs3/prototype/loader.hpp" #include "fggl/debug/draw.hpp" diff --git a/demo/include/GameScene.h b/demo/include/GameScene.h index 521584e..db20119 100644 --- a/demo/include/GameScene.h +++ b/demo/include/GameScene.h @@ -29,14 +29,14 @@ #include "fggl/gui/gui.hpp" #include "fggl/scenes/game.hpp" -#include "fggl/data/heightmap.h" +#include "fggl/data/heightmap.hpp" #include "fggl/data/procedural.hpp" #include "fggl/gfx/camera.hpp" #include "fggl/input/input.hpp" -#include "fggl/input/camera_input.h" +#include "fggl/input/camera_input.hpp" -#include "fggl/util/service.h" +#include "fggl/util/service.hpp" #include "fggl/util/chrono.hpp" #include "PerlinNoise.hpp" diff --git a/fggl/CMakeLists.txt b/fggl/CMakeLists.txt index 7beae95..d8271d5 100644 --- a/fggl/CMakeLists.txt +++ b/fggl/CMakeLists.txt @@ -1,18 +1,16 @@ - - # headers file(GLOB_RECURSE HEADER_LIST CONFIGURE_DEPENDS "${CMAKE_SOURCE_DIR}/include/fggl/**.hpp") - # the fggl library itself +# Should be shared linkage for legal reasons (LGPL) add_library(fggl SHARED ${HEADER_LIST}) # we need to tell people using the library about our headers target_include_directories(fggl - PUBLIC + PUBLIC $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include> $<INSTALL_INTERFACE:include> - ) +) # users of this library need at least C++20 target_compile_features(fggl PUBLIC cxx_std_20) @@ -34,7 +32,7 @@ if (CLANG_TIDY_FOUND) endif () target_sources(${PROJECT_NAME} - PRIVATE + PRIVATE app.cpp data/model.cpp @@ -57,10 +55,9 @@ target_sources(${PROJECT_NAME} gui/widgets.cpp gui/containers.cpp gui/fonts.cpp +) - math/triangulation.cpp - math/shapes.cpp - ) +add_subdirectory(math) # yaml-cpp for configs and storage find_package(yaml-cpp) diff --git a/fggl/app.cpp b/fggl/app.cpp index 27e5ead..419145c 100644 --- a/fggl/app.cpp +++ b/fggl/app.cpp @@ -6,8 +6,8 @@ #include <fggl/app.hpp> #include <fggl/ecs3/types.hpp> -#include <fggl/ecs3/module/module.h> -#include <fggl/util/service.h> +#include "fggl/ecs3/module/module.hpp" +#include <fggl/util/service.hpp> namespace fggl { diff --git a/fggl/audio/openal/audio.cpp b/fggl/audio/openal/audio.cpp index 6afd540..ed0101d 100644 --- a/fggl/audio/openal/audio.cpp +++ b/fggl/audio/openal/audio.cpp @@ -21,7 +21,7 @@ #include "fggl/audio/openal/audio.hpp" -#include "fggl/util/service.h" +#include "fggl/util/service.hpp" #include "fggl/data/storage.hpp" namespace fggl::audio::openal { diff --git a/fggl/data/heightmap.cpp b/fggl/data/heightmap.cpp index 525e886..7c50f02 100644 --- a/fggl/data/heightmap.cpp +++ b/fggl/data/heightmap.cpp @@ -3,7 +3,7 @@ // #include <fggl/data/model.hpp> -#include <fggl/data/heightmap.h> +#include <fggl/data/heightmap.hpp> // adapted from https://www.mbsoftworks.sk/tutorials/opengl4/016-heightmap-pt1-random-terrain/ diff --git a/fggl/ecs3/fast/Container.cpp b/fggl/ecs3/fast/Container.cpp index 7941260..75c3a2a 100644 --- a/fggl/ecs3/fast/Container.cpp +++ b/fggl/ecs3/fast/Container.cpp @@ -2,7 +2,7 @@ // Created by webpigeon on 23/10/2021. // -#include <fggl/ecs3/fast/Container.h> +#include <fggl/ecs3/fast/Container.hpp> namespace fggl::ecs3 { diff --git a/fggl/ecs3/module/module.cpp b/fggl/ecs3/module/module.cpp index 85ce2e5..ac82f75 100644 --- a/fggl/ecs3/module/module.cpp +++ b/fggl/ecs3/module/module.cpp @@ -2,7 +2,7 @@ // Created by webpigeon on 23/10/2021. // -#include <fggl/ecs3/module/module.h> +#include "fggl/ecs3/module/module.hpp" namespace fggl::ecs3 { diff --git a/fggl/ecs3/prototype/world.cpp b/fggl/ecs3/prototype/world.cpp index 4862f0e..b9c426c 100644 --- a/fggl/ecs3/prototype/world.cpp +++ b/fggl/ecs3/prototype/world.cpp @@ -2,4 +2,4 @@ // Created by webpigeon on 23/10/2021. // -#include <fggl/ecs3/prototype/world.h> +#include <fggl/ecs3/prototype/world.hpp> diff --git a/fggl/gfx/ogl/CMakeLists.txt b/fggl/gfx/ogl/CMakeLists.txt index 8dbb2f0..9e40c86 100644 --- a/fggl/gfx/ogl/CMakeLists.txt +++ b/fggl/gfx/ogl/CMakeLists.txt @@ -9,11 +9,6 @@ target_sources(fggl types.cpp ) -# Math -# probably shouldn't be graphics dependent... -find_package( glm REQUIRED ) -target_link_libraries(${PROJECT_NAME} PRIVATE glm::glm ) - # OpenGL Backend if ( WIN32 ) message("There is a hack to make opengl detection work on windows, someone should look into this...") diff --git a/fggl/gfx/ogl/renderer.cpp b/fggl/gfx/ogl/renderer.cpp index c713cba..cd123f3 100644 --- a/fggl/gfx/ogl/renderer.cpp +++ b/fggl/gfx/ogl/renderer.cpp @@ -1,4 +1,4 @@ -#include <fggl/util/service.h> +#include <fggl/util/service.hpp> #include "fggl/debug/logging.hpp" #include "fggl/gfx/ogl/common.hpp" diff --git a/fggl/gfx/ogl4/canvas.cpp b/fggl/gfx/ogl4/canvas.cpp index c106c02..7e9ce02 100644 --- a/fggl/gfx/ogl4/canvas.cpp +++ b/fggl/gfx/ogl4/canvas.cpp @@ -26,7 +26,7 @@ #include <glm/gtc/type_ptr.hpp> #include "fggl/math/triangulation.hpp" -#include "fggl/util/service.h" +#include "fggl/util/service.hpp" #include "fggl/gui/fonts.hpp" #include "fggl/gfx/windowing.hpp" diff --git a/fggl/gfx/ogl4/models.cpp b/fggl/gfx/ogl4/models.cpp index 3af5329..ff456b0 100644 --- a/fggl/gfx/ogl4/models.cpp +++ b/fggl/gfx/ogl4/models.cpp @@ -23,7 +23,7 @@ // #include "fggl/gfx/ogl4/models.hpp" -#include "fggl/data/heightmap.h" +#include "fggl/data/heightmap.hpp" #include "fggl/gfx/camera.hpp" #include "fggl/gfx/phong.hpp" diff --git a/fggl/input/camera_input.cpp b/fggl/input/camera_input.cpp index bdfffcd..77a7ba0 100644 --- a/fggl/input/camera_input.cpp +++ b/fggl/input/camera_input.cpp @@ -6,7 +6,7 @@ #include <fggl/input/input.hpp> #include <fggl/gfx/camera.hpp> -#include <fggl/input/camera_input.h> +#include <fggl/input/camera_input.hpp> namespace fggl::input { diff --git a/fggl/math/CMakeLists.txt b/fggl/math/CMakeLists.txt new file mode 100644 index 0000000..85eebe0 --- /dev/null +++ b/fggl/math/CMakeLists.txt @@ -0,0 +1,9 @@ +# math +find_package( glm REQUIRED ) +target_link_libraries( fggl PUBLIC glm::glm ) + +target_sources(fggl + PRIVATE + shapes.cpp + triangulation.cpp +) \ No newline at end of file diff --git a/fggl/phys/bullet/CMakeLists.txt b/fggl/phys/bullet/CMakeLists.txt index afeed64..f422e9c 100644 --- a/fggl/phys/bullet/CMakeLists.txt +++ b/fggl/phys/bullet/CMakeLists.txt @@ -1,13 +1,16 @@ # bullet integration support +find_package( Bullet ) +if ( NOT Bullet_FOUND ) + message("Bullet not found - disabling bullet physics integration") +else() + target_link_libraries(fggl PUBLIC ${BULLET_LIBRARIES}) + target_include_directories(fggl PUBLIC ${BULLET_INCLUDE_DIR}) -find_package( Bullet REQUIRED ) -target_link_libraries(fggl PUBLIC ${BULLET_LIBRARIES} ) -target_include_directories(fggl PUBLIC ${BULLET_INCLUDE_DIR}) - -# -target_sources(fggl + # bullet cpp files + target_sources(fggl PRIVATE simulation.cpp phys_draw.cpp -) + ) +endif() diff --git a/fggl/scenes/game.cpp b/fggl/scenes/game.cpp index b2f3ad5..1e30f5d 100644 --- a/fggl/scenes/game.cpp +++ b/fggl/scenes/game.cpp @@ -23,7 +23,7 @@ // #include "fggl/scenes/game.hpp" -#include "fggl/util/service.h" +#include "fggl/util/service.hpp" #include "fggl/phys/bullet/types.hpp" namespace fggl::scenes { diff --git a/fggl/scenes/menu.cpp b/fggl/scenes/menu.cpp index b0437c3..0da4fc3 100644 --- a/fggl/scenes/menu.cpp +++ b/fggl/scenes/menu.cpp @@ -1,5 +1,5 @@ #include <fggl/scenes/menu.hpp> -#include <fggl/util/service.h> +#include <fggl/util/service.hpp> #include <fggl/gui/gui.hpp> #include <spdlog/spdlog.h> diff --git a/include/fggl/app.hpp b/include/fggl/app.hpp index 4ba1ca9..a807ede 100644 --- a/include/fggl/app.hpp +++ b/include/fggl/app.hpp @@ -29,7 +29,7 @@ #include <unordered_map> #include <fggl/ecs3/types.hpp> -#include <fggl/ecs3/module/module.h> +#include "fggl/ecs3/module/module.hpp" #include <fggl/gfx/window.hpp> #include <fggl/gfx/paint.hpp> #include <fggl/util/states.hpp> diff --git a/include/fggl/data/heightmap.h b/include/fggl/data/heightmap.hpp similarity index 100% rename from include/fggl/data/heightmap.h rename to include/fggl/data/heightmap.hpp diff --git a/include/fggl/ecs3/ecs.hpp b/include/fggl/ecs3/ecs.hpp index 20e1165..25c64af 100644 --- a/include/fggl/ecs3/ecs.hpp +++ b/include/fggl/ecs3/ecs.hpp @@ -1,8 +1,8 @@ #ifndef FGGL_ECS3_ECS_H #define FGGL_ECS3_ECS_H -#include <fggl/ecs3/module/module.h> -#include <fggl/ecs3/prototype/world.h> +#include "fggl/ecs3/module/module.hpp" +#include <fggl/ecs3/prototype/world.hpp> #include <fggl/math/types.hpp> namespace fggl::ecs3 { diff --git a/include/fggl/ecs3/fast/Container.h b/include/fggl/ecs3/fast/Container.hpp similarity index 100% rename from include/fggl/ecs3/fast/Container.h rename to include/fggl/ecs3/fast/Container.hpp diff --git a/include/fggl/ecs3/fast/ecs.hpp b/include/fggl/ecs3/fast/ecs.hpp index 542106c..425f7d9 100644 --- a/include/fggl/ecs3/fast/ecs.hpp +++ b/include/fggl/ecs3/fast/ecs.hpp @@ -13,7 +13,7 @@ #include <fggl/ecs3/utils.hpp> #include <fggl/ecs3/types.hpp> -#include <fggl/ecs3/fast/Container.h> +#include <fggl/ecs3/fast/Container.hpp> namespace fggl::ecs3::fast { diff --git a/include/fggl/ecs3/module/module.h b/include/fggl/ecs3/module/module.hpp similarity index 100% rename from include/fggl/ecs3/module/module.h rename to include/fggl/ecs3/module/module.hpp diff --git a/include/fggl/ecs3/prototype/world.h b/include/fggl/ecs3/prototype/world.hpp similarity index 98% rename from include/fggl/ecs3/prototype/world.h rename to include/fggl/ecs3/prototype/world.hpp index 87a6d66..88e7814 100644 --- a/include/fggl/ecs3/prototype/world.h +++ b/include/fggl/ecs3/prototype/world.hpp @@ -2,8 +2,8 @@ // Created by webpigeon on 23/10/2021. // -#ifndef FGGL_ECS3_PROTOTYPE_WORLD_H -#define FGGL_ECS3_PROTOTYPE_WORLD_H +#ifndef FGGL_ECS3_PROTOTYPE_WORLD_HPP +#define FGGL_ECS3_PROTOTYPE_WORLD_HPP #include <map> #include <functional> @@ -364,4 +364,4 @@ namespace fggl::ecs3::prototype { } -#endif //FGGL_ECS3_PROTOTYPE_WORLD_H +#endif //FGGL_ECS3_PROTOTYPE_WORLD_HPP diff --git a/include/fggl/gfx/ogl/compat.hpp b/include/fggl/gfx/ogl/compat.hpp index fc50420..7542616 100644 --- a/include/fggl/gfx/ogl/compat.hpp +++ b/include/fggl/gfx/ogl/compat.hpp @@ -19,8 +19,8 @@ #include <fggl/gfx/camera.hpp> #include <fggl/ecs/ecs.hpp> #include <utility> -#include <fggl/input/camera_input.h> -#include <fggl/data/heightmap.h> +#include <fggl/input/camera_input.hpp> +#include <fggl/data/heightmap.hpp> #include "fggl/gfx/phong.hpp" diff --git a/include/fggl/gui/fonts.hpp b/include/fggl/gui/fonts.hpp index 370a3ec..0b1f615 100644 --- a/include/fggl/gui/fonts.hpp +++ b/include/fggl/gui/fonts.hpp @@ -31,7 +31,7 @@ #include "fggl/math/types.hpp" #include "fggl/data/storage.hpp" -#include "fggl/util/service.h" +#include "fggl/util/service.hpp" #include <ft2build.h> #include FT_FREETYPE_H diff --git a/include/fggl/input/camera_input.h b/include/fggl/input/camera_input.hpp similarity index 100% rename from include/fggl/input/camera_input.h rename to include/fggl/input/camera_input.hpp diff --git a/include/fggl/phys/bullet/bullet.hpp b/include/fggl/phys/bullet/bullet.hpp index b50326c..df0c258 100644 --- a/include/fggl/phys/bullet/bullet.hpp +++ b/include/fggl/phys/bullet/bullet.hpp @@ -25,7 +25,7 @@ #ifndef FGGL_PHYS_BULLET_BULLET_HPP #define FGGL_PHYS_BULLET_BULLET_HPP -#include "fggl/ecs3/module/module.h" +#include "fggl/ecs3/module/module.hpp" #include "fggl/phys/types.hpp" #include "fggl/phys/bullet/types.hpp" diff --git a/include/fggl/scenes/Scene.h b/include/fggl/scenes/Scene.hpp similarity index 100% rename from include/fggl/scenes/Scene.h rename to include/fggl/scenes/Scene.hpp diff --git a/include/fggl/util/service.h b/include/fggl/util/service.hpp similarity index 100% rename from include/fggl/util/service.h rename to include/fggl/util/service.hpp -- GitLab