summaryrefslogtreecommitdiff
blob: 6e963441e8a5137ab57f823ec52386159248a77a (plain)
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
85
86
--- darktable-1.1/cmake/modules/FindLibraw.cmake
+++ darktable-1.1/cmake/modules/FindLibraw.cmake
@@ -0,0 +1,29 @@
+# - Try to find libraw
+# Once done, this will define
+#
+#  Libraw_FOUND - system has Libraw
+#  Libraw_INCLUDE_DIRS - the Libraw include directories
+#  Libraw_LIBRARIES - link these to use Libraw
+
+include(LibFindMacros)
+
+# Use pkg-config to get hints about paths
+libfind_pkg_check_modules(Libraw_PKGCONF libraw)
+
+# Include dir
+find_path(Libraw_INCLUDE_DIR
+  NAMES libraw.h
+  PATHS ${Libraw_PKGCONF_INCLUDE_DIRS}
+)
+
+# Finally the library itself
+find_library(Libraw_LIBRARY
+  NAMES raw_r
+  PATHS ${Libraw_PKGCONF_LIBRARY_DIRS}
+)
+
+# Set the include dir variables and the libraries and let libfind_process do the rest.
+# NOTE: Singular variables for this library, plural for libraries this this lib depends on.
+set(Libraw_PROCESS_INCLUDES Libraw_INCLUDE_DIR Libraw_INCLUDE_DIRS)
+set(Libraw_PROCESS_LIBS Libraw_LIBRARY Libraw_LIBRARIES)
+libfind_process(Libraw)
--- darktable-1.1/src/CMakeLists.txt
+++ darktable-1.1/src/CMakeLists.txt
@@ -86,7 +86,6 @@
 
 include_directories(${CMAKE_CURRENT_SOURCE_DIR})
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external)
-include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/LibRaw)
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/osm-gps-map/src)
 include_directories(${CMAKE_CURRENT_SOURCE_DIR}/external/colord-gtk/src)
 
@@ -143,7 +142,7 @@
 endif(INOTIFY_FOUND)
 
 # Find all the libs that don't require extra parameters
-foreach(lib ${OUR_LIBS} LensFun GIO GThread GModule Cairo PangoCairo PThread Rsvg2 GDK-PixBuf LibXml2 Sqlite3 Exiv2  CURL PNG JPEG TIFF OpenEXR LCMS2)
+foreach(lib ${OUR_LIBS} LensFun Libraw GIO GThread GModule Cairo PangoCairo PThread Rsvg2 GDK-PixBuf LibXml2 Sqlite3 Exiv2 CURL PNG JPEG TIFF OpenEXR LCMS2)
   find_package(${lib} REQUIRED)
   include_directories(${${lib}_INCLUDE_DIRS})
   list(APPEND LIBS ${${lib}_LIBRARIES})
@@ -366,24 +365,6 @@
 set_target_properties(lib_darktable PROPERTIES OUTPUT_NAME darktable)
 set_target_properties(lib_darktable PROPERTIES LINKER_LANGUAGE C)
 
-#
-# the libraw part is a bit of a hack:
-# the static linking didn't work since it was pulling -lstdc++ and -lm into linker flags.
-# so we do a custom dependency and pretend an imported liblibraw_r.a so no other -l are
-# appended.
-#
-add_dependencies(lib_darktable libraw_r)
-add_library(libraw_static STATIC IMPORTED)
-set_target_properties(libraw_static PROPERTIES IMPORTED_LOCATION ${CMAKE_CURRENT_BINARY_DIR}/external/LibRaw/liblibraw_r.a)
-if(APPLE)
-  set(LIBRAW_STATIC_LIBS libraw_static stdc++)
-else(APPLE)
-  set(LIBRAW_STATIC_LIBS libraw_static)
-endif(APPLE)
-
-target_link_libraries(lib_darktable ${LIBRAW_STATIC_LIBS})
-list(APPEND STATIC_LIBS ${LIBRAW_STATIC_LIBS})
-
 # same for librawspeed (can switch it off with -DDONT_USE_RAWSPEED, for macs):
 if(NOT DONT_USE_RAWSPEED)
   add_definitions("-DHAVE_RAWSPEED")
@@ -448,9 +429,6 @@
 # make sure static libs is first
 list(INSERT LIBS 0 lib_darktable ${STATIC_LIBS})
 
-# Compile libraw modules
-add_subdirectory(external/LibRaw)
-
 # Compile views modules
 add_subdirectory(views)