tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

CMakeLists.txt (5541B)


      1 # Copyright (c) the JPEG XL Project Authors. All rights reserved.
      2 #
      3 # Use of this source code is governed by a BSD-style
      4 # license that can be found in the LICENSE file.
      5 
      6 set(JPEGXL_MAJOR_VERSION 0)
      7 set(JPEGXL_MINOR_VERSION 11)
      8 set(JPEGXL_PATCH_VERSION 1)
      9 set(JPEGXL_LIBRARY_VERSION
     10    "${JPEGXL_MAJOR_VERSION}.${JPEGXL_MINOR_VERSION}.${JPEGXL_PATCH_VERSION}")
     11 
     12 # This is the library API/ABI compatibility version. Changing this value makes
     13 # the shared library incompatible with previous version. A program linked
     14 # against this shared library SOVERSION will not run with an older SOVERSION.
     15 # It is important to update this value when making incompatible API/ABI changes
     16 # so that programs that depend on libjxl can update their dependencies. Semantic
     17 # versioning allows 0.y.z to have incompatible changes in minor versions.
     18 set(JPEGXL_SO_MINOR_VERSION 11)
     19 if (JPEGXL_MAJOR_VERSION EQUAL 0)
     20  set(JPEGXL_LIBRARY_SOVERSION
     21      "${JPEGXL_MAJOR_VERSION}.${JPEGXL_SO_MINOR_VERSION}")
     22 else()
     23  set(JPEGXL_LIBRARY_SOVERSION "${JPEGXL_MAJOR_VERSION}")
     24 endif()
     25 
     26 
     27 # List of warning and feature flags for our library and tests.
     28 if (MSVC)
     29  set(JPEGXL_INTERNAL_FLAGS
     30    # TODO(janwas): add flags
     31  )
     32 else ()
     33  set(JPEGXL_INTERNAL_FLAGS
     34    # F_FLAGS
     35    -fmerge-all-constants
     36    -fno-builtin-fwrite
     37    -fno-builtin-fread
     38 
     39    # WARN_FLAGS
     40    -Wall
     41    -Wextra
     42    -Wc++11-compat
     43    -Warray-bounds
     44    -Wformat-security
     45    -Wimplicit-fallthrough
     46    -Wno-register  # Needed by public headers in lcms
     47    -Wno-unused-function
     48    -Wno-unused-parameter
     49    -Wnon-virtual-dtor
     50    -Woverloaded-virtual
     51    -Wvla
     52  )
     53 
     54  # Warning flags supported by clang.
     55  if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
     56    list(APPEND JPEGXL_INTERNAL_FLAGS
     57      -Wdeprecated-increment-bool
     58      # TODO(deymo): Add -Wextra-semi once we update third_party/highway.
     59      # -Wextra-semi
     60      -Wfloat-overflow-conversion
     61      -Wfloat-zero-conversion
     62      -Wfor-loop-analysis
     63      -Wgnu-redeclared-enum
     64      -Winfinite-recursion
     65      -Wliteral-conversion
     66      -Wno-c++98-compat
     67      -Wno-unused-command-line-argument
     68      -Wprivate-header
     69      -Wself-assign
     70      -Wstring-conversion
     71      -Wtautological-overlap-compare
     72      -Wthread-safety-analysis
     73      -Wundefined-func-template
     74      -Wunreachable-code
     75      -Wunused-comparison
     76    )
     77    if (CMAKE_CXX_COMPILER_VERSION VERSION_GREATER 5.0)
     78      list(APPEND HWY_FLAGS -Wc++2a-extensions)
     79    endif()
     80  endif()  # Clang
     81 
     82  if (WIN32)
     83    list(APPEND JPEGXL_INTERNAL_FLAGS
     84      -Wno-cast-align
     85      -Wno-double-promotion
     86      -Wno-float-equal
     87      -Wno-format-nonliteral
     88      -Wno-shadow
     89      -Wno-sign-conversion
     90      -Wno-zero-as-null-pointer-constant
     91    )
     92 
     93    if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
     94      list(APPEND JPEGXL_INTERNAL_FLAGS
     95        -Wno-used-but-marked-unused
     96        -Wno-unused-template
     97        -Wno-unused-member-function
     98        -Wno-shadow-field-in-constructor
     99        -Wno-language-extension-token
    100        -Wno-global-constructors
    101        -Wno-c++98-compat-pedantic
    102      )
    103    endif()  # Clang
    104  else()  # WIN32
    105    list(APPEND JPEGXL_INTERNAL_FLAGS
    106      -fsized-deallocation
    107      -fno-exceptions
    108 
    109      # Language flags
    110      -fmath-errno
    111    )
    112 
    113    if (CMAKE_CXX_COMPILER_ID MATCHES "Clang")
    114      list(APPEND JPEGXL_INTERNAL_FLAGS
    115        -fnew-alignment=8
    116        -fno-cxx-exceptions
    117        -fno-slp-vectorize
    118        -fno-vectorize
    119 
    120        -disable-free
    121        -disable-llvm-verifier
    122      )
    123    endif()  # Clang
    124  endif()  # WIN32
    125 endif()  #!MSVC
    126 
    127 if (JPEGXL_ENABLE_SKCMS)
    128  list(APPEND JPEGXL_INTERNAL_FLAGS -DJPEGXL_ENABLE_SKCMS=1)
    129 endif ()
    130 
    131 # strips the -internal suffix from all the elements in LIST
    132 function(strip_internal OUTPUT_VAR LIB_LIST)
    133  foreach(lib IN LISTS ${LIB_LIST})
    134    string(REGEX REPLACE "-internal$" "" lib "${lib}")
    135    list(APPEND out_list "${lib}")
    136  endforeach()
    137  set(${OUTPUT_VAR} ${out_list} PARENT_SCOPE)
    138 endfunction()
    139 
    140 # set variables for jxl_cms.cmake and jxl.cmake
    141 if(IS_ABSOLUTE "${CMAKE_INSTALL_INCLUDEDIR}")
    142    set(PKGCONFIG_TARGET_INCLUDES "${CMAKE_INSTALL_INCLUDEDIR}")
    143 else()
    144    set(PKGCONFIG_TARGET_INCLUDES "\${prefix}/${CMAKE_INSTALL_INCLUDEDIR}")
    145 endif()
    146 if(IS_ABSOLUTE "${CMAKE_INSTALL_LIBDIR}")
    147    set(PKGCONFIG_TARGET_LIBS "${CMAKE_INSTALL_LIBDIR}")
    148 else()
    149    set(PKGCONFIG_TARGET_LIBS "\${exec_prefix}/${CMAKE_INSTALL_LIBDIR}")
    150 endif()
    151 
    152 include(CheckCXXSymbolExists)
    153 set(PKGCONFIG_CXX_LIB "")
    154 check_cxx_symbol_exists(__GLIBCXX__ iostream LIBSTDCXX)
    155 check_cxx_symbol_exists(_LIBCPP_VERSION iostream LIBCXX)
    156 if(LIBSTDCXX)
    157  set(PKGCONFIG_CXX_LIB "-lstdc++")
    158 elseif(LIBCXX)
    159  set(PKGCONFIG_CXX_LIB "-lc++")
    160 endif()
    161 
    162 # The jxl_cms library definition.
    163 include(jxl_cms.cmake)
    164 # The jxl library definition.
    165 include(jxl.cmake)
    166 
    167 # Other libraries outside the core jxl library.
    168 if(JPEGXL_ENABLE_TOOLS OR BUILD_TESTING)
    169  include(jxl_extras.cmake)
    170 endif()
    171 include(jxl_threads.cmake)
    172 if (JPEGXL_ENABLE_JPEGLI)
    173  include(jpegli.cmake)
    174 endif()
    175 
    176 # For simplicity all the library headers, both source and generated ones, are
    177 # gathered in the binary folder. There is no distinction on which libraries use
    178 # which header since it is expected that all developer libraries are available
    179 # together at build time.
    180 install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/include/jxl
    181  DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}")
    182 
    183 if(BUILD_TESTING)
    184  include(GoogleTest)
    185 endif()
    186 
    187 # Tests for the jxl library.
    188 include(jxl_tests.cmake)
    189 
    190 if(BUILD_TESTING)
    191  # Google benchmark for the jxl library
    192  include(jxl_benchmark.cmake)
    193 endif()