CMakeLists.txt 2.08 KB
Newer Older
Jan Möbius's avatar
 
Jan Möbius committed
1 2
include (common)

Jan Möbius's avatar
Jan Möbius committed
3
# find needed packages
Jan Möbius's avatar
 
Jan Möbius committed
4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22
find_package (OpenGL)
find_package (GLUT)
find_package (GLEW)
ftgl ()

include_directories (
  ..
  ${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
23
# source code directories
Jan Möbius's avatar
 
Jan Möbius committed
24 25 26 27 28 29 30 31 32
set (directories 
  ../BasePlugin 
  ../ACGHelper 
  ../common 
  ../common/bsp  
  ../INIFile 
  ../widgets/glWidget
)

Jan Möbius's avatar
Jan Möbius committed
33
# generate dllexport macros on windows
Jan Möbius's avatar
 
Jan Möbius committed
34 35 36 37 38 39
if (WIN32)
  add_definitions (
    -DPLUGINLIBDLL
  )
endif ()

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 44
append_files (headers "*.hh" ${directories})
append_files (sources "*.cc" ${directories})
append_files (ui "*.ui" ${directories})

Jan Möbius's avatar
Jan Möbius committed
45
# add additional object type sources
Jan Möbius's avatar
 
Jan Möbius committed
46 47 48
append_files_recursive (headers "*.hh" ${CMAKE_SOURCE_DIR}/ObjectTypes)
append_files_recursive (sources "*.cc" ${CMAKE_SOURCE_DIR}/ObjectTypes)

Jan Möbius's avatar
Jan Möbius committed
49
# remove template cc files from source file list
Jan Möbius's avatar
 
Jan Möbius committed
50 51
drop_templates (sources)

Jan Möbius's avatar
Jan Möbius committed
52
# genereate uic and moc targets
Jan Möbius's avatar
 
Jan Möbius committed
53 54 55 56 57
qt4_autouic (uic_targets ${ui})
qt4_automoc (moc_targets ${headers})

add_library (PluginLib SHARED ${uic_targets} ${sources} ${headers} ${moc_targets})

Jan Möbius's avatar
Jan Möbius committed
58
# set common target properties defined in common.cmake
Jan Möbius's avatar
 
Jan Möbius committed
59 60 61 62 63 64 65 66 67 68 69 70 71
set_target_props (PluginLib)

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

Jan Möbius's avatar
Jan Möbius committed
72
if (NOT APPLE)
Jan Möbius's avatar
Jan Möbius committed
73 74
  # no install on mac, because the whole bundle will be installed in the
  # toplevel CMakeLists.txt
Jan Möbius's avatar
Jan Möbius committed
75 76
  install (TARGETS PluginLib DESTINATION ${OPENFLIPPER_LIBDIR})
endif ()
Jan Möbius's avatar
 
Jan Möbius committed
77 78

if (WIN32)
Jan Möbius's avatar
Jan Möbius committed
79 80 81
  # 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
Jan Möbius's avatar
 
Jan Möbius committed
82 83 84 85
  add_custom_command (TARGET PluginLib POST_BUILD
                      COMMAND ${CMAKE_COMMAND} -E
                      copy_if_different 
                        ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/PluginLib.dll
Jan Möbius's avatar
 
Jan Möbius committed
86
                        ${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_LIBDIR}/PluginLib.dll)
Jan Möbius's avatar
 
Jan Möbius committed
87
endif ()