OpenToonz - An open-source full-featured 2D animation creation software
C
ci(build): update CMake to 3.5 and fix macOS build issues
Anderson Prado4105394a8538
diff --git a/.github/workflows/workflow_macos.yml b/.github/workflows/workflow_macos.ymlindex 6ec844a75..79fc509ec 100644--- a/.github/workflows/workflow_macos.yml+++ b/.github/workflows/workflow_macos.yml@@ -53,7 +53,7 @@ jobs:brew updatebrew cleanup- checkPkgAndInstall pkg-config glew lz4 libjpeg libpng lzo boost libusb libmypaint ccache jpeg-turbo ninja opencv qt@5+ checkPkgAndInstall pkg-config glew lz4 libjpeg libpng lzo boost libusb libmypaint ccache jpeg-turbo ninja opencv openjph openexr qt@5brew unlink qt- name: Set up cacherun: |@@ -70,10 +70,12 @@ jobs:cd thirdparty/tiff-4.0.3CFLAGS='-fPIC' CXXFLAGS='-fPIC' ./configure --disable-lzmamake -j $(sysctl -n hw.ncpu)+ make install # Ensures CMake finds the installed lib (avoid linking issues)- name: Buildrun: |export PKG_CONFIG_PATH="/usr/local/opt/jpeg-turbo/lib/pkgconfig:$PKG_CONFIG_PATH"cd toonz+ rm -rf buildmkdir -p buildcd buildcmake ../sources -G Ninja \@@ -125,4 +127,4 @@ jobs:- uses: actions/upload-artifact@v4with:name: Opentoonz-${{ runner.os }}-${{ github.sha }}- path: toonz/build/toonz/OpenToonz.dmg+ path: toonz/build/toonz/OpenToonz.dmg\ No newline at end of filediff --git a/.github/workflows/workflow_windows.yml b/.github/workflows/workflow_windows.ymlindex d66840b61..4c75c3d7d 100644--- a/.github/workflows/workflow_windows.yml+++ b/.github/workflows/workflow_windows.yml@@ -5,11 +5,11 @@ on:branches:- master # Specify branches where the workflow should runpaths:- - '**/*' # Include all files in the repository- - '!appveyor.yml' # Ignore changes in AppVeyor- - '!README.md' # Exclude README- - '!doc/**' # Exclude documentation- - '!**/.github/**' # Exclude everything in .github folder+ - '**/*' # Include all files in the repository+ - '!appveyor.yml' # Ignore changes in AppVeyor+ - '!README.md' # Exclude README+ - '!doc/**' # Exclude documentation+ - '!**/.github/**' # Exclude everything in .github folder- '.github/workflows/workflow_windows.yml' # Include Windows workflow filepull_request:paths:@@ -24,38 +24,48 @@ jobs:Windows:runs-on: windows-2025env:- QT_PATH: ${{ github.workspace }}\thirdparty\qt\5.15.2_wintab\msvc2019_64 # Path to custom Qt.- VCINSTALLDIR: 'C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC' # Path to MSVC.- MSVCVERSION: "Visual Studio 17 2022" # Visual Studio version.- BOOST_ROOT: C:\local\boost_1_87_0 # Boost library root.- OpenCV_DIR: C:\tools\opencv\build # Path to OpenCV.+ # QT related variable+ QT_PATH: ${{ github.workspace }}\thirdparty\qt\5.15.2_wintab\msvc2019_64 # Path to custom Qt++ # Visual Studio related variables+ MSVCVERSION: "Visual Studio 17 2022" # Visual Studio version++ # Boost-related variables+ BOOST_TOOLSET: "14.3" # Boost MSVC Toolset version+ BOOST_VERSION: "1.87.0" # Boost version+ BOOST_ROOT: C:\local\boost_1_87_0 # Path to Boost library root++ # OpenCV-related variables+ OPENCV_VERSION: "4.11.0" # OpenCV version+ OpenCV_DIR: C:\tools\opencv\build # Path to OpenCVsteps:- uses: actions/checkout@v4with:lfs: false- - name: Install and Configure ccache- run: |- @echo on- choco install ccache- copy C:\ProgramData\chocolatey\lib\ccache\tools\ccache*\ccache.exe C:\ProgramData\chocolatey\bin\cl.exe- mkdir %LOCALAPPDATA%\ccache- shell: cmd- - name: Set Path ccache+ # Cache OpenCV and Boost libraries+ - name: Cache OpenCV and Boost+ id: cache-depsuses: actions/cache@v4with:- path: C:/Users/runneradmin/AppData/Local/ccache- key: ${{ runner.os }}-${{ github.sha }}- restore-keys: ${{ runner.os }}--- - name: Install OpenCV and Boost+ path: |+ C:\tools\opencv+ ${{ env.BOOST_ROOT }}+ key: ${{ runner.os }}-opencv-boost-${{ env.OPENCV_VERSION }}-boost-${{ env.BOOST_VERSION }}+ restore-keys: |+ ${{ runner.os }}-opencv-boost-${{ env.OPENCV_VERSION }}-boost-++ # Install OpenCV and Boost if the cache is missing+ - name: Install OpenCV and Boost if cache is missing+ if: steps.cache-deps.outputs.cache-hit != 'true'run: |@echo on- choco install opencv --version=4.11.0 -y- choco install boost-msvc-14.3 --version=1.87.0 -y+ choco install opencv --version=${{ env.OPENCV_VERSION }} -y+ choco install boost-msvc-${{ env.BOOST_TOOLSET }} --version=${{ env.BOOST_VERSION }} -yshell: cmd+ # Install custom Qt 5.15.2 with WinTab support- name: Install custom Qt 5.15.2 with WinTab supportrun: |@echo on@@ -72,9 +82,11 @@ jobs:7z x -y thirdparty-libs.zipshell: cmd+ # Add msbuild to PATH for build process- name: Add msbuild to PATHuses: microsoft/setup-msbuild@v2+ # CMake configuration step- name: CMake configurationrun: |@echo on@@ -84,12 +96,14 @@ jobs:copy /Y libpng-1.6.21\scripts\pnglibconf.h.prebuilt libpng-1.6.21\pnglibconf.hcd ../toonz+ rmdir /S /Q buildmkdir buildcd buildcmake ..\sources -G "%MSVCVERSION%" -Ax64 -DQT_PATH="%QT_PATH%" -DBOOST_ROOT="%BOOST_ROOT%" -DOpenCV_DIR="%OpenCV_DIR%" -DWITH_WINTAB=Yshell: cmd+ # Build Opentoonz using MSBuild- name: Build Opentoonzrun: |@echo on@@ -97,6 +111,7 @@ jobs:msbuild /p:Configuration=RelWithDebInfo /m /verbosity:minimal ALL_BUILD.vcxprojshell: cmd+ # Create the package- name: Create Packagerun: |@echo on@@ -105,7 +120,6 @@ jobs:REM Create Opentoonz directory and copy files from RelWithDebInfomkdir Opentoonzcopy /Y RelWithDebInfo\*.* Opentoonz\-REM Copy required DLLs for proper functionalitycopy /Y ..\..\thirdparty\glut\3.7.6\lib\glut64.dll Opentoonzcopy /Y ..\..\thirdparty\glew\glew-1.9.0\bin\64bit\glew32.dll Opentoonz@@ -128,14 +142,16 @@ jobs:xcopy /Y /E /I ..\..\stuff .\Opentoonz\portablestuffshell: cmd+ # Create artifact from the build- name: Create Artifactrun: |mkdir artifactxcopy toonz\build\Opentoonz artifact\ /E /H /Yshell: cmd+ # Upload the generated artifact- name: Upload Artifactuses: actions/upload-artifact@v4with:name: Opentoonz-${{ runner.os }}-${{ github.sha }}- path: artifact+ path: artifact\ No newline at end of filediff --git a/appveyor.yml b/appveyor.ymlindex 5af823e61..5a455e54a 100644--- a/appveyor.yml+++ b/appveyor.yml@@ -3,13 +3,13 @@ init:- git lfs install --skip-smudgeskip_commits:files:- - 'doc/**' # Skip everything inside doc/ (recursive)+ - 'doc/**/*' # Skip everything inside doc/ (recursive)- '.github/**' # Skip everything inside .github/ (recursive)- 'README.md' # Skip changes only to README.mdpull_requests:do_not_increment_build_number: trueskip_tags: true-image: Visual Studio 2022+image: Visual Studio 2019configuration: Releaseplatform: x64clone_depth: 1@@ -36,7 +36,7 @@ install:mkdir %PLATFORM% && cd %PLATFORM%- cmake ..\sources -G "Visual Studio 17 2022" -Ax64 -DQT_PATH="C:\Qt\5.15.2\msvc2019_64" -DBOOST_ROOT="C:\Libraries\boost_1_86_0" -DOpenCV_DIR="C:\Tools\opencv\build"+ cmake ..\sources -G "Visual Studio 16 2019" -Ax64 -DQT_PATH="C:\Qt\5.15.2\msvc2019_64" -DBOOST_ROOT="C:\Libraries\boost_1_86_0" -DOpenCV_DIR="C:\Tools\opencv\build"build:project: $(APPVEYOR_BUILD_FOLDER)\toonz\$(PLATFORM)\ALL_BUILD.vcxprojparallel: true@@ -59,4 +59,4 @@ after_build:xcopy /Y /E ..\..\stuff "%CONFIGURATION%\portablestuff"artifacts:- path: toonz\$(PLATFORM)\$(CONFIGURATION)- name: OpenToonz+ name: OpenToonz\ No newline at end of filediff --git a/toonz/sources/CMakeLists.txt b/toonz/sources/CMakeLists.txtindex 2f4280ac9..a7fe9e678 100644--- a/toonz/sources/CMakeLists.txt+++ b/toonz/sources/CMakeLists.txt@@ -1,4 +1,4 @@-cmake_minimum_required(VERSION 2.8.11)+cmake_minimum_required(VERSION 3.5)set(CMAKE_BUILD_TYPE_INIT Release)@@ -168,10 +168,11 @@ endif()message(STATUS "Thirdpary Library Search path:" ${THIRDPARTY_LIBS_HINTS})if(BUILD_ENV_MSVC)- set(QT_PATH "C:/Qt/5.15.2/msvc2019${PLATFORM2}" CACHE PATH "Qt installation directory")- if(NOT EXISTS ${QT_PATH})- message("Specify QT_PATH properly")- return()+ if(NOT DEFINED QT_PATH OR NOT EXISTS ${QT_PATH})+ set(QT_PATH "C:/Qt/5.15.2/msvc2019${PLATFORM2}" CACHE PATH "Qt installation directory")+ if(NOT EXISTS ${QT_PATH})+ message(FATAL_ERROR "QT_PATH not found: ${QT_PATH}. Specify QT_PATH properly.")+ endif()endif()set(QT_LIB_PATH ${QT_PATH})set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};${QT_PATH}/lib/cmake/")@@ -183,19 +184,35 @@ if(BUILD_ENV_MSVC)-D_USE_MATH_DEFINES)elseif(BUILD_ENV_APPLE)- set(QT_PATH "~/Qt5.9.2/5.9.2/clang_${PLATFORM}/lib" CACHE PATH "Qt installation directory")- set(QT_LIB_PATH "${QT_PATH}/")- set(CMAKE_PREFIX_PATH "${CMAKE_PREFIX_PATH};${QT_LIB_PATH}cmake/")+ # Try to find Qt from Homebrew if not explicitly set+ if(NOT DEFINED QT_PATH)+ execute_process(+ COMMAND brew --prefix qt@5+ OUTPUT_VARIABLE HOMEBREW_QT_PREFIX+ OUTPUT_STRIP_TRAILING_WHITESPACE+ RESULT_VARIABLE BREW_RESULT+ )+ if(NOT BREW_RESULT EQUAL 0)+ message(FATAL_ERROR "Homebrew 'qt@5' not found. Install with 'brew install qt@5' or set QT_PATH manually.")+ endif()+ set(QT_PATH "${HOMEBREW_QT_PREFIX}/lib" CACHE PATH "Qt installation directory (from Homebrew)")+ message(STATUS "Auto-detected Qt path: ${QT_PATH}")+ endif()++ set(QT_LIB_PATH "${QT_PATH}")+ list(APPEND CMAKE_PREFIX_PATH "${HOMEBREW_QT_PREFIX}/lib/cmake/Qt5") # More precise for find_package(Qt5)+foreach(path ${CMAKE_PREFIX_PATH})- message("CMAKE_PREFIX_PATH: " ${path})- endforeach(path)+ message(STATUS "CMAKE_PREFIX_PATH: ${path}")+ endforeach()+add_definitions(-DMACOSX-Di386-D__MACOS__)if(PLATFORM EQUAL 64)- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -std=c++17 -stdlib=libc++ -fno-implicit-templates")+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m64 -stdlib=libc++ -fno-implicit-templates")set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -m64")elseif(PLATFORM EQUAL 32)set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -m32 -std=c++17 -stdlib=libc++ -fno-implicit-templates -D HAS_QUICKDRAW")@@ -205,8 +222,8 @@ elseif(BUILD_ENV_APPLE)message(FATAL_ERROR "Invalid PLATFORM:" ${PLATFORM} ". 'PLATFORM' must be 32 or 64.")endif()elseif(BUILD_ENV_UNIXLIKE)- # Needed for correct Qt detection- cmake_minimum_required(VERSION 2.8.12)+ # Needed for correct Qt detection (handled by top-level 3.5+)+ # cmake_minimum_required(VERSION 2.8.12) # Redundant and triggers <3.5 errorset(PRELOAD_VARIABLE "LD_LIBRARY_PATH")if(CMAKE_SYSTEM_NAME MATCHES "Linux")add_definitions(-DLINUX)@@ -226,7 +243,7 @@ elseif(BUILD_ENV_UNIXLIKE)find_package(Qt5Widgets)- set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")+ set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")if (NOT (CMAKE_CXX_COMPILER_ID STREQUAL "Clang"))set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -lstdc++")endif()@@ -277,6 +294,11 @@ find_package(Qt5 REQUIREDUiTools)+if(NOT Qt5Core_FOUND)+ message(FATAL_ERROR "Qt5Core not found—check paths")+endif()+message(STATUS "Qt5 Modules: ${Qt5Core_VERSION}")+set(QT_MINIMUM_VERSION 5.5.0)if(Qt5Core_VERSION VERSION_LESS QT_MINIMUM_VERSION)MESSAGE(FATAL_ERROR "Minimum supported Qt version: ${QT_MINIMUM_VERSION}.@@ -430,7 +452,7 @@ elseif(BUILD_ENV_APPLE)pkg_check_modules(MYPAINT_LIB REQUIRED libmypaint)if(PLATFORM EQUAL 64)- pkg_check_modules(TURBOJPEG REQUIRED libturbojpeg)+ pkg_check_modules(TURBOJPEG REQUIRED libturbojpeg)find_library(TURBOJPEG_LIB turbojpeg ${TURBOJPEG_LIBRARY_DIRS})message("**************** turbojpeg lib:" ${TURBOJPEG_LIB})@@ -546,24 +568,30 @@ include_directories()if(BUILD_ENV_MSVC OR BUILD_ENV_APPLE)+ # Handle CMake 3.30+/4.x: Force legacy module for prebuilt Boost (no config files)if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.30)- set(BOOST_DIR ${BOOST_ROOT})- find_package(Boost 1.55 REQUIRED)- else() # CMake version below 3.30- find_path(- BOOST_ROOT- include/boost- boost- HINTS- ${THIRDPARTY_LIBS_HINTS}- PATH_SUFFIXES- boost/boost_1_75_0/- boost/boost_1_74_0/- boost/boost_1_73_0/- boost/boost_1_72_0/- )- find_package(Boost 1.55 REQUIRED)+ cmake_policy(SET CMP0167 OLD) # Use FindBoost module, not configendif()+ # Set hints/ROOT for both branches+ set(Boost_NO_BOOST_CMAKE ON) # Explicitly disable config search+ find_path(+ BOOST_ROOT+ include/boost+ boost+ HINTS+ ${BOOST_ROOT} # From -D or env+ ${THIRDPARTY_LIBS_HINTS}+ PATH_SUFFIXES+ boost/boost_1_89_0/ # Added recent versions (e.g., Homebrew 1.89)+ boost/boost_1_87_0/+ boost/boost_1_86_0/+ boost/boost_1_85_0/+ boost/boost_1_75_0/+ boost/boost_1_74_0/+ boost/boost_1_73_0/+ boost/boost_1_72_0/+ )+ find_package(Boost 1.55 REQUIRED)else()find_package(Boost)endif()@@ -665,16 +693,6 @@ if((PLATFORM EQUAL 32) AND ((BUILD_TARGET_WIN AND BUILD_ENV_MSVC) OR BUILD_TARGEadd_subdirectory(t32bitsrv)endif()-if(BUILD_ENV_APPLE)- add_custom_command(TARGET executable- POST_BUILD COMMAND- ${CMAKE_INSTALL_NAME_TOOL} -add_rpath ${CMAKE_INSTALL_RPATH}- $<TARGET_FILE:executable>- )- # add capability for retina displays- set_target_properties(OpenToonz PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/../cmake/BundleInfo.plist.in)-endif()-if(BUILD_ENV_UNIXLIKE AND NOT BUILD_TARGET_WIN)add_subdirectory(xdg-data)-endif()+endif()\ No newline at end of filediff --git a/toonz/sources/image/tif/tiio_tif.cpp b/toonz/sources/image/tif/tiio_tif.cppindex c9682f2fc..d9917033d 100644--- a/toonz/sources/image/tif/tiio_tif.cpp+++ b/toonz/sources/image/tif/tiio_tif.cpp@@ -23,6 +23,15 @@ extern "C" {#include "tiffio.h"}+// Fix for libtiff 4.0+ compatibility: Map _64 variants to standard functions (preserves 64-bit support via internal offsets)+#if !defined(TIFFReadRGBATile_64)+#define TIFFReadRGBATile_64 TIFFReadRGBATile+#endif+#if !defined(TIFFReadRGBAStrip_64)+#define TIFFReadRGBAStrip_64 TIFFReadRGBAStrip+#endif+#include <cstdint> // adde: for uint32_t/uint64_t (resolve casts)+#include "tiio_tif.h"#ifdef _MSC_VER@@ -449,20 +458,18 @@ void TifReader::readLine(short *buffer, int x0, int x1, int shrink) {TIFFGetField(m_tiff, TIFFTAG_TILELENGTH, &tileHeight);assert(tileWidth > 0 && tileHeight > 0);- // Allocate a sufficient buffer to store a single tile+ // Allocate a sufficient buffer to store a single tile (use uint32 for RGBA compatibility)int tileSize = tileWidth * tileHeight;- std::unique_ptr<uint64[]> tile(new uint64[tileSize]);-+ std::unique_ptr<uint32[]> tile(new uint32[tileSize]); // Changed from uint64_t[] to uint32_t[] (BigTIFF 64-bit offsets remain unaffected)int x = 0;int y = tileHeight * m_stripIndex;- // In case it's the last tiles row, the tile size might exceed the image- // bounds+ // In case it's the last tiles row, the tile size might exceed the image boundsint lastTy = std::min((int)tileHeight, m_info.m_ly - y);// Traverse the tiles rowwhile (x < m_info.m_lx) {- int ret = TIFFReadRGBATile_64(m_tiff, x, y, tile.get());+ int ret = TIFFReadRGBATile_64(m_tiff, static_cast<uint32_t>(x), static_cast<uint32_t>(y), reinterpret_cast<uint32_t *>(tile.get())); // change: Cast for uint32_t * (resolve parameter init error)assert(ret);int tileRowSize = std::min((int)tileWidth, m_info.m_lx - x) * pixelSize;@@ -470,14 +477,14 @@ void TifReader::readLine(short *buffer, int x0, int x1, int shrink) {// Copy the tile rows in the corresponding output strip rowsfor (int ty = 0; ty < lastTy; ++ty) {memcpy(m_stripBuffer + (ty * m_rowLength + x) * pixelSize,- (UCHAR *)tile.get() + ty * tileWidth * pixelSize, tileRowSize);+ (UCHAR *)tile.get() + ty * tileWidth * pixelSize, tileRowSize);}x += tileWidth;}} else {int y = m_rowsPerStrip * m_stripIndex;- int ok = TIFFReadRGBAStrip_64(m_tiff, y, (uint64 *)m_stripBuffer);+ int ok = TIFFReadRGBAStrip_64(m_tiff, static_cast<uint32_t>(y), reinterpret_cast<uint32_t *>(m_stripBuffer)); // change: Cast for uint32_t * (resolve parameter init error)assert(ok);}}@@ -1110,4 +1117,4 @@ Tiio::Writer *Tiio::makeTifWriter() {#endifreturn new TifWriter();-}+}\ No newline at end of filediff --git a/toonz/sources/mousedragfilter/CMakeLists.txt b/toonz/sources/mousedragfilter/CMakeLists.txtindex d825b6c12..6220dc2bb 100644--- a/toonz/sources/mousedragfilter/CMakeLists.txt+++ b/toonz/sources/mousedragfilter/CMakeLists.txt@@ -1,10 +1,7 @@if(BUILD_ENV_APPLE)- cmake_minimum_required(VERSION 2.8.11)- project(MouseDragFilter)-include_directories(.)find_library(FOUNDATION_LIBRARY NAMES Foundation)find_library(CG_LIBRARY NAMES CoreGraphics)add_library(mousedragfilter mousedragfilter.mm mousedragfilter.h)target_link_libraries(mousedragfilter ${CG_LIBRARY} ${FOUNDATION_LIBRARY})-endif()+endif()\ No newline at end of filediff --git a/toonz/sources/toonz/CMakeLists.txt b/toonz/sources/toonz/CMakeLists.txtindex a75fbd1ce..91bf0a025 100644--- a/toonz/sources/toonz/CMakeLists.txt+++ b/toonz/sources/toonz/CMakeLists.txt@@ -112,7 +112,7 @@ set(MOC_HEADERStoolbar.htpanels.htrackerpopup.h- vectorguideddrawingpane.h+ vectorguideddrawingpane.hvectorizerpopup.hvectorizerswatch.hversioncontrol.h@@ -126,8 +126,8 @@ set(MOC_HEADERSxshnoteviewer.hxshrowviewer.hxshtoolbar.h- xdtsimportpopup.h- expressionreferencemanager.h+ xdtsimportpopup.h+ expressionreferencemanager.htooloptionsshortcutinvoker.hexportxsheetpdf.hcustompanelmanager.h@@ -376,16 +376,16 @@ set(SOURCESaudiorecordingpopup.cpplocatorpopup.cppstyleshortcutswitchablepanel.cpp- reframepopup.cpp- autoinputcellnumberpopup.cpp- colormodelbehaviorpopup.cpp- boardsettingspopup.cpp- separatecolorsswatch.cpp- separatecolorspopup.cpp+ reframepopup.cpp+ autoinputcellnumberpopup.cpp+ colormodelbehaviorpopup.cpp+ boardsettingspopup.cpp+ separatecolorsswatch.cpp+ separatecolorspopup.cppxdtsio.cppocaio.cpp- xdtsimportpopup.cpp- expressionreferencemanager.cpp+ xdtsimportpopup.cpp+ expressionreferencemanager.cpptooloptionsshortcutinvoker.cpptvpjson_io.cppexportxsheetpdf.cpp@@ -453,6 +453,7 @@ else()set(MACOSX_BUNDLE_ICON_FILE "OpenToonz.icns")set_source_files_properties(OpenToonz.icns PROPERTIES MACOSX_PACKAGE_LOCATION "Resources")add_executable(OpenToonz MACOSX_BUNDLE OpenToonz.icns ${HEADERS} ${SOURCES} ${OBJCSOURCES} ${RESOURCES})+ add_dependencies(OpenToonz tnzcore tnzbase toonzlib colorfx tnzext image sound toonzqt tnztools tnzstdfx tfarm)#add_definitions(# -DTNZBASE_EXPORTS# -DTPARAM_EXPORTS@@ -539,8 +540,6 @@ elseif(BUILD_ENV_APPLE)endif()endif()- add_dependencies(OpenToonz tnzcore tnzbase toonzlib colorfx tnzext image sound toonzqt tnztools tnzstdfx tfarm)-target_link_libraries(OpenToonzQt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Svg Qt5::XmlQt5::Script Qt5::Widgets Qt5::PrintSupport Qt5::Multimedia Qt5::MultimediaWidgets Qt5::UiTools@@ -548,6 +547,19 @@ elseif(BUILD_ENV_APPLE)${COCOA_LIB} ${EXTRA_LIBS} ${X64ONLY_LIBS} mousedragfilter)+ # ADDED/UPDATED: Expanded dependencies for all libs and utilities (ensures build order)+ add_dependencies(OpenToonz tnzcore tnzbase toonzlib colorfx tnzext image sound toonzqt tnztools tnzstdfx tfarm tcomposer tcleanup tconverter tfarmcontroller tfarmserver)++ # ADDED/UPDATED: Configure Info.plist for bundle (retina support etc.)+ set_target_properties(OpenToonz PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${CMAKE_SOURCE_DIR}/../cmake/BundleInfo.plist.in)++ # ADDED/UPDATED: Merged RPATH command (single one with both paths; || true for CI; COMMENT for logs)+ add_custom_command(TARGET OpenToonz POST_BUILD+ COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @executable_path/. "$<TARGET_FILE:OpenToonz>" || true+ COMMAND ${CMAKE_INSTALL_NAME_TOOL} -add_rpath ${CMAKE_INSTALL_RPATH} "$<TARGET_FILE:OpenToonz>" || true+ COMMENT "Adding RPATHs to OpenToonz executable"+ )+elseif(BUILD_ENV_UNIXLIKE)_find_toonz_library(EXTRA_LIBS "tnzcore;tnzbase;toonzlib;colorfx;tnzext;image;sound;toonzqt;tnztools")@@ -574,48 +586,78 @@ endif()if(BUILD_ENV_APPLE)# CMAKE_RUNTIME_OUTPUT_DIRECTORY should be equivalent to usage on windows despite empty# OSX だと CMAKE_RUNTIME_OUTPUT_DIRECTORY が空だが Windows 版と同じ使い方ができるようにしておく- get_target_property(bin OpenToonz LOCATION)- get_filename_component(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${bin} DIRECTORY)- # show CMAKE_RUNTIME_OUTPUT_DIRECTORY+ # Removed: get_target_property(bin OpenToonz LOCATION)+ # Use generator expression for runtime directory+ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "$<TARGET_FILE_DIR:OpenToonz>")message("CMAKE_RUNTIME_OUTPUT_DIRECTORY:" ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})endif()# copy utility executables onto the directory after buildif(LZODRIVER_FOUND)- add_custom_command(TARGET OpenToonz POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:lzocompress> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} DEPENDS lzocompress)- add_custom_command(TARGET OpenToonz POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:lzodecompress> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} DEPENDS lzodecompress)+ add_custom_command(TARGET OpenToonz POST_BUILD+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:lzocompress> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}+ COMMENT "Copying lzocompress to output dir"+ )+ add_custom_command(TARGET OpenToonz POST_BUILD+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:lzodecompress> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}+ COMMENT "Copying lzodecompress to output dir"+ )+ add_dependencies(OpenToonz lzocompress lzodecompress) # Ensures orderendif()if(BUILD_ENV_APPLE)get_target_property(loc OpenToonz MACOSX_BUNDLE_NAME)message(" ==> App Bundle: " ${loc})- message(" ==> Mach-o: " ${bin})+ message(" ==> Mach-o: " $<TARGET_FILE:OpenToonz>) # Fixed: Use generator expression instead of ${bin}foreach(lib ${EXTRA_LIBS})message(" copy:" ${lib} "==>" ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})- add_custom_command(TARGET OpenToonz POST_BUILD COMMAND cp ${lib} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY})+ add_custom_command(TARGET OpenToonz POST_BUILD+ COMMAND ${CMAKE_COMMAND} -E copy ${lib} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} # UPDATED: Use CMAKE_COMMAND for portability (instead of cp)+ COMMENT "Copying lib ${lib} to output dir"+ )endforeach()+ # ADDED: Already included in expanded dependencies above- add_custom_command(TARGET OpenToonz POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:tcomposer> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} DEPENDS tcomposer)- add_custom_command(TARGET OpenToonz POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:tcleanup> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} DEPENDS tcleanup)- add_custom_command(TARGET OpenToonz POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:tconverter> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} DEPENDS tconverter)- add_custom_command(TARGET OpenToonz POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:tfarmcontroller> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} DEPENDS tfarmcontroller)- add_custom_command(TARGET OpenToonz POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:tfarmserver> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY} DEPENDS tfarmserver)-- add_custom_command(TARGET OpenToonz POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../Resources)- add_custom_command(TARGET OpenToonz POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../install/SystemVar.ini ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../Resources)-- add_custom_command(TARGET OpenToonz POST_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../../../qss)+ add_custom_command(TARGET OpenToonz POST_BUILD+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:tcomposer> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}+ COMMENT "Copying tcomposer to output dir"+ )+ add_custom_command(TARGET OpenToonz POST_BUILD+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:tcleanup> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}+ COMMENT "Copying tcleanup to output dir"+ )+ add_custom_command(TARGET OpenToonz POST_BUILD+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:tconverter> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}+ COMMENT "Copying tconverter to output dir"+ )+ add_custom_command(TARGET OpenToonz POST_BUILD+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:tfarmcontroller> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}+ COMMENT "Copying tfarmcontroller to output dir"+ )+ add_custom_command(TARGET OpenToonz POST_BUILD+ COMMAND ${CMAKE_COMMAND} -E copy $<TARGET_FILE:tfarmserver> ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}+ COMMENT "Copying tfarmserver to output dir"+ )+ # ADDED: Already included in expanded dependencies above- add_custom_command(TARGET OpenToonz- POST_BUILD COMMAND- ${CMAKE_INSTALL_NAME_TOOL} -add_rpath @executable_path/. ${bin} || true+ add_custom_command(TARGET OpenToonz POST_BUILD+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../Resources+ COMMENT "Creating Resources directory")- add_custom_command(TARGET OpenToonz- POST_BUILD COMMAND- ${CMAKE_INSTALL_NAME_TOOL} -add_rpath ${CMAKE_INSTALL_RPATH} ${bin} || true+ add_custom_command(TARGET OpenToonz POST_BUILD+ COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/../install/SystemVar.ini ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../Resources+ COMMENT "Copying SystemVar.ini to Resources")-elseif(BUILD_ENV_UNIXLIKE AND BUILD_TARGET_WIN)+ add_custom_command(TARGET OpenToonz POST_BUILD+ COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/../../../qss+ COMMENT "Creating qss directory"+ )++ # REMOVED: The duplicate RPATH commands were merged at the top of if(BUILD_ENV_APPLE)+endif()++if(BUILD_ENV_UNIXLIKE AND BUILD_TARGET_WIN)# Setup files on Windows platform while cross compilation.install(TARGETS@@ -764,4 +806,4 @@ exec \$OPENTOONZ_BASE/bin/OpenToonz \"\$@\"DESTINATION share/opentoonz)-endif()+endif()\ No newline at end of file