Redo of render paths

This commit is contained in:
Dynamitos
2020-06-02 11:46:18 +02:00
parent bb5b48698a
commit 356e6058fe
121 changed files with 3890 additions and 572 deletions
+95
View File
@@ -0,0 +1,95 @@
#
# 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${LIBRARY_SUFFIX}.lib
PATHS
$ENV{PROGRAMFILES}/lib
${ASSIMP_ROOT}/lib/
PATH_SUFFIXES Debug Release)
find_file(
ASSIMP_BINARY
NAMES assimp${LIBRARY_SUFFIX}.dll
PATHS
$ENV{PROGRAMFILES}/bin
${ASSIMP_ROOT}/bin/
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
DOC "The directory where assimp/scene.h resides")
# Find library files
find_library(
ASSIMP_LIBRARY
NAMES assimp
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
${ASSIMP_ROOT}/lib
DOC "The Assimp library")
find_file(
ASSIMP_BINARY
NAMES assimp.so
PATHS
/usr/bin64
/usr/bin
/usr/local/bin64
/usr/local/bin
/sw/bin
/opt/local/bin
${ASSIMP_ROOT}/lib
DOC "The Assimp binary")
endif()
# Handle REQUIRD argument, define *_FOUND variable
find_package_handle_standard_args(assimp DEFAULT_MSG ASSIMP_INCLUDE_DIR ASSIMP_LIBRARY ASSIMP_BINARY)
# Define GLFW_LIBRARIES and GLFW_INCLUDE_DIRS
if (ASSIMP_FOUND)
set(ASSIMP_LIBRARIES ${ASSIMP_LIBRARY})
set(ASSIMP_INCLUDE_DIRS ${ASSIMP_INCLUDE_DIR})
endif()
message(STATUS BINARY: ${ASSIMP_BINARY})
# Hide some variables
mark_as_advanced(ASSIMP_INCLUDE_DIR ASSIMP_LIBRARY)
+112
View File
@@ -0,0 +1,112 @@
#
# 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.lib for static library
if (GLFW_USE_STATIC_LIBS)
set(GLFW_LIBRARY_NAME glfw3)
else()
set(GLFW_LIBRARY_NAME glfw3dll)
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)
message(STATUS cant find ${GLFW_LIBRARY_NAME} in ${GLFW_ROOT}/src)
unset(GLFW_LIBRARY_NAME)
find_file(
GLFW_BINARY
NAMES glfw3.dll
PATHS
$ENV{PROGRAMFILES}/bin
${GLFW_ROOT}/src
${GLFW_ROOT}/bin
PATH_SUFFIXES Debug Release)
else()
# Find include files
find_path(
GLFW_INCLUDE_DIR
NAMES GLFW/glfw.h
PATHS
/usr/include
/usr/local/include
/sw/include
/opt/local/include
DOC "The directory where GL/glfw.h resides")
# Find library files
# Try to use static libraries
find_library(
GLFW_LIBRARY
NAMES glfw3
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
${GLFW_ROOT}/lib
DOC "The GLFW library")
find_file(
GLFW_BINARY
NAMES glfw3.so
PATHS
/usr/lib64
/usr/lib
/usr/local/lib64
/usr/local/lib
/sw/lib
/opt/local/lib
${GLFW_ROOT}/lib
)
endif()
# Handle REQUIRD argument, define *_FOUND variable
find_package_handle_standard_args(GLFW DEFAULT_MSG GLFW_INCLUDE_DIR GLFW_LIBRARY GLFW_BINARY)
# Define GLFW_LIBRARIES and GLFW_INCLUDE_DIRS
if (GLFW_FOUND)
set(GLFW_LIBRARIES ${OPENGL_LIBRARIES} ${GLFW_LIBRARY})
set(GLFW_INCLUDE_DIRS ${GLFW_INCLUDE_DIR})
endif()
# Hide some variables
mark_as_advanced(GLFW_INCLUDE_DIR GLFW_LIBRARY)
+41
View File
@@ -0,0 +1,41 @@
#
# 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)
+32 -34
View File
@@ -1,12 +1,19 @@
include (ExternalProject)
set_property(DIRECTORY PROPERTY EP_BASE external)
set(DEPENDENCIES)
set(EXTRA_CMAKE_ARGS)
set(DEPENDENT_BINARIES "")
execute_process(COMMAND git submodule update --init --recursive -- ${CMAKE_SOURCE_DIR})
#------------ASSIMP---------------
list(APPEND DEPENDENCIES assimp)
set(ASSIMP_BUILD_TESTS OFF CACHE INTERNAL "")
set(ASSIMP_BUILD_ASSIMP_TOOLS OFF CACHE INTERNAL "")
set(ASSIMP_INSTALL OFF CACHE INTERNAL "")
set(ASSIMP_INJECT_DEBUG_POSTFIX OFF CACHE INTERNAL "")
add_subdirectory(${ASSIMP_ROOT} ${ASSIMP_ROOT})
target_compile_definitions(assimp PRIVATE _SILENCE_CXX17_ITERATOR_BASE_CLASS_DEPRECATION_WARNING)
#-------------BOOST----------------
list(APPEND DEPENDENCIES boost)
if(WIN32)
@@ -38,48 +45,41 @@ list(APPEND EXTRA_CMAKE_ARGS
)
#--------------------JSON------------------
#list(APPEND DEPENDENCIES nlohmann_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})
export(TARGETS nlohmann_json
NAMESPACE nlohmann_json::
FILE ${nlohmann_json_BINARY_DIR}/json_target.cmake)
list(APPEND EXTRA_CMAKE_ARGS
-DJSON_IMPORT=${nlohmann_json_BINARY_DIR}/json_target.cmake
)
#--------------GLFW------------------------------
list(APPEND DEPENDENCIES glfw)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
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" )
set(GLFW_BUILD_DOCS OFF CACHE BOOL "GLFW lib only" )
set(GLFW_BUILD_INSTALL OFF CACHE BOOL "GLFW lib only" )
add_subdirectory(${GLFW_ROOT})
export(TARGETS glfw
FILE ${GLFW_BINARY_DIR}/glfw.cmake)
add_subdirectory(${GLFW_ROOT} ${GLFW_ROOT})
#---------------STB_IMAGE------------------------
list(APPEND EXTRA_CMAKE_ARGS
-DGLFW_IMPORT=${GLFW_BINARY_DIR}/glfw.cmake
)
-DSTB_INCLUDE_DIRS=${STB_ROOT})
#--------------SLang------------------------------
list(APPEND DEPENDENCIES slang)
string(TOLOWER ${CMAKE_BUILD_TYPE}_${CMAKE_PLATFORM} SLANG_CONFIG)
string(TOLOWER release_${CMAKE_PLATFORM} SLANG_CONFIG)
if(WIN32)
ExternalProject_Add(slang
SOURCE_DIR ${SLANG_ROOT}
BINARY_DIR ${CMAKE_BINARY_DIR}/lib
CONFIGURE_COMMAND devenv /upgrade ${SLANG_ROOT}/source/slang/slang.vcxproj
BUILD_COMMAND msbuild -p:Configuration=${CMAKE_BUILD_TYPE} -p:Platform=${CMAKE_PLATFORM} -p:WindowsTargetPlatformVersion=10.0 ${SLANG_ROOT}/source/slang/slang.vcxproj
BUILD_COMMAND msbuild -p:Configuration=Release -p:Platform=${CMAKE_PLATFORM} -p:WindowsTargetPlatformVersion=10.0 ${SLANG_ROOT}/source/slang/slang.vcxproj
INSTALL_COMMAND "")
string(TOLOWER bin/windows-${CMAKE_PLATFORM}/${CMAKE_BUILD_TYPE}/slang.dll SLANG_BINARY)
string(TOLOWER bin/windows-${CMAKE_PLATFORM}/${CMAKE_BUILD_TYPE}/slang.lib SLANG_LIB_PATH)
string(TOLOWER bin/windows-${CMAKE_PLATFORM}/Release/slang.dll SLANG_BINARY)
string(TOLOWER bin/windows-${CMAKE_PLATFORM}/Release/slang-glslang.dll SLANG_GLSLANG)
string(TOLOWER bin/windows-${CMAKE_PLATFORM}/Release/slang.lib SLANG_LIB_PATH)
set(SLANG_LIB_PATH ${SLANG_ROOT}/${SLANG_LIB_PATH})
elseif(UNIX)
ExternalProject_Add(slang
@@ -89,24 +89,22 @@ ExternalProject_Add(slang
BUILD_COMMAND make -C ${CMAKE_SOURCE_DIR}/external/slang/build.linux config=${SLANG_CONFIG}
INSTALL_COMMAND "")
string(TOLOWER bin/linux-${CMAKE_PLATFORM}/${CMAKE_BUILD_TYPE}/libslang.so SLANG_BINARY)
string(TOLOWER bin/linux-${CMAKE_PLATFORM}/Release/libslang.so SLANG_BINARY)
string(TOLOWER bin/linux-${CMAKE_PLATFORM}/Release/libslang-glslang.so SLANG_GLSLANG)
set(SLANG_LIB_PATH)
endif()
list(APPEND EXTRA_CMAKE_ARGS
-DSLANG_INCLUDE_DIRS=${EXTERNAL_ROOT}/slang
-DSLANG_LIBRARY=${SLANG_LIB_PATH})
list(APPEND DEPENDENT_BINARIES ${SLANG_ROOT}/${SLANG_BINARY})
-DSLANG_LIBRARY=${SLANG_LIB_PATH}
-DSLANG_BINARY=${SLANG_BINARY}
-DSLANG_GLSLANG=${SLANG_GLSLANG})
list(APPEND EXTRA_CMAKE_ARGS
-DDEPENDENT_BINARIES=${DEPENDENT_BINARIES})
#-----------------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 ""
BINARY_DIR ${CMAKE_BINARY_DIR})
INSTALL_COMMAND "")