Compare commits
4 Commits
Author | SHA1 | Date |
---|---|---|
|
bff3e7ad0f | 8 months ago |
|
11f8cfdbdd | 8 months ago |
|
eaeab28829 | 8 months ago |
|
b1190cd970 | 8 months ago |
@ -1,63 +1,9 @@
|
||||
# ---> Android
|
||||
# Gradle files
|
||||
.gradle/
|
||||
build/
|
||||
app/release/
|
||||
app/src/main/cpp/libs_export/
|
||||
|
||||
# Local configuration file (sdk path, etc)
|
||||
local.properties
|
||||
|
||||
# Log/OS Files
|
||||
*.log
|
||||
|
||||
# Android Studio generated files and folders
|
||||
captures/
|
||||
.externalNativeBuild/
|
||||
.cxx/
|
||||
*.apk
|
||||
output.json
|
||||
|
||||
# IntelliJ
|
||||
*.iml
|
||||
.idea/
|
||||
misc.xml
|
||||
deploymentTargetDropDown.xml
|
||||
render.experimental.xml
|
||||
|
||||
# Keystore files
|
||||
*.jks
|
||||
*.keystore
|
||||
|
||||
# Google Services (e.g. APIs or Firebase)
|
||||
google-services.json
|
||||
|
||||
# Android Profiling
|
||||
*.hprof
|
||||
|
||||
# ---> Java
|
||||
# Compiled class file
|
||||
*.class
|
||||
|
||||
# Log file
|
||||
*.log
|
||||
|
||||
# BlueJ files
|
||||
*.ctxt
|
||||
|
||||
# Mobile Tools for Java (J2ME)
|
||||
.mtj.tmp/
|
||||
|
||||
# Package Files #
|
||||
*.jar
|
||||
*.war
|
||||
*.nar
|
||||
*.ear
|
||||
*.zip
|
||||
*.tar.gz
|
||||
*.rar
|
||||
|
||||
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||
hs_err_pid*
|
||||
replay_pid*
|
||||
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/workspace.xml
|
||||
/.idea/libraries
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.idea
|
||||
|
@ -1,228 +0,0 @@
|
||||
# MIT License
|
||||
#
|
||||
# Copyright (c) 2016-2022 The ZLMediaKit project authors. All Rights Reserved.
|
||||
#
|
||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
# of this software and associated documentation files (the "Software"), to deal
|
||||
# in the Software without restriction, including without limitation the rights
|
||||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
# copies of the Software, and to permit persons to whom the Software is
|
||||
# furnished to do so, subject to the following conditions:
|
||||
#
|
||||
# The above copyright notice and this permission notice shall be included in all
|
||||
# copies or substantial portions of the Software.
|
||||
#
|
||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
# SOFTWARE.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
|
||||
# jsoncpp
|
||||
file(GLOB JSONCPP_SRC_LIST
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/jsoncpp/include/json/*.h
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/jsoncpp/src/lib_json/*.cpp
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/jsoncpp/src/lib_json/*.h)
|
||||
|
||||
add_library(jsoncpp STATIC ${JSONCPP_SRC_LIST})
|
||||
target_compile_options(jsoncpp
|
||||
PRIVATE ${COMPILE_OPTIONS_DEFAULT})
|
||||
target_include_directories(jsoncpp
|
||||
PRIVATE
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/jsoncpp/include"
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>/jsoncpp/include")
|
||||
|
||||
update_cached_list(MK_LINK_LIBRARIES jsoncpp)
|
||||
|
||||
##############################################################################
|
||||
|
||||
# media-server
|
||||
set(MediaServer_ROOT "${CMAKE_CURRENT_SOURCE_DIR}/media-server")
|
||||
# TODO: 补一个函数处理各种库
|
||||
|
||||
# 添加 mov、flv 库用于 MP4 录制
|
||||
if (ENABLE_MP4)
|
||||
# MOV
|
||||
set(MediaServer_MOV_ROOT ${MediaServer_ROOT}/libmov)
|
||||
aux_source_directory(${MediaServer_MOV_ROOT}/include MOV_SRC_LIST)
|
||||
aux_source_directory(${MediaServer_MOV_ROOT}/source MOV_SRC_LIST)
|
||||
add_library(mov STATIC ${MOV_SRC_LIST})
|
||||
add_library(MediaServer::mov ALIAS mov)
|
||||
target_compile_options(mov PRIVATE ${COMPILE_OPTIONS_DEFAULT})
|
||||
target_include_directories(mov
|
||||
PRIVATE
|
||||
"$<BUILD_INTERFACE:${MediaServer_MOV_ROOT}/include>"
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${MediaServer_MOV_ROOT}/include>")
|
||||
|
||||
# FLV
|
||||
set(MediaServer_FLV_ROOT ${MediaServer_ROOT}/libflv)
|
||||
aux_source_directory(${MediaServer_FLV_ROOT}/include FLV_SRC_LIST)
|
||||
aux_source_directory(${MediaServer_FLV_ROOT}/source FLV_SRC_LIST)
|
||||
add_library(flv STATIC ${FLV_SRC_LIST})
|
||||
add_library(MediaServer::flv ALIAS flv)
|
||||
target_compile_options(flv PRIVATE ${COMPILE_OPTIONS_DEFAULT})
|
||||
target_include_directories(flv
|
||||
PRIVATE
|
||||
"$<BUILD_INTERFACE:${MediaServer_FLV_ROOT}/include>"
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${MediaServer_FLV_ROOT}/include>")
|
||||
|
||||
update_cached_list(MK_LINK_LIBRARIES MediaServer::flv MediaServer::mov)
|
||||
|
||||
if (ENABLE_MP4)
|
||||
message(STATUS "ENABLE_MP4 defined")
|
||||
update_cached_list(MK_COMPILE_DEFINITIONS ENABLE_MP4)
|
||||
endif ()
|
||||
endif ()
|
||||
|
||||
# 添加 mpeg 用于支持 ts 生成
|
||||
if(ENABLE_RTPPROXY OR ENABLE_HLS)
|
||||
# mpeg
|
||||
set(MediaServer_MPEG_ROOT ${MediaServer_ROOT}/libmpeg)
|
||||
aux_source_directory(${MediaServer_MPEG_ROOT}/include MPEG_SRC_LIST)
|
||||
aux_source_directory(${MediaServer_MPEG_ROOT}/source MPEG_SRC_LIST)
|
||||
add_library(mpeg STATIC ${MPEG_SRC_LIST})
|
||||
add_library(MediaServer::mpeg ALIAS mpeg)
|
||||
# media-server库相关编译宏
|
||||
# MPEG_H26X_VERIFY - 视频流类型识别
|
||||
# MPEG_ZERO_PAYLOAD_LENGTH - 兼容hik流
|
||||
# MPEG_DAHUA_AAC_FROM_G711 - 兼容dahua流
|
||||
target_compile_options(mpeg
|
||||
PRIVATE ${COMPILE_OPTIONS_DEFAULT} -DMPEG_H26X_VERIFY -DMPEG_ZERO_PAYLOAD_LENGTH -DMPEG_DAHUA_AAC_FROM_G711)
|
||||
target_include_directories(mpeg
|
||||
PRIVATE
|
||||
"$<BUILD_INTERFACE:${MediaServer_MPEG_ROOT}/include>"
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${MediaServer_MPEG_ROOT}/include>")
|
||||
|
||||
update_cached_list(MK_LINK_LIBRARIES MediaServer::mpeg)
|
||||
if(ENABLE_RTPPROXY)
|
||||
message(STATUS "ENABLE_RTPPROXY defined")
|
||||
update_cached_list(MK_COMPILE_DEFINITIONS ENABLE_RTPPROXY)
|
||||
endif()
|
||||
if(ENABLE_HLS)
|
||||
message(STATUS "ENABLE_HLS defined")
|
||||
update_cached_list(MK_COMPILE_DEFINITIONS ENABLE_HLS)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
##############################################################################
|
||||
|
||||
# toolkit
|
||||
# TODO: 改造 toolkit 以便直接引用
|
||||
|
||||
include(CheckStructHasMember)
|
||||
include(CheckSymbolExists)
|
||||
|
||||
# 检查 sendmmsg 相关依赖并设置对应的宏, 配置 _GNU_SOURCE 以启用 GNU 扩展特性
|
||||
list(APPEND CMAKE_REQUIRED_DEFINITIONS -D_GNU_SOURCE)
|
||||
check_struct_has_member("struct mmsghdr" msg_hdr sys/socket.h HAVE_MMSG_HDR)
|
||||
check_symbol_exists(sendmmsg sys/socket.h HAVE_SENDMMSG_API)
|
||||
check_symbol_exists(recvmmsg sys/socket.h HAVE_RECVMMSG_API)
|
||||
|
||||
set(COMPILE_DEFINITIONS)
|
||||
# ToolKit 依赖 ENABLE_OPENSSL 以及 ENABLE_MYSQL
|
||||
list(FIND MK_COMPILE_DEFINITIONS ENABLE_OPENSSL ENABLE_OPENSSL_INDEX)
|
||||
if(NOT ENABLE_OPENSSL_INDEX EQUAL -1)
|
||||
list(APPEND COMPILE_DEFINITIONS ENABLE_OPENSSL)
|
||||
endif()
|
||||
list(FIND MK_COMPILE_DEFINITIONS ENABLE_MYSQL ENABLE_MYSQL_INDEX)
|
||||
if(NOT ENABLE_MYSQL_INDEX EQUAL -1)
|
||||
list(APPEND COMPILE_DEFINITIONS ENABLE_MYSQL)
|
||||
endif()
|
||||
if(HAVE_MMSG_HDR)
|
||||
list(APPEND COMPILE_DEFINITIONS HAVE_MMSG_HDR)
|
||||
endif()
|
||||
if(HAVE_SENDMMSG_API)
|
||||
list(APPEND COMPILE_DEFINITIONS HAVE_SENDMMSG_API)
|
||||
endif()
|
||||
if(HAVE_RECVMMSG_API)
|
||||
list(APPEND COMPILE_DEFINITIONS HAVE_RECVMMSG_API)
|
||||
endif()
|
||||
|
||||
# check the socket buffer size set by the upper cmake project, if it is set, use the setting of the upper cmake project, otherwise set it to 256K
|
||||
# if the socket buffer size is set to 0, it means that the socket buffer size is not set, and the kernel default value is used(just for linux)
|
||||
if(DEFINED SOCKET_DEFAULT_BUF_SIZE)
|
||||
if (SOCKET_DEFAULT_BUF_SIZE EQUAL 0)
|
||||
message(STATUS "Socket default buffer size is not set, use the kernel default value")
|
||||
else()
|
||||
message(STATUS "Socket default buffer size is set to ${SOCKET_DEFAULT_BUF_SIZE}")
|
||||
endif ()
|
||||
add_definitions(-DSOCKET_DEFAULT_BUF_SIZE=${SOCKET_DEFAULT_BUF_SIZE})
|
||||
endif()
|
||||
|
||||
set(ToolKit_ROOT ${CMAKE_CURRENT_SOURCE_DIR}/ZLToolKit)
|
||||
# 收集源代码
|
||||
file(GLOB ToolKit_SRC_LIST
|
||||
${ToolKit_ROOT}/src/*/*.cpp
|
||||
${ToolKit_ROOT}/src/*/*.h
|
||||
${ToolKit_ROOT}/src/*/*.c)
|
||||
if(IOS)
|
||||
list(APPEND ToolKit_SRC_LIST
|
||||
${ToolKit_ROOT}/src/Network/Socket_ios.mm)
|
||||
endif()
|
||||
|
||||
###################################################################
|
||||
#使用wepoll windows iocp 模拟 epoll
|
||||
if(ENABLE_WEPOLL)
|
||||
if(WIN32)
|
||||
message(STATUS "Enable wepoll")
|
||||
#增加wepoll源文件及api参数兼容文件
|
||||
list(APPEND ToolKit_SRC_LIST
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wepoll/wepoll.c
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/wepoll/sys/epoll.cpp)
|
||||
#增加wepoll头文件目录
|
||||
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/wepoll)
|
||||
#开启epoll
|
||||
add_definitions(-DHAS_EPOLL)
|
||||
endif()
|
||||
endif()
|
||||
###################################################################
|
||||
|
||||
# 去除 win32 的适配代码
|
||||
if(NOT WIN32)
|
||||
list(REMOVE_ITEM ToolKit_SRC_LIST ${ToolKit_ROOT}/win32/getopt.c)
|
||||
else()
|
||||
# 防止 Windows.h 包含 Winsock.h
|
||||
list(APPEND COMPILE_DEFINITIONS
|
||||
WIN32_LEAN_AND_MEAN MP4V2_NO_STDINT_DEFS
|
||||
# 禁用警告
|
||||
_CRT_SECURE_NO_WARNINGS _WINSOCK_DEPRECATED_NO_WARNINGS)
|
||||
endif()
|
||||
|
||||
# 添加库
|
||||
add_library(zltoolkit STATIC ${ToolKit_SRC_LIST})
|
||||
add_library(ZLMediaKit::ToolKit ALIAS zltoolkit)
|
||||
target_compile_definitions(zltoolkit
|
||||
PUBLIC ${COMPILE_DEFINITIONS})
|
||||
target_compile_options(zltoolkit
|
||||
PRIVATE ${COMPILE_OPTIONS_DEFAULT})
|
||||
target_include_directories(zltoolkit
|
||||
PRIVATE
|
||||
"$<BUILD_INTERFACE:${ToolKit_ROOT}/src>"
|
||||
PUBLIC
|
||||
"$<BUILD_INTERFACE:${ToolKit_ROOT}>/src")
|
||||
|
||||
update_cached_list(MK_LINK_LIBRARIES ZLMediaKit::ToolKit)
|
||||
|
||||
if(USE_SOLUTION_FOLDERS AND (NOT GROUP_BY_EXPLORER))
|
||||
# 在 IDE 中对文件进行分组, 源文件和头文件分开
|
||||
set_file_group(${ToolKit_ROOT}/src ${ToolKit_SRC_LIST})
|
||||
endif()
|
||||
|
||||
# 未在使用
|
||||
if(ENABLE_CXX_API)
|
||||
# 保留目录结构
|
||||
install(DIRECTORY ${ToolKit_ROOT}/
|
||||
DESTINATION ${INSTALL_PATH_INCLUDE}/ZLToolKit
|
||||
REGEX "(.*[.](md|cpp)|win32)$" EXCLUDE)
|
||||
install(TARGETS zltoolkit
|
||||
DESTINATION ${INSTALL_PATH_LIB})
|
||||
endif()
|
@ -1,46 +0,0 @@
|
||||
name: Linux
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Release
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# The CMake configure and build commands are platform agnostic and should work equally
|
||||
# well on Windows or Mac. You can convert this to a matrix build if you need
|
||||
# cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Create Build Environment
|
||||
# Some projects don't allow in-source building, so create a separate build directory
|
||||
# We'll use this as our working directory for all subsequent commands
|
||||
run: cmake -E make_directory ${{github.workspace}}/build
|
||||
|
||||
- name: Configure CMake
|
||||
# Use a bash shell so we can use the same syntax for environment variable
|
||||
# access regardless of the host operating system
|
||||
shell: bash
|
||||
working-directory: ${{github.workspace}}/build
|
||||
# Note the current convention is to use the -S and -B options here to specify source
|
||||
# and build directories, but this is only available with CMake 3.13 and higher.
|
||||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
|
||||
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{github.workspace}}/build
|
||||
shell: bash
|
||||
# Execute the build. You can specify a specific target with "--target <NAME>"
|
||||
run: cmake --build . --config $BUILD_TYPE -j $(nproc)
|
||||
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build
|
||||
shell: bash
|
||||
# Execute tests defined by the CMake configuration.
|
||||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
||||
run: ctest -C $BUILD_TYPE
|
@ -1,46 +0,0 @@
|
||||
name: MacOS
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
env:
|
||||
# Customize the CMake build type here (Release, Debug, RelWithDebInfo, etc.)
|
||||
BUILD_TYPE: Release
|
||||
|
||||
jobs:
|
||||
build:
|
||||
# The CMake configure and build commands are platform agnostic and should work equally
|
||||
# well on Windows or Mac. You can convert this to a matrix build if you need
|
||||
# cross-platform coverage.
|
||||
# See: https://docs.github.com/en/free-pro-team@latest/actions/learn-github-actions/managing-complex-workflows#using-a-build-matrix
|
||||
runs-on: macOS-latest
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
|
||||
- name: Create Build Environment
|
||||
# Some projects don't allow in-source building, so create a separate build directory
|
||||
# We'll use this as our working directory for all subsequent commands
|
||||
run: cmake -E make_directory ${{github.workspace}}/build
|
||||
|
||||
- name: Configure CMake
|
||||
# Use a bash shell so we can use the same syntax for environment variable
|
||||
# access regardless of the host operating system
|
||||
shell: bash
|
||||
working-directory: ${{github.workspace}}/build
|
||||
# Note the current convention is to use the -S and -B options here to specify source
|
||||
# and build directories, but this is only available with CMake 3.13 and higher.
|
||||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
|
||||
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE
|
||||
|
||||
- name: Build
|
||||
working-directory: ${{github.workspace}}/build
|
||||
shell: bash
|
||||
# Execute the build. You can specify a specific target with "--target <NAME>"
|
||||
run: cmake --build . --config $BUILD_TYPE -j $(nproc)
|
||||
|
||||
- name: Test
|
||||
working-directory: ${{github.workspace}}/build
|
||||
shell: bash
|
||||
# Execute tests defined by the CMake configuration.
|
||||
# See https://cmake.org/cmake/help/latest/manual/ctest.1.html for more detail
|
||||
run: ctest -C $BUILD_TYPE
|
@ -1,27 +0,0 @@
|
||||
name: style check
|
||||
|
||||
on: [pull_request]
|
||||
|
||||
jobs:
|
||||
check:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
with:
|
||||
# with all history
|
||||
fetch-depth: 0
|
||||
- name: Validate BOM
|
||||
run: |
|
||||
ret=0
|
||||
for i in $(git diff --name-only origin/${GITHUB_BASE_REF}...${GITHUB_SHA}); do
|
||||
if [ -f ${i} ]; then
|
||||
case ${i} in
|
||||
*.c|*.cc|*.cpp|*.h)
|
||||
if file ${i} | grep -qv BOM; then
|
||||
echo "Missing BOM in ${i}" && ret=1;
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
fi
|
||||
done
|
||||
exit ${ret}
|
@ -1,30 +0,0 @@
|
||||
name: Windows
|
||||
|
||||
on: [push, pull_request]
|
||||
|
||||
jobs:
|
||||
build:
|
||||
runs-on: windows-2019
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
submodules: 'recursive'
|
||||
fetch-depth: 1
|
||||
|
||||
- name: 配置 vcpkg
|
||||
uses: lukka/run-vcpkg@v7
|
||||
with:
|
||||
vcpkgDirectory: '${{github.workspace}}/vcpkg'
|
||||
vcpkgTriplet: x64-windows-static
|
||||
# 2021.05.12
|
||||
vcpkgGitCommitId: '5568f110b509a9fd90711978a7cb76bae75bb092'
|
||||
vcpkgArguments: 'openssl'
|
||||
|
||||
- name: 编译
|
||||
uses: lukka/run-cmake@v3
|
||||
with:
|
||||
useVcpkgToolchainFile: true
|
||||
buildDirectory: '${{github.workspace}}/build'
|
||||
cmakeAppendedArgs: ''
|
||||
cmakeBuildType: 'RelWithDebInfo'
|
@ -1,33 +0,0 @@
|
||||
# Compiled Object files
|
||||
*.slo
|
||||
*.lo
|
||||
*.o
|
||||
*.obj
|
||||
*.d
|
||||
|
||||
# Precompiled Headers
|
||||
*.gch
|
||||
*.pch
|
||||
|
||||
# Compiled Dynamic libraries
|
||||
#*.dylib
|
||||
#*.dll
|
||||
|
||||
# Fortran module files
|
||||
*.mod
|
||||
*.smod
|
||||
|
||||
# Compiled Static libraries
|
||||
*.lai
|
||||
*.la
|
||||
*.lib
|
||||
|
||||
# Executables
|
||||
*.exe
|
||||
*.out
|
||||
*.app
|
||||
/X64/
|
||||
|
||||
*.DS_Store
|
||||
/cmake-build-debug/
|
||||
/.idea/
|
@ -1,13 +0,0 @@
|
||||
language: cpp
|
||||
sudo: required
|
||||
dist: trusty
|
||||
compiler:
|
||||
- gcc
|
||||
os:
|
||||
- linux
|
||||
before_install:
|
||||
script:
|
||||
- ./build_for_linux.sh
|
||||
|
||||
|
||||
|
@ -1,21 +0,0 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2016 The ZLToolKit project authors. All Rights Reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||
SOFTWARE.
|
@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
brew install cmake
|
||||
cd ..
|
||||
git clone --depth=50 https://github.com/xia-chu/ZLToolKit.git
|
||||
cd ZLToolKit
|
||||
mkdir -p android_build
|
||||
rm -rf ./build
|
||||
ln -s ./android_build ./build
|
||||
cd android_build
|
||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/android.toolchain.cmake -DANDROID_NDK=$ANDROID_NDK_ROOT -DCMAKE_BUILD_TYPE=Release -DANDROID_ABI="armeabi" -DANDROID_NATIVE_API_LEVEL=android-9
|
||||
make -j4
|
||||
sudo make install
|
@ -1,13 +0,0 @@
|
||||
#!/bin/bash
|
||||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
brew install cmake
|
||||
cd ..
|
||||
git clone --depth=50 https://github.com/xia-chu/ZLToolKit.git
|
||||
cd ZLToolKit
|
||||
mkdir -p ios_build
|
||||
rm -rf ./build
|
||||
ln -s ./ios_build ./build
|
||||
cd ios_build
|
||||
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/iOS.cmake -DIOS_PLATFORM=OS
|
||||
make -j4
|
||||
sudo make install
|
@ -1,14 +0,0 @@
|
||||
#!/bin/bash
|
||||
sudo apt-get install cmake
|
||||
sudo apt-get install libmysqlclient-dev
|
||||
sudo apt-get install libssl-dev
|
||||
cd ..
|
||||
git clone --depth=50 https://github.com/xia-chu/ZLToolKit.git
|
||||
cd ZLToolKit
|
||||
mkdir -p linux_build
|
||||
rm -rf ./build
|
||||
ln -s ./linux_build ./build
|
||||
cd linux_build
|
||||
cmake ..
|
||||
make -j4
|
||||
sudo make install
|
@ -1,15 +0,0 @@
|
||||
#!/bin/bash
|
||||
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
|
||||
brew install cmake
|
||||
brew install mysql
|
||||
brew install openssl
|
||||
cd ..
|
||||
git clone --depth=50 https://github.com/xia-chu/ZLToolKit.git
|
||||
cd ZLToolKit
|
||||
mkdir -p mac_build
|
||||
rm -rf ./build
|
||||
ln -s ./mac_build ./build
|
||||
cd mac_build
|
||||
cmake .. -DOPENSSL_ROOT_DIR=/usr/local/Cellar/openssl/1.0.2j/
|
||||
make -j4
|
||||
sudo make install
|
@ -1,96 +0,0 @@
|
||||
# Copyright (c) 2014, Pavel Rojtberg
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
# ------------------------------------------------------------------------------
|
||||
# Usage:
|
||||
# 1. place AndroidNdkGdb.cmake somewhere inside ${CMAKE_MODULE_PATH}
|
||||
# 2. inside your project add
|
||||
#
|
||||
# include(AndroidNdkGdb)
|
||||
# android_ndk_gdb_enable()
|
||||
# # for each target
|
||||
# add_library(MyLibrary ...)
|
||||
# android_ndk_gdb_debuggable(MyLibrary)
|
||||
|
||||
|
||||
# add gdbserver and general gdb configuration to project
|
||||
# also create a mininal NDK skeleton so ndk-gdb finds the paths
|
||||
#
|
||||
# the optional parameter defines the path to the android project.
|
||||
# uses PROJECT_SOURCE_DIR by default.
|
||||
macro(android_ndk_gdb_enable)
|
||||
if(ANDROID)
|
||||
# create custom target that depends on the real target so it gets executed afterwards
|
||||
add_custom_target(NDK_GDB ALL)
|
||||
|
||||
if(${ARGC})
|
||||
set(ANDROID_PROJECT_DIR ${ARGV0})
|
||||
else()
|
||||
set(ANDROID_PROJECT_DIR ${PROJECT_SOURCE_DIR})
|
||||
endif()
|
||||
|
||||
set(NDK_GDB_SOLIB_PATH ${ANDROID_PROJECT_DIR}/obj/local/${ANDROID_NDK_ABI_NAME}/)
|
||||
file(MAKE_DIRECTORY ${NDK_GDB_SOLIB_PATH})
|
||||
|
||||
# 1. generate essential Android Makefiles
|
||||
file(MAKE_DIRECTORY ${ANDROID_PROJECT_DIR}/jni)
|
||||
if(NOT EXISTS ${ANDROID_PROJECT_DIR}/jni/Android.mk)
|
||||
file(WRITE ${ANDROID_PROJECT_DIR}/jni/Android.mk "APP_ABI := ${ANDROID_NDK_ABI_NAME}\n")
|
||||
endif()
|
||||
if(NOT EXISTS ${ANDROID_PROJECT_DIR}/jni/Application.mk)
|
||||
file(WRITE ${ANDROID_PROJECT_DIR}/jni/Application.mk "APP_ABI := ${ANDROID_NDK_ABI_NAME}\n")
|
||||
endif()
|
||||
|
||||
# 2. generate gdb.setup
|
||||
get_directory_property(PROJECT_INCLUDES DIRECTORY ${PROJECT_SOURCE_DIR} INCLUDE_DIRECTORIES)
|
||||
string(REGEX REPLACE ";" " " PROJECT_INCLUDES "${PROJECT_INCLUDES}")
|
||||
file(WRITE ${LIBRARY_OUTPUT_PATH}/gdb.setup "set solib-search-path ${NDK_GDB_SOLIB_PATH}\n")
|
||||
file(APPEND ${LIBRARY_OUTPUT_PATH}/gdb.setup "directory ${PROJECT_INCLUDES}\n")
|
||||
|
||||
# 3. copy gdbserver executable
|
||||
file(COPY ${ANDROID_NDK}/prebuilt/android-${ANDROID_ARCH_NAME}/gdbserver/gdbserver DESTINATION ${LIBRARY_OUTPUT_PATH})
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
# register a target for remote debugging
|
||||
# copies the debug version to NDK_GDB_SOLIB_PATH then strips symbols of original
|
||||
macro(android_ndk_gdb_debuggable TARGET_NAME)
|
||||
if(ANDROID)
|
||||
get_property(TARGET_LOCATION TARGET ${TARGET_NAME} PROPERTY LOCATION)
|
||||
|
||||
# create custom target that depends on the real target so it gets executed afterwards
|
||||
add_dependencies(NDK_GDB ${TARGET_NAME})
|
||||
|
||||
# 4. copy lib to obj
|
||||
add_custom_command(TARGET NDK_GDB POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different ${TARGET_LOCATION} ${NDK_GDB_SOLIB_PATH})
|
||||
|
||||
# 5. strip symbols
|
||||
add_custom_command(TARGET NDK_GDB POST_BUILD COMMAND ${CMAKE_STRIP} ${TARGET_LOCATION})
|
||||
endif()
|
||||
endmacro()
|
@ -1,58 +0,0 @@
|
||||
# Copyright (c) 2014, Pavel Rojtberg
|
||||
# All rights reserved.
|
||||
#
|
||||
# Redistribution and use in source and binary forms, with or without
|
||||
# modification, are permitted provided that the following conditions are met:
|
||||
#
|
||||
# 1. Redistributions of source code must retain the above copyright notice,
|
||||
# this list of conditions and the following disclaimer.
|
||||
#
|
||||
# 2. Redistributions in binary form must reproduce the above copyright notice,
|
||||
# this list of conditions and the following disclaimer in the documentation
|
||||
# and/or other materials provided with the distribution.
|
||||
#
|
||||
# 3. Neither the name of the copyright holder nor the names of its
|
||||
# contributors may be used to endorse or promote products derived from this
|
||||
# software without specific prior written permission.
|
||||
#
|
||||
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
||||
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
# POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
macro(android_ndk_import_module_cpufeatures)
|
||||
if(ANDROID)
|
||||
include_directories(${ANDROID_NDK}/sources/android/cpufeatures)
|
||||
add_library(cpufeatures ${ANDROID_NDK}/sources/android/cpufeatures/cpu-features.c)
|
||||
target_link_libraries(cpufeatures dl)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(android_ndk_import_module_native_app_glue)
|
||||
if(ANDROID)
|
||||
include_directories(${ANDROID_NDK}/sources/android/native_app_glue)
|
||||
add_library(native_app_glue ${ANDROID_NDK}/sources/android/native_app_glue/android_native_app_glue.c)
|
||||
target_link_libraries(native_app_glue log)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
macro(android_ndk_import_module_ndk_helper)
|
||||
if(ANDROID)
|
||||
android_ndk_import_module_cpufeatures()
|
||||
android_ndk_import_module_native_app_glue()
|
||||
|
||||
include_directories(${ANDROID_NDK}/sources/android/ndk_helper)
|
||||
file(GLOB _NDK_HELPER_SRCS ${ANDROID_NDK}/sources/android/ndk_helper/*.cpp ${ANDROID_NDK}/sources/android/ndk_helper/gl3stub.c)
|
||||
add_library(ndk_helper ${_NDK_HELPER_SRCS})
|
||||
target_link_libraries(ndk_helper log android EGL GLESv2 cpufeatures native_app_glue)
|
||||
|
||||
unset(_NDK_HELPER_SRCS)
|
||||
endif()
|
||||
endmacro()
|
@ -1,132 +0,0 @@
|
||||
# - Try to find MySQL / MySQL Embedded library
|
||||
# Find the MySQL includes and client library
|
||||
# This module defines
|
||||
# MYSQL_INCLUDE_DIR, where to find mysql.h
|
||||
# MYSQL_LIBRARIES, the libraries needed to use MySQL.
|
||||
# MYSQL_LIB_DIR, path to the MYSQL_LIBRARIES
|
||||
# MYSQL_EMBEDDED_LIBRARIES, the libraries needed to use MySQL Embedded.
|
||||
# MYSQL_EMBEDDED_LIB_DIR, path to the MYSQL_EMBEDDED_LIBRARIES
|
||||
# MYSQL_FOUND, If false, do not try to use MySQL.
|
||||
# MYSQL_EMBEDDED_FOUND, If false, do not try to use MySQL Embedded.
|
||||
|
||||
# Copyright (c) 2006-2008, Jarosław Staniek <staniek@kde.org>
|
||||
#
|
||||
# Redistribution and use is allowed according to the terms of the BSD license.
|
||||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
|
||||
|
||||
include(CheckCXXSourceCompiles)
|
||||
|
||||
if(WIN32)
|
||||
find_path(MYSQL_INCLUDE_DIR mysql.h
|
||||
PATHS
|
||||
$ENV{MYSQL_INCLUDE_DIR}
|
||||
$ENV{MYSQL_DIR}/include
|
||||
$ENV{ProgramFiles}/MySQL/*/include
|
||||
$ENV{SystemDrive}/MySQL/*/include
|
||||
$ENV{ProgramW6432}/MySQL/*/include
|
||||
)
|
||||
else(WIN32)
|
||||
#在Mac OS下, mysql.h的文件可能不是在mysql目录下
|
||||
#可能存在/usr/local/mysql/include/mysql.h
|
||||
find_path(MYSQL_INCLUDE_DIR mysql.h
|
||||
PATHS
|
||||
$ENV{MYSQL_INCLUDE_DIR}
|
||||
$ENV{MYSQL_DIR}/include
|
||||
/usr/local/mysql/include
|
||||
/usr/local/mysql/include/mysql
|
||||
/opt/mysql/mysql/include
|
||||
PATH_SUFFIXES
|
||||
mysql
|
||||
)
|
||||
endif(WIN32)
|
||||
|
||||
if(WIN32)
|
||||
if (${CMAKE_BUILD_TYPE})
|
||||
string(TOLOWER ${CMAKE_BUILD_TYPE} CMAKE_BUILD_TYPE_TOLOWER)
|
||||
endif()
|
||||
|
||||
# path suffix for debug/release mode
|
||||
# binary_dist: mysql binary distribution
|
||||
# build_dist: custom build
|
||||
if(CMAKE_BUILD_TYPE_TOLOWER MATCHES "debug")
|
||||
set(binary_dist debug)
|
||||
set(build_dist Debug)
|
||||
else(CMAKE_BUILD_TYPE_TOLOWER MATCHES "debug")
|
||||
ADD_DEFINITIONS(-DDBUG_OFF)
|
||||
set(binary_dist opt)
|
||||
set(build_dist Release)
|
||||
endif(CMAKE_BUILD_TYPE_TOLOWER MATCHES "debug")
|
||||
|
||||
# find_library(MYSQL_LIBRARIES NAMES mysqlclient
|
||||
set(MYSQL_LIB_PATHS
|
||||
$ENV{MYSQL_DIR}/lib/${binary_dist}
|
||||
$ENV{MYSQL_DIR}/libmysql/${build_dist}
|
||||
$ENV{MYSQL_DIR}/client/${build_dist}
|
||||
$ENV{ProgramFiles}/MySQL/*/lib/${binary_dist}
|
||||
$ENV{SystemDrive}/MySQL/*/lib/${binary_dist}
|
||||
$ENV{MYSQL_DIR}/lib/opt
|
||||
$ENV{MYSQL_DIR}/client/release
|
||||
$ENV{ProgramFiles}/MySQL/*/lib/opt
|
||||
$ENV{ProgramFiles}/MySQL/*/lib/
|
||||
$ENV{SystemDrive}/MySQL/*/lib/opt
|
||||
$ENV{ProgramW6432}/MySQL/*/lib
|
||||
)
|
||||
find_library(MYSQL_LIBRARIES NAMES libmysql
|
||||
PATHS
|
||||
${MYSQL_LIB_PATHS}
|
||||
)
|
||||
else(WIN32)
|
||||
# find_library(MYSQL_LIBRARIES NAMES mysqlclient
|
||||
set(MYSQL_LIB_PATHS
|
||||
$ENV{MYSQL_DIR}/libmysql_r/.libs
|
||||
$ENV{MYSQL_DIR}/lib
|
||||
$ENV{MYSQL_DIR}/lib/mysql
|
||||
/usr/local/mysql/lib
|
||||
/opt/mysql/mysql/lib
|
||||
$ENV{MYSQL_DIR}/libmysql_r/.libs
|
||||
$ENV{MYSQL_DIR}/lib
|
||||
$ENV{MYSQL_DIR}/lib/mysql
|
||||
/usr/local/mysql/lib
|
||||
/opt/mysql/mysql/lib
|
||||
PATH_SUFFIXES
|
||||
mysql
|
||||
)
|
||||
find_library(MYSQL_LIBRARIES NAMES mysqlclient
|
||||
PATHS
|
||||
${MYSQL_LIB_PATHS}
|
||||
)
|
||||
endif(WIN32)
|
||||
|
||||
find_library(MYSQL_EMBEDDED_LIBRARIES NAMES mysqld
|
||||
PATHS
|
||||
${MYSQL_LIB_PATHS}
|
||||
)
|
||||
|
||||
if(MYSQL_LIBRARIES)
|
||||
get_filename_component(MYSQL_LIB_DIR ${MYSQL_LIBRARIES} PATH)
|
||||
endif(MYSQL_LIBRARIES)
|
||||
|
||||
if(MYSQL_EMBEDDED_LIBRARIES)
|
||||
get_filename_component(MYSQL_EMBEDDED_LIB_DIR ${MYSQL_EMBEDDED_LIBRARIES} PATH)
|
||||
endif(MYSQL_EMBEDDED_LIBRARIES)
|
||||
|
||||
set( CMAKE_REQUIRED_INCLUDES ${MYSQL_INCLUDE_DIR} )
|
||||
set( CMAKE_REQUIRED_LIBRARIES ${MYSQL_EMBEDDED_LIBRARIES} )
|
||||
check_cxx_source_compiles( "#include <mysql.h>\nint main() { int i = MYSQL_OPT_USE_EMBEDDED_CONNECTION; }" HAVE_MYSQL_OPT_EMBEDDED_CONNECTION )
|
||||
if(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
|
||||
set(MYSQL_FOUND TRUE)
|
||||
message(STATUS "Found MySQL: ${MYSQL_INCLUDE_DIR}, ${MYSQL_LIBRARIES}")
|
||||
else(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
|
||||
set(MYSQL_FOUND FALSE)
|
||||
message(STATUS "MySQL not found.")
|
||||
endif(MYSQL_INCLUDE_DIR AND MYSQL_LIBRARIES)
|
||||
|
||||
if(MYSQL_INCLUDE_DIR AND MYSQL_EMBEDDED_LIBRARIES AND HAVE_MYSQL_OPT_EMBEDDED_CONNECTION)
|
||||
set(MYSQL_EMBEDDED_FOUND TRUE)
|
||||
message(STATUS "Found MySQL Embedded: ${MYSQL_INCLUDE_DIR}, ${MYSQL_EMBEDDED_LIBRARIES}")
|
||||
else(MYSQL_INCLUDE_DIR AND MYSQL_EMBEDDED_LIBRARIES AND HAVE_MYSQL_OPT_EMBEDDED_CONNECTION)
|
||||
set(MYSQL_EMBEDDED_FOUND FALSE)
|
||||
message(STATUS "MySQL Embedded not found.")
|
||||
endif(MYSQL_INCLUDE_DIR AND MYSQL_EMBEDDED_LIBRARIES AND HAVE_MYSQL_OPT_EMBEDDED_CONNECTION)
|
||||
|
||||
mark_as_advanced(MYSQL_INCLUDE_DIR MYSQL_LIBRARIES MYSQL_EMBEDDED_LIBRARIES)
|
File diff suppressed because it is too large
Load Diff
@ -1,209 +0,0 @@
|
||||
# This file is based off of the Platform/Darwin.cmake and Platform/UnixPaths.cmake
|
||||
# files which are included with CMake 2.8.4
|
||||
# It has been altered for iOS development
|
||||
|
||||
# Options:
|
||||
#
|
||||
# IOS_PLATFORM = OS (default) or SIMULATOR or SIMULATOR64
|
||||
# This decides if SDKS will be selected from the iPhoneOS.platform or iPhoneSimulator.platform folders
|
||||
# OS - the default, used to build for iPhone and iPad physical devices, which have an arm arch.
|
||||
# SIMULATOR - used to build for the Simulator platforms, which have an x86 arch.
|
||||
#
|
||||
# CMAKE_IOS_DEVELOPER_ROOT = automatic(default) or /path/to/platform/Developer folder
|
||||
# By default this location is automatcially chosen based on the IOS_PLATFORM value above.
|
||||
# If set manually, it will override the default location and force the user of a particular Developer Platform
|
||||
#
|
||||
# CMAKE_IOS_SDK_ROOT = automatic(default) or /path/to/platform/Developer/SDKs/SDK folder
|
||||
# By default this location is automatcially chosen based on the CMAKE_IOS_DEVELOPER_ROOT value.
|
||||
# In this case it will always be the most up-to-date SDK found in the CMAKE_IOS_DEVELOPER_ROOT path.
|
||||
# If set manually, this will force the use of a specific SDK version
|
||||
|
||||
# Macros:
|
||||
#
|
||||
# set_xcode_property (TARGET XCODE_PROPERTY XCODE_VALUE)
|
||||
# A convenience macro for setting xcode specific properties on targets
|
||||
# example: set_xcode_property (myioslib IPHONEOS_DEPLOYMENT_TARGET "3.1")
|
||||
#
|
||||
# find_host_package (PROGRAM ARGS)
|
||||
# A macro used to find executable programs on the host system, not within the iOS environment.
|
||||
# Thanks to the android-cmake project for providing the command
|
||||
|
||||
# Standard settings
|
||||
set (CMAKE_SYSTEM_NAME Darwin)
|
||||
set (CMAKE_SYSTEM_VERSION 1)
|
||||
set (UNIX True)
|
||||
set (APPLE True)
|
||||
set (IOS True)
|
||||
|
||||
# Required as of cmake 2.8.10
|
||||
set (CMAKE_OSX_DEPLOYMENT_TARGET "" CACHE STRING "Force unset of the deployment target for iOS" FORCE)
|
||||
|
||||
# Determine the cmake host system version so we know where to find the iOS SDKs
|
||||
find_program (CMAKE_UNAME uname /bin /usr/bin /usr/local/bin)
|
||||
if (CMAKE_UNAME)
|
||||
exec_program(uname ARGS -r OUTPUT_VARIABLE CMAKE_HOST_SYSTEM_VERSION)
|
||||
string (REGEX REPLACE "^([0-9]+)\\.([0-9]+).*$" "\\1" DARWIN_MAJOR_VERSION "${CMAKE_HOST_SYSTEM_VERSION}")
|
||||
endif (CMAKE_UNAME)
|
||||
|
||||
# Force the compilers to gcc for iOS
|
||||
include (CMakeForceCompiler)
|
||||
#CMAKE_FORCE_C_COMPILER (/usr/bin/gcc Apple)
|
||||
set(CMAKE_C_COMPILER /usr/bin/clang)
|
||||
#CMAKE_FORCE_CXX_COMPILER (/usr/bin/g++ Apple)
|
||||
set(CMAKE_CXX_COMPILER /usr/bin/clang++)
|
||||
set(CMAKE_AR ar CACHE FILEPATH "" FORCE)
|
||||
|
||||
# Skip the platform compiler checks for cross compiling
|
||||
set (CMAKE_CXX_COMPILER_WORKS TRUE)
|
||||
set (CMAKE_C_COMPILER_WORKS TRUE)
|
||||
|
||||
# All iOS/Darwin specific settings - some may be redundant
|
||||
set (CMAKE_SHARED_LIBRARY_PREFIX "lib")
|
||||
set (CMAKE_SHARED_LIBRARY_SUFFIX ".dylib")
|
||||
set (CMAKE_SHARED_MODULE_PREFIX "lib")
|
||||
set (CMAKE_SHARED_MODULE_SUFFIX ".so")
|
||||
set (CMAKE_MODULE_EXISTS 1)
|
||||
set (CMAKE_DL_LIBS "")
|
||||
|
||||
set (CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG "-compatibility_version ")
|
||||
set (CMAKE_C_OSX_CURRENT_VERSION_FLAG "-current_version ")
|
||||
set (CMAKE_CXX_OSX_COMPATIBILITY_VERSION_FLAG "${CMAKE_C_OSX_COMPATIBILITY_VERSION_FLAG}")
|
||||
set (CMAKE_CXX_OSX_CURRENT_VERSION_FLAG "${CMAKE_C_OSX_CURRENT_VERSION_FLAG}")
|
||||
|
||||
# Hidden visibilty is required for cxx on iOS
|
||||
set (CMAKE_C_FLAGS_INIT "")
|
||||
set (CMAKE_CXX_FLAGS_INIT "-fvisibility=hidden -fvisibility-inlines-hidden")
|
||||
|
||||
set (CMAKE_C_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_C_LINK_FLAGS}")
|
||||
set (CMAKE_CXX_LINK_FLAGS "-Wl,-search_paths_first ${CMAKE_CXX_LINK_FLAGS}")
|
||||
|
||||
set (CMAKE_PLATFORM_HAS_INSTALLNAME 1)
|
||||
set (CMAKE_SHARED_LIBRARY_CREATE_C_FLAGS "-dynamiclib -headerpad_max_install_names")
|
||||
set (CMAKE_SHARED_MODULE_CREATE_C_FLAGS "-bundle -headerpad_max_install_names")
|
||||
set (CMAKE_SHARED_MODULE_LOADER_C_FLAG "-Wl,-bundle_loader,")
|
||||
set (CMAKE_SHARED_MODULE_LOADER_CXX_FLAG "-Wl,-bundle_loader,")
|
||||
set (CMAKE_FIND_LIBRARY_SUFFIXES ".dylib" ".so" ".a")
|
||||
|
||||
# hack: if a new cmake (which uses CMAKE_INSTALL_NAME_TOOL) runs on an old build tree
|
||||
# (where install_name_tool was hardcoded) and where CMAKE_INSTALL_NAME_TOOL isn't in the cache
|
||||
# and still cmake didn't fail in CMakeFindBinUtils.cmake (because it isn't rerun)
|
||||
# hardcode CMAKE_INSTALL_NAME_TOOL here to install_name_tool, so it behaves as it did before, Alex
|
||||
if (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
|
||||
find_program(CMAKE_INSTALL_NAME_TOOL install_name_tool)
|
||||
endif (NOT DEFINED CMAKE_INSTALL_NAME_TOOL)
|
||||
|
||||
# Setup iOS platform unless specified manually with IOS_PLATFORM
|
||||
if (NOT DEFINED IOS_PLATFORM)
|
||||
set (IOS_PLATFORM "OS")
|
||||
endif (NOT DEFINED IOS_PLATFORM)
|
||||
set (IOS_PLATFORM ${IOS_PLATFORM} CACHE STRING "Type of iOS Platform")
|
||||
|
||||
# Setup building for arm64 or not
|
||||
if (NOT DEFINED BUILD_ARM64)
|
||||
set (BUILD_ARM64 true)
|
||||
endif (NOT DEFINED BUILD_ARM64)
|
||||
set (BUILD_ARM64 ${BUILD_ARM64} CACHE STRING "Build arm64 arch or not")
|
||||
|
||||
# Check the platform selection and setup for developer root
|
||||
if (${IOS_PLATFORM} STREQUAL "OS")
|
||||
set (IOS_PLATFORM_LOCATION "iPhoneOS.platform")
|
||||
|
||||
# This causes the installers to properly locate the output libraries
|
||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphoneos")
|
||||
elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
||||
set (SIMULATOR true)
|
||||
set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform")
|
||||
|
||||
# This causes the installers to properly locate the output libraries
|
||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
|
||||
elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR64")
|
||||
set (SIMULATOR true)
|
||||
set (IOS_PLATFORM_LOCATION "iPhoneSimulator.platform")
|
||||
|
||||
# This causes the installers to properly locate the output libraries
|
||||
set (CMAKE_XCODE_EFFECTIVE_PLATFORMS "-iphonesimulator")
|
||||
else (${IOS_PLATFORM} STREQUAL "OS")
|
||||
message (FATAL_ERROR "Unsupported IOS_PLATFORM value selected. Please choose OS or SIMULATOR")
|
||||
endif (${IOS_PLATFORM} STREQUAL "OS")
|
||||
|
||||
# Setup iOS developer location unless specified manually with CMAKE_IOS_DEVELOPER_ROOT
|
||||
# Note Xcode 4.3 changed the installation location, choose the most recent one available
|
||||
exec_program(/usr/bin/xcode-select ARGS -print-path OUTPUT_VARIABLE CMAKE_XCODE_DEVELOPER_DIR)
|
||||
set (XCODE_POST_43_ROOT "${CMAKE_XCODE_DEVELOPER_DIR}/Platforms/${IOS_PLATFORM_LOCATION}/Developer")
|
||||
set (XCODE_PRE_43_ROOT "/Developer/Platforms/${IOS_PLATFORM_LOCATION}/Developer")
|
||||
if (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
|
||||
if (EXISTS ${XCODE_POST_43_ROOT})
|
||||
set (CMAKE_IOS_DEVELOPER_ROOT ${XCODE_POST_43_ROOT})
|
||||
elseif(EXISTS ${XCODE_PRE_43_ROOT})
|
||||
set (CMAKE_IOS_DEVELOPER_ROOT ${XCODE_PRE_43_ROOT})
|
||||
endif (EXISTS ${XCODE_POST_43_ROOT})
|
||||
endif (NOT DEFINED CMAKE_IOS_DEVELOPER_ROOT)
|
||||
set (CMAKE_IOS_DEVELOPER_ROOT ${CMAKE_IOS_DEVELOPER_ROOT} CACHE PATH "Location of iOS Platform")
|
||||
|
||||
# Find and use the most recent iOS sdk unless specified manually with CMAKE_IOS_SDK_ROOT
|
||||
if (NOT DEFINED CMAKE_IOS_SDK_ROOT)
|
||||
file (GLOB _CMAKE_IOS_SDKS "${CMAKE_IOS_DEVELOPER_ROOT}/SDKs/*")
|
||||
if (_CMAKE_IOS_SDKS)
|
||||
list (SORT _CMAKE_IOS_SDKS)
|
||||
list (REVERSE _CMAKE_IOS_SDKS)
|
||||
list (GET _CMAKE_IOS_SDKS 0 CMAKE_IOS_SDK_ROOT)
|
||||
else (_CMAKE_IOS_SDKS)
|
||||
message (FATAL_ERROR "No iOS SDK's found in default search path ${CMAKE_IOS_DEVELOPER_ROOT}. Manually set CMAKE_IOS_SDK_ROOT or install the iOS SDK.")
|
||||
endif (_CMAKE_IOS_SDKS)
|
||||
message (STATUS "Toolchain using default iOS SDK: ${CMAKE_IOS_SDK_ROOT}")
|
||||
endif (NOT DEFINED CMAKE_IOS_SDK_ROOT)
|
||||
set (CMAKE_IOS_SDK_ROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Location of the selected iOS SDK")
|
||||
|
||||
# Set the sysroot default to the most recent SDK
|
||||
set (CMAKE_OSX_SYSROOT ${CMAKE_IOS_SDK_ROOT} CACHE PATH "Sysroot used for iOS support")
|
||||
|
||||
# set the architecture for iOS
|
||||
if (${IOS_PLATFORM} STREQUAL "OS")
|
||||
set (IOS_ARCH armv7 armv7s arm64)
|
||||
elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR")
|
||||
set (IOS_ARCH i386)
|
||||
elseif (${IOS_PLATFORM} STREQUAL "SIMULATOR64")
|
||||
set (IOS_ARCH x86_64)
|
||||
endif (${IOS_PLATFORM} STREQUAL "OS")
|
||||
|
||||
set (CMAKE_OSX_ARCHITECTURES ${IOS_ARCH} CACHE string "Build architecture for iOS")
|
||||
|
||||
# Set the find root to the iOS developer roots and to user defined paths
|
||||
set (CMAKE_FIND_ROOT_PATH ${CMAKE_IOS_DEVELOPER_ROOT} ${CMAKE_IOS_SDK_ROOT} ${CMAKE_PREFIX_PATH} CACHE string "iOS find search path root")
|
||||
|
||||
# default to searching for frameworks first
|
||||
set (CMAKE_FIND_FRAMEWORK FIRST)
|
||||
|
||||
# set up the default search directories for frameworks
|
||||
set (CMAKE_SYSTEM_FRAMEWORK_PATH
|
||||
${CMAKE_IOS_SDK_ROOT}/System/Library/Frameworks
|
||||
${CMAKE_IOS_SDK_ROOT}/System/Library/PrivateFrameworks
|
||||
${CMAKE_IOS_SDK_ROOT}/Developer/Library/Frameworks
|
||||
)
|
||||
|
||||
# only search the iOS sdks, not the remainder of the host filesystem
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
|
||||
|
||||
# This little macro lets you set any XCode specific property
|
||||
macro (set_xcode_property TARGET XCODE_PROPERTY XCODE_VALUE)
|
||||
set_property (TARGET ${TARGET} PROPERTY XCODE_ATTRIBUTE_${XCODE_PROPERTY} ${XCODE_VALUE})
|
||||
endmacro (set_xcode_property)
|
||||
|
||||
|
||||
# This macro lets you find executable programs on the host system
|
||||
macro (find_host_package)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY NEVER)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE NEVER)
|
||||
set (IOS FALSE)
|
||||
|
||||
find_package(${ARGN})
|
||||
|
||||
set (IOS TRUE)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_PROGRAM ONLY)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set (CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
||||
endmacro (find_host_package)
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,86 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2016 The ZLToolKit project authors. All Rights Reserved.
|
||||
*
|
||||
* This file is part of ZLToolKit(https://github.com/xia-chu/ZLToolKit).
|
||||
*
|
||||
* Use of this source code is governed by MIT license that can be found in the
|
||||
* LICENSE file in the root of the source tree. All contributing project authors
|
||||
* may be found in the AUTHORS file in the root of the source tree.
|
||||
*/
|
||||
#import "Socket.h"
|
||||
#include "Util/logger.h"
|
||||
|
||||
#if defined (OS_IPHONE)
|
||||
#import <Foundation/Foundation.h>
|
||||
#endif //OS_IPHONE
|
||||
|
||||
namespace toolkit {
|
||||
|
||||
#if defined (OS_IPHONE)
|
||||
bool SockNum::setSocketOfIOS(int sock){
|
||||
|
||||
CFStreamCreatePairWithSocket(NULL, (CFSocketNativeHandle)sock, (CFReadStreamRef *)(&readStream), (CFWriteStreamRef*)(&writeStream));
|
||||
if (readStream)
|
||||
CFReadStreamSetProperty((CFReadStreamRef)readStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanFalse);
|
||||
if (writeStream)
|
||||
CFWriteStreamSetProperty((CFWriteStreamRef)writeStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanFalse);
|
||||
if ((readStream == NULL) || (writeStream == NULL))
|
||||
{
|
||||
WarnL<<"Unable to create read and write stream...";
|
||||
if (readStream)
|
||||
{
|
||||
CFReadStreamClose((CFReadStreamRef)readStream);
|
||||
CFRelease(readStream);
|
||||
readStream = NULL;
|
||||
}
|
||||
if (writeStream)
|
||||
{
|
||||
CFWriteStreamClose((CFWriteStreamRef)writeStream);
|
||||
CFRelease(writeStream);
|
||||
writeStream = NULL;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
Boolean r1 = CFReadStreamSetProperty((CFReadStreamRef)readStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP);
|
||||
Boolean r2 = CFWriteStreamSetProperty((CFWriteStreamRef)writeStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP);
|
||||
|
||||
if (!r1 || !r2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
CFStreamStatus readStatus = CFReadStreamGetStatus((CFReadStreamRef)readStream);
|
||||
CFStreamStatus writeStatus = CFWriteStreamGetStatus((CFWriteStreamRef)writeStream);
|
||||
|
||||
if ((readStatus == kCFStreamStatusNotOpen) || (writeStatus == kCFStreamStatusNotOpen))
|
||||
{
|
||||
BOOL r1 = CFReadStreamOpen((CFReadStreamRef)readStream);
|
||||
BOOL r2 = CFWriteStreamOpen((CFWriteStreamRef)writeStream);
|
||||
|
||||
if (!r1 || !r2)
|
||||
{
|
||||
WarnL<<"Error in CFStreamOpen";
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//NSLog(@"setSocketOfIOS:%d",sock);
|
||||
return true;
|
||||
}
|
||||
void SockNum::unsetSocketOfIOS(int sock){
|
||||
//NSLog(@"unsetSocketOfIOS:%d",sock);
|
||||
if (readStream) {
|
||||
CFReadStreamClose((CFReadStreamRef)readStream);
|
||||
readStream=NULL;
|
||||
}
|
||||
if (writeStream) {
|
||||
CFWriteStreamClose((CFWriteStreamRef)writeStream);
|
||||
writeStream=NULL;
|
||||
}
|
||||
}
|
||||
#endif //OS_IPHONE
|
||||
|
||||
|
||||
|
||||
} // namespace toolkit
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because one or more lines are too long
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue