update vcpkg to get the arm64 compatible packages

This commit is contained in:
Marek Roszko 2023-03-04 18:34:23 -05:00
parent 65818bd4a3
commit b4bb1f4b46
8 changed files with 217 additions and 64 deletions

View File

@ -54,6 +54,7 @@ set( CMAKE_EXPORT_COMPILE_COMMANDS ON )
set( KICAD_CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" )
set( CMAKE_MODULE_PATH "${KICAD_CMAKE_MODULE_PATH}" )
include( ConfigurePlatform )
# Create a flag to identify the non-Apple unix systems
if( UNIX AND NOT APPLE )
@ -303,37 +304,6 @@ if( WIN32 )
# _USE_MATH_DEFINES is set.
add_compile_definitions( _USE_MATH_DEFINES )
# Used for the resource compiler and other arch dependent steps
if( MSVC )
# CMake does not set CMAKE_SYSTEM_PROCESSOR correctly for MSVC
# and it will always return the host instead of the target arch
if("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM64")
set( KICAD_BUILD_ARCH "arm64" )
set( KICAD_BUILD_ARCH_ARM64 1 )
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM")
set( KICAD_BUILD_ARCH "arm" )
set( KICAD_BUILD_ARCH_ARM 1 )
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "X86")
set( KICAD_BUILD_ARCH "x86" )
set( KICAD_BUILD_ARCH_X86 1 )
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "x64")
set( KICAD_BUILD_ARCH "x64" )
set( KICAD_BUILD_ARCH_X64 1 )
else()
message(FATAL_ERROR "Failed to determine the MSVC target architecture: ${MSVC_C_ARCHITECTURE_ID}")
endif()
else()
if ( NOT CMAKE_SIZEOF_VOID_P EQUAL 8 )
set( KICAD_BUILD_ARCH "x86" )
set( KICAD_BUILD_ARCH_X86 1 )
elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set( KICAD_BUILD_ARCH "x64" )
set( KICAD_BUILD_ARCH_X64 1 )
endif()
endif()
add_compile_definitions( KICAD_BUILD_ARCH=${KICAD_BUILD_ARCH} )
add_compile_definitions( $<$<BOOL:${KICAD_WIN32_DPI_AWARE}>:KICAD_WIN32_DPI_AWARE=1> )
endif()
@ -884,7 +854,7 @@ check_find_package_result( PYTHONINTERP_FOUND "Python Interpreter" )
# Get the correct Python site package install path from the Python interpreter found by
# FindPythonInterp unless the user specifically defined a custom path.
if( NOT PYTHON_SITE_PACKAGE_PATH )
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import distutils.sysconfig;print(\"%s\"%distutils.sysconfig.get_python_lib(plat_specific=0, standard_lib=0, prefix=''))"
execute_process( COMMAND ${PYTHON_EXECUTABLE} -c "import sysconfig;print(\"%s\"%sysconfig.get_path('purelib'))"
OUTPUT_VARIABLE PYTHON_SITE_PACKAGE_PATH
OUTPUT_STRIP_TRAILING_WHITESPACE
)
@ -939,15 +909,18 @@ set( INC_AFTER ${INC_AFTER} ${PYTHON_INCLUDE_DIRS} ${CMAKE_CURRENT_SOURCE_DIR}/s
if( KICAD_SCRIPTING_WXPYTHON )
# Find the wxPython installation
find_package( wxPython REQUIRED )
if( NOT VCPKG_TOOLCHAIN AND NOT KICAD_BUILD_ARCH_ARM64 )
find_package( wxPython REQUIRED )
if( WXPYTHON_VERSION VERSION_LESS 4.0.0 )
message( FATAL_ERROR "wxPython Phoenix is required" )
if( WXPYTHON_VERSION VERSION_LESS 4.0.0 )
message( FATAL_ERROR "wxPython Phoenix is required" )
endif()
if( WXPYTHON_WXVERSION VERSION_LESS 3.2.0 )
message( FATAL_ERROR "wxWidgets 3.2.0 or greater is required" )
endif()
endif()
if( WXPYTHON_WXVERSION VERSION_LESS 3.2.0 )
message( FATAL_ERROR "wxWidgets 3.2.0 or greater is required" )
endif()
endif()
# GTK3 is required on Linux

View File

@ -0,0 +1,102 @@
if( MSVC )
cmake_policy( SET CMP0091 NEW )
# CMake does not set CMAKE_SYSTEM_PROCESSOR correctly for MSVC
# and it will always return the host instead of the target arch
if("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM64")
set( KICAD_BUILD_ARCH "arm64" )
set( KICAD_BUILD_ARCH_ARM64 1 )
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "ARM")
set( KICAD_BUILD_ARCH "arm" )
set( KICAD_BUILD_ARCH_ARM 1 )
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "X86")
set( KICAD_BUILD_ARCH "x86" )
set( KICAD_BUILD_ARCH_X86 1 )
elseif("${MSVC_C_ARCHITECTURE_ID}" STREQUAL "x64")
set( KICAD_BUILD_ARCH "x64" )
set( KICAD_BUILD_ARCH_X64 1 )
else()
message(FATAL_ERROR "Failed to determine the MSVC target architecture: ${MSVC_C_ARCHITECTURE_ID}")
endif()
add_compile_definitions( KICAD_BUILD_ARCH=${KICAD_BUILD_ARCH} )
# CMake does not set CMAKE_SYSTEM_PROCESSOR correctly for MSVC
# and it will always return the host instead of the target arch
if("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "ARM64")
set( KICAD_HOST_ARCH "arm64" )
set( KICAD_HOST_ARCH_ARM64 1 )
elseif("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "ARM")
set( KICAD_HOST_ARCH "arm" )
set( KICAD_HOST_ARCH_ARM 1 )
elseif("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "X86")
set( KICAD_HOST_ARCH "x86" )
set( KICAD_HOST_ARCH_X86 1 )
elseif("${CMAKE_HOST_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
set( KICAD_HOST_ARCH "x64" )
set( KICAD_HOST_ARCH_X64 1 )
else()
message(FATAL_ERROR "Failed to determine the host architecture: ${CMAKE_SYSTEM_PROCESSOR}")
endif()
else()
if ( NOT CMAKE_SIZEOF_VOID_P EQUAL 8 )
set( KICAD_BUILD_ARCH "x86" )
set( KICAD_BUILD_ARCH_X86 1 )
elseif( CMAKE_SIZEOF_VOID_P EQUAL 8 )
set( KICAD_BUILD_ARCH "x64" )
set( KICAD_BUILD_ARCH_X64 1 )
endif()
endif()
if( MSVC )
# This is a workaround borrowed from https://github.com/dotnet/runtime/blob/main/eng/native/configurecompiler.cmake
# CMake currently cannot handle the fact that "armasm" is used in combination with standard MSVC "cl" for ARM targets
# So this is basically a hack (incombination with the MSVCAssemblyHelper.cmake) to make this all work
if(KICAD_BUILD_ARCH_ARM)
message( "Configuring ARM assembler" )
# Explicitly specify the assembler to be used for Arm32 compile
file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}\\bin\\HostX86\\arm\\armasm.exe" CMAKE_ASM_COMPILER)
set(CMAKE_ASM_MASM_COMPILER ${CMAKE_ASM_COMPILER})
message("CMAKE_ASM_MASM_COMPILER explicitly set to: ${CMAKE_ASM_MASM_COMPILER}")
# Enable generic assembly compilation to avoid CMake generate VS proj files that explicitly
# use ml[64].exe as the assembler.
enable_language(ASM)
set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "")
set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL "")
set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug "")
set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -g <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")
elseif(KICAD_BUILD_ARCH_ARM64)
message( "Configuring ARM64 assembler" )
# Explicitly specify the assembler to be used for Arm64 compile
file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}\\bin\\HostX86\\arm64\\armasm64.exe" CMAKE_ASM_COMPILER)
set(CMAKE_ASM_MASM_COMPILER ${CMAKE_ASM_COMPILER})
message("CMAKE_ASM_MASM_COMPILER explicitly set to: ${CMAKE_ASM_MASM_COMPILER}")
# Enable generic assembly compilation to avoid CMake generate VS proj files that explicitly
# use ml[64].exe as the assembler.
enable_language(ASM)
set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "")
set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL "")
set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug "")
set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "")
set(CMAKE_ASM_COMPILE_OBJECT "<CMAKE_ASM_COMPILER> -g <INCLUDES> <FLAGS> -o <OBJECT> <SOURCE>")
else()
message( "Configuring MASM assembler" )
if(KICAD_BUILD_ARCH_X86)
set( CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /safeseh" )
endif()
enable_language(ASM_MASM)
set(CMAKE_ASM_MASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "")
set(CMAKE_ASM_MASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL "")
set(CMAKE_ASM_MASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug "")
set(CMAKE_ASM_MASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "")
endif()
endif()

View File

@ -76,11 +76,26 @@ if( ${PYTHON_ROOT_DIR} )
PATHS ${PYTHON_ROOT_DIR}
NO_DEFAULT_PATH )
elseif(VCPKG_TOOLCHAIN)
# this is a hack for arm64 builds for now
# the main problem being nobody seems to actually cross-compile kicad
# and insteads compiles it painfully on slow hardware
set(INTERP_TRIPLET "${VCPKG_TARGET_TRIPLET}")
if(${VCPKG_TARGET_TRIPLET} STREQUAL "arm64-windows")
set(INTERP_TRIPLET "x64-windows")
endif()
# Our VCPKG usage will always place it in a known location
find_program(PYTHON_EXECUTABLE
NAMES ${_Python_NAMES}
PATHS "${VCPKG_INSTALLED_DIR}/${VCPKG_TARGET_TRIPLET}/tools/python3"
PATHS "${VCPKG_INSTALLED_DIR}/${INTERP_TRIPLET}/tools/python3"
NO_DEFAULT_PATH
NO_PACKAGE_ROOT_PATH
NO_CMAKE_PATH
NO_CMAKE_ENVIRONMENT_PATH
NO_CMAKE_SYSTEM_PATH
NO_SYSTEM_ENVIRONMENT_PATH
)
else()
# If there is no specific path given, look for python in the path
find_program(PYTHON_EXECUTABLE NAMES ${_Python_NAMES})

View File

@ -0,0 +1,51 @@
# compile_asm(TARGET target ASM_FILES file1 [file2 ...] OUTPUT_OBJECTS [variableName])
# CMake does not support the ARM or ARM64 assemblers on Windows when using the
# MSBuild generator. When the MSBuild generator is in use, we manually compile the assembly files
# using this function.
#
# Borrowed from dotnet/runtime, licensed under MIT
# Copyright (c) .NET Foundation and Contributors
# https://github.com/dotnet/runtime/blob/main/eng/native/functions.cmake
function(compile_asm)
set(options "")
set(oneValueArgs TARGET OUTPUT_OBJECTS)
set(multiValueArgs ASM_FILES)
cmake_parse_arguments(COMPILE_ASM "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGV})
get_include_directories_asm(ASM_INCLUDE_DIRECTORIES)
set (ASSEMBLED_OBJECTS "")
foreach(ASM_FILE ${COMPILE_ASM_ASM_FILES})
get_filename_component(name ${ASM_FILE} NAME_WE)
# Produce object file where CMake would store .obj files for an OBJECT library.
# ex: artifacts\obj\coreclr\windows.arm64.Debug\src\vm\wks\cee_wks.dir\Debug\AsmHelpers.obj
set (OBJ_FILE "${CMAKE_CURRENT_BINARY_DIR}/${COMPILE_ASM_TARGET}.dir/${CMAKE_CFG_INTDIR}/${name}.obj")
# Need to compile asm file using custom command as include directories are not provided to asm compiler
add_custom_command(OUTPUT ${OBJ_FILE}
COMMAND "${CMAKE_ASM_COMPILER}" -g ${ASM_INCLUDE_DIRECTORIES} -o ${OBJ_FILE} ${ASM_FILE}
DEPENDS ${ASM_FILE}
COMMENT "Assembling ${ASM_FILE} ---> \"${CMAKE_ASM_COMPILER}\" -g ${ASM_INCLUDE_DIRECTORIES} -o ${OBJ_FILE} ${ASM_FILE}")
# mark obj as source that does not require compile
set_source_files_properties(${OBJ_FILE} PROPERTIES EXTERNAL_OBJECT TRUE)
# Add the generated OBJ in the dependency list so that it gets consumed during linkage
list(APPEND ASSEMBLED_OBJECTS ${OBJ_FILE})
endforeach()
set(${COMPILE_ASM_OUTPUT_OBJECTS} ${ASSEMBLED_OBJECTS} PARENT_SCOPE)
endfunction()
# Build a list of include directories for consumption by the assembler
function(get_include_directories_asm IncludeDirectories)
get_directory_property(dirs INCLUDE_DIRECTORIES)
foreach(dir IN LISTS dirs)
list(APPEND INC_DIRECTORIES -I${dir};)
endforeach()
set(${IncludeDirectories} ${INC_DIRECTORIES} PARENT_SCOPE)
endfunction(get_include_directories_asm)

View File

@ -14,30 +14,34 @@ list(APPEND LIBCONTEXT_SOURCES
)
if( MSVC )
if( KICAD_BUILD_ARCH_ARM64 )
enable_language(ASM_ARMASM)
else()
enable_language(ASM_MASM)
endif()
if( NOT LIBCONTEXT_USE_WINFIBER )
include( MSVCAssemblyHelper )
if ( KICAD_BUILD_ARCH_X86 )
set( CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /safeseh" )
list(APPEND LIBCONTEXT_SOURCES
make_i386_ms_pe_masm.asm
jump_i386_ms_pe_masm.asm
list(APPEND LIBCONTEXT_ASM_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/make_i386_ms_pe_masm.asm
${CMAKE_CURRENT_SOURCE_DIR}/jump_i386_ms_pe_masm.asm
)
elseif( KICAD_BUILD_ARCH_X64 )
list(APPEND LIBCONTEXT_SOURCES
make_x86_64_ms_pe_masm.asm
jump_x86_64_ms_pe_masm.asm
list(APPEND LIBCONTEXT_ASM_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/make_x86_64_ms_pe_masm.asm
${CMAKE_CURRENT_SOURCE_DIR}/jump_x86_64_ms_pe_masm.asm
)
elseif( KICAD_BUILD_ARCH_ARM64 )
list(APPEND LIBCONTEXT_SOURCES
make_arm64_aapcs_pe_armasm.asm
jump_arm64_aapcs_pe_armasm.asm
list(APPEND LIBCONTEXT_ASM_SOURCES
${CMAKE_CURRENT_SOURCE_DIR}/make_arm64_aapcs_pe_armasm.asm
${CMAKE_CURRENT_SOURCE_DIR}/jump_arm64_aapcs_pe_armasm.asm
)
endif()
if( KICAD_BUILD_ARCH_ARM64 )
# ARM64 needs to use the compile_asm workaround
compile_asm( TARGET libcontext ASM_FILES ${LIBCONTEXT_ASM_SOURCES} OUTPUT_OBJECTS ASM_SOURCES_OBJECTS )
list(APPEND LIBCONTEXT_SOURCES ${ASM_SOURCES_OBJECTS})
else()
list(APPEND LIBCONTEXT_SOURCES ${LIBCONTEXT_ASM_SOURCES})
endif()
else()
add_compile_definitions(LIBCONTEXT_USE_WINFIBER)
endif()

View File

@ -16,7 +16,7 @@ unset(_SENTRY_HEADER_CONTENT)
unset(_SENTRY_VERSION_MATCH)
project(Sentry-Native
LANGUAGES C CXX ASM
LANGUAGES C CXX
VERSION ${SENTRY_VERSION}
)

View File

@ -3,14 +3,21 @@
"default-registry": {
"kind": "git",
"repository": "https://github.com/microsoft/vcpkg",
"baseline": "36fb23307e10cc6ffcec566c46c4bb3f567c82c6"
"baseline": "9cf4835a54ef1c78f12789859e2730ced29d23ce"
},
"registries": [
{
"kind": "git",
"repository": "https://gitlab.com/kicad/packaging/kicad-vcpkg-registry.git",
"baseline": "a5f6c93d41190d8dd011553c9f5df0dbaf8387a0",
"packages": [ "python3", "wxpython", "wxwidgets", "ngspice" ]
"baseline": "d3633f1c1ff519106a6f443532b9f562a421f5ea",
"packages": [
"glew",
"python3",
"opencascade",
"wxpython",
"wxwidgets",
"ngspice"
]
}
]
}

View File

@ -11,7 +11,8 @@
"curl",
{
"name": "gettext",
"features": [ "tools" ]
"features": [ "tools" ],
"host": true
},
"harfbuzz",
"glm",
@ -26,19 +27,19 @@
"overrides": [
{
"name": "python3",
"version": "3.9.14"
"version": "3.11.2"
},
{
"name": "wxwidgets",
"version": "3.2.2#0"
"version": "3.2.2#1"
},
{
"name": "wxpython",
"version": "4.2.0#4"
"version": "4.2.0#9"
},
{
"name": "ngspice",
"version": "39"
"version": "39#1"
}
]
}