CMakeLists.txt 5.5 KB
Newer Older
1 2 3 4 5
include (ACGCommon)

include_directories (
  ../..
  ${CMAKE_CURRENT_SOURCE_DIR}
6
  ${CMAKE_CURRENT_SOURCE_DIR}/src
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
)

# source code directories
set (directories 
  . 
  Geometry 
  IO 
  IO/exporter 
  IO/importer 
  IO/reader 
  IO/writer
  Mesh 
  Mesh/gen 
  System 
  Utils
)

# collect all header and source files
acg_append_files (headers "*.hh" ${directories})
acg_append_files (sources "*.cc" ${directories})

Jan Möbius's avatar
Jan Möbius committed
28 29 30 31
#Drop the template only cc files
acg_drop_templates(sources)


32 33 34 35 36 37
# Disable Library installation when not building OpenMesh on its own but as part of another project!
if ( NOT ${PROJECT_NAME} MATCHES "OpenMesh")
  set(ACG_NO_LIBRARY_INSTALL true)
endif()


38
if (WIN32)
39 40

  if ( OPENMESH_BUILD_SHARED )
Jan Möbius's avatar
Jan Möbius committed
41
    add_definitions( -DOPENMESHDLL -DBUILDOPENMESHDLL)
42 43 44 45 46 47
    acg_add_library (OpenMeshCore SHARED ${sources} ${headers})
  else()
    # OpenMesh has no dll exports so we have to build a static library on windows
    acg_add_library (OpenMeshCore STATIC ${sources} ${headers})
  endif()

48 49 50 51 52 53 54
else ()
  acg_add_library (OpenMeshCore SHAREDANDSTATIC ${sources} ${headers})
  set_target_properties (OpenMeshCore PROPERTIES VERSION ${OPENMESH_VERSION_MAJOR}.${OPENMESH_VERSION_MINOR}
                                               SOVERSION ${OPENMESH_VERSION_MAJOR}.${OPENMESH_VERSION_MINOR} )

endif ()

55
# Add core as dependency before fixbundle 
56
if ( ${PROJECT_NAME} MATCHES "OpenMesh")
57

Jan Möbius's avatar
Jan Möbius committed
58 59 60 61
  if ( WIN32 AND BUILD_APPS)
    if ( NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" )
      add_dependencies (fixbundle OpenMeshCore)
    endif()
62
  endif()
Jan Möbius's avatar
Jan Möbius committed
63 64

  # Add core as dependency before fixbundle 
65
  if ( APPLE)
66 67 68 69
    # let bundle generation depend on targets
    add_dependencies (fixbundle OpenMeshCore)
  endif ()

Jan Möbius's avatar
Jan Möbius committed
70 71
endif()

72 73 74
# if we build debug and release in the same dir, we want to install both!
if ( ${PROJECT_NAME} MATCHES "OpenMesh")
  if ( WIN32 )
75 76
    FILE(GLOB files_install_libs "${CMAKE_BINARY_DIR}/Build/lib/*.lib" )
    INSTALL(FILES ${files_install_libs} DESTINATION lib )
77 78 79
  endif()
endif()

80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122

# Install Header Files (Apple)
if ( NOT ACG_PROJECT_MACOS_BUNDLE AND APPLE )
 FILE(GLOB files_install_Geometry    "${CMAKE_CURRENT_SOURCE_DIR}/Geometry/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/Geometry/*T.cc" )
 FILE(GLOB files_install_IO          "${CMAKE_CURRENT_SOURCE_DIR}/IO/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/IO/*T.cc" "${CMAKE_CURRENT_SOURCE_DIR}/IO/*.inl"  )
 FILE(GLOB files_install_IO_importer "${CMAKE_CURRENT_SOURCE_DIR}/IO/importer/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/IO/importer/*T.cc" )
 FILE(GLOB files_install_IO_exporter "${CMAKE_CURRENT_SOURCE_DIR}/IO/exporter/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/IO/exporter/*T.cc" )
 FILE(GLOB files_install_IO_reader   "${CMAKE_CURRENT_SOURCE_DIR}/IO/reader/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/IO/reader/*T.cc" )
 FILE(GLOB files_install_IO_writer   "${CMAKE_CURRENT_SOURCE_DIR}/IO/writer/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/IO/writer/*T.cc" )
 FILE(GLOB files_install_Mesh        "${CMAKE_CURRENT_SOURCE_DIR}/Mesh/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/Mesh/*T.cc" )
 FILE(GLOB files_install_Mesh_Gen    "${CMAKE_CURRENT_SOURCE_DIR}/Mesh/gen/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/Mesh/gen/*T.cc" )
 FILE(GLOB files_install_System      "${CMAKE_CURRENT_SOURCE_DIR}/System/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/System/*T.cc" "${CMAKE_CURRENT_SOURCE_DIR}/System/config.h" )
 FILE(GLOB files_install_Utils       "${CMAKE_CURRENT_SOURCE_DIR}/Utils/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/Utils/*T.cc" )
 INSTALL(FILES ${files_install_Geometry}    DESTINATION include/OpenMesh/Core/Geometry )
 INSTALL(FILES ${files_install_IO}          DESTINATION include/OpenMesh/Core/IO )
 INSTALL(FILES ${files_install_IO_importer} DESTINATION include/OpenMesh/Core/IO/importer )
 INSTALL(FILES ${files_install_IO_exporter} DESTINATION include/OpenMesh/Core/IO/exporter )
 INSTALL(FILES ${files_install_IO_reader}   DESTINATION include/OpenMesh/Core/IO/reader )
 INSTALL(FILES ${files_install_IO_writer}   DESTINATION include/OpenMesh/Core/IO/writer )
 INSTALL(FILES ${files_install_Mesh}        DESTINATION include/OpenMesh/Core/Mesh )
 INSTALL(FILES ${files_install_Mesh_Gen}    DESTINATION include/OpenMesh/Core/Mesh/gen )
 INSTALL(FILES ${files_install_System}      DESTINATION include/OpenMesh/Core/System )
 INSTALL(FILES ${files_install_Utils}       DESTINATION include/OpenMesh/Core/Utils )
endif()


# Only install if the project name matches OpenMesh.
if (NOT APPLE AND ${PROJECT_NAME} MATCHES "OpenMesh")

# Install Header Files)
install(DIRECTORY . 
	DESTINATION include/OpenMesh/Core
        FILES_MATCHING 
	PATTERN "*.hh"
        PATTERN "CVS" EXCLUDE
        PATTERN ".svn" EXCLUDE
        PATTERN "tmp" EXCLUDE
	PATTERN "Templates" EXCLUDE
        PATTERN "Debian*" EXCLUDE)

#install Template cc files (required by headers)
install(DIRECTORY . 
	DESTINATION include/OpenMesh/Core
123
    FILES_MATCHING 
124
	PATTERN "*T.cc"
125 126
    PATTERN "CVS" EXCLUDE
    PATTERN ".svn" EXCLUDE
127 128
	PATTERN "tmp" EXCLUDE
	PATTERN "Templates" EXCLUDE
129
    PATTERN "Debian*" EXCLUDE)
130 131 132 133 134 135 136 137 138 139

#install the config file
install(FILES System/config.h DESTINATION include/OpenMesh/Core/System)

#install inlined Files from IO
install(DIRECTORY IO/ 
	DESTINATION include/OpenMesh/Core/IO
	FILES_MATCHING
	PATTERN "*.inl"         
	PATTERN "CVS" EXCLUDE
140 141 142 143 144 145 146 147
    PATTERN ".svn" EXCLUDE
    PATTERN "reader" EXCLUDE
    PATTERN "writer" EXCLUDE
    PATTERN "importer" EXCLUDE
    PATTERN "exporter" EXCLUDE
    PATTERN "tmp" EXCLUDE
    PATTERN "Debian*" EXCLUDE )
    
148 149 150
endif ()