CMakeLists.txt 4.48 KB
Newer Older
Jan Möbius's avatar
 
Jan Möbius committed
1
include (ACGCommon)
Jan Möbius's avatar
 
Jan Möbius committed
2 3 4

include_directories (
  ..
Jan Möbius's avatar
 
Jan Möbius committed
5
  ${CMAKE_SOURCE_DIR}/OpenMesh/src
Jan Möbius's avatar
 
Jan Möbius committed
6 7 8 9 10 11 12 13 14 15 16 17
  ${CMAKE_SOURCE_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${CMAKE_CURRENT_BINARY_DIR}
  ${OPENGL_INCLUDE_DIR}
  ${GLEW_INCLUDE_DIR}
  ${GLUT_INCLUDE_DIR}
)

link_directories (
  ${GLEW_LIBRARY_DIR}
)

Jan Möbius's avatar
Jan Möbius committed
18
# source code directories
Jan Möbius's avatar
 
Jan Möbius committed
19 20 21 22 23 24 25 26 27 28 29 30
set (directories 
  .. 
  ../Core
  ../Logging
  ../Scripting
  ../Scripting/scriptPrototypes
  ../Scripting/scriptWrappers
  ../SimpleOpt
  ../widgets/aboutWidget 
  ../widgets/addEmptyWidget
  ../widgets/loggerWidget
  ../widgets/coreWidget 
31
  ../widgets/helpWidget
Jan Möbius's avatar
 
Jan Möbius committed
32 33 34 35
  ../widgets/loadWidget
  ../widgets/optionsWidget
  ../widgets/PluginDialog
  ../widgets/viewModeWidget
Dirk Wilden's avatar
Dirk Wilden committed
36
  ../widgets/videoCaptureDialog
37
  ../widgets/snapshotDialog
Jan Möbius's avatar
 
Jan Möbius committed
38 39
)

Jan Möbius's avatar
Jan Möbius committed
40
# collect all header,source and ui files
Jan Möbius's avatar
 
Jan Möbius committed
41 42 43
acg_append_files (headers "*.hh" ${directories})
acg_append_files (sources "*.cc" ${directories})
acg_append_files (ui "*.ui" ${directories})
Jan Möbius's avatar
 
Jan Möbius committed
44

Jan Möbius's avatar
Jan Möbius committed
45
# remove template cc files from source file list
Jan Möbius's avatar
 
Jan Möbius committed
46
acg_drop_templates (sources)
Jan Möbius's avatar
 
Jan Möbius committed
47

Jan Möbius's avatar
Jan Möbius committed
48
# genereate uic and moc targets
Jan Möbius's avatar
 
Jan Möbius committed
49 50
acg_qt4_autouic (uic_targets ${ui})
acg_qt4_automoc (moc_targets ${headers})
Jan Möbius's avatar
 
Jan Möbius committed
51

Jan Möbius's avatar
 
Jan Möbius committed
52
if (WIN32)
Jan Möbius's avatar
Jan Möbius committed
53
  # add app icon rc file to windows build
Jan Möbius's avatar
 
Jan Möbius committed
54
  acg_add_executable (OpenFlipper WIN32 ${CMAKE_CURRENT_SOURCE_DIR}/CoreApp.rc ${uic_targets} ${sources} ${headers} ${moc_targets})
Jan Möbius's avatar
Jan Möbius committed
55
  # link to qtmain library to get WinMain function for a non terminal app
56
  target_link_libraries (OpenFlipper ${QT_QTMAIN_LIBRARY})
Jan Möbius's avatar
Jan Möbius committed
57
elseif (APPLE)
Jan Möbius's avatar
Jan Möbius committed
58
  # generate bundle on mac
Jan Möbius's avatar
 
Jan Möbius committed
59
  acg_add_executable (OpenFlipper MACOSX_BUNDLE ${uic_targets} ${sources} ${headers} ${moc_targets})
Jan Möbius's avatar
 
Jan Möbius committed
60
else ()
Jan Möbius's avatar
 
Jan Möbius committed
61
  acg_add_executable (OpenFlipper ${uic_targets} ${sources} ${headers} ${moc_targets})
Jan Möbius's avatar
 
Jan Möbius committed
62
endif ()
Jan Möbius's avatar
 
Jan Möbius committed
63 64 65 66 67 68 69 70 71 72 73 74 75

target_link_libraries (OpenFlipper
  OpenMeshCore
  OpenMeshTools
  ACG
  PluginLib
  ${QT_LIBRARIES}
  ${OPENGL_LIBRARIES}
  ${GLEW_LIBRARY}
  ${GLUT_LIBRARIES}
  ${FTGL_LIBS}
)

Jan Möbius's avatar
Jan Möbius committed
76
if (APPLE)
Jan Möbius's avatar
Jan Möbius committed
77 78 79
   # create bundle in "Build" directory and set icon
   # no install needed here, because the whole bundle will be installed in the
   # toplevel CMakeLists.txt
Jan Möbius's avatar
Jan Möbius committed
80 81 82 83
   set_target_properties (
      OpenFlipper PROPERTIES
      RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/Build"
      MACOSX_BUNDLE_INFO_STRING "ACG OpenFlipper"
Jan Möbius's avatar
Jan Möbius committed
84
      MACOSX_BUNDLE_ICON_FILE "OpenFlipper.icns"
Jan Möbius's avatar
Jan Möbius committed
85
   )
Jan Möbius's avatar
Jan Möbius committed
86 87 88
   add_custom_command(TARGET OpenFlipper POST_BUILD                                                              
     COMMAND ${CMAKE_COMMAND} -E copy_if_different "${CMAKE_CURRENT_SOURCE_DIR}/../Icons/OpenFlipper_Icon.icns" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/OpenFlipper.icns"                         
   )    
Jan Möbius's avatar
Jan Möbius committed
89
endif ()
Jan Möbius's avatar
 
Jan Möbius committed
90 91


Jan Möbius's avatar
Jan Möbius committed
92 93
# 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
Jan Möbius's avatar
 
Jan Möbius committed
94 95
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")
Jan Möbius's avatar
Jan Möbius committed
96
acg_copy_after_build (OpenFlipper "${CMAKE_CURRENT_SOURCE_DIR}/../Scripts" "${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Textures")
Jan Möbius's avatar
 
Jan Möbius committed
97 98 99 100
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")
Jan Möbius's avatar
Jan Möbius committed
101 102 103


if (NOT APPLE)
Jan Möbius's avatar
Jan Möbius committed
104 105 106 107
  # 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
Jan Möbius's avatar
 
Jan Möbius committed
108 109
  acg_install_dir ("${CMAKE_CURRENT_SOURCE_DIR}/../Shaders" "${ACG_PROJECT_DATADIR}/Shaders")
  acg_install_dir ("${CMAKE_CURRENT_SOURCE_DIR}/../Textures" "${ACG_PROJECT_DATADIR}/Textures")
Jan Möbius's avatar
Jan Möbius committed
110
  acg_install_dir ("${CMAKE_CURRENT_SOURCE_DIR}/../Scripts" "${ACG_PROJECT_DATADIR}/Scripts")
Jan Möbius's avatar
 
Jan Möbius committed
111 112 113 114
  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")
Jan Möbius's avatar
Jan Möbius committed
115
endif ()