Skip to content
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

Update makefile #34

Merged
merged 4 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
54 changes: 11 additions & 43 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,40 +42,28 @@ jobs:

- name: Build prover Android ARM64
run: |
mkdir -p build_prover_android && cd build_prover_android
cmake .. -DTARGET_PLATFORM=ANDROID -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android -DBUILD_TESTS=OFF -DUSE_OPENMP=OFF
make -j4 && make install
make android

- name: Build prover Android ARM64 with OpenMP
run: |
mkdir -p build_prover_android_openmp && cd build_prover_android_openmp
cmake .. -DTARGET_PLATFORM=ANDROID -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android_openmp -DBUILD_TESTS=OFF -DUSE_OPENMP=ON
make -j4 && make install
make android_openmp

- name: Build prover Android x86_64
run: |
mkdir -p build_prover_android_x86_64 && cd build_prover_android_x86_64
cmake .. -DTARGET_PLATFORM=ANDROID_x86_64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android_x86_64 -DBUILD_TESTS=OFF -DUSE_OPENMP=OFF
make -j4 && make install
make android_x86_64

- name: Build prover Android x86_64 with OpenMP
run: |
mkdir -p build_prover_android_openmp_x86_64 && cd build_prover_android_openmp_x86_64
cmake .. -DTARGET_PLATFORM=ANDROID_x86_64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android_openmp_x86_64 -DBUILD_TESTS=OFF -DUSE_OPENMP=ON
make -j4 && make install
make android_openmp_x86_64

- name: Build prover Linux x86_64
run: |
mkdir -p build_prover && cd build_prover
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package
make -j4 && make install
make host
ctest --rerun-failed --output-on-failure

- name: Build prover Linux x86_64 noasm
run: |
mkdir -p build_prover_noasm && cd build_prover_noasm
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_noasm -DUSE_ASM=NO
make -j4 && make install
make host_noasm
ctest --rerun-failed --output-on-failure

- name: Test rapidsnark
Expand Down Expand Up @@ -216,9 +204,7 @@ jobs:

- name: Build prover Linux arm64
run: |
mkdir -p build_prover_arm64 && cd build_prover_arm64
cmake .. -DTARGET_PLATFORM=aarch64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_arm64
make -j4 && make install
make host_arm64
ctest --rerun-failed --output-on-failure

- name: Test rapidsnark
Expand Down Expand Up @@ -275,24 +261,9 @@ jobs:
if [[ ! -d "depends/gmp/package_ios_arm64" ]]; then ./build_gmp.sh ios; fi
if [[ ! -d "depends/gmp/package_iphone_simulator" ]]; then ./build_gmp.sh ios_simulator; fi
if [[ ! -d "depends/gmp/package_macos_arm64" ]]; then ./build_gmp.sh macos_arm64; fi

mkdir -p build_prover_ios && cd build_prover_ios
cmake .. -GXcode -DTARGET_PLATFORM=IOS -DCMAKE_INSTALL_PREFIX=../package_ios
xcodebuild -destination 'generic/platform=iOS' -scheme rapidsnarkStatic -project rapidsnark.xcodeproj -configuration Release
xcodebuild -destination 'generic/platform=iOS' -scheme rapidsnark -project rapidsnark.xcodeproj -configuration Release CODE_SIGNING_ALLOWED=NO
cp ../depends/gmp/package_ios_arm64/lib/libgmp.a src/Release-iphoneos
cd ../

mkdir -p build_prover_ios_simulator && cd build_prover_ios_simulator
cmake .. -GXcode -DTARGET_PLATFORM=IOS_SIMULATOR -DCMAKE_INSTALL_PREFIX=../package_ios_simulator -DUSE_ASM=NO
xcodebuild -destination 'generic/platform=iOS Simulator' -scheme rapidsnarkStatic -project rapidsnark.xcodeproj
xcodebuild -destination 'generic/platform=iOS Simulator' -scheme rapidsnark -project rapidsnark.xcodeproj CODE_SIGNING_ALLOWED=NO ARCHS=arm64
cp ../depends/gmp/package_iphone_simulator/lib/libgmp.a src/Debug-iphonesimulator
cd ../

mkdir -p build_prover_macos_arm64 && cd build_prover_macos_arm64
cmake .. -DTARGET_PLATFORM=macos_arm64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_macos_arm64
make -j4 && make install
make ios
make ios_simulator
make macos_arm64
ctest --rerun-failed --output-on-failure

- name: test rapidsnark
Expand Down Expand Up @@ -391,10 +362,7 @@ jobs:
- name: build
run: |
if [[ ! -d "depends/gmp/package_macos_x86_64" ]]; then ./build_gmp.sh macos_x86_64; fi

mkdir -p build_prover_macos_x86_64 && cd build_prover_macos_x86_64
cmake .. -DTARGET_PLATFORM=macos_x86_64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_macos_x86_64
make -j4 && make install
make macos_x86_64
ctest --rerun-failed --output-on-failure

- name: test rapidsnark
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.10)

include(cmake/platform.cmake)

Expand Down
77 changes: 70 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,85 @@ host:
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package && \
make -j$(nproc) -vvv && make install

host_noasm:
rm -rf build_prover_noasm && mkdir build_prover_noasm && cd build_prover_noasm && \
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_noasm -DUSE_ASM=NO && \
make -j$(nproc) -vvv && make install

host_arm64:
rm -rf build_prover_arm64 && mkdir build_prover_arm64 && cd build_prover_arm64 && \
cmake .. -DTARGET_PLATFORM=aarch64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_arm64 && \
make -j$(nproc) -vvv && make install

android:
rm -rf build_prover_android && mkdir build_prover_android && cd build_prover_android && \
cmake .. -DTARGET_PLATFORM=ANDROID -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android && \
cmake .. -DTARGET_PLATFORM=ANDROID -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android -DBUILD_TESTS=OFF -DUSE_OPENMP=OFF && \
make -j$(nproc) -vvv && make install

android_openmp:
rm -rf build_prover_android_openmp && mkdir build_prover_android_openmp && cd build_prover_android_openmp && \
cmake .. -DTARGET_PLATFORM=ANDROID -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android_openmp -DBUILD_TESTS=OFF -DUSE_OPENMP=ON && \
make -j$(nproc) -vvv && make install

android_x86_64:
rm -rf build_prover_android_x86_64 && mkdir build_prover_android_x86_64 && cd build_prover_android_x86_64 && \
cmake .. -DTARGET_PLATFORM=ANDROID_x86_64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android_x86_64 && \
cmake .. -DTARGET_PLATFORM=ANDROID_x86_64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android_x86_64 -DBUILD_TESTS=OFF -DUSE_OPENMP=OFF && \
make -j$(nproc) -vvv && make install

android_openmp_x86_64:
rm -rf build_prover_android_openmp_x86_64 && mkdir build_prover_android_openmp_x86_64 && cd build_prover_android_openmp_x86_64 && \
cmake .. -DTARGET_PLATFORM=ANDROID_x86_64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android_openmp_x86_64 -DBUILD_TESTS=OFF -DUSE_OPENMP=ON && \
make -j$(nproc) -vvv && make install

ios:
@if [ ! -d "./depends/gmp/package_ios_arm64" ]; then echo "Looks like gmp lib is not built. Run './build_gmp.sh ios' first." && exit 1; fi
rm -rf build_prover_ios && mkdir build_prover_ios && cd build_prover_ios && \
cmake .. -GXcode -DTARGET_PLATFORM=IOS -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_ios && \
echo "" && echo "Now open Xcode and compile the generated project" && echo ""
cmake .. -GXcode -DTARGET_PLATFORM=IOS -DCMAKE_INSTALL_PREFIX=../package_ios && \
xcodebuild -destination 'generic/platform=iOS' -scheme rapidsnarkStatic -project rapidsnark.xcodeproj -configuration Release && \
xcodebuild -destination 'generic/platform=iOS' -scheme rapidsnark -project rapidsnark.xcodeproj -configuration Release CODE_SIGNING_ALLOWED=NO && \
cp ../depends/gmp/package_ios_arm64/lib/libgmp.a src/Release-iphoneos && \
echo "" && echo "iOS Simulator artifacts built in build_prover_ios/src/Release-iphoneos" && echo ""

ios_simulator:
@if [ ! -d "./depends/gmp/package_iphone_simulator" ]; then echo "Looks like gmp lib is not built. Run './build_gmp.sh ios_simulator' first." && exit 1; fi
rm -rf build_prover_ios_simulator && mkdir build_prover_ios_simulator && cd build_prover_ios_simulator && \
cmake .. -GXcode -DTARGET_PLATFORM=IOS_SIMULATOR -DCMAKE_INSTALL_PREFIX=../package_ios_simulator -DUSE_ASM=NO && \
xcodebuild -destination 'generic/platform=iOS Simulator' -scheme rapidsnarkStatic -project rapidsnark.xcodeproj && \
xcodebuild -destination 'generic/platform=iOS Simulator' -scheme rapidsnark -project rapidsnark.xcodeproj CODE_SIGNING_ALLOWED=NO ARCHS=arm64 && \
cp ../depends/gmp/package_iphone_simulator/lib/libgmp.a src/Debug-iphonesimulator && \
echo "" && echo "iOS Simulator artifacts built in build_prover_ios_simulator/src/Debug-iphonesimulator" && echo ""

macos_arm64:
@if [ ! -d "./depends/gmp/package_macos_arm64" ]; then echo "Looks like gmp lib is not built. Run './build_gmp.sh macos_arm64' first." && exit 1; fi
rm -rf build_prover_macos_arm64 && mkdir build_prover_macos_arm64 && cd build_prover_macos_arm64 && \
cmake .. -DTARGET_PLATFORM=macos_arm64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_macos_arm64 && \
make -j$(nproc) -vvv && make install

macos_x86_64:
@if [ ! -d "./depends/gmp/package_macos_x86_64" ]; then echo "Looks like gmp lib is not built. Run './build_gmp.sh macos_x86_64' first." && exit 1; fi
rm -rf build_prover_macos_x86_64 && mkdir build_prover_macos_x86_64 && cd build_prover_macos_x86_64 && \
cmake .. -DTARGET_PLATFORM=macos_x86_64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_macos_x86_64 && \
make -j$(nproc) -vvv && make install

clean:
rm -rf build_prover build_prover_android build_prover_android_x86_64 build_prover_ios package package_android \
package_android_x86_64 package_ios depends/gmp/package depends/gmp/package_android_arm64 \
depends/gmp/package_android_x86_64 depends/gmp/package_ios_arm64
rm -rf build_prover \
build_prover_macos_arm64 \
build_prover_macos_x86_64 \
build_prover_android \
build_prover_android_x86_64 \
build_prover_ios \
build_prover_ios_simulator \
package \
package_macos_arm64 \
package_macos_x86_64 \
package_android \
package_android_x86_64 \
package_ios \
package_ios_simulator \
depends/gmp/package \
depends/gmp/package_macos_arm64 \
depends/gmp/package_macos_x86_64 \
depends/gmp/package_android_arm64 \
depends/gmp/package_android_x86_64 \
depends/gmp/package_ios_arm64 \
depends/gmp/package_iphone_simulator
28 changes: 7 additions & 21 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,7 @@ brew install cmake gmp libsodium nasm
git submodule init
git submodule update
./build_gmp.sh host
mkdir build_prover && cd build_prover
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package
make -j4 && make install
make host
```

### Compile prover for macOS arm64 host machine
Expand All @@ -41,9 +39,7 @@ make -j4 && make install
git submodule init
git submodule update
./build_gmp.sh macos_arm64
mkdir build_prover_macos_arm64 && cd build_prover_macos_arm64
cmake .. -DTARGET_PLATFORM=macos_arm64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_macos_arm64
make -j4 && make install
make macos_arm64
```

### Compile prover for linux arm64 host machine
Expand All @@ -52,9 +48,7 @@ make -j4 && make install
git submodule init
git submodule update
./build_gmp.sh host
mkdir build_prover && cd build_prover
cmake .. -DTARGET_PLATFORM=arm64_host -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package
make -j4 && make install
make host_arm64
```

### Compile prover for linux arm64 machine
Expand All @@ -63,9 +57,7 @@ make -j4 && make install
git submodule init
git submodule update
./build_gmp.sh host
mkdir build_prover && cd build_prover
cmake .. -DTARGET_PLATFORM=aarch64 -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_aarch64
make -j4 && make install
make arm64
```

### Compile prover for Android
Expand Down Expand Up @@ -93,9 +85,7 @@ Compilation:
git submodule init
git submodule update
./build_gmp.sh android
mkdir build_prover_android && cd build_prover_android
cmake .. -DTARGET_PLATFORM=ANDROID -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=../package_android -DBUILD_TESTS=OFF
make -j4 && make install
make android
```

### Compile prover for iOS
Expand All @@ -106,9 +96,7 @@ Install Xcode
git submodule init
git submodule update
./build_gmp.sh ios
mkdir build_prover_ios && cd build_prover_ios
cmake .. -GXcode -DTARGET_PLATFORM=IOS -DCMAKE_INSTALL_PREFIX=../package_ios
xcodebuild -destination 'generic/platform=iOS' -scheme rapidsnarkStatic -project rapidsnark.xcodeproj -configuration Release
make ios
```
Open generated Xcode project and compile prover.

Expand All @@ -120,9 +108,7 @@ Install Xcode
git submodule init
git submodule update
./build_gmp.sh ios_simulator
mkdir build_prover_ios_simulator && cd build_prover_ios_simulator
cmake .. -GXcode -DTARGET_PLATFORM=IOS -DCMAKE_INSTALL_PREFIX=../package_ios_simulator -DUSE_ASM=NO
xcodebuild -destination 'generic/platform=iOS Simulator' -scheme rapidsnarkStatic -project rapidsnark.xcodeproj
make ios_simulator
```

Files that you need to copy to your XCode project to link against Rapidsnark:
Expand Down
7 changes: 1 addition & 6 deletions cmake/platform.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.5)
cmake_minimum_required(VERSION 3.10)

string(TOLOWER "${TARGET_PLATFORM}" TARGET_PLATFORM)

Expand Down Expand Up @@ -55,11 +55,6 @@ elseif(TARGET_PLATFORM MATCHES "aarch64")
set(GMP_PREFIX ${GMP_ROOT}/package_aarch64)
set(ARCH arm64)

elseif(TARGET_PLATFORM MATCHES "arm64_host")

set(GMP_PREFIX ${GMP_ROOT}/package)
set(ARCH arm64)

elseif(TARGET_PLATFORM MATCHES "macos_x86_64")

set(CMAKE_OSX_ARCHITECTURES x86_64)
Expand Down