Commit 9aaa850c authored by Jan Möbius's avatar Jan Möbius

Dennis:

LicenseManagement for cmake plugins



git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@6664 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 32e639d2
......@@ -9,7 +9,8 @@
# [LIBDIRS dir1 dir2 ...]
# [INCDIRS dir1 dir2 ...]
# [ADDSRC file1 file2 ...]
# [INSTALLDATA dir1 dir2 ...)
# [INSTALLDATA dir1 dir2 ...]
# [LICENSEMANAGER])
#
# DIRS = additional directories with source files
# DEPS = required dependencies for find_package macro
......@@ -22,6 +23,8 @@
# ADDSRC = additional source files
# INSTALLDATA = directories that will be installed into the openflipper data directory
#
# 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
# build sources lists (see common.cmake drop_templates macro)
......@@ -39,9 +42,14 @@ endmacro ()
macro (_get_plugin_parameters _prefix)
set (_current_var _foo)
set (_supported_var DIRS DEPS OPTDEPS LDFLAGSADD CFLAGSADD LIBRARIES LIBDIRS INCDIRS ADDSRC INSTALLDATA)
set (_supported_flags LICENSEMANAGER)
foreach (_val ${_supported_var})
set (${_prefix}_${_val})
endforeach ()
foreach (_val ${_supported_flags})
set (${_prefix}_${_val} 0)
endforeach ()
foreach (_val ${ARGN})
set (_found FALSE)
foreach (_find ${_supported_var})
......@@ -49,13 +57,20 @@ macro (_get_plugin_parameters _prefix)
set (_found TRUE)
endif ()
endforeach ()
foreach (_find ${_supported_flags})
if ("${_find}" STREQUAL "${_val}")
set (${_prefix}_${_val} 1)
endif ()
endforeach ()
if (_found)
set (_current_var ${_prefix}_${_val})
else ()
list (APPEND ${_current_var} ${_val})
endif ()
endforeach ()
endmacro ()
# check dependencies
......@@ -100,6 +115,42 @@ macro (_check_plugin_deps _prefix)
endforeach ()
endmacro ()
macro (_plugin_licensemanagement)
acg_append_files (headers "*.hh" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager")
acg_append_files (sources "*.cc" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager")
acg_append_files (keygen_hdr "*.hh" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager/keyGen")
acg_append_files (keygen_src "*.cc" "${CMAKE_SOURCE_DIR}/OpenFlipper/LicenseManager/keyGen")
add_executable (Plugin-${plugin}-keygen ${keygen_hdr} ${keygen_src})
target_link_libraries (
Plugin-${plugin}-keygen
${QT_LIBRARIES}
)
# create our output directroy
if (NOT EXISTS ${CMAKE_BINARY_DIR}/LicenseManagement)
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/LicenseManagement)
endif ()
if (WIN32)
# copy exe file to "Build" directory
# Visual studio will create this file in a subdirectory so we can't use
# RUNTIME_OUTPUT_DIRECTORY directly here
add_custom_command (TARGET Plugin-${plugin}-keygen POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Plugin-${plugin}-keygen.exe
${CMAKE_BINARY_DIR}/LicenseManagement/Plugin-${plugin}-keygen.exe)
else ()
set_target_properties (
Plugin-${plugin}-keygen PROPERTIES
RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/LicenseManagement"
)
endif ()
endmacro ()
# main function
function (_build_openflipper_plugin plugin)
......@@ -161,6 +212,10 @@ function (_build_openflipper_plugin plugin)
acg_list_filter (ui)
endif ()
if (${${_PLUGIN}_LICENSEMANAGER})
_plugin_licensemanagement ()
endif ()
# genereate uic and moc targets
acg_qt4_autouic (uic_targets ${ui})
acg_qt4_automoc (moc_targets ${headers})
......@@ -174,7 +229,7 @@ function (_build_openflipper_plugin plugin)
# append compiler and linker flags from plugin dependencies
set_target_properties (
Plugin-${plugin} PROPERTIES
COMPILE_FLAGS "${${_PLUGIN}_CFLAGSADD}"
COMPILE_FLAGS ""
LINK_FLAGS "${${_PLUGIN}_LDFLAGSADD} ${${_PLUGIN}_DEPS_LINKER_FLAGS}"
)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment