cmake_minimum_required(VERSION 3.1) project(Graph) list(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake) add_subdirectory(3rdparty) include(cmake/BuildShaders.cmake) include(cmake/CopyData.cmake) set(CMAKE_CXX_STANDARD 17) find_package(SDL2 REQUIRED) find_package(Vulkan REQUIRED) find_package(assimp REQUIRED) find_package(glm REQUIRED) if(CMAKE_BUILD_TYPE STREQUAL "Debug") add_definitions(-DDEBUG) endif() if(APPLE AND NOT TARGET SDL2::SDL2) add_library(SDL2::SDL2 UNKNOWN IMPORTED) set_target_properties(SDL2::SDL2 PROPERTIES IMPORTED_LOCATION "${SDL2_LIBDIR}/libSDL2.dylib" INTERFACE_INCLUDE_DIRECTORIES ${SDL2_INCLUDE_DIRS}) endif() # workaround for linking dbus/glib ourselves if(UNIX AND NOT APPLE) set_target_properties(SDL2::SDL2 PROPERTIES IMPORTED_LINK_INTERFACE_LIBRARIES_NOCONFIG "") endif() if(NOT TARGET assimp::assimp) add_library(assimp::assimp UNKNOWN IMPORTED) find_library(ASSIMP_IMPORTED_PATH ${ASSIMP_LIBRARIES} PATHS ${ASSIMP_LIBRARY_DIRS}) set_target_properties(assimp::assimp PROPERTIES IMPORTED_LOCATION ${ASSIMP_IMPORTED_PATH}) set_target_properties(assimp::assimp PROPERTIES INTERFACE_INCLUDE_DIRECTORIES ${ASSIMP_INCLUDE_DIRS}) endif() set(ENGINE_SRC src/renderer.cpp src/worldpass.cpp src/postpass.cpp src/dofpass.cpp src/skypass.cpp src/shadowpass.cpp src/config.cpp src/stringutils.cpp src/animationsystem.cpp src/worldmanager.cpp src/assetmanager.cpp src/entityparser.cpp src/smaapass.cpp) if(CMAKE_BUILD_TYPE STREQUAL "Debug") set(ENGINE_SRC ${ENGINE_SRC} src/imguipass.cpp) endif() add_library(Engine ${ENGINE_SRC}) target_compile_options(Engine PUBLIC -fno-exceptions) target_link_libraries(Engine PUBLIC SDL2::SDL2 Vulkan::Vulkan assimp::assimp nlohmann::json stb::stb SMAA::SMAA) if(CMAKE_BUILD_TYPE STREQUAL "Debug") target_link_libraries(Engine PUBLIC imgui::imgui) endif() target_include_directories(Engine PUBLIC include PRIVATE ${GLM_INCLUDE_DIRS}) add_executable(Graph src/main.cpp) target_link_libraries(Graph PRIVATE Engine) add_shaders(Graph shaders/mesh.vert shaders/mesh.frag shaders/post.vert shaders/post.frag shaders/dof.vert shaders/dof.frag shaders/imgui.vert shaders/imgui.frag shaders/sky.vert shaders/sky.frag shaders/shadow.vert shaders/edge.vert shaders/edge.frag shaders/blend.vert shaders/blend.frag) add_data(Graph data/suzanne.obj data/test.cim data/bokeh.png data/scene.obj data/tile.jpg data/graphics_presets.cfg data/test.world data/test.material data/empty.world data/player.obj data/sphere.obj data/matpreview.world data/basic.material data/maticon.png) add_subdirectory(tools)