summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomi Valkeinen <tomi.valkeinen@ti.com>2016-03-20 10:47:56 +0200
committerTomi Valkeinen <tomi.valkeinen@ti.com>2016-03-20 10:48:09 +0200
commitbf1a38247f292301f3b75b3dacbef41cd0a1bb46 (patch)
tree1f257b6a84a8367745ec9dafdd1829babc08b5e2
parent2024b70397aeea0b1533399831df6ba994b6be8d (diff)
Add LTO option
-rw-r--r--CMakeLists.txt9
-rw-r--r--README.md11
2 files changed, 14 insertions, 6 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 45916d0..739b80d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -9,6 +9,7 @@ ENDIF(NOT CMAKE_BUILD_TYPE)
set(LIBKMS_ENABLE_PYTHON ON CACHE BOOL "Enable Python wrappers")
set(LIBKMS_ENABLE_KMSCUBE OFF CACHE BOOL "Enable kmscube")
+set(LIBKMS_ENABLE_LTO OFF CACHE BOOL "Enable LTO")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -Wall")
@@ -17,6 +18,12 @@ set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
# static link libc
# set(CMAKE_EXE_LINKER_FLAGS "-static-libgcc -static-libstdc++")
+if(LIBKMS_ENABLE_LTO)
+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flto -fwhole-program")
+ set(CMAKE_AR gcc-ar)
+ set(CMAKE_RANLIB gcc-ranlib)
+endif()
+
find_package(PkgConfig REQUIRED)
pkg_check_modules(LIBDRM libdrm REQUIRED)
@@ -27,7 +34,7 @@ add_subdirectory(libkmstest)
add_subdirectory(tests)
if(LIBKMS_ENABLE_KMSCUBE)
-add_subdirectory(kmscube)
+ add_subdirectory(kmscube)
endif()
if(LIBKMS_ENABLE_PYTHON)
diff --git a/README.md b/README.md
index 363be9a..030312f 100644
--- a/README.md
+++ b/README.md
@@ -54,11 +54,12 @@ SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
You can use the following cmake flags to control the build. Use `-DFLAG=VALUE` to set them.
-Option name | Values | Default
--------------------- | ------------- | --------
-CMAKE_BUILD_TYPE | Release/Debug | Release
-LIBKMS_ENABLE_PYTHON | ON/OFF | ON
-LIBKMS_ENABLE_KMSCUBE | ON/OFF | OFF
+Option name | Values | Default | Notes
+--------------------- | ------------- | -------- | --------
+CMAKE_BUILD_TYPE | Release/Debug | Release |
+LIBKMS_ENABLE_PYTHON | ON/OFF | ON |
+LIBKMS_ENABLE_KMSCUBE | ON/OFF | OFF |
+LIBKMS_ENABLE_LTO  | ON/OFF | OFF | Link Time Optimization
## Env variables