Skip to content

Commit

Permalink
Canon SDK support for Linux
Browse files Browse the repository at this point in the history
  • Loading branch information
manongjohn committed Jan 26, 2025
1 parent 7380f81 commit 2e05335
Show file tree
Hide file tree
Showing 9 changed files with 57 additions and 16 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/linux_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ jobs:
restore-keys: |
${{ runner.os }}-${{ matrix.compiler }}-
${{ runner.os }}-
- name: Get CanonSDK
if: ${{ (github.repository_owner == 'tahoma2d' || github.repository_owner == 'manongjohn') && github.event_name == 'push' }}
run: |
wget --header="Authorization: token ${{ secrets.TAHOMA2D_TOKEN }}" --header="Accept:application/octet-stream" -O EDSDK_Linux.zip https://api.github.com/repos/tahoma2d/CanonSDK/releases/assets/223415219
unzip EDSDK_Linux.zip -d EDSDK_Linux
mv EDSDK_Linux/EDSDK/* thirdparty/canon
- name: Build ffmpeg
run: |
export CC="ccache ${{ matrix.cc }}"
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/macOS_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
key: ${{ runner.os }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-
- name: Get CanonSDK
if: ${{ github.repository_owner == 'tahoma2d' && github.event_name == 'push' }}
if: ${{ (github.repository_owner == 'tahoma2d' || github.repository_owner == 'manongjohn') && github.event_name == 'push' }}
run: |
wget --header="Authorization: token ${{ secrets.TAHOMA2D_TOKEN }}" --header="Accept:application/octet-stream" -O EDSDK_Macintosh.zip https://api.github.com/repos/tahoma2d/CanonSDK/releases/assets/223415237
unzip EDSDK_Macintosh.zip -d EDSDK_Macintosh
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/windows_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
key: ${{ runner.os }}-${{ github.sha }}
restore-keys: ${{ runner.os }}-
- name: Get CanonSDK
if: ${{ github.repository_owner == 'tahoma2d' && github.event_name == 'push' }}
if: ${{ (github.repository_owner == 'tahoma2d' || github.repository_owner == 'manongjohn') && github.event_name == 'push' }}
run: |
curl -H "Authorization: token ${{ secrets.TAHOMA2D_TOKEN }}" -H "Accept:application/octet-stream" -fsSL -o EDSDK_Windows.zip https://api.github.com/repos/tahoma2d/CanonSDK/releases/assets/223415203
7z x EDSDK_Windows.zip -oEDSDK_Windows
Expand Down
7 changes: 6 additions & 1 deletion ci-scripts/linux/tahoma-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,13 @@ cd build

source /opt/qt515/bin/qt515-env.sh

if [ -d ../../thirdparty/canon/Header ]
then
export CANON_FLAG=-DWITH_CANON=ON
fi

export LD_LIBRARY_PATH=/usr/local/lib:$LD_LIBRARY_PATH
cmake ../sources \
cmake ../sources $CANON_FLAG \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DWITH_GPHOTO2:BOOL=ON \
-DWITH_SYSTEM_SUPERLU=ON
Expand Down
6 changes: 6 additions & 0 deletions ci-scripts/linux/tahoma-buildpkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ then
chmod 755 -R Tahoma2D/rhubarb
fi

if [ -d ../../thirdparty/canon/Library ]
then
echo ">>> Copying canon libraries"
cp -R ../../thirdparty/canon/Library/x86_64/* appdir/usr/lib
fi

echo ">>> Copying libghoto2 supporting directories"
cp -r /usr/local/lib/libgphoto2 appdir/usr/lib
cp -r /usr/local/lib/libgphoto2_port appdir/usr/lib
Expand Down
19 changes: 11 additions & 8 deletions toonz/sources/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,10 @@ elseif(BUILD_ENV_UNIXLIKE)
set(PLATFORM 32)
endif()
if(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_definitions(-DLINUX)
add_definitions(
-DLINUX
-DTARGET_OS_LINUX
)
elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku")
add_definitions(-DHAIKU)
set(PRELOAD_VARIABLE "LIBRARY_PATH")
Expand Down Expand Up @@ -399,11 +402,7 @@ if(BUILD_ENV_MSVC)
set(OPENBLAS_LIB ${SDKROOT}/openblas/libopenblas_${PLATFORM}.lib)
set(USB_LIB) # unused
if (WITH_CANON)
if(BUILD_ENV_APPLE)
set(CANON_LIB ${SDKROOT}/canon/Framework/EDSDK.framework)
else()
set(CANON_LIB ${SDKROOT}/canon/library/EDSDK.lib)
endif()
set(CANON_LIB ${SDKROOT}/canon/library/EDSDK.lib)
endif()
set(MYPAINT_LIB_INCLUDE_DIRS ${SDKROOT}/libmypaint/dist/${PLATFORM}/include/libmypaint)
set(MYPAINT_LIB_LDFLAGS ${SDKROOT}/libmypaint/dist/${PLATFORM}/libmypaint.lib)
Expand Down Expand Up @@ -469,8 +468,7 @@ elseif(BUILD_ENV_APPLE)
if (WITH_CANON)
if(BUILD_ENV_APPLE)
set(CANON_LIB ${SDKROOT}/canon/Framework/EDSDK.framework)
else()
set(CANON_LIB ${SDKROOT}/canon/library/EDSDK.lib)
message("**************** canon lib:" ${CANON_LIB})
endif()
endif()

Expand Down Expand Up @@ -552,6 +550,11 @@ elseif(BUILD_ENV_UNIXLIKE)
find_library(TURBOJPEG_LIB turbojpeg)
message("**************** turbojpeg lib:" ${TURBOJPEG_LIB})

if (WITH_CANON)
set(CANON_LIB ${SDKROOT}/canon/Library/x86_64/libEDSDK.so)
message("**************** canon lib:" ${CANON_LIB})
endif()

if(WITH_GPHOTO2)
find_library(GPHOTO2_LIB gphoto2)
message("**************** gphoto2 lib:" ${GPHOTO2_LIB})
Expand Down
4 changes: 2 additions & 2 deletions toonz/sources/stopmotion/canon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -829,7 +829,7 @@ bool Canon::downloadImage(EdsBaseRef object) {
if ((m_imageQuality.toLower().contains("jpeg") ||
m_imageQuality.toLower().contains("jpg")) &&
m_imageQuality.toLower().contains("raw")) {
#ifdef MACOSX
#if defined(MACOSX) || defined(LINUX)
EdsUInt64 rawStreamSize = 0;
#else
unsigned __int64 rawStreamSize = 0;
Expand Down Expand Up @@ -872,7 +872,7 @@ bool Canon::downloadImage(EdsBaseRef object) {
bufferSize = width * height * 4;
}

#ifdef MACOSX
#if defined(MACOSX) || defined(LINUX)
EdsUInt64 jpgStreamSize = 0;
EdsUInt64 rawStreamSize = 0;
#else
Expand Down
4 changes: 1 addition & 3 deletions toonz/sources/stopmotion/jpgconverter.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,14 +33,12 @@ class JpgConverter : public QThread {
EdsStreamRef m_stream;
#endif

#if defined(MACOSX)
#if defined(MACOSX) || defined(LINUX)
#ifdef WITH_CANON
EdsUInt64 m_dataSize = 0;
#else
unsigned long long m_dataSize = 0;
#endif
#elif defined(LINUX)
unsigned long long m_dataSize = 0;
#else
unsigned __int64 m_dataSize = 0;
#endif
Expand Down
23 changes: 23 additions & 0 deletions toonz/sources/toonz/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -542,6 +542,29 @@ elseif(BUILD_ENV_APPLE)
${COCOA_LIB} ${EXTRA_LIBS} mousedragfilter
)

elseif(BUILD_ENV_UNIXLIKE AND WITH_CANON)
_find_toonz_library(EXTRA_LIBS "tnzcore;tnzbase;toonzlib;colorfx;tnzext;image;sound;toonzqt;tnztools")

# 変なところにライブラリ生成するカスども
set(EXTRA_LIBS ${EXTRA_LIBS} "$<TARGET_FILE:tnzstdfx>" "$<TARGET_FILE:tfarm>")

set(EXTRA_LIBS ${EXTRA_LIBS} ${Boost_LIBRARIES} ${OPENBLAS_LIB} ${EXECINFO_LIBRARY})

if(WITH_GPHOTO2)
set(EXTRA_LIBS ${EXTRA_LIBS} ${GPHOTO2_LIB} ${GPHOTO2_PORT_LIB})
endif()

if(BUILD_TARGET_WIN)
set(EXTRA_LIBS ${EXTRA_LIBS} Qt5::WinMain -lstrmiids -mwindows)
endif()

target_link_libraries(
Tahoma2D Qt5::Core Qt5::Gui Qt5::Network Qt5::OpenGL Qt5::Svg Qt5::Xml
Qt5::Script Qt5::Widgets Qt5::PrintSupport Qt5::Multimedia Qt5::SerialPort Qt5::UiTools
${GL_LIB} ${GLUT_LIB} ${GLU_LIB} ${CANON_LIB} ${TURBOJPEG_LIB} ${OpenCV_LIBS}
${EXTRA_LIBS} dl
)

elseif(BUILD_ENV_UNIXLIKE)
_find_toonz_library(EXTRA_LIBS "tnzcore;tnzbase;toonzlib;colorfx;tnzext;image;sound;toonzqt;tnztools")

Expand Down

0 comments on commit 2e05335

Please sign in to comment.