diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..2ab1d1a --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,47 @@ + +name: Build the project +run-name: Build the project on behalf of ${{ github.actor }} +on: + workflow_dispatch: + pull_request: + types: [opened, synchronize, reopened] + push: + branches: + - dev +jobs: + build: + runs-on: windows-latest + + steps: + + - name: Install Conan + run: pip3 install 'conan>=2.0.0' + + - name: Conan version + run: conan --version + + - name: Checkout + uses: actions/checkout@v4 + + - name: Cache conan database + id: cache-conan + uses: actions/cache@v3 + env: + cache-name: cache-conan-database + with: + path: ~/.conan2 + key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/conanfile.py') }} + + - if: ${{ steps.cache-conan.outputs.cache-hit != 'true' }} + name: List the state of conan local cache + continue-on-error: true + run: conan list * + + - name: Resolve dependencies + run: .\1.resolve.dependencies.cmd + + - name: Generate solution + run: .\2.generate.solution.cmd + + - name: Build solution + run: .\3.build.all.cmd diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9489afe --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ + +build/ +CMakeUserPresets.json diff --git a/0.clean.all.cmd b/0.clean.all.cmd new file mode 100644 index 0000000..c59e8c4 --- /dev/null +++ b/0.clean.all.cmd @@ -0,0 +1,2 @@ + +rmdir .\build /s /q diff --git a/1.resolve.dependencies.cmd b/1.resolve.dependencies.cmd new file mode 100644 index 0000000..c4d2da6 --- /dev/null +++ b/1.resolve.dependencies.cmd @@ -0,0 +1,12 @@ + +conan install . --output-folder=build/conan --build=missing + +conan profile detect --force + +set CUR_DIR=%CD% + +conan install . --output-folder=%CUR_DIR%\build\conan --build=missing -s build_type=RelWithDebInfo +if %errorlevel% neq 0 exit /b %errorlevel% + +conan install . --output-folder=%CUR_DIR%\build\conan --build=missing -s build_type=Debug +if %errorlevel% neq 0 exit /b %errorlevel% diff --git a/2.generate.solution.cmd b/2.generate.solution.cmd new file mode 100644 index 0000000..e638134 --- /dev/null +++ b/2.generate.solution.cmd @@ -0,0 +1,4 @@ + +cmake -S .\ -B .\build -G "Visual Studio 17 2022" -A x64 -DCMAKE_TOOLCHAIN_FILE=.\build\conan\conan_toolchain.cmake -DCMAKE_CONFIGURATION_TYPES="Debug;RelWithDebInfo" + +if %errorlevel% neq 0 exit /b %errorlevel% diff --git a/3.build.all.cmd b/3.build.all.cmd new file mode 100644 index 0000000..bc0ba58 --- /dev/null +++ b/3.build.all.cmd @@ -0,0 +1,6 @@ + +cmake --build .\build --config "Debug" +if %errorlevel% neq 0 exit /b %errorlevel% + +cmake --build .\build --config "RelWithDebInfo" +if %errorlevel% neq 0 exit /b %errorlevel% diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..662d282 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,27 @@ + +cmake_minimum_required(VERSION 3.26) + +project(windows.pep VERSION 1.0.0 LANGUAGES CXX C) + +set(CMAKE_CXX_STANDARD 23) +set(CMAKE_CXX_STANDARD_REQUIRED On) +set(CMAKE_CXX_EXTENSIONS Off) + +#if(EXISTS "${CMAKE_BINARY_DIR}/conan/conanbuildinfo.cmake") +#include(${CMAKE_BINARY_DIR}/conan/conanbuildinfo.cmake) +#endif() + +#conan_basic_setup() + +find_package("Boost" 1.84.0 COMPONENTS test thread log log_setup REQUIRED) + +message( "CMAKE_BINARY_DIR: " ${CMAKE_BINARY_DIR} ) +message( "CONAN_INCLUDE_DIRS: " ${CONAN_INCLUDE_DIRS} ) +message( "CMAKE_INCLUDE_PATH: " ${CMAKE_INCLUDE_PATH} ) +message( "CMAKE_LIBRARY_PATH: " ${CMAKE_LIBRARY_PATH} ) +message( "CONAN_LIBS: " ${CONAN_LIBS} ) +#include_directories(${CONAN_INCLUDE_DIRS}) +include_directories(${CMAKE_INCLUDE_PATH}) +#CMAKE_LIBRARY_PATH + +add_subdirectory(src/tests) diff --git a/README.md b/README.md index d1096b8..284e822 100644 --- a/README.md +++ b/README.md @@ -1 +1 @@ -# github-actions \ No newline at end of file +# github-actions diff --git a/conanfile.py b/conanfile.py new file mode 100644 index 0000000..7525426 --- /dev/null +++ b/conanfile.py @@ -0,0 +1,12 @@ +from conan import ConanFile + + +class WindowsPEP(ConanFile): + settings = "os", "compiler", "build_type", "arch" + generators = "CMakeToolchain", "CMakeDeps" + + def requirements(self): + self.requires("boost/1.84.0") + +# def build_requirements(self): +# self.tool_requires("cmake/3.26.0") diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt new file mode 100644 index 0000000..6a69ebb --- /dev/null +++ b/src/tests/CMakeLists.txt @@ -0,0 +1,18 @@ + +set( MODULE_NAME ${CMAKE_PROJECT_NAME}.unit.tests) + +project(${MODULE_NAME} VERSION 1.0.0 LANGUAGES CXX C) + +file(GLOB_RECURSE UnitTests_Src + *.cpp + *.h +) + +include_directories(${CONAN_INCLUDE_DIRS}) + +add_executable(${MODULE_NAME} WIN32 ${UnitTests_Src} ) +set_target_properties(${MODULE_NAME} PROPERTIES LINK_FLAGS "/SUBSYSTEM:CONSOLE" ) +target_precompile_headers(${MODULE_NAME} PRIVATE stdafx.h) +target_link_libraries( ${MODULE_NAME} Boost::unit_test_framework ) +#target_link_libraries( ${MODULE_NAME} Boost ) +#target_link_libraries(timer ${CONAN_LIBS}) diff --git a/src/tests/main.cpp b/src/tests/main.cpp new file mode 100644 index 0000000..6aa71bc --- /dev/null +++ b/src/tests/main.cpp @@ -0,0 +1,31 @@ +//#define BOOST_TEST_MODULE MyTest +//#include +//#include + +//BOOST_AUTO_TEST_CASE( my_test ) +//{ +// BOOST_CHECK( false ); +//} + +#define BOOST_TEST_MODULE PoltavaUnitTests +#include + +BOOST_AUTO_TEST_CASE( TestCase_1 ) +{ + BOOST_TEST( true ); +} + +BOOST_AUTO_TEST_CASE( TestCase_2 ) +{ + BOOST_TEST( true ); +} + +/* +int main(int argc, const char* argv[]) +{ + std::cout << "This is placeholder project for unit tests.\n"; + + return 0; +} +*/ \ No newline at end of file diff --git a/src/tests/stdafx.h b/src/tests/stdafx.h new file mode 100644 index 0000000..505da94 --- /dev/null +++ b/src/tests/stdafx.h @@ -0,0 +1,2 @@ + +#include