load("@rules_license//rules:license.bzl", "license") package( default_applicable_licenses = [":license"], ) # Dual licensed FreeImage and GPL # https://freeimage.sourceforge.io/license.html. Only the FreeImage license is # listed here as it is more permissive. license( name = "license", package_name = "freeimage", license_kinds = ["@rules_license//licenses/spdx:FreeImage"], license_text = ":license-fi.txt", ) internal_zlib_private_headers = glob( include = [ "Source/ZLib/*.h", ], ) internal_libpng_private_headers = ["Source/LibPNG/png.h"] internal_openexr_public_headers = glob( include = [ "Source/OpenEXR/*.h", ], ) internal_openexr_half_private_headers = glob( include = [ "Source/OpenEXR/Half/*.h", ], ) internal_openexr_half_sources = glob( include = [ "Source/OpenEXR/Half/*.cpp", ], exclude = [ "Source/OpenEXR/Half/toFloat.cpp", "Source/OpenEXR/Half/eLut.cpp", ], ) cc_library( name = "openexr_half", srcs = internal_openexr_half_sources + internal_openexr_half_private_headers, hdrs = internal_openexr_public_headers, copts = [ "-w", ], includes = ["Source/OpenEXR/Half"], ) internal_openjpeg_private_headers = glob( include = [ "Source/LibOpenJPEG/*.h", ], exclude = [ "Source/LibOpenJPEG/*manager.h", ], ) internal_openjpeg_sources = glob( include = [ "Source/LibOpenJPEG/*.c", ], exclude = [ "Source/LibOpenJPEG/*manager.c", "Source/LibOpenJPEG/t1_generate_luts.c", ], ) cc_library( name = "openjpeg", srcs = internal_openjpeg_sources + internal_openjpeg_private_headers, copts = [ "-w", ], includes = ["Source/LibOpenJPEG"], ) internal_tiff_private_headers = glob( include = [ "Source/LibTIFF4/*.h", ], exclude = [ "Source/LibTIFF4/tif_win32.h", "Source/LibTIFF4/tif_wince.h", "Source/LibTIFF4/tif_config.vc.h", ], ) internal_tiff_sources = glob( include = [ "Source/LibTIFF4/*.c", ], exclude = [ "Source/LibTIFF4/tif_win32.c", "Source/LibTIFF4/tif_wince.c", "Source/LibTIFF4/tif_vms.c", "Source/LibTIFF4/mkg3states.c", "Source/LibTIFF4/mkspans.c", ], ) cc_library( name = "tiff", srcs = internal_tiff_sources + internal_tiff_private_headers, copts = [ "-w", "-Wno-error=implicit-function-declaration", ], includes = [ "Source/LibTIFF4", ], deps = [ "@zlib", "@libjpeg_turbo", ], ) freeimage_public_headers = ["Source/FreeImage.h"] freeimage_sources = glob( include = [ "Source/FreeImage/*.cpp", "Source/FreeImageToolkit/*.cpp", "Source/Metadata/*.cpp", ], ) freeimage_private_headers = glob( include = [ "Source/*.h", "Source/FreeImage/*.h", "Source/FreeImageToolkit/*.h", "Source/Metadata/*.h", ], exclude = freeimage_public_headers, ) cc_library( name = "freeimage", srcs = freeimage_sources + freeimage_private_headers + internal_zlib_private_headers + internal_libpng_private_headers, hdrs = freeimage_public_headers, copts = [ "-w", "-Wno-error=implicit-function-declaration", ], defines = ["USE_INTERNAL_TIFF_UNIX_ROUTINES"], includes = [ "Source", ], visibility = ["//visibility:public"], deps = [ "@libjpeg_turbo", "@libjpeg_turbo//:transform", ":openexr_half", ":openjpeg", ":tiff", "@libpng", "@libwebp", "@openexr//:OpenEXR", "@zlib", ], ) freeimageplus_sources = glob( include = [ "Wrapper/FreeImagePlus/src/*.cpp", ], ) freeimageplus_public_headers = ["Wrapper/FreeImagePlus/FreeImagePlus.h"] cc_library( name = "freeimageplus", srcs = freeimageplus_sources, hdrs = freeimageplus_public_headers, copts = [ "-w", ], includes = [ "Wrapper/FreeImagePlus", ], visibility = ["//visibility:public"], deps = [ ":freeimage", ], )