2015-04-14 20:55:44 +00:00
|
|
|
# The name of our project is "VULKAN". CMakeLists files in this project can
|
|
|
|
# refer to the root source directory of the project as ${VULKAN_SOURCE_DIR} and
|
|
|
|
# to the root binary directory of the project as ${VULKAN_BINARY_DIR}.
|
2015-01-10 15:15:51 +00:00
|
|
|
cmake_minimum_required(VERSION 2.8.11)
|
2015-04-14 20:55:44 +00:00
|
|
|
project (VULKAN)
|
2014-08-01 19:01:47 +00:00
|
|
|
# set (CMAKE_VERBOSE_MAKEFILE 1)
|
2014-07-24 14:36:15 +00:00
|
|
|
|
2015-11-26 17:59:58 +00:00
|
|
|
|
|
|
|
|
2015-07-09 18:44:38 +00:00
|
|
|
# The MAJOR number of the version we're building, used in naming
|
2015-09-08 17:07:46 +00:00
|
|
|
# vulkan-<major>.dll (and other files).
|
2015-11-17 00:01:29 +00:00
|
|
|
set(MAJOR "0")
|
2015-07-09 18:44:38 +00:00
|
|
|
|
2015-12-10 23:25:21 +00:00
|
|
|
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
2015-11-26 17:59:58 +00:00
|
|
|
add_definitions(-DVK_USE_PLATFORM_WIN32_KHR -DWIN32_LEAN_AND_MEAN)
|
2015-12-10 23:25:21 +00:00
|
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
|
|
|
|
add_definitions(-DVK_USE_PLATFORM_ANDROID_KHR)
|
|
|
|
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
|
|
add_definitions(-DVK_USE_PLATFORM_XCB_KHR -DVK_USE_PLATFORM_XLIB_KHR)
|
|
|
|
# TODO: Add support to SDK for Wayland and Mir
|
|
|
|
# add_definitions(-DVK_USE_PLATFORM_MIR_KHR -DVK_USEPLATFORM_WAYLAND_KHR)
|
2015-11-25 20:26:15 +00:00
|
|
|
else()
|
2015-12-10 23:25:21 +00:00
|
|
|
message(FATAL_ERROR "Unsupported Platform!")
|
2015-11-25 20:26:15 +00:00
|
|
|
endif()
|
|
|
|
|
2015-01-10 15:15:51 +00:00
|
|
|
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
|
|
|
|
|
2014-07-24 14:36:15 +00:00
|
|
|
# Header file for CMake settings
|
|
|
|
include_directories("${PROJECT_SOURCE_DIR}/include")
|
|
|
|
|
2014-08-02 01:14:28 +00:00
|
|
|
include(FindPkgConfig)
|
|
|
|
|
2015-07-31 21:15:00 +00:00
|
|
|
set (CMAKE_INSTALL_PREFIX "")
|
|
|
|
|
2015-02-17 16:55:34 +00:00
|
|
|
if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
|
2015-02-13 21:04:01 +00:00
|
|
|
set(COMMON_COMPILE_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers")
|
2015-02-05 21:14:33 +00:00
|
|
|
set(COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -fno-strict-aliasing -fno-builtin-memcmp")
|
2014-12-19 03:34:46 +00:00
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 ${COMMON_COMPILE_FLAGS}")
|
2015-06-23 19:33:48 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_COMPILE_FLAGS} -std=c++11")
|
2014-08-04 00:03:57 +00:00
|
|
|
if (UNIX)
|
|
|
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
|
2015-01-18 03:09:29 +00:00
|
|
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
|
2014-08-04 00:03:57 +00:00
|
|
|
endif()
|
|
|
|
endif()
|
2014-08-02 01:14:28 +00:00
|
|
|
|
2015-10-10 15:43:07 +00:00
|
|
|
option(BUILD_LOADER "Build loader" ON)
|
2015-10-14 23:00:19 +00:00
|
|
|
if(WIN32)
|
|
|
|
option(BUILD_ICD "Build LunarG intel icd" OFF)
|
|
|
|
else()
|
|
|
|
option(BUILD_ICD "Build LunarG intel icd" ON)
|
|
|
|
endif()
|
2015-10-10 15:43:07 +00:00
|
|
|
option(BUILD_TESTS "Build tests" ON)
|
|
|
|
option(BUILD_LAYERS "Build layers" ON)
|
|
|
|
option(BUILD_DEMOS "Build demos" ON)
|
2015-11-25 23:13:36 +00:00
|
|
|
option(BUILD_VKTRACE "Build VkTrace" ON)
|
2015-10-10 15:43:07 +00:00
|
|
|
|
2015-10-14 23:00:44 +00:00
|
|
|
if (BUILD_ICD OR BUILD_TESTS)
|
|
|
|
# Hard code our glslang path for now
|
2015-10-10 15:43:07 +00:00
|
|
|
get_filename_component(GLSLANG_PREFIX ../glslang ABSOLUTE)
|
|
|
|
|
|
|
|
if(NOT EXISTS ${GLSLANG_PREFIX})
|
|
|
|
message(FATAL_ERROR "Necessary glslang components do not exist: " ${GLSLANG_PREFIX})
|
|
|
|
endif()
|
2015-10-14 23:00:44 +00:00
|
|
|
endif()
|
|
|
|
|
|
|
|
if (BUILD_ICD)
|
|
|
|
# Hard code our LunarGLASS path for now
|
|
|
|
get_filename_component(LUNARGLASS_PREFIX ../LunarGLASS ABSOLUTE)
|
2014-10-03 21:34:53 +00:00
|
|
|
|
2015-10-10 15:43:07 +00:00
|
|
|
if(NOT EXISTS ${LUNARGLASS_PREFIX})
|
|
|
|
message(FATAL_ERROR "Necessary LunarGLASS components do not exist: " ${LUNARGLASS_PREFIX})
|
|
|
|
endif()
|
2015-05-21 17:07:47 +00:00
|
|
|
endif()
|
2014-10-03 21:34:53 +00:00
|
|
|
|
2015-05-21 17:07:47 +00:00
|
|
|
if(NOT WIN32)
|
2015-07-23 20:29:26 +00:00
|
|
|
include(GNUInstallDirs)
|
2015-07-24 00:39:37 +00:00
|
|
|
add_definitions(-DSYSCONFDIR="${CMAKE_INSTALL_SYSCONFDIR}")
|
|
|
|
add_definitions(-DDATADIR="${CMAKE_INSTALL_DATADIR}")
|
|
|
|
if (CMAKE_INSTALL_PREFIX STREQUAL "/usr")
|
2015-07-31 21:47:59 +00:00
|
|
|
elseif (CMAKE_INSTALL_PREFIX STREQUAL "")
|
2015-07-24 00:39:37 +00:00
|
|
|
else()
|
|
|
|
add_definitions(-DLOCALPREFIX="${CMAKE_INSTALL_PREFIX}")
|
|
|
|
endif()
|
2015-05-21 17:07:47 +00:00
|
|
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
2015-03-18 15:29:11 +00:00
|
|
|
set(PYTHON_CMD "python3")
|
|
|
|
endif()
|
|
|
|
else()
|
2015-05-21 17:07:47 +00:00
|
|
|
set(PYTHON_CMD "py")
|
2014-10-03 21:34:53 +00:00
|
|
|
endif()
|
|
|
|
|
2015-04-14 20:55:44 +00:00
|
|
|
# loader: Generic VULKAN ICD loader
|
|
|
|
# icd: Device dependent (DD) VULKAN components
|
|
|
|
# tests: VULKAN tests
|
2015-10-10 15:43:07 +00:00
|
|
|
if(BUILD_LOADER)
|
|
|
|
add_subdirectory(loader)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BUILD_ICD)
|
|
|
|
add_subdirectory(icd)
|
|
|
|
endif()
|
|
|
|
|
2015-07-09 23:31:46 +00:00
|
|
|
if(BUILD_TESTS)
|
|
|
|
add_subdirectory(tests)
|
|
|
|
endif()
|
2015-10-10 15:43:07 +00:00
|
|
|
|
|
|
|
if(BUILD_LAYERS)
|
|
|
|
add_subdirectory(layers)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BUILD_DEMOS)
|
|
|
|
add_subdirectory(demos)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(BUILD_VKTRACE)
|
|
|
|
add_subdirectory(vktrace)
|
|
|
|
endif()
|