Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions THIRD-PARTY-NOTICES.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
libxml2
Comment thread
plnelson marked this conversation as resolved.
=======

Copyright (C) 1998-2012 Daniel Veillard. All Rights Reserved.
Copyright (C) The Libxml2 Contributors.

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.
53 changes: 51 additions & 2 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License.

# Require at least version 3.14 of CMake
cmake_minimum_required(VERSION 3.14)
# Require at least version 3.18 of CMake
cmake_minimum_required(VERSION 3.18)

IF(NOT EXISTS "${CMAKE_INSTALL_PREFIX}" OR NOT IS_DIRECTORY "${CMAKE_INSTALL_PREFIX}")
message(FATAL_ERROR "Required property CMAKE_INSTALL_PREFIX not correctly defined.")
Expand Down Expand Up @@ -233,6 +233,53 @@ function(generate_exports_file inputFilename versionName outputFilename)
PROPERTIES GENERATED TRUE)
endfunction()

function(fetch_libxml2)
include(FetchContent)

set(BUILD_SHARED_LIBS OFF)
set(LIBXML2_WITH_C14N OFF)
set(LIBXML2_WITH_CATALOG OFF)
set(LIBXML2_WITH_DEBUG OFF)
set(LIBXML2_WITH_DOCS OFF)
set(LIBXML2_WITH_HTML OFF)
set(LIBXML2_WITH_HTTP OFF)
set(LIBXML2_WITH_ICU OFF)
set(LIBXML2_WITH_MODULES OFF)
set(LIBXML2_WITH_OUTPUT OFF)
set(LIBXML2_WITH_PATTERN OFF)
set(LIBXML2_WITH_PROGRAMS OFF)
set(LIBXML2_WITH_PYTHON OFF)
set(LIBXML2_WITH_READER OFF)
set(LIBXML2_WITH_REGEXPS OFF)
set(LIBXML2_WITH_RELAXNG OFF)
set(LIBXML2_WITH_SCHEMAS OFF)
set(LIBXML2_WITH_SCHEMATRON OFF)
set(LIBXML2_WITH_TESTS OFF)
set(LIBXML2_WITH_WRITER OFF)
set(LIBXML2_WITH_XINCLUDE OFF)
set(LIBXML2_WITH_XPATH OFF)
set(LIBXML2_WITH_XPTR OFF)
set(LIBXML2_WITH_ZLIB OFF)

FetchContent_Declare(
libxml2
URL https://download.gnome.org/sources/libxml2/2.15/libxml2-2.15.3.tar.xz
Comment thread
plnelson marked this conversation as resolved.
Outdated
URL_HASH SHA256=78262a6e7ac170d6528ebfe2efccdf220191a5af6a6cd61ea4a9a9a5042c7a07
)
FetchContent_MakeAvailable(libxml2)

set_target_properties(LibXml2 PROPERTIES
C_VISIBILITY_PRESET hidden
VISIBILITY_INLINES_HIDDEN true
)

if(CMAKE_SYSTEM_NAME STREQUAL Linux)
target_link_options(LibXml2 INTERFACE
"LINKER:--exclude-libs,libxml2.a"
Comment thread
plnelson marked this conversation as resolved.
Outdated
)
endif()
endfunction()

macro (fetch_google_test)
include(FetchContent)
FetchContent_Declare(
Expand Down Expand Up @@ -365,6 +412,8 @@ add_library_pal(coreclrpal true ${CORECLR_PAL_ROOT}/lib/${CMAKE_BUILD_TYPE}/libc
add_library_pal(palrt true ${CORECLR_PAL_ROOT}/lib/${CMAKE_BUILD_TYPE}/libpalrt.a)
add_library_pal(corguids false ${CORECLR_PAL_ROOT}/lib/${CMAKE_BUILD_TYPE}/libcorguids.a)

fetch_libxml2()

add_subdirectory(unix/src)
add_subdirectory(unix/src/atl)
add_subdirectory(Common.Lib)
Expand Down
8 changes: 6 additions & 2 deletions src/Common.Lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

cmake_minimum_required(VERSION 3.14)
project(Common.Lib)
find_package(LibXml2 REQUIRED)

include_directories(. ${LIBXML2_INCLUDE_DIR})
include_directories(.)
build_init(CPP Common.Lib)

#note: we purposfully exclude windows-only files,
Expand All @@ -28,4 +27,9 @@ add_lib(${PROJECT_NAME}
${src_files}
)

target_link_libraries(${PROJECT_NAME}
PUBLIC
LibXml2::LibXml2
)

#target_compile_options(Common.Lib PUBLIC "-H")
10 changes: 7 additions & 3 deletions src/InstrumentationEngine.Lib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,8 @@

cmake_minimum_required(VERSION 3.14)
project(InstrumentationEngine.Lib)
find_package(LibXml2 REQUIRED)

include_directories(. ${LIBXML2_INCLUDE_DIR})
include_directories(.)

build_init(CPP InstrumentationEngine.Lib)

Expand All @@ -30,4 +29,9 @@ add_lib(${PROJECT_NAME}
true # use_redefines
false # hide_symbols
${src_files}
)
)

target_link_libraries(${PROJECT_NAME}
PRIVATE
LibXml2::LibXml2
)
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@

<!-- Licensing -->
<file src="$enlistmentroot$\$licenseFile$*" target="" />
<file src="$enlistmentroot$\THIRD-PARTY-NOTICES.txt" target="" />

<!-- Icon -->
<file src="$enlistmentroot$\src\SharedNuGetAssets\icon.png" target="" />
Expand Down
5 changes: 1 addition & 4 deletions src/InstrumentationEngine/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
cmake_minimum_required(VERSION 2.8.12)
project(InstrumentationEngine)

find_package(LibXml2 REQUIRED)

include_directories(. ../InstrumentationEngine.Lib ${LIBXML2_INCLUDE_DIR})
include_directories(. ../InstrumentationEngine.Lib)

build_init(CPP InstrumentationEngine)

Expand Down Expand Up @@ -90,7 +88,6 @@ endif()
target_link_libraries(${PROJECT_NAME}
pthread
stdc++
${LIBXML2_LIBRARIES}
${CORECLRPAL}
${LINUXPAL}
${ATL}
Expand Down
4 changes: 1 addition & 3 deletions src/Tests/CommonLibTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,9 @@ cmake_minimum_required(VERSION 3.14)
fetch_google_test()

project(Common.LibTests)
find_package(LibXml2 REQUIRED)

# the midl directory is needed to replace the rpc headers referenced by midl generated headers.
include_directories(. ${REPOSITORY_ROOT}/src/unix/inc/midl ${REPOSITORY_ROOT}/src ${LIBXML2_INCLUDE_DIR})
include_directories(. ${REPOSITORY_ROOT}/src/unix/inc/midl ${REPOSITORY_ROOT}/src)

build_init(CPP Common.LibTests)

Expand All @@ -29,7 +28,6 @@ add_executable(

target_link_libraries(
${PROJECT_NAME}
${LIBXML2_LIBRARIES}
Common.Lib
gtest_main
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
cmake_minimum_required(VERSION 3.14)

project(NaglerInstrumentationEngine)
find_package(LibXml2 REQUIRED)

include_directories(. ${REPOSITORY_ROOT}/src ${LIBXML2_INCLUDE_DIR})
include_directories(. ${REPOSITORY_ROOT}/src)

# don't use the PAL for tests
build_init(CPP InstrumentationEngine)
Expand Down Expand Up @@ -47,7 +46,6 @@ target_link_libraries(
${PROJECT_NAME}
pthread
stdc++
${LIBXML2_LIBRARIES}
Common.Lib
)

Expand Down
4 changes: 1 addition & 3 deletions src/Tests/InstrumentationEngineLibTests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@ cmake_minimum_required(VERSION 3.14)
fetch_google_test()

project(InstrumentationEngine.LibTests)
find_package(LibXml2 REQUIRED)

include_directories(. ${REPOSITORY_ROOT}/src ${LIBXML2_INCLUDE_DIR})
include_directories(. ${REPOSITORY_ROOT}/src)

# don't use the PAL for tests
build_init(CPP InstrumentationEngine.LibTests)
Expand Down Expand Up @@ -58,7 +57,6 @@ target_link_libraries(
${PROJECT_NAME}
pthread
stdc++
${LIBXML2_LIBRARIES}
${CORECLRPAL}
${LINUXPAL}
${ATL}
Expand Down
12 changes: 5 additions & 7 deletions src/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,13 @@ get_cmake()
echo "found cmake version $cmakeVersion"
cmakeMajor=$(echo $cmakeVersion | sed 's/^.*[^0-9]\([0-9]*\)\..*$/\1'/)
cmakeMinor=$(echo $cmakeVersion | sed 's/^.*[^0-9]*\.\([0-9]*\)\..*$/\1'/)
if (( $cmakeMajor > 3 )); then
if (( $cmakeMinor >= 14 )); then
# found sufficient cmake, continue.
echo $cmakeLocation
return
fi
if (( $cmakeMajor > 3 || ($cmakeMajor == 3 && $cmakeMinor >= 18) )); then
# found sufficient cmake, continue.
echo $cmakeLocation
return
fi

echo "Insufficient cmake version. Ensure cmake version 3.14 or later is installed"
echo "Insufficient cmake version. Ensure cmake version 3.18 or later is installed"
exit 1
}

Expand Down
17 changes: 17 additions & 0 deletions src/unix/docker/context/components/libxml2/cgmanifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"$schema": "https://json.schemastore.org/component-detection-manifest.json",
"Registrations": [
{
"Component": {
"Type": "other",
"other": {
"Name": "libxml2",
"Version": "2.15.3",
"DownloadUrl": "https://download.gnome.org/sources/libxml2/2.15/libxml2-2.15.3.tar.xz",
"SHA256CHECK": "78262a6e7ac170d6528ebfe2efccdf220191a5af6a6cd61ea4a9a9a5042c7a07"
}
},
"DevelopmentDependency": false
}
]
}
Loading