diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4362ba9..03a0887 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -33,12 +33,6 @@ jobs: with: python-version: ${{ matrix.python-version }} - - name: Linux - Install prerequisites - if: runner.os == 'Linux' - run: | - sudo apt update - sudo apt install gcc-11 g++-11 - - name: Create virtual environment run: python3 -m venv .pyenv diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index adcbfa2..cc51297 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -47,7 +47,8 @@ jobs: if: "contains(matrix.config.os, 'ubuntu')" run: | sudo apt update - sudo apt install gcc-11 g++-11 + sudo apt install gcc-9-aarch64-linux-gnu g++-9-aarch64-linux-gnu + ls /usr/bin/ | grep aarch64 - name: Set up Python uses: actions/setup-python@v2 @@ -111,26 +112,46 @@ jobs: - name: Linux - Configure & Build (Release) if: "contains(matrix.config.os, 'ubuntu')" run: | - ./build.py conan-install - ./build.py configure - ./build.py build + ./build.py conan-install -o .conan-x86_64 -pr:h profiles/linux.release.x86_64 + ./build.py configure -t .conan-x86_64/build/Release/generators/conan_toolchain.cmake -b .build-x86_64 -bt Release + ./build.py build -b .build-x86_64 + file .build-x86_64/opencl-language-server + + ./build.py conan-install -o .conan-armv8 -pr:h profiles/linux.release.armv8 + ./build.py configure -t .conan-armv8/build/Release/generators/conan_toolchain.cmake -b .build-armv8 -bt Release + ./build.py build -b .build-armv8 + file .build-armv8/opencl-language-server - name: Linux - Archive Artifact if: "contains(matrix.config.os, 'ubuntu')" run: | - cd ${{github.workspace}}/.build/ + cd ${{github.workspace}}/.build-x86_64/ tar -czvf opencl-language-server-linux-x86_64.tar.gz opencl-language-server + + cd ${{github.workspace}}/.build-armv8/ + tar -czvf opencl-language-server-linux-arm64.tar.gz opencl-language-server - - name: Linux - Upload Artifact + - name: Linux - Upload Artifact (x86_64) if: "contains(matrix.config.os, 'ubuntu')" uses: actions/upload-release-asset@v1 env: GITHUB_TOKEN: ${{github.token}} with: upload_url: ${{needs.create_release.outputs.upload_url}} - asset_path: ${{github.workspace}}/.build/opencl-language-server-linux-x86_64.tar.gz + asset_path: ${{github.workspace}}/.build-x86_64/opencl-language-server-linux-x86_64.tar.gz asset_name: opencl-language-server-linux-x86_64.tar.gz asset_content_type: application/gzip + + - name: Linux - Upload Artifact (armv8) + if: "contains(matrix.config.os, 'ubuntu')" + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{github.token}} + with: + upload_url: ${{needs.create_release.outputs.upload_url}} + asset_path: ${{github.workspace}}/.build-armv8/opencl-language-server-linux-arm64.tar.gz + asset_name: opencl-language-server-linux-arm64.tar.gz + asset_content_type: application/gzip - name: Mac - Configure & Build (Release) @@ -139,14 +160,17 @@ jobs: ./build.py conan-install -o .conan-x86_64 -pr:h profiles/darwin.release.x86_64 ./build.py configure -t .conan-x86_64/build/Release/generators/conan_toolchain.cmake -b .build-x86_64 -bt Release ./build.py build -b .build-x86_64 + file .build-x86_64/opencl-language-server ./build.py conan-install -o .conan-armv8 -pr:h profiles/darwin.release.armv8 ./build.py configure -t .conan-armv8/build/Release/generators/conan_toolchain.cmake -b .build-armv8 -bt Release ./build.py build -b .build-armv8 + file .build-armv8/opencl-language-server mkdir -p .build-universal/ lipo -create -output .build-universal/opencl-language-server .build-x86_64/opencl-language-server .build-armv8/opencl-language-server lipo -archs .build-universal/opencl-language-server + file .build-universal/opencl-language-server - name: Mac - Archive Artifact if: "contains(matrix.config.os, 'macos')" @@ -196,7 +220,7 @@ jobs: - name: Linux - Archive Licenses if: "contains(matrix.config.os, 'ubuntu')" run: | - cd ${{github.workspace}}/.conan-install + cd ${{github.workspace}}/.conan-x86_64 tar -czvf licenses.tar.gz licenses - name: Linux - Upload Licenses @@ -206,6 +230,6 @@ jobs: GITHUB_TOKEN: ${{github.token}} with: upload_url: ${{needs.create_release.outputs.upload_url}} - asset_path: ${{github.workspace}}/.conan-install/licenses.tar.gz + asset_path: ${{github.workspace}}/.conan-x86_64/licenses.tar.gz asset_name: licenses.tar.gz asset_content_type: application/gzip diff --git a/DEV.md b/DEV.md index 2cc117a..7720550 100644 --- a/DEV.md +++ b/DEV.md @@ -61,7 +61,20 @@ xcrun altool --notarization-history 0 --asc-provider ${PROVIDER} --password "@ke xcrun altool --notarization-info ${REQUEST_ID} --password "@keychain:AC_PASSWORD" ``` -### CLI +## Linux + +### Cross compilation (x86_64 -> armv8) + +```shell +sudo apt install gcc-9-aarch64-linux-gnu g++-9-aarch64-linux-gnu +./build.py conan-install -o .conan-armv8 -pr:h profiles/linux.release.armv8 +./build.py configure -t .conan-armv8/build/Release/generators/conan_toolchain.cmake -b .build-armv8 -bt Release +./build.py build -b .build-armv8 +``` + +*ubuntu-20.04, gcc-9* + +## CLI The `opencl-language-server` offers support for file logging, as well as subcommands that allow you to test its functionality without starting the server. diff --git a/conanfile.py b/conanfile.py index b9edb7d..2b8dc60 100644 --- a/conanfile.py +++ b/conanfile.py @@ -16,7 +16,7 @@ class OpenCLLanguageServerConanfile(ConanFile): homepage = "https://github.com/Galarius/opencl-language-server" topics = ("opencl", "language-server") settings = "os", "compiler", "build_type", "arch" - generators = "CMakeToolchain", "CMakeDeps" + generators = "CMakeToolchain", "CMakeDeps", "VirtualBuildEnv" options = {"enable_testing": [True, False]} default_options = {"enable_testing": False} requires = ( diff --git a/libclang/CMakeLists.txt b/libclang/CMakeLists.txt index 2580c8c..2bb8466 100644 --- a/libclang/CMakeLists.txt +++ b/libclang/CMakeLists.txt @@ -7,6 +7,7 @@ if(DEFINED LLVM_ROOT_DIR AND NOT LLVM_ROOT_DIR STREQUAL "") # LLVM_ROOT_DIR is already defined else() # Download prebuilt static llvm & clang libraries + # TODO: prebuilt libs for Linux ARM are missing file(STRINGS ${CMAKE_CURRENT_SOURCE_DIR}/libclang-urls.txt libclang_entries) message(STATUS "Parsing ${CMAKE_CURRENT_SOURCE_DIR}/libclang-urls.txt...") foreach(entry ${libclang_entries}) diff --git a/profiles/linux.common b/profiles/linux.common index c714f4d..474bb5c 100644 --- a/profiles/linux.common +++ b/profiles/linux.common @@ -2,7 +2,7 @@ [settings] compiler=gcc -compiler.version=11 +compiler.version=9 compiler.libcxx=libstdc++11 compiler.cppstd = gnu17 os=Linux diff --git a/profiles/linux.common.armv8 b/profiles/linux.common.armv8 new file mode 100644 index 0000000..593ad35 --- /dev/null +++ b/profiles/linux.common.armv8 @@ -0,0 +1,9 @@ +# Common settings (Linux) + +[buildenv] +CC=/usr/bin/aarch64-linux-gnu-gcc-9 +CXX=/usr/bin/aarch64-linux-gnu-g++-9 +LD=/usr/bin/aarch64-linux-gnu-ld + +[conf] +tools.build:compiler_executables={"c": "/usr/bin/aarch64-linux-gnu-gcc-9", "cpp": "/usr/bin/aarch64-linux-gnu-g++-9"} \ No newline at end of file diff --git a/profiles/linux.debug.armv8 b/profiles/linux.debug.armv8 new file mode 100644 index 0000000..d887d81 --- /dev/null +++ b/profiles/linux.debug.armv8 @@ -0,0 +1,6 @@ +include(linux.common) +include(linux.common.armv8) + +[settings] +arch=armv8 +build_type=Debug diff --git a/profiles/linux.release.armv8 b/profiles/linux.release.armv8 new file mode 100644 index 0000000..0292de2 --- /dev/null +++ b/profiles/linux.release.armv8 @@ -0,0 +1,6 @@ +include(linux.common) +include(linux.common.armv8) + +[settings] +arch=armv8 +build_type=Release