-
Notifications
You must be signed in to change notification settings - Fork 1
/
lensfun-0.3.2-Various-CMake-patches-from-the-mailing-list.patch
85 lines (74 loc) · 2.72 KB
/
lensfun-0.3.2-Various-CMake-patches-from-the-mailing-list.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
From bba9aa37c899999fca01101a8ed271a3aa9d82b7 Mon Sep 17 00:00:00 2001
From: Sebastian Kraft <[email protected]>
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