CMakeLists.txt 3.52 KB
Newer Older
Jan Möbius's avatar
Jan Möbius committed
1 2
include (ACGCommon)

Jan Möbius's avatar
Jan Möbius committed
3 4 5 6 7
if ( NOT DEFINED BUILD_APPS )
  set( BUILD_APPS true CACHE BOOL "Enable or disable building of apps" )
endif()
 
if ( BUILD_APPS )
Jan Möbius's avatar
Jan Möbius committed
8

9 10 11
  # Only build and fixbundle apps, when we are building OpenMesh standalone
  if(${PROJECT_NAME} MATCHES "OpenMesh")

Jan Möbius's avatar
Jan Möbius committed
12
    if ( WIN32 AND OPENMESH_BUILD_SHARED )
13
	  add_definitions(-DOPENMESHDLL )
Jan Möbius's avatar
Jan Möbius committed
14 15
    endif()

16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31
    add_subdirectory (Dualizer)
    add_subdirectory (Decimating/commandlineDecimater)
    add_subdirectory (Smoothing)
    add_subdirectory (Subdivider/commandlineSubdivider)
    add_subdirectory (Subdivider/commandlineAdaptiveSubdivider)
    add_subdirectory (mconvert)
    add_subdirectory (VDProgMesh/mkbalancedpm)
    add_subdirectory (VDProgMesh/Analyzer)

    # Add non ui apps as dependency before fixbundle 
    if ( WIN32 )
      if ( NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" )
	# let bundle generation depend on all targets
	add_dependencies (fixbundle commandlineDecimater Dualizer mconvert Smoothing commandlineAdaptiveSubdivider commandlineSubdivider mkbalancedpm Analyzer )
      endif()
    endif()
32

33 34
    # Add non ui apps as dependency before fixbundle
    if ( APPLE)
35 36 37
      # let bundle generation depend on all targets
      add_dependencies (fixbundle commandlineDecimater Dualizer mconvert Smoothing commandlineAdaptiveSubdivider commandlineSubdivider mkbalancedpm Analyzer )
    endif()
Jan Möbius's avatar
Jan Möbius committed
38

Jan Möbius's avatar
Jan Möbius committed
39

40 41 42
    # find needed packages for gui applications
    find_package (OpenGL)
    find_package (GLUT)
Jan Möbius's avatar
Jan Möbius committed
43

Matthias Möller's avatar
Matthias Möller committed
44 45 46
    # try to use QT5 if possible otherwise stick to QT4
    set (FORCE_QT4 OFF CACHE BOOL "Use Qt4 even if Qt5 was found")

47
    # For the apps, we need qt and opengl to build them
Matthias Möller's avatar
Matthias Möller committed
48 49 50 51
    if (NOT QT5_FOUND AND NOT FORCE_QT4)
      acg_qt5 ()
    endif()
    if (NOT QT5_FOUND AND NOT QT4_FOUND)
52
      find_package (Qt4 COMPONENTS QtCore QtGui )
53

54
      set (QT_USE_QTOPENGL 1)
55

56 57 58 59 60 61 62 63
      include (${QT_USE_FILE})
    endif ()

    if ("${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles")
      message(WARNING "GUI Apps are not build with mingw. (TODO)")
    endif()

    # check for OpenGL and GLUT as our required dependencies
Matthias Möller's avatar
Matthias Möller committed
64 65
    if ((QT5_FOUND OR QT4_FOUND) AND OPENGL_FOUND AND GLUT_FOUND AND NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles" )

66 67 68 69 70 71 72 73 74 75 76 77
      add_subdirectory (Decimating/DecimaterGui)
      add_subdirectory (QtViewer)
      add_subdirectory (Subdivider/SubdividerGui)
      add_subdirectory (ProgViewer)
      add_subdirectory (VDProgMesh/Synthesizer)
			    

      # Add ui apps as dependency before fixbundle 
      if ( WIN32 AND NOT "${CMAKE_GENERATOR}" MATCHES "MinGW Makefiles")
	# let bundle generation depend on all targets
	add_dependencies (fixbundle DecimaterGui ProgViewer QtViewer SubdividerGui Synthesizer)
      endif()
78
    
79 80 81 82 83
      # Add ui apps as dependency before fixbundle 
      if ( APPLE)
	# let bundle generation depend on all targets
	add_dependencies (fixbundle DecimaterGui ProgViewer QtViewer SubdividerGui Synthesizer)
      endif()
84

85
      if ( WIN32 )
86 87
	    FILE(GLOB files_install_app_dlls "${CMAKE_BINARY_DIR}/Build/*.dll" )
	    INSTALL(FILES ${files_install_app_dlls} DESTINATION . )
88
      endif()
Jan Möbius's avatar
Jan Möbius committed
89

90 91 92
    else () # QT ,Opengl or glut not found
      
      if (NOT QT4_FOUND)
93
	    message ("QT 4 not found! Skipping some apps.")
94 95 96
      endif ()

      if (NOT OPENGL_FOUND)
97
	    message ("OpengGL not found! Skipping some apps.")
98
      endif ()
Jan Möbius's avatar
Jan Möbius committed
99

100
      if (NOT GLUT_FOUND)
101
	    message ("GLUT not found! Skipping some apps.")
102 103
      endif ()
      
104
    endif ()
Jan Möbius's avatar
Jan Möbius committed
105

106
  endif() # Project is OpenMesh standalone
107

Jan Möbius's avatar
Jan Möbius committed
108 109 110 111 112
else (BUILD_APPS)

  message ("Building Apps disabled by user.")

endif (BUILD_APPS)