Skip to content

Commit 8b83137

Browse files
author
jeff
committed
fix up compiler flags and make shit smaller
1 parent d00a60e commit 8b83137

4 files changed

Lines changed: 27 additions & 24 deletions

File tree

CMakeLists.txt

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -211,23 +211,24 @@ if(APPLE)
211211
message(STATUS "IOS: Changing arch from x86_64 to x86-64")
212212
add_compile_options(-march=x86-64)
213213
endif()
214-
else()
215-
if(NATIVE_BUILD)
216-
if(CMAKE_SYSTEM_PROCESSOR STREQUAL ppc64le)
217-
add_compile_options(-mcpu=native -mtune=native)
218-
else()
219-
add_compile_options(-march=native -mtune=native)
220-
endif()
221-
elseif(NOT NON_PC_TARGET)
222-
if (USE_AVX2)
223-
add_compile_options(-march=haswell -mtune=haswell -mfpmath=sse)
224-
else()
225-
# Public binary releases
226-
add_compile_options(-march=nocona -mtune=haswell -mfpmath=sse)
227-
endif()
214+
endif()
215+
216+
if(NATIVE_BUILD)
217+
if(CMAKE_SYSTEM_PROCESSOR STREQUAL ppc64le)
218+
add_compile_options(-mcpu=native -mtune=native)
219+
else()
220+
add_compile_options(-march=native -mtune=native)
221+
endif()
222+
elseif(NOT NON_PC_TARGET)
223+
if (USE_AVX2)
224+
add_compile_options(-march=haswell -mtune=haswell -mfpmath=sse)
225+
else()
226+
# Public binary releases
227+
add_compile_options(-march=nocona -mtune=haswell -mfpmath=sse)
228228
endif()
229229
endif()
230230

231+
231232
set(CMAKE_THREAD_PREFER_PTHREAD TRUE)
232233
set(THREADS_PREFER_PTHREAD_FLAG TRUE)
233234
find_package(Threads REQUIRED)

cmake/StaticBuild.cmake

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -243,7 +243,7 @@ if(CMAKE_CROSSCOMPILING)
243243
if(NOT ${apple_toolchain} MATCHES Xcode OR NOT ${apple_sdk} MATCHES "iPhone(OS|Simulator)")
244244
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}")
245245
endif()
246-
set(openssl_system_env CROSS_COMPILE=${apple_toolchain} CROSS_TOP=${CMAKE_DEVELOPER_ROOT} CROSS_SDK=${apple_sdk})
246+
set(openssl_system_env CROSS_COMPILE=${apple_toolchain}/ CROSS_TOP=${CMAKE_DEVELOPER_ROOT}/ CROSS_SDK=${apple_sdk}/)
247247
set(openssl_configure_command ./Configure iphoneos-cross)
248248
set(openssl_cc "clang")
249249
elseif(ARCH_TRIPLET STREQUAL mips64-linux-gnuabi64)

contrib/ios.sh

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,20 +13,21 @@ root="$(readlink -f $(dirname $0)/../)"
1313

1414
build_dir="$root/build/iphone"
1515

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

19-
./contrib/ios/ios-build.sh "$build_dir/device"
20-
./contrib/ios/ios-build.sh "$build_dir/sim"
19+
for targ in device sim ; do
20+
./contrib/ios/ios-build.sh "$build_dir/$targ"
21+
done
2122

2223
pkg_name="iphone_lokinet_embedded_$(date +%s)"
2324
pkg_dir="$build_dir/$pkg_name"
24-
mkdir -p "$pkg_dir/include"
25-
mkdir -p "$pkg_dir/lib/device"
26-
mkdir -p "$pkg_dir/lib/sim"
2725

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

3233
cd "$build_dir"

contrib/ios/ios-configure.sh

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ mkdir -p $targ
1919
cmake \
2020
-G Ninja \
2121
-DCMAKE_TOOLCHAIN_FILE="$root/contrib/cross/ios.toolchain.cmake" -DPLATFORM=$plat -DDEPLOYMENT_TARGET=13 -DENABLE_VISIBILITY=ON -DENABLE_BITCODE=OFF \
22-
-DCMAKE_CXX_COMPILER_LAUNCHER= -DCMAKE_C_COMPILER_LAUNCHER= \
2322
-DBUILD_STATIC_DEPS=ON \
2423
-DBUILD_PACKAGE=OFF \
2524
-DBUILD_SHARED_LIBS=OFF \
@@ -37,5 +36,7 @@ cmake \
3736
-DFORCE_LIBUV_SUBMODULE=ON \
3837
-DSUBMODULE_CHECK=ON \
3938
-DWITH_LTO=OFF \
39+
-DCMAKE_CXX_FLAGS='-Oz' -DCMAKE_C_FLAGS='-Oz' \
40+
-DCMAKE_BUILD_TYPE=Release \
4041
-S "$root" -B $targ \
4142
$@

0 commit comments

Comments
 (0)