Adds missing Makefile for NACL test and a couple of smaller fixes
authorGabriel Jacobo <gabomdq@gmail.com>
Fri, 06 Jun 2014 18:33:17 -0300
changeset 8834b300e097899d
parent 8833 ae720d61d14d
child 8835 bc5ec1b6904c
Adds missing Makefile for NACL test and a couple of smaller fixes
build-scripts/naclbuild.sh
test/nacl/Makefile
test/testmultiaudio.c
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/test/nacl/Makefile	Fri Jun 06 18:33:17 2014 -0300
     1.3 @@ -0,0 +1,63 @@
     1.4 +# Copyright (c) 2013 The Chromium Authors. All rights reserved.
     1.5 +# Use of this source code is governed by a BSD-style license that can be
     1.6 +# found in the LICENSE file.
     1.7 +
     1.8 +# GNU Makefile based on shared rules provided by the Native Client SDK.
     1.9 +# See README.Makefiles for more details.
    1.10 +
    1.11 +VALID_TOOLCHAINS := pnacl
    1.12 +
    1.13 +# NACL_SDK_ROOT ?= $(abspath $(CURDIR)/../../..)
    1.14 +include $(NACL_SDK_ROOT)/tools/common.mk
    1.15 +
    1.16 +
    1.17 +TARGET = sdl_app
    1.18 +DEPS = ppapi_simple nacl_io
    1.19 +# ppapi_simple ends up being listed twice due to dependency solving issues -- Gabriel
    1.20 +LIBS = SDL2_test SDL2 ppapi_simple SDL2main $(DEPS) ppapi_gles2 ppapi_cpp ppapi pthread 
    1.21 +
    1.22 +CFLAGS := -Wall
    1.23 +SOURCES ?= testgles2.c
    1.24 +
    1.25 +# Build rules generated by macros from common.mk:
    1.26 +# Overriden macro from NACL SDK to be able to customize the library search path -- Gabriel
    1.27 +# Specific Link Macro 
    1.28 +#
    1.29 +# $1 = Target Name
    1.30 +# $2 = List of inputs
    1.31 +# $3 = List of libs
    1.32 +# $4 = List of deps
    1.33 +# $5 = List of lib dirs
    1.34 +# $6 = Other Linker Args
    1.35 +#
    1.36 +# For debugging, we translate the pre-finalized .bc file.
    1.37 +#
    1.38 +define LINKER_RULE
    1.39 +all: $(1).pexe 
    1.40 +$(1)_x86_32.nexe : $(1).bc
    1.41 +	$(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) --allow-llvm-bitcode-input -arch x86-32 $$^ -o $$@)
    1.42 +
    1.43 +$(1)_x86_64.nexe : $(1).bc
    1.44 +	$(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) --allow-llvm-bitcode-input -arch x86-64 $$^ -o $$@)
    1.45 +
    1.46 +$(1)_arm.nexe : $(1).bc
    1.47 +	$(call LOG,TRANSLATE,$$@,$(PNACL_TRANSLATE) --allow-llvm-bitcode-input -arch arm $$^ -o $$@)
    1.48 +
    1.49 +$(1).pexe: $(1).bc
    1.50 +	$(call LOG,FINALIZE,$$@,$(PNACL_FINALIZE) -o $$@ $$^)
    1.51 +
    1.52 +$(1).bc: $(2) $(foreach dep,$(4),$(STAMPDIR)/$(dep).stamp)
    1.53 +	$(call LOG,LINK,$$@,$(PNACL_LINK) -o $$@ $(2) $(PNACL_LDFLAGS) $(foreach path,$(5),-L$(path)/pnacl/$(CONFIG)) -L./lib $(foreach lib,$(3),-l$(lib)) $(6))
    1.54 +endef
    1.55 +
    1.56 +$(foreach dep,$(DEPS),$(eval $(call DEPEND_RULE,$(dep))))
    1.57 +$(foreach src,$(SOURCES),$(eval $(call COMPILE_RULE,$(src),$(CFLAGS))))
    1.58 +
    1.59 +ifeq ($(CONFIG),Release)
    1.60 +$(eval $(call LINK_RULE,$(TARGET)_unstripped,$(SOURCES),$(LIBS),$(DEPS)))
    1.61 +$(eval $(call STRIP_RULE,$(TARGET),$(TARGET)_unstripped))
    1.62 +else
    1.63 +$(eval $(call LINK_RULE,$(TARGET),$(SOURCES),$(LIBS),$(DEPS)))
    1.64 +endif
    1.65 +
    1.66 +$(eval $(call NMF_RULE,$(TARGET),))
     2.1 --- a/test/testmultiaudio.c	Fri Jun 06 15:45:59 2014 -0300
     2.2 +++ b/test/testmultiaudio.c	Fri Jun 06 18:33:17 2014 -0300
     2.3 @@ -133,6 +133,16 @@
     2.4      }
     2.5  
     2.6      SDL_Log("Using audio driver: %s\n", SDL_GetCurrentAudioDriver());
     2.7 +    
     2.8 +    #if __NACL__
     2.9 +    SDL_RWUmount("/");
    2.10 +    SDL_RWMount(
    2.11 +        "",  /* source */
    2.12 +        "/",  /* target */
    2.13 +        "httpfs",  /* filesystemtype */
    2.14 +        0,  /* mountflags */
    2.15 +        "");  /* data specific to the html5fs type */
    2.16 +#endif
    2.17  
    2.18      devcount = SDL_GetNumAudioDevices(0);
    2.19      if (devcount < 1) {