Commit 01c95078 authored by Zexin Yuan's avatar Zexin Yuan Committed by Gaetan Lepage
Browse files

tlrender: init at 0.10.0

parent 3d989ea6
Loading
Loading
Loading
Loading
+95 −0
Original line number Diff line number Diff line
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 95a03bbd..9ce32264 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -123,7 +123,7 @@ set_property(GLOBAL PROPERTY USE_FOLDERS ON)
 find_package(Imath REQUIRED)
 find_package(nlohmann_json REQUIRED)
 find_package(ZLIB REQUIRED)
-find_package(minizip REQUIRED)
+find_package(minizip-ng REQUIRED)
 find_package(OpenTimelineIO REQUIRED)
 
 # OpenColorIO dependencies
diff --git a/etc/SuperBuild/tests/OpenColorIOTest/CMakeLists.txt b/etc/SuperBuild/tests/OpenColorIOTest/CMakeLists.txt
index 513e7351..2db48491 100644
--- a/etc/SuperBuild/tests/OpenColorIOTest/CMakeLists.txt
+++ b/etc/SuperBuild/tests/OpenColorIOTest/CMakeLists.txt
@@ -1,10 +1,10 @@
 find_package(ZLIB REQUIRED)
-find_package(minizip REQUIRED)
+find_package(minizip-ng REQUIRED)
 find_package(OpenColorIO REQUIRED)
 
 set(source main.cpp)
 
 add_executable(OpenColorIOTest ${header} ${source})
-target_link_libraries(OpenColorIOTest OpenColorIO::OpenColorIO MINIZIP::minizip ZLIB::ZLIB)
+target_link_libraries(OpenColorIOTest OpenColorIO::OpenColorIO MINIZIP::minizip-ng ZLIB::ZLIB)
 
 add_test(OpenColorIOTest OpenColorIOTest)
diff --git a/lib/tlCore/CMakeLists.txt b/lib/tlCore/CMakeLists.txt
index d02fa96a..877c8462 100644
--- a/lib/tlCore/CMakeLists.txt
+++ b/lib/tlCore/CMakeLists.txt
@@ -40,7 +40,7 @@ else()
 endif()
 
 set(LIBRARIES tlResource feather-tk::feather-tk-core OTIO::opentimelineio Imath::Imath nlohmann_json::nlohmann_json)
-set(LIBRARIES_PRIVATE Freetype::Freetype MINIZIP::minizip ZLIB::ZLIB)
+set(LIBRARIES_PRIVATE Freetype::Freetype MINIZIP::minizip-ng ZLIB::ZLIB)
 if(TLRENDER_OCIO)
     list(APPEND LIBRARIES OpenColorIO::OpenColorIO)
 endif()
diff --git a/lib/tlTimeline/CMakeLists.txt b/lib/tlTimeline/CMakeLists.txt
index ad384749..82a6aacb 100644
--- a/lib/tlTimeline/CMakeLists.txt
+++ b/lib/tlTimeline/CMakeLists.txt
@@ -49,7 +49,7 @@ set(SOURCE
     Video.cpp)
 
 add_library(tlTimeline ${HEADERS} ${PRIVATE_HEADERS} ${SOURCE})
-target_link_libraries(tlTimeline tlIO)
+target_link_libraries(tlTimeline tlIO MINIZIP::minizip-ng)
 set_target_properties(tlTimeline PROPERTIES FOLDER lib)
 set_target_properties(tlTimeline PROPERTIES PUBLIC_HEADER "${HEADERS}")
 
diff --git a/lib/tlTimeline/TimelineCreate.cpp b/lib/tlTimeline/TimelineCreate.cpp
index 9596ab21..c8884435 100644
--- a/lib/tlTimeline/TimelineCreate.cpp
+++ b/lib/tlTimeline/TimelineCreate.cpp
@@ -99,7 +99,7 @@ namespace tl
         public:
             ZipReader(const std::string& fileName)
             {
-                mz_zip_reader_create(&reader);
+                reader = mz_zip_reader_create();
                 if (!reader)
                 {
                     throw std::runtime_error(feather_tk::Format(
diff --git a/lib/tlTimeline/Util.cpp b/lib/tlTimeline/Util.cpp
index 611f02ad..338df840 100644
--- a/lib/tlTimeline/Util.cpp
+++ b/lib/tlTimeline/Util.cpp
@@ -662,7 +662,7 @@ namespace tl
                 }
 
                 // Open the output file.
-                mz_zip_writer_create(&_writer);
+                _writer = mz_zip_writer_create();
                 if (!_writer)
                 {
                     throw std::runtime_error(feather_tk::Format("Cannot create writer: \"{0}\"").arg(fileName));
diff --git a/tlRenderConfig.cmake.in b/tlRenderConfig.cmake.in
index 11312d32..e6ec1184 100644
--- a/tlRenderConfig.cmake.in
+++ b/tlRenderConfig.cmake.in
@@ -9,7 +9,7 @@ include(CMakeFindDependencyMacro)
 find_package(Imath REQUIRED)
 find_package(nlohmann_json REQUIRED)
 find_package(ZLIB REQUIRED)
-find_package(minizip REQUIRED)
+find_package(minizip-ng REQUIRED)
 find_package(OpenTimelineIO REQUIRED)
 
 # OpenColorIO dependencies
+155 −0
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  cmake,
  fetchFromGitHub,
  pkg-config,

  bzip2,
  feather-tk,
  ffmpeg,
  freetype,
  glfw,
  imath,
  libGL,
  libjpeg,
  libtiff,
  libpng,
  lunasvg,
  minizip-ng,
  nasm,
  nativefiledialog-extended,
  nlohmann_json,
  opencolorio,
  openexr,
  openssl,
  opentimelineio,
  openusd,
  plutovg,
  SDL2,
  sdl3,
  xz,
  zlib,
  zstd,

  # optional dependencies
  enableNet ? false,
  enableOcio ? true,
  enableSdl2 ? true,
  enableSdl3 ? false,
  enableJpeg ? true,
  enableTiff ? true,
  enableStb ? true,
  enablePng ? true,
  enableOpenexr ? true,
  enableFfmpeg ? true,
  enableUsd ? false,

  # build options
  enableShared ? !stdenv.hostPlatform.isStatic,
  enableProgram ? true,
  enableExamples ? false,
}:

stdenv.mkDerivation (finalAttrs: {
  pname = "tlrender";
  version = "0.10.0";

  src = fetchFromGitHub {
    owner = "darbyjohnston";
    repo = "tlRender";
    tag = finalAttrs.version;
    hash = "sha256-TxiDZtMvNmrV1FKXZnekCZHnr/eCWZlsP6VJRnaoWg4=";
  };

  patches = [
    # Minizip-ng 4 support: https://github.com/darbyjohnston/tlRender/pull/145
    ./minizip-ng-4.patch
  ];

  postPatch = ''
    substituteInPlace CMakeLists.txt \
      --replace-fail "include(Package)" ""

    substituteInPlace lib/tlCore/CMakeLists.txt \
      --replace-fail "SDL2::SDL2-static" "SDL2::SDL2" \
      --replace-fail "SDL3::SDL3-static" "SDL3::SDL3" \

    substituteInPlace lib/tlIO/CMakeLists.txt \
      --replace-fail \
        "list(APPEND LIBRARIES_PRIVATE libjpeg-turbo::turbojpeg-static)" \
        "list(APPEND LIBRARIES_PRIVATE libjpeg-turbo::jpeg libjpeg-turbo::turbojpeg)"
  '';

  nativeBuildInputs = [
    cmake
    pkg-config
  ];

  buildInputs = [
    bzip2 # required by minizip-ng
    feather-tk
    freetype # required by feather-tk
    glfw
    libGL
    lunasvg # required by feather-tk
    imath
    minizip-ng
    nativefiledialog-extended
    nlohmann_json
    openssl # required by minizip-ng
    opentimelineio
    plutovg # required by feather-tk -> lunasvg
    xz # libLZMA, required by minizip-ng
    zlib # required by minizip-ng
    zstd # required by minizip-ng
  ]
  ++ lib.optionals enableNet [ nasm ]
  ++ lib.optionals enableOcio [ opencolorio ]
  ++ lib.optionals enableSdl2 [ SDL2 ]
  ++ lib.optionals enableSdl3 [ sdl3 ]
  ++ lib.optionals enableJpeg [ libjpeg ]
  ++ lib.optionals enableTiff [ libtiff ]
  ++ lib.optionals enablePng [ libpng ]
  ++ lib.optionals enableOpenexr [ openexr ]
  ++ lib.optionals enableFfmpeg [ ffmpeg ]
  ++ lib.optionals enableUsd [ openusd ];

  cmakeFlags = [
    (lib.cmakeBool "TLRENDER_NET" enableNet)
    (lib.cmakeBool "TLRENDER_OCIO" enableOcio)
    (lib.cmakeBool "TLRENDER_SDL2" enableSdl2)
    (lib.cmakeBool "TLRENDER_SDL3" enableSdl3)
    (lib.cmakeBool "TLRENDER_JPEG" enableJpeg)
    (lib.cmakeBool "TLRENDER_TIFF" enableTiff)
    (lib.cmakeBool "TLRENDER_STB" enableStb)
    (lib.cmakeBool "TLRENDER_PNG" enablePng)
    (lib.cmakeBool "TLRENDER_EXR" enableOpenexr)
    (lib.cmakeBool "TLRENDER_FFMPEG" enableFfmpeg)
    (lib.cmakeBool "TLRENDER_USD" enableUsd)

    (lib.cmakeBool "BUILD_SHARED_LIBS" enableShared)
    (lib.cmakeBool "TLRENDER_PROGRAMS" enableProgram)
    (lib.cmakeBool "TLRENDER_EXAMPLES" enableExamples)
    (lib.cmakeBool "TLRENDER_TESTS" finalAttrs.finalPackage.doCheck)
  ];

  # GLFW requires a working X11 session.
  doCheck = false;

  meta = {
    description = "Open source library for building playback and review applications";
    longDescription = ''
      An open source library for building playback and review applications for
      visual effects, film, and animation.

      The library can render and playback timelines with multiple video clips,
      image sequences, audio clips, and transitions. Examples are provided for
      integrating the library with Qt and OpenGL applications.
    '';
    homepage = "https://github.com/darbyjohnston/tlRender";
    license = lib.licenses.bsd3;
    maintainers = with lib.maintainers; [ yzx9 ];
    platforms = with lib.platforms; linux ++ darwin;
  };
})