Skip to content

Commit

Permalink
Merge pull request #756 from vsbogd/conan2
Browse files Browse the repository at this point in the history
Migrate to Conan2
  • Loading branch information
vsbogd authored Jul 31, 2024
2 parents d40a62b + e2d0c83 commit 43b7230
Show file tree
Hide file tree
Showing 17 changed files with 726 additions and 55 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci-auto.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ jobs:
with:
python-version: "3.7"
os: "ubuntu-20.04"
cmake-version: "3.19.x"
cmake-version: "3.24.x"
2 changes: 1 addition & 1 deletion .github/workflows/ci-manual.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
cmake-version:
description: 'JSON array of CMake versions to be checked'
required: true
default: "[\"3.19.x\"]"
default: "[\"3.24.x\"]"
type: string

jobs:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/common.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ on:
type: string
cmake-version:
description: "CMake version to use"
default: "3.19.x"
default: "3.24.x"
required: false
type: string

Expand Down Expand Up @@ -69,11 +69,11 @@ jobs:
- name: Install Conan
uses: turtlebrowser/[email protected]
with:
version: "1.64"
version: "2.5.0"

- name: Setup Conan profile
run: |
conan profile new --detect default
conan profile detect --force
- name: Print environment
run: |
Expand All @@ -97,8 +97,8 @@ jobs:
echo "conan Python: $conan_python"
echo -n "conan Python platform: "
$conan_python -c "import platform; print(platform.platform())"
echo "conan profile show default"
conan profile show default
echo "conan profile show"
conan profile show
echo "gcc --version"
gcc --version
echo "g++ --version"
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/old_interpreter.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,16 @@ jobs:
- name: Install CMake
uses: jwlawson/[email protected]
with:
cmake-version: "3.19.x"
cmake-version: "3.24.x"

- name: Install Conan
uses: turtlebrowser/[email protected]
with:
version: "1.64"
version: "2.5.0"

- name: Setup Conan profile
run: |
conan profile new --detect default
conan profile detect --force
- name: Print environment
run: |
Expand All @@ -87,8 +87,8 @@ jobs:
echo "conan Python: $conan_python"
echo -n "conan Python platform: "
$conan_python -c "import platform; print(platform.platform())"
echo "conan profile show default"
conan profile show default
echo "conan profile show"
conan profile show
echo "gcc --version"
gcc --version
echo "g++ --version"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ Cargo.lock
.vscode
.aider*
__pycache__
CMakeUserPresets.json
/build
/python/hyperon.egg-info
/python/dist
Expand Down
4 changes: 3 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Minimal version supported by hyperonc
cmake_minimum_required(VERSION 3.19)
cmake_minimum_required(VERSION 3.24)

project(hyperon)

Expand All @@ -22,6 +22,7 @@ ExternalProject_Add(
"-DCMAKE_INSTALL_PREFIX=${HYPERONC_INSTALL_PREFIX}"
"-DCMAKE_BUILD_TYPE=${BUILD_CONFIGURATION}"
"-DCARGO_ARGS=${CARGO_ARGS}"
"-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=${CMAKE_CURRENT_SOURCE_DIR}/conan_provider.cmake"
)

ExternalProject_Get_Property(hyperonc BINARY_DIR)
Expand All @@ -38,6 +39,7 @@ ExternalProject_Add(
"-DHYPERONC_INSTALL_PREFIX=${HYPERONC_INSTALL_PREFIX}"
"-DCMAKE_LIBRARY_OUTPUT_DIRECTORY=${CMAKE_CURRENT_SOURCE_DIR}/python"
"-DCMAKE_BUILD_TYPE=${BUILD_CONFIGURATION}"
"-DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=${CMAKE_CURRENT_SOURCE_DIR}/conan_provider.cmake"
INSTALL_COMMAND cmake -E echo "Skipping install step."
)

Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,9 @@ RUN sh /tmp/rustup.sh -y && rm /tmp/rustup.sh
ENV PATH="${PATH}:${HOME}/.cargo/bin"
RUN cargo install cbindgen

RUN python3 -m pip install conan==1.64 pip==23.1.2
RUN python3 -m pip install conan==2.5.0 pip==23.1.2
ENV PATH="${PATH}:${HOME}/.local/bin"
RUN conan profile new --detect default
RUN conan profile detect --force

ADD --chown=user:users . ${HOME}/hyperon-experimental

Expand Down
18 changes: 8 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ Rust (see the Notes at the installation page).
* Python3 and Python3-dev (3.7 or later)
* Pip (23.1.2 or later)
* GCC (7.5 or later)
* CMake (3.19 or later)
* CMake (3.24 or later)

To support Git based modules (enabled by default):
* OpenSSL library
Expand All @@ -99,8 +99,8 @@ cargo install --force cbindgen

* Install Conan and make default Conan profile:
```
python3 -m pip install conan==1.64
conan profile new --detect default
python3 -m pip install conan==2.5.0
conan profile detect --force
```

* Upgrade Pip to the required version:
Expand Down Expand Up @@ -233,21 +233,19 @@ If you see the following `cmake` output:
```
ERROR: Not able to automatically detect '/usr/bin/cc' version
ERROR: Unable to find a working compiler
WARN: Remotes registry file missing, creating default one in /root/.conan/remotes.json
ERROR: libcheck/0.15.2: 'settings.compiler' value not defined
```
Try to create the default Conan profile manually:
```
conan profile new --detect default
conan profile detect --force
```
If it doesn't help, then try to manually add `compiler`, `compiler.version` and
`compiler.libcxx` values in the default Conan profile
(`~/.conan/profiles/default`).
(`~/.conan2/profiles/default`).
For example:
```
conan profile update settings.compiler=gcc default
conan profile update settings.compiler.version=7 default
conan profile update settings.compiler.libcxx=libstdc++ default
compiler=gcc
compiler.version=7
compiler.libcxx=libstdc++
```

### Rust compiler shows errors
Expand Down
8 changes: 0 additions & 8 deletions c/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,6 @@ enable_testing()
option(BUILD_SHARED_LIBS "Build shared library" ON)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure)

execute_process(
# --build is required to build dependencies from source under cibuildwheel
# environment
COMMAND cmake -E env CC= CXX= conan install --build -pr:b default -pr:h default -- ${CMAKE_CURRENT_SOURCE_DIR}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
include(${CMAKE_CURRENT_BINARY_DIR}/conanbuildinfo.cmake)
conan_basic_setup(TARGETS)

# HYPERONC_TARGET_DIR is used as a target dir for cargo. Cargo automatically adds
# `debug/release` suffix to the value of --target-dir argument so we need to
# calculate actual path to compiled library using $<CONFIG:...> cmake generator
Expand Down
5 changes: 3 additions & 2 deletions c/conanfile.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
libcheck/0.15.2

[generators]
cmake
CMakeDeps
CMakeToolchain

[options]
libcheck:with_subunit=False
libcheck/*:with_subunit=False
12 changes: 7 additions & 5 deletions c/tests/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
find_package(check REQUIRED)

set(TEST_SOURCES
test.c
int_gnd.c
Expand All @@ -6,21 +8,21 @@ set(TEST_SOURCES
)

add_executable(check_atom check_atom.c ${TEST_SOURCES})
target_link_libraries(check_atom hyperonc-shared CONAN_PKG::libcheck)
target_link_libraries(check_atom hyperonc-shared Check::check)
add_test(NAME check_atom COMMAND check_atom)

add_executable(check_space check_space.c ${TEST_SOURCES})
target_link_libraries(check_space hyperonc-shared CONAN_PKG::libcheck)
target_link_libraries(check_space hyperonc-shared Check::check)
add_test(NAME check_space COMMAND check_space)

add_executable(check_sexpr_parser check_sexpr_parser.c ${TEST_SOURCES})
target_link_libraries(check_sexpr_parser hyperonc-shared CONAN_PKG::libcheck)
target_link_libraries(check_sexpr_parser hyperonc-shared Check::check)
add_test(NAME check_sexpr_parser COMMAND check_sexpr_parser)

add_executable(check_types check_types.c ${TEST_SOURCES})
target_link_libraries(check_types hyperonc-shared CONAN_PKG::libcheck)
target_link_libraries(check_types hyperonc-shared Check::check)
add_test(NAME check_types COMMAND check_types)

add_executable(check_runner check_runner.c ${TEST_SOURCES})
target_link_libraries(check_runner hyperonc-shared CONAN_PKG::libcheck)
target_link_libraries(check_runner hyperonc-shared Check::check)
add_test(NAME check_runner COMMAND check_runner)
Loading

0 comments on commit 43b7230

Please sign in to comment.