CMakeLists.txt 2.15 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 41 42 43 44
# define core version
add_definitions (
    -DCORE_VERSION="${VERSION}"
)

Jan Möbius's avatar
Jan Möbius committed
45
# collect all header,source and ui files
Jan Möbius's avatar
 
Jan Möbius committed
46 47 48 49
append_files (headers "*.hh" ${directories})
append_files (sources "*.cc" ${directories})
append_files (ui "*.ui" ${directories})

Jan Möbius's avatar
Jan Möbius committed
50
# add additional object type sources
Jan Möbius's avatar
 
Jan Möbius committed
51 52 53
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
54
# remove template cc files from source file list
Jan Möbius's avatar
 
Jan Möbius committed
55 56
drop_templates (sources)

Jan Möbius's avatar
Jan Möbius committed
57
# genereate uic and moc targets
Jan Möbius's avatar
 
Jan Möbius committed
58 59 60 61 62
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
63
# set common target properties defined in common.cmake
Jan Möbius's avatar
 
Jan Möbius committed
64 65 66 67 68 69 70 71 72 73 74 75 76
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
77
if (NOT APPLE)
Jan Möbius's avatar
Jan Möbius committed
78 79
  # 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
80 81
  install (TARGETS PluginLib DESTINATION ${OPENFLIPPER_LIBDIR})
endif ()
Jan Möbius's avatar
 
Jan Möbius committed
82 83

if (WIN32)
Jan Möbius's avatar
Jan Möbius committed
84 85 86
  # 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
87 88 89 90
  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
91
                        ${CMAKE_BINARY_DIR}/Build/${OPENFLIPPER_LIBDIR}/PluginLib.dll)
Jan Möbius's avatar
 
Jan Möbius committed
92
endif ()