Skip to content

Commit

Permalink
Merge branch 'release/0.0.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
ChristianJacobsen committed Jul 22, 2020
2 parents 2c487f9 + cb0da98 commit edb3680
Show file tree
Hide file tree
Showing 5 changed files with 88 additions and 3 deletions.
49 changes: 49 additions & 0 deletions .semaphore/semaphore.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
version: v1.0
name: Linux-x64
agent:
machine:
type: e1-standard-2
os_image: ubuntu1804
blocks:
- name: Upgrade System
dependencies: []
task:
prologue:
commands:
- checkout
jobs:
- name: Fetch Version 3.18 of CMake
commands:
- ./build-tools/000-upgrade-system/upgrade-cmake.sh
env_vars:
- name: CMAKE_CACHE_STRING
value: cmake-3-18-0
- name: CMAKE_VERSION
value: 3.18.0
- name: Build
dependencies:
- Upgrade System
task:
prologue:
commands:
- sem-version cpp 8
- checkout
jobs:
- name: Configure & Build
commands:
- ./build-tools/001-configure-and-build/configure-and-build.sh
env_vars:
- name: CMAKE_CACHE_STRING
value: cmake-3-18-0
- name: CMAKE_VERSION
value: 3.18.0
- name: Publish
dependencies:
- Build
skip:
when: branch != 'master'
task:
jobs:
- name: Publish
commands:
- ./build-tools/002-publish/publish.sh
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.0)
cmake_minimum_required(VERSION 3.14)
project(wakeup
DESCRIPTION "Wake your computer from sleep by sending a Magic Packet"
LANGUAGES CXX
Expand All @@ -8,12 +8,12 @@ set(Boost_NO_BOOST_CMAKE On)
set(CMAKE_CXX_EXTENSIONS Off)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED On)
set(CMAKE_POSITION_INDEPENDENT_CODE On)

include(./cmake/CPM.cmake)

set(BOOST_VERSION 1.67.0)
find_package(Boost ${BOOST_VERSION} QUIET)
get_cmake_property(_variableNames VARIABLES)
if (NOT ${Boost_FOUND})
CPMAddPackage(
NAME boost-cmake
Expand All @@ -22,7 +22,9 @@ if (NOT ${Boost_FOUND})
)
elseif (NOT TARGET Boost::system)
# Add Boost::system target for Boost packages compiled without CMake
add_library(Boost_system INTERFACE)
if (NOT TARGET Boost_system)
add_library(Boost_system INTERFACE)
endif ()
add_library(Boost::system ALIAS Boost_system)
endif ()

Expand Down
11 changes: 11 additions & 0 deletions build-tools/000-upgrade-system/upgrade-cmake.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/usr/bin/env sh

# Exit if CMake version is already cached
cache has_key "${CMAKE_CACHE_STRING}" && exit 0

# Download and extract desired version
wget -q "https://github.com/Kitware/CMake/releases/download/v${CMAKE_VERSION}/cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz"
tar zxf "cmake-${CMAKE_VERSION}-Linux-x86_64.tar.gz"

# Store the newly downloaded version in the cache
cache store "${CMAKE_CACHE_STRING}" "./cmake-${CMAKE_VERSION}-Linux-x86_64/"
13 changes: 13 additions & 0 deletions build-tools/001-configure-and-build/configure-and-build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/usr/bin/env sh

# Restore CMake from cache
cache restore "${CMAKE_CACHE_STRING}"

# Configure build
"./cmake-${CMAKE_VERSION}-Linux-x86_64/bin/cmake" -B build -DCMAKE_BUILD_TYPE=Release .

# Build
"./cmake-${CMAKE_VERSION}-Linux-x86_64/bin/cmake" --build build -j 3

# Store the built binary as an artifact
artifact push workflow build/wakeup
10 changes: 10 additions & 0 deletions build-tools/002-publish/publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#!/usr/bin/env sh

# Fetch the current artifact
artifact pull workflow build/wakeup

# Create a tar-ball
tar zcf "wakeup-$(build/wakeup --version).tar.gz" build/wakeup

# Publish the final tar-balled binary
artifact push project "wakeup-$(build/wakeup --version).tar.gz"

0 comments on commit edb3680

Please sign in to comment.