"Fossies" - the Fresh Open Source Software Archive

Member "darktable-2.6.3/src/external/rawspeed/CMakeLists.txt" (19 Oct 2019, 10235 Bytes) of package /linux/misc/darktable-2.6.3.tar.xz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. See also the latest Fossies "Diffs" side-by-side code changes report for "CMakeLists.txt": 2.6.2_vs_2.6.3.

    1 cmake_minimum_required(VERSION 3.4.0)
    2 
    3 cmake_policy(SET CMP0011 NEW)
    4 cmake_policy(SET CMP0025 NEW)
    5 
    6 # Avoid source tree pollution
    7 set(CMAKE_DISABLE_SOURCE_CHANGES ON)
    8 set(CMAKE_DISABLE_IN_SOURCE_BUILD ON)
    9 
   10 If(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
   11   message(FATAL_ERROR "In-source builds are not permitted. Make a separate folder for building:\nmkdir build; cd build; cmake ..\nBefore that, remove the files already created:\nrm -rf CMakeCache.txt CMakeFiles")
   12 endif(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
   13 
   14 include(GNUInstallDirs)
   15 include(FeatureSummary)
   16 include(CheckCXXCompilerFlag)
   17 
   18 # NOTE: if rawspeed is being added as a submodule to another build,
   19 # this CMakeLists.txt should be added via add_subdirectory().
   20 
   21 project(rawspeed CXX)
   22 
   23 set(RAWSPEED_SOURCE_DIR "${PROJECT_SOURCE_DIR}" CACHE PATH "" FORCE)
   24 set(RAWSPEED_BINARY_DIR "${PROJECT_BINARY_DIR}" CACHE PATH "" FORCE)
   25 
   26 if("${CMAKE_SOURCE_DIR}" STREQUAL "${RAWSPEED_SOURCE_DIR}")
   27   set(RAWSPEED_STANDALONE_BUILD TRUE CACHE BOOL "")
   28 else()
   29   set(RAWSPEED_STANDALONE_BUILD FALSE CACHE BOOL "")
   30 endif()
   31 
   32 set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/Modules/" ${CMAKE_MODULE_PATH})
   33 set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake/" ${CMAKE_MODULE_PATH})
   34 
   35 set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
   36 
   37 set(CMAKE_POSITION_INDEPENDENT_CODE ON)
   38 
   39 option(BINARY_PACKAGE_BUILD "Sets march optimization to generic" OFF)
   40 option(WITH_SSE2 "If SSE2 support is available, do build SSE2 codepaths" ON)
   41 if(CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang" OR CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
   42   option(RAWSPEED_USE_LIBCXX "(Clang only) Build using libc++ as the standard library." OFF)
   43 
   44   # when OSX_DEPLOYMENT_TARGET is 10.9 and newer, the default is libc++,
   45   # but for no reason let's always specify/use libc++ for apple.
   46   if(APPLE)
   47     set(RAWSPEED_USE_LIBCXX ON)
   48   endif()
   49 else()
   50   set(RAWSPEED_USE_LIBCXX OFF CACHE BOOL "(Clang only) Build using libc++ as the standard library." FORCE)
   51 endif()
   52 
   53 set(CMAKE_REQUIRED_FLAGS_ORIG "${CMAKE_REQUIRED_FLAGS}")
   54 set(CMAKE_REQUIRED_FLAGS "-c -std=c++14 -g")
   55 # see https://bugs.llvm.org/show_bug.cgi?id=16091
   56 # see https://reviews.llvm.org/rL221704
   57 CHECK_CXX_SOURCE_COMPILES(
   58 "struct foo {
   59   static auto func();
   60 };
   61 
   62 foo f;
   63 
   64 auto foo::func() {
   65   return 1;
   66 }"
   67   RAWSPEED_CXX_DEBUG_INFO_FOR_AUTO_IS_SUPPORTED
   68 )
   69 set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS_ORIG}")
   70 
   71 option(RAWSPEED_ENABLE_DEBUG_INFO "Whether to generate debug info or not." ${RAWSPEED_CXX_DEBUG_INFO_FOR_AUTO_IS_SUPPORTED})
   72 
   73 option(RAWSPEED_ENABLE_WERROR "Stop and fail the build, if a compiler warning is triggered." ON)
   74 
   75 option(WITH_OPENMP "Enable OpenMP support." ON)
   76 if(WITH_OPENMP)
   77   option(USE_BUNDLED_LLVMOPENMP "Build and use LLVM OpenMP runtime library in-tree" OFF)
   78 else()
   79   set(USE_BUNDLED_LLVMOPENMP OFF CACHE BOOL "Build and use LLVM OpenMP runtime library in-tree" FORCE)
   80 endif()
   81 set(LLVMOPENMP_PATH "/usr/src/openmp" CACHE PATH "Path to the LLVM OpenMP runtime library root tree.")
   82 if(WITH_OPENMP AND USE_BUNDLED_LLVMOPENMP)
   83   option(ALLOW_DOWNLOADING_LLVMOPENMP "If LLVM OpenMP runtime library src tree is not found in location specified by LLVMOPENMP_PATH, do fetch the archive from internet" OFF)
   84 else()
   85   set(ALLOW_DOWNLOADING_LLVMOPENMP OFF CACHE BOOL "If LLVM OpenMP runtime library src tree is not found in location specified by LLVMOPENMP_PATH, do fetch the archive from internet" FORCE)
   86 endif()
   87 
   88 option(WITH_PUGIXML "Enable XML support for cameras.xml reading" ON)
   89 if(WITH_PUGIXML)
   90   option(USE_BUNDLED_PUGIXML "Build and use pugixml in-tree" OFF)
   91 else()
   92   set(USE_BUNDLED_PUGIXML OFF CACHE BOOL "Build and use pugixml in-tree" FORCE)
   93 endif()
   94 if(WITH_PUGIXML AND USE_BUNDLED_PUGIXML)
   95   option(ALLOW_DOWNLOADING_PUGIXML "If pugixml src tree is not found in location specified by PUGIXML_PATH, do fetch the archive from internet" OFF)
   96 else()
   97   set(ALLOW_DOWNLOADING_PUGIXML OFF CACHE BOOL "If pugixml src tree is not found in location specified by PUGIXML_PATH, do fetch the archive from internet" FORCE)
   98 endif()
   99 option(WITH_JPEG "Enable JPEG support for DNG Lossy JPEG support" ON)
  100 option(WITH_ZLIB "Enable ZLIB support for DNG deflate support" ON)
  101 if(WITH_ZLIB)
  102   option(USE_BUNDLED_ZLIB "Build and use zlib in-tree" OFF)
  103 else()
  104   set(USE_BUNDLED_ZLIB OFF CACHE BOOL "Build and use zlib in-tree" FORCE)
  105 endif()
  106 if(WITH_ZLIB AND USE_BUNDLED_ZLIB)
  107   option(ALLOW_DOWNLOADING_ZLIB "If ZLIB src tree is not found in location specified by ZLIB_PATH, do fetch the archive from internet" OFF)
  108 else()
  109   set(ALLOW_DOWNLOADING_ZLIB OFF CACHE BOOL "If ZLIB src tree is not found in location specified by ZLIB_PATH, do fetch the archive from internet" FORCE)
  110 endif()
  111 option(USE_XMLLINT "Run xmllint to test if data/cameras.xml is valid" ON)
  112 option(USE_IWYU "Run iwyu tool when compiling sources" OFF)
  113 option(USE_CLANG_TIDY "Run clang-tidy tool when compiling sources" OFF)
  114 option(BUILD_TESTING "Build the testing tree." ON)
  115 if(BUILD_TESTING)
  116   option(ALLOW_DOWNLOADING_GOOGLETEST "If googletest src tree is not found in location specified by GOOGLETEST_PATH, do fetch the archive from internet" OFF)
  117 else()
  118   set(ALLOW_DOWNLOADING_GOOGLETEST OFF CACHE BOOL "If googletest src tree is not found in location specified by GOOGLETEST_PATH, do fetch the archive from internet" FORCE)
  119 endif()
  120 option(BUILD_TOOLS "Build some tools (identify, rstest)." ON)
  121 option(BUILD_BENCHMARKING "Build some benchmarks." OFF)
  122 if(BUILD_BENCHMARKING)
  123   option(ALLOW_DOWNLOADING_GOOGLEBENCHMARK "If googlebenchmark src tree is not found in location specified by GOOGLEBENCHMARK_PATH, do fetch the archive from internet" OFF)
  124 else()
  125   set(ALLOW_DOWNLOADING_GOOGLEBENCHMARK OFF CACHE BOOL "If googlebenchmark src tree is not found in location specified by GOOGLEBENCHMARK_PATH, do fetch the archive from internet" FORCE)
  126 endif()
  127 option(BUILD_DOCS "Build the documentation (Sphinx+Doxygen)." OFF)
  128 option(BUILD_FUZZERS "Build the fuzzing tree." ON)
  129 if(BUILD_TOOLS)
  130   option(RAWSPEED_ENABLE_SAMPLE_BASED_TESTING "If enabled, allows to use rstest to check the samples specified by RAWSPEED_REFERENCE_SAMPLE_ARCHIVE" OFF)
  131 else()
  132   set(RAWSPEED_ENABLE_SAMPLE_BASED_TESTING OFF CACHE BOOL "If enabled, allows to use rstest to check the samples specified by RAWSPEED_REFERENCE_SAMPLE_ARCHIVE" FORCE)
  133 endif()
  134 if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
  135   option(USE_LLVM_OPT_REPORT "(Clang only) Save compiler optimizations records and show them" OFF)
  136 else()
  137   set(USE_LLVM_OPT_REPORT OFF CACHE BOOL "(Clang only) Save compiler optimizations records and show them" FORCE)
  138 endif()
  139 
  140 set(GOOGLETEST_PATH "/usr/src/googletest" CACHE PATH
  141                     "Path to the googletest root tree. Should contain googletest and googlemock subdirs. And CMakeLists.txt in root, and in both of these subdirs")
  142 
  143 set(PUGIXML_PATH "/usr/src/pugixml" CACHE PATH "Path to the pugixml root tree.")
  144 
  145 set(ZLIB_PATH "/usr/src/zlib" CACHE PATH "Path to the zlib root tree.")
  146 
  147 set(GOOGLEBENCHMARK_PATH "/usr/src/googlebenchmark" CACHE PATH
  148                     "Path to the googlebenchmark root tree.")
  149 
  150 set(LIB_FUZZING_ENGINE "OFF" CACHE STRING "Either OFF, or overrides the fuzzing engine library (e.g. libFuzzer) that needs to be linked with all fuzz targets.")
  151 
  152 set(RAWSPEED_REFERENCE_SAMPLE_ARCHIVE "~/raw-camera-samples/raw.pixls.us-unique" CACHE PATH "The location of the reference sample set to use. Should contain filelist.sha1 and timestamp.txt")
  153 
  154 set(RAWSPEED_PROFDATA_FILE "${PROJECT_BINARY_DIR}/rawspeed.profdata"
  155     CACHE FILEPATH "The location of the .profdata file")
  156 
  157 option(RAWSPEED_ENABLE_LTO "Add appropriate flag to the compile and link command lines, enabling link-time optimization." OFF)
  158 
  159 if(CMAKE_MAKE_PROGRAM MATCHES "ninja")
  160   set(RAWSPEED_PARALLEL_LINK_JOBS "" CACHE STRING
  161     "Define the maximum number of concurrent link jobs.")
  162 
  163   if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND
  164      RAWSPEED_ENABLE_LTO AND NOT RAWSPEED_PARALLEL_LINK_JOBS)
  165      message(STATUS "Clang's ThinLTO provides its own parallel linking - limiting parallel link jobs to 2.")
  166      set(RAWSPEED_PARALLEL_LINK_JOBS "2")
  167   endif()
  168 
  169   if(RAWSPEED_PARALLEL_LINK_JOBS)
  170     set_property(GLOBAL APPEND PROPERTY
  171                  JOB_POOLS link_job_pool=${RAWSPEED_PARALLEL_LINK_JOBS})
  172     set(CMAKE_JOB_POOL_LINK link_job_pool)
  173   endif()
  174 else()
  175   set(RAWSPEED_PARALLEL_LINK_JOBS "" CACHE STRING
  176       "(Ninja-only) Define the maximum number of concurrent link jobs." FORCE)
  177 
  178   if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang" AND RAWSPEED_ENABLE_LTO)
  179     message(WARNING "RAWSPEED_ENABLE_LTO is enabled but RAWSPEED_PARALLEL_LINK_JOBS is only supported for Ninja.\nConsider using Ninja Generator!")
  180   endif()
  181 endif()
  182 
  183 include(cmake-command-wrappers)
  184 
  185 include(build-type)
  186 
  187 if(RAWSPEED_USE_LIBCXX)
  188   include(libc++)
  189 endif()
  190 
  191 if(USE_IWYU)
  192   include(iwyu)
  193 endif()
  194 
  195 if(USE_LLVM_OPT_REPORT)
  196   include(llvm-opt-report)
  197 endif()
  198 
  199 if((UNIX OR APPLE) AND USE_CLANG_TIDY)
  200   include(clang-tidy)
  201 endif()
  202 
  203 if(BUILD_TESTING)
  204   enable_testing()
  205 endif()
  206 
  207 include(compiler-versions)
  208 include(compiler-flags)
  209 
  210 add_custom_target(check-rawspeed ALL)
  211 add_custom_target(dependencies ALL)
  212 add_custom_target(tests ALL)
  213 
  214 include(compiler-warnings)
  215 
  216 if(RAWSPEED_ENABLE_WERROR)
  217   set_directory_properties(PROPERTIES COMPILE_OPTIONS "-Werror")
  218 endif()
  219 
  220 if(BUILD_BENCHMARKING)
  221   add_custom_target(benchmarks ALL)
  222 endif()
  223 
  224 rawspeed_add_library(rawspeed STATIC)
  225 
  226 include(src-dependencies)
  227 
  228 add_subdirectory(src)
  229 
  230 if(BUILD_TESTING)
  231   add_subdirectory(test)
  232 endif()
  233 
  234 if(BUILD_BENCHMARKING)
  235   add_subdirectory(bench)
  236 endif()
  237 
  238 if(BUILD_FUZZERS)
  239   add_subdirectory(fuzz)
  240 endif()
  241 
  242 add_subdirectory(data)
  243 
  244 if(BUILD_DOCS)
  245   add_subdirectory(docs)
  246 endif()
  247 
  248 if(BUILD_TESTING AND CMAKE_BUILD_TYPE STREQUAL "COVERAGE")
  249   if(CMAKE_CXX_COMPILER_ID STREQUAL "Clang")
  250     include(llvm-profdata)
  251     include(llvm-cov)
  252   elseif(CMAKE_COMPILER_IS_GNUCXX OR
  253          CMAKE_CXX_COMPILER_ID STREQUAL "AppleClang")
  254     include(gcc-gcov)
  255 
  256     find_package(LCov)
  257     find_package(GenHtml)
  258 
  259     if(LCov_FOUND AND GenHtml_FOUND)
  260       include(lcov)
  261       include(genhtml)
  262       include(gcc-coverage)
  263     else()
  264       message(WARNING "Did not find lcov and genhtml. "
  265                       "Will not be able to generate HTML reports")
  266     endif()
  267   endif()
  268 endif()
  269 
  270 feature_summary(WHAT ALL)