Open ghost opened 1 year ago
I edited the CMakeLists.txt, the original has missing dependencies on IMGUI. I build successfully using MSVC cmake on windows.
cmake_minimum_required(VERSION 3.0.0)
project(LegitEngineCMake VERSION 0.1.0)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /bigobj")
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
find_package(Vulkan)
message(STATUS "Found Vulkan in ${Vulkan_INCLUDE_DIRS}")
message(STATUS "Found Vulkan libs in ${Vulkan_LIBRARIES}")
set(TINYOBJ_INCLUDE_DIR ./dependencies/tiny_obj_loader/include)
set(SPIRVCROSS_INCLUDE_DIR ./dependencies/spirv-cross)
set(GLI_INCLUDE_DIR ./dependencies/gli)
set(GLM_INCLUDE_DIR ./dependencies/glm/include)
set(GLFW3_INCLUDE_DIR ./dependencies/glfw/include)
set(JSONCPP_INCLUDE_DIR ./dependencies/jsoncpp)
set(GLFW3_LIBRARIES "${CMAKE_SOURCE_DIR}/dependencies/glfw/lib-vc2015/glfw3.lib")
#find_package(GLM)
#find_package(GLFW3)
include_directories ("${Vulkan_INCLUDE_DIRS}")
include_directories ("${GLM_INCLUDE_DIR}")
include_directories ("${GLFW3_INCLUDE_DIR}")
include_directories ("${SPIRVCROSS_INCLUDE_DIR}")
include_directories ("${GLI_INCLUDE_DIR}")
include_directories ("${TINYOBJ_INCLUDE_DIR}")
include_directories ("${JSONCPP_INCLUDE_DIR}")
# imgui
set(IMGUI_DIR "${CMAKE_CURRENT_SOURCE_DIR}/dependencies/imgui")
set(IMGUI_FILES
"${IMGUI_DIR}/imgui.cpp"
"${IMGUI_DIR}/imgui_demo.cpp"
"${IMGUI_DIR}/imgui_draw.cpp"
"${IMGUI_DIR}/imgui_widgets.cpp"
"${IMGUI_DIR}/imconfig.h"
"${IMGUI_DIR}/imgui.h"
"${IMGUI_DIR}/imgui_internal.h"
"${IMGUI_DIR}/imstb_rectpack.h"
"${IMGUI_DIR}/imstb_textedit.h"
"${IMGUI_DIR}/imstb_truetype.h")
add_library(imgui STATIC ${IMGUI_FILES})
target_include_directories(imgui PUBLIC ${IMGUI_DIR})
#include_directories ("${CMAKE_SOURCE_DIR}/dependencies/glm/include")
#include_directories ("${CMAKE_SOURCE_DIR}/dependencies/glfw/include")
file(GLOB_RECURSE dep_sources ${SPIRVCROSS_INCLUDE_DIR}/*.cpp ${TINYOBJ_INCLUDE_DIR}/*.cc ${JSONCPP_INCLUDE_DIR}/*.cpp)
file(GLOB_RECURSE legit_sources ./src/*.cpp)
file(GLOB_RECURSE legit_headers ./src/*.h)
add_executable(LegitEngine)
#source_group(TREE src/)
target_sources(LegitEngine PRIVATE ${dep_sources} ${legit_sources} ${legit_headers})
target_link_libraries(LegitEngine ${Vulkan_LIBRARIES} ${GLFW3_LIBRARIES} imgui)
set_target_properties(LegitEngine PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG "${CMAKE_SOURCE_DIR}/bin/cmaked")
set_target_properties(LegitEngine PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE "${CMAKE_SOURCE_DIR}/bin/cmake")
I'll accept a pull request if you add imgui the same way how everything else is added (or change the way everything else is added to something better), I just want it to be done uniformly.
If not, then it's alright, I'm planning at some point in the future to do a large update to this repo and upload 2 years worth of changes and I'll have a look at updating CMakeLists.txt while I'm at it.