Skip to content

Commit

Permalink
Fix indices for brackets + macOS Universal Builds
Browse files Browse the repository at this point in the history
  • Loading branch information
donn committed Aug 28, 2023
1 parent 642051b commit bb4d06f
Show file tree
Hide file tree
Showing 6 changed files with 74 additions and 52 deletions.
21 changes: 14 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,12 @@ jobs:
run: |
yarn
yarn build
cp -r ./dist/*.zip ./nudelta-amd64.app.zip
cp -r ./dist/*.dmg ./nudelta-universal.app.dmg
- name: Upload App
uses: actions/upload-artifact@v3
with:
name: mac-app
path: ./nudelta-amd64.app.zip
path: ./nudelta-universal.app.dmg
publish:
name: Publish
runs-on: ubuntu-20.04
Expand Down Expand Up @@ -139,13 +139,20 @@ jobs:
A Windows `.exe`, a macOS `.app` and a Linux `.AppImage` have all been built.
On Windows, you will need to download and unzip the `.exe` file. You may see a Windows SmartScreen warning- you can safely ignore it.
On Windows, you will need to download and unzip the `.exe` file.
You may see a Windows SmartScreen warning- you can safely ignore it.
On macOS, you will need to download and unzip the `.app` file, then **Right-click > Open** the app on macOS. The app is not code-signed or notarized.
* Please note that you may need Rosetta 2 as there is no Apple Silicon build at the moment: first, though, please see the [Rosetta advisory in the Readme](https://github.com/donn/nudelta#rosetta).
On macOS, you will need to download the `.dmg` file, drag it into
your Applications folder, then **Right-click > Open** the app on
macOS. The app is not code-signed or notarized. The app is universal
with binaries for both x86-64 and aarch64, and Rosetta is not
required, but has not been thoroughly tested on Apple Silicon.
Use at your own risk.
On Linux, download the `.AppImage`, enable "allow executing file as program" in its properties (shown below), then double-click it.
* You may need to install `libudev` separately- on Ubuntu, you can run `sudo apt-get install -y libudev`.
On Linux, download the `.AppImage`, enable "allow executing file as
program" in its properties (shown below), then double-click it.
* You may need to install `libudev` separately- on Ubuntu, you can
run `sudo apt-get install -y libudev`.
![Setting Linux execute permission with the GNOME File Browser](https://raw.githubusercontent.com/donn/nudelta/main/res/linux_exec_permission.png)
files: |
Expand Down
80 changes: 43 additions & 37 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,30 @@ cmake_policy(SET CMP0042 NEW)

project(nudelta)

if(NOT DEFINED NODE_RUNTIME)
message( FATAL_ERROR "NODE_RUNTIME is not defined. Use `cmake-js` from the root of the repo." )
endif()

# Get version from package.json
file(READ ${CMAKE_CURRENT_SOURCE_DIR}/package.json PACKAGE_JSON)
string(JSON NUDELTA_VERSION GET ${PACKAGE_JSON} "version")
set(PROJECT_VERSION ${NUDELTA_VERSION})

set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED True)
set(CMAKE_OSX_ARCHITECTURES x86_64)
set(CMAKE_OSX_ARCHITECTURES arm64;x86_64)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(BUILD_SHARED_LIBS FALSE)
set(CMAKE_OSX_DEPLOYMENT_TARGET "11")

if(APPLE)
set(NODE_ARCH arm64;x86_64)
set(CMAKE_THREAD_LIBS_INIT "-lpthread")
set(CMAKE_HAVE_THREADS_LIBRARY 1)
set(CMAKE_USE_WIN32_THREADS_INIT 0)
set(CMAKE_USE_PTHREADS_INIT 1)
set(THREADS_PREFER_PTHREAD_FLAG ON)
endif()

# Hidapi does not use `option`
set(HIDAPI_WITH_LIBUSB FALSE)
Expand All @@ -26,7 +40,9 @@ option(YAML_CPP_BUILD_TOOLS OFF)
add_subdirectory(submodules/yaml-cpp)

add_subdirectory(submodules/scope_guard)

add_subdirectory(submodules/fmt)

add_subdirectory(submodules/ssco)

# Common
Expand All @@ -48,53 +64,43 @@ file(GLOB nudelta_lib_src "lib/*.cpp")
add_library(nd ${nudelta_lib_src} ${CMAKE_CURRENT_BINARY_DIR}/res.cpp)
add_dependencies(nd res_file)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(nd PRIVATE hidapi::hidraw)
else ()
target_link_libraries(nd PRIVATE hidapi)
endif ()
target_link_libraries(nd PRIVATE yaml-cpp)
target_link_libraries(nd PRIVATE fmt)
target_link_libraries(nd PRIVATE scope_guard)
target_link_libraries(nd hidapi::hidraw)
else()
target_link_libraries(nd hidapi)
endif()
target_link_libraries(nd yaml-cpp)
target_link_libraries(nd fmt)
target_link_libraries(nd scope_guard)

if(!MSVC)
target_compile_options(nd PRIVATE -Wall -Wextra -Wpedantic -Werror)
target_compile_options(nd -Wall -Wextra -Wpedantic -Werror)
endif()


# node-libnd
if (NODE_RUNTIME)
add_definitions(-DNAPI_VERSION=4)
include_directories(${CMAKE_JS_INC})
include_directories(${CMAKE_SOURCE_DIR}/node_modules/node-addon-api)
include_directories(${CMAKE_SOURCE_DIR}/node_modules/node-api-headers/include)
add_library(node-libnd SHARED src/node.cpp ${CMAKE_JS_SRC})
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(node-libnd PRIVATE hidapi::hidraw)
else ()
target_link_libraries(node-libnd PRIVATE hidapi)
endif ()
target_link_libraries(node-libnd PRIVATE yaml-cpp)
target_link_libraries(node-libnd PRIVATE fmt)
target_link_libraries(node-libnd PRIVATE scope_guard)
target_link_libraries(node-libnd PRIVATE nd)
target_link_libraries(node-libnd PRIVATE ${CMAKE_JS_LIB})

set_target_properties(node-libnd PROPERTIES PREFIX "" SUFFIX ".node")
endif()
add_definitions(-DNAPI_VERSION=4)
include_directories(${CMAKE_JS_INC})
include_directories(${CMAKE_SOURCE_DIR}/node_modules/node-addon-api)
include_directories(${CMAKE_SOURCE_DIR}/node_modules/node-api-headers/include)
add_library(node-libnd SHARED src/node.cpp ${CMAKE_JS_SRC})
target_link_libraries(node-libnd nd)
target_link_libraries(node-libnd ${CMAKE_JS_LIB})

set_target_properties(node-libnd PROPERTIES PREFIX "" SUFFIX ".node")

# nudelta
add_executable(nudelta src/main.cpp)
add_compile_definitions(NUDELTA_VERSION="${CMAKE_PROJECT_VERSION}")
target_link_libraries(nudelta PRIVATE nd)
target_link_libraries(nudelta nd)
if (CMAKE_SYSTEM_NAME STREQUAL "Linux")
target_link_libraries(nudelta PRIVATE hidapi::hidraw)
else ()
target_link_libraries(nudelta PRIVATE hidapi)
endif ()
target_link_libraries(nudelta PRIVATE yaml-cpp)
target_link_libraries(nudelta PRIVATE fmt)
target_link_libraries(nudelta PRIVATE ssco)
target_link_libraries(nudelta PRIVATE scope_guard)
target_link_libraries(nudelta hidapi::hidraw)
else()
target_link_libraries(nudelta hidapi)
endif()
target_link_libraries(nudelta yaml-cpp)
target_link_libraries(nudelta fmt)
target_link_libraries(nudelta ssco)
target_link_libraries(nudelta scope_guard)


install(TARGETS nudelta)
5 changes: 5 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.7.4
- Fix internal indices for `[` and `]` for Air75
- Build universal binary for macOS
- Internal changes to build system

# 0.7.3
- Fix USB handle mixup affecting Windows builds
- Fix GUI bug with remapping alternate IDs
Expand Down
12 changes: 8 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "nudelta",
"author": "Mohamed Gaber <[email protected]>",
"version": "0.7.3",
"version": "0.7.4",
"license": "GPL-3.0-or-later",
"homepage": "https://github.com/donn/nudelta#readme",
"description": "An open-source alternative to the NuPhy Console",
Expand Down Expand Up @@ -44,8 +44,7 @@
"main": "index.cjs",
"cmake-js": {
"runtime": "electron",
"runtimeVersion": "21.2.1",
"arch": "x64"
"runtimeVersion": "21.2.1"
},
"build": {
"appId": "website.donn.nudelta",
Expand All @@ -58,7 +57,12 @@
"mac": {
"category": "public.app-category.utilities",
"target": [
"zip"
{
"target": "dmg",
"arch": [
"universal"
]
}
],
"icon": "./res/nudelta.icns"
},
Expand Down
4 changes: 2 additions & 2 deletions res/Air75/indices_mac.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,8 +65,8 @@ semicolon: 63
minus: 67
equal: 73
quote: 69
lbracket: 68
rbracket: 159
lbracket: 159
rbracket: 68
backslash: 160
fwdslash: 64
comma: 164
Expand Down
4 changes: 2 additions & 2 deletions res/Air75/indices_win.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ semicolon: 63
minus: 67
equal: 73
quote: 69
lbracket: 68
rbracket: 159
lbracket: 159
rbracket: 68
backslash: 160
fwdslash: 64
comma: 164
Expand Down

0 comments on commit bb4d06f

Please sign in to comment.