Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cmake: use ENV{VCPKG_ROOT}, fix msgfmt + minor. #3685

Open
wants to merge 19 commits into
base: main
Choose a base branch
from

Commits on Mar 17, 2022

  1. build: ignore build*/ for out-of-source builds

    Add build*/ to .gitignore to support the typical commandline cmake
    workflow for out-of-source builds. That is, something like:
    
    mkdir build-x64-static
    cd build-x64-static
    cmake ../contrib/buildsystems -DCMAKE_BUILD_TYPE=Release `
    	-DVCPKG_ARCH=x64-windows-static `
    	-G Ninja
    ninja
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    c026559 View commit details
    Browse the repository at this point in the history
  2. build: add -static triplets in vcpkg_install usage

    Change the usage message that is printed when the arch is not passed in
    in vcpkg_install.bat to mention the -static vcpkg triplets for static
    builds.
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    2472dc4 View commit details
    Browse the repository at this point in the history
  3. build: improve check for built vcpkg.exe

    Use IF EXIST path/vcpkg.exe instead of dir path/vcpkg.exe && to check
    for an existing vcpkg.exe which is the typical way to do these tests in
    cmd scripts.
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    4f6e164 View commit details
    Browse the repository at this point in the history
  4. build: reformat git check in vcpkg_install.bat

    Indent and format the code in the IF statement checking for the
    non-existence of git.exe.
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    b024210 View commit details
    Browse the repository at this point in the history
  5. build: error/usage to stderr in vcpkg_install.bat

    Append >&2 to the echo statements for the missing arch message and the
    git not found messages to send them to stderr instead of stdout which is
    the typical practice.
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    bea48ac View commit details
    Browse the repository at this point in the history
  6. build: support VCPKG_ROOT env in vcpkg_install.bat

    If %VCPKG_ROOT% environment variable is set, check that the parent
    directory exists and throw an error if it does not.
    
    If %VCPKG_ROOT% is not set, set it to %cwd%\vcpkg, which was the
    previous behavior.
    
    Change all references to %cwd%\vcpkg to %VCPKG_ROOT%.
    
    Change the documentation in the top comment to refer to %VCPKG_ROOT%.
    
    This allows a developer to maintain his or her own vcpkg clone and not
    have to unnecessarily repeat the very time-consuming process of
    compiling the dependencies.
    
    Set ENV{VCPKG_ROOT} to the VCPKG_DIR default in CMakeLists.txt, because
    the cmake code does not support this yet, this is introduced in a
    subsequent commit.
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    155b5b1 View commit details
    Browse the repository at this point in the history
  7. doc: correct NO_VCPKG to USE_VCPKG

    USE_VCPKG is the current variable used to disable vcpkg.
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    77a16b6 View commit details
    Browse the repository at this point in the history
  8. build: add vim modeline to CMakeLists.txt

    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    392055f View commit details
    Browse the repository at this point in the history
  9. build: add workdir to CreateLinks.cmake call

    Add WORKING_DIRECTORY to the add_custom_command() call that launches
    CreateLinks.cmake, which is a script that creates some hard links to
    built git executables. This allows the script to not fail for build
    directories other than the default.
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    3e50ee2 View commit details
    Browse the repository at this point in the history
  10. build: log some cmake vars after project()

    Stop displaying the variables MSVC, CMAKE_CXX_COMPILER_ID,
    CMAKE_GENERATOR_PLATFORM in the vcpkg setup section, as this section
    runs before project() and they are not yet initialized.
    
    Instead display them after the project() call, and use
    CMAKE_C_COMPILER_ID instead of CMAKE_CXX_COMPILER_ID as this is a C
    project.
    
    Also change all variable log message() calls to message(STATUS ...)
    calls.
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    cd28420 View commit details
    Browse the repository at this point in the history
  11. build: use VCPKG_DIR instead of constant

    Use VCPKG_DIR instead of relative path to the default vcpkg clone for
    appending the vcpkg bin to PATH when writing GIT-BUILD-OPTIONS in cmake.
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    c2b23c7 View commit details
    Browse the repository at this point in the history
  12. build: fix check for VCPKG_ARCH

    Use DEFINED instead of EXISTS (EXISTS is for checking if a filesystem
    path exists, DEFINED is for variables.)
    
    Also move the check to above the call to vcpkg_install.bat where it is
    used from its previous location below.
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    b21f8b6 View commit details
    Browse the repository at this point in the history
  13. build: always call vcpkg_install.bat from cmake

    Instead of checking if VCPKG_DIR exists first, always call
    vcpkg_install.bat, which will create a new vcpkg clone as well as
    perform any necessary actions on an existing clone, and will do nothing
    if nothing needs to be done.
    
    Remove the "Initializing vcpkg..." message from cmake and change the
    "installing libraries" message from the cmd script to say that it may
    take a while.
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 17, 2022
    Configuration menu
    Copy the full SHA
    dcb576a View commit details
    Browse the repository at this point in the history

Commits on Mar 21, 2022

  1. build: add build_option() to cmake/Utilities.cmake

    Add the build_option() function which is similar to the cmake option()
    command, but allows adding alias variables and alias environment
    variables.
    
    The option and all aliases are set to the first found value by listed
    sequence in the option and all aliases, followed by the default if
    provided, or 'OFF' if not provided, with cache variables having
    precedence over normal variables.
    
    In the case of environment variables or aliases, if the type is BOOL and
    the found/default value is OFF/FALSE unset the environment variable.
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 21, 2022
    Configuration menu
    Copy the full SHA
    fa1a687 View commit details
    Browse the repository at this point in the history
  2. build: alias VCPKG_TARGET_TRIPLET to VCPKG_ARCH

    Include the build_option() function introduced in b0d325d4bd (Add
    build_option() to cmake/Utilities.cmake., 2022-02-10).
    
    Initialize VCPKG_ARCH with an alias to VCPKG_TARGET_TRIPLET with
    build_option().
    
    Add a note about this to the cmake doc.
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 21, 2022
    Configuration menu
    Copy the full SHA
    312a4f1 View commit details
    Browse the repository at this point in the history
  3. build: alias VCPKG_ROOT env variable to VCPKG_DIR

    Use the build_option() function introduced in 3db0658 (build: add
    build_option() to cmake/Utilities.cmake, 2022-02-10) to alias the
    VCPKG_ROOT environment variable to VCPKG_DIR.
    
    Support for VCPKG_ROOT was added to vcpkg_install.bat in 98c6a0d
    (build: support VCPKG_ROOT env in vcpkg_install.bat, 2022-02-08).
    
    Add a note about VCPKG_DIR and ENV{VCPKG_ROOT} to the cmake doc.
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 21, 2022
    Configuration menu
    Copy the full SHA
    575a968 View commit details
    Browse the repository at this point in the history
  4. build: support NO_LIB env to disable vcpkg deps

    Check if NO_<dep> environment variable is defined to skip vcpkg deps,
    this is needed to implement cmake support for NO_GETTEXT properly in a
    subsequent commit.
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 21, 2022
    Configuration menu
    Copy the full SHA
    d654bcc View commit details
    Browse the repository at this point in the history
  5. build: add gettext[tools] vcpkg dep

    Add gettext vcpkg dependency lib with the [tools] feature for the msgfmt
    utility to build the translations.
    
    Can be disabled by setting the NO_GETTEXT environment variable, support
    for which was added in 2cd6269 (build: support NO_LIB env to disable
    vcpkg deps, 2022-03-17).
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 21, 2022
    Configuration menu
    Copy the full SHA
    55ec81d View commit details
    Browse the repository at this point in the history

Commits on Mar 23, 2022

  1. build: clean up NO_GETTEXT cmake support

    Make NO_GETTEXT a build option aliased to ENV{NO_GETTEXT} to pass to
    vcpkg_install.bat to skip building gettext.
    
    Turn it off by default when vcpkg is in-use because it's a very long
    compile.
    
    Do not build translations if NO_GETTEXT is set.
    
    Add a note about NO_GETTEXT to the docs at the top of CMakeLists.txt.
    
    Signed-off-by: Rafael Kitover <[email protected]>
    rkitover committed Mar 23, 2022
    Configuration menu
    Copy the full SHA
    5292199 View commit details
    Browse the repository at this point in the history