Add option to build and install the designer plugin
The patch adds a cmake option BUILD_DESIGNER_PLUGIN, targeted mainly at package maintainers to allow an easy build and installation of the FreeCAD designer plugin. It has been discussed in https://forum.freecadweb.org/viewtopic.php?f=10&t=67706 Signed-off-by: Bernd Waibel <waebbl-gentoo@posteo.net>
This commit is contained in:
@@ -87,6 +87,8 @@ SetGlobalCompilerAndLinkerSettings()
|
|||||||
add_subdirectory(src)
|
add_subdirectory(src)
|
||||||
add_subdirectory(data)
|
add_subdirectory(data)
|
||||||
|
|
||||||
|
BuildAndInstallDesignerPlugin()
|
||||||
|
|
||||||
CreatePackagingTargets()
|
CreatePackagingTargets()
|
||||||
|
|
||||||
PrintFinalReport()
|
PrintFinalReport()
|
||||||
|
|||||||
@@ -0,0 +1,9 @@
|
|||||||
|
macro(BuildAndInstallDesignerPlugin)
|
||||||
|
# =================================================================
|
||||||
|
# ============= Build and install the designer plugin =============
|
||||||
|
# =================================================================
|
||||||
|
|
||||||
|
if(BUILD_DESIGNER_PLUGIN)
|
||||||
|
add_subdirectory(src/Tools/plugins/widget)
|
||||||
|
endif(BUILD_DESIGNER_PLUGIN)
|
||||||
|
endmacro(BuildAndInstallDesignerPlugin)
|
||||||
@@ -80,6 +80,8 @@ macro(InitializeFreeCADBuildOptions)
|
|||||||
endif()
|
endif()
|
||||||
configure_file(${CMAKE_SOURCE_DIR}/src/QtOpenGL.h.cmake ${CMAKE_BINARY_DIR}/src/QtOpenGL.h)
|
configure_file(${CMAKE_SOURCE_DIR}/src/QtOpenGL.h.cmake ${CMAKE_BINARY_DIR}/src/QtOpenGL.h)
|
||||||
|
|
||||||
|
option(BUILD_DESIGNER_PLUGIN "Build and install the designer plugin" OFF)
|
||||||
|
|
||||||
if(APPLE)
|
if(APPLE)
|
||||||
option(FREECAD_CREATE_MAC_APP "Create app bundle on install" OFF)
|
option(FREECAD_CREATE_MAC_APP "Create app bundle on install" OFF)
|
||||||
|
|
||||||
|
|||||||
@@ -92,6 +92,11 @@ macro(PrintFinalReport)
|
|||||||
message(STATUS "Qt5WebKitWidgets: not needed (BUILD_WEB)")
|
message(STATUS "Qt5WebKitWidgets: not needed (BUILD_WEB)")
|
||||||
message(STATUS "Qt5WebEngineWidgets: not needed (BUILD_WEB)")
|
message(STATUS "Qt5WebEngineWidgets: not needed (BUILD_WEB)")
|
||||||
endif(BUILD_WEB)
|
endif(BUILD_WEB)
|
||||||
|
if(BUILD_DESIGNER_PLUGIN)
|
||||||
|
message(STATUS "Designer plugin: ${DESIGNER_PLUGIN_LOCATION}/libFreeCAD_widgets.so")
|
||||||
|
else(BUILD_DESIGNER_PLUGIN)
|
||||||
|
message(STATUS "Designer plugin: not built per user request (BUILD_DESIGNER_PLUGIN)")
|
||||||
|
endif(BUILD_DESIGNER_PLUGIN)
|
||||||
if(${Qt5WinExtras_FOUND})
|
if(${Qt5WinExtras_FOUND})
|
||||||
message(STATUS "Qt5WinExtras: ${Qt5WinExtras_VERSION}")
|
message(STATUS "Qt5WinExtras: ${Qt5WinExtras_VERSION}")
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -29,6 +29,9 @@ if(BUILD_GUI)
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
if(BUILD_DESIGNER_PLUGIN)
|
||||||
|
find_package(Qt5Designer REQUIRED)
|
||||||
|
endif()
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
find_package(Qt5WinExtras QUIET)
|
find_package(Qt5WinExtras QUIET)
|
||||||
endif()
|
endif()
|
||||||
|
|||||||
@@ -1,11 +1,11 @@
|
|||||||
project(FreeCAD_widgets)
|
project(FreeCAD_widgets)
|
||||||
cmake_minimum_required(VERSION 3.2.0)
|
cmake_minimum_required(VERSION 3.2.0)
|
||||||
|
|
||||||
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
#set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
||||||
set(CMAKE_AUTOMOC ON)
|
#set(CMAKE_AUTOMOC ON)
|
||||||
|
|
||||||
find_package(Qt5Widgets REQUIRED)
|
#find_package(Qt5Widgets REQUIRED)
|
||||||
find_package(Qt5Designer REQUIRED)
|
#find_package(Qt5Designer REQUIRED)
|
||||||
|
|
||||||
include_directories(
|
include_directories(
|
||||||
${Qt5Core_INCLUDE_DIRS}
|
${Qt5Core_INCLUDE_DIRS}
|
||||||
@@ -27,13 +27,12 @@ target_compile_options(FreeCAD_widgets PRIVATE ${COMPILE_OPTIONS})
|
|||||||
# Get the install location of a plugin to determine the path to designer plguins
|
# Get the install location of a plugin to determine the path to designer plguins
|
||||||
get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION)
|
get_target_property(QMAKE_EXECUTABLE Qt5::qmake LOCATION)
|
||||||
exec_program(${QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_PLUGINS" RETURN_VALUE return_code OUTPUT_VARIABLE DEFAULT_QT_PLUGINS_DIR )
|
exec_program(${QMAKE_EXECUTABLE} ARGS "-query QT_INSTALL_PLUGINS" RETURN_VALUE return_code OUTPUT_VARIABLE DEFAULT_QT_PLUGINS_DIR )
|
||||||
set(DESIGNER_PLUGIN_LOCATION ${DEFAULT_QT_PLUGINS_DIR}/designer)
|
set(DESIGNER_PLUGIN_LOCATION ${DEFAULT_QT_PLUGINS_DIR}/designer CACHE FILEPATH "Path where the plugin will be installed to")
|
||||||
message(STATUS "Plugin will installed to: ${DESIGNER_PLUGIN_LOCATION}")
|
#message(STATUS "Plugin will be installed to: ${DESIGNER_PLUGIN_LOCATION}")
|
||||||
|
|
||||||
|
|
||||||
# Override the CMake variable
|
# Override the CMake variable
|
||||||
set(CMAKE_INSTALL_PREFIX ${DESIGNER_PLUGIN_LOCATION} CACHE PATH "Install path to Qt Designer plugins" FORCE)
|
#set(CMAKE_INSTALL_PREFIX ${DESIGNER_PLUGIN_LOCATION} CACHE PATH "Install path to Qt Designer plugins" FORCE)
|
||||||
|
|
||||||
INSTALL(TARGETS FreeCAD_widgets
|
INSTALL(TARGETS FreeCAD_widgets
|
||||||
LIBRARY DESTINATION ${DESIGNER_PLUGIN_LOCATION}
|
LIBRARY DESTINATION "$ENV{DESTDIR}${DESIGNER_PLUGIN_LOCATION}"
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user