CMakeLists.txt 5.47 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11
include (ACGCommon)

include_directories (
  ../..
  ${CMAKE_CURRENT_SOURCE_DIR}
)

# source code directories
set (directories 
  . 
  Decimater
12
  Dualizer
13 14 15 16 17
  Smoother
  Subdivider/Adaptive/Composite
  Subdivider/Uniform/Composite 
  Subdivider/Uniform
  Utils
18
  VDPM
19 20 21 22 23 24
)

# 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
25 26 27
#Drop the template only cc files
acg_drop_templates(sources)

28
IF(WIN32 AND NOT MINGW)
29
  acg_append_files (sources "*.c" ${directories})
30
ENDIF(WIN32 AND NOT MINGW)
31

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
    acg_add_library (OpenMeshTools SHARED ${sources} ${headers})
  else()
    # OpenMesh has no dll exports so we have to build a static library on windows
Jan Möbius's avatar
Typo  
Jan Möbius committed
45
    acg_add_library (OpenMeshTools STATIC ${sources} ${headers})
46 47
  endif()

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

target_link_libraries (OpenMeshTools OpenMeshCore)

56 57 58 59
IF( NOT WIN32 )
  target_link_libraries (OpenMeshToolsStatic OpenMeshCoreStatic)
ENDIF(NOT WIN32)

60
if ( (${PROJECT_NAME} MATCHES "OpenMesh") AND BUILD_APPS )
61

62
  if ( WIN32 )
Jan Möbius's avatar
Jan Möbius committed
63 64 65 66
    if ( NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" )
      # let bundle generation depend on target
      add_dependencies (fixbundle OpenMeshTools)
    endif()
67 68
  endif()

69
  # Add tools as dependency before fixbundle 
70
  if (APPLE)
71 72 73 74
    # let bundle generation depend on target
    add_dependencies (fixbundle OpenMeshTools)
    add_dependencies (fixbundle OpenMeshToolsStatic)
  endif()
Jan Möbius's avatar
Jan Möbius committed
75

Jan Möbius's avatar
Jan Möbius committed
76 77 78
endif()


79 80
# Install Header Files (Apple)
if ( NOT ACG_PROJECT_MACOS_BUNDLE AND APPLE )
81
 FILE(GLOB files_install_Decimater                       "${CMAKE_CURRENT_SOURCE_DIR}/Decimater/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/Decimater/*T.cc" )
82
 FILE(GLOB files_install_Dualizer                        "${CMAKE_CURRENT_SOURCE_DIR}/Dualizer/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/Dualizer/*T.cc" )
83
 FILE(GLOB files_install_KERNEL_OSG                      "${CMAKE_CURRENT_SOURCE_DIR}/Kernel_OSG/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/Kernel_OSG/*T.cc" )
84
 FILE(GLOB files_install_Smoother                        "${CMAKE_CURRENT_SOURCE_DIR}/Smoother/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/Smoother/*T.cc" )
85 86 87 88 89 90
 FILE(GLOB files_install_Subdivider_Adaptive             "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Adaptive/Composite/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Adaptive/Composite/*T.cc" )
 FILE(GLOB files_install_Subdivider_Uniform              "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Uniform/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Uniform/*T.cc" )
 FILE(GLOB files_install_Subdivider_Uniform_Composite    "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Uniform/Composite/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/Subdivider/Uniform/Composite/*T.cc" )
 FILE(GLOB files_install_Utils                           "${CMAKE_CURRENT_SOURCE_DIR}/Utils/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/Utils/*T.cc"  "${CMAKE_CURRENT_SOURCE_DIR}/Utils/getopt.h" )
 FILE(GLOB files_install_VDPM                            "${CMAKE_CURRENT_SOURCE_DIR}/VDPM/*.hh"  "${CMAKE_CURRENT_SOURCE_DIR}/VDPM/*T.cc" )
 INSTALL(FILES ${files_install_Decimater}                       DESTINATION include/OpenMesh/Tools/Decimater )
91
 INSTALL(FILES ${files_install_Dualizer}                        DESTINATION include/OpenMesh/Tools/Dualizer )
92 93 94 95 96 97 98
 INSTALL(FILES ${files_install_KERNEL_OSG}                      DESTINATION include/OpenMesh/Tools/Kernel_OSG )
 INSTALL(FILES ${files_install_Smoother}                        DESTINATION include/OpenMesh/Tools/Smoother )
 INSTALL(FILES ${files_install_Subdivider_Adaptive}             DESTINATION include/OpenMesh/Tools/Subdivider/Adaptive/Composite )
 INSTALL(FILES ${files_install_Subdivider_Uniform}              DESTINATION include/OpenMesh/Tools/Subdivider/Uniform )
 INSTALL(FILES ${files_install_Subdivider_Uniform_Composite}    DESTINATION include/OpenMesh/Tools/Subdivider/Uniform/Composite )
 INSTALL(FILES ${files_install_Utils}                           DESTINATION include/OpenMesh/Tools/Utils )
 INSTALL(FILES ${files_install_VDPM}                            DESTINATION include/OpenMesh/Tools/VDPM )
99 100
endif()

101

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

105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125
# Install Header Files
install(DIRECTORY .
        DESTINATION include/OpenMesh/Tools
        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/Tools
        FILES_MATCHING
        PATTERN "*T.cc"
        PATTERN "CVS" EXCLUDE
        PATTERN ".svn" EXCLUDE
        PATTERN "tmp" EXCLUDE
        PATTERN "Templates" EXCLUDE
        PATTERN "Debian*" EXCLUDE)
126 127 128 129

#install the config file
install(FILES Utils/getopt.h DESTINATION include/OpenMesh/Tools/Utils)

130 131
endif ()

132