diff --git a/.github/actions/install-boost-python/action.yml b/.github/actions/install-boost-python/action.yml index 5d339fd..7390b22 100644 --- a/.github/actions/install-boost-python/action.yml +++ b/.github/actions/install-boost-python/action.yml @@ -2,11 +2,11 @@ name: install-boost description: "Install Boost " inputs: - platform: - description: "Indicate the identifier of the platform" - python: - description: "Path to python executable" + description: "Python version targeted" + + path: + description: "Path to install CMake config into" runs: using: composite @@ -14,56 +14,52 @@ runs: - name: Install conan shell: bash run: | - python3 -m pip install conan==1.* - conan profile new default --detect - conan profile show default - - - name: Setup compiler (Linux only) - shell: bash - if: ${{ inputs.platform == 'ubuntu' }} - run: | - conan profile update settings.compiler.libcxx=libstdc++11 default - conan profile show default + python3 -m pip install --upgrade pip + python3 -m pip install conan==2.* + conan profile detect + conan profile show - name: Install numpy shell: bash # For some reason, boost python cannot be installed without numpy # https://github.com/conan-io/conan-center-index/issues/10953 - run: ${{ inputs.python }} -m pip install numpy + run: python3 -m pip install numpy==1.* - name: Install Boost Python + working-directory: ${{ inputs.path }} shell: bash run: | - conan install boost/1.80.0@ \ - --options=boost:without_python=False \ - --options=boost:without_atomic=True \ - --options=boost:without_chrono=True \ - --options=boost:without_container=True \ - --options=boost:without_context=True \ - --options=boost:without_contract=True \ - --options=boost:without_coroutine=True \ - --options=boost:without_date_time=True \ - --options=boost:without_exception=True \ - --options=boost:without_fiber=True \ - --options=boost:without_filesystem=True \ - --options=boost:without_graph=True \ - --options=boost:without_iostreams=True \ - --options=boost:without_json=True \ - --options=boost:without_locale=True \ - --options=boost:without_log=True \ - --options=boost:without_math=True \ - --options=boost:without_nowide=True \ - --options=boost:without_program_options=True \ - --options=boost:without_random=True \ - --options=boost:without_regex=True \ - --options=boost:without_serialization=True \ - --options=boost:without_stacktrace=True \ - --options=boost:without_system=True \ - --options=boost:without_test=True \ - --options=boost:without_thread=True \ - --options=boost:without_timer=True \ - --options=boost:without_type_erasure=True \ - --options=boost:without_wave=True \ - --options=boost:python_executable=${{ inputs.python }} \ - --generator=cmake_find_package \ + conan install \ + --requires boost/1.85.0@ \ + --options=boost/*:without_python=False \ + --options=boost/*:without_atomic=True \ + --options=boost/*:without_chrono=True \ + --options=boost/*:without_container=True \ + --options=boost/*:without_context=True \ + --options=boost/*:without_contract=True \ + --options=boost/*:without_coroutine=True \ + --options=boost/*:without_date_time=True \ + --options=boost/*:without_exception=True \ + --options=boost/*:without_fiber=True \ + --options=boost/*:without_filesystem=True \ + --options=boost/*:without_graph=True \ + --options=boost/*:without_iostreams=True \ + --options=boost/*:without_json=True \ + --options=boost/*:without_locale=True \ + --options=boost/*:without_log=True \ + --options=boost/*:without_math=True \ + --options=boost/*:without_nowide=True \ + --options=boost/*:without_program_options=True \ + --options=boost/*:without_random=True \ + --options=boost/*:without_regex=True \ + --options=boost/*:without_serialization=True \ + --options=boost/*:without_stacktrace=True \ + --options=boost/*:without_system=False \ + --options=boost/*:without_test=True \ + --options=boost/*:without_thread=True \ + --options=boost/*:without_timer=True \ + --options=boost/*:without_type_erasure=True \ + --options=boost/*:without_wave=True \ + --options=boost/*:python_version=${{ inputs.python }} \ + --generator=CMakeDeps \ --build=missing diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index d1ea1d0..ea81c2e 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,16 +56,21 @@ jobs: - name: Install Boost Python uses: ./.github/actions/install-boost-python with: - platform: ${{ matrix.os }} - python: $(which python) + python: ${{ matrix.python }} + path: ${{ runner.temp }} - name: Install pytest + pytest-cmake - run: pip install . pytest==${{ matrix.pytest }}.* + run: python3 -m pip install . pytest==${{ matrix.pytest }}.* - name: Build Example + shell: bash run: | cmake --version - cmake -D "CMAKE_MODULE_PATH:FILEPATH=${{ github.workspace }}" -S ./example -B ./build + cmake \ + -D "CMAKE_BUILD_TYPE=Release" \ + -D "Boost_ROOT=${{ runner.temp }}" \ + -S ./example \ + -B ./build cmake --build ./build --config Release - name: Run Tests diff --git a/example/CMakeLists.txt b/example/CMakeLists.txt index 32a99b9..5af628f 100644 --- a/example/CMakeLists.txt +++ b/example/CMakeLists.txt @@ -2,17 +2,19 @@ cmake_minimum_required(VERSION 3.20) project(Example) -find_package(Python COMPONENTS Interpreter Development REQUIRED) -set(_py_version ${Python_VERSION_MAJOR}${Python_VERSION_MINOR}) -mark_as_advanced(_py_version) +if (NOT "${CMAKE_CXX_STANDARD}") + set(CMAKE_CXX_STANDARD 17 CACHE STRING "Default C++ standard") +endif() if (WIN32) set(CMAKE_WINDOWS_EXPORT_ALL_SYMBOLS TRUE) endif() -find_package(Boost 1.70.0 COMPONENTS "python${_py_version}" REQUIRED) +find_package(Python COMPONENTS Interpreter Development REQUIRED) +find_package(Boost 1.70.0 REQUIRED) if (NOT TARGET Boost::python) + set(_py_version ${Python_VERSION_MAJOR}${Python_VERSION_MINOR}) add_library(Boost::python ALIAS "Boost::python${_py_version}") endif()