Platform.js 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. //-------------------------------------------------------------------------------------------------------
  2. // Copyright (C) Microsoft. All rights reserved.
  3. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
  4. //-------------------------------------------------------------------------------------------------------
  5. var isWindows = !WScript.Platform || WScript.Platform.OS == 'win32';
  6. var path_sep = isWindows ? '\\' : '/';
  7. var isStaticBuild = WScript.Platform && WScript.Platform.LINK_TYPE == 'static';
  8. if (!isStaticBuild) {
  9. // test will be ignored
  10. print("# IGNORE_THIS_TEST");
  11. } else {
  12. var platform = WScript.Platform.OS;
  13. var binaryPath = WScript.Platform.BINARY_PATH;
  14. // discard `ch` from path
  15. binaryPath = binaryPath.substr(0, binaryPath.lastIndexOf(path_sep));
  16. var makefile =
  17. "IDIR=" + binaryPath + "/../../lib/Jsrt \n\
  18. \n\
  19. LIBRARY_PATH=" + binaryPath + "/lib\n\
  20. PLATFORM=" + platform + "\n\
  21. LDIR=$(LIBRARY_PATH)/libChakraCoreStatic.a \n\
  22. \n\
  23. ifeq (darwin, ${PLATFORM})\n\
  24. \tICU4C_LIBRARY_PATH ?= /usr/local/opt/icu4c\n\
  25. \tCFLAGS=-lstdc++ -std=c++11 -I$(IDIR)\n\
  26. \tFORCE_STARTS=-Wl,-force_load,\n\
  27. \tFORCE_ENDS=\n\
  28. \tLIBS=-framework CoreFoundation -framework Security -lm -ldl -Wno-c++11-compat-deprecated-writable-strings \
  29. -Wno-deprecated-declarations -Wno-unknown-warning-option -o sample.o\n\
  30. \tLDIR+=$(ICU4C_LIBRARY_PATH)/lib/libicudata.a \
  31. $(ICU4C_LIBRARY_PATH)/lib/libicuuc.a \
  32. $(ICU4C_LIBRARY_PATH)/lib/libicui18n.a\n\
  33. else\n\
  34. \tCFLAGS=-lstdc++ -std=c++0x -I$(IDIR)\n\
  35. \tFORCE_STARTS=-Wl,--whole-archive\n\
  36. \tFORCE_ENDS=-Wl,--no-whole-archive\n\
  37. \tLIBS=-pthread -lm -ldl -licuuc -Wno-c++11-compat-deprecated-writable-strings \
  38. -Wno-deprecated-declarations -Wno-unknown-warning-option -o sample.o\n\
  39. endif\n\
  40. \n\
  41. testmake:\n\
  42. \t$(CC) sample.cpp $(CFLAGS) $(FORCE_STARTS) $(LDIR) $(FORCE_ENDS) $(LIBS)\n\
  43. \n\
  44. .PHONY: clean\n\
  45. \n\
  46. clean:\n\
  47. \trm sample.o\n";
  48. print(makefile)
  49. }