-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9 from contour-terminal/improvements/build-process
Build & install process improvements
- Loading branch information
Showing
12 changed files
with
119 additions
and
92 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,59 +11,28 @@ on: | |
- '*.sh' | ||
branches: | ||
- master | ||
- feature/** | ||
- fix/** | ||
- improvement/** | ||
pull_request: | ||
branches: | ||
- master | ||
|
||
concurrency: | ||
group: ${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
env: | ||
CTEST_OUTPUT_ON_FAILURE: 1 | ||
CPM_SOURCE_CACHE: ${{ github.workspace }}/cpm_modules | ||
|
||
jobs: | ||
ubuntu_2004: | ||
name: "Ubuntu Linux 20.04" | ||
runs-on: ubuntu-20.04 | ||
ubuntu_linux: | ||
name: "Ubuntu Linux 22.04" | ||
runs-on: ubuntu-22.04 | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: "**/cpm_modules" | ||
key: ${{github.workflow}}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} | ||
- name: set environment variables | ||
id: set_vars | ||
run: ./scripts/ci-set-vars.sh | ||
env: | ||
REPOSITORY: ${{ github.event.repository.name }} | ||
- name: "install dependencies" | ||
run: | | ||
set -ex | ||
sudo apt -q update | ||
sudo ./scripts/install-deps.sh | ||
- name: "create build directory" | ||
run: mkdir build | ||
- name: "cmake" | ||
run: | | ||
BUILD_DIR="build" \ | ||
CMAKE_BUILD_TYPE="RelWithDebInfo" \ | ||
CXX="g++-9" \ | ||
EXTRA_CMAKE_FLAGS="" \ | ||
./scripts/ci-prepare-contour.sh | ||
- name: "build" | ||
run: cmake --build build/ -- -j3 | ||
|
||
ubuntu1804: | ||
name: "Ubuntu Linux 18.04" | ||
runs-on: ubuntu-18.04 | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- uses: actions/cache@v2 | ||
- name: ccache | ||
uses: hendrikmuhs/ccache-action@v1 | ||
with: | ||
path: "**/cpm_modules" | ||
key: ${{github.workflow}}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} | ||
key: "ccache-ubuntu_2204" | ||
max-size: 256M | ||
- name: set environment variables | ||
id: set_vars | ||
run: ./scripts/ci-set-vars.sh | ||
|
@@ -74,17 +43,8 @@ jobs: | |
set -ex | ||
sudo apt -q update | ||
sudo ./scripts/install-deps.sh | ||
- name: "Get specific version CMake, v3.18.3" | ||
uses: lukka/[email protected] | ||
- name: "create build directory" | ||
run: mkdir build | ||
- name: "cmake" | ||
run: | | ||
BUILD_DIR="build" \ | ||
CMAKE_BUILD_TYPE="Release" \ | ||
CXX="g++-8" \ | ||
EXTRA_CMAKE_FLAGS="-DCONTOUR_BLUR_PLATFORM_KWIN=ON -DUSE_BOOST_FILESYSTEM=ON" \ | ||
./scripts/ci-prepare-contour.sh | ||
run: cmake -S . -B build -DCMAKE_BUILD_TYPE="RelWithDebInfo" | ||
- name: "build" | ||
run: cmake --build build/ -- -j3 | ||
|
||
|
@@ -110,14 +70,7 @@ jobs: | |
- name: "Create build directory" | ||
run: mkdir build | ||
- name: "Generate build files" | ||
run: | | ||
cmake . \ | ||
-DCMAKE_BUILD_TYPE=Release \ | ||
-DYAML_BUILD_SHARED_LIBS=OFF -DYAML_CPP_BUILD_CONTRIB=OFF \ | ||
-DYAML_CPP_BUILD_TESTS=OFF -DYAML_CPP_BUILD_TOOLS=OFF \ | ||
-DYAML_CPP_INSTALL=OFF \ | ||
-DQt5_DIR="$(brew --prefix qt5)/lib/cmake/Qt5" \ | ||
-B build/ | ||
run: cmake -S . -B build -DCMAKE_BUILD_TYPE="RelWithDebInfo" | ||
- name: "Build" | ||
run: cmake --build build/ | ||
|
||
|
@@ -126,26 +79,18 @@ jobs: | |
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions/cache@v2 | ||
with: | ||
path: "**/cpm_modules" | ||
key: ${{github.workflow}}-cpm-modules-${{ hashFiles('**/CMakeLists.txt', '**/*.cmake') }} | ||
- name: setup environment | ||
shell: powershell | ||
id: set_vars | ||
run: .\scripts\ci-set-vars.ps1 | ||
env: | ||
REPOSITORY: ${{ github.event.repository.name }} | ||
- name: Install Qt | ||
uses: jurplel/install-qt-action@v2 | ||
- name: "vcpkg: Install dependencies" | ||
uses: lukka/run-vcpkg@v5 | ||
uses: lukka/run-vcpkg@v11.1 | ||
id: runvcpkg | ||
with: | ||
vcpkgArguments: freetype fontconfig harfbuzz | ||
vcpkgDirectory: ${{ runner.workspace }}/vcpkg/ | ||
vcpkgGitCommitId: b063d0cee7389514a0841cf1e2e055d6466fe4b8 | ||
vcpkgTriplet: x64-windows | ||
vcpkgGitCommitId: 3e93bb69a1cadeb36fe9eca3b6f3912d84f618d5 | ||
- name: "create build directory" | ||
shell: powershell | ||
run: | | ||
|
@@ -154,6 +99,6 @@ jobs: | |
New-Item -ItemType Directory -Force -Path build | ||
} | ||
- name: "Generate build files" | ||
run: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="${{ runner.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows -DYAML_BUILD_SHARED_LIBS=OFF -DCONTOUR_EXAMPLES=OFF -DLIBTERMINAL_TESTING=ON -DLIBUNICODE_TESTING=ON -DYAML_CPP_BUILD_CONTRIB=OFF -DYAML_CPP_BUILD_TESTS=OFF -DYAML_CPP_BUILD_TOOLS=OFF -DYAML_CPP_INSTALL=OFF -B build . | ||
run: cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_TOOLCHAIN_FILE="${{ runner.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DVCPKG_TARGET_TRIPLET=x64-windows -B build . | ||
- name: "Build" | ||
run: cmake --build build/ --config Release |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,62 @@ | ||
add_library(termbench | ||
termbench.cpp termbench.h | ||
) | ||
include(GNUInstallDirs) | ||
|
||
set(_TERMBENCH_LIB_BUILD_MODE) | ||
if(MASTER_PROJECT) | ||
set(_TERMBENCH_LIB_BUILD_MODE "SHARED") | ||
else() | ||
set(_TERMBENCH_LIB_BUILD_MODE "STATIC") | ||
endif() | ||
|
||
set(TERMBENCH_LIB_BUILD_MODE ${_TERMBENCH_LIB_BUILD_MODE} CACHE STRING "Choose the build mode." FORCE) | ||
set_property(CACHE TERMBENCH_LIB_BUILD_MODE PROPERTY STRINGS "STATIC" "SHARED") | ||
message(STATUS "termbench library build mode: ${TERMBENCH_LIB_BUILD_MODE}") | ||
|
||
set(_PUBLIC_HEADERS termbench.h) | ||
add_library(termbench ${TERMBENCH_LIB_BUILD_MODE} termbench.cpp) | ||
add_library(termbench::termbench ALIAS termbench) | ||
target_compile_features(termbench PUBLIC cxx_std_20) | ||
set_target_properties(termbench PROPERTIES | ||
PUBLIC_HEADER "${_PUBLIC_HEADERS}" | ||
) | ||
set_target_properties(termbench PROPERTIES | ||
VERSION "${PROJECT_VERSION}" | ||
SOVERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}" | ||
) | ||
target_link_libraries(termbench PUBLIC fmt::fmt-header-only) | ||
|
||
target_compile_features(termbench PUBLIC cxx_std_17) | ||
target_include_directories(termbench PUBLIC | ||
${CMAKE_SOURCE_DIR} | ||
$<BUILD_INTERFACE:${${PROJECT_NAME}_SOURCE_DIR}> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}/include> | ||
target_include_directories(termbench PUBLIC $<BUILD_INTERFACE:${${PROJECT_NAME}_SOURCE_DIR}> | ||
$<INSTALL_INTERFACE:${CMAKE_INSTALL_INCLUDEDIR}>) | ||
|
||
install(TARGETS termbench | ||
EXPORT termbench-targets | ||
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR} | ||
PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/termbench" | ||
PRIVATE_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/termbench" | ||
FRAMEWORK DESTINATION "." | ||
RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR} | ||
) | ||
|
||
# {{{ Generate the version, config and target files | ||
include(CMakePackageConfigHelpers) | ||
|
||
write_basic_package_version_file(${CMAKE_CURRENT_BINARY_DIR}/termbench-config-version.cmake | ||
VERSION ${PROJECT_VERSION} | ||
COMPATIBILITY SameMajorVersion | ||
) | ||
|
||
configure_package_config_file(termbench-config.cmake.in | ||
${CMAKE_CURRENT_BINARY_DIR}/termbench-config.cmake | ||
INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/termbench | ||
) | ||
|
||
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/termbench-config.cmake | ||
${CMAKE_CURRENT_BINARY_DIR}/termbench-config-version.cmake | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/termbench | ||
) | ||
|
||
install(EXPORT termbench-targets | ||
DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/termbench | ||
NAMESPACE termbench:: | ||
) | ||
# }}} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
@PACKAGE_INIT@ | ||
|
||
# prevent repeatedly including the targets | ||
if(NOT TARGET termbench::termbench) | ||
include(${CMAKE_CURRENT_LIST_DIR}/termbench-targets.cmake) | ||
endif() | ||
|
||
message(STATUS "Found @PROJECT_NAME@, version: ${@PROJECT_NAME@_VERSION}") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/** | ||
* This file is part of the "termbench-pro" project | ||
* This file is part of the "termbench" project | ||
* Copyright (c) 2021 Christian Parpart <[email protected]> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/** | ||
* This file is part of the "termbench-pro" project | ||
* This file is part of the "termbench" project | ||
* Copyright (c) 2021 Christian Parpart <[email protected]> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
include(GNUInstallDirs) | ||
|
||
add_executable(tb main.cpp) | ||
target_link_libraries(tb PRIVATE termbench fmt::fmt-header-only) | ||
|
||
# Set the RPATH so that the executable can find the shared libraries | ||
# when installed in a non-standard location | ||
set_target_properties(tb PROPERTIES | ||
INSTALL_RPATH "${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_LIBDIR}" | ||
INSTALL_RPATH_USE_LINK_PATH TRUE | ||
) | ||
|
||
install(TARGETS tb RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
/** | ||
* This file is part of the "termbench-pro" project | ||
* This file is part of the "termbench" project | ||
* Copyright (c) 2021 Christian Parpart <[email protected]> | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"$schema": "https://raw.githubusercontent.com/microsoft/vcpkg-tool/main/docs/vcpkg.schema.json", | ||
"dependencies": [ | ||
"catch2", | ||
"fmt" | ||
] | ||
} |