Merge branch 'development' into 'development'

Development

See merge request gpuopen/GPUOpen-LibrariesAndSDKs/d3d12memoryallocator!1
This commit is contained in:
Sawicki, Adam 2021-10-06 11:36:30 +00:00
commit ae0e4ba71a
6 changed files with 140 additions and 84 deletions

32
CMakeLists.txt Normal file
View File

@ -0,0 +1,32 @@
cmake_minimum_required(VERSION 3.9)
project(D3D12MemoryAllocator)
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
find_package(Doxygen)
option(BUILD_DOCUMENTATION "Create and install the HTML based API documentation (requires Doxygen)" OFF)
if (DOXYGEN_FOUND AND BUILD_DOCUMENTATION)
# set input and output files
set(DOXYGEN_IN ${CMAKE_CURRENT_SOURCE_DIR}/src/Doxyfile)
set(DOXYGEN_OUT ${CMAKE_CURRENT_BINARY_DIR}/Doxyfile)
# request to configure the file
configure_file(${DOXYGEN_IN} ${DOXYGEN_OUT} @ONLY)
# note the option ALL which allows to build the docs together with the application
add_custom_target( doc_doxygen ALL
COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_OUT}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating API documentation with Doxygen"
VERBATIM )
else (DOXYGEN_FOUND AND BUILD_DOCUMENTATION)
message("Doxygen need to be installed to generate the doxygen documentation")
endif (DOXYGEN_FOUND AND BUILD_DOCUMENTATION)
# D3D12MemoryAllocator contains an sample application which is not build by default
option(D3D12MA_BUILD_SAMPLE "Build D3D12MemoryAllocator sample application" OFF)
message(STATUS "D3D12MA_BUILD_SAMPLE = ${D3D12MA_BUILD_SAMPLE}")
add_subdirectory(src)

View File

@ -1,27 +0,0 @@
Copyright (c) 2003-2016 Jason Perkins and individual contributors.
All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
3. Neither the name of Premake nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Binary file not shown.

View File

@ -1,56 +0,0 @@
-- _ACTION is a premake global variable and for our usage will be vs2012, vs2013, etc.
-- Strip "vs" from this string to make a suffix for solution and project files.
_SUFFIX = _ACTION
workspace "D3D12Sample"
configurations { "Debug", "Release" }
platforms { "x64" }
location "../build"
filename ("D3D12Sample_" .. _SUFFIX)
startproject "D3D12Sample"
filter "platforms:x64"
system "Windows"
architecture "x64"
includedirs { }
libdirs { }
project "D3D12Sample"
kind "ConsoleApp"
language "C++"
location "../build"
filename ("D3D12Sample_" .. _SUFFIX)
targetdir "../bin"
objdir "../build/Desktop_%{_SUFFIX}/%{cfg.platform}/%{cfg.buildcfg}"
floatingpoint "Fast"
files { "../src/*.h", "../src/*.cpp" }
flags { "NoPCH", "FatalWarnings" }
characterset "Unicode"
warnings "Extra"
disablewarnings "4127" -- conditional expression is constant
disablewarnings "4100" -- unreferenced formal parameter
disablewarnings "4324" -- structure was padded due to alignment specifier
disablewarnings "4189" -- local variable is initialized but not referenced
disablewarnings "4201" -- nonstandard extension used: nameless struct/union
filter "configurations:Debug"
defines { "_DEBUG", "DEBUG" }
flags { }
targetsuffix ("_Debug_" .. _SUFFIX)
filter "configurations:Release"
defines { "NDEBUG" }
optimize "On"
flags { "LinkTimeOptimization" }
targetsuffix ("_Release_" .. _SUFFIX)
filter { "platforms:x64" }
defines { "WIN32", "_CONSOLE", "PROFILE", "_WINDOWS", "_WIN32_WINNT=0x0601" }
links { "d3d12.lib", "dxgi.lib", "shlwapi.lib" }
filter { "configurations:Debug", "platforms:x64" }
buildoptions { "/MDd" }
filter { "configurations:Release", "platforms:Windows-x64" }
buildoptions { "/MD" }

107
src/CMakeLists.txt Normal file
View File

@ -0,0 +1,107 @@
set(D3D12MA_LIBRARY_SOURCE_FILES
D3D12MemAlloc.h
D3D12MemAlloc.cpp
)
set(CMAKE_DEBUG_POSTFIX d)
set(CMAKE_RELWITHDEBINFO_POSTFIX rd)
set(CMAKE_MINSIZEREL_POSTFIX s)
add_library(D3D12MemoryAllocator ${D3D12MA_LIBRARY_SOURCE_FILES})
set_target_properties(
D3D12MemoryAllocator PROPERTIES
CXX_EXTENSIONS OFF
# Use C++14
CXX_STANDARD 14
CXX_STANDARD_REQUIRED ON
)
target_link_libraries(D3D12MemoryAllocator PUBLIC
d3d12.lib
dxgi.lib
dxguid.lib
)
install(TARGETS D3D12MemoryAllocator DESTINATION lib)
install(FILES D3D12MemAlloc.h DESTINATION include)
if (D3D12MA_BUILD_SAMPLE)
if(WIN32)
set(D3D12_SAMPLE_SOURCE_FILES
Common.cpp
Tests.cpp
D3D12Sample.cpp
)
set( VERTEX_SHADERS
Shaders/VS.hlsl
)
set( PIXEL_SHADERS
Shaders/PS.hlsl
)
set( SHADERS
${VERTEX_SHADERS}
${PIXEL_SHADERS}
)
source_group( "Resources\\Shaders" FILES ${SHADERS} )
set_source_files_properties( ${VERTEX_SHADERS}
PROPERTIES
VS_SHADER_TYPE Vertex
)
set_source_files_properties( ${PIXEL_SHADERS}
PROPERTIES
VS_SHADER_TYPE Pixel
)
add_executable(D3D12Sample ${D3D12_SAMPLE_SOURCE_FILES} ${SHADERS})
# Visual Studio specific settings
if(${CMAKE_GENERATOR} MATCHES "Visual Studio.*")
# Use Unicode instead of multibyte set
add_compile_definitions(UNICODE _UNICODE)
# Set VmaSample as startup project
set_property(DIRECTORY ${PROJECT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT "D3D12Sample")
# Enable multithreaded compiling
target_compile_options(D3D12Sample PRIVATE "/MP")
# Set working directory for Visual Studio debugger
set_target_properties(
D3D12Sample
PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${PROJECT_SOURCE_DIR}/bin"
)
endif()
set_target_properties(
D3D12Sample PROPERTIES
CXX_EXTENSIONS OFF
# Use C++14
CXX_STANDARD 14
CXX_STANDARD_REQUIRED ON
)
target_link_libraries(
D3D12Sample
PRIVATE D3D12MemoryAllocator
PUBLIC d3d12.lib
PUBLIC dxgi.lib
PUBLIC dxguid.lib
PUBLIC Shlwapi.lib
)
else()
message(STATUS "D3D12Sample application is not supported to Linux")
endif()
endif()
if(D3D12MA_BUILD_SAMPLE_SHADERS)
# add_subdirectory(Shaders)
endif()

View File

@ -823,7 +823,7 @@ WARN_LOGFILE =
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING # spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched. # Note: If this tag is empty the current directory is searched.
INPUT = D3D12MemAlloc.h INPUT = @CMAKE_CURRENT_SOURCE_DIR@/src/D3D12MemAlloc.h
# This tag can be used to specify the character encoding of the source files # This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses # that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses