Verified Commit e8c38767 authored by Tobias WEBER's avatar Tobias WEBER
Browse files

moved external libraries to their own cmakelists

parent 28352a57
#
# TAS-Paths main cmake file
# @author Tobias Weber <tweber@ill.fr>
# @date feb-2021
# @license GPLv3, see 'LICENSE' file
......@@ -152,6 +153,12 @@ if(Qhull_FOUND)
endif()
find_package(QCP)
if(QCP_FOUND)
include_directories("${QCP_INCLUDE_DIRS}")
endif()
if(USE_OVD)
find_package(OVD)
if(OVD_FOUND)
......@@ -232,21 +239,11 @@ set(CMAKE_AUTOMOC TRUE)
# more compiler settings
# -----------------------------------------------------------------------------
add_compile_options(${Boost_CXX_FLAGS})
#add_definitions(-DQCUSTOMPLOT_USE_OPENGL)
if(CMAKE_BUILD_TYPE STREQUAL "Release")
# disable some warnings for generated source files
set_source_files_properties("${PROJECT_BINARY_DIR}/qcustomplot_local_autogen/mocs_compilation.cpp"
PROPERTIES COMPILE_FLAGS "-Wno-effc++")
set_source_files_properties("${PROJECT_BINARY_DIR}/taspaths_autogen/mocs_compilation.cpp"
PROPERTIES COMPILE_FLAGS "-Wno-effc++")
# disable warnings for external source files
set_source_files_properties("${PROJECT_SOURCE_DIR}/externals/qcustomplot/qcustomplot.cpp"
PROPERTIES COMPILE_FLAGS "-Wno-effc++ \
-Wno-implicit-fallthrough \
-Wno-deprecated-enum-enum-conversion \
-Wno-misleading-indentation")
endif()
# -----------------------------------------------------------------------------
......@@ -281,29 +278,6 @@ target_link_libraries(taspaths_core
"${CGAL_LIBRARIES}"
Threads::Threads
)
# make a 3rd party qcustomplot library
add_library(qcustomplot_local SHARED
externals/qcustomplot/qcustomplot.cpp externals/qcustomplot/qcustomplot.h
)
set_property(TARGET qcustomplot_local
PROPERTY POSITION_INDEPENDENT_CODE True)
if(QT_VER EQUAL 6)
target_link_libraries(qcustomplot_local
Qt6::Core Qt6::Gui Qt6::Widgets
#Qt6::OpenGL Qt6::OpenGLWidgets
Qt6::PrintSupport
)
elseif(QT_VER EQUAL 5)
target_link_libraries(qcustomplot_local
Qt5::Core Qt5::Gui Qt5::Widgets
#Qt5::OpenGL
Qt5::PrintSupport
)
endif()
# -----------------------------------------------------------------------------
......@@ -404,7 +378,7 @@ if(QT_VER EQUAL 6)
Qt6::Core Qt6::Gui Qt6::Widgets
Qt6::OpenGL Qt6::OpenGLWidgets
Qt6::PrintSupport
qcustomplot_local
"${QCP_LIBRARIES}"
)
......@@ -461,7 +435,7 @@ elseif(QT_VER EQUAL 5)
Threads::Threads
Qt5::Core Qt5::Gui Qt5::Widgets
Qt5::OpenGL Qt5::PrintSupport
qcustomplot_local
"${QCP_LIBRARIES}"
)
......
#
# cmake file for external libraries like qcustomplot
# @author Tobias Weber <tweber@ill.fr>
# @date feb-2021
# @license GPLv3, see 'LICENSE' file
#
# -----------------------------------------------------------------------------
# TAS-Paths (part of the Takin software suite)
# Copyright (C) 2021 Tobias WEBER (Institut Laue-Langevin (ILL),
# Grenoble, France).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
#
cmake_minimum_required(VERSION 3.0)
project(taspaths_externals)
enable_language(CXX)
list(APPEND CMAKE_MODULE_PATH
"${PROJECT_SOURCE_DIR}"
"${PROJECT_SOURCE_DIR}/cmake"
"${PROJECT_SOURCE_DIR}/tlibs2/cmake"
)
option(USE_QT6 "use qt 6" FALSE)
if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set(CMAKE_VERBOSE_MAKEFILE TRUE)
endif()
if(USE_QT6)
set(QT_VER 6)
else()
set(QT_VER 5)
endif()
message("Build type: ${CMAKE_BUILD_TYPE}.")
message("Compiler: " ${CMAKE_CXX_COMPILER_ID}.)
message("Selected Qt version ${QT_VER}.")
set(WARN_OPTS -Wall -Wextra)
add_compile_options(${WARN_OPTS})
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
# generate debug symbols
add_compile_options(-g -ggdb)
elseif(CMAKE_BUILD_TYPE STREQUAL "Release")
add_compile_options("-DNDEBUG")
endif()
# -----------------------------------------------------------------------------
# compiler settings
# -----------------------------------------------------------------------------
set(CMAKE_CXX_STANDARD 20)
add_compile_options(-std=c++20)
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# system specific settings
# -----------------------------------------------------------------------------
message("Building for ${CMAKE_SYSTEM_NAME} systems.")
set(MINGW_WINSOCK)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
# pass linker --subsystem option
add_compile_options(-Wl,--subsystem,windows)
set(MINGW_WINSOCK "ws2_32")
elseif(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
#add_compile_options(-mmacosx-version-min=10.15)
add_compile_options(-mmacosx-version-min=11.0)
endif()
include_directories("${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/externals")
if(QT_VER EQUAL 6)
include_directories("${Qt6Core_INCLUDE_DIRS}/..")
elseif(QT_VER EQUAL 5)
include_directories("${Qt5Core_INCLUDE_DIRS}/..")
endif()
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# packages
# -----------------------------------------------------------------------------
if(QT_VER EQUAL 6)
find_package(Qt6 REQUIRED
COMPONENTS Core Gui Svg Widgets
OpenGL OpenGLWidgets
PrintSupport)
elseif(QT_VER EQUAL 5)
find_package(Qt5 REQUIRED
COMPONENTS Core Gui Svg Widgets OpenGL
PrintSupport)
else()
message(FATAL_ERROR "Unknown Qt version selected: ${QT_VER}")
endif()
set(CMAKE_AUTOUIC TRUE)
set(CMAKE_AUTOMOC TRUE)
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# more compiler settings
# -----------------------------------------------------------------------------
#add_definitions(-DQCUSTOMPLOT_USE_OPENGL)
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# target library settings
# -----------------------------------------------------------------------------
# make a 3rd party qcustomplot library
add_library(qcustomplot_local SHARED
qcustomplot/qcustomplot.cpp qcustomplot/qcustomplot.h
)
set_property(TARGET qcustomplot_local
PROPERTY POSITION_INDEPENDENT_CODE True)
if(QT_VER EQUAL 6)
target_link_libraries(qcustomplot_local
Qt6::Core Qt6::Gui Qt6::Widgets
#Qt6::OpenGL Qt6::OpenGLWidgets
Qt6::PrintSupport
)
elseif(QT_VER EQUAL 5)
target_link_libraries(qcustomplot_local
Qt5::Core Qt5::Gui Qt5::Widgets
#Qt5::OpenGL
Qt5::PrintSupport
)
endif()
# -----------------------------------------------------------------------------
......@@ -6,7 +6,7 @@
#
# -----------------------------------------------------------------------------
# TAS-Paths (part of the Takin software suite)
# Copyright (C) 2021 Tobias WEBER (Institut Laue-Langevin (ILL),
# Copyright (C) 2021 Tobias WEBER (Institut Laue-Langevin (ILL),
# Grenoble, France).
#
# This program is free software: you can redistribute it and/or modify
......
#
# finds the qcustomplot libs
# @author Tobias Weber <tweber@ill.fr>
# @date 16-sep-2020
# @license GPLv3
#
# -----------------------------------------------------------------------------
# TAS-Paths (part of the Takin software suite)
# Copyright (C) 2021 Tobias WEBER (Institut Laue-Langevin (ILL),
# Grenoble, France).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, version 3 of the License.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# -----------------------------------------------------------------------------
#
find_path(QCP_INCLUDE_DIRS
NAMES qcustomplot.h
HINTS ./externals/qcustomplot /usr/include/ /usr/local/include/
/opt/local/include
DOC "QCP include directories"
)
find_library(QCP_LIBRARIES
NAMES qcustomplot_local qcustomplot
HINTS ./externals/qcustomplot /usr/lib/x86_64-linux-gnu /usr/lib64 /usr/lib
/usr/local/lib64 /usr/local/lib /opt/local/lib
DOC "QCP library"
)
if(QCP_INCLUDE_DIRS AND QCP_LIBRARIES)
set(QCP_FOUND TRUE)
message("QCP include directories: ${QCP_INCLUDE_DIRS}")
message("QCP libraries: ${QCP_LIBRARIES}")
else()
set(QCP_FOUND FALSE)
message("Error: QCP could not be found!")
endif()
......@@ -6,7 +6,7 @@
#
# -----------------------------------------------------------------------------
# TAS-Paths (part of the Takin software suite)
# Copyright (C) 2021 Tobias WEBER (Institut Laue-Langevin (ILL),
# Copyright (C) 2021 Tobias WEBER (Institut Laue-Langevin (ILL),
# Grenoble, France).
#
# This program is free software: you can redistribute it and/or modify
......
......@@ -32,6 +32,42 @@ USE_LAPACK=False
USE_QT6=False
USE_CGAL=True
USE_OVD=False
BUILD_EXTERNALS=1
#export CXX=clang++-10
#export CXX=g++-10
if [ $BUILD_EXTERNALS -ne 0 ]; then
echo -e "--------------------------------------------------------------------------------"
echo -e "Building external libraries..."
echo -e "--------------------------------------------------------------------------------"
cp -v CMakeLists_externals.txt externals/CMakeLists.txt
rm -rfv externals/build
mkdir externals/build
pushd externals/build
if ! ${cmake_tool} -DUSE_QT6=${USE_QT6} \
-DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-O2" \
-DCMAKE_VERBOSE_MAKEFILE=False ..
then
echo -e "cmake failed (external libraries)."
exit -1
fi
if ! ${cmake_tool} --build . --parallel 4; then
echo -e "make failed (external libraries)."
exit -1
fi
strip -v libqcustomplot_local.*
cp -v libqcustomplot_local.* ../qcustomplot/
popd
echo -e "--------------------------------------------------------------------------------"
fi
echo -e "--------------------------------------------------------------------------------"
......@@ -42,13 +78,11 @@ doxygen setup/dev_doc
echo -e "--------------------------------------------------------------------------------"
echo -e "--------------------------------------------------------------------------------"
echo -e "Building..."
echo -e "Building TAS-Paths..."
echo -e "--------------------------------------------------------------------------------"
#export CXX=clang++-10
#export CXX=g++-10
rm -rfv build
mkdir build
pushd build
......@@ -73,7 +107,10 @@ strip -v taspaths
strip -v taspaths-lines
strip -v taspaths-hull
strip -v taspaths-poly
strip -v libqcustomplot_local.so
if [ $BUILD_EXTERNALS -ne 0 ]; then
cp -v ../externals/qcustomplot/libqcustomplot_local.* .
fi
popd
echo -e "--------------------------------------------------------------------------------"
......@@ -104,7 +104,9 @@ ConfigSpaceDlg::ConfigSpaceDlg(QWidget* parent, QSettings *sett)
m_plot->xAxis->setLabel("2θ_S (deg)");
m_plot->yAxis->setLabel("2θ_M (deg)");
m_plot->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
#if QCUSTOMPLOT_VERSION >= 0x020100
m_plot->setInteraction(QCP::iSelectPlottablesBeyondAxisRect, false);
#endif
// wall contours
m_colourMap = new QCPColorMap(m_plot->xAxis, m_plot->yAxis);
......
......@@ -71,7 +71,9 @@ XtalConfigSpaceDlg::XtalConfigSpaceDlg(QWidget* parent, QSettings *sett)
m_plot->xAxis->setLabel("x * Orientation Vector 1");
m_plot->yAxis->setLabel("y * Orientation Vector 2");
m_plot->setSizePolicy(QSizePolicy::Expanding, QSizePolicy::Expanding);
#if QCUSTOMPLOT_VERSION >= 0x020100
m_plot->setInteraction(QCP::iSelectPlottablesBeyondAxisRect, false);
#endif
// wall contours
m_colourMap = new QCPColorMap(m_plot->xAxis, m_plot->yAxis);
......
......@@ -30,7 +30,13 @@
// see: https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Weffc++"
#if __has_include("qcustomplot/qcustomplot.h")
#include "qcustomplot/qcustomplot.h"
#elif __has_include("qcustomplot.h")
#include "qcustomplot.h"
#else
#error "QCustomplot header was not found."
#endif
#pragma GCC diagnostic pop
#endif
......@@ -1103,9 +1103,9 @@ template<class t_vec,
class t_int = int>
VoronoiLinesResults<t_vec, t_line, t_graph>
calc_voro_ovd(const std::vector<t_line>& lines,
typename t_vec::value_type eps = std::sqrt(std::numeric_limits<typename t_vec::value_type>::epsilon()),
typename t_vec::value_type para_edge_eps = 1e-2,
const VoronoiLinesRegions<t_vec, t_line>* regions = nullptr)
[[maybe_unused]] typename t_vec::value_type eps = std::sqrt(std::numeric_limits<typename t_vec::value_type>::epsilon()),
[[maybe_unused]] typename t_vec::value_type para_edge_eps = 1e-2,
[[maybe_unused]] const VoronoiLinesRegions<t_vec, t_line>* regions = nullptr)
requires tl2::is_vec<t_vec> && is_graph<t_graph>
{
using t_real = typename t_vec::value_type;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment