From d7566c5825590ab5dd7c1c5ed4fa071d5bd09223 Mon Sep 17 00:00:00 2001 From: Dynamitos Date: Sat, 30 Apr 2022 20:35:25 +0200 Subject: [PATCH] Revamping build system --- CMakeLists.txt | 92 ++++++++++++------------------------ cmake/FindAftermath.cmake | 99 --------------------------------------- cmake/FindAssimp.cmake | 84 --------------------------------- cmake/FindFreeType.cmake | 89 ----------------------------------- cmake/FindGLFW.cmake | 97 -------------------------------------- cmake/FindGLM.cmake | 54 --------------------- cmake/FindJSON.cmake | 41 ---------------- cmake/FindKTX.cmake | 84 --------------------------------- cmake/FindSLANG.cmake | 82 -------------------------------- cmake/FindSPIRV.cmake | 50 -------------------- cmake/FindSTB.cmake | 51 -------------------- cmake/FindTTFParser.cmake | 68 --------------------------- cmake/SuperBuild.cmake | 97 +++++++++++++++++--------------------- external/ktx | 2 +- external/slang | 2 +- test/CMakeLists.txt | 12 ++--- 16 files changed, 78 insertions(+), 926 deletions(-) delete mode 100644 cmake/FindAftermath.cmake delete mode 100644 cmake/FindAssimp.cmake delete mode 100644 cmake/FindFreeType.cmake delete mode 100644 cmake/FindGLFW.cmake delete mode 100644 cmake/FindGLM.cmake delete mode 100644 cmake/FindJSON.cmake delete mode 100644 cmake/FindKTX.cmake delete mode 100644 cmake/FindSLANG.cmake delete mode 100644 cmake/FindSPIRV.cmake delete mode 100644 cmake/FindSTB.cmake delete mode 100644 cmake/FindTTFParser.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 753811c..d362ec0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,5 +1,8 @@ -cmake_minimum_required(VERSION 3.19) +cmake_minimum_required(VERSION 3.7...3.23) +if(${CMAKE_VERSION} VERSION_LESS 3.12) + cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION}) +endif() set(CMAKE_CXX_STANDARD 20) # Handle superbuild first @@ -26,15 +29,9 @@ set(NSAM_ROOT ${EXTERNAL_ROOT}/aftermath) set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake/) set(Boost_NO_WARN_NEW_VERSIONS 1) -if (USE_SUPERBUILD) - project (SUPERBUILD NONE) - # execute the superbuild (this script will be invoked again without the - # USE_SUPERBUILD option this time) - include (cmake/SuperBuild.cmake) - return() # stop processing this file further -else() - project (Seele) -endif() +project (Seele) + +include(cmake/Superbuild.cmake) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/bin/${CMAKE_BUILD_TYPE}) #Workaround for vs, because it places artifacts into an additional subfolder @@ -48,21 +45,7 @@ endif() find_package(Vulkan REQUIRED) find_package(Boost REQUIRED COMPONENTS serialization) -find_package(Threads REQUIRED) -find_package(Assimp REQUIRED) -find_package(JSON REQUIRED) -find_package(GLFW REQUIRED) -find_package(FreeType REQUIRED) -find_package(TTFParser REQUIRED) -find_package(GLM REQUIRED) -find_package(KTX REQUIRED) -find_package(STB REQUIRED) -find_package(SLANG REQUIRED) -find_package(Aftermath REQUIRED) -add_definitions(${Vulkan_DEFINITIONS}) -add_definitions(${Boost_DEFINITIONS}) -add_compile_definitions(GLFW_WINDOWS) if(WIN32) add_compile_definitions(USE_EXTENSIONS) endif() @@ -71,29 +54,21 @@ if(CMAKE_DEBUG_POSTFIX) add_compile_definitions(SEELE_DEBUG) endif() add_executable(Engine "") -target_include_directories(Engine PRIVATE ${GLM_INCLUDE_DIRS}) -target_include_directories(Engine PRIVATE ${KTX_INCLUDE_DIRS}) -target_include_directories(Engine PRIVATE ${STB_INCLUDE_DIRS}) -target_include_directories(Engine PRIVATE ${Vulkan_INCLUDE_DIR}) -target_include_directories(Engine PRIVATE ${Boost_INCLUDE_DIRS}) -target_include_directories(Engine PRIVATE ${GLFW_INCLUDE_DIRS}) -target_include_directories(Engine PRIVATE ${FREETYPE_INCLUDE_DIRS}) -target_include_directories(Engine PRIVATE ${SLANG_INCLUDE_DIRS}) -target_include_directories(Engine PRIVATE ${ASSIMP_INCLUDE_DIRS}) -target_include_directories(Engine PRIVATE ${JSON_INCLUDE_DIRS}) -target_include_directories(Engine PRIVATE ${NSAM_INCLUDE_DIRS}) -target_include_directories(Engine PRIVATE ${TTFPARSER_INCLUDE_DIRS}) -target_include_directories(Engine PRIVATE ${ENGINE_ROOT}) -target_include_directories(Engine PRIVATE src/Engine) - -target_link_libraries(Engine ${Vulkan_LIBRARY}) -target_link_libraries(Engine ${Boost_LIBRARIES}) -target_link_libraries(Engine ${GLFW_LIBRARIES}) -target_link_libraries(Engine ${FREETYPE_LIBRARIES}) -target_link_libraries(Engine ${SLANG_LIBRARIES}) -target_link_libraries(Engine ${ASSIMP_LIBRARIES}) -target_link_libraries(Engine ${NSAM_LIBRARIES}) -target_link_libraries(Engine ${KTX_LIBRARIES}) +target_compile_definitions(Engine PUBLIC GLFW_WINDOWS) +target_include_directories(Engine PUBLIC src/Engine) +target_link_libraries(Engine PUBLIC Vulkan::Vulkan) +target_link_libraries(Engine PUBLIC Boost::headers) +target_link_libraries(Engine PUBLIC Boost::serialization) +target_link_libraries(Engine PUBLIC EnTT::EnTT) +target_link_libraries(Engine PUBLIC glfw) +target_link_libraries(Engine PUBLIC glm::glm) +target_link_libraries(Engine PUBLIC freetype) +target_link_libraries(Engine PUBLIC slang) +target_link_libraries(Engine PUBLIC assimp) +target_link_libraries(Engine PUBLIC nsam) +target_link_libraries(Engine PUBLIC ktx) +target_link_libraries(Engine PUBLIC stb) +target_link_libraries(Engine PUBLIC nlohmann_json::nlohmann_json) if(UNIX) target_link_libraries(Engine Threads::Threads) target_link_libraries(Engine dl) @@ -128,22 +103,13 @@ endif() add_executable(Seele_unit_tests "") add_subdirectory(test/) -if(WIN32) - add_custom_target(copy-binaries ALL - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SLANG_BINARIES} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SLANG_GLSLANG} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GLFW_BINARY} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${FREETYPE_BINARY} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${ASSIMP_BINARY} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NSAM_BINARIES} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NSAM_LLVM} $ - COMMAND ${CMAKE_COMMAND} -E copy_if_different ${KTX_BINARIES} $) -else() - add_custom_target(copy-binaries ALL COMMAND "") -endif() - add_custom_target(SeeleEngine ALL COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/res $ - DEPENDS Engine copy-binaries) + COMMAND ${CMAKE_COMMAND} -E copy $ $ + COMMAND ${CMAKE_COMMAND} -E copy $ $ + COMMAND ${CMAKE_COMMAND} -E copy $ $ + COMMAND ${CMAKE_COMMAND} -E copy $ $ + COMMAND ${CMAKE_COMMAND} -E copy $ $ + COMMAND_EXPAND_LISTS + DEPENDS Engine slang-build) - \ No newline at end of file diff --git a/cmake/FindAftermath.cmake b/cmake/FindAftermath.cmake deleted file mode 100644 index 5286209..0000000 --- a/cmake/FindAftermath.cmake +++ /dev/null @@ -1,99 +0,0 @@ -# -# Find Nsight Aftermath -# -# Try to find Nvidia Nsight aftermath library. -# This module defines the following variables: -# - NSAM_INCLUDE_DIRS -# - NSAM_LIBRARIES -# - NSAM_FOUND -# -# The following variables can be set as arguments for the module. -# - NSAM_ROOT : Root library directory of NSAM -# - NSAM_USE_STATIC_LIBS : Specifies to use static version of NSAM library (Windows only) -# -# References: -# - https://github.com/progschj/OpenGL-Examples/blob/master/cmake_modules/FindNSAM.cmake -# - https://bitbucket.org/Ident8/cegui-mk2-opengl3-renderer/src/befd47200265/cmake/FindNSAM.cmake -# - -# Additional modules -include(FindPackageHandleStandardArgs) - -if (WIN32) - # Find include files - find_path( - NSAM_INCLUDE_DIR - NAMES GFSDK_Aftermath.h - PATHS - $ENV{PROGRAMFILES}/include - ${NSAM_ROOT}/include - DOC "The directory where GFSDK_Aftermath.h resides") - - - # Find library files - find_library( - NSAM_LIBRARY - NAMES GFSDK_Aftermath_Lib.${CMAKE_PLATFORM}.lib - PATHS - $ENV{PROGRAMFILES}/lib - ${NSAM_ROOT}/lib/${CMAKE_PLATFORM} - ${NSAM_ROOT}/lib - PATH_SUFFIXES x86 x64) - - find_file( - NSAM_BINARY - NAMES GFSDK_Aftermath_Lib.${CMAKE_PLATFORM}.dll - PATHS - $ENV{PROGRAMFILES}/bin - ${NSAM_ROOT}/lib/${CMAKE_PLATFORM} - ${NSAM_ROOT}/lib - PATH_SUFFIXES x86 x64) - - find_file( - NSAM_LLVM - NAMES llvm_7_0_1.dll - PATHS - $ENV{PROGRAMFILES}/bin - ${NSAM_ROOT}/lib/${CMAKE_PLATFORM} - ${NSAM_ROOT}/lib - PATH_SUFFIXES x86 x64) - -else() - # Find include files - find_path( - NSAM_INCLUDE_DIR - NAMES GFSDK_Aftermath.h - PATHS - /usr/include - /usr/local/include - /sw/include - /opt/local/include - ${NSAM_ROOT}/include - DOC "The directory where GL/nsam.h resides") - - find_file( - NSAM_LIBRARY - NAMES libGFSDK_Aftermath_Lib.${CMAKE_PLATFORM}.so - PATHS - /usr/lib64 - /usr/lib - /usr/local/lib64 - /usr/local/lib - /sw/lib - /opt/local/lib - ${NSAM_ROOT}/lib - PATH_SUFFIXES x64 x86) -endif() - -# Handle REQUIRD argument, define *_FOUND variable -find_package_handle_standard_args(NSAM DEFAULT_MSG NSAM_INCLUDE_DIR NSAM_LIBRARY) - -# Define NSAM_LIBRARIES and NSAM_INCLUDE_DIRS -if (NSAM_FOUND) - set(NSAM_LIBRARIES ${NSAM_LIBRARY}) - set(NSAM_INCLUDE_DIRS ${NSAM_INCLUDE_DIR}) - set(NSAM_BINARIES ${NSAM_BINARY}) -endif() - -# Hide some variables -mark_as_advanced(NSAM_INCLUDE_DIR NSAM_LIBRARY) \ No newline at end of file diff --git a/cmake/FindAssimp.cmake b/cmake/FindAssimp.cmake deleted file mode 100644 index f8b8622..0000000 --- a/cmake/FindAssimp.cmake +++ /dev/null @@ -1,84 +0,0 @@ -# -# Find Assimp -# -# Try to find Assimp : Open Asset Import Library. -# This module defines the following variables: -# - ASSIMP_INCLUDE_DIRS -# - ASSIMP_LIBRARIES -# - ASSIMP_FOUND -# -# The following variables can be set as arguments for the module. -# - ASSIMP_ROOT : Root library directory of Assimp -# - -# Additional modules -include(FindPackageHandleStandardArgs) -if (WIN32) - # Find include files - find_path( - ASSIMP_INCLUDE_DIR - NAMES assimp/scene.h - PATHS - $ENV{PROGRAMFILES}/include - ${ASSIMP_ROOT}/include - DOC "The directory where assimp/scene.h resides") - - # Find library files - find_library( - ASSIMP_LIBRARY - NAMES assimp-vc${MSVC_TOOLSET_VERSION}-mt${CMAKE_DEBUG_POSTFIX}.lib - PATHS - $ENV{PROGRAMFILES}/lib - ${ASSIMP_ROOT}/lib - ${ASSIMP_ROOT}/code - PATH_SUFFIXES Debug Release) - - find_file( - ASSIMP_BINARY - NAMES assimp-vc${MSVC_TOOLSET_VERSION}-mt${CMAKE_DEBUG_POSTFIX}.dll - PATHS - $ENV{PROGRAMFILES}/bin - ${ASSIMP_ROOT}/code - PATH_SUFFIXES Debug Release) -else() - # Find include files - find_path( - ASSIMP_INCLUDE_DIR - NAMES assimp/scene.h - PATHS - /usr/include - /usr/local/include - /sw/include - /opt/local/include - ${ASSIMP_ROOT}/include - DOC "The directory where assimp/scene.h resides") - - # Find library files - find_library( - ASSIMP_LIBRARY - NAMES libassimp${CMAKE_DEBUG_POSTFIX}.so - PATHS - /usr/lib64 - /usr/lib - /usr/local/lib64 - /usr/local/lib - /sw/lib - /opt/local/lib - ${ASSIMP_ROOT}/code - DOC "Assimp library file") - - -endif() - -# Handle REQUIRD argument, define *_FOUND variable -find_package_handle_standard_args(assimp DEFAULT_MSG ASSIMP_INCLUDE_DIR ASSIMP_LIBRARY) - -# Define GLFW_LIBRARIES and GLFW_INCLUDE_DIRS -if (ASSIMP_FOUND) - set(ASSIMP_LIBRARIES ${ASSIMP_LIBRARY}) - set(ASSIMP_INCLUDE_DIRS ${ASSIMP_INCLUDE_DIR}) - set(ASSIMP_BINARIES ${ASSIMP_BINARY}) -endif() - -# Hide some variables -mark_as_advanced(ASSIMP_INCLUDE_DIR ASSIMP_LIBRARY, ASSIMP_BINARY) \ No newline at end of file diff --git a/cmake/FindFreeType.cmake b/cmake/FindFreeType.cmake deleted file mode 100644 index 18fcda4..0000000 --- a/cmake/FindFreeType.cmake +++ /dev/null @@ -1,89 +0,0 @@ -# -# Find FREETYPE -# -# Try to find FREETYPE library. -# This module defines the following variables: -# - FREETYPE_INCLUDE_DIRS -# - FREETYPE_LIBRARIES -# - FREETYPE_FOUND -# -# The following variables can be set as arguments for the module. -# - FREETYPE_ROOT : Root library directory of FREETYPE -# - FREETYPE_USE_STATIC_LIBS : Specifies to use static version of FREETYPE library (Windows only) -# -# References: -# - https://github.com/progschj/OpenGL-Examples/blob/master/cmake_modules/FindFREETYPE.cmake -# - https://bitbucket.org/Ident8/cegui-mk2-opengl3-renderer/src/befd47200265/cmake/FindFREETYPE.cmake -# - -# Additional modules -include(FindPackageHandleStandardArgs) - -if (WIN32) - # Find include files - find_path( - FREETYPE_INCLUDE_DIR - NAMES freetype/freetype.h - PATHS - $ENV{PROGRAMFILES}/include - ${FREETYPE_ROOT}/include - DOC "The directory where FREETYPE/glfw.h resides") - - # Find library files - find_library( - FREETYPE_LIBRARY - NAMES freetype${CMAKE_DEBUG_POSTFIX}.lib - PATHS - $ENV{PROGRAMFILES}/lib - ${FREETYPE_ROOT}/lib - ${FREETYPE_ROOT} - PATH_SUFFIXES Debug Release) - - - find_file( - FREETYPE_BINARY - NAMES freetype${CMAKE_DEBUG_POSTFIX}.dll - PATHS - $ENV{PROGRAMFILES}/bin - ${CMAKE_BINARY_DIR} - ${FREETYPE_ROOT}/src - ${FREETYPE_ROOT} - PATH_SUFFIXES Debug Release) -else() - # Find include files - find_path( - FREETYPE_INCLUDE_DIR - NAMES FREETYPE/glfw3.h - PATHS - /usr/include - /usr/local/include - /sw/include - /opt/local/include - DOC "The directory where GL/glfw.h resides") - - # Find library files - find_file( - FREETYPE_LIBRARY - NAMES libglfw${CMAKE_DEBUG_POSTFIX}.so - PATHS - /usr/lib64 - /usr/lib - /usr/local/lib64 - /usr/local/lib - /sw/lib - /opt/local/lib - ${FREETYPE_ROOT}/src - ) -endif() - -# Handle REQUIRD argument, define *_FOUND variable -find_package_handle_standard_args(FREETYPE DEFAULT_MSG FREETYPE_INCLUDE_DIR FREETYPE_LIBRARY FREETYPE_BINARY) - -# Define FREETYPE_LIBRARIES and FREETYPE_INCLUDE_DIRS -if (FREETYPE_FOUND) - set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY}) - set(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDE_DIR}) -endif() - -# Hide some variables -mark_as_advanced(FREETYPE_INCLUDE_DIR FREETYPE_LIBRARY) \ No newline at end of file diff --git a/cmake/FindGLFW.cmake b/cmake/FindGLFW.cmake deleted file mode 100644 index 7119aad..0000000 --- a/cmake/FindGLFW.cmake +++ /dev/null @@ -1,97 +0,0 @@ -# -# Find GLFW -# -# Try to find GLFW library. -# This module defines the following variables: -# - GLFW_INCLUDE_DIRS -# - GLFW_LIBRARIES -# - GLFW_FOUND -# -# The following variables can be set as arguments for the module. -# - GLFW_ROOT : Root library directory of GLFW -# - GLFW_USE_STATIC_LIBS : Specifies to use static version of GLFW library (Windows only) -# -# References: -# - https://github.com/progschj/OpenGL-Examples/blob/master/cmake_modules/FindGLFW.cmake -# - https://bitbucket.org/Ident8/cegui-mk2-opengl3-renderer/src/befd47200265/cmake/FindGLFW.cmake -# - -# Additional modules -include(FindPackageHandleStandardArgs) - -if (WIN32) - # Find include files - find_path( - GLFW_INCLUDE_DIR - NAMES GLFW/glfw3.h - PATHS - $ENV{PROGRAMFILES}/include - ${GLFW_ROOT}/include - DOC "The directory where GLFW/glfw.h resides") - - # Use glfw3(d).lib for static library - if (GLFW_USE_STATIC_LIBS) - set(GLFW_LIBRARY_NAME glfw3${CMAKE_DEBUG_POSTFIX}) - else() - set(GLFW_LIBRARY_NAME glfw3${CMAKE_DEBUG_POSTFIX}dll) - endif() - - # Find library files - find_library( - GLFW_LIBRARY - NAMES ${GLFW_LIBRARY_NAME}.lib - PATHS - $ENV{PROGRAMFILES}/lib - ${GLFW_ROOT}/lib - ${GLFW_ROOT}/src - PATH_SUFFIXES Debug Release) - - unset(GLFW_LIBRARY_NAME) - - find_file( - GLFW_BINARY - NAMES glfw3${CMAKE_DEBUG_POSTFIX}.dll - PATHS - $ENV{PROGRAMFILES}/bin - ${CMAKE_BINARY_DIR} - ${GLFW_ROOT}/src - ${GLFW_ROOT}/bin - PATH_SUFFIXES Debug Release) -else() - # Find include files - find_path( - GLFW_INCLUDE_DIR - NAMES GLFW/glfw3.h - PATHS - /usr/include - /usr/local/include - /sw/include - /opt/local/include - DOC "The directory where GL/glfw.h resides") - - # Find library files - find_file( - GLFW_LIBRARY - NAMES libglfw${CMAKE_DEBUG_POSTFIX}.so - PATHS - /usr/lib64 - /usr/lib - /usr/local/lib64 - /usr/local/lib - /sw/lib - /opt/local/lib - ${GLFW_ROOT}/src - ) -endif() - -# Handle REQUIRD argument, define *_FOUND variable -find_package_handle_standard_args(GLFW DEFAULT_MSG GLFW_INCLUDE_DIR GLFW_LIBRARY) - -# Define GLFW_LIBRARIES and GLFW_INCLUDE_DIRS -if (GLFW_FOUND) - set(GLFW_LIBRARIES ${GLFW_LIBRARY}) - set(GLFW_INCLUDE_DIRS ${GLFW_INCLUDE_DIR}) -endif() - -# Hide some variables -mark_as_advanced(GLFW_INCLUDE_DIR GLFW_LIBRARY) \ No newline at end of file diff --git a/cmake/FindGLM.cmake b/cmake/FindGLM.cmake deleted file mode 100644 index dfcfcad..0000000 --- a/cmake/FindGLM.cmake +++ /dev/null @@ -1,54 +0,0 @@ -# -# Find GLM -# -# Try to find GLM library. -# This module defines the following variables: -# - GLM_INCLUDE_DIRS -# - GLM_LIBRARIES -# - GLM_FOUND -# -# The following variables can be set as arguments for the module. -# - GLM_ROOT : Root library directory of GLM -# - GLM_USE_STATIC_LIBS : Specifies to use static version of GLM library (Windows only) -# -# References: -# - https://github.com/progschj/OpenGL-Examples/blob/master/cmake_modules/FindGLM.cmake -# - https://bitbucket.org/Ident8/cegui-mk2-opengl3-renderer/src/befd47200265/cmake/FindGLM.cmake -# - -# Additional modules -include(FindPackageHandleStandardArgs) - -if (WIN32) - # Find include files - find_path( - GLM_INCLUDE_DIR - NAMES GLM/glm.hpp - PATHS - $ENV{PROGRAMFILES}/include - ${GLM_ROOT} - DOC "The directory where GLM/glm.h resides") -else() - # Find include files - find_path( - GLM_INCLUDE_DIR - NAMES glm/glm.hpp - PATHS - /usr/include - /usr/local/include - /sw/include - /opt/local/include - ${GLM_ROOT} - DOC "The directory where GLM/glm.h resides") -endif() - -# Handle REQUIRD argument, define *_FOUND variable -find_package_handle_standard_args(GLM DEFAULT_MSG GLM_INCLUDE_DIR) - -# Define GLM_LIBRARIES and GLM_INCLUDE_DIRS -if (GLM_FOUND) - set(GLM_INCLUDE_DIRS ${GLM_INCLUDE_DIR}) -endif() - -# Hide some variables -mark_as_advanced(GLM_INCLUDE_DIR) \ No newline at end of file diff --git a/cmake/FindJSON.cmake b/cmake/FindJSON.cmake deleted file mode 100644 index 4d39726..0000000 --- a/cmake/FindJSON.cmake +++ /dev/null @@ -1,41 +0,0 @@ -# -# Find nlohmann_json -# -# Try to find nlohmann_json library -# This module defines the following variables: -# - JSON_INCLUDE_DIRS -# - JSON_FOUND -# -# The following variables can be set as arguments for the module. -# - JSON_ROOT : Root library directory of json -# - -# Additional modules -include(FindPackageHandleStandardArgs) - -if(JSON_MultipleHeaders) - find_path( - JSON_INCLUDE_DIR - NAMES nlohmann/json.hpp - PATHS - $ENV{PROGRAMFILES}/include - ${JSON_ROOT}/single_include - DOC "The directory where nlohmann/json.hpp resides") -else() - find_path( - JSON_INCLUDE_DIR - NAMES nlohmann/json.hpp - PATHS - $ENV{PROGRAMFILES}/include - ${JSON_ROOT}/include - DOC "The directory where nlohmann/json.hpp resides") -endif() - -find_package_handle_standard_args(JSON DEFAULT_MSG JSON_INCLUDE_DIR) - -if(JSON_FOUND) - set(JSON_INCLUDE_DIRS ${JSON_INCLUDE_DIR}) -endif() - -# Hide some variables -mark_as_advanced(JSON_INCLUDE_DIR) \ No newline at end of file diff --git a/cmake/FindKTX.cmake b/cmake/FindKTX.cmake deleted file mode 100644 index fc96699..0000000 --- a/cmake/FindKTX.cmake +++ /dev/null @@ -1,84 +0,0 @@ -# -# Find KTX -# -# Try to find KTX library. -# This module defines the following variables: -# - KTX_INCLUDE_DIRS -# - KTX_LIBRARIES -# - KTX_FOUND -# -# The following variables can be set as arguments for the module. -# - KTX_ROOT : Root library directory of KTX -# - KTX_USE_STATIC_LIBS : Specifies to use static version of KTX library (Windows only) -# -# - -# Additional modules -include(FindPackageHandleStandardArgs) - -if (WIN32) - # Find include files - find_path( - KTX_INCLUDE_DIR - NAMES ktx.h - PATHS - $ENV{PROGRAMFILES}/include - ${KTX_ROOT}/include - DOC "The directory where ktx.h resides") - - # Find library files - find_library( - KTX_LIBRARY - NAMES ktx${CMAKE_DEBUG_POSTFIX}.lib - PATHS - $ENV{PROGRAMFILES}/lib - ${KTX_ROOT} - ${KTX_ROOT}/lib - PATH_SUFFIXES Debug Release) - - find_file( - KTX_BINARY - NAMES ktx${CMAKE_DEBUG_POSTFIX}.dll - PATHS - $ENV{PROGRAMFILES}/lib - ${KTX_ROOT} - ${KTX_ROOT}/lib - PATH_SUFFIXES Debug Release) -else() - # Find include files - find_path( - KTX_INCLUDE_DIR - NAMES ktx.h - PATHS - /usr/include - /usr/local/include - /sw/include - /opt/local/include - ${KTX_ROOT} - DOC "The directory where KTX/ktx.h resides") - - find_library( - KTX_LIBRARY - NAMES libktx${CMAKE_DEBUG_POSTFIX}.so - PATHS - /usr/include - /usr/local/include - /sw/include - /opt/local/include - ${KTX_ROOT} - DOC "The directory where KTX/libktx.so resides") -endif() - -# Handle REQUIRD argument, define *_FOUND variable -find_package_handle_standard_args(KTX DEFAULT_MSG KTX_INCLUDE_DIR KTX_LIBRARY) - -# Define KTX_LIBRARIES and KTX_INCLUDE_DIRS -if (KTX_FOUND) - set(KTX_INCLUDE_DIRS ${KTX_INCLUDE_DIR}) - set(KTX_LIBRARIES ${KTX_LIBRARY}) - set(KTX_BINARIES ${KTX_BINARY}) -endif() - -# Hide some variables -mark_as_advanced(KTX_INCLUDE_DIR) -mark_as_advanced(KTX_LIBRARY) \ No newline at end of file diff --git a/cmake/FindSLANG.cmake b/cmake/FindSLANG.cmake deleted file mode 100644 index b9cd7be..0000000 --- a/cmake/FindSLANG.cmake +++ /dev/null @@ -1,82 +0,0 @@ -# -# Find SLANG -# -# Try to find SLANG library. -# This module defines the following variables: -# - SLANG_INCLUDE_DIRS -# - SLANG_LIBRARIES -# - SLANG_FOUND -# -# The following variables can be set as arguments for the module. -# - SLANG_ROOT : Root library directory of SLANG -# -# References: -# - https://github.com/progschj/OpenGL-Examples/blob/master/cmake_modules/FindSLANG.cmake -# - https://bitbucket.org/Ident8/cegui-mk2-opengl3-renderer/src/befd47200265/cmake/FindSLANG.cmake -# - -# Additional modules -include(FindPackageHandleStandardArgs) - -if (WIN32) - set(SLANG_BINARY_PATH ${SLANG_ROOT}/bin/windows-${CMAKE_PLATFORM}/release/) - # Find include files - find_path( - SLANG_INCLUDE_DIR - NAMES slang.h - PATHS - $ENV{PROGRAMFILES}/include - ${SLANG_ROOT} - DOC "The directory where SLANG/slang.h resides") - - # Find library files - find_library( - SLANG_LIBRARY - NAMES slang.lib - PATHS - $ENV{PROGRAMFILES}/lib - ${SLANG_BINARY_PATH}) - - find_file( - SLANG_BINARY - NAMES slang.dll - PATHS - ${SLANG_BINARY_PATH}) - - find_file( - SLANG_GLSLANG - NAMES slang-glslang.dll - PATHS - ${SLANG_BINARY_PATH}) -else() - set(SLANG_BINARY_PATH ${SLANG_ROOT}/bin/linux-${CMAKE_PLATFORM}/release/) - # Find include files - find_path( - SLANG_INCLUDE_DIR - NAMES slang.h - PATHS - ${SLANG_ROOT} - DOC "The directory where GL/glfw.h resides") - - # Find library files - find_library( - SLANG_LIBRARY - NAMES libslang.so - PATHS - ${SLANG_BINARY_PATH} - NO_DEFAULT_PATH - DOC "The SLANG library") -endif() - -# Handle REQUIRD argument, define *_FOUND variable -find_package_handle_standard_args(SLANG DEFAULT_MSG SLANG_INCLUDE_DIR SLANG_LIBRARY) - -# Define SLANG_LIBRARIES and SLANG_INCLUDE_DIRS -if (SLANG_FOUND) - set(SLANG_BINARIES ${SLANG_BINARY}) - set(SLANG_LIBRARIES ${SLANG_LIBRARY}) - set(SLANG_INCLUDE_DIRS ${SLANG_INCLUDE_DIR}) -endif() - -# Hide some variables -mark_as_advanced(SLANG_INCLUDE_DIR SLANG_LIBRARY SLANG_GLSLANG SLANG_BINARY) \ No newline at end of file diff --git a/cmake/FindSPIRV.cmake b/cmake/FindSPIRV.cmake deleted file mode 100644 index 0756e42..0000000 --- a/cmake/FindSPIRV.cmake +++ /dev/null @@ -1,50 +0,0 @@ -# -# Find SPIR-V Cross -# -# Try to find SPIR-V Cross library. -# This module defines the following variables: -# - SPIRV_INCLUDE_DIRS -# - SPIRV_LIBRARIES -# - SPIRV_FOUND -# -# The following variables can be set as arguments for the module. -# - SPIRV_ROOT : Root library directory of SPIR-V Cross -# -# References: -# - https://github.com/progschj/OpenGL-Examples/blob/master/cmake_modules/FindGLFW.cmake -# - https://bitbucket.org/Ident8/cegui-mk2-opengl3-renderer/src/befd47200265/cmake/FindGLFW.cmake -# - -# Additional modules -include(FindPackageHandleStandardArgs) -find_path(SPIRV_INCLUDE_DIR - NAMES spirv.h - PATHS - ${SPIRV_ROOT}) - -find_library(SPIRV_CORE_LIBRARY -NAMES spirv-cross-core${CMAKE_DEBUG_POSTFIX} -PATHS - ${Seele_BINARY_DIR}/external/SPIRV-Cross) - - -find_library(SPIRV_GLSL_LIBRARY -NAMES spirv-cross-glsl${CMAKE_DEBUG_POSTFIX} -PATHS - ${Seele_BINARY_DIR}/external/SPIRV-Cross) - -find_library(SPIRV_REFLECT_LIBRARY - NAMES spirv-cross-reflect${CMAKE_DEBUG_POSTFIX} - PATHS - ${Seele_BINARY_DIR}/external/SPIRV-Cross) - - -find_package_handle_standard_args(SPIRV DEFAULT_MSG SPIRV_CORE_LIBRARY SPIRV_GLSL_LIBRARY SPIRV_REFLECT_LIBRARY SPIRV_INCLUDE_DIR) - -if(SPIRV_FOUND) - set(SPIRV_LIBRARIES ${SPIRV_CORE_LIBRARY} ${SPIRV_GLSL_LIBRARY} ${SPIRV_REFLECT_LIBRARY}) - set(SPIRV_INCLUDE_DIRS ${SPIRV_INCLUDE_DIR}) -endif() - -mark_as_advanced(SPIRV_INCLUDE_DIR SPIRV_LIBRARY) - diff --git a/cmake/FindSTB.cmake b/cmake/FindSTB.cmake deleted file mode 100644 index 3d6ce1d..0000000 --- a/cmake/FindSTB.cmake +++ /dev/null @@ -1,51 +0,0 @@ -# -# Find STB -# -# Try to find STB library. -# This module defines the following variables: -# - STB_INCLUDE_DIRS -# - STB_LIBRARIES -# - STB_FOUND -# -# The following variables can be set as arguments for the module. -# - STB_ROOT : Root library directory of STB -# - STB_USE_STATIC_LIBS : Specifies to use static version of STB library (Windows only) -# -# - -# Additional modules -include(FindPackageHandleStandardArgs) - -if (WIN32) - # Find include files - find_path( - STB_INCLUDE_DIR - NAMES stb.h - PATHS - $ENV{PROGRAMFILES}/include - ${STB_ROOT}/include - DOC "The directory where STB/stb.h resides") -else() - # Find include files - find_path( - STB_INCLUDE_DIR - NAMES stb.h - PATHS - /usr/include - /usr/local/include - /sw/include - /opt/local/include - ${STB_ROOT} - DOC "The directory where STB/stb.h resides") -endif() - -# Handle REQUIRD argument, define *_FOUND variable -find_package_handle_standard_args(STB DEFAULT_MSG STB_INCLUDE_DIR) - -# Define STB_LIBRARIES and STB_INCLUDE_DIRS -if (STB_FOUND) - set(STB_INCLUDE_DIRS ${STB_INCLUDE_DIR}) -endif() - -# Hide some variables -mark_as_advanced(STB_INCLUDE_DIR) \ No newline at end of file diff --git a/cmake/FindTTFParser.cmake b/cmake/FindTTFParser.cmake deleted file mode 100644 index a13f268..0000000 --- a/cmake/FindTTFParser.cmake +++ /dev/null @@ -1,68 +0,0 @@ -# -# Find TTFPARSER -# -# Try to find TTFPARSER library. -# This module defines the following variables: -# - TTFPARSER_INCLUDE_DIRS -# - TTFPARSER_LIBRARIES -# - TTFPARSER_FOUND -# -# The following variables can be set as arguments for the module. -# - TTFPARSER_ROOT : Root library directory of TTFPARSER -# - TTFPARSER_USE_STATIC_LIBS : Specifies to use static version of TTFPARSER library (Windows only) -# -# References: -# - https://github.com/progschj/OpenGL-Examples/blob/master/cmake_modules/FindTTFPARSER.cmake -# - https://bitbucket.org/Ident8/cegui-mk2-opengl3-renderer/src/befd47200265/cmake/FindTTFPARSER.cmake -# - -# Additional modules -include(FindPackageHandleStandardArgs) - -if (WIN32) - # Find include files - find_path( - TTFPARSER_INCLUDE_DIR - NAMES ttfParser.h - PATHS - $ENV{PROGRAMFILES}/include - ${TTFPARSER_ROOT}/src - DOC "The directory where TTFPARSER/glfw.h resides") - -else() - # Find include files - find_path( - TTFPARSER_INCLUDE_DIR - NAMES TTFPARSER/glfw3.h - PATHS - /usr/include - /usr/local/include - /sw/include - /opt/local/include - DOC "The directory where GL/glfw.h resides") - - # Find library files - find_file( - TTFPARSER_LIBRARY - NAMES libglfw${CMAKE_DEBUG_POSTFIX}.so - PATHS - /usr/lib64 - /usr/lib - /usr/local/lib64 - /usr/local/lib - /sw/lib - /opt/local/lib - ${TTFPARSER_ROOT}/src - ) -endif() - -# Handle REQUIRD argument, define *_FOUND variable -find_package_handle_standard_args(TTFPARSER DEFAULT_MSG TTFPARSER_INCLUDE_DIR) - -# Define TTFPARSER_LIBRARIES and TTFPARSER_INCLUDE_DIRS -if (TTFPARSER_FOUND) - set(TTFPARSER_INCLUDE_DIRS ${TTFPARSER_INCLUDE_DIR}) -endif() - -# Hide some variables -mark_as_advanced(TTFPARSER_INCLUDE_DIR) \ No newline at end of file diff --git a/cmake/SuperBuild.cmake b/cmake/SuperBuild.cmake index 985c82b..dbfefc1 100644 --- a/cmake/SuperBuild.cmake +++ b/cmake/SuperBuild.cmake @@ -1,57 +1,39 @@ include (ExternalProject) -set(DEPENDENCIES) -set(EXTRA_CMAKE_ARGS) #------------ASSIMP--------------- -list(APPEND DEPENDENCIES assimp) set(ASSIMP_BUILD_TESTS OFF CACHE INTERNAL "") set(ASSIMP_BUILD_SAMPLES OFF CACHE INTERNAL "") set(ASSIMP_BUILD_OVERALLS OFF CACHE INTERNAL "") set(BUILD_SHARED_LIBS ON CACHE INTERNAL "") -add_subdirectory(${ASSIMP_ROOT} ${ASSIMP_ROOT}) +add_subdirectory(${ASSIMP_ROOT}) target_compile_definitions(assimp PRIVATE _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING) if(WIN32) - target_compile_options(assimp PRIVATE /WX-) + target_compile_options(assimp PRIVATE /WX-) else() - target_compile_options(assimp PRIVATE -Wno-error -fPIC) - target_compile_options(IrrXML PRIVATE -fPIC) + target_compile_options(assimp PRIVATE -Wno-error -fPIC) + target_compile_options(IrrXML PRIVATE -fPIC) endif() #-------------BOOST---------------- -list(APPEND DEPENDENCIES boost) -if(WIN32) - set(BOOTSTRAP_EXTENSION bat) -else() - set(BOOTSTRAP_EXTENSION sh) -endif() -ExternalProject_Add(boost - SOURCE_DIR ${BOOST_ROOT} - CONFIGURE_COMMAND ./bootstrap.${BOOTSTRAP_EXTENSION} --with-libraries=serialization,test - BUILD_COMMAND ./b2 -d0 -link=shared - BUILD_IN_SOURCE 1 - INSTALL_COMMAND "") - -list (APPEND EXTRA_CMAKE_ARGS - -DBoost_NO_SYSTEM_PATHS=ON) +add_subdirectory(${BOOST_ROOT}) #-----------------KTX---------------------------- -list(APPEND DEPENDENCIES ktx) - find_program(BASH_EXECUTABLE git-bash) set(KTX_FEATURE_TESTS off) add_subdirectory(${KTX_ROOT} ${KTX_ROOT}) #--------------------JSON------------------ -list(APPEND DEPENDENCIES nlohmann_json) set(JSON_MultipleHeaders ON CACHE INTERNAL "") set(JSON_BuildTests OFF CACHE INTERNAL "") set(JSON_Install OFF CACHE INTERNAL "") -add_subdirectory(${JSON_ROOT} ${JSON_ROOT}) +add_subdirectory(${JSON_ROOT}) + +#--------------GLM------------------------------ +add_subdirectory(${GLM_ROOT}) #--------------GLFW------------------------------ -list(APPEND DEPENDENCIES glfw) set(ENKITS_BUILD_EXAMPLES OFF CACHE BOOL "Build basic example applications" ) set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "GLFW lib only" ) set(GLFW_BUILD_TESTS OFF CACHE BOOL "GLFW lib only" ) @@ -59,43 +41,50 @@ set(GLFW_BUILD_DOCS OFF CACHE BOOL "GLFW lib only" ) set(GLFW_BUILD_INSTALL OFF CACHE BOOL "GLFW lib only" ) set(GLFW_VULKAN_STATIC OFF CACHE BOOL "GLFW vulkan static") -add_subdirectory(${GLFW_ROOT} ${GLFW_ROOT}) +add_subdirectory(${GLFW_ROOT}) #--------------EnTT------------------------------ -list(APPEND DEPENDENCIES EnTT) - -add_subdirectory(${ENTT_ROOT} ${ENTT_ROOT}) +add_subdirectory(${ENTT_ROOT}) #--------------FreeType------------------------------ -list(APPEND DEPENDENCIES freetype) +add_subdirectory(${FREETYPE_ROOT}) + +#--------------STB----------------------------------- +add_library(stb INTERFACE) + +target_include_directories(stb INTERFACE ${STB_ROOT}) + +#--------------Aftermath------------------------------ +add_library(nsam INTERFACE) + +target_include_directories(nsam INTERFACE ${NSAM_ROOT}/include) +target_link_libraries(nsam INTERFACE ${NSAM_ROOT}/lib/${CMAKE_PLATFORM}/*.lib) +set_target_properties(nsam PROPERTIES NSAM_BINARY ${NSAM_ROOT}/lib/${CMAKE_PLATFORM}/GFSDK_Aftermath_Lib.${CMAKE_PLATFORM}.dll) +set_target_properties(nsam PROPERTIES LLVM_BINARY ${NSAM_ROOT}/lib/${CMAKE_PLATFORM}/llvm_7_0_1.dll) -add_subdirectory(${FREETYPE_ROOT} ${FREETYPE_ROOT}) #--------------SLang------------------------------ -list(APPEND DEPENDENCIES slang) string(TOLOWER release_${CMAKE_PLATFORM} SLANG_CONFIG) if(WIN32) -ExternalProject_Add(slang - SOURCE_DIR ${SLANG_ROOT} - BINARY_DIR ${SLANG_ROOT} - CONFIGURE_COMMAND premake.bat vs2019 --file=${CMAKE_SOURCE_DIR}/external/slang/premake5.lua gmake --arch=${CMAKE_PLATFORM} --deps=true - BUILD_COMMAND msbuild slang.sln -p:Configuration=Release -p:Platform=${CMAKE_PLATFORM} - INSTALL_COMMAND "") +string(TOLOWER ${SLANG_ROOT}/bin/windows-${CMAKE_PLATFORM}/release SLANG_BINARY_DIR) +ExternalProject_Add(slang-build + SOURCE_DIR ${SLANG_ROOT} + BINARY_DIR ${SLANG_ROOT} + CONFIGURE_COMMAND ${SLANG_ROOT}/premake.bat vs2019 --file=${CMAKE_SOURCE_DIR}/external/slang/premake5.lua gmake --arch=${CMAKE_PLATFORM} --deps=true + BUILD_COMMAND msbuild slang.sln -p:Configuration=Release -p:Platform=${CMAKE_PLATFORM} + INSTALL_COMMAND "") elseif(UNIX) -ExternalProject_Add(slang - SOURCE_DIR ${SLANG_ROOT} - BINARY_DIR ${SLANG_ROOT} - CONFIGURE_COMMAND ${CMAKE_SOURCE_DIR}/premake5 --file=${CMAKE_SOURCE_DIR}/external/slang/premake5.lua gmake --arch=${CMAKE_PLATFORM} --deps=true --build-location=build/linux - BUILD_COMMAND make -C ${CMAKE_SOURCE_DIR}/external/slang/build/linux config=${SLANG_CONFIG} - INSTALL_COMMAND "") +ExternalProject_Add(slang-build + SOURCE_DIR ${SLANG_ROOT} + BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} + CONFIGURE_COMMAND ${CMAKE_SOURCE_DIR}/premake5 --file=${CMAKE_SOURCE_DIR}/external/slang/premake5.lua gmake --arch=${CMAKE_PLATFORM} --deps=true --build-location=build/linux + BUILD_COMMAND make -C ${CMAKE_SOURCE_DIR}/external/slang/build/linux config=${SLANG_CONFIG} + INSTALL_COMMAND "") endif() +add_library(slang INTERFACE) -#-----------------SeeleEngine-------------------- -ExternalProject_Add(SeeleEngine - DEPENDS ${DEPENDENCIES} - SOURCE_DIR ${PROJECT_SOURCE_DIR} - PREFIX ${CMAKE_BINARY_DIR} - BINARY_DIR ${CMAKE_BINARY_DIR} - CMAKE_ARGS -DUSE_SUPERBUILD=OFF ${EXTRA_CMAKE_ARGS} - INSTALL_COMMAND "") +target_include_directories(slang INTERFACE ${SLANG_ROOT}) +target_link_libraries(slang INTERFACE ${SLANG_BINARY_DIR}/*.lib) +set_target_properties(slang PROPERTIES SLANG_BINARY ${SLANG_BINARY_DIR}/slang.dll) +set_target_properties(slang PROPERTIES GLSLANG_BINARY ${SLANG_BINARY_DIR}/slang-glslang.dll) diff --git a/external/ktx b/external/ktx index a2ccc90..d1a25c8 160000 --- a/external/ktx +++ b/external/ktx @@ -1 +1 @@ -Subproject commit a2ccc90effc8a5831a271ea033a9e38e26e63a59 +Subproject commit d1a25c8a20607a432b2d910a7a761d663c907e8e diff --git a/external/slang b/external/slang index 2e1a84a..ec530b3 160000 --- a/external/slang +++ b/external/slang @@ -1 +1 @@ -Subproject commit 2e1a84add57efd9f8a50a88d0569a48ae4b6d834 +Subproject commit ec530b300524635dfe0fd86949b0a4fc5c19a984 diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 408d5df..b2b8765 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -1,19 +1,15 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ".") find_package(Boost COMPONENTS unit_test_framework REQUIRED) -find_package(Aftermath REQUIRED) +find_package(Vulkan REQUIRED) add_subdirectory(Engine/) target_include_directories(Seele_unit_tests PRIVATE ${ENGINE_ROOT}) -target_include_directories(Seele_unit_tests PRIVATE ${Boost_INCLUDE_DIRS}) -target_include_directories(Seele_unit_tests PRIVATE ${GLM_INCLUDE_DIRS}) -target_include_directories(Seele_unit_tests PRIVATE ${Vulkan_INCLUDE_DIR}) -target_include_directories(Seele_unit_tests PRIVATE ${NSAM_INCLUDE_DIRS}) -target_link_libraries(Seele_unit_tests ${Boost_LIBRARIES}) -target_link_libraries(Seele_unit_tests ${Vulkan_LIBRARY}) -target_link_libraries(Seele_unit_tests ${NSAM_LIBRARIES}) +target_link_libraries(Seele_unit_tests PRIVATE Boost::unit_test_framework) +target_link_libraries(Seele_unit_tests PRIVATE Vulkan::Vulkan) +target_link_libraries(Seele_unit_tests PRIVATE nsam) if(UNIX) target_compile_definitions(Seele_unit_tests PRIVATE -DBOOST_TEST_DYN_LINK) endif()