mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-09 23:34:20 +00:00
CMake: Improve Windows Arm architecture detection
This commit is contained in:
parent
cba00cc71f
commit
9e193862c1
6 changed files with 103 additions and 56 deletions
|
|
@ -62,7 +62,11 @@ function(_juce_find_target_architecture result)
|
|||
set("${result}" "${match_result}" PARENT_SCOPE)
|
||||
endfunction()
|
||||
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD") OR MSYS OR MINGW)
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
OR (CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
||||
OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD")
|
||||
OR MSYS
|
||||
OR MINGW)
|
||||
# If you really need to override the detected arch for some reason,
|
||||
# you can configure the build with -DJUCE_TARGET_ARCHITECTURE=<custom arch>
|
||||
if(NOT DEFINED JUCE_TARGET_ARCHITECTURE)
|
||||
|
|
@ -70,6 +74,17 @@ if((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD") O
|
|||
set(JUCE_TARGET_ARCHITECTURE "${target_arch}"
|
||||
CACHE INTERNAL "The target architecture, used to name internal folders in VST3 bundles, and to locate bundled libraries in modules")
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
if ((CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "X86" AND NOT JUCE_TARGET_ARCHITECTURE STREQUAL "i386")
|
||||
OR (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64"
|
||||
AND NOT (JUCE_TARGET_ARCHITECTURE STREQUAL "i386"
|
||||
OR JUCE_TARGET_ARCHITECTURE STREQUAL "x86_64")))
|
||||
set(JUCE_WINDOWS_HELPERS_CAN_RUN FALSE)
|
||||
else()
|
||||
set(JUCE_WINDOWS_HELPERS_CAN_RUN TRUE)
|
||||
endif()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
# ==================================================================================================
|
||||
|
|
@ -270,7 +285,9 @@ function(_juce_get_platform_plugin_kinds out)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
if((CMAKE_SYSTEM_NAME STREQUAL "Darwin" OR CMAKE_SYSTEM_NAME STREQUAL "Windows") AND NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU"))
|
||||
if(NOT (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
|
||||
AND (CMAKE_SYSTEM_NAME STREQUAL "Darwin"
|
||||
OR (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND JUCE_TARGET_ARCHITECTURE STREQUAL "x86_64")))
|
||||
list(APPEND result AAX)
|
||||
endif()
|
||||
|
||||
|
|
|
|||
|
|
@ -851,19 +851,12 @@ endfunction()
|
|||
|
||||
# ==================================================================================================
|
||||
|
||||
function(_juce_create_windows_package source_target dest_target extension default_icon x32folder x64folder)
|
||||
if(NOT CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
return()
|
||||
endif()
|
||||
|
||||
function(_juce_create_windows_package source_target dest_target extension default_icon arch_string)
|
||||
get_target_property(products_folder ${dest_target} LIBRARY_OUTPUT_DIRECTORY)
|
||||
|
||||
set(product_name $<TARGET_PROPERTY:${source_target},JUCE_PRODUCT_NAME>)
|
||||
set(output_folder "${products_folder}/${product_name}.${extension}")
|
||||
|
||||
set(is_x64 $<EQUAL:${CMAKE_SIZEOF_VOID_P},8>)
|
||||
set(arch_string $<IF:${is_x64},${x64folder},${x32folder}>)
|
||||
|
||||
set_target_properties(${dest_target}
|
||||
PROPERTIES
|
||||
PDB_OUTPUT_DIRECTORY "${products_folder}"
|
||||
|
|
@ -1090,6 +1083,13 @@ function(juce_enable_vst3_manifest_step shared_code_target)
|
|||
return()
|
||||
endif()
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND NOT JUCE_WINDOWS_HELPERS_CAN_RUN)
|
||||
message(WARNING "VST3 manifest generation is disabled for ${shared_code_target} because a "
|
||||
"${JUCE_TARGET_ARCHITECTURE} manifest helper cannot run on a host system processor detected to be "
|
||||
"${CMAKE_HOST_SYSTEM_PROCESSOR}.")
|
||||
return()
|
||||
endif()
|
||||
|
||||
set(target_name ${shared_code_target}_VST3)
|
||||
get_target_property(product ${target_name} JUCE_PLUGIN_ARTEFACT_FILE)
|
||||
|
||||
|
|
@ -1102,14 +1102,17 @@ function(juce_enable_vst3_manifest_step shared_code_target)
|
|||
|
||||
get_target_property(target_version_string ${shared_code_target} JUCE_VERSION)
|
||||
|
||||
set(ouput_path "${product}/Contents/Resources/moduleinfo.json")
|
||||
|
||||
# Use the helper tool to write out the moduleinfo.json
|
||||
add_custom_command(TARGET ${target_name} POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E echo "creating ${ouput_path}"
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory "${product}/Contents/Resources"
|
||||
COMMAND juce_vst3_helper
|
||||
-create
|
||||
-version "${target_version_string}"
|
||||
-path "${product}"
|
||||
-output "${product}/Contents/Resources/moduleinfo.json"
|
||||
-output "${ouput_path}"
|
||||
VERBATIM)
|
||||
|
||||
set_target_properties(${shared_code_target} PROPERTIES _JUCE_VST3_MANIFEST_STEP_ADDED TRUE)
|
||||
|
|
@ -1194,7 +1197,21 @@ function(_juce_set_plugin_target_properties shared_code_target kind)
|
|||
XCODE_ATTRIBUTE_LIBRARY_STYLE Bundle
|
||||
XCODE_ATTRIBUTE_GENERATE_PKGINFO_FILE YES)
|
||||
|
||||
_juce_create_windows_package(${shared_code_target} ${target_name} vst3 "" x86-win x86_64-win)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
if(JUCE_TARGET_ARCHITECTURE STREQUAL "x86_64")
|
||||
set(windows_arch "x86_64")
|
||||
elseif(JUCE_TARGET_ARCHITECTURE STREQUAL "i386")
|
||||
set(windows_arch "x86")
|
||||
elseif(JUCE_TARGET_ARCHITECTURE STREQUAL "arm64ec")
|
||||
set(windows_arch "arm64ec")
|
||||
elseif(JUCE_TARGET_ARCHITECTURE STREQUAL "aarch64")
|
||||
set(windows_arch "arm64")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported target architecture for VST3: ${JUCE_TARGET_ARCHITECTURE}")
|
||||
endif()
|
||||
|
||||
_juce_create_windows_package(${shared_code_target} ${target_name} vst3 "" "${windows_arch}-win")
|
||||
endif()
|
||||
|
||||
set(output_path "${products_folder}/${product_name}.vst3")
|
||||
|
||||
|
|
@ -1262,7 +1279,18 @@ function(_juce_set_plugin_target_properties shared_code_target kind)
|
|||
|
||||
_juce_init_bundled_aax_sdk()
|
||||
get_target_property(default_icon juce_aax_sdk INTERFACE_JUCE_AAX_DEFAULT_ICON)
|
||||
_juce_create_windows_package(${shared_code_target} ${target_name} aaxplugin "${default_icon}" Win32 x64)
|
||||
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
|
||||
if(JUCE_TARGET_ARCHITECTURE STREQUAL "x86_64")
|
||||
set(windows_arch "x64")
|
||||
elseif(JUCE_TARGET_ARCHITECTURE STREQUAL "i386")
|
||||
set(windows_arch "Win32")
|
||||
else()
|
||||
message(FATAL_ERROR "Unsupported target architecture for AAX: ${JUCE_TARGET_ARCHITECTURE}")
|
||||
endif()
|
||||
|
||||
_juce_create_windows_package(${shared_code_target} ${target_name} aaxplugin "${default_icon}" "${windows_arch}")
|
||||
endif()
|
||||
|
||||
set(output_path "${products_folder}/${product_name}.aaxplugin")
|
||||
_juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_AAX_COPY_DIR)
|
||||
|
|
@ -1300,6 +1328,11 @@ function(_juce_set_plugin_target_properties shared_code_target kind)
|
|||
JUCE_UNITY_COPY_DIR)
|
||||
endif()
|
||||
elseif(kind STREQUAL "LV2")
|
||||
if (CMAKE_SYSTEM_NAME STREQUAL "Windows" AND NOT JUCE_WINDOWS_HELPERS_CAN_RUN)
|
||||
message(FATAL_ERROR "You cannot build a ${JUCE_TARGET_ARCHITECTURE} LV2 plug-in on a host "
|
||||
"system processor detected to be ${CMAKE_HOST_SYSTEM_PROCESSOR}.")
|
||||
endif()
|
||||
|
||||
set_target_properties(${target_name} PROPERTIES BUNDLE FALSE)
|
||||
|
||||
get_target_property(JUCE_LV2URI "${shared_code_target}" JUCE_LV2URI)
|
||||
|
|
@ -2251,23 +2284,22 @@ function(juce_add_pip header)
|
|||
else()
|
||||
set(source_main "${JUCE_CMAKE_UTILS_DIR}/PIPAudioProcessor.cpp.in")
|
||||
|
||||
set(formats AAX AU AUv3 LV2 Standalone Unity VST3)
|
||||
|
||||
# We add VST2 targets too, if the user has set up those SDKs
|
||||
|
||||
set(extra_formats)
|
||||
|
||||
if(TARGET juce_vst2_sdk)
|
||||
list(APPEND extra_formats VST)
|
||||
list(APPEND formats VST)
|
||||
endif()
|
||||
|
||||
if(NOT (CMAKE_SYSTEM_NAME MATCHES ".*BSD"))
|
||||
list(APPEND extra_formats VST3)
|
||||
if(CMAKE_SYSTEM_NAME STREQUAL "Windows" AND NOT JUCE_WINDOWS_HELPERS_CAN_RUN)
|
||||
list(REMOVE_ITEM formats LV2)
|
||||
endif()
|
||||
|
||||
# Standalone plugins might want to access the mic
|
||||
list(APPEND extra_target_args MICROPHONE_PERMISSION_ENABLED TRUE)
|
||||
|
||||
juce_add_plugin(${JUCE_PIP_NAME}
|
||||
FORMATS AU AUv3 LV2 Standalone Unity AAX ${extra_formats}
|
||||
FORMATS ${formats}
|
||||
${extra_target_args})
|
||||
endif()
|
||||
elseif(pip_kind STREQUAL "Component")
|
||||
|
|
|
|||
|
|
@ -32,21 +32,20 @@
|
|||
==============================================================================
|
||||
*/
|
||||
|
||||
#if defined(__arm__) || defined(__TARGET_ARCH_ARM) || defined(_M_ARM) || defined(_M_ARM64) || defined(__aarch64__) || defined(__ARM64__)
|
||||
|
||||
#if defined(_M_ARM64) || defined(__aarch64__) || defined(__ARM64__)
|
||||
#error JUCE_ARCH aarch64
|
||||
#elif (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM == 8) || defined(__ARMv8__) || defined(__ARMv8_A__)
|
||||
#error JUCE_ARCH armv8l
|
||||
#elif (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM == 7) || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(_ARM_ARCH_7) || defined(__CORE_CORTEXA__)
|
||||
#error JUCE_ARCH armv7l
|
||||
#elif (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM == 6) || defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6M__)
|
||||
#error JUCE_ARCH armv6l
|
||||
#elif (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM == 5) || defined(__ARM_ARCH_5TEJ__)
|
||||
#error JUCE_ARCH armv5l
|
||||
#else
|
||||
#error JUCE_ARCH arm
|
||||
#endif
|
||||
#if defined(_M_ARM64EC)
|
||||
#error JUCE_ARCH arm64ec
|
||||
#elif defined(_M_ARM64) || defined(__aarch64__) || defined(__ARM64__)
|
||||
#error JUCE_ARCH aarch64
|
||||
#elif (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM == 8) || defined(__ARMv8__) || defined(__ARMv8_A__)
|
||||
#error JUCE_ARCH armv8l
|
||||
#elif (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM == 7) || defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7S__) || defined(_ARM_ARCH_7) || defined(__CORE_CORTEXA__)
|
||||
#error JUCE_ARCH armv7l
|
||||
#elif (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM == 6) || defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6T2__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6M__)
|
||||
#error JUCE_ARCH armv6l
|
||||
#elif (defined(__TARGET_ARCH_ARM) && __TARGET_ARCH_ARM == 5) || defined(__ARM_ARCH_5TEJ__)
|
||||
#error JUCE_ARCH armv5l
|
||||
#elif defined(__arm__) || defined(_M_ARM)
|
||||
#error JUCE_ARCH arm
|
||||
|
||||
#elif defined(__i386) || defined(__i386__) || defined(_M_IX86)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue