Skip to content

Commit 8553be9

Browse files
committed
cmake/DaemonNacl: set proper NaCl architecture for the target
1 parent 1ff3033 commit 8553be9

File tree

1 file changed

+21
-5
lines changed

1 file changed

+21
-5
lines changed

cmake/DaemonNacl.cmake

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,27 @@ option(USE_NACL_SAIGO "Use Saigo toolchain to build NaCl executables" OFF)
3030

3131
if( 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()
3854
else()
3955
# Build native dll or native exe.
4056
if( APPLE )

0 commit comments

Comments
 (0)