Commit 00c4a7f7 authored by Jan Möbius's avatar Jan Möbius

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5917 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 2835f0e2
include (common)
include (ACGCommon)
# find needed packages
acg_qt4 (REQUIRED 4.5)
acg_openmp ()
acg_ftgl ()
# check for OpenGL, GLEW and GLUT as our required dependencies
find_package (OpenGL)
find_package (GLUT)
if (NOT OPENGL_FOUND)
message (FATAL_ERROR "OpengGL not found!")
endif ()
find_package (GLEW)
ftgl ()
if (NOT GLEW_FOUND)
message (FATAL_ERROR "GLEW not found!")
endif ()
find_package (GLUT)
if (NOT GLUT_FOUND)
message (FATAL_ERROR "GLUT not found!")
endif ()
include_directories (
..
${CMAKE_SOURCE_DIR}/OpenMesh/src
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/ShaderUtils
${CMAKE_CURRENT_BINARY_DIR}
......@@ -43,21 +58,18 @@ if (WIN32)
endif ()
# collect all header,source and ui files
append_files (headers "*.hh" ${directories})
append_files (sources "*.cc" ${directories})
append_files (ui "*.ui" ${directories})
acg_append_files (headers "*.hh" ${directories})
acg_append_files (sources "*.cc" ${directories})
acg_append_files (ui "*.ui" ${directories})
# remove template cc files from source file list
drop_templates (sources)
acg_drop_templates (sources)
# genereate uic and moc targets
qt4_autouic (uic_targets ${ui})
qt4_automoc (moc_targets ${headers})
acg_qt4_autouic (uic_targets ${ui})
acg_qt4_automoc (moc_targets ${headers})
add_library (ACG SHARED ${uic_targets} ${sources} ${headers} ${moc_targets})
# set common target properties defined in common.cmake
set_target_props (ACG)
acg_add_library (ACG SHARED ${uic_targets} ${sources} ${headers} ${moc_targets})
target_link_libraries (ACG
OpenMeshCore
......@@ -69,22 +81,3 @@ target_link_libraries (ACG
${FTGL_LIBS}
)
# no install on mac, because the whole bundle will be installed in the
# toplevel CMakeLists.txt
if (NOT APPLE)
install (TARGETS ACG DESTINATION ${OPENFLIPPER_LIBDIR})
endif ()
if (WIN32)
# copy dll file to "Build" directory
# Visual studio will create this file in a subdirectory so we can't use
# LIBRARY_OUTPUT_DIRECTORY directly here
add_custom_command (TARGET ACG POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/ACG.dll
${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_LIBDIR}/ACG.dll
)
endif ()
include (common)
# find needed packages
find_package (OpenGL)
find_package (GLUT)
find_package (GLEW)
ftgl ()
include (ACGCommon)
include_directories (
..
${CMAKE_SOURCE_DIR}/OpenMesh/src
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
......@@ -41,32 +36,29 @@ set (directories
)
# collect all header,source and ui files
append_files (headers "*.hh" ${directories})
append_files (sources "*.cc" ${directories})
append_files (ui "*.ui" ${directories})
acg_append_files (headers "*.hh" ${directories})
acg_append_files (sources "*.cc" ${directories})
acg_append_files (ui "*.ui" ${directories})
# remove template cc files from source file list
drop_templates (sources)
acg_drop_templates (sources)
# genereate uic and moc targets
qt4_autouic (uic_targets ${ui})
qt4_automoc (moc_targets ${headers})
acg_qt4_autouic (uic_targets ${ui})
acg_qt4_automoc (moc_targets ${headers})
if (WIN32)
# add app icon rc file to windows build
add_executable (OpenFlipper WIN32 ${CMAKE_CURRENT_SOURCE_DIR}/CoreApp.rc ${uic_targets} ${sources} ${headers} ${moc_targets})
acg_add_executable (OpenFlipper WIN32 ${CMAKE_CURRENT_SOURCE_DIR}/CoreApp.rc ${uic_targets} ${sources} ${headers} ${moc_targets})
# link to qtmain library to get WinMain function for a non terminal app
target_link_libraries (OpenFlipper ${QT_QTMAIN_LIBRARY})
elseif (APPLE)
# generate bundle on mac
add_executable (OpenFlipper MACOSX_BUNDLE ${uic_targets} ${sources} ${headers} ${moc_targets})
acg_add_executable (OpenFlipper MACOSX_BUNDLE ${uic_targets} ${sources} ${headers} ${moc_targets})
else ()
add_executable (OpenFlipper ${uic_targets} ${sources} ${headers} ${moc_targets})
acg_add_executable (OpenFlipper ${uic_targets} ${sources} ${headers} ${moc_targets})
endif ()
# set common target properties defined in common.cmake
set_target_props (OpenFlipper)
target_link_libraries (OpenFlipper
OpenMeshCore
OpenMeshTools
......@@ -89,29 +81,17 @@ if (APPLE)
MACOSX_BUNDLE_INFO_STRING "ACG OpenFlipper"
MACOSX_BUNDLE_ICON_FILE "Icons/OpenFlipper_Icon.icns"
)
else ()
install (TARGETS OpenFlipper DESTINATION ${OPENFLIPPER_BINDIR})
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 OpenFlipper POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/OpenFlipper.exe
${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_BINDIR}/OpenFlipper.exe)
endif ()
# copy all needed files to "Build" directory to allow a direct execution from it
# the copy_after_build macro (common.cmake) copies the whole directory without svn files
copy_after_build (OpenFlipper "${CMAKE_CURRENT_SOURCE_DIR}/../Shaders" "${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_DATADIR}/Shaders")
copy_after_build (OpenFlipper "${CMAKE_CURRENT_SOURCE_DIR}/../Textures" "${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_DATADIR}/Textures")
copy_after_build (OpenFlipper "${CMAKE_CURRENT_SOURCE_DIR}/../Icons" "${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_DATADIR}/Icons")
copy_after_build (OpenFlipper "${CMAKE_CURRENT_SOURCE_DIR}/../Fonts" "${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_DATADIR}/Fonts")
copy_after_build (OpenFlipper "${CMAKE_CURRENT_SOURCE_DIR}/../Docs" "${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_DATADIR}/Docs")
copy_after_build (OpenFlipper "${CMAKE_CURRENT_SOURCE_DIR}/../Help" "${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_DATADIR}/Help")
acg_copy_after_build (OpenFlipper "${CMAKE_CURRENT_SOURCE_DIR}/../Shaders" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Shaders")
acg_copy_after_build (OpenFlipper "${CMAKE_CURRENT_SOURCE_DIR}/../Textures" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Textures")
acg_copy_after_build (OpenFlipper "${CMAKE_CURRENT_SOURCE_DIR}/../Icons" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Icons")
acg_copy_after_build (OpenFlipper "${CMAKE_CURRENT_SOURCE_DIR}/../Fonts" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Fonts")
acg_copy_after_build (OpenFlipper "${CMAKE_CURRENT_SOURCE_DIR}/../Docs" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Docs")
acg_copy_after_build (OpenFlipper "${CMAKE_CURRENT_SOURCE_DIR}/../Help" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Help")
if (NOT APPLE)
......@@ -119,10 +99,10 @@ if (NOT APPLE)
# the install_dir macro (common.cmake) installs the whole directory without svn files
# no install for mac needed here, because the whole bundle will be installed in the
# toplevel CMakeLists.txt
install_dir ("${CMAKE_CURRENT_SOURCE_DIR}/../Shaders" "${OPENFLIPPER_DATADIR}/Shaders")
install_dir ("${CMAKE_CURRENT_SOURCE_DIR}/../Textures" "${OPENFLIPPER_DATADIR}/Textures")
install_dir ("${CMAKE_CURRENT_SOURCE_DIR}/../Icons" "${OPENFLIPPER_DATADIR}/Icons")
install_dir ("${CMAKE_CURRENT_SOURCE_DIR}/../Fonts" "${OPENFLIPPER_DATADIR}/Fonts")
install_dir ("${CMAKE_CURRENT_SOURCE_DIR}/../Docs" "${OPENFLIPPER_DATADIR}/Docs")
install_dir ("${CMAKE_CURRENT_SOURCE_DIR}/../Help" "${OPENFLIPPER_DATADIR}/Help")
acg_install_dir ("${CMAKE_CURRENT_SOURCE_DIR}/../Shaders" "${ACG_PROJECT_DATADIR}/Shaders")
acg_install_dir ("${CMAKE_CURRENT_SOURCE_DIR}/../Textures" "${ACG_PROJECT_DATADIR}/Textures")
acg_install_dir ("${CMAKE_CURRENT_SOURCE_DIR}/../Icons" "${ACG_PROJECT_DATADIR}/Icons")
acg_install_dir ("${CMAKE_CURRENT_SOURCE_DIR}/../Fonts" "${ACG_PROJECT_DATADIR}/Fonts")
acg_install_dir ("${CMAKE_CURRENT_SOURCE_DIR}/../Docs" "${ACG_PROJECT_DATADIR}/Docs")
acg_install_dir ("${CMAKE_CURRENT_SOURCE_DIR}/../Help" "${ACG_PROJECT_DATADIR}/Help")
endif ()
\ No newline at end of file
include (common)
# find needed packages
find_package (OpenGL)
find_package (GLUT)
find_package (GLEW)
ftgl ()
include (ACGCommon)
include_directories (
..
${CMAKE_SOURCE_DIR}/OpenMesh/src
${CMAKE_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
......@@ -43,25 +38,22 @@ add_definitions (
)
# collect all header,source and ui files
append_files (headers "*.hh" ${directories})
append_files (sources "*.cc" ${directories})
append_files (ui "*.ui" ${directories})
acg_append_files (headers "*.hh" ${directories})
acg_append_files (sources "*.cc" ${directories})
acg_append_files (ui "*.ui" ${directories})
# add additional object type sources
append_files_recursive (headers "*.hh" ${CMAKE_SOURCE_DIR}/ObjectTypes)
append_files_recursive (sources "*.cc" ${CMAKE_SOURCE_DIR}/ObjectTypes)
acg_append_files_recursive (headers "*.hh" ${CMAKE_SOURCE_DIR}/ObjectTypes)
acg_append_files_recursive (sources "*.cc" ${CMAKE_SOURCE_DIR}/ObjectTypes)
# remove template cc files from source file list
drop_templates (sources)
acg_drop_templates (sources)
# genereate uic and moc targets
qt4_autouic (uic_targets ${ui})
qt4_automoc (moc_targets ${headers})
add_library (PluginLib SHARED ${uic_targets} ${sources} ${headers} ${moc_targets})
acg_qt4_autouic (uic_targets ${ui})
acg_qt4_automoc (moc_targets ${headers})
# set common target properties defined in common.cmake
set_target_props (PluginLib)
acg_add_library (PluginLib SHARED ${uic_targets} ${sources} ${headers} ${moc_targets})
target_link_libraries (PluginLib
OpenMeshCore
......@@ -73,20 +65,3 @@ target_link_libraries (PluginLib
${GLUT_LIBRARIES}
${FTGL_LIBS}
)
if (NOT APPLE)
# no install on mac, because the whole bundle will be installed in the
# toplevel CMakeLists.txt
install (TARGETS PluginLib DESTINATION ${OPENFLIPPER_LIBDIR})
endif ()
if (WIN32)
# copy dll file to "Build" directory
# Visual studio will create this file in a subdirectory so we can't use
# LIBRARY_OUTPUT_DIRECTORY directly here
add_custom_command (TARGET PluginLib POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/PluginLib.dll
${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_LIBDIR}/PluginLib.dll)
endif ()
\ No newline at end of file
set (ACG_PROJECT_MACOS_BUNDLE "1")
macro (acg_modify_project_dirs)
# set directory structures for the different platforms
if (WIN32)
add_definitions(
-D_USE_MATH_DEFINES -DNOMINMAX
-DOPENFLIPPER_APPDIR=".."
-DOPENFLIPPER_PLUGINDIR="${ACG_PROJECT_PLUGINDIR}"
-DOPENFLIPPER_DATADIR="${ACG_PROJECT_DATADIR}"
)
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_BINDIR})
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_BINDIR})
endif ()
elseif (APPLE)
set (MAC_OPENFLIPPER_BASEDIR "OpenFlipper.app/Contents/Resources")
set (ACG_PROJECT_DATADIR "${MAC_ACG_PROJECT_BASEDIR}")
set (ACG_PROJECT_PLUGINDIR "${MAC_ACG_PROJECT_BASEDIR}/Plugins")
set (ACG_PROJECT_LIBDIR "${MAC_ACG_PROJECT_BASEDIR}/../MacOS")
set (ACG_PROJECT_BINDIR "${MAC_ACG_PROJECT_BASEDIR}/../MacOS")
add_definitions(
-DOPENFLIPPER_APPDIR="../Resources"
-DOPENFLIPPER_PLUGINDIR="Plugins"
-DOPENFLIPPER_DATADIR="."
)
else ()
add_definitions(
-DOPENFLIPPER_APPDIR=".."
-DOPENFLIPPER_PLUGINDIR="${ACG_PROJECT_PLUGINDIR}"
-DOPENFLIPPER_DATADIR="${ACG_PROJECT_DATADIR}"
)
endif ()
endmacro ()
# search all plugins and add them to build
function (of_add_plugins)
file (
GLOB _plugins_in
RELATIVE "${CMAKE_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/Plugin-*/CMakeLists.txt"
)
foreach (_plugin ${_plugins_in})
get_filename_component (_plugin_dir ${_plugin} PATH)
add_subdirectory (${CMAKE_SOURCE_DIR}/${_plugin_dir})
endforeach ()
endfunction ()
# print plugin statistics
function (of_print_plugin_stats)
acg_color_message ("\n${_escape}[4mPlugin configure check results:${_escape}[0m\n")
file (
GLOB _plugins_in
RELATIVE "${CMAKE_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/Plugin-*"
)
foreach (_plugin ${_plugins_in})
string (REPLACE "Plugin-" "" _plugin_name ${_plugin})
string (TOUPPER ${_plugin_name} _PLUGIN)
if (NOT EXISTS ${CMAKE_SOURCE_DIR}/${_plugin}/CMakeLists.txt AND DISABLE_QMAKE_BUILD)
list (APPEND CPACK_SOURCE_IGNORE_FILES "${CMAKE_SOURCE_DIR}/${_plugin}")
elseif (DISABLE_PLUGIN_${_PLUGIN})
list (APPEND CPACK_SOURCE_IGNORE_FILES "${CMAKE_SOURCE_DIR}/${_plugin}")
endif ()
endforeach ()
foreach (_plugin ${_plugins_in})
string (REPLACE "Plugin-" "" _plugin_name ${_plugin})
string (TOUPPER ${_plugin_name} _PLUGIN)
acg_format_string (${_plugin_name} 20 _plugin_name)
if (DISABLE_PLUGIN_${_PLUGIN})
acg_color_message (" ${_plugin_name}: ${_escape}[1;34mDisabled${_escape}[0m")
elseif (NOT EXISTS ${CMAKE_SOURCE_DIR}/${_plugin}/CMakeLists.txt)
acg_color_message (" ${_plugin_name}: ${_escape}[1;34mNo CMake build system${_escape}[0m")
else ()
if (OPENFLIPPER_${_PLUGIN}_BUILD)
acg_color_message (" ${_plugin_name}: ${_escape}[1;32mYes${_escape}[0m")
else ()
acg_color_message (" ${_plugin_name}: ${_escape}[1;31mNo${_escape}[0m (Missing dependencies :${_${_PLUGIN}_MISSING_DEPS})")
endif ()
endif ()
endforeach ()
message ("")
endfunction ()
......@@ -98,12 +98,12 @@ if (WIN32)
if (EXISTS ${CMAKE_SOURCE_DIR}/WIN)
file (GLOB _files "${CMAKE_SOURCE_DIR}/WIN/DLLs/DLLs 32 debug/*.dll")
install(FILES ${_files}
DESTINATION ${OPENFLIPPER_LIBDIR}
DESTINATION ${ACG_PROJECT_LIBDIR}
CONFIGURATIONS Debug
)
file (GLOB _files "${CMAKE_SOURCE_DIR}/WIN/DLLs/DLLs 32 release/*.dll")
install (FILES ${_files}
DESTINATION ${OPENFLIPPER_LIBDIR}
DESTINATION ${ACG_PROJECT_LIBDIR}
CONFIGURATIONS Release
)
endif ()
......
......@@ -20,12 +20,12 @@
# INCDIRS = additional include directories
# ADDSRC = additional source files
#
# Plugins can implement a of_list_filter ("listname") macro to filter out
# 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)
#
include (common)
include (ACGCommon)
# get plugin name from directory name
macro (_get_plugin_name var)
......@@ -81,7 +81,7 @@ macro (_check_plugin_deps _prefix)
endforeach ()
else ()
set (${_prefix}_HAS_DEPS FALSE)
of_set (_${_prefix}_MISSING_DEPS "${_${_prefix}_MISSING_DEPS} ${_val}")
acg_set (_${_prefix}_MISSING_DEPS "${_${_prefix}_MISSING_DEPS} ${_val}")
endif ()
endforeach ()
endmacro ()
......@@ -89,12 +89,7 @@ endmacro ()
# main function
function (_build_openflipper_plugin plugin)
of_set (OPENFLIPPER_${_PLUGIN}_BUILD "0")
# base dependencies
find_package (OpenGL)
find_package (GLUT)
find_package (GLEW)
acg_set (OPENFLIPPER_${_PLUGIN}_BUILD "0")
# get upper plugin name
string (TOUPPER ${plugin} _PLUGIN)
......@@ -104,11 +99,11 @@ function (_build_openflipper_plugin plugin)
# check dependencies
of_unset (_${_PLUGIN}_MISSING_DEPS)
acg_unset (_${_PLUGIN}_MISSING_DEPS)
set (${_PLUGIN}_HAS_DEPS)
_check_plugin_deps (${_PLUGIN} ${${_PLUGIN}_OPTDEPS})
of_unset (_${_PLUGIN}_MISSING_DEPS)
acg_unset (_${_PLUGIN}_MISSING_DEPS)
set (${_PLUGIN}_HAS_DEPS)
_check_plugin_deps (${_PLUGIN} ${${_PLUGIN}_DEPS})
......@@ -116,6 +111,7 @@ function (_build_openflipper_plugin plugin)
include_directories (
.
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/OpenMesh/src
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${${_PLUGIN}_DEPS_INCDIRS}
......@@ -136,30 +132,30 @@ function (_build_openflipper_plugin plugin)
)
# collect all header,source and ui files
append_files (headers "*.hh" ${directories})
append_files (sources "*.cc" ${directories})
append_files (sources "*.c" ${directories})
append_files (ui "*.ui" ${directories})
acg_append_files (headers "*.hh" ${directories})
acg_append_files (sources "*.cc" ${directories})
acg_append_files (sources "*.c" ${directories})
acg_append_files (ui "*.ui" ${directories})
# remove template cc files from source file list
drop_templates (sources)
acg_drop_templates (sources)
# filter header,source and ui files lists if of_list_filter macro has been defined
if (COMMAND of_list_filter)
of_list_filter (headers)
of_list_filter (sources)
of_list_filter (ui)
# filter header,source and ui files lists if acg_list_filter macro has been defined
if (COMMAND acg_list_filter)
acg_list_filter (headers)
acg_list_filter (sources)
acg_list_filter (ui)
endif ()
# genereate uic and moc targets
qt4_autouic (uic_targets ${ui})
qt4_automoc (moc_targets ${headers})
acg_qt4_autouic (uic_targets ${ui})
acg_qt4_automoc (moc_targets ${headers})
add_library (Plugin-${plugin} MODULE ${uic_targets} ${sources} ${headers} ${moc_targets} ${${_PLUGIN}_ADDSRC})
# add this plugin to build plugin list for dependency tracking
of_set (OPENFLIPPER_PLUGINS "${OPENFLIPPER_PLUGINS};Plugin-${plugin}")
of_set (OPENFLIPPER_${_PLUGIN}_BUILD "1")
acg_set (OPENFLIPPER_PLUGINS "${OPENFLIPPER_PLUGINS};Plugin-${plugin}")
acg_set (OPENFLIPPER_${_PLUGIN}_BUILD "1")
# append compiler and linker flags from plugin dependencies
set_target_properties (
......@@ -173,7 +169,7 @@ function (_build_openflipper_plugin plugin)
find_package (GLUT)
# generate dllinport defines
add_definitions (-DACGDLL -DUSEACG -DPLUGINLIBDLL -DUSEPLUGINLIBDLL)
target_link_libraries (Plugin-${plugin}
target_link_libraries (Plugin-${plugin}
OpenMeshCore
OpenMeshTools
ACG
......@@ -184,14 +180,14 @@ function (_build_openflipper_plugin plugin)
# copy plugin dll file to "Build" directory
# Visual studio will create this file in a subdirectory so we can't use
# LIBRARY_OUTPUT_DIRECTORY directly here
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_PLUGINDIR})
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_PLUGINDIR})
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_PLUGINDIR})
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${ACG_PROJEC_PLUGINDIR})
endif ()
add_custom_command (TARGET Plugin-${plugin} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/Plugin-${plugin}.dll
${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_PLUGINDIR}
${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_PLUGINDIR}
)
elseif (APPLE)
......@@ -201,20 +197,20 @@ function (_build_openflipper_plugin plugin)
${QT_LIBRARIES}
)
# copy plugin so file to application bundle inside "Build" directory
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_PLUGINDIR})
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_PLUGINDIR})
if (NOT EXISTS ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_PLUGINDIR})
file (MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_PLUGINDIR})
endif ()
add_custom_command (TARGET Plugin-${plugin} POST_BUILD
COMMAND ${CMAKE_COMMAND} -E
copy_if_different
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/libPlugin-${plugin}.so
${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_PLUGINDIR}/libPlugin-${plugin}.so
${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_PLUGINDIR}/libPlugin-${plugin}.so
)
else ()
# directly generate plugin in plugin directory
set_target_properties (
Plugin-${plugin} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_PLUGINDIR}"
LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_PLUGINDIR}"
)
endif ()
......@@ -228,7 +224,7 @@ function (_build_openflipper_plugin plugin)
if (NOT APPLE)
install (
TARGETS Plugin-${plugin}
DESTINATION ${OPENFLIPPER_PLUGINDIR}
DESTINATION ${ACG_PROJECT_PLUGINDIR}
)
endif ()
......
# fill string with spaces
macro (acg_format_string str length return)
string (LENGTH "${str}" _str_len)
math (EXPR _add_chr "${length} - ${_str_len}")
set (${return} "${str}")
while (_add_chr GREATER 0)
set (${return} "${${return}} ")
math (EXPR _add_chr "${_add_chr} - 1")
endwhile ()
endmacro ()
# print message with color escape sequences if CMAKE_COLOR_MAKEFILE is set
string (ASCII 27 _escape)
function (acg_color_message _str)
if (CMAKE_COLOR_MAKEFILE AND NOT WIN32)
message (${_str})
else ()
string (REGEX REPLACE "${_escape}.[0123456789;]*m" "" __str ${_str})
message (${__str})
endif ()
endfunction ()
# info header
function (acg_print_configure_header _name)
acg_format_string ("${_name}" 40 _project)
acg_format_string ("${VERSION}" 40 _version)
acg_color_message ("\n${_escape}[40;37m************************************************************${_escape}[0m")
acg_color_message ("${_escape}[40;37m* ${_escape}[1;31mACG ${_escape}[0;40;34mBuildsystem${_escape}[0m${_escape}[40;37m *${_escape}[0m")
acg_color_message ("${_escape}[40;37m* *${_escape}[0m")
acg_color_message ("${_escape}[40;37m* Package : ${_escape}[32m${_project} ${_escape}[37m *${_escape}[0m")
acg_color_message ("${_escape}[40;37m* Version : ${_escape}[32m${_version} ${_escape}[37m *${_escape}[0m")
acg_color_message ("${_escape}[40;37m************************************************************${_escape}[0m")
endfunction ()
# info line
function (acg_print_configure_footer)
acg_color_message ("${_escape}[40;37m************************************************************${_escape}[0m\n")
endfunction ()
# fill string with spaces
macro (of_format_string str length return)
string (LENGTH "${str}" _str_len)
math (EXPR _add_chr "${length} - ${_str_len}")
set (${return} "${str}")
while (_add_chr GREATER 0)
set (${return} "${${return}} ")
math (EXPR _add_chr "${_add_chr} - 1")
endwhile ()
endmacro ()
# print message with color escape sequences if CMAKE_COLOR_MAKEFILE is set
string (ASCII 27 _escape)
function (of_color_message _str)
if (CMAKE_COLOR_MAKEFILE AND NOT WIN32)
message (${_str})
else ()
string (REGEX REPLACE "${_escape}.[0123456789;]*m" "" __str ${_str})
message (${__str})
endif ()
endfunction ()
# info header
function (of_print_configure_header _name)
of_format_string ("${_name}" 40 _project)
of_format_string ("${VERSION}" 40 _version)
of_color_message ("\n${_escape}[40;37m************************************************************${_escape}[0m")
of_color_message ("${_escape}[40;37m* ${_escape}[1;31mACG ${_escape}[0;40;34mBuildsystem${_escape}[0m${_escape}[40;37m *${_escape}[0m")
of_color_message ("${_escape}[40;37m* *${_escape}[0m")
of_color_message ("${_escape}[40;37m* Package : ${_escape}[32m${_project} ${_escape}[37m *${_escape}[0m")
of_color_message ("${_escape}[40;37m* Version : ${_escape}[32m${_version} ${_escape}[37m *${_escape}[0m")
of_color_message ("${_escape}[40;37m************************************************************${_escape}[0m")
endfunction ()
# info line
function (of_print_configure_footer)
of_color_message ("${_escape}[40;37m************************************************************${_escape}[0m\n")
endfunction ()
# print plugin statistics
function (of_print_plugin_stats)
of_color_message ("\n${_escape}[4mPlugin configure check results:${_escape}[0m\n")
file (
GLOB _plugins_in
RELATIVE "${CMAKE_SOURCE_DIR}"
"${CMAKE_SOURCE_DIR}/Plugin-*"
)
foreach (_plugin ${_plugins_in})
string (REPLACE "Plugin-" "" _plugin_name ${_plugin})
string (TOUPPER ${_plugin_name} _PLUGIN)