Commit bdd63e89951880bf826a39e432f872c72d8b23a7

Authored by Peter M. Groen
1 parent e4e2e74e

Setting up build-system

.gitignore 0 → 100644
  1 +/.gitmodules
  2 +/cmake/
  3 +/versioning/
... ...
CMakeLists.txt
  1 +cmake_minimum_required(VERSION 3.12)
  2 +project(mqtt-tools)
  3 +# ===========================================================================
  4 +# == Check to see if we're a submodule or top-repo.
  5 +if( IS_DIRECTORY ${CMAKE_SOURCE_DIR}/cmake)
  6 + message( STATUS "Looks like we're a single module." )
  7 + LIST( APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
  8 +else()
  9 + message( FATAL_ERROR "No cmake directory founnd. Did you run the submodules script?" )
  10 +endif()
  11 +
  12 +# ============================================================================
  13 +# == Check to see if there is versioning information available
  14 +if( IS_DIRECTORY ${CMAKE_SOURCE_DIR}/versioning/cmake)
  15 + LIST( APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/versioning/cmake)
  16 +else()
  17 + message( FATAL_ERROR "No ${CMAKE_SOURCE_DIR}/osdev_versioning directory found." )
  18 +endif()
  19 +
  20 +# ============================================================================
  21 +# == Include build information
  22 +include(osdevversion)
  23 +include(projectheader)
  24 +
  25 +project_header(mqtt-tools)
  26 +
  27 +add_subdirectory(src/controlcentre)
  28 +
  29 +include(packaging)
  30 +package_component()
... ...
src/controlcentre/CMakeLists.txt
  1 +cmake_minimum_required(VERSION 3.12)
  2 +# ============================================================================
  3 +# Check to see if we have cmake directory
  4 +if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/cmake)
  5 + message( STATUS "Looks like we're a single module" )
  6 + LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
  7 +else()
  8 + message( FATAL_ERROR "No cmake directory found. Did you run the submodules script?" )
  9 +endif()
  10 +
  11 +# ==============================================================================
  12 +# Check to see if there is versioning information available
  13 +if(IS_DIRECTORY ${CMAKE_SOURCE_DIR}/versioning)
  14 + LIST(APPEND CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/versioning/cmake)
  15 +else()
  16 + message( FATAL_ERROR "No ${CMAKE_SOURCE_DIR}/osdev_versioning directory found." )
  17 +endif()
  18 +
  19 +# ==============================================================================
  20 +include(projectheader)
  21 +project_header(mqttcc)
  22 +
  23 +find_package( Qt5Core REQUIRED )
  24 +find_package( Qt5Gui REQUIRED )
  25 +find_package( Qt5Widgets REQUIRED )
  26 +
  27 +include(compiler)
  28 +
  29 +include_directories(
  30 + ${Qt5Core_INCLUDE_DIRS}
  31 + ${Qt5Gui_INCLUDE_DIRS}
  32 + ${Qt5Widget_INCLUDE_DIRS}
  33 +)
  34 +
  35 +set(SRC_LIST
  36 + ${CMAKE_CURRENT_SOURCE_DIR}/controlcentre.cpp
  37 + ${CMAKE_CURRENT_SOURCE_DIR}/main.cpp
  38 +)
  39 +
  40 +include(qtmoc)
  41 +create_mocs( SRC_LIST MOC_LIST
  42 + ${CMAKE_CURRENT_SOURCE_DIR}/controlcentre.h
  43 +)
  44 +
  45 +add_executable( ${PROJECT_NAME}
  46 + ${SRC_LIST}
  47 +)
  48 +
  49 +target_link_libraries( ${PROJECT_NAME}
  50 + ${Qt5Core_LIBRARIES}
  51 + ${Qt5Gui_LIBRARIES}
  52 + ${Qt5Widget_LIBRARIES}
  53 + mqtt-cpp
  54 +)
  55 +
  56 +set_target_properties( ${PROJECT_NAME} PROPERTIES
  57 + RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin
  58 + LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
  59 +)
  60 +
  61 +include(installation)
  62 +install_application()
... ...