diff --git a/.gitignore b/.gitignore index 36920cd..2970a65 100644 --- a/.gitignore +++ b/.gitignore @@ -55,3 +55,6 @@ ImagePlay.VC.db IPL/release/ IPL/debug/ IPL/lib/ + +# cmake build dir +[bB]uild/ diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..ffc6f4d --- /dev/null +++ b/CMakeLists.txt @@ -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) diff --git a/IPL/CMakeLists.txt b/IPL/CMakeLists.txt new file mode 100644 index 0000000..b1f2d3a --- /dev/null +++ b/IPL/CMakeLists.txt @@ -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}) diff --git a/ImagePlay/CMakeLists.txt b/ImagePlay/CMakeLists.txt new file mode 100644 index 0000000..e47f732 --- /dev/null +++ b/ImagePlay/CMakeLists.txt @@ -0,0 +1,97 @@ +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) + +if(TEMPLATE___equals___app) + target_compile_definitions( + ${PROJECT_NAME} + PRIVATE APP_COMPANY="BFH" + APP_COPYRIGHT=" " + APP_DESCRIPTION=" " + APP_NAME="ImagePlay" + APP_PRODUCT="ImagePlay" + APP_VERSION="6.1.0" + LINUX_PATH_PREFIX="/usr/share/imageplay/") +endif() + +if(NOT TEMPLATE___equals___app) + target_compile_definitions( + ${PROJECT_NAME} + PRIVATE APP_COMPANY="BFH" + APP_COPYRIGHT=" " + APP_DESCRIPTION=" " + APP_NAME="ImagePlay" + APP_PRODUCT="${PROJECT_NAME}" + APP_VERSION="6.1.0" + LINUX_PATH_PREFIX="/usr/share/${PROJECT_NAME}/") +endif() + +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. diff --git a/ImagePlay/ui/AboutWindow.ui b/ImagePlay/src/AboutWindow.ui similarity index 100% rename from ImagePlay/ui/AboutWindow.ui rename to ImagePlay/src/AboutWindow.ui diff --git a/ImagePlay/ui/ImageViewerWindow.ui b/ImagePlay/src/ImageViewerWindow.ui similarity index 100% rename from ImagePlay/ui/ImageViewerWindow.ui rename to ImagePlay/src/ImageViewerWindow.ui diff --git a/ImagePlay/ui/MainWindow.ui b/ImagePlay/src/MainWindow.ui similarity index 100% rename from ImagePlay/ui/MainWindow.ui rename to ImagePlay/src/MainWindow.ui diff --git a/ImagePlay/ui/PluginGenerator.ui b/ImagePlay/src/PluginGenerator.ui similarity index 100% rename from ImagePlay/ui/PluginGenerator.ui rename to ImagePlay/src/PluginGenerator.ui diff --git a/ImagePlay/ui/SettingsWindow.ui b/ImagePlay/src/SettingsWindow.ui similarity index 100% rename from ImagePlay/ui/SettingsWindow.ui rename to ImagePlay/src/SettingsWindow.ui diff --git a/ImagePlay/ui/TutorialDialog.ui b/ImagePlay/src/TutorialDialog.ui similarity index 100% rename from ImagePlay/ui/TutorialDialog.ui rename to ImagePlay/src/TutorialDialog.ui