Warning, /graphics/krita/3rdparty/ext_lcms2/0002-Add-modern-CMake-toolchain.patch is written in an unsupported language. File is not indexed.

0001 From b6dc4548ccb41c67b3a2989ef1a801274abdc9e2 Mon Sep 17 00:00:00 2001
0002 From: "L. E. Segovia" <amy@amyspark.me>
0003 Date: Thu, 20 Oct 2022 20:13:00 -0300
0004 Subject: [PATCH 2/2] Add modern CMake toolchain
0005 
0006 Co-authored-by: Halla Rempt <halla@valdyas.org>
0007 ---
0008  CMakeLists.txt                    | 59 ++++++++++++++++++++++
0009  plugins/fast_float/CMakeLists.txt | 51 +++++++++++++++++++
0010  src/CMakeLists.txt                | 82 +++++++++++++++++++++++++++++++
0011  testbed/CMakeLists.txt            |  3 ++
0012  utils/CMakeLists.txt              | 77 +++++++++++++++++++++++++++++
0013  5 files changed, 272 insertions(+)
0014  create mode 100644 CMakeLists.txt
0015  create mode 100644 plugins/fast_float/CMakeLists.txt
0016  create mode 100644 src/CMakeLists.txt
0017  create mode 100644 testbed/CMakeLists.txt
0018  create mode 100644 utils/CMakeLists.txt
0019 
0020 diff --git a/CMakeLists.txt b/CMakeLists.txt
0021 new file mode 100644
0022 index 0000000..7ea5907
0023 --- /dev/null
0024 +++ b/CMakeLists.txt
0025 @@ -0,0 +1,59 @@
0026 +cmake_minimum_required(VERSION 3.1)
0027 +
0028 +project(lcms2 VERSION "2.12")
0029 +
0030 +option(BUILD_TESTS "build the test executable" OFF)
0031 +option(BUILD_SHARED_LIBS "build as shared library" ON)
0032 +option(BUILD_UTILS "build the utilities executables" OFF)
0033 +option(BUILD_PLUGINS "build the plugins" ON)
0034 +
0035 +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
0036 +
0037 +include(CheckLibraryExists)
0038 +CHECK_LIBRARY_EXISTS(m sqrt "" HAVE_LIBM)
0039 +
0040 +include(CheckCSourceCompiles)
0041 +
0042 +check_c_source_compiles("__attribute__((visibility(\"hidden\"))) int foo() { return 0; } int main() { return 0; }" HAVE_FUNC_ATTRIBUTE_VISIBILITY)
0043 +
0044 +include(CheckCCompilerFlag)
0045 +
0046 +check_c_compiler_flag("-fvisibility=hidden" HAVE_VISIBILITY_HIDDEN)
0047 +
0048 +include(FindThreads)
0049 +
0050 +add_subdirectory(src)
0051 +
0052 +if(BUILD_PLUGINS)
0053 +    add_subdirectory(plugins/fast_float)
0054 +endif()
0055 +
0056 +if(BUILD_TESTS)
0057 +    add_subdirectory(testbed)
0058 +endif(BUILD_TESTS)
0059 +
0060 +if(BUILD_UTILS)
0061 +    add_subdirectory(utils)
0062 +endif(BUILD_UTILS)
0063 +
0064 +set(prefix ${CMAKE_INSTALL_PREFIX})
0065 +set(exec_prefix "\${prefix}")
0066 +set(libdir "\${prefix}/lib")
0067 +set(includedir "\${exec_prefix}/include")
0068 +set(PACKAGE ${PROJECT_NAME})
0069 +set(VERSION ${lcms2_VERSION})
0070 +if(BUILD_PLUGINS)
0071 +    set(LIB_PLUGINS "-llcms2_fast_float")
0072 +endif()
0073 +if(HAVE_LIBM)
0074 +    set(LIB_MATH "-lm")
0075 +endif()
0076 +if(Threads_FOUND)
0077 +    set(LIB_THREAD ${CMAKE_THREAD_LIBS_INIT})
0078 +endif()
0079 +
0080 +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/lcms2.pc.in ${CMAKE_CURRENT_BINARY_DIR}/lcms2.pc @ONLY)
0081 +install(
0082 +    FILES ${CMAKE_CURRENT_BINARY_DIR}/lcms2.pc
0083 +    DESTINATION lib/pkgconfig
0084 +)
0085 diff --git a/plugins/fast_float/CMakeLists.txt b/plugins/fast_float/CMakeLists.txt
0086 new file mode 100644
0087 index 0000000..49b0825
0088 --- /dev/null
0089 +++ b/plugins/fast_float/CMakeLists.txt
0090 @@ -0,0 +1,51 @@
0091 +include(CheckCXXSourceCompiles)
0092 +check_cxx_source_compiles ("#include <emmintrin.h>
0093 +int main() { __m128i n = _mm_set1_epi8(42); }" HAVE_SSE2)
0094 +
0095 +set(lcms_plugin_SRCS 
0096 +    src/fast_16_tethra.c
0097 +    src/fast_8_curves.c
0098 +    src/fast_8_matsh.c
0099 +    src/fast_8_tethra.c
0100 +    src/fast_float_15bits.c
0101 +    src/fast_float_15mats.c
0102 +    src/fast_float_cmyk.c
0103 +    src/fast_float_curves.c
0104 +    src/fast_float_lab.c
0105 +    src/fast_float_matsh.c
0106 +    src/fast_float_separate.c
0107 +    src/fast_float_sup.c
0108 +    src/fast_float_tethra.c
0109 +)
0110 +
0111 +add_library(lcms2_fast_float SHARED ${lcms_plugin_SRCS})
0112 +
0113 +target_include_directories(lcms2_fast_float PUBLIC
0114 +    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/include>
0115 +    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
0116 +    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
0117 +    $<INSTALL_INTERFACE:include>
0118 +)
0119 +
0120 +if (NOT HAVE_SSE)
0121 +    target_compile_definitions(lcms2_fast_float PUBLIC CMS_DONT_USE_SSE2=1)
0122 +endif()
0123 +
0124 +set_target_properties(lcms2_fast_float PROPERTIES VERSION ${lcms2_VERSION}
0125 +                                      SOVERSION ${lcms2_VERSION_MAJOR})
0126 +
0127 +if(WIN32)
0128 +    set_target_properties(lcms2_fast_float PROPERTIES COMPILE_FLAGS -DCMS_DLL_BUILD=1)
0129 +endif()
0130 +
0131 +target_link_libraries(lcms2_fast_float PUBLIC lcms2)
0132 +
0133 +install(TARGETS lcms2_fast_float RUNTIME DESTINATION bin
0134 +                                LIBRARY DESTINATION lib
0135 +                                ARCHIVE DESTINATION lib)
0136 +
0137 +install(FILES
0138 +    ${CMAKE_CURRENT_SOURCE_DIR}/../../include/lcms2_plugin.h
0139 +    ${CMAKE_CURRENT_SOURCE_DIR}/include/lcms2_fast_float.h
0140 +    DESTINATION include
0141 +)
0142 diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
0143 new file mode 100644
0144 index 0000000..66409a5
0145 --- /dev/null
0146 +++ b/src/CMakeLists.txt
0147 @@ -0,0 +1,82 @@
0148 +set(lcms_SRCS
0149 +    cmscnvrt.c
0150 +    cmserr.c
0151 +    cmsgamma.c
0152 +    cmsgmt.c
0153 +    cmsintrp.c
0154 +    cmsio0.c
0155 +    cmsio1.c
0156 +    cmslut.c
0157 +    cmsplugin.c
0158 +    cmssm.c
0159 +    cmsmd5.c
0160 +    cmsmtrx.c
0161 +    cmspack.c
0162 +    cmspcs.c
0163 +    cmswtpnt.c
0164 +    cmsxform.c
0165 +    cmssamp.c
0166 +    cmsnamed.c
0167 +    cmscam02.c
0168 +    cmsvirt.c
0169 +    cmstypes.c
0170 +    cmscgats.c
0171 +    cmsps2.c
0172 +    cmsopt.c
0173 +    cmshalf.c
0174 +    cmsalpha.c
0175 +)
0176 +
0177 +if (MSVC)
0178 +    set(lcms_SRCS ${lcms_SRCS}
0179 +        lcms2.def
0180 +    )
0181 +endif()
0182 +
0183 +if (BUILD_SHARED_LIBS)
0184 +    add_library(lcms2 SHARED ${lcms_SRCS})
0185 +else()
0186 +    add_library(lcms2 STATIC ${lcms_SRCS})
0187 +endif()
0188 +
0189 +set_target_properties(lcms2 PROPERTIES VERSION ${lcms2_VERSION}
0190 +                                      SOVERSION ${lcms2_VERSION_MAJOR})
0191 +
0192 +if(BUILD_SHARED_LIBS AND WIN32)
0193 +    target_compile_definitions(lcms2 PUBLIC CMS_DLL_BUILD=1)
0194 +elseif(NOT BUILD_SHARED_LIBS)
0195 +    target_compile_definitions(lcms2 PUBLIC CMS_STATIC=1)
0196 +endif()
0197 +
0198 +if(HAVE_LIBM)
0199 +    target_link_libraries(lcms2 PUBLIC m)
0200 +endif()
0201 +
0202 +if(HAVE_FUNC_ATTRIBUTE_VISIBILITY)
0203 +    target_compile_definitions(lcms2 PUBLIC HAVE_FUNC_ATTRIBUTE_VISIBILITY=1)
0204 +endif()
0205 +
0206 +if(HAVE_VISIBILITY_HIDDEN)
0207 +    target_compile_options(lcms2 PUBLIC "-fvisibility=hidden")
0208 +endif()
0209 +
0210 +if(Threads_FOUND)
0211 +    target_compile_definitions(lcms2 PRIVATE HasTHREADS=1)
0212 +    target_link_libraries(lcms2 PUBLIC Threads::Threads)
0213 +endif()
0214 +
0215 +target_include_directories(lcms2 PUBLIC
0216 +    $<BUILD_INTERFACE:${CMAKE_BINARY_DIR}/include>
0217 +    $<BUILD_INTERFACE:${CMAKE_SOURCE_DIR}/include>
0218 +    $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
0219 +    $<INSTALL_INTERFACE:include>
0220 +)
0221 +
0222 +install(TARGETS lcms2
0223 +    RUNTIME DESTINATION bin
0224 +    LIBRARY DESTINATION lib
0225 +    ARCHIVE DESTINATION lib)
0226 +
0227 +install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/../include/lcms2.h
0228 +    DESTINATION include
0229 +)
0230 diff --git a/testbed/CMakeLists.txt b/testbed/CMakeLists.txt
0231 new file mode 100644
0232 index 0000000..9f213e4
0233 --- /dev/null
0234 +++ b/testbed/CMakeLists.txt
0235 @@ -0,0 +1,3 @@
0236 +add_executable(testcms testcms2.c testplugin.c zoo_icc.c)
0237 +target_link_libraries(testcms PUBLIC lcms2 lcms2_fast_float)
0238 +target_compile_definitions(testcms PRIVATE LCMS_FAST_EXTENSIONS=1)
0239 diff --git a/utils/CMakeLists.txt b/utils/CMakeLists.txt
0240 new file mode 100644
0241 index 0000000..ed2f211
0242 --- /dev/null
0243 +++ b/utils/CMakeLists.txt
0244 @@ -0,0 +1,77 @@
0245 +include_directories(
0246 +    ${CMAKE_CURRENT_SOURCE_DIR}/common
0247 +    ${CMAKE_SOURCE_DIR}/include # override search path if LCMS is already installed
0248 +)
0249 +
0250 +find_package(JPEG)
0251 +find_package(TIFF)
0252 +
0253 +set(UTILS_EXECUTABLES )
0254 +set(UTILS_MANPAGES )
0255 +
0256 +###############################################################################
0257 +if(JPEG_FOUND)
0258 +    set(JPGICC_SRCS
0259 +        jpgicc/jpgicc.c
0260 +        jpgicc/iccjpeg.c
0261 +        common/xgetopt.c
0262 +        common/vprf.c
0263 +    )
0264 +    add_executable(jpgicc ${JPGICC_SRCS})
0265 +    target_link_libraries(jpgicc PUBLIC lcms2 ${JPEG_LIBRARIES})
0266 +    target_include_directories(jpgicc AFTER PRIVATE ${JPEG_INCLUDE_DIR})
0267 +    list(APPEND UTILS_EXECUTABLES jpgicc)
0268 +    list(APPEND UTILS_MANPAGES jpgicc/jpgicc.1)
0269 +endif(JPEG_FOUND)
0270 +
0271 +###############################################################################
0272 +set(LINKICC_SRCS
0273 +    linkicc/linkicc.c
0274 +    common/xgetopt.c
0275 +    common/vprf.c
0276 +)
0277 +add_executable(linkicc ${LINKICC_SRCS})
0278 +target_link_libraries(linkicc PUBLIC lcms2)
0279 +list(APPEND UTILS_EXECUTABLES linkicc)
0280 +list(APPEND UTILS_MANPAGES linkicc/linkicc.1)
0281 +
0282 +###############################################################################
0283 +set(PSICC_SRCS
0284 +    psicc/psicc.c
0285 +    common/xgetopt.c
0286 +    common/vprf.c
0287 +)
0288 +add_executable(psicc ${PSICC_SRCS})
0289 +target_link_libraries(psicc PUBLIC lcms2)
0290 +list(APPEND UTILS_EXECUTABLES psicc)
0291 +list(APPEND UTILS_MANPAGES psicc/psicc.1)
0292 +
0293 +###############################################################################
0294 +if(TIFF_FOUND)
0295 +    set(TIFICC_SRCS
0296 +        tificc/tificc.c
0297 +        common/xgetopt.c
0298 +        common/vprf.c
0299 +    )
0300 +    add_executable(tificc ${TIFICC_SRCS})
0301 +    target_link_libraries(tificc PUBLIC lcms2 ${TIFF_LIBRARIES})
0302 +    target_include_directories(tificc AFTER PRIVATE ${TIFF_INCLUDE_DIR})
0303 +    list(APPEND UTILS_EXECUTABLES tificc)
0304 +    list(APPEND UTILS_MANPAGES tificc/tificc.1)
0305 +endif(TIFF_FOUND)
0306 +
0307 +###############################################################################
0308 +set(TRANSICC_SRCS
0309 +    transicc/transicc.c
0310 +    common/xgetopt.c
0311 +    common/vprf.c
0312 +)
0313 +add_executable(transicc ${TRANSICC_SRCS})
0314 +target_link_libraries(transicc PUBLIC lcms2)
0315 +list(APPEND UTILS_EXECUTABLES transicc)
0316 +list(APPEND UTILS_MANPAGES transicc/transicc.1)
0317 +
0318 +install(TARGETS ${UTILS_EXECUTABLES} RUNTIME DESTINATION bin
0319 +                                     LIBRARY DESTINATION lib
0320 +                                     ARCHIVE DESTINATION lib)
0321 +install(FILES ${UTILS_MANPAGES} DESTINATION share/man/man1)
0322 -- 
0323 2.37.1.windows.1
0324