Various minor fixes to LHC Linux CMake (#781)

* Various minor fixes to LHC Linux CMake

* PR feedback

* PR feedback

* Fixing Android cmake paths'
This commit is contained in:
Jason Sandlin 2023-10-10 13:39:44 -07:00 коммит произвёл GitHub
Родитель 8472e3210e
Коммит 18d2a68c62
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
26 изменённых файлов: 71 добавлений и 261 удалений

58
.gitattributes поставляемый
Просмотреть файл

@ -4,60 +4,6 @@
* text=auto
###############################################################################
# Set default behavior for command prompt diff.
#
# This is need for earlier builds of msysgit that does not have it on by
# default for csharp files.
# Note: This is only used by command line
# Don't add crlf to Linux bash files or they get Bash: /bin/bash^M: bad interpreter errors
###############################################################################
#*.cs diff=csharp
###############################################################################
# Set the merge driver for project and solution files
#
# Merging from the command prompt will add diff markers to the files if there
# are conflicts (Merging from VS is not affected by the settings below, in VS
# the diff markers are never inserted). Diff markers may cause the following
# file extensions to fail to load in VS. An alternative would be to treat
# these files as binary and thus will always conflict and require user
# intervention with every merge. To do so, just uncomment the entries below
###############################################################################
#*.sln merge=binary
#*.csproj merge=binary
#*.vbproj merge=binary
#*.vcxproj merge=binary
#*.vcproj merge=binary
#*.dbproj merge=binary
#*.fsproj merge=binary
#*.lsproj merge=binary
#*.wixproj merge=binary
#*.modelproj merge=binary
#*.sqlproj merge=binary
#*.wwaproj merge=binary
###############################################################################
# behavior for image files
#
# image files are treated as binary by default.
###############################################################################
#*.jpg binary
#*.png binary
#*.gif binary
###############################################################################
# diff behavior for common document formats
#
# Convert binary document formats to text before diffing them. This feature
# is only available from the command line. Turn it on by uncommenting the
# entries below.
###############################################################################
#*.doc diff=astextplain
#*.DOC diff=astextplain
#*.docx diff=astextplain
#*.DOCX diff=astextplain
#*.dot diff=astextplain
#*.DOT diff=astextplain
#*.pdf diff=astextplain
#*.PDF diff=astextplain
#*.rtf diff=astextplain
#*.RTF diff=astextplain
*.bash text eol=lf

1
.gitignore поставляемый
Просмотреть файл

@ -78,6 +78,7 @@ Output-Build.txt
**/Durango/
**/XboxOne.x64/
**/Int/
Samples/**/bin/
Samples/**/Debug/
Samples/**/Release/

Просмотреть файл

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.6)
get_filename_component(PATH_TO_ROOT "../../../.." ABSOLUTE)
get_filename_component(PATH_TO_ROOT "../.." ABSOLUTE)
project("libHttpClient.Android")
@ -10,7 +10,7 @@ set(CMAKE_STATIC_LIBRARY_PREFIX "")
### Set up paths for source and include ###
###########################################
include("../../GetCommonHCSourceFiles.cmake")
include("../libHttpClient.CMake/GetCommonHCSourceFiles.cmake")
get_common_hc_source_files(
PUBLIC_SOURCE_FILES
HC_COMMON_SOURCE_FILES
@ -88,10 +88,10 @@ target_include_directories(
"${ANDROID_INCLUDE_DIRS}"
)
include("GetLibHCFlags.cmake")
include("../libHttpClient.CMake/GetLibHCFlags.cmake")
get_libhc_flags(FLAGS FLAGS_DEBUG FLAGS_RELEASE)
include("../TargetSetFlags.cmake")
include("../libHttpClient.CMake/TargetSetFlags.cmake")
target_set_flags(
"${PROJECT_NAME}"
"${FLAGS}"

Просмотреть файл

@ -1,7 +1,6 @@
# libHttpClient Android CMake build system
This directory contains `CMakeLists.txt` files for building `libHttpClient`,
`libssl`, and `libcrypto` for Android via Gradle's
This directory contains `CMakeLists.txt` files for building `libHttpClient` for Android via Gradle's
[external native build](https://developer.android.com/studio/projects/gradle-external-native-builds)
integration with CMake.

Просмотреть файл

@ -23,7 +23,7 @@ android {
externalNativeBuild {
cmake {
path "../../Utilities/CMake/Android/libHttpClient/CMakeLists.txt"
path "CMakeLists.txt"
buildStagingDirectory "${project.buildDir.getParentFile().getAbsolutePath()}/.cxx/${project.name}"
}
}

Просмотреть файл

@ -1,11 +1,14 @@
cmake_minimum_required(VERSION 3.6)
get_filename_component(PATH_TO_ROOT "../../../.." ABSOLUTE)
get_filename_component(PATH_TO_ROOT "../.." ABSOLUTE)
project("libHttpClient.Linux.C")
set(CMAKE_C_COMPILER clang)
set(CMAKE_CXX_COMPILER clang++)
set(CMAKE_CXX_FLAGS "-fvisibility=hidden")
set(CMAKE_C_FLAGS "-fvisibility=hidden")
set(CMAKE_STATIC_LIBRARY_PREFIX "")
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
###########################################
@ -19,9 +22,9 @@ set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY_RELEASE ${PATH_TO_ROOT}/Binaries/Release/x64/
# BINARY_DIR is a temp folder used by cmake itself.
# Binary folder can be remove freely.
# See more details: https://cmake.org/cmake/help/v3.4/command/add_subdirectory.html
set(BINARY_DIR ${PATH_TO_ROOT}/Build/libHttpClient.Linux.C/build)
set(BINARY_DIR ${PATH_TO_ROOT}/Int/CMake/libHttpClient.Linux.C)
include("../../GetCommonHCSourceFiles.cmake")
include("../libHttpClient.CMake/GetCommonHCSourceFiles.cmake")
get_common_hc_source_files(
PUBLIC_SOURCE_FILES
HC_COMMON_SOURCE_FILES
@ -98,10 +101,10 @@ target_include_directories(
"${LINUX_INCLUDE_DIRS}"
)
include("GetLibHCFlags.cmake")
include("../libHttpClient.CMake/GetLibHCFlags.cmake")
get_libhc_flags(FLAGS FLAGS_DEBUG FLAGS_RELEASE)
include("../TargetSetFlags.cmake")
include("../libHttpClient.CMake/TargetSetFlags.cmake")
target_set_flags(
"${PROJECT_NAME}"
"${FLAGS}"

Просмотреть файл

@ -21,13 +21,6 @@ while [[ $# -gt 0 ]]; do
esac
done
sudo hwclock --hctosys
sudo apt-get install clang
sudo apt-get install make
sudo apt-get install autoconf
sudo apt-get install automake
sudo apt-get install libtool
pushd "$SCRIPT_DIR"/../../External/curl
autoreconf -fi "$SCRIPT_DIR"/../../External/curl

Просмотреть файл

@ -27,6 +27,10 @@ while [[ $# -gt 0 ]]; do
BUILD_SSL=false
shift
;;
-sg|--skipaptget)
DO_APTGET=false
shift
;;
-*|--*)
echo "Unknown option $1"
exit 1
@ -40,22 +44,35 @@ done
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
if [ "$DO_APTGET" != "false" ]; then
sudo hwclock --hctosys
sudo apt-get update
sudo apt-get install clang
sudo apt-get install make
sudo apt-get install autoconf
sudo apt-get install automake
sudo apt-get install libtool
fi
log "CONFIGURATION = ${CONFIGURATION}"
log "BUILD CURL = ${SEARCHPATH}"
log "BUILD SSL = ${BUILD_SSL}"
log "BUILD CURL = ${BUILD_CURL}"
log "CMakeLists.txt = ${SCRIPT_DIR}"
log "CMake output = ${SCRIPT_DIR}/../../Int/CMake/libHttpClient.Linux.C"
# make libcrypto and libssl
if [ "$BUILD_SSL" = true ]; then
log "Building SSL"
sed -i -e 's/\r$//' "$SCRIPT_DIR"/openssl.bash
bash "$SCRIPT_DIR"/openssl.bash -c "$CONFIGURATION"
sed -i -e 's/\r$//' "$SCRIPT_DIR"/openssl_Linux.bash
bash "$SCRIPT_DIR"/openssl_Linux.bash -c "$CONFIGURATION"
fi
if [ "$BUILD_CURL" = true ]; then
log "Building cURL"
sed -i -e 's/\r$//' "$SCRIPT_DIR"/curl.bash
bash "$SCRIPT_DIR"/curl.bash -c "$CONFIGURATION"
sed -i -e 's/\r$//' "$SCRIPT_DIR"/curl_Linux.bash
bash "$SCRIPT_DIR"/curl_Linux.bash -c "$CONFIGURATION"
fi
# make libHttpClient
sudo cmake -S "$SCRIPT_DIR"/../CMake/Linux/libHttpClient -B "$SCRIPT_DIR"/../../Build/libHttpClient.Linux.C/build -D CMAKE_BUILD_TYPE=$CONFIGURATION -D CMAKE_C_COMPILER=clang -D CMAKE_CXX_COMPILER=clang++ -DCMAKE_CXX_FLAGS="-fvisibility=hidden" -DCMAKE_C_FLAGS="-fvisibility=hidden"
sudo make -C "$SCRIPT_DIR"/../../Build/libHttpClient.Linux.C/build
sudo cmake -S "$SCRIPT_DIR" -B "$SCRIPT_DIR"/../../Int/CMake/libHttpClient.Linux.C -D CMAKE_BUILD_TYPE=$CONFIGURATION
sudo make -C "$SCRIPT_DIR"/../../Int/CMake/libHttpClient.Linux.C

Просмотреть файл

@ -22,15 +22,7 @@ while [[ $# -gt 0 ]]; do
esac
done
sudo hwclock --hctosys
sudo apt-get install clang
sudo apt-get install make
sudo apt-get install autoconf
sudo apt-get install automake
sudo apt-get install libtool
pushd $OPENSSL_SRC
make clean
sed -i -e 's/\r$//' Configure
if [ "$CONFIGURATION" = "Debug" ]; then

Просмотреть файл

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.6)
get_filename_component(PATH_TO_ROOT "../../../../.." ABSOLUTE)
get_filename_component(PATH_TO_ROOT "../.." ABSOLUTE)
project("libcrypto.Android")
@ -683,10 +683,10 @@ target_include_directories(
"${CRYPTO_INCLUDE_DIRS}"
)
include("../GetOpenSSLFlags.cmake")
include("../libHttpClient.CMake/GetOpenSSLFlags.cmake")
get_openssl_flags(FLAGS FLAGS_DEBUG FLAGS_RELEASE)
include("../../TargetSetFlags.cmake")
include("../libHttpClient.CMake/TargetSetFlags.cmake")
target_set_flags(
"${PROJECT_NAME}"
"${FLAGS}"

Просмотреть файл

@ -0,0 +1,9 @@
# libHttpClient Android CMake build system
This directory contains `CMakeLists.txt` files for building `libcrypto` for Android via Gradle's
[external native build](https://developer.android.com/studio/projects/gradle-external-native-builds)
integration with CMake.
The Gradle projects that reference these CMake builds are located in
`/Build/<project-name>.Android`. See `/Build/libHttpClient.Android.Workspace`
for more details.

Просмотреть файл

@ -19,7 +19,7 @@ android {
externalNativeBuild {
cmake {
path "../../Utilities/Cmake/Android/openssl/libcrypto/CMakeLists.txt"
path "CMakeLists.txt"
buildStagingDirectory "${project.buildDir.getParentFile().getAbsolutePath()}/.cxx/${project.name}"
}
}

Просмотреть файл

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.6)
get_filename_component(PATH_TO_ROOT "../../../../.." ABSOLUTE)
get_filename_component(PATH_TO_ROOT "../.." ABSOLUTE)
project("libssl.Android")
@ -86,10 +86,10 @@ target_include_directories(
"${SSL_INCLUDE_DIRS}"
)
include("../GetOpenSSLFlags.cmake")
include("../libHttpClient.CMake/GetOpenSSLFlags.cmake")
get_openssl_flags(FLAGS FLAGS_DEBUG FLAGS_RELEASE)
include("../../TargetSetFlags.cmake")
include("../libHttpClient.CMake/TargetSetFlags.cmake")
target_set_flags(
"${PROJECT_NAME}"
"${FLAGS}"

Просмотреть файл

@ -0,0 +1,9 @@
# libHttpClient Android CMake build system
This directory contains `CMakeLists.txt` files for building `libssl` for Android via Gradle's
[external native build](https://developer.android.com/studio/projects/gradle-external-native-builds)
integration with CMake.
The Gradle projects that reference these CMake builds are located in
`/Build/<project-name>.Android`. See `/Build/libHttpClient.Android.Workspace`
for more details.

Просмотреть файл

@ -19,7 +19,7 @@ android {
externalNativeBuild {
cmake {
path "../../Utilities/Cmake/Android/openssl/libssl/CMakeLists.txt"
path "CMakeLists.txt"
buildStagingDirectory "${project.buildDir.getParentFile().getAbsolutePath()}/.cxx/${project.name}"
}
}

5
Utilities/CMake/.gitignore поставляемый
Просмотреть файл

@ -1,5 +0,0 @@
build
output
vcxprojs
ProjectFileProcessor/bin/Debug/ProjectFileProcessor.exe.config
!ProjectFileProcessor/bin/Debug

Просмотреть файл

@ -1,37 +0,0 @@
cmake_minimum_required(VERSION 3.6)
# This function will set common, debug, and release config compiler flags
# into the three OUT_XXX variables, respectively. These are intended to then
# be passed to `target_set_flags`, from `TargetSetFlags.cmake`.
function(GET_LIBHC_FLAGS OUT_FLAGS OUT_FLAGS_DEBUG OUT_FLAGS_RELEASE)
set(FLAGS
"-Wall"
"-fexceptions"
"-frtti"
"-std=c++17"
"-Wno-unknown-pragmas"
"-Wno-pragma-once-outside-header"
"-DHC_PLATFORM_MSBUILD_GUESS=HC_PLATFORM_ANDROID"
PARENT_SCOPE
)
if (DEFINED HC_NOWEBSOCKETS)
list(APPEND FLAGS "-DHC_NOWEBSOCKETS=1")
endif()
set("${OUT_FLAGS}" "${FLAGS}" PARENT_SCOPE)
set("${OUT_FLAGS_DEBUG}"
"-O0"
"-std=c++17"
"-DHC_TRACE_BUILD_LEVEL=HC_PRIVATE_TRACE_LEVEL_VERBOSE"
PARENT_SCOPE
)
set("${OUT_FLAGS_RELEASE}"
"-Os"
"-std=c++17"
"-DHC_TRACE_BUILD_LEVEL=HC_PRIVATE_TRACE_LEVEL_IMPORTANT"
PARENT_SCOPE
)
endfunction()

Просмотреть файл

@ -1,99 +0,0 @@
cmake_minimum_required (VERSION 3.6)
project (${PROJECT_NAME})
if(MSVC_VERSION GREATER 1919)
set(COMPILER_VERSION "16")
elseif(MSVC_VERSION GREATER 1909)
set(COMPILER_VERSION "15")
elseif(MSVC_VERSION GREATER 1899)
set(COMPILER_VERSION "14")
elseif(MSVC_VERSION GREATER 1700)
set(COMPILER_VERSION "12")
elseif(MSVC_VERSION GREATER 1600)
set(COMPILER_VERSION "11")
endif()
if(CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES Debug)
set(CMAKE_CONFIGURATION_TYPES "${CMAKE_CONFIGURATION_TYPES}" CACHE STRING "Reset the configurations to what we need" FORCE)
endif()
set(CMAKE_USE_RELATIVE_PATHS TRUE)
if("${CMAKE_SYSTEM_NAME}" STREQUAL "WindowsStore")
set(PLATFORM STORE)
endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
add_compile_options(/Zm300 /bigobj)
if (WINDOWS_STORE OR WINDOWS_PHONE)
add_compile_options(/ZW)
endif()
add_definitions(-D_NO_ASYNCRTIMP -D_NO_PPLXIMP -D_NO_XSAPIIMP -DXSAPI_BUILD)
set_source_files_properties(../../../Source/Common/pch.cpp PROPERTIES COMPILE_OPTIONS "/Ycpch.h")
if (NOT ${CMAKE_GENERATOR} MATCHES "Visual Studio .*")
set_property(SOURCE ../../../Source/Common/pch.cpp APPEND PROPERTY OBJECT_OUTPUTS "${CMAKE_CURRENT_BINARY_DIR}/pch.pch")
set_property(SOURCE ${SOURCES} APPEND PROPERTY OBJECT_DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/pch.pch")
endif()
include_directories(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/../../../Source
${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Common
${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/HTTP
${CMAKE_CURRENT_SOURCE_DIR}/../../../Source/Logger
${CMAKE_CURRENT_SOURCE_DIR}/../../../Include
${CMAKE_CURRENT_SOURCE_DIR}/../../../Include/httpClient
)
set(CMAKE_SUPPRESS_REGENERATION true)
include(GetCommonHCSourceFiles.cmake)
get_common_hc_source_files(
Public_Source_Files
Common_Source_Files
Global_Source_Files
Platform_Source_Files
WebSocket_Source_Files
Task_Source_Files
Mock_Source_Files
HTTP_Source_Files
Logger_Source_Files
"../../.."
)
message(STATUS "Common source group")
source_group("Header Files" FILES ${Public_Source_Files})
source_group("C++ Source\\Common" FILES ${Common_Source_Files})
source_group("C++ Source\\Global" FILES ${Global_Source_Files})
source_group("C++ Source\\Platform" FILES ${Platform_Source_Files})
source_group("C++ Source\\WebSocket" FILES ${WebSocket_Source_Files})
source_group("C++ Source\\Mock" FILES ${Mock_Source_Files})
source_group("C++ Source\\HTTP" FILES ${HTTP_Source_Files})
source_group("C++ Source\\Logger" FILES ${Logger_Source_Files})
set( SOURCE_FILES
${Public_Source_Files}
${Common_Source_Files}
${Global_Source_Files}
${Platform_Source_Files}
${WebSocket_Source_Files}
${Mock_Source_Files}
${HTTP_Source_Files}
${Logger_Source_Files}
)
list( SORT SOURCE_FILES )
add_library(${PROJECT_NAME} ${SOURCE_FILES})
set_property(TARGET ${PROJECT_NAME} APPEND_STRING PROPERTY LINK_FLAGS "/INCREMENTAL:NO")
set(CMAKE_STATIC_LINKER_FLAGS "/INCREMENTAL:NO")
message(STATUS "CMAKE_SYSTEM_VERSION='${CMAKE_SYSTEM_VERSION}'")
message(STATUS "CMAKE_SYSTEM_NAME='${CMAKE_SYSTEM_NAME}'")
message(STATUS "SHORT_VERSION='${SHORT_VERSION}'")

Просмотреть файл

@ -1,3 +0,0 @@
# libHttpClient Linux CMake build system
This directory contains `CMakeLists.txt` files for building `libHttpClient`.

Просмотреть файл

@ -1,15 +0,0 @@
function(TARGET_SET_FLAGS TARGET_NAME FLAGS FLAGS_DEBUG FLAGS_RELEASE)
foreach(flag "${FLAGS}")
target_compile_options("${TARGET_NAME}" PRIVATE "${flag}")
endforeach()
if (CMAKE_BUILD_TYPE STREQUAL "Debug")
foreach(flag "${FLAGS_DEBUG}")
target_compile_options("${TARGET_NAME}" PRIVATE "${flag}")
endforeach()
elseif (CMAKE_BUILD_TYPE STREQUAL "Release")
foreach(flag "${FLAGS_RELEASE}")
target_compile_options("${TARGET_NAME}" PRIVATE "${flag}")
endforeach()
endif()
endfunction()

Просмотреть файл

@ -8,17 +8,17 @@ steps:
- task: Bash@3
displayName: 'Build and install OpenSSL'
inputs:
filePath: './Utilities/LinuxBuildScripts/openssl.bash'
filePath: './Build/libHttpClient.Linux/openssl_Linux.bash'
arguments: '-c ${{ parameters.configuration }}'
- task: Bash@3
displayName: 'Build libcurl'
inputs:
filePath: './Utilities/LinuxBuildScripts/curl.bash'
filePath: './Build/libHttpClient.Linux/curl_Linux.bash'
arguments: '-c ${{ parameters.configuration }}'
- task: Bash@3
displayName: 'Build libHttpClient'
inputs:
filePath: './Utilities/LinuxBuildScripts/libHttpClient_Linux.bash'
filePath: './Build/libHttpClient.Linux/libHttpClient_Linux.bash'
arguments: '-c ${{ parameters.configuration }} -nc -ns'