From 543097548f2543a0f5f1c4dc9ac8f4082742a5dd Mon Sep 17 00:00:00 2001
From: Joseph Walton-Rivers <joseph@walton-rivers.uk>
Date: Thu, 23 Jun 2022 09:33:58 +0100
Subject: [PATCH] fix cmake files - Linux-compatable include syntax

---
 .gitlab-ci.yml                  |  2 +-
 demo/CMakeLists.txt             |  4 ++--
 fggl/CMakeLists.txt             |  8 ++++++--
 fggl/phys/bullet/CMakeLists.txt | 12 +++++++++++-
 4 files changed, 20 insertions(+), 6 deletions(-)

diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index 9a906aa..5253caa 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -21,7 +21,7 @@ stages:          # List of stages for jobs, and their order of execution
   - deploy
 
 .f34-ogl:
-  image: git.fossgalaxy.com:8042/gamedev/containers/fedora:34-opengl
+  image: git.fossgalaxy.com:8042/gamedev/containers/fedora:36-opengl
   before_script:
     - dnf install -y pkgconfig\(dri\) pkgconfig\(glu\) pkgconfig\(x11\) pkgconfig\(xcursor\) pkgconfig\(xi\) pkgconfig\(xinerama\) pkgconfig\(xrandr\) doxygen
     - dnf install -y glm-devel glfw-devel openal-soft-devel spdlog-devel freetype-devel yaml-cpp-devel assimp-devel bullet-devel
diff --git a/demo/CMakeLists.txt b/demo/CMakeLists.txt
index c45405f..4c8f3dd 100644
--- a/demo/CMakeLists.txt
+++ b/demo/CMakeLists.txt
@@ -1,5 +1,5 @@
-#cmake_minimum_required(VERSION 3.16)
-#project(demo)
+cmake_minimum_required(VERSION 3.16)
+project(demo)
 
 # Executable
 add_executable(demo
diff --git a/fggl/CMakeLists.txt b/fggl/CMakeLists.txt
index 476c4f6..d19d33e 100644
--- a/fggl/CMakeLists.txt
+++ b/fggl/CMakeLists.txt
@@ -64,8 +64,12 @@ find_package(yaml-cpp)
 target_link_libraries(fggl PUBLIC yaml-cpp)
 
 # model loading
-find_package(assimp)
-target_link_libraries(${PROJECT_NAME} PUBLIC assimp::assimp)
+find_package(assimp CONFIG)
+if ( MSVC )
+    target_link_libraries(${PROJECT_NAME} PUBLIC assimp::assimp)
+else()
+    target_link_libraries(${PROJECT_NAME} PUBLIC assimp)
+endif()
 
 find_package(Freetype)
 target_link_libraries(${PROJECT_NAME} PUBLIC Freetype::Freetype)
diff --git a/fggl/phys/bullet/CMakeLists.txt b/fggl/phys/bullet/CMakeLists.txt
index bb2ac62..6c5ca9e 100644
--- a/fggl/phys/bullet/CMakeLists.txt
+++ b/fggl/phys/bullet/CMakeLists.txt
@@ -4,7 +4,17 @@ if ( NOT Bullet_FOUND )
     message(WARNING "Bullet not found - disabling bullet physics integration")
 else()
     message(STATUS "Bullet found")
-    target_link_libraries(fggl PUBLIC LinearMath Bullet3Common BulletCollision BulletDynamics BulletSoftBody )
+
+    if ( MSVC )
+        # see https://github.com/microsoft/vcpkg/issues/7877
+        target_link_libraries(fggl PUBLIC LinearMath Bullet3Common BulletDynamics BulletSoftBody BulletCollision BulletInverseDynamics)
+    else()
+        # FIXME: this shouldn't be necessary, for modern cmake, linking the libraries should be enough
+        target_compile_definitions(fggl PUBLIC ${BULLET_DEFINITIONS})
+        target_include_directories(fggl PUBLIC ${BULLET_INCLUDE_DIRS})
+        target_link_libraries(fggl PUBLIC ${BULLET_LIBRARIES})
+    endif()
+
 
     # bullet cpp files
     target_sources(fggl
-- 
GitLab