CMakeLists.txt 6.9 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
# use internally
SET( OW_EXTERNAL_MODULE false )

49 50 51 52 53 54 55
# 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 )
56

57
# ---------------------------------------------------------------------------------------------------------------------------------------------------
58
#
59
# Resource/Doc Copy
60
#  - Resource copy is done by the OW parts. This just copies additional helpers
61 62 63
#
# ---------------------------------------------------------------------------------------------------------------------------------------------------

64 65 66 67 68 69 70 71 72
# 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()
73

74
# ---------------------------------------------------------------------------------------------------------------------------------------------------
75
#
76 77 78 79
# Convenience targets
#
# ---------------------------------------------------------------------------------------------------------------------------------------------------

80 81 82 83
# some convenience install targets:
ADD_CUSTOM_TARGET( list_install_tarets
                   COMMAND echo The following components can be installed:
                   COMMAND echo " * install - install everything."
84
                   COMMAND echo " * install_runtime - install the GUIs."
85 86 87
                   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."
88
                   COMMAND echo " * install_devdoc - install the development documentation for libopenwalnut."
89 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
                   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
                 )
116 117 118 119 120 121
ADD_CUSTOM_TARGET( install_devdoc
                    ${CMAKE_COMMAND}
                        -DCOMPONENT=CORE_DOC
                        -P ${CMAKE_BINARY_DIR}/cmake_install.cmake
                    DEPENDS core_devdoc
                 )
122
ADD_DEPENDENCIES( install_devdoc core_devdoc )
123

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

# -----------------------------------------------------------------------------------------------------------------------------------------------
134
# core library
135 136 137 138 139

# build core
ADD_SUBDIRECTORY( core )

# -----------------------------------------------------------------------------------------------------------------------------------------------
140
# QT4 GUI
141

142 143 144 145 146
OPTION( OW_GUI_QT4 "Enable this to build the QT4-based OpenWalnut GUI." ON )
IF( OW_GUI_QT4 )
    # build
    ADD_SUBDIRECTORY( qt4gui )
ENDIF()
147

148 149 150 151
# -----------------------------------------------------------------------------------------------------------------------------------------------
# Scripting GUI

OPTION( OW_GUI_SCRIPT "Enable this to build the script-based OpenWalnut interface for commandline-only use." ON )
152 153
IF( OW_GUI_SCRIPT )
    # build
154
    ADD_SUBDIRECTORY( scriptUI )
155 156
ENDIF()

157 158 159 160
# -----------------------------------------------------------------------------------------------------------------------------------------------
# Modules

# build modules
161 162 163 164
OPTION( OW_MODULE_BUILD "Enable this to build the modules." ON )
IF( OW_MODULE_BUILD )
  ADD_SUBDIRECTORY( modules )
ENDIF()
165