CMakeLists.txt 6.62 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
#---------------------------------------------------------------------------
#
# Project: OpenWalnut ( http://www.openwalnut.org )
#
# Copyright 2009 OpenWalnut Community, BSV@Uni-Leipzig and CNCF@MPI-CBS
# For more information see http:#www.openwalnut.org/copying
#
# This file is part of OpenWalnut.
#
# OpenWalnut is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OpenWalnut is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with OpenWalnut. If not, see <http:#www.gnu.org/licenses/>.
#
#---------------------------------------------------------------------------

25
# ---------------------------------------------------------------------------------------------------------------------------------------------------
26
#
27 28 29 30 31
# General CMake Setup
#
# ---------------------------------------------------------------------------------------------------------------------------------------------------

CMAKE_MINIMUM_REQUIRED(VERSION 2.8)
32 33
PROJECT( OpenWalnut )

34
# ---------------------------------------------------------------------------------------------------------------------------------------------------
35
#
36
# Include the OpenWalnut build system.
37 38
#
# ---------------------------------------------------------------------------------------------------------------------------------------------------
39

40 41
# where to find our utils and cmake modules?
SET( OW_TOOLS_DIR ${PROJECT_SOURCE_DIR}/../tools )
42

43 44
# append search path for FindModules:
LIST( APPEND CMAKE_MODULE_PATH ${OW_TOOLS_DIR}/cmake )
45

46 47 48 49 50 51 52
# These scripts contains all the needed tools to setup the build:
# * Compiler Setup
# * Common OpenWalnut Options
# * Third-party Dependencies Setup
# * Unit Testing Setup if found
# * Doxygen Setup if found
INCLUDE( OpenWalnut )
53

54
# ---------------------------------------------------------------------------------------------------------------------------------------------------
55
#
56
# Resource/Doc Copy
57
#  - Resource copy is done by the OW parts. This just copies additional helpers
58 59 60
#
# ---------------------------------------------------------------------------------------------------------------------------------------------------

61 62 63 64 65 66 67 68 69
# copy our debug utilities. This is only useful if compiled debug or RelWithDebInfo
IF( NOT cmake_build_type_tolower STREQUAL "release" )
    # NOTE: DO NOT add and install target here. Debugging tools are not useful and wished in an OpenWalnut installation.
    ADD_CUSTOM_TARGET( CopyDebugUtilities
        ALL
        COMMAND ${CMAKE_COMMAND} -E copy_directory "${PROJECT_SOURCE_DIR}/../tools/debugging" "${PROJECT_BINARY_DIR}/"
        COMMENT "Copying debug utilities"
    )
ENDIF()
70

71
# ---------------------------------------------------------------------------------------------------------------------------------------------------
72
#
73 74 75 76
# Convenience targets
#
# ---------------------------------------------------------------------------------------------------------------------------------------------------

77 78 79 80
# some convenience install targets:
ADD_CUSTOM_TARGET( list_install_tarets
                   COMMAND echo The following components can be installed:
                   COMMAND echo " * install - install everything."
81
                   COMMAND echo " * install_runtime - install the GUIs."
82 83 84
                   COMMAND echo " * install_lib - install only libopenwalnut."
                   COMMAND echo " * install_modules - install only the compiled modules."
                   COMMAND echo " * install_dev - install the development headers for libopenwalnut."
85
                   COMMAND echo " * install_devdoc - install the development documentation for libopenwalnut."
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112
                   COMMENT "List installation targets."
                 )

# install targets for different parts
ADD_CUSTOM_TARGET( install_runtime
                    ${CMAKE_COMMAND}
                        -DCOMPONENT=QT4GUI
                        -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
                 )
ADD_CUSTOM_TARGET( install_lib
                    ${CMAKE_COMMAND}
                        -DCOMPONENT=CORE
                        -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
                    ${CMAKE_COMMAND}
                        -DCOMPONENT=EXT
                        -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
                 )
ADD_CUSTOM_TARGET( install_modules
                    ${CMAKE_COMMAND}
                        -DCOMPONENT=MODULES
                        -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
                 )
ADD_CUSTOM_TARGET( install_dev
                    ${CMAKE_COMMAND}
                        -DCOMPONENT=CORE_DEV
                        -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
                 )
113 114 115 116 117 118
ADD_CUSTOM_TARGET( install_devdoc
                    ${CMAKE_COMMAND}
                        -DCOMPONENT=CORE_DOC
                        -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
                    DEPENDS core_devdoc
                 )
119
ADD_DEPENDENCIES( install_devdoc core_devdoc )
120

121
# ---------------------------------------------------------------------------------------------------------------------------------------------------
122
#
123
# Compilation Targets
124
#  - The GUI + OpenWalnut.cpp ==> openwalnut binary
125 126 127 128 129 130 131 132 133
#  - Ext ==> libOWext_*
#  - All the others ==> libOWcore
#
# ---------------------------------------------------------------------------------------------------------------------------------------------------

# to allow non-core code to access core and ext absolutely
INCLUDE_DIRECTORIES( ${PROJECT_SOURCE_DIR} )

# -----------------------------------------------------------------------------------------------------------------------------------------------
134
# core library
135

136
SET( OWCoreName "openwalnut" )
137 138 139 140 141

# build core
ADD_SUBDIRECTORY( core )

# -----------------------------------------------------------------------------------------------------------------------------------------------
142
# QT4 GUI
143

144 145 146 147
OPTION( OW_GUI_QT4 "Enable this to build the QT4-based OpenWalnut GUI." ON )
IF( OW_GUI_QT4 )
    SET( OWQt4GuiName "qt4gui" )
    SET( OWBinaryName "openwalnut-qt4" )
148

149 150 151
    # build
    ADD_SUBDIRECTORY( qt4gui )
ENDIF()
152

153 154 155 156 157 158
# -----------------------------------------------------------------------------------------------------------------------------------------------
# Modules

# build modules
ADD_SUBDIRECTORY( modules )