-
-
Save opo2000tw/b049b7a4022ff92bcc3b722ae7d62e48 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| cmake_minimum_required(VERSION 3.4.1) | |
| set(CMAKE_VERBOSE_MAKEFILE on) | |
| message(set ${PROXY_PLUGIN_BUILD}) | |
| ##### GLOBAL VARS | |
| if (${PROXY_PLUGIN_BUILD}) | |
| set(CS_VPN_SOURCES ${PROJECT_SOURCE_DIR}/../../) | |
| set(CS_VPN_LIBS ${PROJECT_SOURCE_DIR}/../../csproxy/libs-android) | |
| set(LIB_PATH_INCLUDES ${PROJECT_SOURCE_DIR}/../libhydranative/hydra/includes) | |
| set(LIB_PATH ${PROJECT_SOURCE_DIR}/../libhydranative/hydra/libs) | |
| set(3RD_PATH_LIB_PATH ${PROJECT_SOURCE_DIR}/../libhydranative/3rd_parties) | |
| else() | |
| set(CS_VPN_SOURCES ${PROJECT_SOURCE_DIR}/../libhydranative/cs-vpn) | |
| set(CS_VPN_LIBS ${PROJECT_SOURCE_DIR}/../libhydranative/cs-vpn/csproxy/libs-android) | |
| set(LIB_PATH_INCLUDES ${PROJECT_SOURCE_DIR}/../libhydranative/hydra/includes) | |
| set(LIB_PATH ${PROJECT_SOURCE_DIR}/../libhydranative/hydra/libs) | |
| set(3RD_PATH_LIB_PATH ${PROJECT_SOURCE_DIR}/../libhydranative/3rd_parties) | |
| endif() | |
| message(${CS_VPN_SOURCES}) | |
| set(COMMON_CFLAGS "-fvisibility=hidden -fasynchronous-unwind-tables") | |
| set(COMMON_CFLAGS ${COMMON_CFLAGS} -g -DDEBUG) | |
| ########################################################## | |
| # build cpufeatures as a static lib | |
| include_directories(./ndk_helper | |
| ${ANDROID_NDK}/sources/android/cpufeatures) | |
| add_library(cpufeatures STATIC | |
| ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c) | |
| add_library( libssl_static | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| libssl_static | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${CS_VPN_LIBS}/${ANDROID_ABI}/libssl.a ) | |
| add_library( libcrypto_static | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| libcrypto_static | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${CS_VPN_LIBS}/${ANDROID_ABI}/libcrypto.a ) | |
| ######### PROXY PLUGIN | |
| add_library( | |
| proxy_plugin | |
| STATIC | |
| ${CS_VPN_SOURCES}/conntrack.c | |
| ${CS_VPN_SOURCES}/proxy_plugin_bev_channel.c | |
| ${CS_VPN_SOURCES}/proxy_plugin_bev_udp_channel.c | |
| ${CS_VPN_SOURCES}/proxy_plugin_lwip_channel.c | |
| ${CS_VPN_SOURCES}/proxy_plugin_lwip_udp_channel.c | |
| ${CS_VPN_SOURCES}/proxy_plugin_bev_sock_tcp_channel.c | |
| ${CS_VPN_SOURCES}/proxy_plugin_bev_sock_udp_channel.c | |
| ${CS_VPN_SOURCES}/proxy_plugin_ctx.c | |
| ${CS_VPN_SOURCES}/proxy_plugin_filters.c | |
| ${CS_VPN_SOURCES}/proxy_plugin_filter_ssl.c | |
| ${CS_VPN_SOURCES}/proxy_plugin_filter_zlib.c | |
| ${CS_VPN_SOURCES}/proxy_plugin.c | |
| ${CS_VPN_SOURCES}/proxy_plugin_templates.c | |
| ${CS_VPN_SOURCES}/proxy_plugin_bypass_per_ip.c | |
| ${CS_VPN_SOURCES}/proxy_plugin_comScore.c | |
| ${CS_VPN_SOURCES}/proxy_plugin_comScore_lib.c | |
| ${CS_VPN_SOURCES}/proxy_plugin_comScore_csproxy.c | |
| ) | |
| target_link_libraries(proxy_plugin | |
| cpufeatures | |
| ) | |
| set_target_properties(proxy_plugin PROPERTIES COMPILE_FLAGS | |
| "-std=c99 -fvisibility=hidden -fasynchronous-unwind-tables -DHAVE_LIBEVENT_OPENSSL -Wall -Wno-unused-function -fno-strict-aliasing") | |
| ######### CELPER | |
| add_library( # Sets the name of the library. | |
| celper | |
| # Sets the library as a shared library. | |
| SHARED | |
| # Provides a relative path to your source file(s). | |
| # Associated headers in the same location as their source | |
| # file are automatically included. | |
| ../libhydranative/jni/celper.cpp ) | |
| find_library( # Sets the name of the path variable. | |
| log-lib | |
| # Specifies the name of the NDK library that | |
| # you want CMake to locate. | |
| log ) | |
| include_directories(../libhydranative/cs-vpn/csproxy/libs/include) | |
| target_link_libraries( # Specifies the target library. | |
| celper | |
| # Links the target library to the log library | |
| # included in the NDK. | |
| libssl_static | |
| libcrypto_static | |
| ${log-lib} | |
| -Wl,--no-warn-shared-textrel ) | |
| ######### JUDY | |
| message(warning ${ANDROID_ABI}) | |
| if (${ANDROID_ABI} MATCHES "armeabi*.") | |
| set(POSTFIX ".android.arm" ) | |
| else() | |
| set(POSTFIX ".android.${ANDROID_ABI}") | |
| endif() | |
| add_library( judy | |
| SHARED | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| judy | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${PROJECT_SOURCE_DIR}/../libhydranative/3rd_parties/${POSTFIX}/libJudy.so ) | |
| file(COPY | |
| ${PROJECT_SOURCE_DIR}/../libhydranative/3rd_parties/${POSTFIX}/libJudy.so | |
| DESTINATION | |
| ${PROJECT_SOURCE_DIR}/../libhydranative/prebuilt-libs/${ANDROID_ABI}/ ) | |
| ######### HYDRA | |
| add_library( viper | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| viper | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${LIB_PATH}/libviper_android${POSTFIX}.a ) | |
| add_library( afvpn | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| afvpn | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${LIB_PATH}/libafvpn_client${POSTFIX}.a ) | |
| add_library( lproxy | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| lproxy | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${LIB_PATH}/liblproxy${POSTFIX}.a ) | |
| add_library( tranceport | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| tranceport | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${LIB_PATH}/libtranceport_client${POSTFIX}.a ) | |
| add_library( libevent2 | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| libevent2 | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${3RD_PATH_LIB_PATH}/${POSTFIX}/libevent.a ) | |
| add_library( libevent | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| libevent | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${3RD_PATH_LIB_PATH}/${POSTFIX}/libevent.a ) | |
| add_library( libevent2_pthreads | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| libevent2_pthreads | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${3RD_PATH_LIB_PATH}/${POSTFIX}/libevent_pthreads.a ) | |
| add_library( libevent2_openssl | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| libevent2_openssl | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${3RD_PATH_LIB_PATH}/${POSTFIX}/libevent_openssl.a ) | |
| add_library( proxy_plugin2 | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| proxy_plugin2 | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${LIB_PATH}/libproxyplugin${POSTFIX}.a ) | |
| add_library( libssl_static2 | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| libssl_static2 | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${3RD_PATH_LIB_PATH}/${POSTFIX}/libssl.a ) | |
| add_library( yajl | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| yajl | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${CS_VPN_LIBS}/${ANDROID_ABI}/libyajl_s.a ) | |
| add_library( ezxml | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| ezxml | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${CS_VPN_LIBS}/${ANDROID_ABI}/libezxml.a ) | |
| add_library( curl | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| curl | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${CS_VPN_LIBS}/${ANDROID_ABI}/libcurl.a ) | |
| add_library( uuid | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| uuid | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${CS_VPN_LIBS}/${ANDROID_ABI}/libuuid.a ) | |
| add_library( pcre2-8 | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| pcre2-8 | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${CS_VPN_LIBS}/${ANDROID_ABI}/libpcre2-8.a ) | |
| add_library( pcre2-posix | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| pcre2-posix | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${CS_VPN_LIBS}/${ANDROID_ABI}/libpcre2-posix.a ) | |
| add_library( cbo | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| cbo | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${LIB_PATH}/libcbo.client${POSTFIX}.a ) | |
| add_library( libsocat | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| libsocat | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${3RD_PATH_LIB_PATH}/${POSTFIX}/libxio.a ) | |
| add_library( libeccser | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| libeccser | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${LIB_PATH}/libeccser_client${POSTFIX}.a ) | |
| add_library( performance_testing | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| performance_testing | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${LIB_PATH}/libperformance_testing${POSTFIX}.a ) | |
| add_library( vpr_stats | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| vpr_stats | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${LIB_PATH}/libafvprstats${POSTFIX}.a ) | |
| add_library( jansson_static | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| jansson_static | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${3RD_PATH_LIB_PATH}/${POSTFIX}/libjansson.a ) | |
| add_library( csproxy | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| csproxy | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${CS_VPN_LIBS}/${ANDROID_ABI}/libcsproxy_static.a ) | |
| add_library( pmtutils | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| pmtutils | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${CS_VPN_LIBS}/${ANDROID_ABI}/libpmtutils.a ) | |
| add_library( pmt63 | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| pmt63 | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${CS_VPN_LIBS}/${ANDROID_ABI}/libpmt63_static.a ) | |
| add_library( fuzzy | |
| STATIC | |
| IMPORTED ) | |
| set_target_properties( # Specifies the target library. | |
| fuzzy | |
| # Specifies the parameter you want to define. | |
| PROPERTIES IMPORTED_LOCATION | |
| # Provides the path to the library you want to import. | |
| ${CS_VPN_LIBS}/${ANDROID_ABI}/libfuzzy.a ) | |
| add_library( # Sets the name of the library. | |
| hydra | |
| # Sets the library as a shared library. | |
| SHARED | |
| # Provides a relative path to your source file(s). | |
| # Associated headers in the same location as their source | |
| # file are automatically included. | |
| ../libhydranative/jni/arc4random.c | |
| ../libhydranative/jni/event_list.c | |
| ../libhydranative/jni/hydra_jni.c | |
| ../libhydranative/jni/socket_list.c | |
| ../libhydranative/jni/hydra_ptm.c ) | |
| include_directories( | |
| ${CS_VPN_SOURCES}/csproxy/csproxy/include | |
| ${CS_VPN_SOURCES}/csproxy/libs/include | |
| ${CS_VPN_SOURCES}/csproxy/pmt63/include | |
| ${CS_VPN_SOURCES}/csproxy/fuzzy/include | |
| ${LIB_PATH_INCLUDES}/hydra/tranceport | |
| ${LIB_PATH_INCLUDES}/libevent${POSTFIX}/include | |
| ${LIB_PATH_INCLUDES}/openssl${POSTFIX} | |
| ${LIB_PATH_INCLUDES}/openssl${POSTFIX}/crypto | |
| ${LIB_PATH_INCLUDES}/openssl${POSTFIX}/include | |
| ${LIB_PATH_INCLUDES}/judy${POSTFIX}/judy-1.0.5/src | |
| ${LIB_PATH_INCLUDES}/hydra | |
| ${LIB_PATH_INCLUDES}/hydra/afvpn | |
| ${LIB_PATH_INCLUDES}/hydra/viper/afcommon/lib | |
| ${LIB_PATH_INCLUDES}/hydra/viper/afcommon/include | |
| ${LIB_PATH_INCLUDES}/hydra/viper/afcommon/include/arch | |
| ${LIB_PATH_INCLUDES}/hydra/lwip/src/include | |
| ${LIB_PATH_INCLUDES}/hydra/lwip/src/include/ipv4 | |
| ${LIB_PATH_INCLUDES}/jansson${POSTFIX}/src | |
| ${LIB_PATH_INCLUDES}/jansson${POSTFIX}/android | |
| ) | |
| set_target_properties(hydra PROPERTIES COMPILE_FLAGS | |
| "-fvisibility=hidden -fasynchronous-unwind-tables -std=c99 -Wall -Wno-unused-function -fno-strict-aliasing -DSTDC_HEADERS -DPROXY_PLUGIN_DEBUG -DHAVE_LIBEVENT_OPENSSL") | |
| set_target_properties(hydra PROPERTIES LINKER_LANGUAGE CXX) | |
| if (${PROXY_PLUGIN_BUILD}) | |
| target_link_libraries( hydra | |
| PUBLIC | |
| afvpn tranceport | |
| viper lproxy performance_testing proxy_plugin vpr_stats | |
| libeccser libsocat jansson_static | |
| csproxy pmt63 pmtutils fuzzy pcre2-posix pcre2-8 | |
| ezxml curl uuid yajl | |
| cbo | |
| afvpn tranceport | |
| libevent libevent2_pthreads libevent2_openssl | |
| libssl_static libcrypto_static | |
| cpufeatures | |
| judy | |
| z | |
| android | |
| cpufeatures | |
| ${log-lib} ) | |
| else() | |
| target_link_libraries( hydra | |
| PUBLIC | |
| afvpn tranceport | |
| viper lproxy performance_testing proxy_plugin2 vpr_stats | |
| libeccser libsocat jansson_static | |
| csproxy pmt63 pmtutils fuzzy pcre2-posix pcre2-8 | |
| ezxml curl uuid yajl | |
| cbo | |
| afvpn tranceport | |
| libevent2 libevent2_pthreads libevent2_openssl | |
| libssl_static2 libcrypto_static | |
| cpufeatures | |
| judy | |
| z | |
| android | |
| cpufeatures | |
| ${log-lib} ) | |
| endif() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment