Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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
7 changes: 2 additions & 5 deletions .azure-pipelines/azure-pipelines-linux.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 1 addition & 3 deletions .azure-pipelines/azure-pipelines-osx.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

26 changes: 0 additions & 26 deletions .ci_support/linux_aarch64_.yaml

This file was deleted.

7 changes: 0 additions & 7 deletions .ci_support/migrations/libxml2212.yaml

This file was deleted.

22 changes: 0 additions & 22 deletions .ci_support/osx_arm64_.yaml

This file was deleted.

2 changes: 1 addition & 1 deletion .scripts/build_steps.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .scripts/run_osx_build.sh

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion .scripts/run_win_build.bat

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions azure-pipelines.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

15 changes: 15 additions & 0 deletions recipe/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR)
project(cmake_build_test)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED TRUE)
find_package(CppInterOp REQUIRED)
message(STATUS "CppInterOp library status:")
message(STATUS " config: ${CppInterOp_CONFIG}")
message(STATUS " dir: ${CppInterOp_DIR}")
message(STATUS " version: ${CppInterOp_VERSION}")
message(STATUS " compatible with clang: ${CppInterOp_CLANG_VERSION}")
message(STATUS " libraries: ${CPPINTEROP_LIBRARIES}")
message(STATUS " include path: ${CppInterOp_INCLUDE_DIRS}")
add_executable(cmake_build_test test.cpp)
target_link_libraries(cmake_build_test PRIVATE clangCppInterOp)
add_compile_definitions(cmake_build_test PUBLIC CONDA_PREFIX="${CONDA_PREFIX}")
5 changes: 0 additions & 5 deletions recipe/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,6 @@ set -x

# Common settings

export CPU_COUNT="$(nproc --all)"
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${BUILD_PREFIX}/x86_64-conda-linux-gnu/lib:${BUILD_PREFIX}/lib:${PREFIX}/lib"
sys_include_path=$(LC_ALL=C x86_64-conda-linux-gnu-g++ -O3 -DNDEBUG -xc++ -E -v /dev/null 2>&1 | sed -n -e '/^.include/,${' -e '/^ \/.*++/p' -e '}' | xargs -I$ echo "$" | tr '\n' ':')
export CPLUS_INCLUDE_PATH="${CPLUS_INCLUDE_PATH}:$PWD/include:$sys_include_path:${BUILD_PREFIX}/x86_64-conda-linux-gnu/sysroot/usr/include:${BUILD_PREFIX}/include:${PREFIX}/include"

export clangdev_tag=${clangdev/\.\*/}
clangdev1=${clangdev_tag}.0.0
export clangdev_ver=${clangdev1/17\.0\.0/17.0.6} # fix: clang 17.0.0 is removed from releases
Expand Down
37 changes: 35 additions & 2 deletions recipe/meta.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{% set name = "CppInterOp" %}
{% set build_number = 3 %}
{% set build_number = 4 %}
{% set version = "1.2.0" %}
{% set revision_tag = "v"+version %}

Expand All @@ -17,12 +17,20 @@ source:
- patches/cppinterop/0002-cmake-CppInterOp-install-fix.patch
- patches/cppinterop/0003-Implement-detection-of-resource-and-include-dirs.patch
- patches/cppinterop/0004-cmake-config-fix-library-suffix-and-prefix.patch
- patches/cppinterop/0005-Fix-config-for-msvc.patch
- patches/cppinterop/0006-Export-symbols-in-Windows-DLL.patch
- path: patches
folder: add_patches

build:
number: {{ build_number }}
string: clang{{ (clangdev or "None").split(".")[0] }}_repl_h{{ PKG_HASH }}_{{ build_number }}
error_overlinking: false # FIXME: We should adjust the ignore_run_exports.
ignore_run_exports:
- zstd # [win]
- libxml2
- backtrace
- libllvm{{ clangdev }}

requirements:
build:
Expand All @@ -44,7 +52,7 @@ requirements:
- backtrace # [unix and x86]
- libxml2
- zlib
- zstd # [not win]
- zstd # [unix]
- libcxx {{ cxx_compiler_version }} # [osx]
- libstdcxx-ng {{ cxx_compiler_version }} # [linux]
run_constrained:
Expand All @@ -56,9 +64,34 @@ requirements:
- libstdcxx-ng >={{ cxx_compiler_version }} # [linux]

test:
requires:
- {{ compiler('cxx') }}
- libcxx {{ cxx_compiler_version }} # [osx]
- libstdcxx-ng >={{ cxx_compiler_version }} # [linux]
- cmake
- ninja
files:
- CMakeLists.txt
- test.cpp
commands:
- test -f $PREFIX/lib/libclangCppInterOp${SHLIB_EXT} # [unix]
- if not exist %LIBRARY_BIN%\\clangCppInterOp.dll exit 1 # [win]
# Avoid Bad CPU from cmake when cross-compiling on osx and arm...
- exit 0 # [build_platform != target_platform]
- mkdir -p cmake_build_test && pushd cmake_build_test
- $CXX -xc++ -E -v /dev/null 2>&1 | sed -n -e '/^.include/,${' -e '/^ \/.*/p' -e '}' # [unix]
- cmake -DCMAKE_BUILD_TYPE=Debug -DCONDA_PREFIX="$BUILD_PREFIX" -G "Ninja" ..
- cmake --build . --config Debug -- -v
- ./cmake_build_test $CXX # [unix]
- rm -fr *
- cmake -DCMAKE_BUILD_TYPE=Release -DCONDA_PREFIX="$BUILD_PREFIX" -G "Ninja" ..
- cmake --build . --config Release
- ./cmake_build_test $CXX # [unix]
- rm -fr *
- cmake -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCONDA_PREFIX="$BUILD_PREFIX" -G "Ninja" ..
- cmake --build . --config RelWithDebInfo
- ./cmake_build_test $CXX # [unix]
- popd

about:
home: https://github.com/compiler-research/CppInterOp
Expand Down
88 changes: 88 additions & 0 deletions recipe/patches/cppinterop/0005-Fix-config-for-msvc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
From 82478204b3e52f98b3d6622f47ba21fd7c453224 Mon Sep 17 00:00:00 2001
From: Vassil Vassilev <[email protected]>
Date: Mon, 18 Mar 2024 20:09:06 +0000
Subject: [PATCH] [cmake] Clean up and improve the CppInterOp config for
Windows.

---
cmake/CppInterOp/CppInterOpConfig.cmake.in | 41 ++++++++++++++++------
1 file changed, 31 insertions(+), 10 deletions(-)

diff --git a/cmake/CppInterOp/CppInterOpConfig.cmake.in b/cmake/CppInterOp/CppInterOpConfig.cmake.in
index 414c1c0..b2dd5a5 100644
--- a/cmake/CppInterOp/CppInterOpConfig.cmake.in
+++ b/cmake/CppInterOp/CppInterOpConfig.cmake.in
@@ -9,21 +9,27 @@ get_filename_component(CPPINTEROP_INSTALL_PREFIX "${CPPINTEROP_INSTALL_PREFIX}"
# Determine CMAKE_SHARED_LIBRARY_SUFFIX based on operating system
include(CMakeSystemSpecificInformation)

+if(MSVC)
+ set(shared_lib_dir bin)
+else()
+ set(shared_lib_dir lib)
+endif()
+
### build/install workaround
if (@BUILD_SHARED_LIBS@)
- set(__lib_suffix ${CMAKE_SHARED_LIBRARY_SUFFIX})
- set(__lib_prefix ${CMAKE_SHARED_LIBRARY_PREFIX})
+ set(_lib_suffix ${CMAKE_SHARED_LIBRARY_SUFFIX})
+ set(_lib_prefix ${CMAKE_SHARED_LIBRARY_PREFIX})
else()
- set(__lib_suffix ${CMAKE_STATIC_LIBRARY_SUFFIX})
- set(__lib_prefix ${CMAKE_STATIC_LIBRARY_PREFIX})
+ set(_lib_suffix ${CMAKE_STATIC_LIBRARY_SUFFIX})
+ set(_lib_prefix ${CMAKE_STATIC_LIBRARY_PREFIX})
endif()

if (IS_DIRECTORY "${CPPINTEROP_INSTALL_PREFIX}/include")
set(_include "${CPPINTEROP_INSTALL_PREFIX}/include")
- set(_libs "${CPPINTEROP_INSTALL_PREFIX}/lib/${__lib_prefix}clangCppInterOp${__lib_suffix}")
+ set(_lib "${CPPINTEROP_INSTALL_PREFIX}/${shared_lib_dir}/${_lib_prefix}clangCppInterOp${_lib_suffix}")
else()
set(_include "@CMAKE_CURRENT_SOURCE_DIR@/include")
- set(_libs "@CMAKE_CURRENT_BINARY_DIR@/lib/${__lib_prefix}clangCppInterOp${__lib_suffix}")
+ set(_lib "@CMAKE_CURRENT_BINARY_DIR@/${shared_lib_dir}/${_lib_prefix}clangCppInterOp${_lib_suffix}")
endif()

###
@@ -31,7 +37,7 @@ endif()
set(CPPINTEROP_EXPORTED_TARGETS "clangCppInterOp")
set(CPPINTEROP_CMAKE_DIR "${_cmake}")
set(CPPINTEROP_INCLUDE_DIRS "${_include}")
-set(CPPINTEROP_LIBRARIES "${_libs}")
+set(CPPINTEROP_LIBRARIES "${_lib}")

# Provide all our library targets to users.
if (@BUILD_SHARED_LIBS@)
@@ -39,9 +45,24 @@ if (@BUILD_SHARED_LIBS@)
else()
add_library(clangCppInterOp STATIC IMPORTED)
endif()
-set_property(TARGET clangCppInterOp PROPERTY INTERFACE_INCLUDE_DIRECTORIES "${_include}")
-set_property(TARGET clangCppInterOp PROPERTY IMPORTED_LOCATION "${_libs}")
+set_target_properties(clangCppInterOp PROPERTIES
+ INTERFACE_INCLUDE_DIRECTORIES ${_include}
+ IMPORTED_LOCATION ${_lib}
+ )
+if (MSVC)
+ if (IS_DIRECTORY "${CPPINTEROP_INSTALL_PREFIX}/include")
+ set(_static_lib "${CPPINTEROP_INSTALL_PREFIX}/lib/${_lib_prefix}clangCppInterOp.lib")
+ else()
+ set(_static_lib "@CMAKE_CURRENT_BINARY_DIR@/lib/${_lib_prefix}clangCppInterOp.lib")
+ endif()
+
+ set_target_properties(clangCppInterOp PROPERTIES
+ IMPORTED_IMPLIB ${_static_lib}
+ )
+endif(MSVC)

+unset(_lib_prefix)
+unset(_lib_suffix)
unset(_cmake)
unset(_include)
-unset(_libs)
+unset(_lib)
--
2.37.1 (Apple Git-137.1)

Loading