diff --git a/ACG/CMakeLists.txt b/ACG/CMakeLists.txt index 2df8d74f3931fabd3badac2837a9887a033cc88d..c705e59e08d51b1be8b103be58ec246b1639c6b0 100644 --- a/ACG/CMakeLists.txt +++ b/ACG/CMakeLists.txt @@ -8,7 +8,23 @@ if ( ${PROJECT_NAME} MATCHES "OpenFlipper") endif() -acg_qt4 (REQUIRED 4.5) + +if (NOT FORCE_QT4) + # try to use QT5 if possible otherwise stick to QT4 + acg_qt5 () +else() + set (QT_MAX_VERSION 4.9.9) + set (QT5_FOUND false) +endif() + + +if (NOT QT5_FOUND) + message(STATUS "Using QT4 for ACG") + acg_qt4 (REQUIRED 4.5) +else () + message(STATUS "Using QT5 for ACG") +endif () + acg_openmp () acg_ftgl () @@ -48,10 +64,10 @@ find_package(Qwt5) if(Qwt5_Qt4_FOUND) add_definitions(-DWITH_QWT) set(INCLUDE_DIRS ${INCLUDE_DIRS} ${Qwt5_INCLUDE_DIR} ) - set(ADDITIONAL_LINK_LIBRARIES ${ADDITIONAL_LINK_LIBRARIES} ${Qwt5_Qt4_LIBRARY}) + set(ADDITIONAL_LINK_LIBRARIES ${ADDITIONAL_LINK_LIBRARIES} ${Qwt5_Qt4_LIBRARY}) endif() -find_package( Freetype) +find_package( Freetype) if (NOT FREETYPE_FOUND) message (MESSAGE "FREETYPE not found! Disabled ftgl support!") else (NOT FREETYPE_FOUND) @@ -60,7 +76,7 @@ else (NOT FREETYPE_FOUND) message (MESSAGE "FTGL not found! Disabled ftgl support!") else () set(INCLUDE_DIRS ${INCLUDE_DIRS} ${FREETYPE_INCLUDE_DIR_freetype2} ${FREETYPE_INCLUDE_DIR_ft2build} ) - set( ADDITIONAL_LINK_LIBRARIES ${ADDITIONAL_LINK_LIBRARIES} ${FTGL_LIBS} ${FREETYPE_LIBRARIES} ) + set( ADDITIONAL_LINK_LIBRARIES ${ADDITIONAL_LINK_LIBRARIES} ${FTGL_LIBS} ${FREETYPE_LIBRARIES} ) endif () endif () @@ -103,7 +119,7 @@ endif(GTEST_FOUND) #=================================================================== # source code directories -set (directories +set (directories . Geometry Config @@ -133,10 +149,20 @@ acg_append_files (ui "*.ui" ${directories}) acg_drop_templates (sources) # genereate uic and moc targets -acg_qt4_autouic (uic_targets ${ui}) -acg_qt4_automoc (moc_targets ${headers}) +if (QT5_FOUND) + acg_qt5_autouic (uic_targets ${ui}) + acg_qt5_automoc (moc_targets ${headers}) +elseif (QT4_FOUND) + acg_qt4_autouic (uic_targets ${ui}) + acg_qt4_automoc (moc_targets ${headers}) +endif() + -acg_add_library (ACG SHARED ${uic_targets} ${sources} ${headers} ${moc_targets}) +if (QT5_FOUND) + acg_add_library (ACG SHARED ${uic_targets} ${sources} ${headers} ${moc_targets}) +elseif (QT4_FOUND) + acg_add_library (ACG SHARED ${uic_targets} ${sources} ${headers} ${moc_targets}) +endif() if ( NOT WIN32 ) set_target_properties (ACG PROPERTIES VERSION ${ACG_VERSION_MAJOR}.${ACG_VERSION_MINOR} SOVERSION ${ACG_VERSION_MAJOR}.${ACG_VERSION_MINOR}) @@ -156,4 +182,3 @@ target_link_libraries ( ACG OpenMeshCore ${GLEW_LIBRARY} ${GLUT_LIBRARIES} ${ADDITIONAL_LINK_LIBRARIES} ) - diff --git a/CMakeLists.txt b/CMakeLists.txt index 924af9ff52de8b3e7473e5ff2492b5e036a93696..2d76cb25fe3181f87441d7f5de0b62272452b0e2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -26,8 +26,23 @@ acg_get_version (OpenFlipper) include (package) include (ACGOutput) +# try to use QT5 if possible otherwise stick to QT4 +set (FORCE_QT4 ON CACHE BOOL "Use Qt4 even if Qt5 was found") + +if (NOT FORCE_QT4) + acg_qt5 () +else() + set (QT5_FOUND false) +endif() + + +if (NOT QT5_FOUND) + message(STATUS "Using QT4 for OpenFlipper") + acg_qt4 (4.7.0) +else () + message(STATUS "Using QT5 for OpenFlipper") +endif () -acg_qt4 (4.7.0) acg_openmp () acg_ftgl () @@ -97,12 +112,12 @@ add_subdirectory (OpenFlipper/PluginLib) add_subdirectory (tests) # ======================================================================== -# Documentation generators +# Documentation generators # ======================================================================== # Create dirs to make doxygen happy -file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Doc ) -file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Help ) +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Doc ) +file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Help ) # Add the deocumentation targets add_subdirectory (OpenFlipper/Documentation/DeveloperTarget) @@ -110,12 +125,11 @@ add_subdirectory (OpenFlipper/Documentation/DeveloperQtHelpTarget) add_subdirectory (OpenFlipper/Documentation/UserTarget) add_subdirectory (OpenFlipper/Documentation/UserQtHelpTarget) - # ======================================================================== -# Build all additional libraries +# Build all additional libraries # ======================================================================== -# search all libs in the libs directory +# search all libs in the libs directory # (required and optional libraries file ( GLOB _local_libs_in @@ -152,7 +166,7 @@ foreach (_localLib ${REMAINING_LOCAL_LIBS}) # If the library is in the required folder, we have to build it anyway, so # detect it here - SET(REQUIRED FALSE) + SET(REQUIRED FALSE) if ( _localLib MATCHES ".*libs_required.*" ) SET(REQUIRED TRUE ) endif() @@ -160,7 +174,7 @@ foreach (_localLib ${REMAINING_LOCAL_LIBS}) # Extract upper case library dir name for the human readable entries in the cmake config string(TOUPPER ${_local_lib_dir} _local_lib_dir_upper) string(REGEX REPLACE "LIBS[/\\]" "" _local_lib_dir_upper ${_local_lib_dir_upper} ) - + # Only generate setting if the lib is not required (otherwise, we will always build it) if ( NOT DEFINED LIB_${_local_lib_dir_upper}_BUILD AND NOT REQUIRED) set( LIB_${_local_lib_dir_upper}_BUILD true CACHE BOOL "Enable or disable build of ${_local_lib_dir_upper} Library" ) @@ -176,7 +190,7 @@ endforeach () # PolyLine extension special case # ======================================================================== -if ( EXISTS ${CMAKE_SOURCE_DIR}/libs/MeshIntegration ) +if ( EXISTS ${CMAKE_SOURCE_DIR}/libs/MeshIntegration ) add_definitions( -DEXTENDED_POLY_LINE ) endif() @@ -217,10 +231,10 @@ add_subdirectory (OpenFlipper/CoreApp) if (WIN32 ) - # Plugins collected a list of required libdirs for getting + # Plugins collected a list of required libdirs for getting # their DLLS on windows: get_property( WINDOWS_COPY_LIBDIRS GLOBAL PROPERTY WINDOWS_LIBRARY_DIR_LIST ) - + if ( WINDOWS_COPY_LIBDIRS ) list(REMOVE_DUPLICATES WINDOWS_COPY_LIBDIRS) endif() @@ -234,7 +248,7 @@ if (WIN32 ) # let bundle generation depend on all targets add_dependencies (fixbundle OpenFlipper PluginLib ${OPENFLIPPER_PLUGINS}) - + endif(WIN32) # ======================================================================== @@ -250,18 +264,18 @@ if ( APPLE ) # prepare bundle generation cmake file and add a build target for it configure_file ("${CMAKE_SOURCE_DIR}/OpenFlipper/cmake/fixbundle.cmake.in" - "${CMAKE_BINARY_DIR}/fixbundle.cmake" @ONLY IMMEDIATE) + "${CMAKE_BINARY_DIR}/fixbundle.cmake" @ONLY IMMEDIATE) # Fixbundle is only necessary, when we wan't a shippable package. - # Otherwise the original rpaths are used + # Otherwise the original rpaths are used if ( OPENFLIPPER_CALL_FIX_BUNDLE ) - # Call fixbundle every time - add_custom_target (fixbundle ALL + # Call fixbundle every time + add_custom_target (fixbundle ALL COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/fixbundle.cmake" ) else() # Call fixbundle only as a dependency - add_custom_target (fixbundle + add_custom_target (fixbundle COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/fixbundle.cmake" ) endif() diff --git a/OpenFlipper/CoreApp/CMakeLists.txt b/OpenFlipper/CoreApp/CMakeLists.txt index 0d8ed4ecff176bc9650aab64d24579dc84995e37..d80186be281a11619a020af1bc7e306a639e8993 100644 --- a/OpenFlipper/CoreApp/CMakeLists.txt +++ b/OpenFlipper/CoreApp/CMakeLists.txt @@ -39,18 +39,18 @@ else (APPLE) endif(APPLE) # source code directories -set (directories - .. +set (directories + .. ../Core ../Logging ../Scripting ../Scripting/scriptPrototypes ../Scripting/scriptWrappers ../SimpleOpt - ../widgets/aboutWidget + ../widgets/aboutWidget ../widgets/addEmptyWidget ../widgets/loggerWidget - ../widgets/coreWidget + ../widgets/coreWidget ../widgets/helpWidget ../widgets/processManagerWidget ../widgets/loadWidget @@ -73,8 +73,14 @@ acg_append_files (ui "*.ui" ${directories}) acg_drop_templates (sources) # genereate uic and moc targets -acg_qt4_autouic (uic_targets ${ui}) -acg_qt4_automoc (moc_targets ${headers}) +if (QT5_FOUND) + set(CMAKE_AUTOMOC ON) + acg_qt5_autouic (uic_targets ${ui}) + acg_qt5_automoc (moc_targets ${headers}) +else () + acg_qt4_autouic (uic_targets ${ui}) + acg_qt4_automoc (moc_targets ${headers}) +endif() if (WIN32) # add app icon rc file to windows build @@ -104,7 +110,7 @@ endif () # ==================================================================================== # Get list of ll plugin dependencies and handle special ones -# where we need to link the library directly into the core to prevent +# where we need to link the library directly into the core to prevent # linker problems # ==================================================================================== # Get the property containing the list of all dependencies of the plugins @@ -155,6 +161,7 @@ target_link_libraries (OpenFlipper ${GLUT_LIBRARIES} ${FTGL_LIBS} ${COREAPP_ADDITIONAL_LINK_LIBRARIES} + ) if (APPLE) @@ -168,34 +175,28 @@ if (APPLE) MACOSX_BUNDLE_ICON_FILE "OpenFlipper.icns" ) - if ( EXISTS ${CMAKE_SOURCE_DIR}/branding ) + if ( EXISTS ${CMAKE_SOURCE_DIR}/branding ) - # Take bundle icon from branding dir - IF ( NOT APPLE_BUNDLE_ICON ) + IF ( NOT APPLE_BUNDLE_ICON ) # option to set the used Icon for OpenFlipper set ( APPLE_BUNDLE_ICON "${CMAKE_SOURCE_DIR}\\branding\\mac\\OpenFlipper_Icon.icns" CACHE FILEPATH "Path to the Bundle Icon" ) - ENDIF(NOT APPLE_BUNDLE_ICON ) - - # Take plist from branding - IF ( NOT APPLE_INFO_PLIST ) - if ( EXISTS ${CMAKE_SOURCE_DIR}/branding/mac/Info.plist ) - # option to configure the custom Info.plist - set ( APPLE_INFO_PLIST "${CMAKE_SOURCE_DIR}\\branding\\mac\\Info.plist" CACHE FILEPATH "Path to the Info.plist file for Bundle" ) - else ( EXISTS ${CMAKE_SOURCE_DIR}/branding/mac/Info.plist ) - # option to configure a custum Info.plist but configure with default one - set ( APPLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/../installer/mac/Info.plist" CACHE FILEPATH "Path to the Info.plist file for Bundle" ) - endif( EXISTS ${CMAKE_SOURCE_DIR}/branding/mac/Info.plist ) - ENDIF(NOT APPLE_INFO_PLIST ) + ENDIF(NOT APPLE_BUNDLE_ICON ) + + IF ( NOT APPLE_INFO_PLIST ) + if ( EXISTS ${CMAKE_SOURCE_DIR}/branding/mac/Info.plist ) + # option to configure the custom Info.plist + set ( APPLE_INFO_PLIST "${CMAKE_SOURCE_DIR}\\branding\\mac\\Info.plist" CACHE FILEPATH "Path to the Info.plist file for Bundle" ) + else ( EXISTS ${CMAKE_SOURCE_DIR}/branding/mac/Info.plist ) + # option to configure a custum Info.plist but configure with default one + set ( APPLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/../installer/mac/Info.plist" CACHE FILEPATH "Path to the Info.plist file for Bundle" ) + endif( EXISTS ${CMAKE_SOURCE_DIR}/branding/mac/Info.plist ) + ENDIF(NOT APPLE_INFO_PLIST ) else() IF ( NOT APPLE_BUNDLE_ICON ) # option to set the used Icon for OpenFlipper - if ( EXISTS ${CMAKE_SOURCE_DIR}/branding/Icons/OpenFlipper_Icon.icns ) - set ( APPLE_BUNDLE_ICON " ${CMAKE_SOURCE_DIR}/branding/Icons/OpenFlipper_Icon.icns" CACHE FILEPATH "Path to the Bundle Icon" ) - else() - set ( APPLE_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/../Icons/OpenFlipper_Icon.icns" CACHE FILEPATH "Path to the Bundle Icon" ) - endif() + set ( APPLE_BUNDLE_ICON "${CMAKE_CURRENT_SOURCE_DIR}/../Icons/OpenFlipper_Icon.icns" CACHE FILEPATH "Path to the Bundle Icon" ) ENDIF(NOT APPLE_BUNDLE_ICON ) IF ( NOT APPLE_INFO_PLIST ) @@ -204,21 +205,22 @@ if (APPLE) ENDIF(NOT APPLE_INFO_PLIST ) endif() - - add_custom_command(TARGET OpenFlipper POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different "${APPLE_BUNDLE_ICON}" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/OpenFlipper.icns" - ) - # create bundle in "Build" directory and set icon - # no install needed here, because the whole bundle will be installed in the - # toplevel CMakeLists.txt - set_target_properties ( + + add_custom_command(TARGET OpenFlipper POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different "${APPLE_BUNDLE_ICON}" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/OpenFlipper.icns" + ) + + # create bundle in "Build" directory and set icon + # no install needed here, because the whole bundle will be installed in the + # toplevel CMakeLists.txt + set_target_properties ( OpenFlipper PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Build" MACOSX_BUNDLE_INFO_STRING "ACG OpenFlipper" MACOSX_BUNDLE_ICON_FILE "OpenFlipper.icns" MACOSX_BUNDLE_INFO_PLIST ${APPLE_INFO_PLIST} - ) + ) endif () @@ -240,17 +242,17 @@ acg_copy_after_build (OpenFlipper "${CMAKE_CURRENT_SOURCE_DIR}/../Fonts" "${CMAK acg_copy_after_build (OpenFlipper "${CMAKE_CURRENT_SOURCE_DIR}/../Documentation/QtHelpResources" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Help") if ( EXISTS ${CMAKE_SOURCE_DIR}/branding ) - if ( WIN32 ) - acg_copy_after_build (OpenFlipper "${CMAKE_SOURCE_DIR}/branding/win/Icons" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Icons") + if ( WIN32 ) + acg_copy_after_build (OpenFlipper "${CMAKE_SOURCE_DIR}/branding/win" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Icons") elseif( APPLE ) - acg_copy_after_build (OpenFlipper "${CMAKE_SOURCE_DIR}/branding/mac/Icons" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Icons") + acg_copy_after_build (OpenFlipper "${CMAKE_SOURCE_DIR}/branding/mac" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Icons") elseif() - acg_copy_after_build (OpenFlipper "${CMAKE_SOURCE_DIR}/branding/linux/Icons" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Icons") + acg_copy_after_build (OpenFlipper "${CMAKE_SOURCE_DIR}/branding/linux" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Icons") endif() endif() -if ( APPLE ) +if ( APPLE ) # we need qt_menu.nib in our resources dir so try to get it if ( EXISTS /opt/local/lib/Resources/qt_menu.nib ) @@ -275,7 +277,7 @@ if ( APPLE ) endif() else () - + # In debug mode, we don't want release binaries in the bundle as it could cause crashes due to wrong linking or mixing of debug and release if ( _file MATCHES ".*debug.*" ) add_custom_command(TARGET OpenFlipper POST_BUILD @@ -284,7 +286,7 @@ if ( APPLE ) endif() endif() - + endforeach () elseif(WIN32) @@ -319,17 +321,15 @@ if (NOT APPLE) install( FILES "@CMAKE_BINARY_DIR@/Build/qt.conf" DESTINATION "${ACG_PROJECT_DATADIR}/" ) acg_install_dir ("${CMAKE_BINARY_DIR}/Build/QtPlugins/" "${ACG_PROJECT_DATADIR}/QtPlugins") endif(WIN32) - - if ( EXISTS ${CMAKE_SOURCE_DIR}/branding/win ) - if ( WIN32 ) + + if ( EXISTS ${CMAKE_SOURCE_DIR}/branding ) + if ( WIN32 ) acg_install_dir ( "${CMAKE_SOURCE_DIR}/branding/win" "${ACG_PROJECT_DATADIR}/Icons") endif() endif() + +#todo install splash file for windows and Linux branding endif () -if ( EXISTS ${CMAKE_SOURCE_DIR}/branding/Icons ) - # Overwrite generic Icons with branded ones. - acg_copy_after_build (OpenFlipper "${CMAKE_SOURCE_DIR}/branding/Icons" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Icons") -endif() diff --git a/OpenFlipper/PluginLib/CMakeLists.txt b/OpenFlipper/PluginLib/CMakeLists.txt index 42708c36c738207924f9b4d8d082edbe2ed033cb..09c8ccb05668456aa579b1b7541bf939c8da362f 100644 --- a/OpenFlipper/PluginLib/CMakeLists.txt +++ b/OpenFlipper/PluginLib/CMakeLists.txt @@ -42,7 +42,7 @@ link_directories ( # generate dllexport macros on windows if (WIN32) add_definitions ( - -DPLUGINLIBDLL + -DPLUGINLIBDLL -DACGDLL -DUSEACG ) @@ -66,7 +66,7 @@ if ( NOT DEFINED OPENFLIPPER_SETTINGS_DEBUG ) endif() if ( OPENFLIPPER_SETTINGS_DEBUG ) - add_definitions(-DOPENFLIPPER_SETTINGS_DEBUG ) + add_definitions(-DOPENFLIPPER_SETTINGS_DEBUG ) endif() #======================================================= @@ -74,13 +74,13 @@ endif() #======================================================= # source code directories -set (directories - ../BasePlugin - ../ACGHelper - ../common +set (directories + ../BasePlugin + ../ACGHelper + ../common ../threads - ../common/bsp - ../INIFile + ../common/bsp + ../INIFile ../widgets/glWidget ../publicWidgets/objectSelectionWidget ) @@ -99,17 +99,27 @@ acg_append_files_recursive (ui "*.ui" ${CMAKE_SOURCE_DIR}/ObjectTypes) acg_drop_templates (sources) # genereate uic and moc targets -acg_qt4_autouic (uic_targets ${ui}) -acg_qt4_automoc (moc_targets ${headers}) +if (QT5_FOUND) + acg_qt5_autouic (uic_targets ${ui}) + acg_qt5_automoc (moc_targets ${headers}) +elseif (QT4_FOUND) + acg_qt4_autouic (uic_targets ${ui}) + acg_qt4_automoc (moc_targets ${headers}) +endif () #======================================================= # Create library #======================================================= -acg_add_library (OpenFlipperPluginLib SHARED ${uic_targets} ${sources} ${headers} ${moc_targets}) +if (QT5_FOUND) + acg_add_library (OpenFlipperPluginLib SHARED ${uic_targets} ${sources} ${headers} ${moc_targets}) +elseif (QT4_FOUND) + acg_add_library (OpenFlipperPluginLib SHARED ${uic_targets} ${sources} ${headers} ${moc_targets}) +endif () + if( ADDITIONAL_PLUGINLIB_COMPILER_FLAGS ) set_target_properties ( - OpenFlipperPluginLib PROPERTIES + OpenFlipperPluginLib PROPERTIES COMPILE_FLAGS ${ADDITIONAL_PLUGINLIB_COMPILER_FLAGS} ) endif() diff --git a/OpenFlipper/cmake/plugin.cmake b/OpenFlipper/cmake/plugin.cmake index bdae24d9f1248e9df7bb179e9b77ed0027fa76d0..79ca8afa2aae5b89adf0c38633930e66da58750e 100644 --- a/OpenFlipper/cmake/plugin.cmake +++ b/OpenFlipper/cmake/plugin.cmake @@ -33,7 +33,7 @@ # LICENSEMANAGER = Compile plugin with license management # # Plugins can implement a acg_list_filter ("listname") macro to filter out -# unneeded headers, sources and ui files from the autogenerated +# unneeded headers, sources and ui files from the autogenerated # build sources lists (see common.cmake drop_templates macro) # # Translations @@ -41,7 +41,7 @@ # The *.ts files there will be used for the translations # # Special DEPS: -# CUDA: +# CUDA: # If your plugin requires cuda, add "CUDA" to the list of dependencies # and create a subdir called Cuda in your plugin directory # The files in this directory will be compiled by nvcc and linked @@ -104,23 +104,23 @@ macro (_check_plugin_deps _prefix _optional ) # This will contain the final list of all dependencies list (APPEND FULL_DEPENDENCY_LIST "") - #====================================================================================== + #====================================================================================== # Collect dependencies of dependencies - # Recursive dependencies will be added here. + # Recursive dependencies will be added here. # The base package name will be used and the variables # PACKAGE_DEPS : Mandatory recursive dependencies # PACKAGE_OPT_DEPS : Optional recursive dependencies #====================================================================================== foreach (_val ${ARGN}) string (TOUPPER ${_val} _VAL) - + # First we try to find the dependencies directly find_package(${_val}) # This will contain the list of all dependencies of the current base dependency ( including recursive dependencies for one level ) set (CURRENT_DEPENDENCY_LIST "") - # Flag if all dependencies were found (Only mandatory ones) + # Flag if all dependencies were found (Only mandatory ones) set (ALL_REQUIRED_DEPENDENCIES_FOUND TRUE) # Recursive dependencies which are not optional will also be added by default (Not optional, so error if not available!) @@ -131,7 +131,7 @@ macro (_check_plugin_deps _prefix _optional ) string (TOUPPER ${_rec_dep} _REC_DEP) find_package(${_rec_dep}) - + if ( ${_REC_DEP}_FOUND ) list (APPEND CURRENT_DEPENDENCY_LIST ${_rec_dep} ) add_definitions( -DENABLE_${_REC_DEP} ) @@ -140,7 +140,7 @@ macro (_check_plugin_deps _prefix _optional ) acg_set (_${_prefix}_MISSING_DEPS "${_${_prefix}_MISSING_DEPS} ${_VAL}_MISSING_MANDATORY_RECURSIVE_DEP_${_REC_DEP}") endif() endforeach() - + endif() @@ -154,7 +154,7 @@ macro (_check_plugin_deps _prefix _optional ) find_package(${_rec_dep}) # Optional so add if we found the dependency or we skip it. - # Defines will be added due to the optional status + # Defines will be added due to the optional status if ( ${_REC_DEP}_FOUND ) list (APPEND CURRENT_DEPENDENCY_LIST ${_rec_dep} ) add_definitions( -DENABLE_${_REC_DEP} ) @@ -224,7 +224,7 @@ macro (_check_plugin_deps _prefix _optional ) # Remove it again, if it was a duplicate list(REMOVE_DUPLICATES global_dependency_list) - + # Store the list in the global property set_property( GLOBAL PROPERTY GLOBAL_PLUGIN_DEPENDENCIES_LIST ${global_dependency_list} ) @@ -258,7 +258,7 @@ macro (_check_plugin_deps _prefix _optional ) if (DEFINED ${_name}_LINKER_FLAGS) # list (APPEND ${_prefix}_DEPS_LINKER_FLAGS "${${_name}_LINKER_FLAGS}") # this variable is used as a string later on (not as a list!!!) - set( ${_prefix}_DEPS_LINKER_FLAGS "${${_prefix}_DEPS_LINKER_FLAGS} ${${_name}_LINKER_FLAGS}") + set( ${_prefix}_DEPS_LINKER_FLAGS "${${_prefix}_DEPS_LINKER_FLAGS} ${${_name}_LINKER_FLAGS}") endif () if (DEFINED ${_name}_COMPILER_FLAGS) # list (APPEND ${_prefix}_DEPS_COMPILER_FLAGS "${${_name}_COMPILER_FLAGS}") @@ -292,10 +292,15 @@ macro (_plugin_licensemanagement) acg_append_files (keygen_hdr "*.hh" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager/keyGen") acg_append_files (keygen_src "*.cc" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager/keyGen") acg_append_files (keygen_ui "*.ui" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager/keyGen") - + # genereate uic and moc targets - acg_qt4_autouic (keygen_uic ${keygen_ui}) - acg_qt4_automoc (keygen_moc ${keygen_hdr}) + if (QT5_FOUND) + acg_qt5_autouic (keygen_uic ${keygen_ui}) + acg_qt5_automoc (keygen_moc ${keygen_hdr}) + else () + acg_qt4_autouic (keygen_uic ${keygen_ui}) + acg_qt4_automoc (keygen_moc ${keygen_hdr}) + endif() add_executable (Plugin-${plugin}-keygen ${keygen_uic} ${keygen_moc} ${keygen_hdr} ${keygen_src}) @@ -340,7 +345,7 @@ function (_build_openflipper_plugin plugin) #============================================================================================ # parse parameters #============================================================================================ - + _get_plugin_parameters (${_PLUGIN} ${ARGN}) #============================================================================================ @@ -400,7 +405,7 @@ function (_build_openflipper_plugin plugin) "${CMAKE_SOURCE_DIR}/ObjectTypes/*/CMakeLists.txt" ) - + # include all cmake files found for objecttypes here foreach ( _buildInfo ${_plugin_buildinfos}) include ("${CMAKE_SOURCE_DIR}/${_buildInfo}") @@ -409,36 +414,36 @@ function (_build_openflipper_plugin plugin) link_directories ( ${${_PLUGIN}_DEPS_LIBDIRS} ${${_PLUGIN}_LIBDIRS} - ${ADDITIONAL_PLUGINLIB_LINK_DIRS} + ${ADDITIONAL_PLUGINLIB_LINK_DIRS} ) - + else (APPLE) link_directories ( ${${_PLUGIN}_DEPS_LIBDIRS} ${${_PLUGIN}_LIBDIRS} ) endif(APPLE) - - set (directories - . + + set (directories + . ${${_PLUGIN}_DIRS} ) #============================================================================================ # User Documentation build #============================================================================================ - + # Only build the documentation if a userdoc subdirectory exists for the plugin if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/userDoc) set(plugin_html_doc_dir "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Doc/UserHTML/Plugin-${plugin}") set(plugin_qt_help_dir "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Help") - + find_package(Doxygen) if ( DOXYGEN_FOUND ) - # Create user documentation target with our template doxy file + # Create user documentation target with our template doxy file acg_create_doc_target( doc-User-${plugin} "${CMAKE_SOURCE_DIR}/OpenFlipper/Documentation/PluginDoxyTemplate" ) # make doc builds this plugin's documentation as well @@ -452,7 +457,7 @@ function (_build_openflipper_plugin plugin) # Create directories in order to avoid doxygen warnings if(NOT (IS_DIRECTORY ${plugin_qt_help_dir}) ) file(MAKE_DIRECTORY ${plugin_qt_help_dir} ) - endif() + endif() endif() @@ -484,19 +489,25 @@ function (_build_openflipper_plugin plugin) set(${_PLUGIN}_LICENSE_DEFS "") if (${_PLUGIN}_LICENSEMANAGER ) _plugin_licensemanagement () - + if ( OPENFLIPPER_ENABLE_LICENSE_MANAGER ) set(${_PLUGIN}_LICENSE_DEFS "-DWITH_LICENSE_MANAGER") endif() endif () # genereate uic and moc targets - acg_qt4_autouic (uic_targets ${ui}) - acg_qt4_automoc (moc_targets ${headers}) - acg_qt4_autoqrc (qrc_targets ${qrc}) - - - + if (QT5_FOUND) + acg_qt5_autouic (uic_targets ${ui}) + acg_qt5_automoc (moc_targets ${headers}) + acg_qt5_autoqrc (qrc_targets ${qrc}) + else () + acg_qt4_autouic (uic_targets ${ui}) + acg_qt4_automoc (moc_targets ${headers}) + acg_qt4_autoqrc (qrc_targets ${qrc}) + endif () + + + add_library (Plugin-${plugin} MODULE ${uic_targets} ${sources} ${headers} ${moc_targets} ${qrc_targets} ${${_PLUGIN}_ADDSRC}) # add this plugin to build plugin list for dependency tracking @@ -510,10 +521,10 @@ function (_build_openflipper_plugin plugin) set_target_properties ( Plugin-${plugin} PROPERTIES COMPILE_FLAGS "${${_PLUGIN}_CFLAGSADD} ${${_PLUGIN}_LICENSE_DEFS} ${${_PLUGIN}_DEPS_COMPILER_FLAGS}" - COMPILE_DEFINITIONS "${${_PLUGIN}_DEPS_COMPILE_DEFINITIONS}" + COMPILE_DEFINITIONS "${${_PLUGIN}_DEPS_COMPILE_DEFINITIONS}" LINK_FLAGS "${${_PLUGIN}_LDFLAGSADD} ${${_PLUGIN}_DEPS_LINKER_FLAGS}" ) - + if (WIN32) # Visual studio requires our plugins to link with GLUT find_package (GLUT) @@ -540,7 +551,7 @@ function (_build_openflipper_plugin plugin) ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Plugin-${plugin}.dll ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_PLUGINDIR}/Plugin-${plugin}.dll ) - elseif (APPLE) + elseif (APPLE) target_link_libraries ( Plugin-${plugin} @@ -564,7 +575,7 @@ function (_build_openflipper_plugin plugin) LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_PLUGINDIR}" ) endif () - + target_link_libraries (Plugin-${plugin} ${${_PLUGIN}_DEPS_LIBRARIES} ${${_PLUGIN}_LIBRARIES} @@ -585,24 +596,24 @@ function (_build_openflipper_plugin plugin) acg_install_dir ("${CMAKE_CURRENT_SOURCE_DIR}/${_dir}" "${ACG_PROJECT_DATADIR}/${_dir}") endif () endforeach () - + #============================================================================================ # CUDA Integration # This block takes all cuda files from a plugins subdirectory called "Cuda" - # The files will be compiled by nvcc and linked to one library containing all cuda parts of + # The files will be compiled by nvcc and linked to one library containing all cuda parts of # the plugin. This static library is than linked into the plugin #============================================================================================ - + # Check if cuda is in the list of dependencies: list(FIND ${_PLUGIN}_DEPS "CUDA" FIND_RESULT) if ( NOT FIND_RESULT EQUAL -1 ) - + # Required but maybe it is not found # finder is automatically called before this if ( CUDA_FOUND ) #Setup options CUDA_ADD_CUDA_INCLUDE_ONCE() - + # Clear out the directory defines to prevent nvcc from getting them # TODO : Create an additional flag variable for CUDA get_directory_property( CURRENT_DEFINITIONS COMPILE_DEFINITIONS ) @@ -612,27 +623,27 @@ function (_build_openflipper_plugin plugin) # Get all cuda sources file(GLOB_RECURSE ${_PLUGIN}_CUDA_SRCS Cuda/*.cu Cuda/*.c) - + # Add cuda include dirs to global build target include_directories(${CUDA_INCLUDE_DIRS}) - + # Force to -fPIC such that we can correctly link against the lib lateron in the plugin list ( APPEND CMAKE_CXX_FLAGS "-fPIC" ) list ( APPEND CMAKE_CC_FLAGS "-fPIC" ) - + # Prepare the files if(${CMAKE_BUILD_TYPE} STREQUAL "Debug") CUDA_COMPILE(${_PLUGIN}_CUDA_GENERATED_FILES ${${_PLUGIN}_CUDA_SRCS} OPTIONS -g -G --device-emulation -Xcompiler) else() CUDA_COMPILE(${_PLUGIN}_CUDA_GENERATED_FILES ${${_PLUGIN}_CUDA_SRCS} OPTIONS -O2) endif() - + # Create the library containing all cuda files CUDA_ADD_LIBRARY(${_PLUGIN}_cuda_lib STATIC ${${_PLUGIN}_CUDA_GENERATED_FILES} ) - + # Link the cuda plugin library to the plugin itself target_link_libraries(Plugin-${plugin} ${_PLUGIN}_cuda_lib) - + # reset to original compile definitions set_directory_properties( PROPERTIES COMPILE_DEFINITIONS "${CURRENT_DEFINITIONS}" ) @@ -657,7 +668,7 @@ function (_build_openflipper_plugin plugin) message (STATUS "Missing dependencies :${_${_PLUGIN}_MISSING_DEPS}") set(PLUGIN_${plugin}_MISSING_DEPS TRUE PARENT_SCOPE) endif () - + endfunction () macro (openflipper_plugin) diff --git a/cmake/ACGCommon.cmake b/cmake/ACGCommon.cmake index f8d80766d52a4003975ff0cdeb4b150b3c2d140b..26b8314f7181c408eb02fbe16dc55e956b8b1a1f 100644 --- a/cmake/ACGCommon.cmake +++ b/cmake/ACGCommon.cmake @@ -43,9 +43,7 @@ endif() # read version from file macro (acg_get_version) - if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/branding/VERSION") - file (READ "${CMAKE_CURRENT_SOURCE_DIR}/branding/VERSION" _file) - elseif (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ARGN}/VERSION") + if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/${ARGN}/VERSION") file (READ "${CMAKE_CURRENT_SOURCE_DIR}/${ARGN}/VERSION" _file) else () file (READ "${CMAKE_CURRENT_SOURCE_DIR}/VERSION" _file) @@ -184,7 +182,7 @@ add_definitions (-DINCLUDE_TEMPLATES) macro (acg_qt4) if (NOT QT4_FOUND) - set (QT_MIN_VERSION ${ARGN}) + set (QT_MIN_VERSION ${ARGN}) find_package (Qt4 COMPONENTS QtCore QtGui ) @@ -206,6 +204,89 @@ macro (acg_qt4) endif () endmacro () +macro (acg_qt5) + #if (NOT QT5_FOUND) + + #set (QT_MIN_VERSION ${ARGN}) + + #for custom installation of qt5, dont use any of these variables + set (QT5_INSTALL_PATH "" CACHE String "Path to qt5 lib and include folder") + set (CMAKE_PREFIX_PATH ${QT5_INSTALL_PATH}) + set (CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE) + + + find_package (Qt5Core REQUIRED) + find_package (Qt5Declarative REQUIRED) + find_package (Qt5Widgets REQUIRED) + find_package (Qt5Gui REQUIRED) + find_package (Qt5OpenGL REQUIRED) + find_package (Qt5Network REQUIRED) + find_package (Qt5Script REQUIRED) + find_package (Qt5ScriptTools REQUIRED) + find_package (Qt5Sql REQUIRED) + find_package (Qt5Xml REQUIRED) + find_package (Qt5XmlPatterns REQUIRED) + find_package (Qt5Help REQUIRED) + find_package (Qt5WebKit REQUIRED) + find_package (Qt5UiTools REQUIRED) + find_package (Qt5Concurrent REQUIRED) + find_package (Qt5PrintSupport REQUIRED) + + + set (QT5_FOUND ${Qt5Core_FOUND} AND ${Qt5Declarative} ${Qt5Widgets_FOUND} + AND ${Qt5Gui_FOUND} AND ${Qt5OpenGL_FOUND} AND ${Qt5Network_FOUND} + AND ${Qt5Script_FOUND} AND ${Qt5ScriptTools_FOUND} AND ${Qt5Sql_FOUND} + AND ${Qt5Xml_FOUND} AND ${Qt5XmlPatterns_FOUND} AND ${Qt5Help_FOUND} + AND ${Qt5WebKit_FOUND} AND ${Qt5UiTools_FOUND} AND ${Qt5Concurrent_FOUND} + AND ${Qt5PrintSupport_FOUND}) + + if (QT5_FOUND) + include_directories(${Qt5Core_INCLUDE_DIRS}) + include_directories(${Qt5Declarative_INCLUDE_DIRS}) + include_directories(${Qt5Widgets_INCLUDE_DIRS}) + include_directories(${Qt5Gui_INCLUDE_DIRS}) + include_directories(${Qt5OpenGL_INCLUDE_DIRS}) + include_directories(${Qt5Network_INCLUDE_DIRS}) + include_directories(${Qt5Script_INCLUDE_DIRS}) + include_directories(${Qt5ScriptTools_INCLUDE_DIRS}) + include_directories(${Qt5Sql_INCLUDE_DIRS}) + include_directories(${Qt5Xml_INCLUDE_DIRS}) + include_directories(${Qt5XmlPatterns_INCLUDE_DIRS}) + include_directories(${Qt5Help_INCLUDE_DIRS}) + include_directories(${Qt5WebKit_INCLUDE_DIRS}) + include_directories(${Qt5UiTools_INCLUDE_DIRS}) + include_directories(${Qt5Concurrent_INCLUDE_DIRS}) + include_directories(${Qt5PrintSupport_INCLUDE_DIRS}) + add_definitions(${Qt5Core_DEFINITIONS}) + add_definitions(${Qt5Widgets_DEFINITIONS}) + add_definitions(${Qt5Gui_DEFINITIONS}) + add_definitions(${Qt5OpenGL_DEFINITIONS}) + add_definitions(${Qt5Network_DEFINITIONS}) + add_definitions(${Qt5Script_DEFINITIONS}) + add_definitions(${Qt5ScriptTools_DEFINITIONS}) + add_definitions(${Qt5Sql_DEFINITIONS}) + add_definitions(${Qt5Xml_DEFINITIONS}) + add_definitions(${Qt5XmlPatterns_DEFINITIONS}) + add_definitions(${Qt5Help_DEFINITIONS}) + add_definitions(${Qt5WebKit_DEFINITIONS}) + add_definitions(${Qt5UiTools_DEFINITIONS}) + add_definitions(${Qt5Concurrent_DEFINITIONS}) + add_definitions(${Qt5PrintSupport_DEFINITIONS}) + + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") + + set (QT_LIBRARIES ${QT_LIBRARIES} ${Qt5Core_LIBRARIES} ${Qt5Declarative_LIBRARIES} ${Qt5Widgets_LIBRARIES} + ${Qt5Gui_LIBRARIES} ${Qt5OpenGL_LIBRARIES} ${Qt5Network_LIBRARIES} + ${Qt5Script_LIBRARIES} ${Qt5ScriptTools_LIBRARIES} ${Qt5Sql_LIBRARIES} + ${Qt5Xml_LIBRARIES} ${Qt5XmlPatterns_LIBRARIES} ${Qt5Help_LIBRARIES} + ${Qt5WebKit_LIBRARIES} ${Qt5UiTools_LIBRARIES} ${Qt5Concurrent_LIBARIES} ${Qt5PrintSupport_LIBARIES}) + + add_definitions(-DQT_NO_OPENGL) + endif () + + #endif () +endmacro () + # unsets the given variable macro (acg_unset var) set (${var} "" CACHE INTERNAL "") @@ -221,7 +302,7 @@ macro (acg_openmp) if (NOT OPENMP_NOTFOUND) # Set off OpenMP on Darwin architectures # since it causes crashes sometimes -# if(NOT APPLE) +# if(NOT APPLE) find_package(OpenMP) if (OPENMP_FOUND) set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") @@ -326,7 +407,50 @@ macro (acg_qt4_automoc moc_SRCS) add_file_dependencies (${_abs_FILE} ${_moc}) set (${moc_SRCS} ${${moc_SRCS}} ${_moc}) - + + endif () + endif () + endforeach () +endmacro () + +# generate moc targets for sources in list +macro (acg_qt5_automoc moc_SRCS) + qt5_get_moc_flags (_moc_INCS) + + set (_matching_FILES ) + foreach (_current_FILE ${ARGN}) + + get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE) + # if "SKIP_AUTOMOC" is set to true, we will not handle this file here. + # here. this is required to make bouic work correctly: + # we need to add generated .cpp files to the sources (to compile them), + # but we cannot let automoc handle them, as the .cpp files don't exist yet when + # cmake is run for the very first time on them -> however the .cpp files might + # exist at a later run. at that time we need to skip them, so that we don't add two + # different rules for the same moc file + get_source_file_property (_skip ${_abs_FILE} SKIP_AUTOMOC) + + if ( NOT _skip AND EXISTS ${_abs_FILE} ) + + file (READ ${_abs_FILE} _contents) + + get_filename_component (_abs_PATH ${_abs_FILE} PATH) + + string (REGEX MATCHALL "Q_OBJECT" _match "${_contents}") + if (_match) + get_filename_component (_basename ${_current_FILE} NAME_WE) + set (_header ${_abs_FILE}) + set (_moc ${CMAKE_CURRENT_BINARY_DIR}/moc_${_basename}.cpp) + + add_custom_command (OUTPUT ${_moc} + COMMAND ${QT_MOC_EXECUTABLE} + ARGS ${_moc_INCS} ${_header} -o ${_moc} + DEPENDS ${_header} + ) + + add_file_dependencies (${_abs_FILE} ${_moc}) + set (${moc_SRCS} ${${moc_SRCS}} ${_moc}) + endif () endif () endforeach () @@ -351,7 +475,7 @@ macro (acg_qt4_autouic uic_SRCS) set (_outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.hh) set (_header ${_basename}.hh) set (_source ${_abs_PATH}/${_cbasename}.cc) - + add_custom_command (OUTPUT ${_outfile} COMMAND ${QT_UIC_EXECUTABLE} ARGS -o ${_outfile} ${_abs_FILE} @@ -359,11 +483,42 @@ macro (acg_qt4_autouic uic_SRCS) add_file_dependencies (${_source} ${_outfile}) set (${uic_SRCS} ${${uic_SRCS}} ${_outfile}) - + endif () endforeach () endmacro () +# generate uic targets for sources in list +macro (acg_qt5_autouic uic_SRCS) + + set (_matching_FILES ) + foreach (_current_FILE ${ARGN}) + + get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE) + + if ( EXISTS ${_abs_FILE} ) + + file (READ ${_abs_FILE} _contents) + + get_filename_component (_abs_PATH ${_abs_FILE} PATH) + + get_filename_component (_basename ${_current_FILE} NAME_WE) + string (REGEX REPLACE "Ui$" "" _cbasename ${_basename}) + set (_outfile ${CMAKE_CURRENT_BINARY_DIR}/ui_${_basename}.hh) + set (_header ${_basename}.hh) + set (_source ${_abs_PATH}/${_cbasename}.cc) + + add_custom_command (OUTPUT ${_outfile} + COMMAND ${Qt5Widgets_UIC_EXECUTABLE} + ARGS -o ${_outfile} ${_abs_FILE} + DEPENDS ${_abs_FILE}) + + add_file_dependencies (${_source} ${_outfile}) + set (${uic_SRCS} ${${uic_SRCS}} ${_outfile}) + + endif () + endforeach () +endmacro () # generate qrc targets for sources in list macro (acg_qt4_autoqrc qrc_SRCS) @@ -381,11 +536,40 @@ macro (acg_qt4_autoqrc qrc_SRCS) get_filename_component (_basename ${_current_FILE} NAME_WE) set (_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${_basename}.cpp) - + + add_custom_command (OUTPUT ${_outfile} + COMMAND ${QT_RCC_EXECUTABLE} + ARGS -o ${_outfile} ${_abs_FILE} + DEPENDS ${_abs_FILE}) + + add_file_dependencies (${_source} ${_outfile}) + set (${qrc_SRCS} ${${qrc_SRCS}} ${_outfile}) + + endif () + endforeach () +endmacro () + +# generate qrc targets for sources in list +macro (acg_qt5_autoqrc qrc_SRCS) + + set (_matching_FILES ) + foreach (_current_FILE ${ARGN}) + + get_filename_component (_abs_FILE ${_current_FILE} ABSOLUTE) + + if ( EXISTS ${_abs_FILE} ) + + file (READ ${_abs_FILE} _contents) + + get_filename_component (_abs_PATH ${_abs_FILE} PATH) + + get_filename_component (_basename ${_current_FILE} NAME_WE) + set (_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${_basename}.cpp) + add_custom_command (OUTPUT ${_outfile} COMMAND ${QT_RCC_EXECUTABLE} ARGS -o ${_outfile} ${_abs_FILE} - DEPENDS ${_abs_FILE}) + DEPENDS ${_abs_FILE}) add_file_dependencies (${_source} ${_outfile}) set (${qrc_SRCS} ${${qrc_SRCS}} ${_outfile}) @@ -464,7 +648,7 @@ function (acg_add_library _target _libtype) set (_and_static 1) else () set (_and_static 0) - endif () + endif () else () set (_type ${_libtype}) set (_and_static 0) @@ -480,9 +664,9 @@ function (acg_add_library _target _libtype) # set common target properties defined in common.cmake acg_set_target_props (${_target}Static) - + if (NOT APPLE) - set_target_properties (${_target}Static PROPERTIES + set_target_properties (${_target}Static PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${CMAKE_LIBRARY_OUTPUT_DIRECTORY}" ) endif () @@ -568,10 +752,10 @@ function (acg_add_library _target _libtype) ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_LIBDIR}/lib${fullname}.a) endif () - + # Block installation of libraries by setting ACG_NO_LIBRARY_INSTALL - if ( NOT ACG_NO_LIBRARY_INSTALL ) + if ( NOT ACG_NO_LIBRARY_INSTALL ) if (NOT ACG_PROJECT_MACOS_BUNDLE OR NOT APPLE) if (${_type} STREQUAL SHARED OR ${_type} STREQUAL STATIC ) install (TARGETS ${_target} @@ -614,11 +798,19 @@ function (acg_add_translations _target _languages _sources) set (_qm_files) if ( _new_ts_files ) - qt4_create_translation(_qm_files ${_sources} ${_new_ts_files}) + if (QT5_FOUND) + #qt5_create_translation(_qm_files ${_sources} ${_new_ts_files}) + elseif (QT4_FOUND) + qt4_create_translation(_qm_files ${_sources} ${_new_ts_files}) + endif() endif () if ( _ts_files ) - qt4_add_translation(_qm_files2 ${_ts_files}) + if (QT5_FOUND) + #qt5_add_translation(_qm_files2 ${_ts_files}) + elseif (QT4_FOUND) + qt4_add_translation(_qm_files2 ${_ts_files}) + endif() list (APPEND _qm_files ${_qm_files2}) endif () @@ -653,7 +845,7 @@ function (generate_qhp_file files_loc plugin_name) set(qhp_file "${files_loc}/${plugin_name}.qhp") # Read in template file file(STRINGS "${CMAKE_SOURCE_DIR}/OpenFlipper/Documentation/QtHelpResources/QtHelpProject.qhp" qhp_template) - + # Initialize new project file file(WRITE ${qhp_file} "") foreach (_line ${qhp_template}) diff --git a/cmake/FindQwt5.cmake b/cmake/FindQwt5.cmake index caeaaf8ed3d4d421ca9bc5a8fc772c0b4924a647..5c42209347d2863aecd6fbde9c0830ff84d03a50 100644 --- a/cmake/FindQwt5.cmake +++ b/cmake/FindQwt5.cmake @@ -1,4 +1,5 @@ -# Find the Qwt 5.x includes and library, either the version linked to Qt3 or the version linked to Qt4 +# Find the Qwt 5.x includes and library, either the version linked to Qt3, Qt4 +# or Qt5 # # On Windows it makes these assumptions: # - the Qwt DLL is where the other DLLs for Qt are (QT_DIR\bin) or in the path @@ -6,9 +7,12 @@ # - the Qwt .lib is where the other LIBs for Qt are (QT_DIR\lib) or in the path # # Qwt5_INCLUDE_DIR - where to find qwt.h if Qwt +# Qwt5_Qt5_LIBRARY - The Qwt5 library linked against Qt5 (if it exists)# +# Qwt5_Qt5_LIBRARY_DIR # Qwt5_Qt4_LIBRARY - The Qwt5 library linked against Qt4 (if it exists)# -# Qwt5_Qt4_LIBRARY_DIR +# Qwt5_Qt4_LIBRARY_DIR # Qwt5_Qt3_LIBRARY - The Qwt5 library linked against Qt4 (if it exists) +# Qwt5_Qt5_FOUND - Qwt5 was found and uses Qt5 # Qwt5_Qt4_FOUND - Qwt5 was found and uses Qt4 # Qwt5_Qt3_FOUND - Qwt5 was found and uses Qt3 # Qwt5_FOUND - Set to TRUE if Qwt5 was found (linked either to Qt3 or Qt4) @@ -23,32 +27,36 @@ IF(Qwt5_Qt4_LIBRARY OR Qwt5_Qt3_LIBRARY AND Qwt5_INCLUDE_DIR) SET(Qwt5_FIND_QUIETLY TRUE) ENDIF(Qwt5_Qt4_LIBRARY OR Qwt5_Qt3_LIBRARY AND Qwt5_INCLUDE_DIR) -IF(NOT QT4_FOUND) +IF(NOT QT5_FOUND AND NOT FORCE_QT4) + FIND_PACKAGE( Qt5Widgets REQUIRED QUIET ) +ELSEIF(NOT QT5_FOUND AND NOT QT4_FOUND) FIND_PACKAGE( Qt4 REQUIRED QUIET ) -ENDIF(NOT QT4_FOUND) +ENDIF() -IF( QT4_FOUND ) +IF( QT5_FOUND ) + +ELSEIF( QT4_FOUND ) if ( CMAKE_GENERATOR MATCHES "Visual Studio 9*" ) set( SEARCHPATH "./" ) endif() - + if ( CMAKE_GENERATOR MATCHES "Visual Studio 10*" ) set( SEARCHPATH "VS2010" ) endif() # Is Qwt5 installed? Look for header files - FIND_PATH( Qwt5_INCLUDE_DIR qwt.h - PATHS ${QT_INCLUDE_DIR} - /usr/local/qwt/include - /usr/local/include + FIND_PATH( Qwt5_INCLUDE_DIR qwt.h + PATHS ${QT_INCLUDE_DIR} + /usr/local/qwt/include + /usr/local/include /opt/local/include /opt/local/include/qwt /usr/include - /usr/include + /usr/include c:\\libs\\${SEARCHPATH}\\x32\\Qwt-6.0.2 c:\\libs\\Qwt-6.0.1 - c:\\Program\ Files\\qwt\\qwt-5.2.0 - c:\\qwt-5.2.0 + c:\\Program\ Files\\qwt\\qwt-5.2.0 + c:\\qwt-5.2.0 C:\\libs\\qwt-5.2.0 PATH_SUFFIXES qwt qwt5 qwt-qt4 qwt5-qt4 qwt-qt3 qwt5-qt3 include qwt/include qwt5/include qwt-qt4/include qwt5-qt4/include qwt-qt3/include qwt5-qt3/include ENV PATH) @@ -56,7 +64,7 @@ IF( QT4_FOUND ) IF( Qwt5_INCLUDE_DIR ) FILE( READ ${Qwt5_INCLUDE_DIR}/qwt_global.h QWT_GLOBAL_H ) STRING( REGEX MATCH "#define *QWT_VERSION *(0x05*)" QWT_IS_VERSION_5 ${QWT_GLOBAL_H}) - + IF( QWT_IS_VERSION_5 ) STRING(REGEX REPLACE ".*#define[\\t\\ ]+QWT_VERSION_STR[\\t\\ ]+\"([0-9]+\\.[0-9]+\\.[0-9]+)\".*" "\\1" Qwt_VERSION "${QWT_GLOBAL_H}") @@ -68,26 +76,26 @@ IF( QT4_FOUND ) get_filename_component(_Qwt5_Qt4_LIBRARY_DIR ${Qwt5_Qt4_TENTATIVE_LIBRARY_RELEASE} PATH) set ( Qwt5_Qt4_LIBRARY_DIR ${_Qwt5_Qt4_LIBRARY_DIR} CACHE FILEPATH "Library dir of qwt" ) - + if ( Qwt5_Qt4_TENTATIVE_LIBRARY_RELEASE AND Qwt5_Qt4_TENTATIVE_LIBRARY_DEBUG ) set ( Qwt5_Qt4_TENTATIVE_LIBRARY "optimized;${Qwt5_Qt4_TENTATIVE_LIBRARY_RELEASE};debug;${Qwt5_Qt4_TENTATIVE_LIBRARY_DEBUG}") else() set ( Qwt5_Qt4_TENTATIVE_LIBRARY "${Qwt5_Qt4_TENTATIVE_LIBRARY_RELEASE}") endif() - + ELSEIF( WIN32 ) # Find Qwt5 library linked to Qt4 Release Version - FIND_LIBRARY( Qwt5_Qt4_TENTATIVE_LIBRARY_RELEASE NAMES qwt qwt5-qt4 qwt-qt4 qwt5 PATHS + FIND_LIBRARY( Qwt5_Qt4_TENTATIVE_LIBRARY_RELEASE NAMES qwt qwt5-qt4 qwt-qt4 qwt5 PATHS "c:\\libs\\${SEARCHPATH}\\x32\\Qwt-6.0.2\\lib" "c:\\libs\\Qwt-6.0.1\\lib" - "c:\\Program\ Files\\qwt\\qwt-5.2.0\\lib" + "c:\\Program\ Files\\qwt\\qwt-5.2.0\\lib" "c:\\libs\\qwt-5.2.0\\lib" ) # Find Qwt5 library linked to Qt4 Debug Version - FIND_LIBRARY( Qwt5_Qt4_TENTATIVE_LIBRARY_DEBUG NAMES qwtd qwt5d PATHS + FIND_LIBRARY( Qwt5_Qt4_TENTATIVE_LIBRARY_DEBUG NAMES qwtd qwt5d PATHS "c:\\libs\\${SEARCHPATH}\\x32\\Qwt-6.0.2\\lib" "c:\\libs\\Qwt-6.0.1\\lib" - "c:\\Program\ Files\\qwt\\qwt-5.2.0\\lib" + "c:\\Program\ Files\\qwt\\qwt-5.2.0\\lib" "c:\\libs\\qwt-5.2.0\\lib") set ( Qwt5_Qt4_TENTATIVE_LIBRARY "optimized;${Qwt5_Qt4_TENTATIVE_LIBRARY_RELEASE};debug;${Qwt5_Qt4_TENTATIVE_LIBRARY_DEBUG}") @@ -137,7 +145,7 @@ IF( QT4_FOUND ) ENDIF( UNIX AND NOT CYGWIN AND NOT APPLE) - + IF ( NOT APPLE ) # Find Qwt5 library linked to Qt3 FIND_LIBRARY( Qwt5_Qt3_TENTATIVE_LIBRARY NAMES qwt-qt3 qwt qwt5-qt3 qwt5 qwt ) @@ -162,13 +170,13 @@ IF( QT4_FOUND ) ENDIF (NOT Qwt5_FIND_QUIETLY) ENDIF( UNIX AND NOT CYGWIN ) ENDIF( NOT APPLE ) - + ENDIF( QWT_IS_VERSION_5 ) - + IF( Qwt5_Qt4_FOUND OR Qwt5_Qt3_FOUND ) SET( Qwt5_FOUND TRUE ) ENDIF( Qwt5_Qt4_FOUND OR Qwt5_Qt3_FOUND ) - + MARK_AS_ADVANCED( Qwt5_INCLUDE_DIR Qwt5_Qt4_LIBRARY Qwt5_Qt3_LIBRARY ) ENDIF( Qwt5_INCLUDE_DIR ) @@ -176,4 +184,4 @@ IF( QT4_FOUND ) MESSAGE(FATAL_ERROR "Could not find Qwt 5.x") ENDIF (NOT Qwt5_FOUND AND Qwt5_FIND_REQUIRED) -ENDIF( QT4_FOUND ) +ENDIF( ) diff --git a/tests/compareTool/CMakeLists.txt b/tests/compareTool/CMakeLists.txt index 422fee43b8b0d1ed41aaed008822e52a9e5230e1..69247f660cc6d0c2085fbba4d34bd8bcaf9f9df9 100644 --- a/tests/compareTool/CMakeLists.txt +++ b/tests/compareTool/CMakeLists.txt @@ -1,25 +1,27 @@ if(BUILD_TESTING) - if ( NOT QT4_FOUND) + if ( NOT QT5_FOUND AND NOT FORCE_QT4) + find_package(Qt5Core) + elseif ( NOT QT5_FOUND AND NOT QT4_FOUND) find_package (Qt4 COMPONENTS QtCore ) endif() - + add_executable (compareTool compareTool.cc ) target_link_libraries (compareTool ${QT_LIBRARIES} - ) - + ) + set_target_properties ( compareTool PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${OPENFLIPPER_TEST_BINARIES}" LIBRARY_OUTPUT_DIRECTORY "${OPENFLIPPER_TEST_BINARIES}" ) - + if (WIN32) add_custom_command (TARGET compareTool POST_BUILD COMMAND ${CMAKE_COMMAND} -E - copy_if_different + copy_if_different ${OPENFLIPPER_TEST_BINARIES}/${CMAKE_CFG_INTDIR}/compareTool.exe ${OPENFLIPPER_TEST_BINARIES}/compareTool.exe) endif()