-
Notifications
You must be signed in to change notification settings - Fork 0
macos dev compatibility #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
172a42d
61ed291
25359b2
0878f87
5c74aa9
5e21675
604a0ab
dbfd5b4
3d9800d
f0c5701
2c387f5
bafa755
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,38 @@ | ||
| # Pinned style for OALS. Tuned to match what's already in the tree | ||
| # (4-space indent, K&R braces, ref/pointer attached to the variable, | ||
| # no hard column cap). Apply to new code via editor-on-save; do NOT | ||
| # mass-format existing files in a single sweep. | ||
| --- | ||
| BasedOnStyle: LLVM | ||
| Language: Cpp | ||
| Standard: c++20 | ||
|
|
||
| IndentWidth: 4 | ||
| TabWidth: 4 | ||
| UseTab: Never | ||
| ColumnLimit: 100 | ||
|
|
||
| BreakBeforeBraces: Attach | ||
| AllowShortFunctionsOnASingleLine: Empty | ||
| AllowShortIfStatementsOnASingleLine: Never | ||
| AllowShortLoopsOnASingleLine: false | ||
| SpaceAfterCStyleCast: false | ||
| PointerAlignment: Left | ||
| ReferenceAlignment: Left | ||
| DerivePointerAlignment: false | ||
|
|
||
| AccessModifierOffset: -4 | ||
| NamespaceIndentation: None | ||
| FixNamespaceComments: true | ||
|
|
||
| IncludeBlocks: Preserve | ||
| SortIncludes: false | ||
|
|
||
| AlignAfterOpenBracket: Align | ||
| BinPackParameters: false | ||
| BinPackArguments: true | ||
| AllowAllParametersOfDeclarationOnNextLine: true | ||
| ConstructorInitializerAllOnOneLineOrOnePerLine: true | ||
|
|
||
| EmptyLineBeforeAccessModifier: LogicalBlock | ||
| SeparateDefinitionBlocks: Leave |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,47 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: ['**'] | ||
| pull_request: | ||
| branches: ['**'] | ||
|
|
||
| jobs: | ||
| build: | ||
| name: ${{ matrix.os }} (host=${{ matrix.host_backends }}) | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| include: | ||
| # Linux: default Zephyr-firmware-shaped build (no host backends) is | ||
| # the path the firmware repos consume — keep it green. | ||
| - os: ubuntu-latest | ||
| host_backends: OFF | ||
| # Host-dev build path used by OALSEngine + sim_switch. | ||
| - os: ubuntu-latest | ||
| host_backends: ON | ||
| - os: macos-latest | ||
| host_backends: ON | ||
| runs-on: ${{ matrix.os }} | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - name: Install deps (Linux) | ||
| if: runner.os == 'Linux' | ||
| run: | | ||
| sudo apt-get update | ||
| sudo apt-get install -y --no-install-recommends cmake ninja-build | ||
|
|
||
| - name: Install deps (macOS) | ||
| if: runner.os == 'macOS' | ||
| run: brew install cmake ninja | ||
|
|
||
| - name: Configure | ||
| run: | | ||
| cmake -G Ninja -B build \ | ||
| -DCMAKE_BUILD_TYPE=RelWithDebInfo \ | ||
| -DOAN_HOST_BACKENDS=${{ matrix.host_backends }} | ||
|
|
||
| - name: Build | ||
| run: cmake --build build |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| # pre-commit hooks for OpenAudioNetwork. Install once per clone: | ||
| # pip install pre-commit && pre-commit install | ||
| repos: | ||
| - repo: https://github.com/pre-commit/mirrors-clang-format | ||
| rev: v17.0.6 | ||
| hooks: | ||
| - id: clang-format | ||
| types_or: [c++, c] | ||
| exclude: '^build/' | ||
|
|
||
| - repo: https://github.com/pre-commit/pre-commit-hooks | ||
| rev: v5.0.0 | ||
| hooks: | ||
| - id: trailing-whitespace | ||
| - id: end-of-file-fixer | ||
| - id: check-merge-conflict | ||
| - id: check-yaml | ||
| - id: check-added-large-files | ||
| args: ['--maxkb=512'] |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -7,5 +7,18 @@ if(NO_THREADS) | |
| add_compile_definitions(NO_THREADS) | ||
| endif (NO_THREADS) | ||
|
|
||
| # OAN_HOST_BACKENDS: switches in the host-side transport seam (SimTransport, | ||
| # RawLinuxTransport, RawMacTransport). The define is normally injected by | ||
| # the parent OALS build; mirror the logic here so OAN is self-buildable | ||
| # (e.g. for CI of OAN-only changes). Forced ON on macOS — there is no | ||
| # other working transport on Apple at the moment. | ||
| option(OAN_HOST_BACKENDS "Build host dev transports + RT shim" OFF) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The RT shim is a good idea, I think we should use it for all platforms and leave it on permanently |
||
| if(APPLE) | ||
| set(OAN_HOST_BACKENDS ON CACHE BOOL "Build host dev transports + RT shim" FORCE) | ||
| endif() | ||
| if(OAN_HOST_BACKENDS) | ||
| add_compile_definitions(OAN_HOST_BACKENDS) | ||
| endif() | ||
|
|
||
| add_subdirectory(common) | ||
| add_subdirectory(netutils) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. AFAIK we are already using the system to wait for new data, so technically we are not doing busy polling. The timeout is a good idea though. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -5,10 +5,47 @@ set(OAN_UTILS_SOURCES | |
| LowLatSocket.h | ||
| ) | ||
|
|
||
| if(NOT EMBEDDED_BUILD) | ||
| list(APPEND OAN_UTILS_SOURCES | ||
| platform/rt.h | ||
| platform/rt.cpp | ||
| ) | ||
| endif() | ||
|
|
||
| if(OAN_HOST_BACKENDS) | ||
| list(APPEND OAN_UTILS_SOURCES | ||
| transport/ITransport.h | ||
| transport/ITransport.cpp | ||
| transport/SimTransport.h | ||
| transport/SimTransport.cpp | ||
| transport/RawMacTransport.h | ||
| transport/RawMacTransport.cpp | ||
| ) | ||
| if(NOT APPLE) | ||
| list(APPEND OAN_UTILS_SOURCES | ||
| transport/RawLinuxTransport.h | ||
| transport/RawLinuxTransport.cpp | ||
| ) | ||
| endif() | ||
| endif() | ||
|
|
||
| if(EMBEDDED_BUILD) | ||
| add_library(oannetutils STATIC ${OAN_UTILS_SOURCES}) | ||
| else () | ||
| add_library(oannetutils SHARED ${OAN_UTILS_SOURCES}) | ||
| endif (EMBEDDED_BUILD) | ||
|
|
||
| target_include_directories(oannetutils PUBLIC ${PROJECT_SOURCE_DIR}) | ||
| target_include_directories(oannetutils PUBLIC ${PROJECT_SOURCE_DIR}) | ||
|
|
||
| # oannetutils and oancommon have a mutual symbol dependency: | ||
| # LowLatSocket (in netutils) calls NetworkMapper::get_mac_by_uid | ||
| # (in common), and common's ClockMaster/ClockSlave/AudioRouter all | ||
| # instantiate LowLatSocket. CMake forbids cyclic target_link_libraries | ||
| # on shared libs, so we relax each library's own link step (the symbol | ||
| # is unresolved in the .so but always resolved at exe link time when | ||
| # both .so's appear on the line — see executables that link them). | ||
| if(APPLE) | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should not be necessary. If it is, the architecture of the code must change so that it is not a problem anymore on the linking stage. |
||
| target_link_options(oannetutils PRIVATE LINKER:-undefined,dynamic_lookup) | ||
| elseif(UNIX) | ||
| target_link_options(oannetutils PRIVATE LINKER:-z,undefs) | ||
| endif() | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice addition. We should check for embedded platforms that it still compiles though. e.g. trying to cross-compile the lib with gcc-arm-none-eabi or in a Zephyr context.