linux: Fix standard GNU path usage
[platform/upstream/Vulkan-Tools.git] / CMakeLists.txt
1 # The name of our project is "VULKAN". CMakeLists files in this project can
2 # refer to the root source directory of the project as ${VULKAN_SOURCE_DIR} and
3 # to the root binary directory of the project as ${VULKAN_BINARY_DIR}.
4 cmake_minimum_required(VERSION 2.8.11)
5 project (VULKAN)
6 # set (CMAKE_VERBOSE_MAKEFILE 1)
7
8 # The MAJOR number of the version we're building, used in naming
9 # vulkan.<major>.dll (and other files).
10 set(MAJOR "0")
11
12 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
13
14 # Header file for CMake settings
15 include_directories("${PROJECT_SOURCE_DIR}/include")
16
17 include(FindPkgConfig)
18
19 if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
20     set(COMMON_COMPILE_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers")
21     set(COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -fno-strict-aliasing -fno-builtin-memcmp")
22     set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 ${COMMON_COMPILE_FLAGS}")
23     set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_COMPILE_FLAGS} -std=c++11")
24     if (UNIX)
25         set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
26         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
27     endif()
28 endif()
29
30 # Hard code our LunarGLASS and glslang paths for now
31 get_filename_component(GLSLANG_PREFIX ../glslang ABSOLUTE)
32 get_filename_component(LUNARGLASS_PREFIX ../LunarGLASS ABSOLUTE)
33
34 if(NOT EXISTS ${GLSLANG_PREFIX})
35     message(FATAL_ERROR "Necessary glslang components do not exist: " ${GLSLANG_PREFIX})
36 endif()
37
38 if(NOT WIN32)
39     include(GNUInstallDirs)
40     add_definitions(-DLIBDIR="${CMAKE_INSTALL_LIBDIR}")
41     add_definitions(-DSYSCONFDIR="${CMAKE_INSTALL_SYSCONFDIR}")
42     add_definitions(-DDATADIR="${CMAKE_INSTALL_DATADIR}")
43     if (CMAKE_INSTALL_PREFIX STREQUAL "/usr")
44     else()
45         add_definitions(-DLOCALPREFIX="${CMAKE_INSTALL_PREFIX}")
46     endif()
47     if(NOT EXISTS ${LUNARGLASS_PREFIX})
48         message(FATAL_ERROR "Necessary LunarGLASS components do not exist: " ${LUNARGLASS_PREFIX})
49     endif()
50     if(${CMAKE_SYSTEM_NAME} MATCHES "Linux")
51         set(PYTHON_CMD "python3")
52     endif()
53 else()
54     set(PYTHON_CMD "py")
55 endif()
56
57 option(BUILD_TESTS "Build tests" ON)
58
59 # loader: Generic VULKAN ICD loader
60 # icd: Device dependent (DD) VULKAN components
61 # tests: VULKAN tests
62 add_subdirectory(loader)
63 add_subdirectory(icd)
64 if(BUILD_TESTS)
65     add_subdirectory(tests)
66 endif()
67 add_subdirectory(layers)
68 add_subdirectory(demos)
69 #add_subdirectory(tools/glave)