diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 8aa3373..f0d92bf 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -22,6 +22,6 @@ jobs: with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: build/Release/dia-merge.zip - asset_name: dia-merge-x86_64.zip + asset_name: dia-merge-arm64.zip tag: ${{ github.ref }} overwrite: true diff --git a/CMakeLists.txt b/CMakeLists.txt index f7a4490..10c473c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -9,13 +9,13 @@ find_package(Curses REQUIRED) function(add_dia_executable execname) add_executable("${execname}" "${execname}.cpp") target_include_directories("${execname}" PRIVATE ${LLVM_DIR}/include) - target_compile_features("${execname}" PUBLIC cxx_std_14) + target_compile_features("${execname}" PUBLIC cxx_std_17) set_target_properties("${execname}" PROPERTIES CXX_EXTENSIONS OFF) target_compile_options("${execname}" PRIVATE -Wall -Wextra -fblocks -Wno-unused-parameter) if(NOT LLVM_ENABLE_RTTI) target_compile_options("${execname}" PRIVATE -fno-rtti) endif() - target_link_libraries("${execname}" PUBLIC ${LLVM_DIR}/lib/libclangFrontend.a ${LLVM_DIR}/lib/libclangEdit.a ${LLVM_DIR}/lib/libclangLex.a ${LLVM_DIR}/lib/libclangBasic.a ${LLVM_DIR}/lib/libLLVMBitstreamReader.a ${LLVM_DIR}/lib/libLLVMSupport.a ${CURSES_LIBRARIES} + target_link_libraries("${execname}" PUBLIC ${LLVM_DIR}/lib/libclangFrontend.a ${LLVM_DIR}/lib/libclangEdit.a ${LLVM_DIR}/lib/libclangLex.a ${LLVM_DIR}/lib/libclangBasic.a ${LLVM_DIR}/lib/libLLVMBitstreamReader.a ${LLVM_DIR}/lib/libLLVMSupport.a ${LLVM_DIR}/lib/libLLVMTargetParser.a ${CURSES_LIBRARIES} ) target_link_options("${execname}" PRIVATE -dead_strip) endfunction() diff --git a/README.md b/README.md index 9b06cf4..c6a9659 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ _Note: There is a limit of the `.dia` file that this mode guarantees consistency ### DIA file -DIA file is a bitcode formatted file that can be inspected with LLVM's bc-analyzer tool. +DIA file is a bitcode formatted file that can be inspected with LLVM's bc-analyzer tool. ## Example @@ -43,7 +43,7 @@ If a project has source root `/source_root/`, on a producer side call: ``` -dia-merge -r `^/source_root/=./` -output /SomeDerivedData/Example/Build/Intermediates.noindex/Example.build/Debug-iphonesimulator/Example.build/Objects-normal/arm64/Example.dia /SomeDerivedData/Example/Build/Intermediates.noindex/Example.build/Debug-iphonesimulator/Example.build/Objects-normal/arm64/AppDelegate.dia /SomeDerivedData/Example/Build/Intermediates.noindex/Example.build/Debug-iphonesimulator/Example.build/Objects-normal/arm64/ViewController.dia +dia-merge -r `^/source_root/=./` -output /SomeDerivedData/Example/Build/Intermediates.noindex/Example.build/Debug-iphonesimulator/Example.build/Objects-normal/arm64/Example.dia /SomeDerivedData/Example/Build/Intermediates.noindex/Example.build/Debug-iphonesimulator/Example.build/Objects-normal/arm64/AppDelegate.dia /SomeDerivedData/Example/Build/Intermediates.noindex/Example.build/Debug-iphonesimulator/Example.build/Objects-normal/arm64/ViewController.dia ``` On a consumer side, where a source root is `/other_source_root/`, call: @@ -56,12 +56,12 @@ dia-merge -r `^\./=/other_source_root/` -output build_system/ExpectedLocation.di ## Build Instructions To build, first download LLVM prebuilt binary from https://github.com/llvm/llvm-project/releases, e.g. https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz -So far, LLVM publishes only x86_64 architecture, so on arm64 machines, rosetta2 emulation is needed. +LLVM publishes only arm64 architecture, so on x86_64 machines, you may need to built it locally. ```sh mkdir build cd build -cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 -DLLVM_DIR=#{path_to_downloaded_clang} .. +cmake -G Ninja -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64 -DLLVM_DIR=#{path_to_downloaded_clang} .. ninja ``` @@ -70,7 +70,7 @@ See [RELEASING.md](RELEASING.md) for a fat-architecture. Or, if you prefer Xcode for building and debugging, you can replace the last 2 lines with the following: ``` -cmake -G Xcode -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 -DLLVM_DIR=#{path_to_downloaded_clang} .. +cmake -G Xcode -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64 -DLLVM_DIR=#{path_to_downloaded_clang} .. open dia-merge.xcodeproj ``` @@ -84,7 +84,7 @@ cd build curl -L "https://github.com/llvm/llvm-project/releases/download/llvmorg-13.0.0/clang+llvm-13.0.0-x86_64-apple-darwin.tar.xz" --output clang.zip mkdir -p clang-downloaded tar -xvf ./clang.zip -C clang-downloaded --strip 1 -cmake -G Xcode -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 -DLLVM_DIR="$PWD/clang-downloaded" .. +cmake -G Xcode -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64 -DLLVM_DIR="$PWD/clang-downloaded" .. open dia-merge.xcodeproj ``` @@ -104,4 +104,4 @@ distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. -``` \ No newline at end of file +``` diff --git a/build.sh b/build.sh index 15d6b9d..4e6701f 100755 --- a/build.sh +++ b/build.sh @@ -1,7 +1,8 @@ #/!bin/bash -: ${CLANG_VERSION:=15.0.0} +: ${CLANG_VERSION:=16.0.0} +: ${DIST_SUFFIX:=arm64-apple-darwin22.0} LLVM_PACKAGE_PATH="$PWD/llvm.tar.gz" LLVM_UNZIPPED_PACKAGE_PATH="$PWD/llvm" @@ -11,7 +12,7 @@ LLVM_UNZIPPED_PACKAGE_PATH="$PWD/llvm" # -L to follow redirects -curl -L "https://github.com/llvm/llvm-project/releases/download/llvmorg-${CLANG_VERSION}/clang+llvm-${CLANG_VERSION}-x86_64-apple-darwin.tar.xz" --output "$LLVM_PACKAGE_PATH" +curl -L "https://github.com/llvm/llvm-project/releases/download/llvmorg-${CLANG_VERSION}/clang+llvm-${CLANG_VERSION}-${DIST_SUFFIX}.tar.xz" --output "$LLVM_PACKAGE_PATH" mkdir -p "$LLVM_UNZIPPED_PACKAGE_PATH" # --strip 1 to not include a wrapped dir and extract directly to $LLVM_UNZIPPED_PACKAGE_PATH @@ -21,7 +22,7 @@ tar -xvf "$LLVM_PACKAGE_PATH" -C "$LLVM_UNZIPPED_PACKAGE_PATH" --strip 1 # TODO: Using Xcode for now, as CI doesn't have ninja mkdir -p build pushd build -cmake -G Xcode -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=x86_64 -DLLVM_DIR="$LLVM_UNZIPPED_PACKAGE_PATH" .. +cmake -G Xcode -DCMAKE_BUILD_TYPE=Release -DCMAKE_OSX_ARCHITECTURES=arm64 -DLLVM_DIR="$LLVM_UNZIPPED_PACKAGE_PATH" .. ### Build a project xcodebuild -configuration Release