Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move to CMake build system #125

Open
wants to merge 6 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ ImagePlay.VC.db
IPL/release/
IPL/debug/
IPL/lib/

# cmake build dir
[bB]uild/
13 changes: 13 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
cmake_minimum_required(VERSION 3.16)
project(
ImagePlayMain
VERSION 1.0
LANGUAGES C CXX)

include(GNUInstallDirs)

set(EXECUTABLE_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build/bin)
set(LIBRARY_OUTPUT_PATH ${CMAKE_CURRENT_SOURCE_DIR}/build/lib)

add_subdirectory(IPL)
add_subdirectory(ImagePlay)
53 changes: 53 additions & 0 deletions IPL/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
cmake_minimum_required(VERSION 3.1)

# Define project name
project(IPL)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(${${TargetName}_COMPILE_OPTIONS} -g -O0)

set(CXX_STANDARD 11)
set(CXX_STANDARD_REQUIRED TRUE)
set(CXX_EXTENSIONS FALSE)

file(GLOB_RECURSE SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")

add_library(${PROJECT_NAME} SHARED ${SOURCES})

find_package(OpenCV 4 REQUIRED)
message(STATUS " OpenCV library status: ")
message(STATUS " config: ${OpenCV_DIR} ")
message(STATUS " version: ${OpenCV_VERSION} ")
message(STATUS " libraries: ${OpenCV_LIBS} ")
message(STATUS " include path: ${OpenCV_INCLUDE_DIRS} ")

target_include_directories(
${PROJECT_NAME}
PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" ${OpenCV_INCLUDE_DIRS}
"${CMAKE_CURRENT_SOURCE_DIR}/include/processes")

target_compile_definitions(${PROJECT_NAME} PUBLIC ${PROJECT_NAME}_LIBRARY)

target_link_libraries(${PROJECT_NAME} PUBLIC ${OpenCV_LIBS} freeimage)

set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH
TRUE)

if(CLANG)
target_compile_options(${PROJECT_NAME} -openmp)
endif()

if(GCC AND NOT CLANG)
target_link_libraries(${PROJECT_NAME} PUBLIC gomp)

target_compile_options(${PROJECT_NAME} -fopenmp)
endif()

install(
TARGETS ${PROJECT_NAME}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
FRAMEWORK DESTINATION ${CMAKE_INSTALL_LIBDIR}
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})
84 changes: 84 additions & 0 deletions ImagePlay/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
cmake_minimum_required(VERSION 3.1)

# Define project name
project(ImagePlay)

set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)

set(${${TargetName}_COMPILE_OPTIONS} -g -O0)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)

if(CMAKE_VERSION VERSION_LESS "3.7.0")
set(CMAKE_INCLUDE_CURRENT_DIR ON)
endif()

set(CXX_STANDARD 11)
set(CXX_STANDARD_REQUIRED ON)
set(CXX_EXTENSIONS OFF)

file(GLOB_RECURSE SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp")
file(GLOB_RECURSE HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
file(GLOB_RECURSE QRC_FILES "${CMAKE_CURRENT_SOURCE_DIR}/res/*.qrc")

set(PLUGIN_DIR ${CMAKE_CURRENT_SOURCE_DIR}/media/plugin_development)

add_executable(${PROJECT_NAME} ${SOURCES} ${HEADERS} ${PLUGIN_SRC}
${PLUGIN_HEADERS} ${QRC_FILES})

set_target_properties(${PROJECT_NAME} PROPERTIES INSTALL_RPATH_USE_LINK_PATH
TRUE)

target_include_directories(
${PROJECT_NAME}
PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/include/"
"${CMAKE_CURRENT_SOURCE_DIR}/../IPL/include/"
"${CMAKE_CURRENT_SOURCE_DIR}/../IPL/include/processes/"
${OpenCV_INCLUDE_DIRS})

target_compile_definitions(
${PROJECT_NAME}
PRIVATE IMAGEPLAY_APPCAST_URL="http://cpvrlab.github.io/ImagePlay/Appcast.xml"
IMAGEPLAY_URL="http://cpvrlab.github.io/ImagePlay")

find_package(
Qt5
COMPONENTS Core Widgets Gui
REQUIRED)

target_link_libraries(${PROJECT_NAME} PRIVATE Qt5::Core Qt5::Gui Qt5::Widgets)

target_compile_definitions(
${PROJECT_NAME}
PRIVATE APP_COMPANY="BFH"
APP_COPYRIGHT=" "
APP_DESCRIPTION=" "
APP_NAME="${PROJECT_NAME}"
APP_PRODUCT="${PROJECT_NAME}"
APP_VERSION="6.1.0"
LINUX_PATH_PREFIX="/usr/share/${PROJECT_NAME}/")

if(LINUX)
target_link_libraries(${PROJECT_NAME} PRIVATE IPL dl)
endif()

if(GCC AND NOT CLANG)
target_link_libraries(${PROJECT_NAME} PRIVATE gomp)
endif()

if(_ss_USE_FERVOR_UPDATER)
target_compile_definitions(${PROJECT_NAME} PRIVATE USE_FERVOR_UPDATER)
endif()

install(
TARGETS ${PROJECT_NAME}
BUNDLE DESTINATION .
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

# Consider using qt_generate_deploy_app_script() for app deployment if the
# project can use Qt 6.3. In that case rerun qmake2cmake with
# --min-qt-version=6.3.
64 changes: 64 additions & 0 deletions ImagePlay/res/ressources.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,70 @@
<file>plugins.png</file>
<file>thumbnails_on.png</file>
<file>thumbnails_off.png</file>
<file>process_icons/IPLAddNoise.png</file>
<file>process_icons/IPLAgglomerate.png</file>
<file>process_icons/IPLArithmeticOperations.png</file>
<file>process_icons/IPLArithmeticOperationsConstant.png</file>
<file>process_icons/IPLBinarize.png</file>
<file>process_icons/IPLBinarizeEntropy.png</file>
<file>process_icons/IPLBinarizeKMeans.png</file>
<file>process_icons/IPLBinarizeOtsu.png</file>
<file>process_icons/IPLBinarizeSavola.png</file>
<file>process_icons/IPLBinarizeUnimodal.png</file>
<file>process_icons/IPLBlendImages.png</file>
<file>process_icons/IPLCamera.png</file>
<file>process_icons/IPLCanny.png</file>
<file>process_icons/IPLCanvasSize.png</file>
<file>process_icons/IPLCompassMask.png</file>
<file>process_icons/IPLConvertToColor.png</file>
<file>process_icons/IPLConvertToGray.png</file>
<file>process_icons/IPLConvolutionFilter.png</file>
<file>process_icons/IPLEnhanceMode.png</file>
<file>process_icons/IPLEqualizeHistogram.png</file>
<file>process_icons/IPLExtractLines.png</file>
<file>process_icons/IPLExtrema.png</file>
<file>process_icons/IPLFalseColor.png</file>
<file>process_icons/IPLFFT.png</file>
<file>process_icons/IPLFillConcavities.png</file>
<file>process_icons/IPLFlipImage.png</file>
<file>process_icons/IPLFrequencyFilter.png</file>
<file>process_icons/IPLGabor.png</file>
<file>process_icons/IPLGammaCorrection.png</file>
<file>process_icons/IPLGaussianLowPass.png</file>
<file>process_icons/IPLGradientOperator.png</file>
<file>process_icons/IPLHysteresisThreshold.png</file>
<file>process_icons/IPLIFFT.png</file>
<file>process_icons/IPLInverseContrastRatioMapping.png</file>
<file>process_icons/IPLLabelBlobs.png</file>
<file>process_icons/IPLLaplaceOfGaussian.png</file>
<file>process_icons/IPLLoadImage.png</file>
<file>process_icons/IPLLoadImageSequence.png</file>
<file>process_icons/IPLLocalThreshold.png</file>
<file>process_icons/IPLMarkImage.png</file>
<file>process_icons/IPLMax.png</file>
<file>process_icons/IPLMaxMinMedian.png</file>
<file>process_icons/IPLMedian.png</file>
<file>process_icons/IPLMergePlanes.png</file>
<file>process_icons/IPLMin.png</file>
<file>process_icons/IPLMorphologicalEdge.png</file>
<file>process_icons/IPLMorphologyBinary.png</file>
<file>process_icons/IPLMorphologyGrayscale.png</file>
<file>process_icons/IPLMorphologyHitMiss.png</file>
<file>process_icons/IPLMultiplyConstant.png</file>
<file>process_icons/IPLNegate.png</file>
<file>process_icons/IPLNormalizeIllumination.png</file>
<file>process_icons/IPLOnePixelEdge.png</file>
<file>process_icons/IPLRankTransform.png</file>
<file>process_icons/IPLResize.png</file>
<file>process_icons/IPLRotate.png</file>
<file>process_icons/IPLSaveImage.png</file>
<file>process_icons/IPLSplitPlanes.png</file>
<file>process_icons/IPLStretchContrast.png</file>
<file>process_icons/IPLSubstractImages.png</file>
<file>process_icons/IPLSynthesize.png</file>
<file>process_icons/IPLTriangleSegmentation.png</file>
<file>process_icons/IPLUnsharpMasking.png</file>
<file>process_icons/Plugin.png</file>
<file>icons/24hours-phone.png</file>
<file>icons/abs.png</file>
<file>icons/add.png</file>
Expand Down
File renamed without changes.
20 changes: 8 additions & 12 deletions ImagePlay/src/IPProcessList.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,18 @@ void IPProcessList::addProcessItem(QString processID, QString text, QString keyw
{
// load icon from png file and add background color based on the process category

QFileInfo iconFile(_mainWindow->processIconPath(processID));
QPixmap iconFile(":/process_icons/" + processID + QString(".png"));

if(!iconFile.exists())
{
iconFile = QFileInfo(_mainWindow->processIconPath("Plugin"));
if (iconFile.isNull()) {
iconFile = QPixmap(":/process_icons/Plugin.png");
}

QPixmap finalIcon(25,25);

if(iconFile.exists())
{
QPixmap transparentIcon(iconFile.absoluteFilePath());
QPixmap finalIcon(25, 25);

QPainter painter(&finalIcon);
painter.fillRect(0,0,25,25,_categoryColors.at(category));
painter.drawPixmap(0,0,25,25,transparentIcon);
if (!iconFile.isNull()) {
QPainter painter(&finalIcon);
painter.fillRect(0, 0, 25, 25, _categoryColors.at(category));
painter.drawPixmap(0, 0, 25, 25, iconFile);
}

QListWidgetItem* newItem = new QListWidgetItem(finalIcon, text);
Expand Down
7 changes: 1 addition & 6 deletions ImagePlay/src/IPProcessListTabWidget.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,7 @@ void IPProcessListTabWidget::init(MainWindow *mainWindow)
// use icon of first process for the category tab
if(categoryIcon.width() == 0)
{
QFileInfo iconFile(_mainWindow->processIconPath(processID));

if(iconFile.exists())
{
categoryIcon = QPixmap(iconFile.absoluteFilePath());
}
categoryIcon = QPixmap (":/process_icons/" + processID + QString(".png"));
}
}

Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.