diff --git a/native/MacRestarter/CMakeLists.txt b/native/MacRestarter/CMakeLists.txt
new file mode 100644
index 000000000000..700bf4b55b8b
--- /dev/null
+++ b/native/MacRestarter/CMakeLists.txt
@@ -0,0 +1,15 @@
+cmake_minimum_required(VERSION 3.1)
+project(restarter OBJC)
+
+if(NOT APPLE)
+ message(FATAL_ERROR "macOS only.")
+endif()
+
+set(CMAKE_C_STANDARD 11)
+set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
+set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8)
+
+add_compile_options("-fmodules" "-flto=full" "-Wall" "-Wextra" "-Wpedantic" "-Wno-newline-eof")
+add_executable(restarter restarter.m)
+
+install(TARGETS restarter DESTINATION ${CMAKE_CURRENT_LIST_DIR}/../../bin/mac)
diff --git a/native/MacRestarter/make.sh b/native/MacRestarter/make.sh
index cb12a030b1f1..44d648b967ef 100755
--- a/native/MacRestarter/make.sh
+++ b/native/MacRestarter/make.sh
@@ -1,7 +1,6 @@
#!/bin/sh
-
-clang -arch x86_64 -mmacosx-version-min=10.8 -framework AppKit -lobjc -o restarter_x86_64 restarter.m
-clang -arch arm64 -mmacosx-version-min=10.8 -framework AppKit -lobjc -o restarter_arm64 restarter.m
-lipo -create restarter_x86_64 restarter_arm64 -o restarter
-rm restarter_arm64
-rm restarter_x86_64
\ No newline at end of file
+rm -rf build
+mkdir build
+cd build
+cmake -DCMAKE_BUILD_TYPE=Release ..
+make install/strip VERBOSE=1
\ No newline at end of file
diff --git a/native/MacTouchBar/.idea/MacTouchBar.iml b/native/MacTouchBar/.idea/MacTouchBar.iml
deleted file mode 100644
index 74121dcb300c..000000000000
--- a/native/MacTouchBar/.idea/MacTouchBar.iml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/native/MacTouchBar/.idea/misc.xml b/native/MacTouchBar/.idea/misc.xml
deleted file mode 100644
index 28a804d8932a..000000000000
--- a/native/MacTouchBar/.idea/misc.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/native/MacTouchBar/.idea/modules.xml b/native/MacTouchBar/.idea/modules.xml
deleted file mode 100644
index 56abf1fe0cd9..000000000000
--- a/native/MacTouchBar/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/native/MacTouchBar/.idea/xcode.xml b/native/MacTouchBar/.idea/xcode.xml
deleted file mode 100644
index c61751879013..000000000000
--- a/native/MacTouchBar/.idea/xcode.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file
diff --git a/native/MacTouchBar/CMakeLists.txt b/native/MacTouchBar/CMakeLists.txt
new file mode 100644
index 000000000000..38da8439f0cb
--- /dev/null
+++ b/native/MacTouchBar/CMakeLists.txt
@@ -0,0 +1,20 @@
+cmake_minimum_required(VERSION 3.1)
+project(MacTouchBar OBJC)
+
+if(NOT APPLE)
+ message(FATAL_ERROR "macOS only.")
+endif()
+
+set(CMAKE_C_STANDARD 11)
+set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
+set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8)
+
+add_compile_options("-fmodules" "-flto=full" "-Wall" "-Wextra" "-Wpedantic" "-Wno-newline-eof")
+add_library(nst SHARED
+ src/JTypes.h src/Button.m src/Popover.m src/Scrubber.m
+ src/ScrubberItemView.h src/ScrubberItemView.m
+ src/TouchBar.h src/TouchBar.m
+ src/Utils.h src/Utils.m
+)
+
+install(FILES $ DESTINATION ${CMAKE_CURRENT_LIST_DIR}/../../bin/mac RENAME "libnst64.dylib")
diff --git a/native/MacTouchBar/MacTouchBar.xcodeproj/project.pbxproj b/native/MacTouchBar/MacTouchBar.xcodeproj/project.pbxproj
deleted file mode 100644
index c77e1d5dec03..000000000000
--- a/native/MacTouchBar/MacTouchBar.xcodeproj/project.pbxproj
+++ /dev/null
@@ -1,304 +0,0 @@
-// !$*UTF8*$!
-{
- archiveVersion = 1;
- classes = {
- };
- objectVersion = 46;
- objects = {
-
-/* Begin PBXBuildFile section */
- 598F525237306E4D3B8A2900 /* TouchBar.h in Headers */ = {isa = PBXBuildFile; fileRef = 598F5B22A91678A71EE4491F /* TouchBar.h */; };
- 598F54A7F6FED03CB444C146 /* ScrubberItemView.h in Headers */ = {isa = PBXBuildFile; fileRef = 598F5CBC425D28C130AC94FE /* ScrubberItemView.h */; };
- 598F55E9E228B2409B03C284 /* Utils.m in Sources */ = {isa = PBXBuildFile; fileRef = 598F53B3BC479D68ECB64BC9 /* Utils.m */; };
- 598F57D8C273D2116054A3FA /* Button.m in Sources */ = {isa = PBXBuildFile; fileRef = 598F5DD626ED21BA79946AB7 /* Button.m */; };
- 598F5A5979667C1B0C9918D9 /* Scrubber.m in Sources */ = {isa = PBXBuildFile; fileRef = 598F5B3A1B073873267B716D /* Scrubber.m */; };
- 598F5B195CB9382504D47A61 /* Utils.h in Headers */ = {isa = PBXBuildFile; fileRef = 598F516357CE6715C1864F72 /* Utils.h */; };
- 598F5C4CA4AB36808F75FBC3 /* TouchBar.m in Sources */ = {isa = PBXBuildFile; fileRef = 598F5F9A87B09F525027531C /* TouchBar.m */; };
- 598F5CAB483C55F406BD8F00 /* JTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 598F5D64D66F1067328D768F /* JTypes.h */; };
- 598F5FB60DDFE40FC979618C /* ScrubberItemView.m in Sources */ = {isa = PBXBuildFile; fileRef = 598F5B353C4743E6E42C4F8B /* ScrubberItemView.m */; };
- 598F5FF6CBF04F82FF47D67F /* Popover.m in Sources */ = {isa = PBXBuildFile; fileRef = 598F555E5BB3F9610AE63AFD /* Popover.m */; };
-/* End PBXBuildFile section */
-
-/* Begin PBXFileReference section */
- 598F516357CE6715C1864F72 /* Utils.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utils.h; sourceTree = ""; };
- 598F53B3BC479D68ECB64BC9 /* Utils.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Utils.m; sourceTree = ""; };
- 598F555E5BB3F9610AE63AFD /* Popover.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Popover.m; sourceTree = ""; };
- 598F5B22A91678A71EE4491F /* TouchBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TouchBar.h; sourceTree = ""; };
- 598F5B353C4743E6E42C4F8B /* ScrubberItemView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScrubberItemView.m; sourceTree = ""; };
- 598F5B3A1B073873267B716D /* Scrubber.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Scrubber.m; sourceTree = ""; };
- 598F5CBC425D28C130AC94FE /* ScrubberItemView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrubberItemView.h; sourceTree = ""; };
- 598F5D64D66F1067328D768F /* JTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JTypes.h; sourceTree = ""; };
- 598F5DD626ED21BA79946AB7 /* Button.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Button.m; sourceTree = ""; };
- 598F5F9A87B09F525027531C /* TouchBar.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TouchBar.m; sourceTree = ""; };
- 598F5FE929ACF0979D7BCD78 /* libMacTouchBar.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = libMacTouchBar.dylib; sourceTree = BUILT_PRODUCTS_DIR; };
-/* End PBXFileReference section */
-
-/* Begin PBXFrameworksBuildPhase section */
- 598F53495FB8CFC9DA134A3A /* Frameworks */ = {
- isa = PBXFrameworksBuildPhase;
- buildActionMask = 2147483647;
- files = (
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXFrameworksBuildPhase section */
-
-/* Begin PBXGroup section */
- 598F56E800A362185F61FE19 /* Products */ = {
- isa = PBXGroup;
- children = (
- 598F5FE929ACF0979D7BCD78 /* libMacTouchBar.dylib */,
- );
- name = Products;
- sourceTree = "";
- };
- 598F5AC0C8F930CAF8944359 /* src */ = {
- isa = PBXGroup;
- children = (
- 598F5F9A87B09F525027531C /* TouchBar.m */,
- 598F5B353C4743E6E42C4F8B /* ScrubberItemView.m */,
- 598F5CBC425D28C130AC94FE /* ScrubberItemView.h */,
- 598F5B3A1B073873267B716D /* Scrubber.m */,
- 598F5DD626ED21BA79946AB7 /* Button.m */,
- 598F555E5BB3F9610AE63AFD /* Popover.m */,
- 598F53B3BC479D68ECB64BC9 /* Utils.m */,
- 598F516357CE6715C1864F72 /* Utils.h */,
- 598F5D64D66F1067328D768F /* JTypes.h */,
- 598F5B22A91678A71EE4491F /* TouchBar.h */,
- );
- path = src;
- sourceTree = "";
- };
- 598F5FCFCB6188327818C4D2 = {
- isa = PBXGroup;
- children = (
- 598F56E800A362185F61FE19 /* Products */,
- 598F5AC0C8F930CAF8944359 /* src */,
- );
- sourceTree = "";
- };
-/* End PBXGroup section */
-
-/* Begin PBXHeadersBuildPhase section */
- 598F5E9A6810798EADD86B68 /* Headers */ = {
- isa = PBXHeadersBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 598F54A7F6FED03CB444C146 /* ScrubberItemView.h in Headers */,
- 598F5B195CB9382504D47A61 /* Utils.h in Headers */,
- 598F5CAB483C55F406BD8F00 /* JTypes.h in Headers */,
- 598F525237306E4D3B8A2900 /* TouchBar.h in Headers */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXHeadersBuildPhase section */
-
-/* Begin PBXNativeTarget section */
- 598F577CE6323BED1B45254E /* MacTouchBar */ = {
- isa = PBXNativeTarget;
- buildConfigurationList = 598F520D6FBB126BA5B95F28 /* Build configuration list for PBXNativeTarget "MacTouchBar" */;
- buildPhases = (
- 598F5F70326CEA592BD6CC82 /* Sources */,
- 598F53495FB8CFC9DA134A3A /* Frameworks */,
- 598F5E9A6810798EADD86B68 /* Headers */,
- );
- buildRules = (
- );
- dependencies = (
- );
- name = MacTouchBar;
- productName = MacTouchBar;
- productReference = 598F5FE929ACF0979D7BCD78 /* libMacTouchBar.dylib */;
- productType = "com.apple.product-type.library.dynamic";
- };
-/* End PBXNativeTarget section */
-
-/* Begin PBXProject section */
- 598F5118DF5E14ADAD1AA66F /* Project object */ = {
- isa = PBXProject;
- attributes = {
- ORGANIZATIONNAME = jetbrains;
- };
- buildConfigurationList = 598F54B39EE5879BCA7F935D /* Build configuration list for PBXProject "MacTouchBar" */;
- compatibilityVersion = "Xcode 3.2";
- developmentRegion = English;
- hasScannedForEncodings = 0;
- knownRegions = (
- en,
- );
- mainGroup = 598F5FCFCB6188327818C4D2;
- productRefGroup = 598F56E800A362185F61FE19 /* Products */;
- projectDirPath = "";
- projectRoot = "";
- targets = (
- 598F577CE6323BED1B45254E /* MacTouchBar */,
- );
- };
-/* End PBXProject section */
-
-/* Begin PBXSourcesBuildPhase section */
- 598F5F70326CEA592BD6CC82 /* Sources */ = {
- isa = PBXSourcesBuildPhase;
- buildActionMask = 2147483647;
- files = (
- 598F5C4CA4AB36808F75FBC3 /* TouchBar.m in Sources */,
- 598F5FB60DDFE40FC979618C /* ScrubberItemView.m in Sources */,
- 598F5A5979667C1B0C9918D9 /* Scrubber.m in Sources */,
- 598F57D8C273D2116054A3FA /* Button.m in Sources */,
- 598F5FF6CBF04F82FF47D67F /* Popover.m in Sources */,
- 598F55E9E228B2409B03C284 /* Utils.m in Sources */,
- );
- runOnlyForDeploymentPostprocessing = 0;
- };
-/* End PBXSourcesBuildPhase section */
-
-/* Begin XCBuildConfiguration section */
- 598F50271FC9973E4E1165A6 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_ANALYZER_NONNULL = YES;
- CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_COMMA = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INFINITE_RECURSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
- CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- CODE_SIGN_IDENTITY = "-";
- COPY_PHASE_STRIP = NO;
- DEBUG_INFORMATION_FORMAT = dwarf;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- ENABLE_TESTABILITY = YES;
- GCC_C_LANGUAGE_STANDARD = gnu11;
- GCC_DYNAMIC_NO_PIC = NO;
- GCC_NO_COMMON_BLOCKS = YES;
- GCC_OPTIMIZATION_LEVEL = 0;
- GCC_PREPROCESSOR_DEFINITIONS = (
- "DEBUG=1",
- "$(inherited)",
- );
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.13;
- MTL_ENABLE_DEBUG_INFO = YES;
- ONLY_ACTIVE_ARCH = YES;
- SDKROOT = macosx;
- };
- name = Debug;
- };
- 598F519739E4CD4981ED13F0 /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- ALWAYS_SEARCH_USER_PATHS = NO;
- CLANG_ANALYZER_NONNULL = YES;
- CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE;
- CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
- CLANG_CXX_LIBRARY = "libc++";
- CLANG_ENABLE_MODULES = YES;
- CLANG_ENABLE_OBJC_ARC = YES;
- CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
- CLANG_WARN_BOOL_CONVERSION = YES;
- CLANG_WARN_COMMA = YES;
- CLANG_WARN_CONSTANT_CONVERSION = YES;
- CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
- CLANG_WARN_DOCUMENTATION_COMMENTS = YES;
- CLANG_WARN_EMPTY_BODY = YES;
- CLANG_WARN_ENUM_CONVERSION = YES;
- CLANG_WARN_INFINITE_RECURSION = YES;
- CLANG_WARN_INT_CONVERSION = YES;
- CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
- CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
- CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
- CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
- CLANG_WARN_STRICT_PROTOTYPES = YES;
- CLANG_WARN_SUSPICIOUS_MOVE = YES;
- CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE;
- CLANG_WARN_UNREACHABLE_CODE = YES;
- CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
- CODE_SIGN_IDENTITY = "-";
- COPY_PHASE_STRIP = NO;
- DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
- ENABLE_NS_ASSERTIONS = NO;
- ENABLE_STRICT_OBJC_MSGSEND = YES;
- GCC_C_LANGUAGE_STANDARD = gnu11;
- GCC_NO_COMMON_BLOCKS = YES;
- GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
- GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
- GCC_WARN_UNDECLARED_SELECTOR = YES;
- GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
- GCC_WARN_UNUSED_FUNCTION = YES;
- GCC_WARN_UNUSED_VARIABLE = YES;
- MACOSX_DEPLOYMENT_TARGET = 10.13;
- MTL_ENABLE_DEBUG_INFO = NO;
- SDKROOT = macosx;
- };
- name = Release;
- };
- 598F51ADB473ACE3C19A46E8 /* Debug */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CLANG_ENABLE_OBJC_ARC = NO;
- DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 1;
- EXECUTABLE_PREFIX = lib;
- PRODUCT_NAME = "$(TARGET_NAME)";
- };
- name = Debug;
- };
- 598F52426799760C1F9DE10A /* Release */ = {
- isa = XCBuildConfiguration;
- buildSettings = {
- CLANG_ENABLE_OBJC_ARC = NO;
- DYLIB_COMPATIBILITY_VERSION = 1;
- DYLIB_CURRENT_VERSION = 1;
- EXECUTABLE_PREFIX = lib;
- PRODUCT_NAME = "$(TARGET_NAME)";
- };
- name = Release;
- };
-/* End XCBuildConfiguration section */
-
-/* Begin XCConfigurationList section */
- 598F520D6FBB126BA5B95F28 /* Build configuration list for PBXNativeTarget "MacTouchBar" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 598F51ADB473ACE3C19A46E8 /* Debug */,
- 598F52426799760C1F9DE10A /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- };
- 598F54B39EE5879BCA7F935D /* Build configuration list for PBXProject "MacTouchBar" */ = {
- isa = XCConfigurationList;
- buildConfigurations = (
- 598F50271FC9973E4E1165A6 /* Debug */,
- 598F519739E4CD4981ED13F0 /* Release */,
- );
- defaultConfigurationIsVisible = 0;
- defaultConfigurationName = Release;
- };
-/* End XCConfigurationList section */
- };
- rootObject = 598F5118DF5E14ADAD1AA66F /* Project object */;
-}
diff --git a/native/MacTouchBar/MacTouchBar.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/native/MacTouchBar/MacTouchBar.xcodeproj/project.xcworkspace/contents.xcworkspacedata
deleted file mode 100644
index 919434a6254f..000000000000
--- a/native/MacTouchBar/MacTouchBar.xcodeproj/project.xcworkspace/contents.xcworkspacedata
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
diff --git a/native/MacTouchBar/build.gradle b/native/MacTouchBar/build.gradle
deleted file mode 100644
index 93c19dfc2337..000000000000
--- a/native/MacTouchBar/build.gradle
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * This file was generated by the Gradle 'init' task.
- *
- * This is a general purpose Gradle build.
- * Learn how to create Gradle builds at https://guides.gradle.org/creating-new-gradle-builds/
- */
-
-apply plugin: 'objective-c'
-
-task installLib(type: Copy, group: "Custom", description: "Copies built library to the binaries directory") {
- from "${buildDir}/libs/nst/shared"
- into "${projectDir}/../../bin/mac"
- rename { String fileName ->
- fileName.replace("libnst.dylib", "libnst64.dylib")
- }
-}
-build.finalizedBy(installLib)
-
-model {
- platforms {
- x64 {
- architecture "x64"
- }
- // TODO:
- // need check whether touchbar presented on 32-bit
- // enable release-build
- }
-
- components {
- nst(NativeLibrarySpec) {
- sources {
- objc {
- source {
- srcDirs "src"
- }
- }
- }
- binaries.all {
- if (targetPlatform.operatingSystem.macOsX) {
- cCompiler.args '-framework', 'Foundation'
- linker.args '-framework', "Cocoa"
- } else {
- throw new GradleException("Unsupported platform")
- }
- }
- }
- }
- }
diff --git a/native/MacTouchBar/gradle/wrapper/gradle-wrapper.jar b/native/MacTouchBar/gradle/wrapper/gradle-wrapper.jar
deleted file mode 100644
index c44b679acd3f..000000000000
Binary files a/native/MacTouchBar/gradle/wrapper/gradle-wrapper.jar and /dev/null differ
diff --git a/native/MacTouchBar/gradle/wrapper/gradle-wrapper.properties b/native/MacTouchBar/gradle/wrapper/gradle-wrapper.properties
deleted file mode 100644
index 568c50bf3a48..000000000000
--- a/native/MacTouchBar/gradle/wrapper/gradle-wrapper.properties
+++ /dev/null
@@ -1,5 +0,0 @@
-distributionBase=GRADLE_USER_HOME
-distributionPath=wrapper/dists
-zipStoreBase=GRADLE_USER_HOME
-zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-4.5.1-bin.zip
diff --git a/native/MacTouchBar/gradlew b/native/MacTouchBar/gradlew
deleted file mode 100755
index cccdd3d517fc..000000000000
--- a/native/MacTouchBar/gradlew
+++ /dev/null
@@ -1,172 +0,0 @@
-#!/usr/bin/env sh
-
-##############################################################################
-##
-## Gradle start up script for UN*X
-##
-##############################################################################
-
-# Attempt to set APP_HOME
-# Resolve links: $0 may be a link
-PRG="$0"
-# Need this for relative symlinks.
-while [ -h "$PRG" ] ; do
- ls=`ls -ld "$PRG"`
- link=`expr "$ls" : '.*-> \(.*\)$'`
- if expr "$link" : '/.*' > /dev/null; then
- PRG="$link"
- else
- PRG=`dirname "$PRG"`"/$link"
- fi
-done
-SAVED="`pwd`"
-cd "`dirname \"$PRG\"`/" >/dev/null
-APP_HOME="`pwd -P`"
-cd "$SAVED" >/dev/null
-
-APP_NAME="Gradle"
-APP_BASE_NAME=`basename "$0"`
-
-# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-DEFAULT_JVM_OPTS=""
-
-# Use the maximum available, or set MAX_FD != -1 to use that value.
-MAX_FD="maximum"
-
-warn () {
- echo "$*"
-}
-
-die () {
- echo
- echo "$*"
- echo
- exit 1
-}
-
-# OS specific support (must be 'true' or 'false').
-cygwin=false
-msys=false
-darwin=false
-nonstop=false
-case "`uname`" in
- CYGWIN* )
- cygwin=true
- ;;
- Darwin* )
- darwin=true
- ;;
- MINGW* )
- msys=true
- ;;
- NONSTOP* )
- nonstop=true
- ;;
-esac
-
-CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
-
-# Determine the Java command to use to start the JVM.
-if [ -n "$JAVA_HOME" ] ; then
- if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
- # IBM's JDK on AIX uses strange locations for the executables
- JAVACMD="$JAVA_HOME/jre/sh/java"
- else
- JAVACMD="$JAVA_HOME/bin/java"
- fi
- if [ ! -x "$JAVACMD" ] ; then
- die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
- fi
-else
- JAVACMD="java"
- which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-
-Please set the JAVA_HOME variable in your environment to match the
-location of your Java installation."
-fi
-
-# Increase the maximum file descriptors if we can.
-if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
- MAX_FD_LIMIT=`ulimit -H -n`
- if [ $? -eq 0 ] ; then
- if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
- MAX_FD="$MAX_FD_LIMIT"
- fi
- ulimit -n $MAX_FD
- if [ $? -ne 0 ] ; then
- warn "Could not set maximum file descriptor limit: $MAX_FD"
- fi
- else
- warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
- fi
-fi
-
-# For Darwin, add options to specify how the application appears in the dock
-if $darwin; then
- GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
-fi
-
-# For Cygwin, switch paths to Windows format before running java
-if $cygwin ; then
- APP_HOME=`cygpath --path --mixed "$APP_HOME"`
- CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
- JAVACMD=`cygpath --unix "$JAVACMD"`
-
- # We build the pattern for arguments to be converted via cygpath
- ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
- SEP=""
- for dir in $ROOTDIRSRAW ; do
- ROOTDIRS="$ROOTDIRS$SEP$dir"
- SEP="|"
- done
- OURCYGPATTERN="(^($ROOTDIRS))"
- # Add a user-defined pattern to the cygpath arguments
- if [ "$GRADLE_CYGPATTERN" != "" ] ; then
- OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
- fi
- # Now convert the arguments - kludge to limit ourselves to /bin/sh
- i=0
- for arg in "$@" ; do
- CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
- CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
-
- if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
- eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
- else
- eval `echo args$i`="\"$arg\""
- fi
- i=$((i+1))
- done
- case $i in
- (0) set -- ;;
- (1) set -- "$args0" ;;
- (2) set -- "$args0" "$args1" ;;
- (3) set -- "$args0" "$args1" "$args2" ;;
- (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
- (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
- (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
- (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
- (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
- (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
- esac
-fi
-
-# Escape application args
-save () {
- for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
- echo " "
-}
-APP_ARGS=$(save "$@")
-
-# Collect all arguments for the java command, following the shell quoting and substitution rules
-eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
-
-# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
-if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
- cd "$(dirname "$0")"
-fi
-
-exec "$JAVACMD" "$@"
diff --git a/native/MacTouchBar/gradlew.bat b/native/MacTouchBar/gradlew.bat
deleted file mode 100644
index f9553162f122..000000000000
--- a/native/MacTouchBar/gradlew.bat
+++ /dev/null
@@ -1,84 +0,0 @@
-@if "%DEBUG%" == "" @echo off
-@rem ##########################################################################
-@rem
-@rem Gradle startup script for Windows
-@rem
-@rem ##########################################################################
-
-@rem Set local scope for the variables with windows NT shell
-if "%OS%"=="Windows_NT" setlocal
-
-set DIRNAME=%~dp0
-if "%DIRNAME%" == "" set DIRNAME=.
-set APP_BASE_NAME=%~n0
-set APP_HOME=%DIRNAME%
-
-@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
-set DEFAULT_JVM_OPTS=
-
-@rem Find java.exe
-if defined JAVA_HOME goto findJavaFromJavaHome
-
-set JAVA_EXE=java.exe
-%JAVA_EXE% -version >NUL 2>&1
-if "%ERRORLEVEL%" == "0" goto init
-
-echo.
-echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:findJavaFromJavaHome
-set JAVA_HOME=%JAVA_HOME:"=%
-set JAVA_EXE=%JAVA_HOME%/bin/java.exe
-
-if exist "%JAVA_EXE%" goto init
-
-echo.
-echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
-echo.
-echo Please set the JAVA_HOME variable in your environment to match the
-echo location of your Java installation.
-
-goto fail
-
-:init
-@rem Get command-line arguments, handling Windows variants
-
-if not "%OS%" == "Windows_NT" goto win9xME_args
-
-:win9xME_args
-@rem Slurp the command line arguments.
-set CMD_LINE_ARGS=
-set _SKIP=2
-
-:win9xME_args_slurp
-if "x%~1" == "x" goto execute
-
-set CMD_LINE_ARGS=%*
-
-:execute
-@rem Setup the command line
-
-set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
-
-@rem Execute Gradle
-"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
-
-:end
-@rem End local scope for the variables with windows NT shell
-if "%ERRORLEVEL%"=="0" goto mainEnd
-
-:fail
-rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
-rem the _cmd.exe /c_ return code!
-if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
-exit /b 1
-
-:mainEnd
-if "%OS%"=="Windows_NT" endlocal
-
-:omega
diff --git a/native/MacTouchBar/make.sh b/native/MacTouchBar/make.sh
new file mode 100755
index 000000000000..44d648b967ef
--- /dev/null
+++ b/native/MacTouchBar/make.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+rm -rf build
+mkdir build
+cd build
+cmake -DCMAKE_BUILD_TYPE=Release ..
+make install/strip VERBOSE=1
\ No newline at end of file
diff --git a/native/MacTouchBar/settings.gradle b/native/MacTouchBar/settings.gradle
deleted file mode 100644
index b115e0287f1b..000000000000
--- a/native/MacTouchBar/settings.gradle
+++ /dev/null
@@ -1,10 +0,0 @@
-/*
- * This file was generated by the Gradle 'init' task.
- *
- * The settings file is used to specify which projects to include in your build.
- *
- * Detailed information about configuring a multi-project build in Gradle can be found
- * in the user guide at https://docs.gradle.org/4.5.1/userguide/multi_project_builds.html
- */
-
-rootProject.name = 'MacTouchBar'
diff --git a/native/fsNotifier/mac/CMakeLists.txt b/native/fsNotifier/mac/CMakeLists.txt
index 34b553771d55..6417344ad93d 100644
--- a/native/fsNotifier/mac/CMakeLists.txt
+++ b/native/fsNotifier/mac/CMakeLists.txt
@@ -5,11 +5,11 @@ if(NOT APPLE)
message(FATAL_ERROR "macOS only.")
endif()
-set(CMAKE_C_FLAGS "-O2 -Wall -Wextra -Wpedantic -Wno-newline-eof")
set(CMAKE_C_STANDARD 11)
+set(CMAKE_OSX_ARCHITECTURES "x86_64;arm64")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.8)
-find_library(CORE_SERVICES CoreServices)
-
+add_compile_options("-fmodules" "-flto=full" "-Wall" "-Wextra" "-Wpedantic" "-Wno-newline-eof")
add_executable(fsnotifier fsnotifier.c)
-target_link_libraries(fsnotifier ${CORE_SERVICES})
\ No newline at end of file
+
+install(TARGETS fsnotifier DESTINATION ${CMAKE_CURRENT_LIST_DIR}/../../../bin/mac)
diff --git a/native/fsNotifier/mac/make.sh b/native/fsNotifier/mac/make.sh
index 57251349b0a9..44d648b967ef 100755
--- a/native/fsNotifier/mac/make.sh
+++ b/native/fsNotifier/mac/make.sh
@@ -1,9 +1,6 @@
#!/bin/sh
-
-C_FLAGS="-std=c11 -O2 -Wall -Wextra -Wpedantic -Wno-newline-eof"
-
-clang -arch x86_64 -mmacosx-version-min=10.8 -framework CoreServices -std=c11 $C_FLAGS -o fsnotifier_x86_64 fsnotifier.c
-clang -arch arm64 -mmacosx-version-min=10.8 -framework CoreServices -std=c11 $C_FLAGS -o fsnotifier_arm64 fsnotifier.c
-lipo -create fsnotifier_x86_64 fsnotifier_arm64 -o fsnotifier
-rm fsnotifier_arm64
-rm fsnotifier_x86_64
\ No newline at end of file
+rm -rf build
+mkdir build
+cd build
+cmake -DCMAKE_BUILD_TYPE=Release ..
+make install/strip VERBOSE=1
\ No newline at end of file