@@ -30,11 +30,27 @@ option(USE_NACL_SAIGO "Use Saigo toolchain to build NaCl executables" OFF)
3030
3131if ( NACL )
3232 # Build nexe binary.
33- # Those defines looks to be meaningless to produce arch-independent pexe,
34- # but they must be set to anything supported by native builds. this
35- # requirement looks to be a NaCl bug.
36- add_definitions ( -DNACL_BUILD_ARCH=x86 )
37- add_definitions ( -DNACL_BUILD_SUBARCH=64 )
33+ if (USE_NACL_SAIGO)
34+ # NACL_ARCH is "pnacl" here, NACL_TARGET carries the architecture.
35+ if (NACL_TARGET STREQUAL "amd64" )
36+ add_definitions (-DNACL_BUILD_ARCH=x86)
37+ add_definitions (-DNACL_BUILD_SUBARCH=64)
38+ elseif (NACL_TARGET STREQUAL "i686" )
39+ add_definitions (-DNACL_BUILD_ARCH=x86)
40+ add_definitions (-DNACL_BUILD_SUBARCH=32)
41+ elseif (NACL_TARGET STREQUAL "armhf" )
42+ add_definitions (-DNACL_BUILD_ARCH=arm)
43+ else ()
44+ message (FATAL_ERROR "Unsupported architecture ${NACL_TARGET} " )
45+ endif ()
46+ else ()
47+ # Those defines looks to be meaningless to produce arch-independent pexe
48+ # with PNaCl but they must be set to anything supported by native builds.
49+ # This requirement looks to be a PNaCl bug.
50+ # NACL_ARCH is "pnacl" here, NACL_TARGET is not set.
51+ add_definitions ( -DNACL_BUILD_ARCH=x86 )
52+ add_definitions ( -DNACL_BUILD_SUBARCH=64 )
53+ endif ()
3854else ()
3955 # Build native dll or native exe.
4056 if ( APPLE )
0 commit comments