CMakeLists.txt 3.87 KB
Newer Older
Jan Möbius's avatar
Jan Möbius committed
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
cmake_minimum_required (VERSION 2.6)

project (OpenFlipper)

# add our macro directory to cmake search path
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)

# include our cmake files
include (ACGCommon)

acg_get_version ()
acg_get_version (OpenMesh)

include (package)
include (ACGOutput)

acg_qt4 (REQUIRED 4.5)
acg_openmp ()
acg_ftgl ()

# check for OpenGL, GLEW and GLUT as our required dependencies
find_package (OpenGL)
if (NOT OPENGL_FOUND)
  message (FATAL_ERROR "OpengGL not found!")
endif ()

find_package (GLEW)
if (NOT GLEW_FOUND)
  message (FATAL_ERROR "GLEW not found!")
endif ()

find_package (GLUT)
if (NOT GLUT_FOUND)
  message (FATAL_ERROR "GLUT not found!")
endif ()

Jan Möbius's avatar
Jan Möbius committed
37
38
39
# ========================================================================
# Core Components
# ========================================================================
Jan Möbius's avatar
Jan Möbius committed
40
41
42
43
44
45
add_subdirectory (OpenMesh/src/OpenMesh/Core)
add_subdirectory (OpenMesh/src/OpenMesh/Tools)
add_subdirectory (ACG)
add_subdirectory (OpenFlipper/PluginLib)
add_subdirectory (OpenFlipper/CoreApp)

Jan Möbius's avatar
Jan Möbius committed
46
47
48
49
50
51
52
53
54
# ========================================================================
# Documentation generators  
# ========================================================================

# Create dirs to make doxygen happy
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Doc ) 
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/Build/${ACG_PROJECT_DATADIR}/Help ) 

# Add the deocumentation targets
Jan Möbius's avatar
Jan Möbius committed
55
56
add_subdirectory (OpenFlipper/Documentation/DeveloperTarget)
add_subdirectory (OpenFlipper/Documentation/UserTarget)
Jan Möbius's avatar
Jan Möbius committed
57

Jan Möbius's avatar
Jan Möbius committed
58
59
60
61
62

# ========================================================================
# Build all additional libraries  
# ========================================================================

Jan Möbius's avatar
Jan Möbius committed
63
64
65
66
67
68
69
70
71
72
73
74
75
# search all libs in the libs directory 
file (
  GLOB _local_libs_in
  RELATIVE "${CMAKE_SOURCE_DIR}"
        "${CMAKE_SOURCE_DIR}/libs/*/CMakeLists.txt"
)

# add all found libs to the build
foreach (_localLib ${_local_libs_in})
  get_filename_component (_local_lib_dir ${_localLib} PATH)
  add_subdirectory (${CMAKE_SOURCE_DIR}/${_local_lib_dir})
endforeach ()

Jan Möbius's avatar
Jan Möbius committed
76
77
78
79
80
81
82
# ========================================================================
# Plugins
# ========================================================================

# start with an empty plugin list
acg_set (OPENFLIPPER_PLUGINS "")

Jan Möbius's avatar
Jan Möbius committed
83
84
85
# add plugins
of_add_plugins ()

Jan Möbius's avatar
Jan Möbius committed
86
87
88
89
# ========================================================================
# Bundle generation
# ========================================================================

Jan Möbius's avatar
Jan Möbius committed
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
if (WIN32 )
  # prepare bundle generation cmake file and add a build target for it
  configure_file ("${CMAKE_SOURCE_DIR}/OpenFlipper/cmake/fixbundle.cmake.win.in"
     "${CMAKE_BINARY_DIR}/fixbundle.win.cmake" @ONLY IMMEDIATE)

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

  # let bundle generation depend on all targets
  add_dependencies (fixbundle OpenFlipper PluginLib ${OPENFLIPPER_PLUGINS})
 
endif(WIN32)


if (APPLE)
  # prepare bundle generation cmake file and add a build target for it
  configure_file ("${CMAKE_SOURCE_DIR}/OpenFlipper/cmake/fixbundle.cmake.in"
     "${CMAKE_BINARY_DIR}/fixbundle.cmake" @ONLY IMMEDIATE)
  add_custom_target (fixbundle ALL
    COMMAND ${CMAKE_COMMAND} -P "${CMAKE_BINARY_DIR}/fixbundle.cmake"
  )
  # let bundle generation depend on all targets
  add_dependencies (fixbundle OpenFlipper PluginLib ${OPENFLIPPER_PLUGINS})

  # install bundle
  install (DIRECTORY ${CMAKE_BINARY_DIR}/Build/OpenFlipper.app DESTINATION .
           USE_SOURCE_PERMISSIONS)
endif ()

Jan Möbius's avatar
Jan Möbius committed
119
120
121
122
123

# ========================================================================
# Output log information
# ========================================================================

Jan Möbius's avatar
Jan Möbius committed
124
125
126
127
# display results
acg_print_configure_header (OPENFLIPPER "OpenFlipper")
of_print_plugin_stats ()
acg_print_configure_footer ()