Skip to content

Commit

Permalink
Merge pull request #225 from mayeut/conan
Browse files Browse the repository at this point in the history
fix issues with latest versions of libxml2
  • Loading branch information
joergbrech authored May 6, 2024
2 parents 470570d + 7cbacd3 commit 632df57
Show file tree
Hide file tree
Showing 9 changed files with 42 additions and 42 deletions.
33 changes: 17 additions & 16 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
strategy:
matrix:
config: ["Debug", "Release"]
os: ["ubuntu-latest", "ubuntu-18.04"]
os: ["ubuntu-latest", "ubuntu-20.04"]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
Expand All @@ -35,14 +35,15 @@ jobs:
..
make -j
- name: Upload build directory
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.os }}-${{ matrix.config }}
path: build
retention-days: 1
- name: Build conan package
run: |
conan create . -o tixi3:shared=True -s build_type=${{ matrix.config }}
conan profile detect
conan create . --build=missing -o 'tixi3/*:shared=True' -s build_type=${{ matrix.config }}
build-win64:
strategy:
Expand All @@ -59,7 +60,7 @@ jobs:
run: |
git config --global core.autocrlf false
git config --global core.eol lf
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Install dependencies
Expand All @@ -79,12 +80,12 @@ jobs:
}
- name: Setup msys2/gfortran
uses: msys2/setup-msys2@v2

- name: Set up Visual Studio shell
uses: egor-tensin/vs-shell@v2
with:
arch: x64

- name: Build TiXI
shell: cmd /C call {0}
run: |
Expand All @@ -101,7 +102,7 @@ jobs:
..
cmake --build . --target install --config ${{ matrix.config }}
- name: Upload build directory
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: build-${{ matrix.os }}-${{ matrix.config }}
path: build
Expand All @@ -112,12 +113,12 @@ jobs:
strategy:
matrix:
config: ["Debug", "Release"]
os: ["ubuntu-latest", "ubuntu-18.04"]
os: ["ubuntu-latest", "ubuntu-20.04"]
runs-on: ${{ matrix.os }}
needs: build-linux
steps:
- name: Download build directory
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: build-${{ matrix.os }}-${{ matrix.config }}
path: build
Expand All @@ -136,7 +137,7 @@ jobs:
needs: build-win64
steps:
- name: Download build directory
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: build-${{ matrix.os }}-${{ matrix.config }}
path: build
Expand All @@ -151,11 +152,11 @@ jobs:
runs-on: "windows-2019"
needs: test-win64
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: recursive
- name: Download build directory
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
with:
name: build-windows-2019-Release
path: build
Expand All @@ -166,17 +167,17 @@ jobs:
& 'C:\Program Files\CMake\bin\cpack.exe' -G ZIP
& 'C:\Program Files\CMake\bin\cpack.exe' -G NSIS
- name: Upload installer as artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: win64-installer
path: build/*.exe
- name: Upload package as artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: win64-package
path: build/*.zip
- name: Upload documentation as artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: html-documentation
path: build/doc/html/*
30 changes: 10 additions & 20 deletions conanfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
def get_version_from_cmakelists():
if not os.path.exists("CMakeLists.txt"):
return None

major_ver = "0"
minor_ver = "0"
patch_ver = "0"

with open("CMakeLists.txt","r") as file_one:
major_re = re.compile('set\(TIXI_VERSION_MAJOR ([0-9]+)\)')
minor_re = re.compile('set\(TIXI_VERSION_MINOR ([0-9]+)\)')
Expand Down Expand Up @@ -57,9 +57,9 @@ def generate(self):
deps.generate()

def requirements(self):
self.requires("libxml2/2.9.14")
self.requires("libxslt/1.1.34")
self.requires("libcurl/7.84.0")
self.requires("libxml2/[>=2.12.5 <3]")
self.requires("libxslt/1.1.39")
self.requires("libcurl/[>=7.78.0 <9]")

def layout(self):
cmake_layout(self)
Expand All @@ -70,24 +70,14 @@ def config_options(self):

def configure(self):
if self.options.shared:
try:
del self.options.fPIC
except Exception:
pass

self.options.rm_safe("fPIC")
# tixi is a c library
try:
del self.settings.compiler.libcxx
except Exception:
pass
try:
del self.settings.compiler.cppstd
except Exception:
pass
self.settings.rm_safe("compiler.cppstd")
self.settings.rm_safe("compiler.libcxx")

def export_sources(self):
self.output.info("Executing export_sources() method")
self.copy("*", dst=self.export_sources_folder)
files.copy(self, "*", src=self.recipe_folder, dst=self.export_sources_folder)

def build(self):
cmake = CMake(self)
Expand Down Expand Up @@ -126,7 +116,7 @@ def _module_file_rel_path(self):

def package_info(self):
self.cpp_info.includedirs.append(os.path.join("include", "tixi3"))

if self.settings.build_type != "Debug":
self.cpp_info.libs = ['tixi3']
else:
Expand Down
1 change: 1 addition & 0 deletions src/tixiImpl.c
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include <stdio.h>
#include <time.h>
#include <math.h>
#include <stdlib.h>

#include "libxml/parser.h"
#include "libxml/xpath.h"
Expand Down
2 changes: 1 addition & 1 deletion src/tixiInternal.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@

extern void printMsg(MessageType type, const char* message, ...);

void xmlStructuredErrorHandler(void * userData, xmlErrorPtr error) {
void xmlStructuredErrorHandler(void * userData, xmlError const* error) {
printMsg(MESSAGETYPE_ERROR, "%s:%i: %s", error->file, error->line, error->message);
}

Expand Down
1 change: 1 addition & 0 deletions src/tixiUtils.c
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <sys/stat.h>
#include <unistd.h>
#endif
#include <stdlib.h>

extern void printMsg(MessageType type, const char* message, ...);

Expand Down
1 change: 1 addition & 0 deletions src/uidHelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
*/
#include "uidHelper.h"
#include "tixiInternal.h"
#include <stdlib.h>

extern void printMsg(MessageType type, const char* message, ...);

Expand Down
2 changes: 2 additions & 0 deletions src/webMethods.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@
#include <curl/curl.h>
#include <curl/easy.h>

#include <stdlib.h>

extern void printMsg(MessageType type, const char* message, ...);

void* myrealloc(void* ptr, size_t size)
Expand Down
1 change: 1 addition & 0 deletions src/xpathFunctions.c
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include "libxml/xpathInternals.h"

#include <assert.h>
#include <stdlib.h>

extern void printMsg(MessageType type, const char* message, ...);

Expand Down
13 changes: 8 additions & 5 deletions test_package/conanfile.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@

from conan import ConanFile
from conan.tools.cmake import CMake, cmake_layout
from conan.tools.build import can_run
from conan.tools.cmake import cmake_layout, CMake
import os


class TestPackageConan(ConanFile):
settings = "os", "arch", "compiler", "build_type"
generators = "CMakeDeps", "CMakeToolchain", "virtualenv"
generators = "CMakeDeps", "CMakeToolchain", "VirtualRunEnv"
test_type = "explicit"

def requirements(self):
self.requires(self.tested_reference_str)

def layout(self):
cmake_layout(self)
Expand All @@ -19,5 +22,5 @@ def build(self):

def test(self):
if can_run(self):
bin_path = os.path.join(self.cpp.build.bindirs[0], "tixi3_conan_test")
self.run(bin_path, run_environment=True)
bin_path = os.path.join(self.cpp.build.bindir, "tixi3_conan_test")
self.run(bin_path, env="conanrun")

0 comments on commit 632df57

Please sign in to comment.