From 9f94d90d1ac443a04faa414102d1dc13fb31e281 Mon Sep 17 00:00:00 2001 From: Daniel <d.hornung@indiscale.com> Date: Wed, 22 Sep 2021 17:00:49 +0200 Subject: [PATCH] ENH: Makefile works with MacOS now. --- .gitignore | 9 +++++++++ Makefile | 23 +++++++++++++++++++++-- doc/README_SETUP.md | 5 +++++ 3 files changed, 35 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 5ed97f7..7ddf9b7 100644 --- a/.gitignore +++ b/.gitignore @@ -145,3 +145,12 @@ flycheck_*.el # Python/Sphinx env/ + +# Conan build files +build_tools +conan.lock +conan_imports_manifest.txt +conanbuildinfo.cmake +conanbuildinfo.txt +conaninfo.txt +graph_info.json diff --git a/Makefile b/Makefile index a024d31..367c0de 100644 --- a/Makefile +++ b/Makefile @@ -23,6 +23,23 @@ CLANG_FORMAT ?= clang-format-11 +CONAN_SETTINGS = "compiler.libcxx=libstdc++11" + +# OS specific handling, with code by Ken Jackson and oHo, +# from https://stackoverflow.com/a/52062069/232888 and +# https://stackoverflow.com/a/14777895/232888 +ifeq '$(findstring ;,$(PATH))' ';' + DETECTED_OS := Windows +else + DETECTED_OS := $(shell uname 2>/dev/null || echo Unknown) + DETECTED_OS := $(patsubst CYGWIN%,Cygwin,$(DETECTED_OS)) + DETECTED_OS := $(patsubst MSYS%,MSYS,$(DETECTED_OS)) + DETECTED_OS := $(patsubst MINGW%,MSYS,$(DETECTED_OS)) +endif +ifeq ($(DETECTED_OS),Darwin) # Test if we are on MacOS + CONAN_SETTINGS := "cppstd=11" +endif + .PHONY: help help: @@ -36,11 +53,13 @@ style: .PHONY: style conan-install: - conan install . -s "compiler.libcxx=libstdc++11" + conan install . -s $(CONAN_SETTINGS) || \ + (echo "'conan install' failed, trying to build from sources..."; \ + conan install . -s $(CONAN_SETTINGS) --build=missing) .PHONY: conan-install conan-create: - conan create . -s "compiler.libcxx=libstdc++11" + conan create . -s $(CONAN_SETTINGS) .PHONY: conan-create conan: conan-install conan-create diff --git a/doc/README_SETUP.md b/doc/README_SETUP.md index a5976af..46026ee 100644 --- a/doc/README_SETUP.md +++ b/doc/README_SETUP.md @@ -34,6 +34,11 @@ have to add `build/lib/` (or, alternatively after installation, `CMAKE_INSTALL_PREFIX/lib`) to your `DYLD_LIBRARY_PATH` environmental variable. +#### Problems and solutions #### + +- Make sure that your conan version supports your XCode version. A typical symptom of version + mismatch is for example conan complaining about incompatible `compiler.version` settings. + ### How to build on Windows We use [Visual Studio 2019](https://visualstudio.microsoft.com/de/vs/features/cplusplus/) -- GitLab