diff --git a/.clang-format b/.clang-format new file mode 100644 index 0000000..1d0a2df --- /dev/null +++ b/.clang-format @@ -0,0 +1,34 @@ +--- +BasedOnStyle: Google +IndentWidth: 4 +ColumnLimit: 120 +UseTab: Never + +--- +Language: Cpp + +AccessModifierOffset: -4 +AllowShortBlocksOnASingleLine: true +AllowShortCaseLabelsOnASingleLine: true +AllowShortFunctionsOnASingleLine: InlineOnly + +BreakBeforeBraces: Custom +BraceWrapping: + AfterClass: false + AfterControlStatement: false + AfterEnum: false + AfterFunction: false + AfterNamespace: false + AfterObjCDeclaration: false + AfterStruct: false + AfterUnion: false + BeforeCatch: false + BeforeElse: false + IndentBraces: false + +Cpp11BracedListStyle: false + +MaxEmptyLinesToKeep: 2 + +--- + diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..ba475fb --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,152 @@ +name: Build EigenLite +permissions: + contents: write + +on: + push: + tags: + - '*' + +jobs: + # Ubuntu - would need libusb + + # build: + # runs-on: ${{ matrix.os }} + + # strategy: + # # Set fail-fast to false to ensure that feedback is delivered for all matrix combinations. Consider changing this to true when your workflow is stable. + # fail-fast: false + + # # Set up a matrix to run the following 3 configurations: + # # 1. + # # 2. + # # 3. + # # + # # To add more build types (Release, Debug, RelWithDebInfo, etc.) customize the build_type list. + # matrix: + # # os: [ubuntu-latest] + # # os: [ubuntu-latest, windows-latest] + # build_type: [Release] + # c_compiler: [clang] + # cpp_compiler: [clang++] + + # steps: + # - name: Checkout repository + # uses: actions/checkout@v3 + # with: + # submodules: 'true' + + # - name: Set reusable strings + # # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. + # id: strings + # shell: bash + # run: | + # echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + # - name: Configure CMake + # # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + # run: > + # cmake -B ${{ steps.strings.outputs.build-output-dir }} + # -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + # -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + # -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + # -S ${{ github.workspace }} + + # - name: Build + # # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + # run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + + # - name: Upload artifacts + # uses: actions/upload-artifact@v3 + # with: + # path: dist/* + # name: ${{runner.os}} + + build-mac: + name: mac + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + build_type: [Release] + c_compiler: [clang] + cpp_compiler: [clang++] + platform: [x86_64, arm64] + steps: + - name: Checkout repository + uses: actions/checkout@v3 + with: + submodules: 'true' + + - name: Set reusable strings + # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file. + id: strings + shell: bash + run: | + echo "build-output-dir=${{ github.workspace }}/build" >> "$GITHUB_OUTPUT" + + - name: Configure CMake + # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make. + # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type + run: > + cmake -B ${{ steps.strings.outputs.build-output-dir }} + -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} + -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }} + -DCMAKE_C_COMPILER=${{ matrix.c_compiler }} + -DCMAKE_OSX_ARCHITECTURES=${{ matrix.platform }} + -S ${{ github.workspace }} + + - name: Build + # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator). + run: cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }} + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + path: dist/* + name: mac-${{ matrix.platform }} + + publish-header: + name: publish-header + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v3 + - name: Upload artifact + uses: actions/upload-artifact@v3 + with: + path: ${{ github.workspace }}/eigenapi/eigenapi.h + name: header + + + publish: + name: Publish release + # only create a release if a tag was created that is called e.g. v1.2.3 + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + # needs: [build, build-mac,publish-header] + needs: [build-mac,publish-header] + steps: + - uses: actions/checkout@v3 + - uses: FranzDiebold/github-env-vars-action@v2 + - name: Create Release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ github.ref }} + name: Release ${{ env.CI_REF_NAME }} + body: | + ${{ env.CI_REPOSITORY_NAME }} EigenLite ${{ env.CI_REF_NAME }} + draft: false + prerelease: false + - uses: actions/download-artifact@v3 + with: + path: _artifacts + - name: Upload release assets + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: _artifacts/**/* + tag: ${{ github.ref }} + file_glob: true diff --git a/.gitignore b/.gitignore index b1bd5de..9f0cf9b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,6 @@ *.lock profile **/build/* -build* **/*.sublime-workspace cmake-build*/ @@ -30,11 +29,8 @@ Podfile.lock !default.perspectivev3 *.xccheckout -**/*.pd_linux -**/*.pd_darwin -**/*.dll -**/*.o build/**/*.so build/**/*.dylib +dist/* diff --git a/eigenapi/CMakeLists.txt b/eigenapi/CMakeLists.txt index 3c5c8c0..beeda99 100644 --- a/eigenapi/CMakeLists.txt +++ b/eigenapi/CMakeLists.txt @@ -3,6 +3,24 @@ project (eigenapi) # USE_DUMMY_PICO - if you do not want to use prebuilt binaries (advanced use only), implies dynamic! # USE_DYNAMIC - use shared libraries for pico decoder + +# REL_DIR not supported currently +set(REL_DIR "${CMAKE_SOURCE_DIR}/release/eigenapi") + +if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") + set(REL_DIR "${REL_DIR}/macOs/${CMAKE_OSX_ARCHITECTURES}") + set(REL_FILE "eigenapi-macOs-${CMAKE_OSX_ARCHITECTURES}") +elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux") + set(REL_DIR "${REL_DIR}/linux/${CMAKE_HOST_SYSTEM_PROCESSOR}") + set(REL_FILE "eigenapi-linux-${CMAKE_HOST_SYSTEM_PROCESSOR}") +elseif(CMAKE_SYSTEM_NAME STREQUAL "Windows") + set(REL_DIR "${REL_DIR}/windows/${CMAKE_HOST_SYSTEM_PROCESSOR}") + set(REL_FILE "eigenapi-win-${CMAKE_HOST_SYSTEM_PROCESSOR}") +else() + set(REL_DIR "${REL_DIR}/unknown/${CMAKE_HOST_SYSTEM_PROCESSOR}") + set(REL_FILE "eigenapi-unknown-${CMAKE_HOST_SYSTEM_PROCESSOR}") +endif() + if(CMAKE_SYSTEM_NAME STREQUAL "Darwin") #temporary, so I can see 'real' errors set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-deprecated-declarations") @@ -87,7 +105,10 @@ target_include_directories(eigenapi PUBLIC . ) - +add_custom_command(TARGET eigenapi POST_BUILD +COMMAND ${CMAKE_COMMAND} -E make_directory ${CMAKE_SOURCE_DIR}/dist +COMMAND ${CMAKE_COMMAND} -E copy $ ${CMAKE_SOURCE_DIR}/dist/${REL_FILE}.a +) if(CMAKE_COMPILER_IS_GNUCC OR CMAKE_COMPILER_IS_GNUCXX) target_link_libraries(eigenapi atomic) diff --git a/resources/picodecoder/unsupported/pico_decoder_1_0_0.dll b/resources/picodecoder/unsupported/pico_decoder_1_0_0.dll new file mode 100755 index 0000000..042c920 Binary files /dev/null and b/resources/picodecoder/unsupported/pico_decoder_1_0_0.dll differ