[Kde-imaging] KDE/kdegraphics/libs/libkdcraw
Gilles Caulier
caulier.gilles at gmail.com
Wed Apr 22 08:30:28 CEST 2009
SVN commit 957437 by cgilles:
libkdcraw from trunk : OpenMP support : Parallelized RAW demosaicing operations are now enabled by default.
We check which GCC version is available to use right compilation/linking flags. If gcc version is bad, OpenMP
support is disabled.
Note to packagers : a CMake option is available to disable OPenMP support if necessary (default=OFF).
Look in README for details.
CCMAIL: kde-imaging at kde.org
CCMAIL: digikam-devel at kde.org
M +39 -12 CMakeLists.txt
M +1 -0 NEWS
M +5 -4 README
M +3 -3 libkdcraw/kdcraw.cpp
M +7 -2 libkdcraw/libraw_config.h.cmake
--- trunk/KDE/kdegraphics/libs/libkdcraw/CMakeLists.txt #957436:957437
@@ -1,8 +1,8 @@
PROJECT(libkdcraw)
-OPTION(ENABLE_OPENMP "Build with OpenMP support to use LibRaw parallel demosaicing operation" OFF)
+OPTION(DISABLE_OPENMP "Build without LibRaw OpenMP support" OFF)
-# =======================================================
+# ==================================================================================================
# Information to update before to release this library.
# Library version history:
@@ -38,7 +38,7 @@
SET(DCRAW_LIB_SO_REV_VERSION "1")
SET(DCRAW_LIB_SO_AGE_VERSION "0")
-# =======================================================
+# ==================================================================================================
# Set env. variables accordinly.
SET(DCRAW_LIB_VERSION_STRING "${DCRAW_LIB_MAJOR_VERSION}.${DCRAW_LIB_MINOR_VERSION}.${DCRAW_LIB_PATCH_VERSION}${DCRAW_LIB_SUFFIX_VERSION}")
@@ -46,12 +46,12 @@
SET(DCRAW_LIB_SO_VERSION_STRING "${DCRAW_LIB_SO_CUR_VERSION}.${DCRAW_LIB_SO_REV_VERSION}.${DCRAW_LIB_SO_AGE_VERSION}")
-# =======================================================
+# ==================================================================================================
# LibRAW source code
-IF( NOT WIN32)
+IF(NOT WIN32)
FIND_LIBRARY(MATH_LIBRARY m)
-ENDIF( NOT WIN32 )
+ENDIF(NOT WIN32)
find_package(LCMS REQUIRED)
@@ -64,17 +64,44 @@
# LibRaw use C++ exception.
ADD_DEFINITIONS(${KDE4_ENABLE_EXCEPTIONS})
-# OpenMP support to use parallelized code.
-IF(ENABLE_OPENMP)
- ADD_DEFINITIONS(-fopenmp)
- SET(OPENMP_LDFLAGS -lgomp)
-ENDIF(ENABLE_OPENMP)
-
# Under Windows, use specific flag to compile.
IF( WIN32 )
ADD_DEFINITIONS( -DDJGPP )
ENDIF( WIN32 )
+# ==================================================================================================
+# get the gcc version
+
+# Check gcc version to see if OpenMP support is available to perform parallelized
+# demosaicing with LibRaw
+
+IF (NOT DISABLE_OPENMP)
+ IF(CMAKE_COMPILER_IS_GNUCXX)
+ EXEC_PROGRAM(${CMAKE_CXX_COMPILER} ARGS --version OUTPUT_VARIABLE VERSION_GCC_INFO)
+ STRING(REGEX MATCH " [34]\\.[0-9]\\.[0-9]" GCC_VERSION "${VERSION_GCC_INFO}")
+
+ # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the patch level, handle this here:
+ IF(NOT GCC_VERSION)
+ STRING(REGEX REPLACE ".*\\(GCC\\).* ([34]\\.[0-9]) .*" "\\1.0" GCC_VERSION "${VERSION_GCC_INFO}")
+ ENDIF (NOT GCC_VERSION)
+
+ #Only GCC >= 4.3.2 support properly OpenMP, especially with KIOSlave.
+ MACRO_ENSURE_VERSION("4.3.2" "${GCC_VERSION}" GCC_VERSION_GOOD)
+
+ IF(GCC_VERSION_GOOD)
+
+ MESSAGE(STATUS "GCC version (${GCC_VERSION} ) detected: we will use OpenMP extension with LibRaw.")
+ ADD_DEFINITIONS(-fopenmp)
+ SET(OPENMP_LDFLAGS -lgomp)
+
+ ENDIF(GCC_VERSION_GOOD)
+ ENDIF(CMAKE_COMPILER_IS_GNUCXX)
+ELSEIF(NOT DISABLE_OPENMP)
+ MESSAGE(STATUS "OpenMP extension support with LibRaw is disabled.")
+ENDIF(NOT DISABLE_OPENMP)
+
+# ==================================================================================================
+
INCLUDE_DIRECTORIES(
${JPEG_INCLUDE_DIR}
${LCMS_INCLUDE_DIR}
--- trunk/KDE/kdegraphics/libs/libkdcraw/NEWS #957436:957437
@@ -16,6 +16,7 @@
- New option to switch on/off auto brightness adjsutements.
- Add support of Leica Raw files (RWL).
- New method to see if Libraw use OpenMP shared library to perform parallel demosaicing.
+- OpenMP support auto detection based on check of GCC version.
0.4.0 - Released with KDE 4.2.0
------------------------------------------------------------------------
--- trunk/KDE/kdegraphics/libs/libkdcraw/README #957436:957437
@@ -22,14 +22,15 @@
libkde >= 4.0.x http://www.kde.org
liblcms >= 1.14.x (used by libraw) http://www.littlecms.com
libjpeg >= 6b (used by libraw) http://www.ijg.org
+libgomp >= 4.3.x (used by libraw) http://gcc.gnu.org/projects/gomp
+Note: OpenMP support is hightly recommended to speed-up RAW demosaicing
+operations using parallelized code.
+
Optional:
-"-DENABLE_OPENMP=yes" CMake option set on parallelized LibRaw code to
-speed-up RAW demosaicing operations.
-libgomp >= 4.3.x (used by libraw) http://gcc.gnu.org/projects/gomp
+"-DDISABLE_OPENMP=yes" CMake option to disable OpenMP support with LibRaw.
-
-- INSTALL ------------------------------------------------------------
In order to compile, especially when QT3/Qt4 are installed at the same time,
--- trunk/KDE/kdegraphics/libs/libkdcraw/libkdcraw/kdcraw.cpp #957436:957437
@@ -758,10 +758,10 @@
bool KDcraw::librawUseGomp()
{
-#ifdef ENABLE_OPENMP
+#ifdef DISABLE_OPENMP
+ return false;
+#else
return true;
-#else
- return false;
#endif
}
--- trunk/KDE/kdegraphics/libs/libkdcraw/libkdcraw/libraw_config.h.cmake #957436:957437
@@ -1,2 +1,7 @@
-/* Define to 1 if LibRaw use OpenMP shared library to perform parallel demosaicing */
-#cmakedefine ENABLE_OPENMP 1
+#ifndef LIBRAW_CONFIG_H
+#define LIBRAW_CONFIG_H
+
+/* Define to 1 if LibRaw don't use OpenMP shared library to perform parallel demosaicing */
+#cmakedefine DISABLE_OPENMP 1
+
+#endif /* LIBRAW_CONFIG_H */
More information about the Kde-imaging
mailing list