diff --git a/build_shared_library.py b/build_shared_library.py
index 6dbafcdf296d884eb5c2562a43c070e978500d27..1eb8675c9dfb42798c43a71c2e83d808b7edd4ec 100755
--- a/build_shared_library.py
+++ b/build_shared_library.py
@@ -16,14 +16,16 @@
 import subprocess
 import glob
 import os
+import sys
 
 if not os.path.exists("build"):
     os.mkdir("build")
 
 source_files = glob.glob("src/*.cpp")
 
-compile_args = "g++ -O0 -g -Iinclude -Ilib --std=c++11 --shared -fPIC".split()
+compile_args = "g++ -O3 -Iinclude -Ilib --std=c++11 --shared -fPIC".split()
 compile_args += source_files
+compile_args += sys.argv[1:]
 
 library = "build/libolm.so"