type.cmake 2.36 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
include(ACGCommon)

include_directories (
  ..
  ${ACG_INCLUDE_DIR}
  ${OPENMESH_INCLUDE_DIRS}
  ${CMAKE_SOURCE_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}
  ${OPENGL_INCLUDE_DIR}
  ${GLEW_INCLUDE_DIR}
  ${GLUT_INCLUDE_DIR}
David Bommes's avatar
David Bommes committed
12
  ${ADDITIONAL_PLUGINLIB_INCS}
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
)

link_directories (
  ${GLEW_LIBRARY_DIR}
  ${ADDITIONAL_PLUGINLIB_LINK_DIRS}
)

#=======================================================
# General defines
#=======================================================

# generate dllexport macros on windows
if (WIN32)
  add_definitions (
    -DPLUGINLIBDLL
    -DUSEPLUGINLIBDLL
    -DBUILDOBJECTTYPEDLL
    -DACGDLL
    -DUSEACG
32
    -DFREEGLUT_LIB_PRAGMAS=0
33 34 35 36 37 38 39 40 41 42
  )
endif ()

#=======================================================
# Cleanup
#=======================================================

# collect all header,source files
acg_append_files_recursive (headers "*.hh" . )
acg_append_files_recursive (sources "*.cc" . )
Jan Möbius's avatar
Jan Möbius committed
43
acg_append_files_recursive (ui "*.ui" . )
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63


# Match our current directory name
string (REGEX MATCH "[^/\\]*$" TYPENAME ${CMAKE_CURRENT_SOURCE_DIR})
string(TOUPPER ${TYPENAME} TYPENAME )

include_directories (
  ..
  ${ACG_INCLUDE_DIR}
  ${OPENMESH_INCLUDE_DIRS}
  ${CMAKE_SOURCE_DIR}
  ${CMAKE_CURRENT_SOURCE_DIR}/../..
  ${CMAKE_CURRENT_BINARY_DIR}
  ${OPENGL_INCLUDE_DIR}
  ${GLEW_INCLUDE_DIR}
  ${GLUT_INCLUDE_DIR}
)

# remove template cc files from source file list
acg_drop_templates (sources)
64
acg_add_library ( ${TYPENAME} SHARED ${ui} ${sources} ${headers})
65 66
set_target_properties ( ${TYPENAME} PROPERTIES MACOSX_RPATH 0 )

67

Jan Möbius's avatar
Jan Möbius committed
68 69 70 71 72 73 74 75 76 77
if ( NOT WIN32 )
  # Allow targets depending on ACG find the autogenerated header files
  target_include_directories( ${TYPENAME} PUBLIC
                               ${CMAKE_CURRENT_BINARY_DIR}/${TYPENAME}_autogen/include )
else()
  # Allow targets depending on the current type find the autogenerated header files from uic
  target_include_directories( ${TYPENAME} PUBLIC
                              $<$<CONFIG:Debug>:${CMAKE_CURRENT_BINARY_DIR}/${TYPENAME}_autogen/include_Debug/>
                              $<$<CONFIG:Release>:${CMAKE_CURRENT_BINARY_DIR}/${TYPENAME}_autogen/include_Release/> )
endif()
78 79


80 81 82 83 84 85 86 87 88 89 90 91 92
add_dependencies( ${TYPENAME} OpenMeshCore OpenMeshTools ACG OpenFlipperPluginLib)


target_link_libraries (${TYPENAME}
  ${OPENMESH_LIBRARIES}
  ACG
  ${QT_LIBRARIES}
  ${OPENGL_LIBRARIES}
  ${GLEW_LIBRARY}
  ${GLUT_LIBRARIES}
  OpenFlipperPluginLib
)