SUSoftCMakeCommon

July 13, 2023 ยท View on GitHub

This repository is supposed to hold the shared CMake configuration between the different SU softwares.

Features

Configuration

Usage

Functions

Features

  • It sets the different compile options for the compiler
  • It copies at build time the required DLLs (and add them in the installer)

Configuration

This repository contains a ext_libs.txt file. The paths defined should be present on your OS. The variables are:

  • EXT_LIBS_TXT_PATH: path to your ext_libs.txt path that should define EXT_LIB_PATH
  • EXT_LIB_PATH: path to your dev environment (default is "C:/susoft/ext")
  • EIGEN_INCLUDE_PATH: The path to Eigen folder
  • QT_ROOT_PATH: The path to Qt installation. You should have among others bin and lib folders there
  • REFRAME_LIBRARY_DIR: The path to Reframe folder
  • REFRAME2016_LIBRARY_DIR: The path to Reframe (v2016) folder
  • TUT_INCLUDE_PATH: The path to Tut folder
  • OPENSSL_ROOT_DIR: The path to OpenSSL folder

Usage

You can configure what you want to initialize thanks to these variables:

  • if create_doc is TRUE, create Doxygen documentation
    • Note that you'll need to set the variable DOXYGEN_CONF_PATH as a relative path to the Doxyfile.in. e.g. option(DOXYGEN_CONF_PATH "LGC")
  • if USE_QT is TRUE, configure QT.
    • You need to set QT_ROOT_PATH to your root installation
    • You can tell the Qt wanted modules as a list in QT_WANTED_MODULES (default is Core)
  • if USE_OPENSSL is TRUE, provide OpenSSL DLLs for installers.
    • You need to set OPENSSL_ROOT_DIR to your root installation
  • if cpack_build, build binary and source package installers.
  • if enable_console, Enable the console

Moreover, you can provide a flag during CMake project generation to override the default EXT_LIBS_TXT_PATH if you don't want to use the default path provided by the SUSoftCMakeCommon submodule.

In order to do that, provide a path via flag:-DEXT_LIBS_TXT_PATH="C:/susoft/SUSoftCMakeCommon/ext_libs.txt". This flag has to be added prior to the CMake source dir.

Functions

You also have the following functions available to copy files at compile time in the created executable folder:

deployqt

Run the Qt deployment tool to copy DLLs and translation files

  • param target the target when we want to copy (like the executable name)
  • optional parameter: the path to the output dir where the DLL will be copied default is the target binary dir
  • optional paramter: the path to the executable we want to run the Qt deployment tool on default is the executable generated by the given target. Note: the previous optional parameter must be set to set this one
function(deployqt target)

post_build_copy_dlls

Copy files int the build directory at build time if files don't already exist.

  • param target the target when we want to copy (like the executable name)
  • param debug_files (list) files that should go into the debug folder
  • param release_files (list) files that should go into the release folder (can be the same as debug_files)
  • param subdir an optionnal subdir where to write the files

Note: debug_files and release_files must have the same length

Note: this function should be called after the definition of the executable

function(post_build_copy_dlls debug_files release_files subdir)

set_vs_default_startup_project

Set the given project as the default startup project in MSVC++.

  • param project_name the project that should be set as the default startup project

Note: this function should be called after the definition of the executable

function(set_vs_default_startup_project project_name)

create_default_installer

Create an installer package.

The installer contains the minimum required files:

  • the executable
  • the VC redist
  • if USE_QT, runs windeployqt
  • if CREATE_DOC, adds the doc
  • if USE_OPENSSL, copies OpenSSL DLLs

Note: You can add extra files to the installer thanks to the function installer_copy_files (see below)

Note: this function should be called after the definition of the executable

function(create_default_installer)

installer_copy_files

When creating the installer, this function can be called to add files in the installer.

  • param files a list of files to add
  • param destination the destination in the installation folder

Note: this function should be called after the definition of the executable and preferably after the call to create_default_installer

function(installer_copy_files files destination)