Skip to content

Commit

Permalink
Merge branch 'v0.2dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
afichet committed May 21, 2021
2 parents 96bd152 + 741c045 commit 70f9729
Show file tree
Hide file tree
Showing 32 changed files with 1,491 additions and 437 deletions.
231 changes: 155 additions & 76 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
cmake_minimum_required(VERSION 3.5)

project(openexr-viewer
VERSION 0.1.1
VERSION 0.2
DESCRIPTION "Simple Viewer for OpenEXR files with detailed metadata display"
HOMEPAGE_URL "https://github.com/afichet/openexr-viewer"
LANGUAGES CXX
Expand All @@ -14,10 +14,18 @@ set(CMAKE_AUTORCC ON)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

if (NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Release")
endif()

cmake_policy(SET CMP0074 NEW)

include(GNUInstallDirs)

# ----------------------------------------------------------------------------
# Dependencies
# ----------------------------------------------------------------------------

find_package(QT NAMES Qt6 Qt5 COMPONENTS Widgets REQUIRED)
find_package(Qt${QT_VERSION_MAJOR} COMPONENTS Widgets REQUIRED)

Expand All @@ -29,74 +37,83 @@ find_package(OpenEXR REQUIRED)

set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake)

# ----------------------------------------------------------------------------
# Source
# ----------------------------------------------------------------------------

set(PROJECT_SOURCES
src/main.cpp
src/view/mainwindow.cpp
src/view/mainwindow.h
src/view/mainwindow.ui

src/view/GraphicsScene.cpp
src/view/GraphicsScene.h

src/view/GraphicsView.cpp
src/view/GraphicsView.h

src/view/RGBFramebufferWidget.cpp
src/view/RGBFramebufferWidget.h
src/view/RGBFramebufferWidget.ui

src/view/FramebufferWidget.cpp
src/view/FramebufferWidget.h
src/view/FramebufferWidget.ui

src/model/OpenEXRImage.cpp
src/model/OpenEXRImage.h
src/model/OpenEXRLayerItem.cpp
src/model/OpenEXRLayerItem.h
src/model/OpenEXRHeaderItem.cpp
src/model/OpenEXRHeaderItem.h

src/model/ImageModel.cpp
src/model/ImageModel.h
src/model/FramebufferModel.cpp
src/model/FramebufferModel.h
src/model/RGBFramebufferModel.cpp
src/model/RGBFramebufferModel.h

src/model/HeaderModel.cpp
src/model/HeaderModel.h

src/util/Colormap.cpp
src/util/Colormap.h
src/util/TabulatedColormap.cpp
src/util/TabulatedColormap.h
src/util/BBGRColormap.cpp
src/util/BBGRColormap.h
src/util/YColormap.cpp
src/util/YColormap.h
src/util/ColormapModule.h
src/util/ColormapModule.cpp

openexr-viewer.rc
src/main.cpp
src/view/mainwindow.cpp
src/view/mainwindow.h
src/view/mainwindow.ui

src/view/GraphicsScene.cpp
src/view/GraphicsScene.h

src/view/GraphicsView.cpp
src/view/GraphicsView.h

src/view/RGBFramebufferWidget.cpp
src/view/RGBFramebufferWidget.h
src/view/RGBFramebufferWidget.ui

src/view/FramebufferWidget.cpp
src/view/FramebufferWidget.h
src/view/FramebufferWidget.ui

src/model/OpenEXRImage.cpp
src/model/OpenEXRImage.h
src/model/OpenEXRLayerItem.cpp
src/model/OpenEXRLayerItem.h
src/model/OpenEXRHeaderItem.cpp
src/model/OpenEXRHeaderItem.h

src/model/ImageModel.cpp
src/model/ImageModel.h
src/model/FramebufferModel.cpp
src/model/FramebufferModel.h
src/model/RGBFramebufferModel.cpp
src/model/RGBFramebufferModel.h

src/model/HeaderModel.cpp
src/model/HeaderModel.h

src/util/Colormap.cpp
src/util/Colormap.h
src/util/TabulatedColormap.cpp
src/util/TabulatedColormap.h
src/util/BBGRColormap.cpp
src/util/BBGRColormap.h
src/util/YColormap.cpp
src/util/YColormap.h
src/util/ColormapModule.h
src/util/ColormapModule.cpp

openexr-viewer.rc
assets/themes/dark_flat.qrc
)

if(${QT_VERSION_MAJOR} GREATER_EQUAL 6)
if (WIN32)
qt_add_executable(openexr-viewer WIN32
${PROJECT_SOURCES}
)
elseif(APPLE)
qt_add_executable(openexr-viewer MACOSX_BUNDLE
${PROJECT_SOURCES}
)
else()
qt_add_executable(openexr-viewer
${PROJECT_SOURCES}
)
endif()
else()
if(ANDROID)
add_library(openexr-viewer SHARED
if(WIN32)
add_executable(openexr-viewer WIN32
${PROJECT_SOURCES}
)
elseif(WIN32)
add_executable(openexr-viewer WIN32
elseif(APPLE)
add_executable(openexr-viewer MACOSX_BUNDLE
${PROJECT_SOURCES}
)
else()
Expand All @@ -114,50 +131,112 @@ target_link_libraries(openexr-viewer PRIVATE Imath::Imath OpenEXR::OpenEXR)

if((OpenMP_CXX_FOUND) OR (OpenMP_FOUND))
target_link_libraries(openexr-viewer PRIVATE OpenMP::OpenMP_CXX)
# target_link_libraries(openexr-viewer PRIVATE OpenMP::OpenMP_C)
# target_link_libraries(openexr-viewer PRIVATE OpenMP::OpenMP_C)
endif()

# Install

install(TARGETS openexr-viewer)
install(
FILES $<TARGET_FILE:Imath::Imath>
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
install(
FILES $<TARGET_FILE:OpenEXR::OpenEXR>
DESTINATION ${CMAKE_INSTALL_LIBDIR}
)
if (WIN32)
add_custom_command(
TARGET openexr-viewer POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
$<TARGET_FILE:Qt${QT_VERSION_MAJOR}::Widgets>
$<TARGET_FILE:Qt${QT_VERSION_MAJOR}::Core>
$<TARGET_FILE:Qt${QT_VERSION_MAJOR}::Gui>
$<TARGET_FILE_DIR:openexr-viewer>
)
endif(WIN32)


# ----------------------------------------------------------------------------
# Install Rules
# ----------------------------------------------------------------------------

if(UNIX AND NOT APPLE)
install(TARGETS openexr-viewer)

# Application desktop entry
install(
FILES deploy/linux/openexr-viewer.desktop
DESTINATION share/applications
FILES
deploy/linux/openexr-viewer.desktop
DESTINATION
share/applications
)

# MIME data
install(
FILES deploy/linux/openexr-viewer.xml
DESTINATION share/mime/packages
FILES
deploy/linux/openexr-viewer.xml
DESTINATION
share/mime/packages
)

# Application icon
install(
FILES deploy/icon/openexr-viewer.png
DESTINATION share/pixmaps
FILES
deploy/icon/openexr-viewer.png
DESTINATION
share/pixmaps
)
elseif(WIN32)
# include(Windeployqt)
# windeployqt(openexr-viewer ${CMAKE_INSTALL_LIBDIR})
install(
TARGETS
openexr-viewer
DESTINATION
${CMAKE_INSTALL_BINDIR}
)

set(CMAKE_INSTALL_OPENMP_LIBRARIES TRUE)
include(InstallRequiredSystemLibraries)

install(
FILES
"${ZLIB_ROOT}\\bin\\zlib.dll" # Zlib
$<TARGET_FILE:Imath::Imath> # OpenEXR
$<TARGET_FILE:OpenEXR::Iex>
$<TARGET_FILE:OpenEXR::IlmThread>
$<TARGET_FILE:OpenEXR::OpenEXR>
${CMAKE_INSTALL_SYSTEM_RUNTIME_LIBS} # Windows DLLs
DESTINATION
${CMAKE_INSTALL_BINDIR}
)

include(Windeployqt)
windeployqt(openexr-viewer ${CMAKE_INSTALL_BINDIR})
endif()


# CPack
include(CPack)
# ----------------------------------------------------------------------------
# Packaging
# ----------------------------------------------------------------------------

# set(CPACK_PACKAGE_NAME "OpenEXR Viewer")
# set(CPACK_PACKAGE_VENDOR "")
set(CPACK_PACKAGE_DESCRIPTION "Simple Viewer for OpenEXR files with detailed metadata display")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "OpenEXR Viewer")
# set(CPACK_PACKAGE_ICON "")
# set(CPACK_PACKAGE_CHECKSUM "SHA512")
set(CPACK_RESOURCE_FILE_LICENSE "LICENSE")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_LIST_DIR}/LICENSE")
# set(CPACK_RESOURCE_FILE_README "README.md")
set(CPACK_MONOLITHIC_INSTALL True)
set(CPACK_PACKAGE_EXECUTABLES "openexr-viewer;OpenEXR Viewer")
set(CPACK_PACKAGE_EXECUTABLES "openexr-viewer;OpenEXR Viewer")

# NSIS specific settings
if(CPACK_GENERATOR MATCHES "NSIS")
set(CPACK_NSIS_MUI_ICON "${CMAKE_CURRENT_LIST_DIR}/deploy/icon/openexr-viewer.ico")
set(CPACK_NSIS_HELP_LINK "")
set(CPACK_NSIS_URL_INFO_ABOUT "")
set(CPACK_CREATE_DESKTOP_LINKS "OpenEXR Viewer")
set(CPACK_NSIS_INSTALLED_ICON_NAME "openexr-viewer.exe")
set(CPACK_NSIS_MENU_LINKS "openexr-viewer.exe" "OpenEXR Viewer")
set(CPACK_NSIS_MODIFY_PATH OFF)
set(CPACK_NSIS_EXECUTABLES_DIRECTORY ".")
set(CPACK_NSIS_MUI_FINISHPAGE_RUN "openexr-viewer.exe")
endif(CPACK_GENERATOR MATCHES "NSIS")

if("${CPACK_GENERATOR}" STREQUAL "PackageMaker")
set(CPACK_PACKAGE_DEFAULT_LOCATION "/Applications")
endif("${CPACK_GENERATOR}" STREQUAL "PackageMaker")


# CPack
include(CPack)
27 changes: 6 additions & 21 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,29 +1,14 @@
BSD 3-Clause License

Copyright (c) 2021, Alban
Copyright (c) 2021, Alban Fichet
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.

3. Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
9 changes: 9 additions & 0 deletions assets/themes/dark_flat.qrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<RCC>
<qresource prefix="/">
<file>dark_flat/theme.css</file>
<file>dark_flat/icons/down-scroll.svg</file>
<file>dark_flat/icons/left-scroll.svg</file>
<file>dark_flat/icons/right-scroll.svg</file>
<file>dark_flat/icons/up-scroll.svg</file>
</qresource>
</RCC>
31 changes: 31 additions & 0 deletions assets/themes/dark_flat/icons/down-scroll.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 70f9729

Please sign in to comment.