Commit f4c72536 authored by Tobias WEBER's avatar Tobias WEBER
Browse files

restructured tools

parent cbf039a7
......@@ -47,6 +47,7 @@ tmp/**
!tmp/.dir
build/**
tools/structfact/build/**
tools/cif2xml/build/**
tools/magstructfact/build/**
tools/magsgbrowser/build/**
tools/pol/build/**
......
#
# @author Tobias Weber <tweber@ill.fr>
# @date 6-apr-2018
# @date 17-jun-2019
# @license see 'LICENSE' file
#
cmake_minimum_required(VERSION 3.0)
project(in20tools)
message("Build type: ${CMAKE_BUILD_TYPE}")
# setup tools
add_subdirectory(tools/setup)
if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set(CMAKE_VERBOSE_MAKEFILE TRUE)
endif()
# magnetic and nuclear structure tools
add_subdirectory(tools/structfact)
add_subdirectory(tools/magstructfact)
add_subdirectory(tools/magsgbrowser)
add_subdirectory(tools/cif2xml)
set(CMAKE_CXX_STANDARD 17)
add_definitions(-std=c++17)
# polarisation tools
add_subdirectory(tools/pol)
# -----------------------------------------------------------------------------
# Boost
find_package(Boost REQUIRED COMPONENTS system filesystem iostreams REQUIRED)
add_definitions(${Boost_CXX_FLAGS})
# Qt
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5PrintSupport REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Build parser
find_package(FLEX REQUIRED)
find_package(BISON 3.0 REQUIRED)
# temp dir for parser
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/parser)
# parser
BISON_TARGET(cliparser tools/cli/cliparser.y ${CMAKE_CURRENT_BINARY_DIR}/parser/cliparser_impl.cpp
COMPILE_FLAGS "-S lalr1.cc --defines=${CMAKE_CURRENT_BINARY_DIR}/parser/cliparser_impl.h")
# lexer
FLEX_TARGET(clilexer tools/cli/clilexer.l ${CMAKE_CURRENT_BINARY_DIR}/parser/clilexer_impl.cpp
COMPILE_FLAGS "--c++ --header-file=${CMAKE_CURRENT_BINARY_DIR}/parser/clilexer_impl.h")
ADD_FLEX_BISON_DEPENDENCY(clilexer cliparser)
# let moc ignore the generated files
set_property(SOURCE
parser/cliparser_impl.cpp parser/cliparser_impl.h parser/cliparser_impl.hpp
parser/clilexer_impl.cpp parser/clilexer_impl.h parser/clilexer_impl.hpp
PROPERTY SKIP_AUTOGEN ON)
# -----------------------------------------------------------------------------
include_directories(
"${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/ext"
"${Boost_INCLUDE_DIRS}" "${Boost_INCLUDE_DIRS}/.."
"${PROJECT_SOURCE_DIR}/tools/cli" "${PROJECT_BINARY_DIR}/parser"
)
add_executable(in20
tools/in20/main.cpp tools/in20/mainwnd.cpp tools/in20/mainwnd.h
tools/in20/filebrowser.cpp tools/in20/filebrowser.h
tools/in20/workspace.cpp tools/in20/workspace.h
tools/in20/data.cpp tools/in20/data.h
tools/in20/plot.cpp tools/in20/plot.h
tools/in20/command.cpp tools/in20/command.h
tools/in20/globals.cpp tools/in20/globals.h
${BISON_cliparser_OUTPUT_SOURCE} ${BISON_cliparser_OUTPUT_HEADER}
${FLEX_clilexer_OUTPUTS} ${FLEX_clilexer_OUTPUT_HEADER}
tools/cli/cliparser.cpp tools/cli/cliparser.h tools/cli/cliparser_types.h
tools/cli/ast.cpp tools/cli/sym.cpp
tools/cli/funcs.cpp tools/cli/funcs.h
libs/log.cpp
ext/qcp/qcustomplot.cpp ext/qcp/qcustomplot.h
)
target_link_libraries(in20
${Boost_LIBRARIES}
Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport
-ldl
)
# main tool
add_subdirectory(tools/main)
......@@ -3,5 +3,5 @@
#export CC=clang
#export CXX=clang++
export CC=gcc-8
export CXX=g++-8
export CC=gcc-9
export CXX=g++-9
#
# @author Tobias Weber
# @date dec-2018
# @license GPLv3, see 'LICENSE' file
#
cmake_minimum_required(VERSION 3.0)
project(cif2xml)
set(CMAKE_VERBOSE_MAKEFILE TRUE)
find_package(Boost REQUIRED)
set(CMAKE_CXX_STANDARD 20)
add_definitions(-std=c++2a -fconcepts)
add_definitions(${Boost_CXX_FLAGS})
include_directories(
"${PROJECT_SOURCE_DIR}" "${Boost_INCLUDE_DIRS}/.." "../.."
"../../ext/gemmi/include" "../../ext/gemmi/third_party"
"ext" "ext/gemmi/include" "ext/gemmi/third_party"
)
add_executable(cif2xml
cif2xml.cpp ../structfact/loadcif.h)
target_link_libraries(cif2xml
# -static-libstdc++ -static-libgcc
)
......@@ -5,7 +5,7 @@
* @license GPLv3, see 'LICENSE' file
*/
#include "loadcif.h"
#include "../structfact/loadcif.h"
#include "libs/_cxx20/math_algos.h"
#include <gemmi/version.hpp>
......
......@@ -6,7 +6,7 @@
*/
#include "cliparser.h"
#include "tools/in20/globals.h"
#include "tools/main/globals.h"
#include "funcs.h"
#include <cmath>
......
......@@ -20,7 +20,7 @@
#include "cliparser_types.h"
#include "cliparser_impl.h"
#include "tools/in20/data.h"
#include "tools/main/data.h"
class CliAST;
......
......@@ -5,10 +5,12 @@
* @license see 'LICENSE' file
*/
%define parser_class_name { CliParser }
//%define parser_class_name { CliParser }
%define api.parser.class { CliParser }
%define api.value.type variant
%define api.token.constructor
%error-verbose
//%error-verbose
%define parse.error verbose
%code requires { #include "cliparser_types.h" }
%code { #include "cliparser.h" }
......
......@@ -6,7 +6,7 @@
*/
#include "funcs.h"
#include "tools/in20/globals.h"
#include "tools/main/globals.h"
#include "libs/phys.h"
......
......@@ -6,7 +6,7 @@
*/
#include "cliparser.h"
#include "tools/in20/globals.h"
#include "tools/main/globals.h"
#include "funcs.h"
#include "libs/algos.h"
#include "libs/str.h"
......
......@@ -8,7 +8,7 @@ cmake_minimum_required(VERSION 3.0)
project(magstructfact)
set(CMAKE_VERBOSE_MAKEFILE TRUE)
set(BUILD_LIB FALSE)
option(BUILD_LIB "build as dynamic library" FALSE)
find_package(Boost REQUIRED)
find_package(Qt5 REQUIRED COMPONENTS Core Gui Widgets OpenGL)
......@@ -20,8 +20,11 @@ set(CMAKE_CXX_STANDARD 17)
add_definitions(-std=c++17 -fconcepts)
add_definitions(${Boost_CXX_FLAGS})
include_directories("${PROJECT_SOURCE_DIR}" "${Boost_INCLUDE_DIRS}/.." "../.."
"../../ext/gemmi/include" "../../ext/gemmi/third_party")
include_directories(
"${PROJECT_SOURCE_DIR}" "${Boost_INCLUDE_DIRS}/.." "../.."
"ext" "ext/gemmi/include" "ext/gemmi/third_party"
"../../ext/gemmi/include" "../../ext/gemmi/third_party"
)
if(BUILD_LIB)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
......
#
# @author Tobias Weber <tweber@ill.fr>
# @date 6-apr-2018
# @license see 'LICENSE' file
#
cmake_minimum_required(VERSION 3.0)
project(in20tools)
message("Build type: ${CMAKE_BUILD_TYPE}")
if(NOT "${CMAKE_BUILD_TYPE}" STREQUAL "Release")
set(CMAKE_VERBOSE_MAKEFILE TRUE)
endif()
set(CMAKE_CXX_STANDARD 17)
add_definitions(-std=c++17)
# -----------------------------------------------------------------------------
# Boost
find_package(Boost REQUIRED COMPONENTS system filesystem iostreams REQUIRED)
add_definitions(${Boost_CXX_FLAGS})
# Qt
find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Widgets REQUIRED)
find_package(Qt5PrintSupport REQUIRED)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
# -----------------------------------------------------------------------------
# -----------------------------------------------------------------------------
# Build parser
find_package(FLEX REQUIRED)
find_package(BISON 3.0 REQUIRED)
# temp dir for parser
file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/parser)
# parser
BISON_TARGET(cliparser ../cli/cliparser.y ${CMAKE_CURRENT_BINARY_DIR}/parser/cliparser_impl.cpp
COMPILE_FLAGS "-S lalr1.cc --defines=${CMAKE_CURRENT_BINARY_DIR}/parser/cliparser_impl.h")
# lexer
FLEX_TARGET(clilexer ../cli/clilexer.l ${CMAKE_CURRENT_BINARY_DIR}/parser/clilexer_impl.cpp
COMPILE_FLAGS "--c++ --header-file=${CMAKE_CURRENT_BINARY_DIR}/parser/clilexer_impl.h")
ADD_FLEX_BISON_DEPENDENCY(clilexer cliparser)
# let moc ignore the generated files
set_property(SOURCE
parser/cliparser_impl.cpp parser/cliparser_impl.h parser/cliparser_impl.hpp
parser/clilexer_impl.cpp parser/clilexer_impl.h parser/clilexer_impl.hpp
PROPERTY SKIP_AUTOGEN ON)
# -----------------------------------------------------------------------------
include_directories(
"${PROJECT_SOURCE_DIR}" "${PROJECT_SOURCE_DIR}/ext"
"${PROJECT_SOURCE_DIR}/tools/cli"
"${PROJECT_SOURCE_DIR}/../.." "${PROJECT_SOURCE_DIR}/../../ext"
"${PROJECT_SOURCE_DIR}/../../tools/cli"
"${Boost_INCLUDE_DIRS}" "${Boost_INCLUDE_DIRS}/.."
"${PROJECT_BINARY_DIR}/parser"
)
add_executable(in20
main.cpp mainwnd.cpp mainwnd.h
filebrowser.cpp filebrowser.h
workspace.cpp workspace.h
data.cpp data.h plot.cpp plot.h
command.cpp command.h
globals.cpp globals.h
${BISON_cliparser_OUTPUT_SOURCE} ${BISON_cliparser_OUTPUT_HEADER}
${FLEX_clilexer_OUTPUTS} ${FLEX_clilexer_OUTPUT_HEADER}
../cli/cliparser.cpp ../cli/cliparser.h ../cli/cliparser_types.h
../cli/ast.cpp ../cli/sym.cpp
../cli/funcs.cpp ../cli/funcs.h
../../libs/log.cpp
../../ext/qcp/qcustomplot.cpp ../../ext/qcp/qcustomplot.h
)
target_link_libraries(in20
${Boost_LIBRARIES}
Qt5::Core Qt5::Gui Qt5::Widgets Qt5::PrintSupport
-ldl
)
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