Commit 3d27f2e7 by Chris Forbes

Initial cmake support for vulkan target

Change-Id: I34b47a5327055f804951793d9a8a58f771d9b792 Bug: b/116336664 Reviewed-on: https://swiftshader-review.googlesource.com/20988Reviewed-by: 's avatarNicolas Capens <nicolascapens@google.com> Tested-by: 's avatarChris Forbes <chrisforbes@google.com>
parent 96a1ceb1
......@@ -52,6 +52,7 @@ if(WIN32)
endif()
option(BUILD_GLESv2 "Build the OpenGL ES 2 library" 1)
option(BUILD_GLES_CM "Build the OpenGL ES 1.1 library" 1)
option(BUILD_VULKAN "Build the Vulkan library" 1)
option(USE_GROUP_SOURCES "Group the source files in a folder tree for Visual Studio" 1)
......@@ -161,6 +162,7 @@ endif()
set(SOURCE_DIR ${CMAKE_SOURCE_DIR}/src)
set(OPENGL_DIR ${SOURCE_DIR}/OpenGL)
set(OPENGL_COMPILER_DIR ${OPENGL_DIR}/compiler)
set(VULKAN_DIR ${SOURCE_DIR}/Vulkan)
if(SWIFTSHADER_LLVM_VERSION EQUAL 3)
set(LLVM_DIR ${CMAKE_SOURCE_DIR}/third_party/LLVM)
else()
......@@ -1767,6 +1769,12 @@ set(OPENGL_INCLUDE_DIR
${COMMON_INCLUDE_DIR}
)
set(VULKAN_INCLUDE_DIR
${VULKAN_DIR}
${COMMON_INCLUDE_DIR}
)
###########################################################
# File Lists
###########################################################
......@@ -1864,6 +1872,12 @@ file(GLOB_RECURSE OPENGL_COMPILER_OS_SPECIFIC_LIST
)
list(REMOVE_ITEM OPENGL_COMPILER_LIST ${OPENGL_COMPILER_OS_SPECIFIC_LIST})
file(GLOB_RECURSE VULKAN_LIST
${VULKAN_DIR}/*.cpp
${VULKAN_DIR}/*.h
${CMAKE_SOURCE_DIR}/include/vulkan/*.h}
)
###########################################################
# Append OS specific files to lists
###########################################################
......@@ -2037,6 +2051,26 @@ if(BUILD_GLES_CM)
)
endif()
if(BUILD_VULKAN)
add_library(libvk_swiftshader SHARED ${VULKAN_LIST})
set_target_properties(libvk_swiftshader PROPERTIES
INCLUDE_DIRECTORIES "${VULKAN_INCLUDE_DIR}"
FOLDER "Vulkan"
COMPILE_DEFINITIONS "NO_SANITIZE_FUNCTION=;"
PREFIX ""
)
set_shared_library_export_map(libvk_swiftshader ${SOURCE_DIR}/Vulkan)
target_link_libraries(libvk_swiftshader ${OS_LIBS})
add_custom_command(
TARGET libvk_swiftshader
POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory $<TARGET_FILE_DIR:libvk_swiftshader>/translator
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:libvk_swiftshader> $<TARGET_FILE_DIR:libvk_swiftshader>/translator/${LIB_PREFIX}Vulkan_translator${CMAKE_SHARED_LIBRARY_SUFFIX}
COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_SOURCE_DIR}/out/${CMAKE_SYSTEM_NAME}/
COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:libvk_swiftshader> ${CMAKE_SOURCE_DIR}/out/${CMAKE_SYSTEM_NAME}/
)
endif()
###########################################################
# Sample programs
###########################################################
......
......@@ -12,7 +12,7 @@
// See the License for the specific language governing permissions and
// limitations under the License.
#include "vkdebug.hpp"
#include "VkDebug.hpp"
#include <stdarg.h>
......@@ -35,4 +35,4 @@ void trace(const char *format, ...)
}
}
}
}
\ No newline at end of file
}
......@@ -15,7 +15,7 @@
#include "VkDebug.hpp"
#include "VkGetProcAddress.h"
#include <vulkan/vulkan.h>
#include <string>
#include <cstring>
extern "C"
{
......@@ -1280,4 +1280,4 @@ VKAPI_ATTR void VKAPI_CALL vkGetDescriptorSetLayoutSupport(VkDevice device, cons
UNIMPLEMENTED();
}
}
\ No newline at end of file
}
{
global:
# Loader-ICD interface functions
vk_icdGetInstanceProcAddr;
# Type-strings and type-infos required by sanitizers
_ZTS*;
_ZTI*;
local:
*;
};
......@@ -14,10 +14,10 @@
// main.cpp: DLL entry point.
#if defined(_WIN32)
#include "resource.h"
#include <windows.h>
#if defined(_WIN32)
#ifdef DEBUGGER_WAIT_DIALOG
static INT_PTR CALLBACK DebuggerWaitDialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
......@@ -75,4 +75,4 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE instance, DWORD reason, LPVOID reserved
return TRUE;
}
#endif
\ No newline at end of file
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment