2525# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2626
2727function (daemon_detect_nacl_arch )
28- set (arch_name "${YOKAI_TARGET_ARCH_NAME} " )
29- set (nacl_arch "${arch_name } " )
28+ set (target_arch "${YOKAI_TARGET_ARCH_NAME} " )
29+ set (nacl_arch "${target_arch } " )
3030
3131 if (YOKAI_TARGET_SYSTEM_LINUX_COMPATIBILITY OR YOKAI_TARGET_SYSTEM_XDG_COMPATIBILITY)
32- set (armhf_usage "arm64;armel" )
33- if ("${arch_name} " IN_LIST armhf_usage)
34- # Load 32-bit armhf nexe on 64-bit arm64 engine on Linux with multiarch.
35- # The nexe is system agnostic so there should be no difference with armel.
36- set (nacl_arch "armhf" )
32+ set (armhf_usage "arm64" "armel" )
33+ set (box64_usage "ppc64el" "riscv64" )
3734
38- set (box64_usage ppc64el riscv64)
39- if ("${arch_name} " IN_LIST box64_usage)
35+ if ("${target_arch} " IN_LIST armhf_usage)
36+ # Load 32-bit armhf nexe on 64-bit arm64 engine on Linux with multiarch.
37+ # The nexe is system agnostic so there should be no difference with armel.
38+ set (nacl_arch "armhf" )
39+ elseif ("${target_arch} " IN_LIST box64_usage)
4040 option (DAEMON_NACL_BOX64_EMULATION "Use Box64 to emulate x86_64 NaCl loader on unsupported platforms" ON )
4141 if (DAEMON_NACL_BOX64_EMULATION)
4242 # Use Box64 to run x86_64 NaCl loader and amd64 nexe.
@@ -45,27 +45,32 @@ function(daemon_detect_nacl_arch)
4545 add_definitions (-DDAEMON_NACL_BOX64_EMULATION )
4646 endif ()
4747 endif ()
48- endif ()
49-
50- elseif (DAEMON_TARGET_SYSTEM_MACOS)
51- if ("${arch_name} " STREQUAL "arm64" )
48+ elseif (YOKAI_TARGET_SYSTEM_MACOS)
49+ if ("${target_arch} " STREQUAL "arm64" )
5250 # You can get emulated NaCl going like this:
5351 # cp external_deps/macos-amd64-default_10/{nacl_loader,irt_core-amd64.nexe} build/
5452 set (nacl_arch "amd64" )
5553 endif ()
5654 endif ()
5755
58- string (TOUPPER "${nacl_arch_name} " nacl_arch_name_upper)
59-
60- # The DAEMON_NACL_ARCH_NAME variable contributes to the nexe file name.
61- set (DAEMON_NACL_ARCH_NAME "${nacl_arch} " PARENT_SCOPE )
62- set (DAEMON_NACL_ARCH_NAME_UPPER "${nacl_arch_upper} " PARENT_SCOPE )
56+ string (TOUPPER "${nacl_arch} " nacl_arch_upper)
6357
6458 # NaCl runtime is only available on architectures that have a NaCl loader.
65- set (nacl_runtime_arch amd64 i686 armhf)
59+ set (nacl_runtime_arch " amd64" " i686" " armhf" )
6660 if ("${nacl_arch} " IN_LIST nacl_runtime_arch)
61+ message (STATUS "Detected NaCl architecture: ${nacl_arch} " )
62+
6763 add_definitions (-DDAEMON_NACL_RUNTIME_ENABLED )
64+ else ()
65+ set (nacl_arch "unknown" )
66+
67+ message (STATUS "No NaCl architecture detected" )
6868 endif ()
69+
70+ # The DAEMON_NACL_ARCH_NAME variable contributes to the nexe file name.
71+ set (DAEMON_NACL_ARCH_NAME "${nacl_arch} " PARENT_SCOPE )
72+
73+ set (DAEMON_NACL_ARCH_NAME_UPPER "${nacl_arch_upper} " PARENT_SCOPE )
6974endfunction ()
7075
7176daemon_detect_nacl_arch ()
0 commit comments