Skip to content

Commit

Permalink
Some minor cleaning up.
Browse files Browse the repository at this point in the history
  • Loading branch information
agarny committed Oct 17, 2019
2 parents 18fb385 + 4245711 commit fc03a45
Show file tree
Hide file tree
Showing 6 changed files with 57 additions and 54 deletions.
70 changes: 35 additions & 35 deletions CMakeLists.txt
Expand Up @@ -272,6 +272,11 @@ endif()

set(PLATFORM_DIR ${PLATFORM})

# Location of our distribution files

set(DISTRIB_DIR ${CMAKE_SOURCE_DIR}/distrib)
set(PLATFORM_DISTRIB_DIR ${DISTRIB_DIR}/${PLATFORM})

# Default location of external binaries and packages

if(WIN32)
Expand Down Expand Up @@ -368,8 +373,8 @@ if(USE_PREBUILT_PYTHON_AND_QTWEBKIT_PACKAGES)
if(WIN32)
set(ICU_VERSION 57)
elseif(NOT APPLE)
add_subdirectory(${CMAKE_SOURCE_DIR}/distrib/linux/icu)
add_subdirectory(${CMAKE_SOURCE_DIR}/distrib/linux/mesa)
add_subdirectory(${PLATFORM_DISTRIB_DIR}/icu)
add_subdirectory(${PLATFORM_DISTRIB_DIR}/mesa)
endif()
endif()

Expand Down Expand Up @@ -1067,8 +1072,7 @@ if(APPLE)

set(INFO_PLIST_FILENAME ${PROJECT_BUILD_DIR}/Info.plist)

configure_file(${CMAKE_SOURCE_DIR}/distrib/macos/Info.plist.in
${INFO_PLIST_FILENAME})
configure_file(${PLATFORM_DISTRIB_DIR}/Info.plist.in ${INFO_PLIST_FILENAME})

set_target_properties(${CMAKE_PROJECT_NAME} PROPERTIES
MACOSX_BUNDLE_INFO_PLIST ${INFO_PLIST_FILENAME}
Expand All @@ -1090,12 +1094,12 @@ if(APPLE)

# Qt plugins required by OpenCOR

macos_deploy_qt_plugin(imageformats qjpeg)
macos_deploy_qt_plugin(mediaservice qavfmediaplayer)
macos_deploy_qt_plugin(platforms qcocoa)
macos_deploy_qt_plugin(printsupport cocoaprintersupport)
macos_deploy_qt_plugin(sqldrivers qsqlite)
macos_deploy_qt_plugin(styles qmacstyle)
macos_deploy_qt_plugins(imageformats qjpeg)
macos_deploy_qt_plugins(mediaservice qavfmediaplayer)
macos_deploy_qt_plugins(platforms qcocoa)
macos_deploy_qt_plugins(printsupport cocoaprintersupport)
macos_deploy_qt_plugins(sqldrivers qsqlite)
macos_deploy_qt_plugins(styles qmacstyle)
else()
# Make sure that OpenCOR uses RPATH rather than RUNPATH on Linux

Expand Down Expand Up @@ -1198,7 +1202,7 @@ endif()
set(CPACK_PACKAGE_NAME "${CMAKE_PROJECT_NAME}")
set(CPACK_PACKAGE_CONTACT "Team OpenCOR (team@opencor.ws)")
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "${PROJECT_DESCRIPTION}")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/distrib/readMe.txt")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${DISTRIB_DIR}/readMe.txt")
set(CPACK_PACKAGE_INSTALL_DIRECTORY "${CMAKE_PROJECT_NAME}")
set(CPACK_PACKAGE_EXECUTABLES "${CMAKE_PROJECT_NAME}" "${CMAKE_PROJECT_NAME}")
set(CPACK_PACKAGE_VENDOR "Physiome Project")
Expand Down Expand Up @@ -1261,22 +1265,20 @@ if(WIN32)

# Qt plugins required by OpenCOR

windows_deploy_qt_plugin(imageformats qjpeg)
windows_deploy_qt_plugin(platforms qwindows)
windows_deploy_qt_plugin(printsupport windowsprintersupport)
windows_deploy_qt_plugin(sqldrivers qsqlite)
windows_deploy_qt_plugin(styles qwindowsvistastyle)
windows_deploy_qt_plugins(imageformats qjpeg)
windows_deploy_qt_plugins(platforms qwindows)
windows_deploy_qt_plugins(printsupport windowsprintersupport)
windows_deploy_qt_plugins(sqldrivers qsqlite)
windows_deploy_qt_plugins(styles qwindowsvistastyle)

# Batch and VBScript files to run OpenCOR (useful when downloading a ZIPped
# version of OpenCOR)

set(BAT_FILENAME "${PROJECT_BUILD_DIR}/${CMAKE_PROJECT_NAME}.bat")
set(VBS_FILENAME "${PROJECT_BUILD_DIR}/${CMAKE_PROJECT_NAME}.vbs")

configure_file(${CMAKE_SOURCE_DIR}/distrib/windows/application.bat.in
${BAT_FILENAME})
configure_file(${CMAKE_SOURCE_DIR}/distrib/windows/application.vbs.in
${VBS_FILENAME})
configure_file(${PLATFORM_DISTRIB_DIR}/application.bat.in ${BAT_FILENAME})
configure_file(${PLATFORM_DISTRIB_DIR}/application.vbs.in ${VBS_FILENAME})

install(FILES ${BAT_FILENAME}
DESTINATION .)
Expand Down Expand Up @@ -1308,8 +1310,8 @@ elseif(APPLE)

set(CPACK_SYSTEM_NAME "macOS")

set(CPACK_RESOURCE_FILE_WELCOME "${CMAKE_SOURCE_DIR}/distrib/macos/welcome.txt")
set(CPACK_RESOURCE_FILE_README "${CMAKE_SOURCE_DIR}/distrib/readMe.txt")
set(CPACK_RESOURCE_FILE_WELCOME "${PLATFORM_DISTRIB_DIR}/welcome.txt")
set(CPACK_RESOURCE_FILE_README "${DISTRIB_DIR}/readMe.txt")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_SOURCE_DIR}/LICENSE.txt")

set(CPACK_SET_DESTDIR TRUE)
Expand All @@ -1320,12 +1322,11 @@ elseif(APPLE)
# Shell script to run OpenCOR (useful when downloading a ZIPped version of
# OpenCOR)

set(SH_FILENAME ${PROJECT_BUILD_DIR}/${CMAKE_PROJECT_NAME}.sh)
set(SHELL_SCRIPT_FILENAME ${PROJECT_BUILD_DIR}/application)

configure_file(${CMAKE_SOURCE_DIR}/distrib/macos/application.sh.in
${SH_FILENAME} @ONLY)
configure_file(${PLATFORM_DISTRIB_DIR}/application.in ${SHELL_SCRIPT_FILENAME} @ONLY)

install(FILES ${SH_FILENAME}
install(FILES ${SHELL_SCRIPT_FILENAME}
DESTINATION .
RENAME ${CMAKE_PROJECT_NAME}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
Expand Down Expand Up @@ -1378,20 +1379,19 @@ else()

# Qt plugins required by OpenCOR

linux_deploy_qt_plugin(imageformats qjpeg)
linux_deploy_qt_plugin(platforms qxcb)
linux_deploy_qt_plugin(printsupport cupsprintersupport)
linux_deploy_qt_plugin(sqldrivers qsqlite)
linux_deploy_qt_plugin(xcbglintegrations qxcb-egl-integration qxcb-glx-integration)
linux_deploy_qt_plugins(imageformats qjpeg)
linux_deploy_qt_plugins(platforms qxcb)
linux_deploy_qt_plugins(printsupport cupsprintersupport)
linux_deploy_qt_plugins(sqldrivers qsqlite)
linux_deploy_qt_plugins(xcbglintegrations qxcb-egl-integration qxcb-glx-integration)

# Shell script to run OpenCOR

set(SH_FILENAME ${PROJECT_BUILD_DIR}/${CMAKE_PROJECT_NAME}.sh)
set(SHELL_SCRIPT_FILENAME ${PROJECT_BUILD_DIR}/application)

configure_file(${CMAKE_SOURCE_DIR}/distrib/linux/application.sh.in
${SH_FILENAME} @ONLY)
configure_file(${PLATFORM_DISTRIB_DIR}/application.in ${SHELL_SCRIPT_FILENAME} @ONLY)

install(FILES ${SH_FILENAME}
install(FILES ${SHELL_SCRIPT_FILENAME}
DESTINATION .
RENAME ${CMAKE_PROJECT_NAME}
PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE)
Expand Down
31 changes: 17 additions & 14 deletions cmake/common.cmake
Expand Up @@ -175,8 +175,8 @@ macro(add_plugin PLUGIN_NAME)
set(OPTIONS)
set(ONE_VALUE_KEYWORDS
EXTERNAL_BINARIES_DIR
EXTERNAL_DESTINATION_DIR
EXTERNAL_SOURCE_DIR
EXTERNAL_DESTINATION_DIR
)
set(MULTI_VALUE_KEYWORDS
SOURCES
Expand Down Expand Up @@ -276,13 +276,13 @@ macro(add_plugin PLUGIN_NAME)
)
endforeach()

# External binaries

if(NOT "${ARG_EXTERNAL_BINARIES_DIR}" STREQUAL "")
# Create a custom target for copying binaries
# Note: this is to prevent Ninja from getting confused with circular
# references...
# Create a custom target for copying external binaries
# Note: this is to prevent Ninja from getting confused with circular
# references...

if( NOT "${ARG_EXTERNAL_BINARIES_DIR}" STREQUAL ""
OR ( NOT "${ARG_EXTERNAL_SOURCE_DIR}" STREQUAL ""
AND NOT "${ARG_EXTERNAL_DESTINATION_DIR}" STREQUAL ""))
set(COPY_EXTERNAL_BINARIES_TARGET "COPY_${PROJECT_NAME}_EXTERNAL_BINARIES")

add_custom_target(${COPY_EXTERNAL_BINARIES_TARGET})
Expand All @@ -291,7 +291,11 @@ macro(add_plugin PLUGIN_NAME)
if(NOT "${ARG_DEPENDS_ON}" STREQUAL "")
add_dependencies(${COPY_EXTERNAL_BINARIES_TARGET} ${ARG_DEPENDS_ON})
endif()
endif()

# External binaries

if(NOT "${ARG_EXTERNAL_BINARIES_DIR}" STREQUAL "")
foreach(ARG_EXTERNAL_BINARY ${ARG_EXTERNAL_BINARIES})
# Make sure that the external binary exists

Expand Down Expand Up @@ -371,12 +375,11 @@ macro(add_plugin PLUGIN_NAME)

# Check whether an external package has files to install

if( NOT "${ARG_EXTERNAL_DESTINATION_DIR}" STREQUAL ""
AND NOT "${ARG_EXTERNAL_SOURCE_DIR}" STREQUAL "")

if( NOT "${ARG_EXTERNAL_SOURCE_DIR}" STREQUAL ""
AND NOT "${ARG_EXTERNAL_DESTINATION_DIR}" STREQUAL "")
# Copy the entire source directory to the destination

add_custom_command(TARGET ${PROJECT_NAME} POST_BUILD
add_custom_command(TARGET ${COPY_EXTERNAL_BINARIES_TARGET}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${ARG_EXTERNAL_SOURCE_DIR}
${ARG_EXTERNAL_DESTINATION_DIR})
endif()
Expand Down Expand Up @@ -657,7 +660,7 @@ endmacro()

#===============================================================================

macro(windows_deploy_qt_plugin PLUGIN_CATEGORY)
macro(windows_deploy_qt_plugins PLUGIN_CATEGORY)
foreach(PLUGIN_NAME ${ARGN})
# Copy the Qt plugin to the plugins folder

Expand Down Expand Up @@ -725,7 +728,7 @@ endmacro()

#===============================================================================

macro(linux_deploy_qt_plugin PLUGIN_CATEGORY)
macro(linux_deploy_qt_plugins PLUGIN_CATEGORY)
foreach(PLUGIN_NAME ${ARGN})
# Copy the Qt plugin to the plugins folder

Expand Down Expand Up @@ -803,7 +806,7 @@ endmacro()

#===============================================================================

macro(macos_deploy_qt_plugin PLUGIN_CATEGORY)
macro(macos_deploy_qt_plugins PLUGIN_CATEGORY)
foreach(PLUGIN_NAME ${ARGN})
# Deploy the Qt plugin

Expand Down
File renamed without changes.
File renamed without changes.
8 changes: 4 additions & 4 deletions src/misc/cliapplication.cpp
Expand Up @@ -89,13 +89,13 @@ void CliApplication::loadPlugins()
// Retrieve some categories of plugins

for (auto plugin : mPluginManager->loadedPlugins()) {
if (qobject_cast<PluginInterface *>(plugin->instance()) != nullptr) {
mLoadedPluginPlugins << plugin;
}

if (qobject_cast<CliInterface *>(plugin->instance()) != nullptr) {
mLoadedCliPlugins << plugin;
}

if (qobject_cast<PluginInterface *>(plugin->instance()) != nullptr) {
mLoadedPluginPlugins << plugin;
}
}

// Initialise the plugins themselves
Expand Down
2 changes: 1 addition & 1 deletion src/misc/cliapplication.h
Expand Up @@ -58,8 +58,8 @@ class CliApplication

PluginManager *mPluginManager = nullptr;

Plugins mLoadedPluginPlugins;
Plugins mLoadedCliPlugins;
Plugins mLoadedPluginPlugins;

void loadPlugins();
void includePlugins(const QStringList &pPluginNames,
Expand Down

0 comments on commit fc03a45

Please sign in to comment.