LinuxCommandLibrary

sfdk-qmake

Generate Makefiles for Sailfish OS projects

TLDR

Run qmake build

$ sfdk qmake
copy

Run shadow qmake build in a specified project
$ sfdk qmake [project]
copy

Run build with extra qmake arguments
$ sfdk qmake -- [arguments]
copy

Run shadow qmake build with extra qmake arguments
$ sfdk qmake [project] [arguments]
copy

SYNOPSIS

sfdk-qmake [options] [project_file | source_directory]
Note: Many standard qmake options are supported and passed through.

PARAMETERS

project_file
    The path to the Qt project file (.pro) to be processed. If omitted, sfdk-qmake usually searches for a .pro file in the current directory.

source_directory
    A directory containing the .pro file. If specified, sfdk-qmake will change into this directory to find the project file.

-o file
    Specifies the name of the output Makefile. By default, qmake generates a file named Makefile.

-spec spec
    Specifies the platform and compiler combination to use. For sfdk-qmake, this is often pre-configured by the SDK, but can be overridden (e.g., linux-g++ for host builds or specific Sailfish targets).

-config config
    Adds one or more configuration options to the project (e.g., release, debug, staticlib). Multiple configurations can be separated by spaces.

-recursive
    Instructs qmake to process .pro files in subdirectories, useful for projects with multiple modules.

-Wall
    Turns on all warnings when generating build files, making the compiler stricter.

--sdk SDK_TARGET
    (Hypothetical, but common for SDK wrappers) Specifies which installed Sailfish OS SDK target environment should be used for configuration. This ensures the correct toolchain and libraries are selected.

-set VAR VALUE
    Sets a project variable VAR to VALUE, overriding any definitions in the .pro file or environment.

-query VAR
    Queries the value of a project variable VAR without generating build files.

DESCRIPTION

The sfdk-qmake command is an integral part of the Sailfish OS SDK, designed to streamline the process of configuring Qt-based projects for development and deployment on Sailfish OS devices and emulators. It acts as a specialized wrapper or invocation of the standard qmake tool, tailoring its operations to the specific cross-compilation environment provided by the SDK.

When invoked, sfdk-qmake interprets the project's .pro file, ensuring that the generated build files (typically Makefiles) correctly reference the SDK's compilers, libraries, Qt versions, and platform-specific settings. This crucial step prepares the application source code for successful compilation within the Sailfish OS build system, abstracting away much of the complexity associated with cross-platform development.

CAVEATS

Proper functioning of sfdk-qmake is contingent upon a correctly installed and configured Sailfish OS SDK environment. Issues with SDK setup, missing toolchains, or incorrect paths can lead to configuration errors.

While it wraps qmake, not all arbitrary qmake options might be fully compatible or recommended, as sfdk-qmake is tailored for the Sailfish OS build system. Developers should refer to Sailfish OS SDK documentation for specific recommendations.

INTEGRATION WITH SAILFISH OS BUILD FLOW

sfdk-qmake is typically the first step in the manual build process for a Sailfish OS application. After successfully running sfdk-qmake to generate Makefiles, the subsequent step usually involves invoking make (or ninja) to compile the project. Finally, tools like sfdk deploy or sfdk install are used to transfer and install the compiled application onto a target device or emulator.

UNDERSTANDING THE .PRO FILE

The .pro file is the primary input for sfdk-qmake. It contains all project-specific settings, source files, headers, libraries, and Qt modules required. sfdk-qmake interprets these directives within the context of the active Sailfish OS SDK, resolving paths and dependencies to ensure a successful cross-compilation.

HISTORY

The sfdk-qmake command emerged as a critical component alongside the release of the Sailfish OS SDK, designed to facilitate native application development for the platform. It builds upon the well-established qmake build system from the Qt framework, adapting it for the unique cross-compilation and deployment needs of Sailfish OS. Its development has closely mirrored the evolution of Sailfish OS itself and the underlying Qt versions supported by the SDK, becoming an indispensable tool for developers targeting Jolla devices.

SEE ALSO

qmake(1), make(1), sfdk(1), gcc(1), g++(1)

Copied to clipboard