kms++util: split to subdirs
[android/external-libkmsxx.git] / CMakeLists.txt
1 cmake_minimum_required(VERSION 2.8)
2 project(kms++)
4 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
5 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
6 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
8 include(CheckCXXCompilerFlag)
10 IF(NOT CMAKE_BUILD_TYPE)
11     message(STATUS "Setting build type to 'Release' as none was specified.")
12     SET(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build." FORCE)
13     set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS "Debug" "Release" "MinSizeRel" "RelWithDebInfo")
14 ENDIF()
16 string(TOUPPER "${CMAKE_BUILD_TYPE}" U_CMAKE_BUILD_TYPE)
18 option(BUILD_SHARED_LIBS "Build shared libs" FALSE)
20 set(KMSXX_ENABLE_PYTHON ON CACHE BOOL "Enable Python wrappers")
21 set(KMSXX_ENABLE_KMSCUBE OFF CACHE BOOL "Enable kmscube")
23 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
24 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra -Wno-unused-parameter")
26 if (CMAKE_COMPILER_IS_GNUCC)
27     if(CMAKE_CXX_COMPILER_VERSION VERSION_LESS 5.0)
28         # GCC 4.x seems to warn too much
29         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-missing-field-initializers")
30     endif()
31 endif()
33 set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
35 # static link libc
36 # set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
38 if (NOT ${U_CMAKE_BUILD_TYPE} MATCHES DEBUG)
39     CHECK_CXX_COMPILER_FLAG("-flto" HAS_LTO_FLAG)
41     if (HAS_LTO_FLAG)
42         set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto")
43         set(CMAKE_AR gcc-ar)
44         set(CMAKE_RANLIB gcc-ranlib)
45     endif()
46 endif()
48 find_package(PkgConfig REQUIRED)
49 pkg_check_modules(LIBDRM libdrm>=2.4.64 REQUIRED)
51 enable_testing()
53 add_subdirectory(kms++)
54 add_subdirectory(kms++util)
55 add_subdirectory(utils)
57 if(KMSXX_ENABLE_KMSCUBE)
58         add_subdirectory(kmscube)
59 endif()
61 if(KMSXX_ENABLE_PYTHON)
62         add_subdirectory(py)
63 endif()