Skip to content

Commit

Permalink
Updating cmake to utilize a much better working cmake-utils/2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
SpinnerX committed Nov 21, 2024
1 parent b3bd78c commit 0cdc76a
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 115 deletions.
29 changes: 3 additions & 26 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<CXX_COMPILER_ID:MSVC>)
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
)
47 changes: 3 additions & 44 deletions Editor/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
83 changes: 42 additions & 41 deletions TestApp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
)
# 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
# )
3 changes: 1 addition & 2 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 0cdc76a

Please sign in to comment.