You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
85 lines
2.7 KiB
85 lines
2.7 KiB
From bba9aa37c899999fca01101a8ed271a3aa9d82b7 Mon Sep 17 00:00:00 2001 |
|
From: Sebastian Kraft <mail@sebastiankraft.net> |
|
Date: Sat, 16 Jan 2016 15:42:57 +0100 |
|
Subject: [PATCH 060/113] Various CMake patches from the mailing list |
|
|
|
- Add GLIB2 libray path to link directories |
|
- Enable -msseX compiler switch for Clang |
|
- Set -mseeX switch only for files with SSE code |
|
- Do not enable SSE optimizations on non-x86 hardware by default |
|
--- |
|
CMakeLists.txt | 19 +++++++++++++------ |
|
libs/lensfun/CMakeLists.txt | 5 +++++ |
|
2 files changed, 18 insertions(+), 6 deletions(-) |
|
|
|
diff --git a/CMakeLists.txt b/CMakeLists.txt |
|
index 21f082b..b85656c 100644 |
|
--- a/CMakeLists.txt |
|
+++ b/CMakeLists.txt |
|
@@ -31,12 +31,18 @@ IF(NOT HAVE_REGEX_H) |
|
INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/libs/regex) |
|
ENDIF() |
|
|
|
+IF(CMAKE_SYSTEM_PROCESSOR MATCHES "[XxIi][0-9]?86|[Aa][Mm][Dd]64") |
|
+ SET(X86_ON ON) |
|
+else() |
|
+ SET(X86_ON OFF) |
|
+ENDIF() |
|
+ |
|
# options controlling the build process |
|
OPTION(BUILD_STATIC "Build static library" OFF) |
|
OPTION(BUILD_TESTS "Build test suite" OFF) |
|
OPTION(BUILD_LENSTOOL "Build the lenstool (requires libpng)" OFF) |
|
-OPTION(BUILD_FOR_SSE "Build with support for SSE" ON) |
|
-OPTION(BUILD_FOR_SSE2 "Build with support for SSE2" ON) |
|
+OPTION(BUILD_FOR_SSE "Build with support for SSE" ${X86_ON}) |
|
+OPTION(BUILD_FOR_SSE2 "Build with support for SSE2" ${X86_ON}) |
|
OPTION(BUILD_DOC "Build documentation with doxygen" OFF) |
|
OPTION(INSTALL_HELPER_SCRIPTS "Install various helper scripts" ON) |
|
|
|
@@ -62,14 +68,14 @@ ENDIF() |
|
|
|
IF(BUILD_FOR_SSE) |
|
SET(VECTORIZATION_SSE 1) |
|
- IF(CMAKE_COMPILER_IS_GNUCXX) |
|
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse") |
|
+ IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") |
|
+ SET(VECTORIZATION_SSE_FLAGS "-msse") |
|
ENDIF() |
|
ENDIF() |
|
IF(BUILD_FOR_SSE2) |
|
SET(VECTORIZATION_SSE2 1) |
|
- IF(CMAKE_COMPILER_IS_GNUCXX) |
|
- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse2") |
|
+ IF(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang") |
|
+ SET(VECTORIZATION_SSE2_FLAGS "-msse2") |
|
ENDIF() |
|
ENDIF() |
|
|
|
@@ -97,6 +103,7 @@ ELSE() |
|
ENDIF() |
|
|
|
INCLUDE_DIRECTORIES(SYSTEM ${GLIB2_INCLUDE_DIRS}) |
|
+LINK_DIRECTORIES(${GLIB2_LIBRARY_DIRS}) |
|
|
|
|
|
IF(BUILD_STATIC) |
|
diff --git a/libs/lensfun/CMakeLists.txt b/libs/lensfun/CMakeLists.txt |
|
index 6beadec..b0ca638 100644 |
|
--- a/libs/lensfun/CMakeLists.txt |
|
+++ b/libs/lensfun/CMakeLists.txt |
|
@@ -9,6 +9,11 @@ IF(WIN32) |
|
LIST(APPEND LENSFUN_SRC windows/auxfun.cpp) |
|
ENDIF() |
|
|
|
+SET_SOURCE_FILES_PROPERTIES(mod-color-sse.cpp mod-coord-sse.cpp |
|
+ PROPERTIES COMPILE_FLAGS "${VECTORIZATION_SSE_FLAGS}") |
|
+SET_SOURCE_FILES_PROPERTIES(mod-color-sse2.cpp |
|
+ PROPERTIES COMPILE_FLAGS "${VECTORIZATION_SSE2_FLAGS}") |
|
+ |
|
IF(BUILD_STATIC) |
|
ADD_LIBRARY(lensfun STATIC ${LENSFUN_SRC}) |
|
ELSE() |
|
-- |
|
2.7.4 |
|
|
|
|