From b5ec7c4702c046300e92acba8e46d70d5b3c028f Mon Sep 17 00:00:00 2001 From: Teo Mrnjavac Date: Wed, 4 Jun 2014 16:35:26 +0200 Subject: [PATCH] CMake skeleton. --- .gitignore | 1 + CMakeLists.txt | 101 ++++++++++++++ CMakeModules/CMakeDateStamp.cmake | 23 ++++ CMakeModules/CMakeVersionSource.cmake | 45 ++++++ CMakeModules/GNUInstallDirs.cmake | 182 +++++++++++++++++++++++++ CalamaresBuildTreeSettings.cmake.in | 4 + CalamaresConfig.cmake.in | 21 +++ CalamaresConfigVersion.cmake.in | 12 ++ cmake_uninstall.cmake.in | 21 +++ src/CMakeLists.txt | 11 ++ src/calamares/CMakeLists.txt | 52 +++++++ src/calamares/CalamaresApplication.cpp | 0 src/calamares/CalamaresApplication.h | 0 src/calamares/CalamaresVersion.h.in | 9 ++ src/calamares/Config.h.in | 10 ++ src/calamares/MainWindow.cpp | 0 src/calamares/MainWindow.h | 0 src/calamares/main.cpp | 0 src/libcalamares/CMakeLists.txt | 55 ++++++++ src/libcalamares/JobQueue.cpp | 0 src/libcalamares/JobQueue.h | 0 21 files changed, 547 insertions(+) create mode 100644 CMakeLists.txt create mode 100644 CMakeModules/CMakeDateStamp.cmake create mode 100644 CMakeModules/CMakeVersionSource.cmake create mode 100644 CMakeModules/GNUInstallDirs.cmake create mode 100644 CalamaresBuildTreeSettings.cmake.in create mode 100644 CalamaresConfig.cmake.in create mode 100644 CalamaresConfigVersion.cmake.in create mode 100644 cmake_uninstall.cmake.in create mode 100644 src/CMakeLists.txt create mode 100644 src/calamares/CMakeLists.txt create mode 100644 src/calamares/CalamaresApplication.cpp create mode 100644 src/calamares/CalamaresApplication.h create mode 100644 src/calamares/CalamaresVersion.h.in create mode 100644 src/calamares/Config.h.in create mode 100644 src/calamares/MainWindow.cpp create mode 100644 src/calamares/MainWindow.h create mode 100644 src/calamares/main.cpp create mode 100644 src/libcalamares/CMakeLists.txt create mode 100644 src/libcalamares/JobQueue.cpp create mode 100644 src/libcalamares/JobQueue.h diff --git a/.gitignore b/.gitignore index 623e5fea2..12677851b 100644 --- a/.gitignore +++ b/.gitignore @@ -26,3 +26,4 @@ Makefile* # QtCreator *.autosave +qtcreator-build diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 000000000..c7fb397bb --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,101 @@ +project( calamares ) +cmake_minimum_required( VERSION 2.8.12 ) +set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules" ) + +cmake_policy( SET CMP0023 OLD ) + +find_package( Qt5 5.3.0 CONFIG REQUIRED Core Gui Widgets ) + +### +### Calamares application info +### +SET( CALAMARES_ORGANIZATION_NAME "The Calamares Team" ) +SET( CALAMARES_ORGANIZATION_DOMAIN "github.com/calamares" ) +SET( CALAMARES_APPLICATION_NAME "Calamares" ) +SET( CALAMARES_DESCRIPTION_SUMMARY "The distribution-independent installer framework" ) + +set( CALAMARES_VERSION_MAJOR 0 ) +set( CALAMARES_VERSION_MINOR 1 ) +set( CALAMARES_VERSION_PATCH 0 ) +#set( CALAMARES_VERSION_RC 0 ) + +set( CALAMARES_VERSION ${CALAMARES_VERSION_MAJOR}.${CALAMARES_VERSION_MINOR}.${CALAMARES_VERSION_PATCH} ) +set( CALAMARES_VERSION_SHORT "${CALAMARES_VERSION}" ) +if( CALAMARES_VERSION_RC ) + set( CALAMARES_VERSION ${CALAMARES_VERSION}rc${CALAMARES_VERSION_RC} ) +endif() + +# additional info for non-release builds +if( NOT BUILD_RELEASE AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/.git/" ) + include( CMakeDateStamp ) + set( CALAMARES_VERSION_DATE "${CMAKE_DATESTAMP_YEAR}${CMAKE_DATESTAMP_MONTH}${CMAKE_DATESTAMP_DAY}" ) + if( CALAMARES_VERSION_DATE GREATER 0 ) + set( CALAMARES_VERSION ${CALAMARES_VERSION}.${CALAMARES_VERSION_DATE} ) + endif() + + include( CMakeVersionSource ) + if( CMAKE_VERSION_SOURCE ) + set( CALAMARES_VERSION ${CALAMARES_VERSION}-${CMAKE_VERSION_SOURCE} ) + endif() +endif() + +# enforce using constBegin, constEnd for const-iterators +add_definitions( "-DQT_STRICT_ITERATORS" ) + +# set paths +set( CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" ) +set( CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" ) +set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}" ) + +# make predefined install dirs available everywhere +include( GNUInstallDirs ) + +# make uninstall support +configure_file( + "${CMAKE_CURRENT_SOURCE_DIR}/cmake_uninstall.cmake.in" + "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" + IMMEDIATE @ONLY +) + +set( CALAMARES_LIBRARIES calamareslib ) + +add_subdirectory( src ) + +# Add all targets to the build-tree export set +set( CMAKE_INSTALL_CMAKEDIR "${CMAKE_INSTALL_LIBDIR}/cmake/Calamares" CACHE PATH "Installation directory for CMake files" ) +set( CMAKE_INSTALL_FULL_CMAKEDIR "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_CMAKEDIR}" ) +export(TARGETS calamareslib + FILE "${PROJECT_BINARY_DIR}/CalamaresLibraryDepends.cmake") + +# Export the package for use from the build-tree +# (this registers the build-tree with a global CMake-registry) +export( PACKAGE Calamares ) + +# Create a CalamaresBuildTreeSettings.cmake file for the use from the build tree +configure_file( CalamaresBuildTreeSettings.cmake.in "${PROJECT_BINARY_DIR}/CalamaresBuildTreeSettings.cmake" @ONLY ) + +# Create the CalamaresConfig.cmake and CalamaresConfigVersion files +file( RELATIVE_PATH CONF_REL_INCLUDE_DIR "${CMAKE_INSTALL_FULL_CMAKEDIR}" "${CMAKE_INSTALL_FULL_INCLUDEDIR}" ) + +configure_file( CalamaresConfig.cmake.in "${PROJECT_BINARY_DIR}/CalamaresConfig.cmake" @ONLY ) +configure_file( CalamaresConfigVersion.cmake.in "${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake" @ONLY ) + +# Install the cmake files +install( + FILES + "${PROJECT_BINARY_DIR}/CalamaresConfig.cmake" + "${PROJECT_BINARY_DIR}/CalamaresConfigVersion.cmake" +# "${PROJECT_BINARY_DIR}/CalamaresUse.cmake" +# "${PROJECT_BINARY_DIR}/CalamaresAddPlugin.cmake" +# "${PROJECT_BINARY_DIR}/CalamaresAddLibrary.cmake" + DESTINATION + "${CMAKE_INSTALL_CMAKEDIR}" +) + +# Install the export set for use with the install-tree +install( + EXPORT + CalamaresLibraryDepends + DESTINATION + "${CMAKE_INSTALL_CMAKEDIR}" +) diff --git a/CMakeModules/CMakeDateStamp.cmake b/CMakeModules/CMakeDateStamp.cmake new file mode 100644 index 000000000..0b6a3896f --- /dev/null +++ b/CMakeModules/CMakeDateStamp.cmake @@ -0,0 +1,23 @@ +find_program(DATE_EXECUTABLE NAMES date) +mark_as_advanced(DATE_EXECUTABLE) + +if(DATE_EXECUTABLE) + execute_process( + COMMAND ${DATE_EXECUTABLE} +%Y + OUTPUT_VARIABLE CMAKE_DATESTAMP_YEAR + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + execute_process( + COMMAND ${DATE_EXECUTABLE} +%m + OUTPUT_VARIABLE CMAKE_DATESTAMP_MONTH + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + execute_process( + COMMAND ${DATE_EXECUTABLE} +%d + OUTPUT_VARIABLE CMAKE_DATESTAMP_DAY + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) +endif() diff --git a/CMakeModules/CMakeVersionSource.cmake b/CMakeModules/CMakeVersionSource.cmake new file mode 100644 index 000000000..826546807 --- /dev/null +++ b/CMakeModules/CMakeVersionSource.cmake @@ -0,0 +1,45 @@ +# Try to identify the current development source version. +set(CMAKE_VERSION_SOURCE "") +if(EXISTS ${CMAKE_SOURCE_DIR}/.git/HEAD) + find_program(GIT_EXECUTABLE NAMES git git.cmd) + mark_as_advanced(GIT_EXECUTABLE) + if(GIT_EXECUTABLE) + execute_process( + COMMAND ${GIT_EXECUTABLE} rev-parse --verify -q --short=7 HEAD + OUTPUT_VARIABLE head + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + if(head) + set(branch "") + execute_process( + COMMAND ${GIT_EXECUTABLE} name-rev HEAD + OUTPUT_VARIABLE branch + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + string(REGEX REPLACE "HEAD " "" branch "${branch}") + set(CMAKE_VERSION_SOURCE "git-${branch}-${head}") + execute_process( + COMMAND ${GIT_EXECUTABLE} update-index -q --refresh + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + execute_process( + COMMAND ${GIT_EXECUTABLE} diff-index --name-only HEAD -- + OUTPUT_VARIABLE dirty + OUTPUT_STRIP_TRAILING_WHITESPACE + WORKING_DIRECTORY ${CMAKE_SOURCE_DIR} + ) + if(dirty) + set(CMAKE_VERSION_SOURCE "${CMAKE_VERSION_SOURCE}-dirty") + endif() + endif() + endif() +elseif(EXISTS ${CMAKE_SOURCE_DIR}/CVS/Repository) + file(READ ${CMAKE_SOURCE_DIR}/CVS/Repository repo) + set(branch "") + if("${repo}" MATCHES "\\.git/") + string(REGEX REPLACE ".*\\.git/([^\r\n]*).*" "-\\1" branch "${repo}") + endif() + set(CMAKE_VERSION_SOURCE "cvs${branch}") +endif() diff --git a/CMakeModules/GNUInstallDirs.cmake b/CMakeModules/GNUInstallDirs.cmake new file mode 100644 index 000000000..a114dcb2e --- /dev/null +++ b/CMakeModules/GNUInstallDirs.cmake @@ -0,0 +1,182 @@ +# - Define GNU standard installation directories +# Provides install directory variables as defined for GNU software: +# http://www.gnu.org/prep/standards/html_node/Directory-Variables.html +# Inclusion of this module defines the following variables: +# CMAKE_INSTALL_ - destination for files of a given type +# CMAKE_INSTALL_FULL_ - corresponding absolute path +# where is one of: +# BINDIR - user executables (bin) +# SBINDIR - system admin executables (sbin) +# LIBEXECDIR - program executables (libexec) +# SYSCONFDIR - read-only single-machine data (etc) +# SHAREDSTATEDIR - modifiable architecture-independent data (com) +# LOCALSTATEDIR - modifiable single-machine data (var) +# LIBDIR - object code libraries (lib or lib64) +# INCLUDEDIR - C header files (include) +# OLDINCLUDEDIR - C header files for non-gcc (/usr/include) +# DATAROOTDIR - read-only architecture-independent data root (share) +# DATADIR - read-only architecture-independent data (DATAROOTDIR) +# INFODIR - info documentation (DATAROOTDIR/info) +# LOCALEDIR - locale-dependent data (DATAROOTDIR/locale) +# MANDIR - man documentation (DATAROOTDIR/man) +# DOCDIR - documentation root (DATAROOTDIR/doc/PROJECT_NAME) +# Each CMAKE_INSTALL_ value may be passed to the DESTINATION options of +# install() commands for the corresponding file type. If the includer does +# not define a value the above-shown default will be used and the value will +# appear in the cache for editing by the user. +# Each CMAKE_INSTALL_FULL_ value contains an absolute path constructed +# from the corresponding destination by prepending (if necessary) the value +# of CMAKE_INSTALL_PREFIX. + +#============================================================================= +# Copyright 2011 Nikita Krupen'ko +# Copyright 2011 Kitware, Inc. +# +# Distributed under the OSI-approved BSD License (the "License"); +# see accompanying file Copyright.txt for details. +# +# This software is distributed WITHOUT ANY WARRANTY; without even the +# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. +# See the License for more information. +#============================================================================= +# (To distribute this file outside of CMake, substitute the full +# License text for the above reference.) + +# Installation directories +# +if(NOT DEFINED CMAKE_INSTALL_BINDIR) + set(CMAKE_INSTALL_BINDIR "bin" CACHE PATH "user executables (bin)") +endif() + +if(NOT DEFINED CMAKE_INSTALL_SBINDIR) + set(CMAKE_INSTALL_SBINDIR "sbin" CACHE PATH "system admin executables (sbin)") +endif() + +if(NOT DEFINED CMAKE_INSTALL_LIBEXECDIR) + set(CMAKE_INSTALL_LIBEXECDIR "libexec" CACHE PATH "program executables (libexec)") +endif() + +if(NOT DEFINED CMAKE_INSTALL_SYSCONFDIR) + set(CMAKE_INSTALL_SYSCONFDIR "etc" CACHE PATH "read-only single-machine data (etc)") +endif() + +if(NOT DEFINED CMAKE_INSTALL_SHAREDSTATEDIR) + set(CMAKE_INSTALL_SHAREDSTATEDIR "com" CACHE PATH "modifiable architecture-independent data (com)") +endif() + +if(NOT DEFINED CMAKE_INSTALL_LOCALSTATEDIR) + set(CMAKE_INSTALL_LOCALSTATEDIR "var" CACHE PATH "modifiable single-machine data (var)") +endif() + +if(NOT DEFINED CMAKE_INSTALL_LIBDIR) + set(_LIBDIR_DEFAULT "lib") + # Override this default 'lib' with 'lib64' iff: + # - we are on Linux system but NOT cross-compiling + # - we are NOT on debian + # - we are on a 64 bits system + # reason is: amd64 ABI: http://www.x86-64.org/documentation/abi.pdf + # Note that the future of multi-arch handling may be even + # more complicated than that: http://wiki.debian.org/Multiarch + if(CMAKE_SYSTEM_NAME MATCHES "Linux" + AND NOT CMAKE_CROSSCOMPILING + AND NOT EXISTS "/etc/debian_version") + if(NOT DEFINED CMAKE_SIZEOF_VOID_P) + message(AUTHOR_WARNING + "Unable to determine default CMAKE_INSTALL_LIBDIR directory because no target architecture is known. " + "Please enable at least one language before including GNUInstallDirs.") + else() + if("${CMAKE_SIZEOF_VOID_P}" EQUAL "8") + set(_LIBDIR_DEFAULT "lib64") + endif() + endif() + endif() + set(CMAKE_INSTALL_LIBDIR "${_LIBDIR_DEFAULT}" CACHE PATH "object code libraries (${_LIBDIR_DEFAULT})") +endif() + +if(NOT DEFINED CMAKE_INSTALL_INCLUDEDIR) + set(CMAKE_INSTALL_INCLUDEDIR "include" CACHE PATH "C header files (include)") +endif() + +if(NOT DEFINED CMAKE_INSTALL_OLDINCLUDEDIR) + set(CMAKE_INSTALL_OLDINCLUDEDIR "/usr/include" CACHE PATH "C header files for non-gcc (/usr/include)") +endif() + +if(NOT DEFINED CMAKE_INSTALL_DATAROOTDIR) + set(CMAKE_INSTALL_DATAROOTDIR "share" CACHE PATH "read-only architecture-independent data root (share)") +endif() + +#----------------------------------------------------------------------------- +# Values whose defaults are relative to DATAROOTDIR. Store empty values in +# the cache and store the defaults in local variables if the cache values are +# not set explicitly. This auto-updates the defaults as DATAROOTDIR changes. + +if(NOT CMAKE_INSTALL_DATADIR) + set(CMAKE_INSTALL_DATADIR "" CACHE PATH "read-only architecture-independent data (DATAROOTDIR)") + set(CMAKE_INSTALL_DATADIR "${CMAKE_INSTALL_DATAROOTDIR}") +endif() + +if(NOT CMAKE_INSTALL_INFODIR) + set(CMAKE_INSTALL_INFODIR "" CACHE PATH "info documentation (DATAROOTDIR/info)") + set(CMAKE_INSTALL_INFODIR "${CMAKE_INSTALL_DATAROOTDIR}/info") +endif() + +if(NOT CMAKE_INSTALL_LOCALEDIR) + set(CMAKE_INSTALL_LOCALEDIR "" CACHE PATH "locale-dependent data (DATAROOTDIR/locale)") + set(CMAKE_INSTALL_LOCALEDIR "${CMAKE_INSTALL_DATAROOTDIR}/locale") +endif() + +if(NOT CMAKE_INSTALL_MANDIR) + set(CMAKE_INSTALL_MANDIR "" CACHE PATH "man documentation (DATAROOTDIR/man)") + set(CMAKE_INSTALL_MANDIR "${CMAKE_INSTALL_DATAROOTDIR}/man") +endif() + +if(NOT CMAKE_INSTALL_DOCDIR) + set(CMAKE_INSTALL_DOCDIR "" CACHE PATH "documentation root (DATAROOTDIR/doc/PROJECT_NAME)") + set(CMAKE_INSTALL_DOCDIR "${CMAKE_INSTALL_DATAROOTDIR}/doc/${PROJECT_NAME}") +endif() + +#----------------------------------------------------------------------------- + +mark_as_advanced( + CMAKE_INSTALL_BINDIR + CMAKE_INSTALL_SBINDIR + CMAKE_INSTALL_LIBEXECDIR + CMAKE_INSTALL_SYSCONFDIR + CMAKE_INSTALL_SHAREDSTATEDIR + CMAKE_INSTALL_LOCALSTATEDIR + CMAKE_INSTALL_LIBDIR + CMAKE_INSTALL_INCLUDEDIR + CMAKE_INSTALL_OLDINCLUDEDIR + CMAKE_INSTALL_DATAROOTDIR + CMAKE_INSTALL_DATADIR + CMAKE_INSTALL_INFODIR + CMAKE_INSTALL_LOCALEDIR + CMAKE_INSTALL_MANDIR + CMAKE_INSTALL_DOCDIR + ) + +# Result directories +# +foreach(dir + BINDIR + SBINDIR + LIBEXECDIR + SYSCONFDIR + SHAREDSTATEDIR + LOCALSTATEDIR + LIBDIR + INCLUDEDIR + OLDINCLUDEDIR + DATAROOTDIR + DATADIR + INFODIR + LOCALEDIR + MANDIR + DOCDIR + ) + if(NOT IS_ABSOLUTE ${CMAKE_INSTALL_${dir}}) + set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_${dir}}") + else() + set(CMAKE_INSTALL_FULL_${dir} "${CMAKE_INSTALL_${dir}}") + endif() +endforeach() diff --git a/CalamaresBuildTreeSettings.cmake.in b/CalamaresBuildTreeSettings.cmake.in new file mode 100644 index 000000000..507fc3d64 --- /dev/null +++ b/CalamaresBuildTreeSettings.cmake.in @@ -0,0 +1,4 @@ +set(CALAMARES_INCLUDE_DIRS + "@PROJECT_SOURCE_DIR@/src/libcalamares" + "@PROJECT_BINARY_DIR@/src/libcalamares" +) diff --git a/CalamaresConfig.cmake.in b/CalamaresConfig.cmake.in new file mode 100644 index 000000000..ccba1cbbf --- /dev/null +++ b/CalamaresConfig.cmake.in @@ -0,0 +1,21 @@ +# - Config file for the Calamares package +# It defines the following variables +# CALAMARES_INCLUDE_DIRS - include directories for Calamares +# CALAMARES_LIBRARIES - libraries to link against +# CALAMARES_EXECUTABLE - the bar executable + +# Compute paths +get_filename_component(CALAMARES_CMAKE_DIR "${CMAKE_CURRENT_LIST_FILE}" PATH) +if(EXISTS "${CALAMARES_CMAKE_DIR}/CMakeCache.txt") + # In build tree + include("${CALAMARES_CMAKE_DIR}/CalamaresBuildTreeSettings.cmake") +else() + set(CALAMARES_INCLUDE_DIRS "${CALAMARES_CMAKE_DIR}/@CONF_REL_INCLUDE_DIR@/libcalamares") +endif() + +# Our library dependencies (contains definitions for IMPORTED targets) +include("${CALAMARES_CMAKE_DIR}/CalamaresLibraryDepends.cmake") + +# These are IMPORTED targets created by CalamaresLibraryDepends.cmake +set(CALAMARES_LIBRARIES calamareslib) +#set(CALAMARES_USE_FILE "${CALAMARES_CMAKE_DIR}/CalamaresUse.cmake") diff --git a/CalamaresConfigVersion.cmake.in b/CalamaresConfigVersion.cmake.in new file mode 100644 index 000000000..05b87c8d3 --- /dev/null +++ b/CalamaresConfigVersion.cmake.in @@ -0,0 +1,12 @@ +set(PACKAGE_VERSION "@CALAMARES_VERSION@") + +# Check whether the requested PACKAGE_FIND_VERSION is compatible +if("${PACKAGE_VERSION}" VERSION_LESS "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_COMPATIBLE FALSE) +else() + set(PACKAGE_VERSION_COMPATIBLE TRUE) + if ("${PACKAGE_VERSION}" VERSION_EQUAL "${PACKAGE_FIND_VERSION}") + set(PACKAGE_VERSION_EXACT TRUE) + endif() +endif() + diff --git a/cmake_uninstall.cmake.in b/cmake_uninstall.cmake.in new file mode 100644 index 000000000..df95fb9d8 --- /dev/null +++ b/cmake_uninstall.cmake.in @@ -0,0 +1,21 @@ +IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"") +ENDIF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt") + +FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files) +STRING(REGEX REPLACE "\n" ";" files "${files}") +FOREACH(file ${files}) + MESSAGE(STATUS "Uninstalling \"$ENV{DESTDIR}${file}\"") + IF(EXISTS "$ENV{DESTDIR}${file}") + EXEC_PROGRAM( + "@CMAKE_COMMAND@" ARGS "-E remove \"$ENV{DESTDIR}${file}\"" + OUTPUT_VARIABLE rm_out + RETURN_VALUE rm_retval + ) + IF(NOT "${rm_retval}" STREQUAL 0) + MESSAGE(FATAL_ERROR "Problem when removing \"$ENV{DESTDIR}${file}\"") + ENDIF(NOT "${rm_retval}" STREQUAL 0) + ELSE(EXISTS "$ENV{DESTDIR}${file}") + MESSAGE(STATUS "File \"$ENV{DESTDIR}${file}\" does not exist.") + ENDIF(EXISTS "$ENV{DESTDIR}${file}") +ENDFOREACH(file) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 000000000..96b5c6dbb --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,11 @@ +include_directories( ${CMAKE_CURRENT_BINARY_DIR}/libcalamares ) +include_directories( ${CMAKE_CURRENT_LIST_DIR}/libcalamares ) + +include_directories( ${CMAKE_CURRENT_BINARY_DIR} ) +include_directories( ${CMAKE_CURRENT_LIST_DIR} ) + +# library +add_subdirectory( libcalamares ) + +# application +add_subdirectory( calamares ) diff --git a/src/calamares/CMakeLists.txt b/src/calamares/CMakeLists.txt new file mode 100644 index 000000000..8d658a24c --- /dev/null +++ b/src/calamares/CMakeLists.txt @@ -0,0 +1,52 @@ +project( calamares ) + +if( NOT CMAKE_BUILD_TYPE STREQUAL "Release" ) + message( "Building in debug mode, enabling all debug updates" ) +endif() + +set( calamaresSources + main.cpp + CalamaresApplication.cpp + MainWindow.cpp +) + +set( calamaresUi + #ui files go here +) + +include_directories( + . + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_BINARY_DIR}/../libcalamares + + ../libcalamares +) + +include( GNUInstallDirs ) + +qt5_wrap_ui( calamaresUi_H ${calamaresUi} ) + +#qt_add_resources( calamaresRc "../../resources.qrc" ) + +set( final_src ${calamaresUi_H} ${calamaresSources} ${calamaresRc} ) + +add_executable( calamares_bin ${final_src} ) +SET_TARGET_PROPERTIES(calamares_bin + PROPERTIES + AUTOMOC TRUE + RUNTIME_OUTPUT_NAME calamares_bin +) + + +qt5_use_modules( calamares_bin Core Widgets ) +target_link_libraries( calamares_bin + ${LINK_LIBRARIES} + ${CALAMARES_LIBRARIES} + Qt5Core + Qt5Widgets +) + +install( TARGETS calamares_bin + BUNDLE DESTINATION . + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} +) diff --git a/src/calamares/CalamaresApplication.cpp b/src/calamares/CalamaresApplication.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/src/calamares/CalamaresApplication.h b/src/calamares/CalamaresApplication.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/calamares/CalamaresVersion.h.in b/src/calamares/CalamaresVersion.h.in new file mode 100644 index 000000000..6e82f94aa --- /dev/null +++ b/src/calamares/CalamaresVersion.h.in @@ -0,0 +1,9 @@ +#ifndef CALAMARES_VERSION_H +#define CALAMARES_VERSION_H + +#cmakedefine CALAMARES_ORGANIZATION_NAME "${CALAMARES_ORGANIZATION_NAME}" +#cmakedefine CALAMARES_ORGANIZATION_DOMAIN "${CALAMARES_ORGANIZATION_DOMAIN}" +#cmakedefine CALAMARES_APPLICATION_NAME "${CALAMARES_APPLICATION_NAME}" +#cmakedefine CALAMARES_VERSION "${CALAMARES_VERSION}" + +#endif // CALAMARES_VERSION_H diff --git a/src/calamares/Config.h.in b/src/calamares/Config.h.in new file mode 100644 index 000000000..fc57470ec --- /dev/null +++ b/src/calamares/Config.h.in @@ -0,0 +1,10 @@ +#ifndef CONFIG_H_IN +#define CONFIG_H_IN + +#define CMAKE_INSTALL_PREFIX "${CMAKE_INSTALL_PREFIX}" +#define CMAKE_INSTALL_FULL_LIBEXECDIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}" +#define CMAKE_INSTALL_LIBDIR "${CMAKE_INSTALL_LIBDIR}" + +//cmakedefines for CMake variables (e.g. for optdepends) go here + +#endif // CONFIG_H_IN diff --git a/src/calamares/MainWindow.cpp b/src/calamares/MainWindow.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/src/calamares/MainWindow.h b/src/calamares/MainWindow.h new file mode 100644 index 000000000..e69de29bb diff --git a/src/calamares/main.cpp b/src/calamares/main.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/src/libcalamares/CMakeLists.txt b/src/libcalamares/CMakeLists.txt new file mode 100644 index 000000000..21b43c03c --- /dev/null +++ b/src/libcalamares/CMakeLists.txt @@ -0,0 +1,55 @@ +project( calamareslib ) + +add_definitions( ${QT_DEFINITIONS} ) +add_definitions( -DQT_SHARED ) +add_definitions( -DQT_SHAREDPOINTER_TRACK_POINTERS ) + +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../calamares/Config.h.in + ${CMAKE_CURRENT_BINARY_DIR}/config.h) +configure_file(${CMAKE_CURRENT_SOURCE_DIR}/../calamares/CalamaresVersion.h.in + ${CMAKE_CURRENT_BINARY_DIR}/CalamaresVersion.h) + +set( libSources + JobQueue.cpp +) + +include_directories( + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR} + + ${QT_INCLUDE_DIR} +) + +add_library( calamareslib SHARED ${libSources}) +set_target_properties( + calamareslib + PROPERTIES + AUTOMOC TRUE + VERSION ${CALAMARES_VERSION_SHORT} + SOVERSION ${CALAMARES_VERSION_SHORT} + OUTPUT_NAME "calamares" +) + +qt5_use_modules( calamareslib Widgets ) + +target_link_libraries( calamareslib + #LINK_PRIVATE + # internal deps, if any + + LINK_PUBLIC + # External deps + Qt5Core +) + +install( TARGETS calamareslib + EXPORT CalamaresLibraryDepends + RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} + LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} + ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} +) + +# Install header files +file( GLOB rootHeaders "*.h" ) + +install( FILES ${CMAKE_CURRENT_BINARY_DIR}/config.h DESTINATION include/libcalamares ) +install( FILES ${rootHeaders} DESTINATION include/libcalamares ) diff --git a/src/libcalamares/JobQueue.cpp b/src/libcalamares/JobQueue.cpp new file mode 100644 index 000000000..e69de29bb diff --git a/src/libcalamares/JobQueue.h b/src/libcalamares/JobQueue.h new file mode 100644 index 000000000..e69de29bb