CMakeLists.txt 3.15 KB
Newer Older
Jan Möbius's avatar
Revert    
Jan Möbius committed
1
cmake_minimum_required (VERSION 2.6)
2

3
4
5
6
# Only set project name if OpenMesh is built as stand-alone library
if("${PROJECT_NAME}" STREQUAL "")
    project (OpenMesh)
endif()
7
8

# add our macro directory to cmake search path
9
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
10
set (CMAKE_DEBUG_POSTFIX "d")
11
12
13
14
15
16

# include our cmake files
include (ACGCommon)

acg_get_version ()

17
18
19
20
21
22

# Disable package building when built as an external library
if(${PROJECT_NAME} MATCHES "OpenMesh")
    include(OpenMeshPackage)
endif()

23
24
25
26
27
28
29
30
include (ACGOutput)

if (WIN32)
  add_definitions(
      -D_USE_MATH_DEFINES -DNOMINMAX
  )
endif ()

Jan Möbius's avatar
Jan Möbius committed
31
32
33
# ========================================================================
# Add bundle targets here
# ========================================================================
34
35
36
37
if ( NOT DEFINED BUILD_APPS )
  set( BUILD_APPS true CACHE BOOL "Enable or disable building of apps" )
endif()

Jan Möbius's avatar
Jan Möbius committed
38
if (WIN32)
Jan Möbius's avatar
Jan Möbius committed
39
  if ( NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" AND BUILD_APPS )
40
41
42
    add_custom_target (fixbundle ALL
      COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/fixbundle.win.cmake" )
  endif()
Jan Möbius's avatar
Jan Möbius committed
43
44
45
46
47
48
49
50
51
52
53
54
endif()

if (APPLE)
  add_custom_target (fixbundle ALL
    COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/fixbundle.cmake"
  )
endif()

# ========================================================================
# Call the subdirectories with there projects
# ========================================================================

55
56
57
add_subdirectory (src/OpenMesh/Core)
add_subdirectory (src/OpenMesh/Tools)
add_subdirectory (src/OpenMesh/Apps)
58
add_subdirectory (src/Unittests)
59
60
61
add_subdirectory (Doc)

# ========================================================================
Jan Möbius's avatar
Jan Möbius committed
62
# Bundle generation (Targets exist, now configure them)
63
64
# ========================================================================

Jan Möbius's avatar
Jan Möbius committed
65
if (WIN32 AND  BUILD_APPS )
66
67
68
69
  # prepare bundle generation cmake file and add a build target for it
  configure_file ("${CMAKE_SOURCE_DIR}/cmake/fixbundle.cmake.win.in"
     "${CMAKE_BINARY_DIR}/fixbundle.win.cmake" @ONLY IMMEDIATE)

Jan Möbius's avatar
Jan Möbius committed
70
71
72
73
  if ( NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" )
    # let bundle generation depend on all targets
    add_dependencies (fixbundle QtViewer DecimaterGui)
  endif()
74
 
Jan Möbius's avatar
Jan Möbius committed
75
endif()
76
77
78
79
80
81


if (APPLE)
  # prepare bundle generation cmake file and add a build target for it
  configure_file ("${CMAKE_SOURCE_DIR}/cmake/fixbundle.cmake.in"
     "${CMAKE_BINARY_DIR}/fixbundle.cmake" @ONLY IMMEDIATE)
Jan Möbius's avatar
Jan Möbius committed
82

83
  # let bundle generation depend on all targets
84
  add_dependencies (fixbundle DecimaterGui ProgViewer QtViewer SubdividerGui) 
85

86
87
88
89
90
91
92
93

  # Required for Snow leopard, and the latest qt. Then the resources have to be copied
  if ( EXISTS "/opt/local/libexec/qt4-mac/lib/QtGui.framework/Versions/4/Resources/qt_menu.nib" )
      add_custom_command(TARGET OpenMesh POST_BUILD
         COMMAND ${CMAKE_COMMAND} -E copy_directory "/opt/local/libexec/qt4-mac/lib/QtGui.framework/Versions/4/Resources/qt_menu.nib" "${CMAKE_BINARY_DIR}/Build/Libraries/qt_menu.nib" 
        )
  endif ()
  
94
95
96
97
98
99
100
endif ()

# ========================================================================


# display results
acg_print_configure_header (OPENMESH "OpenMesh")