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 #124

Closed
wants to merge 4 commits into from
Closed
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})
97 changes: 97 additions & 0 deletions ImagePlay/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.