diff --git a/CMakeLists.txt b/CMakeLists.txt index e51328748942185c31a53fd004b24d9ad01f3ada..49718b894fe9cb950c24dab38cb048d49264bc53 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -59,6 +59,9 @@ add_subdirectory( vendor/imgui ) add_subdirectory( fggl ) add_subdirectory( vendor/header_only ) +# 3rd party integrations +add_subdirectory( integrations/bullet ) + ## G++ enable insane checks target_compile_options( ${PROJECT_NAME} PRIVATE -Wall -fno-strict-aliasing -fno-strict-overflow ) diff --git a/demo/demo/main.cpp b/demo/demo/main.cpp index 6e36d92a1aa7e5921849db0dca9b61c1bc41fe1b..a5d78bd6640079fa662b8e0a4411a293098073c2 100644 --- a/demo/demo/main.cpp +++ b/demo/demo/main.cpp @@ -34,7 +34,7 @@ #include "fggl/platform/paths.hpp" #include "fggl/ecs3/types.hpp" -#include "fggl/phys/bullet/bullet.hpp" +#include "../../integrations/bullet/include/fggl/phys/bullet/bullet.hpp" #include "fggl/scenes/menu.hpp" diff --git a/fggl/CMakeLists.txt b/fggl/CMakeLists.txt index baa89489ec1371668d7afb836166972744491b17..579475433394a9830ffdba9ad9f70f691fb04b5d 100644 --- a/fggl/CMakeLists.txt +++ b/fggl/CMakeLists.txt @@ -80,7 +80,6 @@ add_subdirectory(gfx) add_subdirectory(audio) # physics integration -add_subdirectory(phys/bullet) # Debug backend add_subdirectory(debug) diff --git a/fggl/gfx/ogl/renderer.cpp b/fggl/gfx/ogl/renderer.cpp index 602cb371dc7ab4db4222adc175c26bf49def176e..2ded83f2911ad55b2960842ef2dceb44bd4295aa 100644 --- a/fggl/gfx/ogl/renderer.cpp +++ b/fggl/gfx/ogl/renderer.cpp @@ -14,6 +14,7 @@ #include <fggl/util/service.hpp> #include "fggl/debug/logging.hpp" +#include "fggl/debug/pragmas.hpp" #include "fggl/gfx/ogl/common.hpp" #include "fggl/gfx/window.hpp" @@ -87,10 +88,8 @@ constexpr auto static fggl_ogl_type(GLenum type) -> const char * { return "unknown"; } -#ifndef _MSC_VER - #pragma clang diagnostic push - #pragma ide diagnostic ignored "bugprone-easily-swappable-parameters" -#endif +PRAGMA_DIAGNOSTIC_PUSH +#pragma ide diagnostic ignored "bugprone-easily-swappable-parameters" constexpr const char* OGL_LOG_FMT {"[GL] {}, {}: [{}]: {}"}; @@ -114,9 +113,7 @@ void static GLAPIENTRY fggl_ogl_to_spdlog(GLenum source, GLenum type, unsigned i } } -#ifndef _MSC_VER - #pragma clang diagnostic pop -#endif +PRAGMA_DIAGNOSTIC_POP } /** diff --git a/fggl/scenes/game.cpp b/fggl/scenes/game.cpp index 2dea4c4b8ac5239260d0156a4e3b005a489b2b1d..dfd22b779f1e9184e804ea67ac26736663766341 100644 --- a/fggl/scenes/game.cpp +++ b/fggl/scenes/game.cpp @@ -18,7 +18,7 @@ #include "fggl/scenes/game.hpp" #include "fggl/util/service.hpp" -#include "fggl/phys/bullet/types.hpp" +#include "../../integrations/bullet/include/fggl/phys/bullet/types.hpp" namespace fggl::scenes { diff --git a/include/fggl/debug/pragmas.hpp b/include/fggl/debug/pragmas.hpp new file mode 100644 index 0000000000000000000000000000000000000000..927412593a3f671b0b3bf1203d8a1d6ca998ff8c --- /dev/null +++ b/include/fggl/debug/pragmas.hpp @@ -0,0 +1,44 @@ +/* + * This file is part of FGGL. + * + * FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. + * + * FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with FGGL. + * If not, see <https://www.gnu.org/licenses/>. + */ + +// +// Created by webpigeon on 27/06/22. +// + +#ifndef FGGL_DEBUG_PRAGMAS_HPP +#define FGGL_DEBUG_PRAGMAS_HPP + +#if defined(__clang__) +#define PRAGMA_DIAGNOSTIC_PUSH _Pragma("clang diagnostic push") +#elif defined(__GNUC__) +#define PRAGMA_DIAGNOSTIC_PUSH _Pragma("gcc diagnostic push") +#else +#define PRAGMA_DIAGNOSTIC_PUSH +#endif + +#if defined(__clang__) +#define PRAGMA_DIAGNOSTIC_POP _Pragma("clang diagnostic pop") +#elif defined(__GNUC__) +#define PRAGMA_DIAGNOSTIC_POP _Pragma("gcc diagnostic pop") +#else +#define PRAGMA_DIAGNOSTIC_POP +#endif + +#if defined(__JETBRAINS_IDE__) +#define PRAGMA_CLION_IGNORED(x) _Pragma("ide diagnostic ignored \"" x "\"") +#else +#define PRAGMA_CLION_IGNORED +#endif + +#endif //FGGL_DEBUG_PRAGMAS_HPP diff --git a/fggl/phys/bullet/CMakeLists.txt b/integrations/bullet/CMakeLists.txt similarity index 84% rename from fggl/phys/bullet/CMakeLists.txt rename to integrations/bullet/CMakeLists.txt index da6eb58a18c52f18fb3b187190de7ff82cda203d..30b2f8ff5b69c9704ab66dd75db004dcc74c5272 100644 --- a/fggl/phys/bullet/CMakeLists.txt +++ b/integrations/bullet/CMakeLists.txt @@ -23,11 +23,16 @@ else() target_link_libraries(fggl PUBLIC ${BULLET_LIBRARIES}) endif() + target_include_directories( fggl + PUBLIC + $<BUILD_INTERFACE:${CMAKE_CURRENT_LIST_DIR}/include> + $<INSTALL_INTERFACE:include> + ) # bullet cpp files - target_sources(fggl + target_sources( fggl PRIVATE - simulation.cpp - phys_draw.cpp + src/simulation.cpp + src/phys_draw.cpp ) endif() diff --git a/include/fggl/phys/bullet/bullet.hpp b/integrations/bullet/include/fggl/phys/bullet/bullet.hpp similarity index 73% rename from include/fggl/phys/bullet/bullet.hpp rename to integrations/bullet/include/fggl/phys/bullet/bullet.hpp index af04029c13dcd034edc43fca45bd4b49fd25ae60..73db6fd355abe718060778f17ca18e96add73a2d 100644 --- a/include/fggl/phys/bullet/bullet.hpp +++ b/integrations/bullet/include/fggl/phys/bullet/bullet.hpp @@ -12,6 +12,20 @@ * If not, see <https://www.gnu.org/licenses/>. */ +/* + * This file is part of FGGL. + * + * FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. + * + * FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with FGGL. + * If not, see <https://www.gnu.org/licenses/>. + */ + // // Created by webpigeon on 24/04/22. // @@ -22,7 +36,7 @@ #include "fggl/ecs3/module/module.hpp" #include "fggl/phys/types.hpp" -#include "fggl/phys/bullet/types.hpp" +#include "types.hpp" namespace fggl::phys::bullet { diff --git a/include/fggl/phys/bullet/motion.hpp b/integrations/bullet/include/fggl/phys/bullet/motion.hpp similarity index 72% rename from include/fggl/phys/bullet/motion.hpp rename to integrations/bullet/include/fggl/phys/bullet/motion.hpp index 0b21e8a75bd9183314bf8ad4426a1e8f73a681a4..5b0540a62bb29fe96827c8771855a71bc638c9a6 100644 --- a/include/fggl/phys/bullet/motion.hpp +++ b/integrations/bullet/include/fggl/phys/bullet/motion.hpp @@ -12,6 +12,20 @@ * If not, see <https://www.gnu.org/licenses/>. */ +/* + * This file is part of FGGL. + * + * FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. + * + * FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with FGGL. + * If not, see <https://www.gnu.org/licenses/>. + */ + // // Created by webpigeon on 11/06/22. // @@ -19,7 +33,7 @@ #ifndef FGGL_PHYS_BULLET_MOTION_HPP #define FGGL_PHYS_BULLET_MOTION_HPP -#include "fggl/phys/bullet/types.hpp" +#include "types.hpp" namespace fggl::phys::bullet { diff --git a/include/fggl/phys/bullet/phys_draw.hpp b/integrations/bullet/include/fggl/phys/bullet/phys_draw.hpp similarity index 100% rename from include/fggl/phys/bullet/phys_draw.hpp rename to integrations/bullet/include/fggl/phys/bullet/phys_draw.hpp diff --git a/include/fggl/phys/bullet/types.hpp b/integrations/bullet/include/fggl/phys/bullet/types.hpp similarity index 80% rename from include/fggl/phys/bullet/types.hpp rename to integrations/bullet/include/fggl/phys/bullet/types.hpp index 222d5e1f844d4ebbe1c1d091fe34b433f6fb0c3a..0809053ccd78d85f7bedf965bac26e8307aaef2d 100644 --- a/include/fggl/phys/bullet/types.hpp +++ b/integrations/bullet/include/fggl/phys/bullet/types.hpp @@ -12,6 +12,20 @@ * If not, see <https://www.gnu.org/licenses/>. */ +/* + * This file is part of FGGL. + * + * FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. + * + * FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with FGGL. + * If not, see <https://www.gnu.org/licenses/>. + */ + // // Created by webpigeon on 24/04/22. // @@ -21,7 +35,7 @@ #include "fggl/ecs3/ecs.hpp" #include "fggl/phys/types.hpp" -#include "fggl/phys/bullet/phys_draw.hpp" +#include "phys_draw.hpp" #include <bullet/btBulletDynamicsCommon.h> #include <bullet/btBulletCollisionCommon.h> diff --git a/fggl/phys/bullet/phys_draw.cpp b/integrations/bullet/src/phys_draw.cpp similarity index 73% rename from fggl/phys/bullet/phys_draw.cpp rename to integrations/bullet/src/phys_draw.cpp index 7dd9ef2547093d1e60d718375a014868d1d1d07c..8a1d9f17ae4c9f32e79cffb7c85b7832dc2babe9 100644 --- a/fggl/phys/bullet/phys_draw.cpp +++ b/integrations/bullet/src/phys_draw.cpp @@ -12,11 +12,25 @@ * If not, see <https://www.gnu.org/licenses/>. */ +/* + * This file is part of FGGL. + * + * FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. + * + * FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with FGGL. + * If not, see <https://www.gnu.org/licenses/>. + */ + // // Created by webpigeon on 30/05/22. // -#include "fggl/phys/bullet/phys_draw.hpp" +#include "../include/fggl/phys/bullet/phys_draw.hpp" #include "fggl/debug/draw.hpp" #include <iostream> diff --git a/fggl/phys/bullet/simulation.cpp b/integrations/bullet/src/simulation.cpp similarity index 93% rename from fggl/phys/bullet/simulation.cpp rename to integrations/bullet/src/simulation.cpp index 9f31835082d8eb9b6866b6ff98d2d2cbe79c805b..e4fbcbef75833e21509fcaa12647709ea902f33f 100644 --- a/fggl/phys/bullet/simulation.cpp +++ b/integrations/bullet/src/simulation.cpp @@ -12,8 +12,22 @@ * If not, see <https://www.gnu.org/licenses/>. */ -#include "fggl/phys/bullet/types.hpp" -#include "fggl/phys/bullet/motion.hpp" +/* + * This file is part of FGGL. + * + * FGGL is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any + * later version. + * + * FGGL is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License along with FGGL. + * If not, see <https://www.gnu.org/licenses/>. + */ + +#include "../include/fggl/phys/bullet/types.hpp" +#include "../include/fggl/phys/bullet/motion.hpp" namespace fggl::phys::bullet {