Skip to content

Commit 411cdae

Browse files
committed
Linux Fixes
1 parent e599ad0 commit 411cdae

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

cppython/plugins/conan/plugin.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,12 @@ def _create_cmake_sync_data(self) -> CMakeSyncData:
283283
Returns:
284284
CMakeSyncData configured for Conan integration
285285
"""
286-
# With tools.cmake.cmake_layout:build_folder=. and --output-folder=build_path,
287-
# generators are placed directly in build_path/generators/
288-
conan_toolchain_path = self.core_data.cppython_data.build_path / 'generators' / 'conan_toolchain.cmake'
286+
# With cmake_layout, Conan creates a subfolder for each build type.
287+
# Use the first build type for the toolchain path.
288+
build_type = self.data.build_types[0] if self.data.build_types else 'Release'
289+
conan_toolchain_path = (
290+
self.core_data.cppython_data.build_path / build_type / 'generators' / 'conan_toolchain.cmake'
291+
)
289292

290293
return CMakeSyncData(
291294
provider_name=TypeName('conan'),

tests/integration/examples/test_conan_cmake.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
from pathlib import Path
1212
from tomllib import loads
1313

14+
import pytest
1415
from typer.testing import CliRunner
1516

1617
from cppython.build import build_wheel
@@ -20,6 +21,11 @@
2021

2122
pytest_plugins = ['tests.fixtures.example', 'tests.fixtures.conan', 'tests.fixtures.cmake']
2223

24+
# C++20 modules require Ninja or Visual Studio generator, not Unix Makefiles
25+
_skip_modules_test = pytest.mark.skipif(
26+
sys.platform != 'win32', reason='C++20 modules require Ninja or Visual Studio generator, not Unix Makefiles.'
27+
)
28+
2329

2430
class TestConanCMake:
2531
"""Test project variation of conan and CMake"""
@@ -47,7 +53,7 @@ def _run_cmake_configure(cmake_binary: str) -> None:
4753
Args:
4854
cmake_binary: Path or command name for the CMake binary to use
4955
"""
50-
result = subprocess.run([cmake_binary, '--preset=default'], capture_output=True, text=True, check=False)
56+
result = subprocess.run([cmake_binary, '--preset=default-release'], capture_output=True, text=True, check=False)
5157
assert result.returncode == 0, f'CMake configuration failed: {result.stderr}'
5258

5359
@staticmethod
@@ -108,6 +114,7 @@ def test_simple(example_runner: CliRunner) -> None:
108114
publish_project.publish()
109115

110116
@staticmethod
117+
@_skip_modules_test
111118
def test_library(example_runner: CliRunner) -> None:
112119
"""Test library creation and packaging workflow"""
113120
# Read cmake_binary from the current pyproject.toml (we're in the example directory)

0 commit comments

Comments
 (0)