CMakeLists.txt 2.46 KB
Newer Older
1
2
include (ACGCommon)

3
4
5
6
7
8
9
set(OVM_ENABLE_DEPRECATED_APIS ON CACHE BOOL "Support deprecated OpenVolumeMesh APIs")

configure_file (
    "${CMAKE_CURRENT_SOURCE_DIR}/Config/DeprecationConfig.hh.in"
    "${CMAKE_CURRENT_BINARY_DIR}/Config/DeprecationConfig.hh"
)

10
11
12
13
14
15
16
17
18
19
include_directories (
  ..
  ${CMAKE_CURRENT_SOURCE_DIR}
)

# source code directories
set (directories 
  .
  OpenVolumeMesh/Attribs
  OpenVolumeMesh/Core
20
  OpenVolumeMesh/Config
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
  OpenVolumeMesh/FileManager
  OpenVolumeMesh/Geometry
  OpenVolumeMesh/Mesh
)

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

# Disable Library installation when not building OpenVolumeMesh on its own but as part of another project!
if ( NOT ${PROJECT_NAME} MATCHES "OpenVolumeMesh")
  set(ACG_NO_LIBRARY_INSTALL true)
endif()

if (WIN32)
    # OpenVolumeMesh has no dll exports so we have to build a static library on windows
    acg_add_library (OpenVolumeMesh STATIC ${sources} ${headers})
else ()
    acg_add_library (OpenVolumeMesh SHAREDANDSTATIC ${sources} ${headers})
    set_target_properties (OpenVolumeMesh PROPERTIES VERSION ${OPENVOLUMEMESH_VERSION_MAJOR}.${OPENVOLUMEMESH_VERSION_MINOR}
                                          SOVERSION ${OPENVOLUMEMESH_VERSION_MAJOR}.${OPENVOLUMEMESH_VERSION_MINOR} )
endif ()
43
44
45
46
47
foreach(TARGET_NAME OpenVolumeMesh OpenVolumeMeshStatic)
    if (TARGET ${TARGET_NAME})
        target_include_directories(${TARGET_NAME} PUBLIC "${CMAKE_CURRENT_BINARY_DIR}/Config/")
    endif()
endforeach(TARGET_NAME)
48
49
50
51
52
53

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

# Install Header Files)
install(DIRECTORY . 
54
        DESTINATION include
55
        FILES_MATCHING 
56
        PATTERN "*.hh"
57
        PATTERN "Unittests" EXCLUDE
58
        PATTERN "FileConverter" EXCLUDE
59
60
61
        PATTERN "CVS" EXCLUDE
        PATTERN ".svn" EXCLUDE
        PATTERN "tmp" EXCLUDE
62
        PATTERN "Templates" EXCLUDE
63
64
65
        PATTERN "Debian*" EXCLUDE)
endif ()

66
67
68
69
# install config files
install( FILES ${CMAKE_CURRENT_BINARY_DIR}/Config/DeprecationConfig.hh
           DESTINATION include/OpenVolumeMesh/Config )

70
71
# Only build unittests and file converter
# if not built as external library
72
73
74
if(${PROJECT_NAME} MATCHES "OpenVolumeMesh")
    # Add unittests target
    add_subdirectory(Unittests)
75
    add_subdirectory(FileConverter)
76
endif()