summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitattributes1
-rw-r--r--CMakeLists.txt41
-rw-r--r--bin/binaryen.js2
-rw-r--r--src/js/binaryen.js-post.js3
4 files changed, 28 insertions, 19 deletions
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 000000000..27470600d
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1 @@
+*.a -text
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 0d7b27452..b0eb140b6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -5,11 +5,6 @@ IF(NOT CMAKE_BUILD_TYPE)
MESSAGE(STATUS "No build type selected, default to Release")
SET(CMAKE_BUILD_TYPE "Release")
ENDIF()
-STRING(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
-IF(CMAKE_BUILD_TYPE AND
- NOT uppercase_CMAKE_BUILD_TYPE MATCHES "^(DEBUG|RELEASE)$")
- MESSAGE(FATAL_ERROR "Invalid value for CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}")
-ENDIF()
OPTION(BUILD_STATIC_LIB "Build as a static library" OFF)
@@ -22,6 +17,24 @@ FUNCTION(ADD_COMPILE_FLAG value)
ENDFOREACH(variable)
ENDFUNCTION()
+FUNCTION(ADD_DEBUG_COMPILE_FLAG value)
+ IF("${CMAKE_BUILD_TYPE}" MATCHES "Debug")
+ MESSAGE(STATUS "Building with ${value}")
+ ENDIF()
+ FOREACH(variable CMAKE_C_FLAGS_DEBUG CMAKE_CXX_FLAGS_DEBUG)
+ SET(${variable} "${${variable}} ${value}" PARENT_SCOPE)
+ ENDFOREACH(variable)
+ENDFUNCTION()
+
+FUNCTION(ADD_NONDEBUG_COMPILE_FLAG value)
+ IF(NOT "${CMAKE_BUILD_TYPE}" MATCHES "Debug")
+ MESSAGE(STATUS "Building with ${value}")
+ ENDIF()
+ FOREACH(variable CMAKE_C_FLAGS_RELEASE CMAKE_CXX_FLAGS_RELEASE CMAKE_C_FLAGS_RELWITHDEBINFO CMAKE_CXX_FLAGS_RELWITHDEBINFO CMAKE_C_FLAGS_MINSIZEREL CMAKE_CXX_FLAGS_MINSIZEREL)
+ SET(${variable} "${${variable}} ${value}" PARENT_SCOPE)
+ ENDFOREACH(variable)
+ENDFUNCTION()
+
FUNCTION(ADD_LINK_FLAG value)
MESSAGE(STATUS "Linking with ${value}")
FOREACH(variable CMAKE_EXE_LINKER_FLAGS)
@@ -48,11 +61,8 @@ IF(MSVC)
ENDIF()
ADD_COMPILE_FLAG("/wd4146") # Ignore warning "warning C4146: unary minus operator applied to unsigned type, result still unsigned", this pattern is used somewhat commonly in the code.
ADD_COMPILE_FLAG("/WX-")
- IF(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
- ADD_COMPILE_FLAG("/O0")
- ELSE()
- ADD_COMPILE_FLAG("/O2")
- ENDIF()
+ ADD_DEBUG_COMPILE_FLAG("/O0")
+ ADD_NONDEBUG_COMPILE_FLAG("/O2")
ADD_COMPILE_FLAG("-D_CRT_SECURE_NO_WARNINGS")
ADD_COMPILE_FLAG("-D_SCL_SECURE_NO_WARNINGS")
ELSE()
@@ -72,13 +82,10 @@ ELSE()
ELSE()
ADD_COMPILE_FLAG("-fPIC")
ENDIF()
- IF(uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
- ADD_COMPILE_FLAG("-O0")
- ADD_COMPILE_FLAG("-g3")
- ELSE()
- ADD_COMPILE_FLAG("-O2")
- ADD_DEFINITIONS("-UNDEBUG") # Keep asserts.
- ENDIF()
+ ADD_DEBUG_COMPILE_FLAG("-O0")
+ ADD_DEBUG_COMPILE_FLAG("-g3")
+ ADD_NONDEBUG_COMPILE_FLAG("-O2")
+ ADD_NONDEBUG_COMPILE_FLAG("-UNDEBUG") # Keep asserts.
ENDIF()
# clang doesn't print colored diagnostics when invoked from Ninja
diff --git a/bin/binaryen.js b/bin/binaryen.js
index 5ea97ba89..bce312888 100644
--- a/bin/binaryen.js
+++ b/bin/binaryen.js
@@ -462,5 +462,5 @@ Y.prototype=Object.create(x.prototype);Y.prototype.constructor=Y;Y.prototype.p=Y
Object.create(ga.prototype);fa.prototype.constructor=fa;fa.prototype.p=fa;fa.s={};d.ShellExternalInterface=fa;fa.prototype.__destroy__=function(){ed(this.e)};ha.prototype=Object.create(x.prototype);ha.prototype.constructor=ha;ha.prototype.p=ha;ha.s={};d.VoidPtr=ha;ha.prototype.__destroy__=function(){Wc(this.e)};S.prototype=Object.create(x.prototype);S.prototype.constructor=S;S.prototype.p=S;S.s={};d.WasmBinaryWriter=S;S.prototype.write=S.prototype.write=function(){ld(this.e)};S.prototype.__destroy__=
function(){Vc(this.e)};Z.prototype=Object.create(x.prototype);Z.prototype.constructor=Z;Z.prototype.p=Z;Z.s={};d.ModuleInstance=Z;Z.prototype.callExport=function(b,c){var d=this.e;b&&"object"===typeof b&&(b=b.e);c&&"object"===typeof c&&(c=c.e);return wa(Qc(d,b,c),R)};Z.prototype.__destroy__=function(){Tc(this.e)};(function(){function b(){}d.calledRun||wb(b)})();"undefined"!==typeof Symbol&&Symbol.iterator&&(d.BufferWithRandomAccess.prototype[Symbol.iterator]=function(){var b=this,c=0,d=b.size();return{next:function(){return c<
d?{done:!1,value:b.vc(c++)}:{done:!0}}}});"undefined"!==typeof Uint8Array&&(d.BufferWithRandomAccess.prototype.toArrayBuffer=function(){return Uint8Array.from(this).buffer});d.compileWast=function(b){var c=(new d.SExpressionParser(b)).Zc().Qc(0);b=new d.Module;new d.SExpressionWasmBuilder(b,c);c=new d.BufferWithRandomAccess(!1);(new d.WasmBinaryWriter(b,c,!1)).write();return N?Buffer.from(Uint8Array.from(c)):c.toArrayBuffer()};return d}
-if("undefined"!=typeof exports){var jb=ib();if("object"===typeof module)module.exports=jb;else for(var Nb in jb)exports[Nb]=jb[Nb]}("undefined"!==typeof window?window:"undefined"!==typeof global&&("undefined"===typeof process||process.argv&&Array.isArray(process.argv)&&process.argv[1]&&"/a.js"===process.argv[1].substr(-5))?global:this).Binaryen=ib;
+if("undefined"!=typeof exports){var jb=ib();if("object"===typeof module)module.exports=jb;else for(var Nb in jb)exports[Nb]=jb[Nb]}("undefined"!==typeof window?window:"undefined"!==typeof global&&("undefined"===typeof process||process.argv&&Array.isArray(process.argv)&&process.argv[1]&&("/a.js"===process.argv[1].substr(-5)||"\\a.js"===process.argv[1].substr(-5)))?global:this).Binaryen=ib;
diff --git a/src/js/binaryen.js-post.js b/src/js/binaryen.js-post.js
index 7389f5afe..a96d39756 100644
--- a/src/js/binaryen.js-post.js
+++ b/src/js/binaryen.js-post.js
@@ -21,7 +21,8 @@ if (typeof exports != 'undefined') {
( process.argv &&
Array.isArray(process.argv) &&
process.argv[1] &&
- process.argv[1].substr(-5) === '/a.js'
+ (process.argv[1].substr(-5) === '/a.js' ||
+ process.argv[1].substr(-5) === '\\a.js')
)
) ? global :