Initial build script and logic for iOS
Adds a build-ios.sh that is basically a watered down version of build.sh and threads iOS build logic through various CMakeLists.txt files. Also includes a preliminary dummy HttpClient_iOS.mm.
This commit is contained in:
Родитель
44046ea1f1
Коммит
17130bd6a6
|
@ -15,6 +15,29 @@ if (NOT TARGET_ARCH)
|
|||
set(TARGET_ARCH ${CMAKE_SYSTEM_PROCESSOR})
|
||||
endif()
|
||||
|
||||
# iOS build options
|
||||
option(BUILD_IOS "Build for iOS" NO)
|
||||
option(BUILD_SIMULATOR "Build using simulator SDK" NO)
|
||||
|
||||
if(BUILD_IOS)
|
||||
set(TARGET_ARCH "APPLE")
|
||||
if(BUILD_SIMULATOR)
|
||||
set(IOS_PLATFORM "iphonesimulator")
|
||||
set(CMAKE_SYSTEM_PROCESSOR x86_64)
|
||||
else()
|
||||
set(IOS_PLATFORM "iphoneos")
|
||||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -arch arm64")
|
||||
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -arch arm64")
|
||||
set(CMAKE_SYSTEM_PROCESSOR arm64)
|
||||
endif()
|
||||
|
||||
execute_process(COMMAND xcodebuild -version -sdk ${IOS_PLATFORM} Path
|
||||
OUTPUT_VARIABLE CMAKE_OSX_SYSROOT
|
||||
ERROR_QUIET
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||
message("-- CMAKE_OSX_SYSROOT ${CMAKE_OSX_SYSROOT}")
|
||||
endif()
|
||||
|
||||
message("-- CMAKE_SYSTEM_INFO_FILE: ${CMAKE_SYSTEM_INFO_FILE}")
|
||||
message("-- CMAKE_SYSTEM_NAME: ${CMAKE_SYSTEM_NAME}")
|
||||
message("-- CMAKE_SYSTEM_PROCESSOR: ${CMAKE_SYSTEM_PROCESSOR}")
|
||||
|
@ -127,14 +150,17 @@ message(STATUS "-- SDK version: ${SDK_VERSION_PREFIX}-${MATSDK_BUILD_VERSION}")
|
|||
|
||||
# Only use custom curl if compiling with CPP11 PAL
|
||||
if (PAL_IMPLEMENTATION STREQUAL "CPP11")
|
||||
include(FindCURL)
|
||||
find_package(CURL REQUIRED)
|
||||
if (NOT CURL_FOUND)
|
||||
message (FATAL_ERROR "libcurl not found! Have you installed deps?")
|
||||
endif (NOT CURL_FOUND)
|
||||
include_directories(CURL_INCLUDE_DIRS)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${CURL_LIBRARIES}")
|
||||
list(APPEND LIBS "${CURL_LIBRARIES}")
|
||||
|
||||
if(NOT BUILD_IOS)
|
||||
include(FindCURL)
|
||||
find_package(CURL REQUIRED)
|
||||
if (NOT CURL_FOUND)
|
||||
message (FATAL_ERROR "libcurl not found! Have you installed deps?")
|
||||
endif (NOT CURL_FOUND)
|
||||
include_directories(CURL_INCLUDE_DIRS)
|
||||
set(CMAKE_REQUIRED_LIBRARIES "${CURL_LIBRARIES}")
|
||||
list(APPEND LIBS "${CURL_LIBRARIES}")
|
||||
endif()
|
||||
endif()
|
||||
|
||||
################################################################################################
|
||||
|
@ -203,6 +229,7 @@ if (BUILD_PACKAGE)
|
|||
include(tools/MakeRpm.cmake)
|
||||
endif()
|
||||
if (${CMAKE_PACKAGE_TYPE} STREQUAL "tgz")
|
||||
message("Building tgz package")
|
||||
# TODO: [MG] - fix path... should we simply use /usr/local/lib without CPU?
|
||||
# TODO: [MG] - Windows path is not ideal -- C:/Program Files (x86)/MSTelemetry/* - what should we use instead?
|
||||
include(tools/MakeTgz.cmake)
|
||||
|
|
|
@ -0,0 +1,33 @@
|
|||
#!/bin/sh
|
||||
|
||||
if [ "$1" == "release" ] || [ "$2" == "release" ]; then
|
||||
BUILD_TYPE="Release"
|
||||
else
|
||||
BUILD_TYPE="Debug"
|
||||
fi
|
||||
|
||||
# Install build tools and recent sqlite3
|
||||
FILE=.buildtools
|
||||
OS_NAME=`uname -a`
|
||||
if [ ! -f $FILE ]; then
|
||||
tools/setup-buildtools-mac.sh
|
||||
# Assume that the build tools have been successfully installed
|
||||
echo > $FILE
|
||||
fi
|
||||
|
||||
if [ -f /usr/bin/gcc ]; then
|
||||
echo "gcc version: `gcc --version`"
|
||||
fi
|
||||
|
||||
if [ -f /usr/bin/clang ]; then
|
||||
echo "clang version: `clang --version`"
|
||||
fi
|
||||
|
||||
mkdir -p out
|
||||
cd out
|
||||
|
||||
cmake -DBUILD_IOS=YES -DBUILD_SIMULATOR=NO -DBUILD_UNIT_TESTS=NO -DBUILD_FUNC_TESTS=NO -DCMAKE_BUILD_TYPE=$BUILD_TYPE .
|
||||
make
|
||||
|
||||
CMAKE_PACKAGE_TYPE=tgz
|
||||
make package
|
|
@ -61,8 +61,6 @@ endif()
|
|||
|
||||
if(PAL_IMPLEMENTATION STREQUAL "CPP11")
|
||||
list(APPEND SRCS
|
||||
http/HttpClient_Curl.cpp
|
||||
http/HttpClient_Curl.hpp
|
||||
http/HttpClient.hpp
|
||||
pal/WorkerThread.cpp
|
||||
pal/WorkerThread.hpp
|
||||
|
@ -71,6 +69,17 @@ if(PAL_IMPLEMENTATION STREQUAL "CPP11")
|
|||
pal/posix/SystemInformationImpl.cpp
|
||||
pal/posix/sysinfo_sources.cpp
|
||||
)
|
||||
|
||||
if(BUILD_IOS)
|
||||
list(APPEND SRCS
|
||||
http/HttpClient_iOS.mm
|
||||
)
|
||||
else()
|
||||
list(APPEND SRCS
|
||||
http/HttpClient_Curl.cpp
|
||||
http/HttpClient_Curl.hpp
|
||||
)
|
||||
endif()
|
||||
elseif(PAL_IMPLEMENTATION STREQUAL "WIN32")
|
||||
# Win32 Desktop for now.
|
||||
# TODO: define a separate PAL for Win10 cmake build
|
||||
|
|
|
@ -0,0 +1,39 @@
|
|||
// Copyright (c) Microsoft. All rights reserved.
|
||||
#include "mat/config.h"
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import <CFNetwork/CFNetwork.h>
|
||||
|
||||
// Assume that if we are compiling with MSVC, then we prefer to use Windows HTTP stack,
|
||||
// e.g. WinInet.dll or Win 10 HTTP client instead
|
||||
#if defined(MATSDK_PAL_CPP11) && !defined(_MSC_VER) && defined(HAVE_MAT_DEFAULT_HTTP_CLIENT)
|
||||
|
||||
#include "Version.hpp"
|
||||
#include "HttpClient.hpp"
|
||||
|
||||
namespace ARIASDK_NS_BEGIN {
|
||||
|
||||
HttpClient::HttpClient()
|
||||
{
|
||||
}
|
||||
|
||||
HttpClient::~HttpClient()
|
||||
{
|
||||
}
|
||||
|
||||
IHttpRequest* HttpClient::CreateRequest()
|
||||
{
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void HttpClient::SendRequestAsync(IHttpRequest*, IHttpResponseCallback*)
|
||||
{
|
||||
}
|
||||
|
||||
void HttpClient::CancelRequestAsync(std::string const&)
|
||||
{
|
||||
}
|
||||
|
||||
} ARIASDK_NS_END
|
||||
|
||||
#endif
|
|
@ -62,11 +62,15 @@ else()
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/../../googletest/build/googlemock/gtest/libgtest.a
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../googletest/build/googlemock/libgmock.a
|
||||
mat
|
||||
curl
|
||||
${ZLIB_LIBRARIES}
|
||||
${SQLITE3_LIB}
|
||||
${PLATFORM_LIBS}
|
||||
dl)
|
||||
|
||||
if(NOT BUILD_IOS)
|
||||
target_link_libraries(FuncTests curl)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
add_test(FuncTests FuncTests "--gtest_output=xml:${CMAKE_BINARY_DIR}/test-reports/FuncTests.xml")
|
||||
|
|
|
@ -90,12 +90,14 @@ else()
|
|||
${CMAKE_CURRENT_SOURCE_DIR}/../../googletest/build/googlemock/gtest/libgtest.a
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/../../googletest/build/googlemock/libgmock.a
|
||||
mat
|
||||
curl
|
||||
${ZLIB_LIBRARIES}
|
||||
${SQLITE3_LIB}
|
||||
${PLATFORM_LIBS}
|
||||
dl)
|
||||
|
||||
if(NOT BUILD_IOS)
|
||||
target_link_libraries(UnitTests curl)
|
||||
endif()
|
||||
|
||||
endif()
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче