Last active
August 6, 2020 19:01
-
-
Save Phildo/68bd4173bf2af573db0e7cae5c597306 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmake_minimum_required(VERSION 3.17) | |
| include(FetchContent) | |
| project(GnomeTower | |
| VERSION 0.0.1 | |
| DESCRIPTION "Lead your gnome civilization to the skies" | |
| LANGUAGES CXX | |
| ) | |
| # | |
| # genglsl | |
| # | |
| # generates many permutations of possible "default" shader glsl- | |
| # eg "shaders which use positions, normals, and uvs", and "shaders which use positions and colors", etc... | |
| # | |
| set(GENGLSL_SOURCE_DIR genglsl) | |
| set(GENGLSL_SOURCE_FILES | |
| ${GENGLSL_SOURCE_DIR}/genglsl.cpp | |
| ${GENGLSL_SOURCE_DIR}/do_shaderparams.cpp ${GENGLSL_SOURCE_DIR}/do_shaderparams.h | |
| ) | |
| add_executable(genglsl ${GENGLSL_SOURCE_FILES}) | |
| target_compile_features(genglsl PUBLIC cxx_std_17) | |
| set_target_properties(genglsl PROPERTIES | |
| CXX_STANDARD_REQUIRED ON | |
| CXX_EXTENSIONS OFF | |
| ) | |
| # | |
| # gnomes | |
| # | |
| # simple voxel simulation game | |
| # | |
| set(GNOMES_SOURCE_DIR gnomes) | |
| set(GNOMES_SOURCE_FILES | |
| ${GNOMES_SOURCE_DIR}/application.cpp | |
| ${GNOMES_SOURCE_DIR}/cmake_config.h | |
| ${GNOMES_SOURCE_DIR}/setflag.h | |
| ${GNOMES_SOURCE_DIR}/do_log.h | |
| ${GNOMES_SOURCE_DIR}/incl_do_renderers.h | |
| ${GNOMES_SOURCE_DIR}/incl_glm.h | |
| ${GNOMES_SOURCE_DIR}/incl_stb.h | |
| ${GNOMES_SOURCE_DIR}/incl_vr.h | |
| ${GNOMES_SOURCE_DIR}/incl_window.h | |
| ${GNOMES_SOURCE_DIR}/do_vk_util.cpp ${GNOMES_SOURCE_DIR}/do_vk_util.h | |
| ${GNOMES_SOURCE_DIR}/do_vk_trash.cpp ${GNOMES_SOURCE_DIR}/do_vk_trash.h | |
| ${GNOMES_SOURCE_DIR}/do_vk_core.cpp ${GNOMES_SOURCE_DIR}/do_vk_core.h | |
| ${GNOMES_SOURCE_DIR}/do_vk_render.cpp ${GNOMES_SOURCE_DIR}/do_vk_render.h | |
| ${GNOMES_SOURCE_DIR}/do_vk_shader.cpp ${GNOMES_SOURCE_DIR}/do_vk_shader.h | |
| ${GNOMES_SOURCE_DIR}/do_vk_material.cpp ${GNOMES_SOURCE_DIR}/do_vk_material.h | |
| ${GNOMES_SOURCE_DIR}/do_vk_model.cpp ${GNOMES_SOURCE_DIR}/do_vk_model.h | |
| ${GNOMES_SOURCE_DIR}/do_util.cpp ${GNOMES_SOURCE_DIR}/do_util.h | |
| ${GNOMES_SOURCE_DIR}/do_config.cpp ${GNOMES_SOURCE_DIR}/do_config.h | |
| ${GNOMES_SOURCE_DIR}/do_buffgen.cpp ${GNOMES_SOURCE_DIR}/do_buffgen.h | |
| ${GNOMES_SOURCE_DIR}/do_glm.cpp ${GNOMES_SOURCE_DIR}/do_glm.h | |
| ${GNOMES_SOURCE_DIR}/do_time.cpp ${GNOMES_SOURCE_DIR}/do_time.h | |
| ${GNOMES_SOURCE_DIR}/do_renderer.cpp ${GNOMES_SOURCE_DIR}/do_renderer.h | |
| ${GNOMES_SOURCE_DIR}/do_voxel_renderer.cpp ${GNOMES_SOURCE_DIR}/do_voxel_renderer.h | |
| ${GNOMES_SOURCE_DIR}/do_voxel_selection_renderer.cpp ${GNOMES_SOURCE_DIR}/do_voxel_selection_renderer.h | |
| ${GNOMES_SOURCE_DIR}/do_stb_voxel_renderer.cpp ${GNOMES_SOURCE_DIR}/do_stb_voxel_renderer.h | |
| ${GNOMES_SOURCE_DIR}/do_window.cpp ${GNOMES_SOURCE_DIR}/do_window.h | |
| ${GNOMES_SOURCE_DIR}/do_vr.cpp ${GNOMES_SOURCE_DIR}/do_vr.h | |
| ${GNOMES_SOURCE_DIR}/do_scene_graph.cpp ${GNOMES_SOURCE_DIR}/do_scene_graph.h | |
| ${GNOMES_SOURCE_DIR}/do_chunk_graph.cpp ${GNOMES_SOURCE_DIR}/do_chunk_graph.h | |
| ${GNOMES_SOURCE_DIR}/do_player.cpp ${GNOMES_SOURCE_DIR}/do_player.h | |
| ${GNOMES_SOURCE_DIR}/do_camera.cpp ${GNOMES_SOURCE_DIR}/do_camera.h | |
| ${GNOMES_SOURCE_DIR}/do_shader.cpp ${GNOMES_SOURCE_DIR}/do_shader.h | |
| ${GNOMES_SOURCE_DIR}/do_material.cpp ${GNOMES_SOURCE_DIR}/do_material.h | |
| ${GNOMES_SOURCE_DIR}/do_model.cpp ${GNOMES_SOURCE_DIR}/do_model.h | |
| ${GNOMES_SOURCE_DIR}/do_instance.cpp ${GNOMES_SOURCE_DIR}/do_instance.h | |
| ${GNOMES_SOURCE_DIR}/do_voxel.cpp ${GNOMES_SOURCE_DIR}/do_voxel.h | |
| ${GNOMES_SOURCE_DIR}/stb_voxel_wrangler.cpp ${GNOMES_SOURCE_DIR}/stb_voxel_wrangler.h | |
| ${GNOMES_SOURCE_DIR}/impl_stb.cpp | |
| ${GNOMES_SOURCE_DIR}/impl_stb_static_vr.cpp | |
| ${GNOMES_SOURCE_DIR}/impl_tiny_obj_loader.cpp | |
| ${GNOMES_SOURCE_DIR}/impl_vk_mem_alloc.cpp | |
| ${GENGLSL_SOURCE_DIR}/do_shaderparams.cpp ${GENGLSL_SOURCE_DIR}/do_shaderparams.h #intentionally shared with genglsl | |
| ) | |
| #if(Android) | |
| # add_library(gnomes SHARED ${GNOMES_SOURCE_FILES}) | |
| #else | |
| add_executable(gnomes ${GNOMES_SOURCE_FILES}) | |
| #endif() | |
| target_compile_features(gnomes PUBLIC cxx_std_17) | |
| set_target_properties(gnomes PROPERTIES | |
| CXX_STANDARD_REQUIRED ON | |
| CXX_EXTENSIONS OFF | |
| ) | |
| # | |
| # Find*.cmake libraries | |
| # | |
| #Vulkan | |
| find_package(Vulkan REQUIRED) | |
| target_link_libraries(gnomes PUBLIC Vulkan::Vulkan) | |
| # | |
| # Repository with CMakeLists.txt libraries | |
| # | |
| #OpenXR | |
| FetchContent_Declare( | |
| OpenXR | |
| GIT_REPOSITORY [email protected]:KhronosGroup/OpenXR-SDK-Source.git | |
| GIT_TAG release-1.0.10 | |
| ) | |
| FetchContent_MakeAvailable(OpenXR) | |
| target_link_libraries(gnomes PUBLIC openxr openxr_loader) | |
| #glfw | |
| FetchContent_Declare( | |
| glfw | |
| GIT_REPOSITORY [email protected]:glfw/glfw.git | |
| GIT_TAG 3.3.2 | |
| ) | |
| set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE) | |
| set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE) | |
| set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE) | |
| FetchContent_MakeAvailable(glfw) | |
| target_link_libraries(gnomes PUBLIC glfw) | |
| #spirv-headers (NEEDED ONLY FOR SPIRV-TOOLS) | |
| FetchContent_Declare( | |
| spirv-headers | |
| GIT_REPOSITORY [email protected]:KhronosGroup/SPIRV-Headers | |
| GIT_TAG 1.5.3 | |
| ) | |
| FetchContent_MakeAvailable(spirv-headers) | |
| #spirv-tools (NEEDED ONLY FOR SHADERC) | |
| FetchContent_Declare( | |
| spirv-tools | |
| GIT_REPOSITORY [email protected]:KhronosGroup/SPIRV-Tools | |
| GIT_TAG v2020.4 | |
| ) | |
| FetchContent_MakeAvailable(spirv-tools) | |
| #spirv-tools (NEEDED ONLY FOR SHADERC) | |
| FetchContent_Declare( | |
| glslang | |
| GIT_REPOSITORY [email protected]:KhronosGroup/glslang | |
| GIT_TAG 8.13.3743 | |
| ) | |
| FetchContent_MakeAvailable(glslang) | |
| #shaderc | |
| FetchContent_Declare( | |
| shaderc | |
| GIT_REPOSITORY [email protected]:google/shaderc.git | |
| GIT_TAG v2020.2 | |
| ) | |
| set(SHADERC_SKIP_INSTALL ON CACHE BOOL "" FORCE) | |
| set(SHADERC_SKIP_TESTS ON CACHE BOOL "" FORCE) | |
| FetchContent_MakeAvailable(shaderc) | |
| target_link_libraries(gnomes PUBLIC shaderc) | |
| #glm | |
| FetchContent_Declare( | |
| glm | |
| GIT_REPOSITORY [email protected]:g-truc/glm | |
| GIT_TAG 0.9.9.8 | |
| ) | |
| FetchContent_MakeAvailable(glm) | |
| target_link_libraries(gnomes PUBLIC glm) | |
| #tinyobjloader | |
| FetchContent_Declare( | |
| tinyobjloader | |
| GIT_REPOSITORY [email protected]:tinyobjloader/tinyobjloader | |
| GIT_TAG v2.0.0rc6 | |
| ) | |
| FetchContent_MakeAvailable(tinyobjloader) | |
| target_link_libraries(gnomes PUBLIC tinyobjloader) | |
| # | |
| # Repositories with only source files | |
| # | |
| #obj (obj writer) | |
| FetchContent_Declare( | |
| obj | |
| GIT_REPOSITORY [email protected]:rlk/obj | |
| ) | |
| FetchContent_GetProperties(obj) | |
| if(NOT obj_POPULATED) | |
| FetchContent_Populate(obj) | |
| add_library(lib_obj ${obj_SOURCE_DIR}/obj.c) | |
| target_include_directories(lib_obj PUBLIC ${obj_SOURCE_DIR}) | |
| endif() | |
| target_link_libraries(gnomes PUBLIC lib_obj) | |
| # | |
| # stb-style single-header libraries | |
| # | |
| #vulkan mem alloc | |
| FetchContent_Declare( | |
| vma | |
| GIT_REPOSITORY [email protected]:GPUOpen-LibrariesAndSDKs/VulkanMemoryAllocator | |
| GIT_TAG v2.3.0+vs2017 | |
| ) | |
| FetchContent_GetProperties(vma) | |
| if(NOT vma_POPULATED) | |
| FetchContent_Populate(vma) | |
| endif() | |
| target_include_directories(gnomes PUBLIC ${vma_SOURCE_DIR}/src) | |
| #stb | |
| FetchContent_Declare( | |
| stb | |
| GIT_REPOSITORY [email protected]:nothings/stb | |
| ) | |
| FetchContent_GetProperties(stb) | |
| if(NOT stb_POPULATED) | |
| FetchContent_Populate(stb) | |
| endif() | |
| target_include_directories(gnomes PUBLIC ${stb_SOURCE_DIR}) | |
| configure_file(cmake_config.h.in ${GNOMES_SOURCE_DIR}/cmake_config.h) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment