blob: 25a91f6c015473ce6e54a9f9c3fa22cbfbcdd88c [file] [log] [blame]
Courtney Goeltzenleuchter62b2e852014-10-03 15:34:53 -06001# The name of our project is "XGL". CMakeLists files in this project can
2# refer to the root source directory of the project as ${XGL_SOURCE_DIR} and
3# to the root binary directory of the project as ${XGL_BINARY_DIR}.
Chia-I Wu60a20b82015-01-10 23:15:51 +08004cmake_minimum_required(VERSION 2.8.11)
Courtney Goeltzenleuchter62b2e852014-10-03 15:34:53 -06005project (XGL)
Courtney Goeltzenleuchter1d22ed82014-08-01 13:01:47 -06006# set (CMAKE_VERBOSE_MAKEFILE 1)
Courtney Goeltzenleuchter2220a3b2014-07-24 08:36:15 -06007
Chia-I Wu60a20b82015-01-10 23:15:51 +08008set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake")
9
Courtney Goeltzenleuchter2220a3b2014-07-24 08:36:15 -060010# Header file for CMake settings
Courtney Goeltzenleuchter2220a3b2014-07-24 08:36:15 -060011include_directories("${PROJECT_SOURCE_DIR}/include")
12
Chia-I Wu155be032014-08-02 09:14:28 +080013include(FindPkgConfig)
Chia-I Wu155be032014-08-02 09:14:28 +080014
Chia-I Wu93d06182015-02-17 09:55:34 -070015if (CMAKE_COMPILER_IS_GNUCC OR CMAKE_C_COMPILER_ID MATCHES "Clang")
Ian Elliott3fdadc82015-02-13 14:04:01 -070016 set(COMMON_COMPILE_FLAGS "-Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers")
Tony Barbour42869bc2015-02-05 14:14:33 -070017 set(COMMON_COMPILE_FLAGS "${COMMON_COMPILE_FLAGS} -fno-strict-aliasing -fno-builtin-memcmp")
Chia-I Wu5a782ae2014-12-19 11:34:46 +080018 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c99 ${COMMON_COMPILE_FLAGS}")
Chia-I Wu7c66b6b2014-12-16 00:07:11 +080019 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COMMON_COMPILE_FLAGS}")
Chia-I Wu468e3c32014-08-04 08:03:57 +080020 if (UNIX)
21 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
Chia-I Wucb5f2e62015-01-18 11:09:29 +080022 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fvisibility=hidden")
Chia-I Wu468e3c32014-08-04 08:03:57 +080023 endif()
24endif()
Chia-I Wu155be032014-08-02 09:14:28 +080025
Ian Elliott81ac44c2015-01-13 17:52:38 -070026if (NOT WIN32)
27 # Hard code our LunarGLASS and glslang paths for now
28 get_filename_component(GLSLANG_PREFIX ../glslang ABSOLUTE)
29 get_filename_component(LUNARGLASS_PREFIX ../LunarGLASS ABSOLUTE)
Courtney Goeltzenleuchter62b2e852014-10-03 15:34:53 -060030
Ian Elliott81ac44c2015-01-13 17:52:38 -070031 if(NOT EXISTS ${GLSLANG_PREFIX})
32 message(FATAL_ERROR "Necessary glslang components do not exist: " ${GLSLANG_PREFIX})
33 endif()
Courtney Goeltzenleuchter62b2e852014-10-03 15:34:53 -060034
Ian Elliott81ac44c2015-01-13 17:52:38 -070035 if(NOT EXISTS ${LUNARGLASS_PREFIX})
36 message(FATAL_ERROR "Necessary LunarGLASS components do not exist: " ${GLSLANG_PREFIX})
37 endif()
Jon Ashburn34cafb62015-03-18 09:29:11 -060038 if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
39 set(PYTHON_CMD "python3")
40 endif()
41else()
42 set(PYTHON_CMD "py")
Courtney Goeltzenleuchter62b2e852014-10-03 15:34:53 -060043endif()
44
Chia-I Wu5f72d0f2014-08-01 11:21:23 +080045# loader: Generic XGL ICD loader
Chia-I Wu41eddec2014-08-03 09:50:47 +080046# icd: Device dependent (DD) XGL components
Courtney Goeltzenleuchter2220a3b2014-07-24 08:36:15 -060047# tests: XGL tests
Chia-I Wu41eddec2014-08-03 09:50:47 +080048add_subdirectory(loader)
David Pinedo0257fbf2015-02-02 18:02:40 -070049add_subdirectory(icd)
Ian Elliott81ac44c2015-01-13 17:52:38 -070050if (NOT WIN32)
Ian Elliott81ac44c2015-01-13 17:52:38 -070051 add_subdirectory(tests)
52endif()
David Pinedo0257fbf2015-02-02 18:02:40 -070053add_subdirectory(layers)
Piers Danielle2bca482015-02-24 13:58:47 -070054add_subdirectory(libs)
David Pinedo0257fbf2015-02-02 18:02:40 -070055add_subdirectory(demos)
56add_subdirectory(tools/glave)