Skip to content

Commit

Permalink
Merge pull request #1 from mody/mody-patch-1
Browse files Browse the repository at this point in the history
Create cmake-single-platform.yml
  • Loading branch information
mody authored Oct 6, 2023
2 parents 923b99c + de0aa95 commit 8f61540
Show file tree
Hide file tree
Showing 4 changed files with 117 additions and 32 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/cmake-single-platform.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# This starter workflow is for a CMake project running on a single platform. There is a different starter workflow if you need cross-platform coverage.
# See: https://github.com/actions/starter-workflows/blob/main/ci/cmake-multi-platform.yml
name: Build test

on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]

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

jobs:
build-gcc:
# 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

steps:
- uses: actions/checkout@v3

- name: Install deps
run: |
sudo apt-get update
sudo apt-get install cmake pkg-config libboost-dev libtbb-dev libfmt-dev libcrypto++-dev libboost-regex-dev
- 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}}

build-clang:
# 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

steps:
- uses: actions/checkout@v3

- name: Install deps
run: |
sudo apt-get update
sudo apt-get install cmake pkg-config libboost-dev libtbb-dev libfmt-dev libcrypto++-dev libboost-regex-dev clang
- 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
env:
CXX: /usr/bin/clang++
CC: /usr/bin/clang
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}}
71 changes: 41 additions & 30 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,111 +8,122 @@ set(CMAKE_CXX_FLAGS "-Wall -Werror -Wshadow -std=c++20 -fno-omit-frame-pointer
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

find_package(PkgConfig)
pkg_check_modules(FMT REQUIRED QUIET fmt)
pkg_check_modules(CRYPTOPP REQUIRED QUIET libcryptopp)
pkg_check_modules(TBB REQUIRED QUIET tbb)
pkg_check_modules(FMT REQUIRED fmt)
pkg_check_modules(TBB REQUIRED tbb)
# pkg_check_modules(PC_RapidJSON QUIET RapidJSON)

pkg_check_modules(CRYPTOPP libcryptopp)
if (NOT CRYPTOPP_FOUND)
pkg_check_modules(CRYPTOPP libcrypto++)
endif()
if (NOT CRYPTOPP_FOUND)
message(FATAL_ERROR "Crypto++ library not found")
endif()

# set(BOOST_ROOT "/home/ov699/opt/")
# find_package(Boost 1.67.0 COMPONENTS unit_test_framework REQUIRED)
# include_directories(src ${Boost_INCLUDE_DIR} ${TBB_DIR})
find_package(Boost 1.74.0 COMPONENTS regex REQUIRED)
include_directories(src ${Boost_INCLUDE_DIR})

set (DEFAULT_LIBS ${FMT_LIBRARIES} ${Boost_REGEX_LIBRARY})

add_executable(day1 src/day1.cc)
target_compile_features(day1 PRIVATE cxx_std_20)
target_link_libraries(day1 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day1 PRIVATE ${DEFAULT_LIBS})

add_executable(day2 src/day2.cc)
target_compile_features(day2 PRIVATE cxx_std_20)
target_link_libraries(day2 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day2 PRIVATE ${DEFAULT_LIBS})

add_executable(day3 src/day3.cc)
target_compile_features(day3 PRIVATE cxx_std_20)
target_link_libraries(day3 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day3 PRIVATE ${DEFAULT_LIBS})

add_executable(day4 src/day4.cc)
target_compile_features(day4 PRIVATE cxx_std_20)
target_link_libraries(day4 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day4 PRIVATE ${DEFAULT_LIBS})

add_executable(day5 src/day5.cc)
target_compile_features(day5 PRIVATE cxx_std_20)
target_link_libraries(day5 PRIVATE ${FMT_LIBRARIES} ${CRYPTOPP_LIBRARIES})
target_link_libraries(day5 PRIVATE ${DEFAULT_LIBS} ${CRYPTOPP_LIBRARIES})

add_executable(day6 src/day6.cc)
target_compile_features(day6 PRIVATE cxx_std_20)
target_link_libraries(day6 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day6 PRIVATE ${DEFAULT_LIBS})

add_executable(day7 src/day7.cc)
target_compile_features(day7 PRIVATE cxx_std_20)
target_link_libraries(day7 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day7 PRIVATE ${DEFAULT_LIBS})

add_executable(day8 src/day8.cc)
target_compile_features(day8 PRIVATE cxx_std_20)
target_link_libraries(day8 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day8 PRIVATE ${DEFAULT_LIBS})

add_executable(day9 src/day9.cc)
target_compile_features(day9 PRIVATE cxx_std_20)
target_link_libraries(day9 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day9 PRIVATE ${DEFAULT_LIBS})

add_executable(day10 src/day10.cc)
target_compile_features(day10 PRIVATE cxx_std_20)
target_link_libraries(day10 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day10 PRIVATE ${DEFAULT_LIBS})

add_executable(day11 src/day11.cc)
target_compile_features(day11 PRIVATE cxx_std_20)
target_link_libraries(day11 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day11 PRIVATE ${DEFAULT_LIBS})

add_executable(day12 src/day12.cc)
target_compile_features(day12 PRIVATE cxx_std_20)
target_link_libraries(day12 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day12 PRIVATE ${DEFAULT_LIBS})

add_executable(day13 src/day13.cc)
target_compile_features(day13 PRIVATE cxx_std_20)
target_link_libraries(day13 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day13 PRIVATE ${DEFAULT_LIBS})

add_executable(day14 src/day14.cc)
target_compile_features(day14 PRIVATE cxx_std_20)
target_link_libraries(day14 PRIVATE ${FMT_LIBRARIES} ${CRYPTOPP_LIBRARIES} ${TBB_LIBRARIES})
target_link_libraries(day14 PRIVATE ${DEFAULT_LIBS} ${CRYPTOPP_LIBRARIES} ${TBB_LIBRARIES})

add_executable(day15 src/day15.cc)
target_compile_features(day15 PRIVATE cxx_std_20)
target_link_libraries(day15 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day15 PRIVATE ${DEFAULT_LIBS})

add_executable(day16 src/day16.cc)
target_compile_features(day16 PRIVATE cxx_std_20)
target_link_libraries(day16 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day16 PRIVATE ${DEFAULT_LIBS})

add_executable(day17 src/day17.cc)
target_compile_features(day17 PRIVATE cxx_std_20)
target_link_libraries(day17 PRIVATE ${FMT_LIBRARIES} ${CRYPTOPP_LIBRARIES})
target_link_libraries(day17 PRIVATE ${DEFAULT_LIBS} ${CRYPTOPP_LIBRARIES})

add_executable(day18 src/day18.cc)
target_compile_features(day18 PRIVATE cxx_std_20)
target_link_libraries(day18 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day18 PRIVATE ${DEFAULT_LIBS})

add_executable(day19 src/day19.cc)
target_compile_features(day19 PRIVATE cxx_std_20)
target_link_libraries(day19 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day19 PRIVATE ${DEFAULT_LIBS})

add_executable(day20 src/day20.cc)
target_compile_features(day20 PRIVATE cxx_std_20)
target_link_libraries(day20 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day20 PRIVATE ${DEFAULT_LIBS})

add_executable(day21 src/day21.cc)
target_compile_features(day21 PRIVATE cxx_std_20)
target_link_libraries(day21 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day21 PRIVATE ${DEFAULT_LIBS})

add_executable(day22 src/day22.cc)
target_compile_features(day22 PRIVATE cxx_std_20)
target_link_libraries(day22 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day22 PRIVATE ${DEFAULT_LIBS})

add_executable(day23 src/day23.cc)
target_compile_features(day23 PRIVATE cxx_std_20)
target_link_libraries(day23 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day23 PRIVATE ${DEFAULT_LIBS})

add_executable(day24 src/day24.cc)
target_compile_features(day24 PRIVATE cxx_std_20)
target_link_libraries(day24 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day24 PRIVATE ${DEFAULT_LIBS})

add_executable(day25 src/day25.cc)
target_compile_features(day25 PRIVATE cxx_std_20)
target_link_libraries(day25 PRIVATE ${FMT_LIBRARIES})
target_link_libraries(day25 PRIVATE ${DEFAULT_LIBS})

enable_testing()
2 changes: 1 addition & 1 deletion src/day25.cc
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ int main()

{
CPU cpu1(prog);
for (unsigned x = 0; x < -1; ++x) {
for (unsigned x = 0; x < std::numeric_limits<unsigned>::max(); ++x) {
cpu1.registers = {0};
cpu1.registers.at(static_cast<unsigned>(Register::A)) = x;
cpu1.run();
Expand Down
1 change: 0 additions & 1 deletion src/day8.cc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include "point2d.h"

#include <boost/regex.hpp>
#include <boost/regex/v5/regex_fwd.hpp>
#include <cassert>
#include <fmt/core.h>
#include <iostream>
Expand Down

0 comments on commit 8f61540

Please sign in to comment.