diff --git a/CHANGES b/CHANGES
index f020c55f..90c67b4c 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,7 @@
-2021-10-27 : 2.3.1
+????-??-?? : 2.4.0
all : deprecated neko (see README)
std : fixed put_env when null is passed in (#229 https://github.com/HaxeFoundation/haxe/issues/10395)
+ std : added sys_cpu_arch (#275)
std : fix sys_is64 returning false on 64 bit Windows (#276)
cmake : updated apr version for Mac
all : fixed various build issues on macOS Catalina
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5e68b921..032d853e 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -42,8 +42,8 @@ if(IS_ABSOLUTE ${CMAKE_INSTALL_LIBDIR})
endif()
set(NEKO_VERSION_MAJOR 2)
-set(NEKO_VERSION_MINOR 3)
-set(NEKO_VERSION_PATCH 1)
+set(NEKO_VERSION_MINOR 4)
+set(NEKO_VERSION_PATCH 0)
# NEKO_VERSION is cached such that we can query it by `cmake -L -N -B . | grep NEKO_VERSION`
set(NEKO_VERSION ${NEKO_VERSION_MAJOR}.${NEKO_VERSION_MINOR}.${NEKO_VERSION_PATCH} CACHE STRING INTERNAL)
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index c9b8a76c..4247178e 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -5,7 +5,7 @@ variables:
- name: AZURE_PIPELINES_BRANCH
value: $(Build.SourceBranchName)
- name: NEKO_VERSION
- value: "2.3.1"
+ value: "2.4.0"
trigger:
branches:
diff --git a/libs/std/sys.c b/libs/std/sys.c
index 72c1e56d..6c700283 100644
--- a/libs/std/sys.c
+++ b/libs/std/sys.c
@@ -233,6 +233,32 @@ static value sys_is64() {
#endif
}
+/**
+ sys_cpu_arch : void -> string
+
+ Returns the cpu architecture. Current possible values:
+
+ - [x86_64]
+ - [x86]
+ - [arm64]
+ - [arm]
+
+
+**/
+static value sys_cpu_arch() {
+#if defined(__x86_64__) || defined(_M_AMD64)
+ return alloc_string("x86_64");
+#elif defined(__i386__) || defined(_M_IX86)
+ return alloc_string("x86");
+#elif defined(__aarch64__) || defined(_M_ARM64)
+ return alloc_string("arm64");
+#elif defined(__arm__) || defined(_M_ARM)
+ return alloc_string("arm");
+#else
+#error Unknown CPU architecture
+#endif
+}
+
/**
sys_command : string -> int
Run the shell command and return exit code
@@ -703,6 +729,7 @@ DEFINE_PRIM(sys_command,1);
DEFINE_PRIM(sys_exit,1);
DEFINE_PRIM(sys_string,0);
DEFINE_PRIM(sys_is64,0);
+DEFINE_PRIM(sys_cpu_arch,0);
DEFINE_PRIM(sys_stat,1);
DEFINE_PRIM(sys_time,0);
DEFINE_PRIM(sys_cpu_time,0);