Skip to content

Commit

Permalink
Fix some issues building with Conan Qt.
Browse files Browse the repository at this point in the history
This still fails as upstream Qt includes an old bug in qtlocation/src/3rdparty/mapbox-gl-native/include/mbgl/util/geometry.hpp; We should switch to KDE's Qt patchset as it has issues like this patched and we already use it on VCPKG. (https://invent.kde.org/qt/qt/qt5/-/tree/kde/5.15)
  • Loading branch information
JulianGro committed Jan 23, 2025
1 parent 918afa3 commit a08d793
Show file tree
Hide file tree
Showing 54 changed files with 3,434 additions and 2 deletions.
16 changes: 16 additions & 0 deletions conan-recipes/nss/all/conandata.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
sources:
"3.107":
url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_107_RTM/src/nss-3.107.tar.gz"
sha256: "7f7e96473e38150771a615f5d40e8c41ba3a19385301ae0c525091f2fc9d6729"
"3.93":
url: "https://ftp.mozilla.org/pub/security/nss/releases/NSS_3_93_RTM/src/nss-3.93.tar.gz"
sha256: "15f54bb72048eb105f8c0e936a04b899e74c3db9a19bbc1e00acee2af9476a8a"
patches:
"3.107":
- patch_file: "patches/3.107-avoid-vswhere.patch"
patch_description: "Use VCVars env vars instead of vswhere"
patch_type: "conan"
"3.93":
- patch_file: "patches/3.107-avoid-vswhere.patch"
patch_description: "Use VCVars env vars instead of vswhere"
patch_type: "conan"
356 changes: 356 additions & 0 deletions conan-recipes/nss/all/conanfile.py

Large diffs are not rendered by default.

33 changes: 33 additions & 0 deletions conan-recipes/nss/all/patches/3.107-avoid-vswhere.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
--- a/nss/coreconf/msvc.sh
+++ b/nss/coreconf/msvc.sh
@@ -1,11 +1,6 @@
#!/bin/bash
# This configures the environment for running MSVC. It uses vswhere, the
# registry, and a little knowledge of how MSVC is laid out.
-
-if ! hash vswhere 2>/dev/null; then
- echo "Can't find vswhere on the path, aborting" 1>&2
- exit 1
-fi

if ! hash reg 2>/dev/null; then
echo "Can't find reg on the path, aborting" 1>&2
@@ -44,8 +39,7 @@
return 1
}

-VSCOMPONENT=Microsoft.VisualStudio.Component.VC.Tools.x86.x64
-vsinstall=$(vswhere -latest -requires "$VSCOMPONENT" -property installationPath)
+vsinstall=$VSINSTALLDIR

# Attempt to setup paths if vswhere returns something and VSPATH isn't set.
# Otherwise, assume that the env is setup.
@@ -99,7 +93,7 @@
export LIB

export GYP_MSVS_OVERRIDE_PATH="${VSPATH}"
- export GYP_MSVS_VERSION=$(vswhere -latest -requires "$VSCOMPONENT" -property catalog_productLineVersion)
+ # export GYP_MSVS_VERSION=$(vswhere -latest -requires "$VSCOMPONENT" -property catalog_productLineVersion)
else
echo Assuming env setup is already done.
echo VSPATH=$VSPATH
7 changes: 7 additions & 0 deletions conan-recipes/nss/all/test_package/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.15)
project(test_package C)

find_package(nss REQUIRED CONFIG)

add_executable(${PROJECT_NAME} test_package.c)
target_link_libraries(${PROJECT_NAME} PRIVATE nss::nss)
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"version": 3,
"vendor": {
"conan": {}
},
"cmakeMinimumRequired": {
"major": 3,
"minor": 15,
"patch": 0
},
"configurePresets": [
{
"name": "conan-gcc-14-x86_64-17-release",
"displayName": "'conan-gcc-14-x86_64-17-release' config",
"description": "'conan-gcc-14-x86_64-17-release' configure using 'Unix Makefiles' generator",
"generator": "Unix Makefiles",
"cacheVariables": {
"CMAKE_POLICY_DEFAULT_CMP0091": "NEW",
"CMAKE_BUILD_TYPE": "Release"
},
"toolchainFile": "generators/conan_toolchain.cmake",
"binaryDir": "/home/juliangro/git/overte/conan-recipes/nss/all/test_package/build/gcc-14-x86_64-17-release"
}
],
"buildPresets": [
{
"name": "conan-gcc-14-x86_64-17-release",
"configurePreset": "conan-gcc-14-x86_64-17-release",
"jobs": 28
}
],
"testPresets": [
{
"name": "conan-gcc-14-x86_64-17-release",
"configurePreset": "conan-gcc-14-x86_64-17-release",
"environment": {
"PATH": "/home/juliangro/.conan2/p/b/nssb1d8c7def7e78/p/bin:$penv{PATH}",
"LD_LIBRARY_PATH": "/home/juliangro/.conan2/p/b/nssb1d8c7def7e78/p/lib:/home/juliangro/.conan2/p/b/nsprc5d1b95cc6e17/p/lib:$penv{LD_LIBRARY_PATH}",
"DYLD_LIBRARY_PATH": "/home/juliangro/.conan2/p/b/nssb1d8c7def7e78/p/lib:/home/juliangro/.conan2/p/b/nsprc5d1b95cc6e17/p/lib:$penv{DYLD_LIBRARY_PATH}"
}
}
]
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@

macro(conan_find_apple_frameworks FRAMEWORKS_FOUND FRAMEWORKS FRAMEWORKS_DIRS)
if(APPLE)
foreach(_FRAMEWORK ${FRAMEWORKS})
# https://cmake.org/pipermail/cmake-developers/2017-August/030199.html
find_library(CONAN_FRAMEWORK_${_FRAMEWORK}_FOUND NAMES ${_FRAMEWORK} PATHS ${FRAMEWORKS_DIRS} CMAKE_FIND_ROOT_PATH_BOTH)
if(CONAN_FRAMEWORK_${_FRAMEWORK}_FOUND)
list(APPEND ${FRAMEWORKS_FOUND} ${CONAN_FRAMEWORK_${_FRAMEWORK}_FOUND})
message(VERBOSE "Framework found! ${FRAMEWORKS_FOUND}")
else()
message(FATAL_ERROR "Framework library ${_FRAMEWORK} not found in paths: ${FRAMEWORKS_DIRS}")
endif()
endforeach()
endif()
endmacro()


function(conan_package_library_targets libraries package_libdir package_bindir library_type
is_host_windows deps_target out_libraries_target config_suffix package_name no_soname_mode)
set(_out_libraries_target "")

foreach(_LIBRARY_NAME ${libraries})
find_library(CONAN_FOUND_LIBRARY NAMES ${_LIBRARY_NAME} PATHS ${package_libdir}
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
if(CONAN_FOUND_LIBRARY)
message(VERBOSE "Conan: Library ${_LIBRARY_NAME} found ${CONAN_FOUND_LIBRARY}")

# Create a micro-target for each lib/a found
# Allow only some characters for the target name
string(REGEX REPLACE "[^A-Za-z0-9.+_-]" "_" _LIBRARY_NAME ${_LIBRARY_NAME})
set(_LIB_NAME CONAN_LIB::${package_name}_${_LIBRARY_NAME}${config_suffix})

if(is_host_windows AND library_type STREQUAL "SHARED")
# Store and reset the variable, so it doesn't leak
set(_OLD_CMAKE_FIND_LIBRARY_SUFFIXES ${CMAKE_FIND_LIBRARY_SUFFIXES})
set(CMAKE_FIND_LIBRARY_SUFFIXES .dll ${CMAKE_FIND_LIBRARY_SUFFIXES})
find_library(CONAN_SHARED_FOUND_LIBRARY NAMES ${_LIBRARY_NAME} PATHS ${package_bindir}
NO_DEFAULT_PATH NO_CMAKE_FIND_ROOT_PATH)
set(CMAKE_FIND_LIBRARY_SUFFIXES ${_OLD_CMAKE_FIND_LIBRARY_SUFFIXES})
if(NOT CONAN_SHARED_FOUND_LIBRARY)
message(STATUS "Cannot locate shared library: ${_LIBRARY_NAME}")
message(DEBUG "DLL library not found, creating UNKNOWN IMPORTED target")
if(NOT TARGET ${_LIB_NAME})
add_library(${_LIB_NAME} UNKNOWN IMPORTED)
endif()
set_target_properties(${_LIB_NAME} PROPERTIES IMPORTED_LOCATION${config_suffix} ${CONAN_FOUND_LIBRARY})
else()
if(NOT TARGET ${_LIB_NAME})
add_library(${_LIB_NAME} SHARED IMPORTED)
endif()
set_target_properties(${_LIB_NAME} PROPERTIES IMPORTED_LOCATION${config_suffix} ${CONAN_SHARED_FOUND_LIBRARY})
set_target_properties(${_LIB_NAME} PROPERTIES IMPORTED_IMPLIB${config_suffix} ${CONAN_FOUND_LIBRARY})
message(DEBUG "Found DLL and STATIC at ${CONAN_SHARED_FOUND_LIBRARY}, ${CONAN_FOUND_LIBRARY}")
endif()
unset(CONAN_SHARED_FOUND_LIBRARY CACHE)
else()
if(NOT TARGET ${_LIB_NAME})
# library_type can be STATIC, still UNKNOWN (if no package type available in the recipe) or SHARED (but no windows)
add_library(${_LIB_NAME} ${library_type} IMPORTED)
endif()
message(DEBUG "Created target ${_LIB_NAME} ${library_type} IMPORTED")
set_target_properties(${_LIB_NAME} PROPERTIES IMPORTED_LOCATION${config_suffix} ${CONAN_FOUND_LIBRARY} IMPORTED_NO_SONAME ${no_soname_mode})
endif()
list(APPEND _out_libraries_target ${_LIB_NAME})
message(VERBOSE "Conan: Found: ${CONAN_FOUND_LIBRARY}")
else()
message(FATAL_ERROR "Library '${_LIBRARY_NAME}' not found in package. If '${_LIBRARY_NAME}' is a system library, declare it with 'cpp_info.system_libs' property")
endif()
unset(CONAN_FOUND_LIBRARY CACHE)
endforeach()

# Add the dependencies target for all the imported libraries
foreach(_T ${_out_libraries_target})
set_property(TARGET ${_T} APPEND PROPERTY INTERFACE_LINK_LIBRARIES ${deps_target})
endforeach()

set(${out_libraries_target} ${_out_libraries_target} PARENT_SCOPE)
endfunction()

macro(check_build_type_defined)
# Check that the -DCMAKE_BUILD_TYPE argument is always present
get_property(isMultiConfig GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG)
if(NOT isMultiConfig AND NOT CMAKE_BUILD_TYPE)
message(FATAL_ERROR "Please, set the CMAKE_BUILD_TYPE variable when calling to CMake "
"adding the '-DCMAKE_BUILD_TYPE=<build_type>' argument.")
endif()
endmacro()
Original file line number Diff line number Diff line change
@@ -0,0 +1,186 @@
# Conan automatically generated toolchain file
# DO NOT EDIT MANUALLY, it will be overwritten

# Avoid including toolchain file several times (bad if appending to variables like
# CMAKE_CXX_FLAGS. See https://github.com/android/ndk/issues/323
include_guard()
message(STATUS "Using Conan toolchain: ${CMAKE_CURRENT_LIST_FILE}")
if(${CMAKE_VERSION} VERSION_LESS "3.15")
message(FATAL_ERROR "The 'CMakeToolchain' generator only works with CMake >= 3.15")
endif()

########## 'user_toolchain' block #############
# Include one or more CMake user toolchain from tools.cmake.cmaketoolchain:user_toolchain



########## 'generic_system' block #############
# Definition of system, platform and toolset





########## 'compilers' block #############



########## 'arch_flags' block #############
# Define C++ flags, C flags and linker flags from 'settings.arch'

message(STATUS "Conan toolchain: Defining architecture flag: -m64")
string(APPEND CONAN_CXX_FLAGS " -m64")
string(APPEND CONAN_C_FLAGS " -m64")
string(APPEND CONAN_SHARED_LINKER_FLAGS " -m64")
string(APPEND CONAN_EXE_LINKER_FLAGS " -m64")


########## 'libcxx' block #############
# Definition of libcxx from 'compiler.libcxx' setting, defining the
# right CXX_FLAGS for that libcxx



########## 'cppstd' block #############
# Define the C++ and C standards from 'compiler.cppstd' and 'compiler.cstd'

function(conan_modify_std_watch variable access value current_list_file stack)
set(conan_watched_std_variable "17")
if (${variable} STREQUAL "CMAKE_C_STANDARD")
set(conan_watched_std_variable "")
endif()
if ("${access}" STREQUAL "MODIFIED_ACCESS" AND NOT "${value}" STREQUAL "${conan_watched_std_variable}")
message(STATUS "Warning: Standard ${variable} value defined in conan_toolchain.cmake to ${conan_watched_std_variable} has been modified to ${value} by ${current_list_file}")
endif()
unset(conan_watched_std_variable)
endfunction()

message(STATUS "Conan toolchain: C++ Standard 17 with extensions OFF")
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
variable_watch(CMAKE_CXX_STANDARD conan_modify_std_watch)


########## 'extra_flags' block #############
# Include extra C++, C and linker flags from configuration tools.build:<type>flags
# and from CMakeToolchain.extra_<type>_flags

# Conan conf flags start:
# Conan conf flags end


########## 'cmake_flags_init' block #############
# Define CMAKE_<XXX>_FLAGS from CONAN_<XXX>_FLAGS

foreach(config IN LISTS CMAKE_CONFIGURATION_TYPES)
string(TOUPPER ${config} config)
if(DEFINED CONAN_CXX_FLAGS_${config})
string(APPEND CMAKE_CXX_FLAGS_${config}_INIT " ${CONAN_CXX_FLAGS_${config}}")
endif()
if(DEFINED CONAN_C_FLAGS_${config})
string(APPEND CMAKE_C_FLAGS_${config}_INIT " ${CONAN_C_FLAGS_${config}}")
endif()
if(DEFINED CONAN_SHARED_LINKER_FLAGS_${config})
string(APPEND CMAKE_SHARED_LINKER_FLAGS_${config}_INIT " ${CONAN_SHARED_LINKER_FLAGS_${config}}")
endif()
if(DEFINED CONAN_EXE_LINKER_FLAGS_${config})
string(APPEND CMAKE_EXE_LINKER_FLAGS_${config}_INIT " ${CONAN_EXE_LINKER_FLAGS_${config}}")
endif()
endforeach()

if(DEFINED CONAN_CXX_FLAGS)
string(APPEND CMAKE_CXX_FLAGS_INIT " ${CONAN_CXX_FLAGS}")
endif()
if(DEFINED CONAN_C_FLAGS)
string(APPEND CMAKE_C_FLAGS_INIT " ${CONAN_C_FLAGS}")
endif()
if(DEFINED CONAN_SHARED_LINKER_FLAGS)
string(APPEND CMAKE_SHARED_LINKER_FLAGS_INIT " ${CONAN_SHARED_LINKER_FLAGS}")
endif()
if(DEFINED CONAN_EXE_LINKER_FLAGS)
string(APPEND CMAKE_EXE_LINKER_FLAGS_INIT " ${CONAN_EXE_LINKER_FLAGS}")
endif()


########## 'extra_variables' block #############
# Definition of extra CMake variables from tools.cmake.cmaketoolchain:extra_variables



########## 'try_compile' block #############
# Blocks after this one will not be added when running CMake try/checks

get_property( _CMAKE_IN_TRY_COMPILE GLOBAL PROPERTY IN_TRY_COMPILE )
if(_CMAKE_IN_TRY_COMPILE)
message(STATUS "Running toolchain IN_TRY_COMPILE")
return()
endif()


########## 'find_paths' block #############
# Define paths to find packages, programs, libraries, etc.
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/conan_cmakedeps_paths.cmake")
message(STATUS "Conan toolchain: Including CMakeDeps generated conan_find_paths.cmake")
include("${CMAKE_CURRENT_LIST_DIR}/conan_cmakedeps_paths.cmake")
else()

set(CMAKE_FIND_PACKAGE_PREFER_CONFIG ON)

# Definition of CMAKE_MODULE_PATH
# the generators folder (where conan generates files, like this toolchain)
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})

# Definition of CMAKE_PREFIX_PATH, CMAKE_XXXXX_PATH
# The Conan local "generators" folder, where this toolchain is saved.
list(PREPEND CMAKE_PREFIX_PATH ${CMAKE_CURRENT_LIST_DIR} )
list(PREPEND CMAKE_LIBRARY_PATH "/home/juliangro/.conan2/p/b/nssb1d8c7def7e78/p/lib" "/home/juliangro/.conan2/p/b/nsprc5d1b95cc6e17/p/lib" "lib" "lib")
list(PREPEND CMAKE_INCLUDE_PATH "/home/juliangro/.conan2/p/b/nssb1d8c7def7e78/p/include" "/home/juliangro/.conan2/p/b/nssb1d8c7def7e78/p/include/nss" "/home/juliangro/.conan2/p/b/nsprc5d1b95cc6e17/p/include" "/home/juliangro/.conan2/p/b/nsprc5d1b95cc6e17/p/include/nspr" "include" "include")
set(CONAN_RUNTIME_LIB_DIRS "/home/juliangro/.conan2/p/b/nssb1d8c7def7e78/p/lib" "/home/juliangro/.conan2/p/b/nsprc5d1b95cc6e17/p/lib" "lib" "lib" )

endif()


########## 'pkg_config' block #############
# Define pkg-config from 'tools.gnu:pkg_config' executable and paths

if (DEFINED ENV{PKG_CONFIG_PATH})
set(ENV{PKG_CONFIG_PATH} "${CMAKE_CURRENT_LIST_DIR}:$ENV{PKG_CONFIG_PATH}")
else()
set(ENV{PKG_CONFIG_PATH} "${CMAKE_CURRENT_LIST_DIR}:")
endif()


########## 'rpath' block #############
# Defining CMAKE_SKIP_RPATH



########## 'output_dirs' block #############
# Definition of CMAKE_INSTALL_XXX folders

set(CMAKE_INSTALL_BINDIR "bin")
set(CMAKE_INSTALL_SBINDIR "bin")
set(CMAKE_INSTALL_LIBEXECDIR "bin")
set(CMAKE_INSTALL_LIBDIR "lib")
set(CMAKE_INSTALL_INCLUDEDIR "include")
set(CMAKE_INSTALL_OLDINCLUDEDIR "include")


########## 'variables' block #############
# Definition of CMake variables from CMakeToolchain.variables values

# Variables
# Variables per configuration



########## 'preprocessor' block #############
# Preprocessor definitions from CMakeToolchain.preprocessor_definitions values

# Preprocessor definitions per configuration



if(CMAKE_POLICY_DEFAULT_CMP0091) # Avoid unused and not-initialized warnings
endif()
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
. "/home/juliangro/git/overte/conan-recipes/nss/all/test_package/build/gcc-14-x86_64-17-release/generators/conanbuildenv-release-x86_64.sh"
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
script_folder="/home/juliangro/git/overte/conan-recipes/nss/all/test_package/build/gcc-14-x86_64-17-release/generators"
echo "echo Restoring environment" > "$script_folder/deactivate_conanbuildenv-release-x86_64.sh"
for v in
do
is_defined="true"
value=$(printenv $v) || is_defined="" || true
if [ -n "$value" ] || [ -n "$is_defined" ]
then
echo export "$v='$value'" >> "$script_folder/deactivate_conanbuildenv-release-x86_64.sh"
else
echo unset $v >> "$script_folder/deactivate_conanbuildenv-release-x86_64.sh"
fi
done

Loading

0 comments on commit a08d793

Please sign in to comment.