Commit e190848f authored by Jan Möbius's avatar Jan Möbius

Dennis CMAKE Documentation

git-svn-id: http://www.openflipper.org/svnrepo/OpenFlipper/branches/Free@5866 383ad7c9-94d9-4d36-a494-682f7c89f535
parent 7ea5b969
include (common)
# find needed packages
find_package (OpenGL)
find_package (GLUT)
find_package (GLEW)
......@@ -19,6 +20,7 @@ link_directories (
${GLEW_LIBRARY_DIR}
)
# source code directories
set (directories
..
../Core
......@@ -38,24 +40,31 @@ set (directories
../widgets/viewModeWidget
)
# collect all header,source and ui files
append_files (headers "*.hh" ${directories})
append_files (sources "*.cc" ${directories})
append_files (ui "*.ui" ${directories})
# remove template cc files from source file list
drop_templates (sources)
# genereate uic and moc targets
qt4_autouic (uic_targets ${ui})
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})
# 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})
else ()
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
......@@ -71,6 +80,9 @@ target_link_libraries (OpenFlipper
)
if (APPLE)
# 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"
......@@ -82,6 +94,9 @@ else ()
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
......@@ -89,7 +104,8 @@ if (WIN32)
${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")
......@@ -99,6 +115,10 @@ copy_after_build (OpenFlipper "${CMAKE_CURRENT_SOURCE_DIR}/../Help" "${CMAKE_BIN
if (NOT APPLE)
# install all needed files
# 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")
......
[Options]
MaxRecent=6
SetRandomBaseColor=true
[Plugins]
DontLoad=Wii controler
include (common)
# find needed packages
find_package (OpenGL)
find_package (GLUT)
find_package (GLEW)
......@@ -19,6 +20,7 @@ link_directories (
${GLEW_LIBRARY_DIR}
)
# source code directories
set (directories
../BasePlugin
../ACGHelper
......@@ -28,26 +30,32 @@ set (directories
../widgets/glWidget
)
# generate dllexport macros on windows
if (WIN32)
add_definitions (
-DPLUGINLIBDLL
)
endif ()
# collect all header,source and ui files
append_files (headers "*.hh" ${directories})
append_files (sources "*.cc" ${directories})
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)
# remove template cc files from source file list
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})
# set common target properties defined in common.cmake
set_target_props (PluginLib)
target_link_libraries (PluginLib
......@@ -62,10 +70,15 @@ target_link_libraries (PluginLib
)
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
......
This diff is collapsed.
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