Skip to content

Commit

Permalink
Added vcpkg support
Browse files Browse the repository at this point in the history
  • Loading branch information
ihedvall committed Aug 10, 2023
1 parent b62d3d2 commit f1e509a
Show file tree
Hide file tree
Showing 15 changed files with 155 additions and 136 deletions.
30 changes: 14 additions & 16 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,22 +31,20 @@ jobs:
platform: linux
cmake_env: { }

# - name: macos
# os: macos-12
# platform: mac
# boost_toolset: clang
# msvc_arch:
# boost_install_path: /Users/runner/work
# cmake_env:
# BOOST_ROOT /Users/runner/work/boost
# pack: 1

# - name: win64
# os: windows-latest
# platform: win
# boost_toolset: msvc
# boost_install_path: D:/a/boost
# msvc_arch: x64
# - name: macos
# os: macos-12
# platform: mac
# boost_toolset: clang
# msvc_arch:
# boost_install_path: /Users/runner/work
# cmake_env:
# BOOST_ROOT /Users/runner/work/boost
# pack: 1

- name: win64
os: windows-latest
platform: win
msvc_arch: x64
# cmake_env:
# # CMAKE_RC_FLAGS: "/C 1252"
# CC: cl
Expand Down
43 changes: 23 additions & 20 deletions .github/workflows/cmake.yml
Original file line number Diff line number Diff line change
@@ -1,38 +1,41 @@
name: CMake
name: CMake Build

on:
push:
branches: [ $default-branch ]
branches:
- master
pull_request:
branches: [ $default-branch ]
branches:
- master

env:
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
BUILD_TYPE: Release


jobs:
build:
# The CMake configure and build commands are platform agnostic and should work equally
# well on Windows or Mac. You can convert this to a matrix build if you need
# cross-platform coverage.
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
runs-on: ubuntu-latest
runs-on: windows-latest

steps:
- uses: actions/checkout@v2

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}
- uses: actions/checkout@v2

- name: Configure CMake
# Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
# See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
run: cmake -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}

- name: Build CMake
# Build your program with the given configuration
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}

- name: Google Test
working-directory: ${{github.workspace}}/build
# Execute tests defined by the CMake configuration.
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
run: ctest -C ${{env.BUILD_TYPE}}

12 changes: 6 additions & 6 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@ project(utilLib
DESCRIPTION "Common C++ library with utilities."
LANGUAGES CXX)

option(UTIL_SHARED_LIBS "Static libraries are preferred" OFF)
option(UTIL_STATIC_LIBS "Static libraries are normally used" ON)
option(BUILD_SHARED_LIBS "Static libraries are preferred" OFF)
option(UTIL_DOC "If doxygen is installed, then build documentation in Release mode" OFF)
option(UTIL_TOOLS "Building applications" ON)
option(UTIL_TEST "Building unit test" ON)
Expand All @@ -16,20 +15,21 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_DEBUG_POSTFIX d)

include(CMakePrintHelpers)

include(script/boost.cmake)
#include(script/expat.cmake)
include(script/fetch_expat.cmake)
include(script/expat.cmake)
#include(script/fetch_expat.cmake)

if (UTIL_TOOLS)
include(script/wxwidgets.cmake)
endif()

if (UTIL_TEST)
include(script/googletest.cmake)
include(script/googletest.cmake)
endif()

if (UTIL_DOC)
include(script/doxygen.cmake)
include(script/doxygen.cmake)
endif()

include(script/flex.cmake)
Expand Down
2 changes: 1 addition & 1 deletion listend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ if (MSVC)
endif ()

target_link_libraries(listend PRIVATE util)
target_link_libraries(listend PRIVATE expat)
target_link_libraries(listend PRIVATE EXPAT::EXPAT)
target_link_libraries(listend PRIVATE ${Boost_LIBRARIES})


Expand Down
2 changes: 1 addition & 1 deletion listenviewer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if (MSVC)
endif()

target_link_libraries(listenviewer PRIVATE util)
target_link_libraries(listenviewer PRIVATE expat)
target_link_libraries(listenviewer PRIVATE EXPAT::EXPAT)
target_link_libraries(listenviewer PRIVATE ${wxWidgets_LIBRARIES})
target_link_libraries(listenviewer PRIVATE ${Boost_LIBRARIES})
if (MINGW)
Expand Down
1 change: 0 additions & 1 deletion script/bison.cmake
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
# Copyright 2022 Ingemar Hedvall
# SPDX-License-Identifier: MIT

include(CMakePrintHelpers)
if (NOT BISON_FOUND)
find_package(BISON)
cmake_print_variables(BISON_FOUND BISON_EXECUTABLE BISON_VERSION)
Expand Down
1 change: 0 additions & 1 deletion script/expat.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# SPDX-License-Identifier: MIT

if (NOT EXPAT_FOUND)

find_package(EXPAT)
message(STATUS "EXPAT Found (Try 1): " ${EXPAT_FOUND})
if (NOT EXPAT_FOUND)
Expand Down
2 changes: 1 addition & 1 deletion serviced/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ if (MSVC)
endif ()

target_link_libraries(serviced PRIVATE util)
target_link_libraries(serviced PRIVATE expat)
target_link_libraries(serviced PRIVATE EXPAT::EXPAT)
target_link_libraries(serviced PRIVATE ${Boost_LIBRARIES})
if (WIN32)
#target_link_libraries(serviced PRIVATE iconv)
Expand Down
2 changes: 1 addition & 1 deletion serviceexplorer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ if (MSVC)
endif()

target_link_libraries(serviceexplorer PRIVATE util)
target_link_libraries(serviceexplorer PRIVATE expat)
target_link_libraries(serviceexplorer PRIVATE EXPAT::EXPAT)
target_link_libraries(serviceexplorer PRIVATE ${wxWidgets_LIBRARIES})
target_link_libraries(serviceexplorer PRIVATE ${Boost_LIBRARIES})
#target_link_libraries(serviceexplorer PRIVATE ${ZLIB_LIBRARIES})
Expand Down
2 changes: 1 addition & 1 deletion src/logconsole.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

namespace util::log::detail {
/** \class LogConsole logconsole.h "logconsole.h"
* \brief Implements a logger that sends the message to the console window.
* \brief Implements a logger that sends the message to the stderr output.
*
* This class implements a logger that sends all log messages to the console.
* This is useful for applications without GUI and where log files are annoying.
Expand Down
Loading

0 comments on commit f1e509a

Please sign in to comment.