Skip to content

Commit

Permalink
Support MSVC architectures
Browse files Browse the repository at this point in the history
  • Loading branch information
ssrobins committed Jul 18, 2023
1 parent 2a5625b commit 8fc6170
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 4 deletions.
8 changes: 4 additions & 4 deletions conan_provider.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ endfunction()


function(detect_arch ARCH)
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|arm64")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64|arm64" OR CMAKE_GENERATOR_PLATFORM STREQUAL ARM64)
set(_ARCH armv8)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv7-a|armv7l")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "armv7-a|armv7l" OR CMAKE_GENERATOR_PLATFORM STREQUAL ARM)
set(_ARCH armv7)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686" OR CMAKE_GENERATOR_PLATFORM STREQUAL Win32)
set(_ARCH x86)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64|amd64|x86_64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "AMD64|amd64|x86_64" OR CMAKE_GENERATOR_PLATFORM STREQUAL x64)
set(_ARCH x86_64)
endif()
message(STATUS "CMake-Conan: cmake_system_processor=${_ARCH}")
Expand Down
30 changes: 30 additions & 0 deletions tests/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -242,3 +242,33 @@ def test_android_x86(self, capfd, chdir_build):
assert "os=Android" in out
assert "os.api_level=19" in out
assert "tools.android:ndk_path=" in out

class TestMSVCArch:
@pytest.fixture(scope="class", autouse=True)
def android_setup(self):
shutil.rmtree("build")
yield

@windows
def test_msvc_arm64(self, capfd, chdir_build):
run('cmake .. --fresh -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake -G "Visual Studio 16 2019" -A ARM64')
out, _ = capfd.readouterr()
assert "arch=armv8" in out

@windows
def test_msvc_arm(self, capfd, chdir_build):
run('cmake .. --fresh -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake -G "Visual Studio 16 2019" -A ARM')
out, _ = capfd.readouterr()
assert "arch=armv7" in out

@windows
def test_msvc_x86_64(self, capfd, chdir_build):
run('cmake .. --fresh -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake -G "Visual Studio 16 2019" -A x64')
out, _ = capfd.readouterr()
assert "arch=x86_64" in out

@windows
def test_msvc_x86(self, capfd, chdir_build):
run('cmake .. --fresh -DCMAKE_PROJECT_TOP_LEVEL_INCLUDES=conan_provider.cmake -G "Visual Studio 16 2019" -A Win32')
out, _ = capfd.readouterr()
assert "arch=x86" in out

0 comments on commit 8fc6170

Please sign in to comment.