From 0cdc76a8def55eefa6e5c41eac3f349cbf609cf0 Mon Sep 17 00:00:00 2001 From: SpinnerX Date: Thu, 21 Nov 2024 00:27:06 -0800 Subject: [PATCH] Updating cmake to utilize a much better working cmake-utils/2.0 --- CMakeLists.txt | 29 ++------------- Editor/CMakeLists.txt | 47 ++---------------------- TestApp/CMakeLists.txt | 83 +++++++++++++++++++++--------------------- conanfile.py | 3 +- src/CMakeLists.txt | 4 +- 5 files changed, 51 insertions(+), 115 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 4962928..7024885 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,29 +4,6 @@ project(engine3d CXX) set(CMAKE_CXX_STANDARD 23) set(ENGINE_INCLUDE_DIR ${CMAKE_CURRENT_LIST_DIR}/engine3d) -cmake_minimum_required(VERSION 3.25) -project(engine3d C CXX) - -set(CMAKE_CXX_STANDARD 23) - -set(CMAKE_EXPORT_COMPILE_COMMANDS ON CACHE INTERNAL "") # works (in creating the compile_commands.json file) - -add_subdirectory(Editor) -add_subdirectory(TestApp) -add_subdirectory(src) - -# # target_include_directory is setting some private settings for differentiating what internal includes are privates and what should be includes should be exposed to the application-dev -target_include_directories(${PROJECT_NAME} PUBLIC ${JoltPhysics_SOURCE_DIR} ${EnTT_INCLUDE_DIR}) -target_include_directories(${PROJECT_NAME} PRIVATE engine3d/ engine3d/Core) -target_include_directories(${PROJECT_NAME} PUBLIC ${GLM_INCLUDE_DIR} ./engine3d) - -# #Set Compiler definitions -set(is_msvc_cl $) -set(dev_definitions - $<${is_msvc_cl}:JPH_FLOATING_POINT_EXCEPTIONS_ENABLED> - JPH_PROFILE_ENABLED - JPH_DEBUG_RENDERER - JPH_OBJECT_STREAM -) - -target_compile_definitions(${PROJECT_NAME} PRIVATE ${dev_definitions}) +build_library( + DIRECTORIES src Editor TestApp +) \ No newline at end of file diff --git a/Editor/CMakeLists.txt b/Editor/CMakeLists.txt index c93f4b1..8f1e0b9 100644 --- a/Editor/CMakeLists.txt +++ b/Editor/CMakeLists.txt @@ -7,50 +7,9 @@ project(Editor CXX) # Editor/Editor.cpp # ) -set( - all_src +build_demos( + SOURCES Editor/Editor.hpp Editor/Editor.cpp + LINK_LIBRARIES engine3d ) - -add_executable(${PROJECT_NAME} ${all_src}) - -find_package(OpenGL REQUIRED) -find_package(glfw3 REQUIRED) - -find_package(Vulkan REQUIRED) -find_package(VulkanHeaders REQUIRED) - -if(LINUX) -find_package(VulkanLoader REQUIRED) -endif(LINUX) - -# target_include_directories(${PROJECT_NAME} PUBLIC ${ENGINE_INCLUDE_DIR}) -target_include_directories(${PROJECT_NAME} PRIVATE ../) -find_package(glm REQUIRED) -find_package(fmt REQUIRED) -find_package(spdlog REQUIRED) -find_package(yaml-cpp REQUIRED) -find_package(imguidocking REQUIRED) -find_package(box2d REQUIRED) -find_package(joltphysics REQUIRED) -find_package(EnTT REQUIRED) - - -target_link_libraries( - ${PROJECT_NAME} - PRIVATE - glfw - ${OPENGL_LIBRARIES} - Vulkan::Vulkan - vulkan-headers::vulkan-headers - glm::glm - fmt::fmt - spdlog::spdlog - yaml-cpp::yaml-cpp - imguidocking::imguidocking - box2d::box2d - Jolt::Jolt - EnTT::EnTT - engine3d -) \ No newline at end of file diff --git a/TestApp/CMakeLists.txt b/TestApp/CMakeLists.txt index e923169..dd1246f 100644 --- a/TestApp/CMakeLists.txt +++ b/TestApp/CMakeLists.txt @@ -4,7 +4,8 @@ project(TestApp CXX) # find_package(Vulkan REQUIRED) # find_package(engine3d CONFIG REQUIRED) -add_executable(${PROJECT_NAME} +build_demos( + SOURCES Application.cpp #To Test @@ -30,50 +31,50 @@ add_executable(${PROJECT_NAME} SceneTest/Scenes/Assets/SceneInstances/ShowCaseSceneInstance.hpp SceneTest/src/Scenes/Assets/SceneInstances/ShowCaseSceneInstance.cpp - + LINK_LIBRARIES engine3d ) target_include_directories(${PROJECT_NAME} PUBLIC SceneTest) target_include_directories(${PROJECT_NAME} PRIVATE ../) -target_compile_definitions(${PROJECT_NAME} PRIVATE ${dev_definitions}) +# target_compile_definitions(${PROJECT_NAME} PRIVATE ${dev_definitions}) -find_package(OpenGL REQUIRED) -find_package(glfw3 REQUIRED) +# find_package(OpenGL REQUIRED) +# find_package(glfw3 REQUIRED) -find_package(Vulkan REQUIRED) -find_package(VulkanHeaders REQUIRED) - -if(LINUX) -find_package(VulkanLoader REQUIRED) -endif(LINUX) - -# target_include_directories(${PROJECT_NAME} PUBLIC ${ENGINE_INCLUDE_DIR}) -target_include_directories(${PROJECT_NAME} PRIVATE ../) -find_package(glm REQUIRED) -find_package(fmt REQUIRED) -find_package(spdlog REQUIRED) -find_package(yaml-cpp REQUIRED) -find_package(imguidocking REQUIRED) -find_package(box2d REQUIRED) -find_package(joltphysics REQUIRED) -find_package(EnTT REQUIRED) - - -target_link_libraries( - ${PROJECT_NAME} - PRIVATE - glfw - ${OPENGL_LIBRARIES} - Vulkan::Vulkan - vulkan-headers::vulkan-headers - glm::glm - fmt::fmt - spdlog::spdlog - yaml-cpp::yaml-cpp - imguidocking::imguidocking - box2d::box2d - Jolt::Jolt - EnTT::EnTT - engine3d -) \ No newline at end of file +# find_package(Vulkan REQUIRED) +# find_package(VulkanHeaders REQUIRED) + +# if(LINUX) +# find_package(VulkanLoader REQUIRED) +# endif(LINUX) + +# # target_include_directories(${PROJECT_NAME} PUBLIC ${ENGINE_INCLUDE_DIR}) +# target_include_directories(${PROJECT_NAME} PRIVATE ../) +# find_package(glm REQUIRED) +# find_package(fmt REQUIRED) +# find_package(spdlog REQUIRED) +# find_package(yaml-cpp REQUIRED) +# find_package(imguidocking REQUIRED) +# find_package(box2d REQUIRED) +# find_package(joltphysics REQUIRED) +# find_package(EnTT REQUIRED) + + +# target_link_libraries( +# ${PROJECT_NAME} +# PRIVATE +# glfw +# ${OPENGL_LIBRARIES} +# Vulkan::Vulkan +# vulkan-headers::vulkan-headers +# glm::glm +# fmt::fmt +# spdlog::spdlog +# yaml-cpp::yaml-cpp +# imguidocking::imguidocking +# box2d::box2d +# Jolt::Jolt +# EnTT::EnTT +# engine3d +# ) \ No newline at end of file diff --git a/conanfile.py b/conanfile.py index 8608013..88f7b45 100644 --- a/conanfile.py +++ b/conanfile.py @@ -26,12 +26,11 @@ class engine3dRecipe(ConanFile): def build_requirements(self): self.tool_requires("make/4.4.1") self.tool_requires("cmake/3.27.1") - self.tool_requires("engine3d-cmake-utils/1.0") + self.tool_requires("engine3d-cmake-utils/2.0") def requirements(self): self.requires("glfw/3.4", transitive_headers=True) self.requires("opengl/system", transitive_headers=True) - self.requires("engine3d-cmake-utils/1.0") # These end in 1.0 because they are engine3d-customized conan packages # Slighly modified of the conan packages and it's CMake generators to using "Unix Makefiles" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6bd534a..739b31c 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -7,8 +7,8 @@ set(VULKAN_SRC_DIR ${ENGINE_SRC_DIR}/Core/internal/Vulkan2Showcase) set(VULKAN_SHADERS_INCLUDE_DIR ${VULKAN_INCLUDE_DIR}/Shaders) set(VULKAN_SHADERS_SRC_DIR ${VULKAN_SRC_DIR}/Shaders) -build_library( - SOURCES +add_library( + ${PROJECT_NAME} ${ENGINE_INCLUDE_NAME}/Core/ApplicationInstance.hpp ${ENGINE_INCLUDE_NAME}/Core/EngineLogger.hpp