Skip to content

Commit

Permalink
Refactoring to use new libtransmission, ported to C++
Browse files Browse the repository at this point in the history
  • Loading branch information
AndreyPavlenko committed Oct 13, 2021
1 parent d7748a1 commit 21d0422
Show file tree
Hide file tree
Showing 21 changed files with 1,160 additions and 1,076 deletions.
26 changes: 14 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.4.1)
project(transmissionbtc VERSION 1.0.0 LANGUAGES C)
project(transmissionbtc)

if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(CMAKE_BUILD_TYPE "Release" CACHE STRING "Build type: [Debug|Release]" FORCE)
Expand All @@ -8,7 +8,7 @@ endif ()

set(EXT_C_FLAGS "-DANDROID -fno-unwind-tables -no-canonical-prefixes -D_FORTIFY_SOURCE=1 \
-D_FILE_OFFSET_BITS=64 -D_LARGE_FILES=1")
set(EXT_CXX_FLAGS "${EXT_C_FLAGS} -fno-exceptions -fno-rtti")
set(EXT_CXX_FLAGS "${EXT_C_FLAGS} -fno-exceptions -frtti -std=gnu++17")
set(EXT_EXE_LINKER_FLAGS "-Wl,--exclude-libs,libgcc.a -Wl,--exclude-libs,libgcc_real.a \
-Wl,--exclude-libs,libatomic.a -Wl,--gc-sections -static-libstdc++")

Expand All @@ -19,8 +19,10 @@ if (CMAKE_BUILD_TYPE STREQUAL "Debug")
set(CMAKE_EXE_LINKER_FLAGS_DEBUG ${EXT_EXE_LINKER_FLAGS})
else ()
set(EXT_C_FLAGS "-O3 -DNDEBUG -flto -fvisibility=hidden -fdata-sections -ffunction-sections ${EXT_C_FLAGS}")
set(EXT_EXE_LINKER_FLAGS "-flto -O3 -Wl,--strip-all ${EXT_EXE_LINKER_FLAGS}")
set(EXT_CXX_FLAGS "-O3 -DNDEBUG -flto -fvisibility=hidden -fdata-sections -ffunction-sections ${EXT_CXX_FLAGS}")
set(EXT_EXE_LINKER_FLAGS "-fuse-ld=gold -flto -O3 -Wl,--strip-all ${EXT_EXE_LINKER_FLAGS}")
set(CMAKE_C_FLAGS_RELEASE ${EXT_C_FLAGS})
set(CMAKE_CXX_FLAGS_RELEASE ${EXT_CXX_FLAGS})
set(CMAKE_EXE_LINKER_FLAGS_RELEASE ${EXT_EXE_LINKER_FLAGS})
endif ()

Expand All @@ -41,15 +43,15 @@ set(EXT_CMAKE_ARGS -DCMAKE_TOOLCHAIN_FILE=${CMAKE_TOOLCHAIN_FILE}
)

add_library(${PROJECT_NAME} SHARED
"${CMAKE_SOURCE_DIR}/src/main/cpp/native_to_java.c"
"${CMAKE_SOURCE_DIR}/src/main/cpp/env.c"
"${CMAKE_SOURCE_DIR}/src/main/cpp/sem.c"
"${CMAKE_SOURCE_DIR}/src/main/cpp/curl.c"
"${CMAKE_SOURCE_DIR}/src/main/cpp/hash.c"
"${CMAKE_SOURCE_DIR}/src/main/cpp/commons.c"
"${CMAKE_SOURCE_DIR}/src/main/cpp/torrent.c"
"${CMAKE_SOURCE_DIR}/src/main/cpp/transmission.c"
"${CMAKE_SOURCE_DIR}/src/main/cpp/stdredirect.c"
"${CMAKE_SOURCE_DIR}/src/main/cpp/native_to_java.cc"
"${CMAKE_SOURCE_DIR}/src/main/cpp/env.cc"
"${CMAKE_SOURCE_DIR}/src/main/cpp/sem.cc"
"${CMAKE_SOURCE_DIR}/src/main/cpp/curl.cc"
"${CMAKE_SOURCE_DIR}/src/main/cpp/hash.cc"
"${CMAKE_SOURCE_DIR}/src/main/cpp/commons.cc"
"${CMAKE_SOURCE_DIR}/src/main/cpp/torrent.cc"
"${CMAKE_SOURCE_DIR}/src/main/cpp/transmission.cc"
"${CMAKE_SOURCE_DIR}/src/main/cpp/stdredirect.cc"
)

list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_SOURCE_DIR}/cmake)
Expand Down
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
def version = '1.3.8'
def versionNum = 9000017
def version = '1.3.10'
def versionNum = 9000020
def webInstallDir = "${project.buildDir}/web"

buildscript {
Expand Down
1 change: 1 addition & 0 deletions cmake/Transmission.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ set(TR_CMAKE_ARGS -DENABLE_TESTS=OFF -DENABLE_DAEMON=OFF -DINSTALL_DOC=OFF -DENA
set(TR_LIBRARIES
"${TR_BUILD_DIR}/libtransmission/libtransmission.a"
"${TR_BUILD_DIR}/third-party/dht/lib/libdht.a"
"${TR_BUILD_DIR}/third-party/arc4/src/libarc4.a"
"${TR_BUILD_DIR}/third-party/b64/lib/libb64.a"
"${TR_BUILD_DIR}/third-party/natpmp/lib/libnatpmp.a"
"${TR_BUILD_DIR}/third-party/miniupnpc/lib/libminiupnpc.a"
Expand Down
3 changes: 1 addition & 2 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.MANAGE_EXTERNAL_STORAGE" />
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
<uses-permission android:name="android.permission.WAKE_LOCK" />
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
Expand All @@ -18,7 +17,7 @@

<uses-permission
android:name="android.permission.WRITE_MEDIA_STORAGE"
tools:ignore="ProtectedPermissions" />
tools:ignore="ermissions" />

<uses-feature
android:name="android.hardware.touchscreen"
Expand Down
199 changes: 0 additions & 199 deletions src/main/cpp/commons.c

This file was deleted.

Loading

0 comments on commit 21d0422

Please sign in to comment.