Skip to content

Commit

Permalink
fix up compiler flags and make shit smaller
Browse files Browse the repository at this point in the history
  • Loading branch information
jeff committed Jul 6, 2022
1 parent d00a60e commit 8b83137
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 24 deletions.
29 changes: 15 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -211,23 +211,24 @@ if(APPLE)
message(STATUS "IOS: Changing arch from x86_64 to x86-64")
add_compile_options(-march=x86-64)
endif()
else()
if(NATIVE_BUILD)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL ppc64le)
add_compile_options(-mcpu=native -mtune=native)
else()
add_compile_options(-march=native -mtune=native)
endif()
elseif(NOT NON_PC_TARGET)
if (USE_AVX2)
add_compile_options(-march=haswell -mtune=haswell -mfpmath=sse)
else()
# Public binary releases
add_compile_options(-march=nocona -mtune=haswell -mfpmath=sse)
endif()
endif()

if(NATIVE_BUILD)
if(CMAKE_SYSTEM_PROCESSOR STREQUAL ppc64le)
add_compile_options(-mcpu=native -mtune=native)
else()
add_compile_options(-march=native -mtune=native)
endif()
elseif(NOT NON_PC_TARGET)
if (USE_AVX2)
add_compile_options(-march=haswell -mtune=haswell -mfpmath=sse)
else()
# Public binary releases
add_compile_options(-march=nocona -mtune=haswell -mfpmath=sse)
endif()
endif()


set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
find_package(Threads REQUIRED)
Expand Down
2 changes: 1 addition & 1 deletion cmake/StaticBuild.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ if(CMAKE_CROSSCOMPILING)
if(NOT ${apple_toolchain} MATCHES Xcode OR NOT ${apple_sdk} MATCHES "iPhone(OS|Simulator)")
message(FATAL_ERROR "didn't find your toolchain and sdk correctly from ${CMAKE_C_COMPILER}/${CMAKE_OSX_SYSROOT}: found toolchain=${apple_toolchain}, sdk=${apple_sdk}")
endif()
set(openssl_system_env CROSS_COMPILE=${apple_toolchain} CROSS_TOP=${CMAKE_DEVELOPER_ROOT} CROSS_SDK=${apple_sdk})
set(openssl_system_env CROSS_COMPILE=${apple_toolchain}/ CROSS_TOP=${CMAKE_DEVELOPER_ROOT}/ CROSS_SDK=${apple_sdk}/)
set(openssl_configure_command ./Configure iphoneos-cross)
set(openssl_cc "clang")
elseif(ARCH_TRIPLET STREQUAL mips64-linux-gnuabi64)
Expand Down
17 changes: 9 additions & 8 deletions contrib/ios.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,20 +13,21 @@ root="$(readlink -f $(dirname $0)/../)"

build_dir="$root/build/iphone"

./contrib/ios/ios-configure.sh "$build_dir/device" OS $@
./contrib/ios/ios-configure.sh "$build_dir/device" OS64 $@
./contrib/ios/ios-configure.sh "$build_dir/sim" SIMULATOR64 $@

./contrib/ios/ios-build.sh "$build_dir/device"
./contrib/ios/ios-build.sh "$build_dir/sim"
for targ in device sim ; do
./contrib/ios/ios-build.sh "$build_dir/$targ"
done

pkg_name="iphone_lokinet_embedded_$(date +%s)"
pkg_dir="$build_dir/$pkg_name"
mkdir -p "$pkg_dir/include"
mkdir -p "$pkg_dir/lib/device"
mkdir -p "$pkg_dir/lib/sim"

cp -a "$build_dir/device/llarp/liblokinet-embedded.a" "$pkg_dir/lib/device/"
cp -a "$build_dir/sim/llarp/liblokinet-embedded.a" "$pkg_dir/lib/sim/"
mkdir -p "$pkg_dir"/{include,lib/{device,sim}}
for targ in device sim ; do
mkdir -p "$pkg_dir/lib/$targ"
cp -av "$build_dir/$targ/llarp/liblokinet-embedded.a" "$pkg_dir/lib/$targ/liblokinet-embedded.a"
done
cp -a "$root"/include/lokinet{,/*}.h "$pkg_dir/include/"

cd "$build_dir"
Expand Down
3 changes: 2 additions & 1 deletion contrib/ios/ios-configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ mkdir -p $targ
cmake \
-G Ninja \
-DCMAKE_TOOLCHAIN_FILE="$root/contrib/cross/ios.toolchain.cmake" -DPLATFORM=$plat -DDEPLOYMENT_TARGET=13 -DENABLE_VISIBILITY=ON -DENABLE_BITCODE=OFF \
-DCMAKE_CXX_COMPILER_LAUNCHER= -DCMAKE_C_COMPILER_LAUNCHER= \
-DBUILD_STATIC_DEPS=ON \
-DBUILD_PACKAGE=OFF \
-DBUILD_SHARED_LIBS=OFF \
Expand All @@ -37,5 +36,7 @@ cmake \
-DFORCE_LIBUV_SUBMODULE=ON \
-DSUBMODULE_CHECK=ON \
-DWITH_LTO=OFF \
-DCMAKE_CXX_FLAGS='-Oz' -DCMAKE_C_FLAGS='-Oz' \
-DCMAKE_BUILD_TYPE=Release \
-S "$root" -B $targ \
$@

0 comments on commit 8b83137

Please sign in to comment.