119 Commits (604535f65a36a67bbf934cc056c648a79a6d03ba)

Author SHA1 Message Date
Adriaan de Groot 38ec357bd5 CMake: simplify development-version string
- merge the (not-installed) date-stamp and git-version
  files into ExtendedVersion, turn things into functions
- drop support for CVS (wut?)
- don't mention the branch, in git-versioning, because the
  hash is enough to find whatever
- don't need external program to find date, use `string(TIMESTAMP...)`
4 years ago
Adriaan de Groot 2ebf9124d1 CMake: move check for skipped-modules to all subdirs
The check for skipping a subdirectory was applied to Python subdirs,
not to C++ subdirs. This meant that a skipped module would notice
only in calamares_add_plugin() that it should be skipped. The **rest**
of the CMakeLists.txt in the to-be-skipped modules' subdirectory
was not skipped, and so a test might be added for a module that
was skipped. Depending on how the test consumes the code/module
under test, that might fail to link.

Example module is *initramfs*. Reported by yonggan.
4 years ago
Adriaan de Groot 88aa1755ce CMake: split out skip-module-checking to its own cmake module
The skip-checking is now in the functions for adding plugins and
subdirectories, so that third-party building should get it
as well, for free. Since AddModuleSubdirectory and AddPlugin
use the newly split-out module, handling SKIP_MODULES and USE_*
consistently across module repositories is now easier.

While here, make accumulating-the-skipped-modules explicit.
4 years ago
Adriaan de Groot a64a54ff04 CMake: split out global skip-modules checking
There are two ways to skip building a module:
 - SKIP_MODULES (individually listed)
 - USE_* (pick one from a collection)

Move the handling for those ways to a separate function, so that it
can be re-used in the calamares-extensions module too, or other
external module repositories.
4 years ago
Adriaan de Groot 0bf1df72cd CMake: report Python module name without subdirectory
FIXES ##1641
4 years ago
Adriaan de Groot e66f81f6ee CMake: comment on BUILD_AS_TEST 4 years ago
Adriaan de Groot 40aa0fcaba CMake: add a helper module for finding KPMcore
I think we had this (kind of) module a long time ago and it was
removed for over-complicating things; re-introduce one now that
KPMcore is used in 3 different places and all would benefit
from consistent API handling / defines.
4 years ago
Adriaan de Groot aeffbac9cd CMake: add resources to tests
Some tests -- notably the keyboard module -- need to have the
QRC for the module loaded as well (e.g. because of data in the
QRC). Add a RESOURCES parameter to calamares_add_test()
like calamares_add_plugin() already has, to build the
resources into the test.

Keyboard test now passes, since it was missing the data for
lookups before.
4 years ago
Adriaan de Groot 6b6267e3a4 i18n: check for gettext rather than just calling msgfmt
- *secretly* this is already done in the KF5 i18n modules,
  so the resizefs was already requiring FindGettext.
- we don't actually use the gettext modules' CMake macros,
  so explain why in the module.
4 years ago
Adriaan de Groot 392b4d33a0 i18n: create the lang/<lang>/ directories in the build as-needed 4 years ago
Adriaan de Groot 49e925ef47 i18n: untangle translations in the executable
- there's no need for a macro that is going to be used once,
  especially if there's only one place it can be called.
- expand it in place and remove it from the installed CMake
  module
4 years ago
Adriaan de Groot 3529659629 i18n: compile the gettext translations at build time
- need gettext to build translations (TODO: find_program)
- compile the .mo files from .po as part of the build, writing
  to the build-directory only
4 years ago
Adriaan de Groot 242d5c6499 i18n: install Python translations from a sensible place
- put the installation code in lang/ rather than among the modules
- remove useless indirection through CMake macro
4 years ago
Adriaan de Groot 1cd9b93a22 REUSE: Giant boilerplate cleanup
- point to main Calamares site in the 'part of' headers instead
  of to github (this is the "this file is part of Calamares"
  opening line for most files).
- remove boilerplate from all source files, CMake modules and completions,
  this is the 3-paragraph summary of the GPL-3.0-or-later, which has
  a meaning entirely covered by the SPDX tag.
4 years ago
Adriaan de Groot 31d0b5b194 REUSE: (BSD-2-Clause) CMakeModules/
The intended license for the CMake modules is BSD-2-Clause;
there's no desire to restrict what can be done with these,
and CMake modules are generally 2-clause licensed.
4 years ago
Adriaan de Groot 2609e05898 CMake: remove unused module 4 years ago
Adriaan de Groot c19866f887 [libcalamares] Add a module-weight to the module descriptor 4 years ago
Adriaan de Groot f7102527a8 CMake: stop clobbering config files
When CMake runs, configure_file() will clobber the config files in
the build/ directory, which is annoying during testing: you need
to keep making the same edits, or edit the source.

- Introduce new behavior: the config file is **not** overwritten unless
  the source file is newer. This means that edits to config files
  in the build directory are preserved.
- If INSTALL_CONFIG is **on** then the files are clobbered anyway (the
  source is considered new regardless).
4 years ago
Adriaan de Groot a8c4f5b758 CMake: fix up warnings from the LibPWQuality module
- don't include other find modules
- pkgconfig isn't totally necessary, it might work without
4 years ago
Adriaan de Groot afb0b36f58 CMake: simplify QRC generation
Use configure_file() to avoid stomping on timestamps: if the list
of translations doesn't change, we don't need to rebuild the
translated QRC.
4 years ago
Adriaan de Groot bfa1f618c7 CMake: Improve RCC version-checking
Previously, we check for RCC support every single time CMake runs.
This is slightly wasteful, and it wasn't being done right anyway.
But it's moot because:

- Calamares supports back to Qt 5.9
- Qt 5.9's version of rcc (at least, 5.9.7) **does** support the
  command-line argument `--format-version 1`
- Everything newer does too.

Simplify translations a little, too: just use autorcc rather than
building things by hand.
4 years ago
Adriaan de Groot 23810aae3d CMake: switch to autorcc from manual futzing 4 years ago
Adriaan de Groot 37ce49b001 CMake: stop overwriting branding settings in the build dir
- Only copy over branding files if they are newer

Typically I have KDevelop open while working on Calamares; if I
am editing settings in `branding.desc` in the build directory,
then every time KDevelop runs CMake in the background, my
changes (for testing branding things!) would be overwritten.
Don't do that.

For normal builds with a clean build directory, this doesn't change
anything since the target is missing; changing a file in the
source directory **will** copy it over the build directory version.
5 years ago
Adriaan de Groot f218e2e9a6 CMake: handle Python modules built from subdirectory a/b 5 years ago
Adriaan de Groot 73f8c627bd CMake: support out-of-tree builds
- The variables that are set for out-of-tree builds are prefixed
  with  to avoid name clashes; make the module-infrastructure
  respect those instead of the in-tree variable names.
- .. and then duplicate the in-tree variables to the out-of-tree
  variables, so we only need one set of module instructions.
5 years ago
Adriaan de Groot e6fe19df20 CMake: remove unused link libraries
- Nothing ever sets LIBRARY_QT5_MODULES (it would be a macro
  argument to calamares_add_library, if anything).
5 years ago
Adriaan de Groot dc16afac4a CMake: massage IMPORTED targets and module path
- Add the Calamares CMake-modules to the search path automatically
- Export to CalamaresTargets.cmake and use namespace Calamares::
- Document imported targets
- Find Qt, because the translations machinery will need macros from that
- The installed lib links to IMPORTED libraries from KF5, so we need
  to find them (again) as well.
5 years ago
Callum Farmer 0d4642ca6a [CMakeModules] Update SPDX identifiers.
Update CalamaresAddTest.cmake

Update CalamaresAddLibrary.cmake

Update CalamaresAddBrandingSubdirectory.cmake

Update CalamaresAddTranslations.cmake

Update CalamaresAddPlugin.cmake

Update CalamaresAddModuleSubdirectory.cmake
5 years ago
Adriaan de Groot c3d8112187 CMake: allow fine-tuning tests
- The Python configuration tests sometimes need extra setup, so
  do that through a CMakeTests.txt file in the test directory.
- Patch up existing tests:
  - grubcfg needs /tmp/calamares/etc/default to exist
  - rawfs won't work on FreeBSD because of differences in /proc
5 years ago
Adriaan de Groot 1ae38c8ebc CMake: add tests when there are test-configs
- If a module has tests/#.global or tests/#.job, these are used
  as arguments to a test-run of loadmodule (which reads them
  and runs the module with that configuration).
- This makes the old python-loading test and test-runner entirely
  obsolete, so remove them too.
5 years ago
Adriaan de Groot 0aaf24c4a5 CMake: tell tests where their source-dir is
- Abuse BUILD_AS_TEST to pass in the value as a string
5 years ago
Adriaan de Groot fba1bf7072 CMake: add DEFINITIONS option to calamares_add_test
- There's a handful of tests that need this, it's possible
  there will be more, so just add it to the infrastructure.
5 years ago
Adriaan de Groot 6f996d8eed CMake: give yamlcpp a proper imported target
- This makes linking easier,
 - Adds the right includes (needed on FreeBSD),
 - Lets us drop silly GUI setting for non-GUI tests (I think this was
   a side-effect of compiling on FreeBSD, where UI would pull in
   /usr/local/include).
5 years ago
Adriaan de Groot 4495a4c739 CMake: Allow extra libraries in calamares_add_test
- Extra libraries specified via LIBRARIES part of CMake function
 - Convert all the other module tests
5 years ago
Adriaan de Groot 6bdc4a55de CMake: new convenience module CalamaresAddTest 5 years ago
Adriaan de Groot 96946a8447 Merge branch 'fix-unpackfs-progress'
This is an ugly hack, using Bill Auger's support for Job weights.
The unpackfs job is arbitrarily awarded a weight of 12. That makes it
(in a Netrunner install) use progress from 12% to 40% or so, overall,
as all the files are unpacked.

Also fixes bug reported by Kevin Kofler that unpackfs was only reporting
progress when it hit an exact multiple of 100 (instead of over 100).

SEE #1176
5 years ago
Adriaan de Groot b0b9073b40 CMake: fix boost.python detection on FreeBSD 5 years ago
Adriaan de Groot 5ad73681c2 CMake: actually write the NO_CONFIG setting 5 years ago
Adriaan de Groot fbb452f9bf CMake: add support for NO_CONFIG
- A C++ module should set NO_CONFIG to flag that it doesn't have a
   config file (this is an error if it secretly **does** have one)
5 years ago
Adriaan de Groot 8fc94900d3 CMake: add the tz_ translation files to the i18n build 5 years ago
Adriaan de Groot 4652df0643 CMake: allow required modules in calamares_add_plugin
- Add a REQUIRES keyword
 - Write out values to the descriptor
 - Add some documentation for the function as a whole
5 years ago
Adriaan de Groot 63d1378721 CMake: need to create dir before copying to it 6 years ago
Adriaan de Groot a08e764467 CMake: add compiled branding translations to build dir
- Copy the .qm files (compiled translations) into the build
   dir as part of the build process. This is independent of
   **installing** those same translations, but does allow
   the translations to be used by Calamares when run from the
   build dir for testing.
6 years ago
Adriaan de Groot ba7ee445c6 CMake: switch to using autouic on plugins
- Use autouic so that we can also pass in --include to add
   a code-warning-suppression to the generated code, just like
   we can do with moc.
6 years ago
Kevin Kofler fa9aeb4a5d CMake: Fix BoostPython3.cmake for Fedora >= 30
CMakeModules/BoostPython3.cmake: Also try e.g. "python37" as the module
name, because Fedora 30 switched from the e.g. "python-py37" format to
that. Otherwise, Boost::Python3 cannot be found on Fedora without
manually setting CALAMARES_BOOST_PYTHON3_COMPONENT.
6 years ago
Adriaan de Groot c9447d7794 CMake: add test for python modules
- Only Python modules have a loadmodule-test added. This will call
   run(), but with an empty configuration it should be a no-op.
6 years ago
Adriaan de Groot 1e391bda7e CMake: document intention to run more tests on modules
- Loading the module will check Python modules for syntax,
   and C++ modules for symbols. This would be a good idea,
   except for where it calls exec() and does things to the
   running system. Most modules are harmless with an empty
   config, but you never know (e.g. a process module).
6 years ago
Adriaan de Groot 6f9548af34 CMake: Check module interfaces
- Only allow meaningful interface strings
 - Improve documentation of which interfaces work for
   which module types.
6 years ago
Adriaan de Groot bdb7bf71a8 Reduce warnings from moc-generated code
- The auto-generated code produces a lot of warnings from
   Clang 8; this obscures the more meaningful warnings from
   actual Calamares code, so tone the warnings down.
 - For Clang, set CALAMARES_MOC_OPTIONS.
 - Add convenience CMake function for automoccing. It applies
   the options as needed to a given target.
6 years ago
Adriaan de Groot d7594860b0 CMake: fix calamares_add_library
- Remove the commented-out cruft and the whinging
 - Fix use of COMPILE_DEFINITIONS with a list passed in
 - Remove unused arguments (TYPE, TARGET)
 - Document calamares_add_library
 - Document how to use COMPILE_DEFINITIONS (in calamares_add_plugin)
6 years ago