Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
partons
core
partons-example
Commits
e5ca0f60
Commit
e5ca0f60
authored
Jul 20, 2021
by
Pawel Sznajder
Browse files
improve CMake.file
parent
f7cc23d0
Changes
8
Hide whitespace changes
Inline
Side-by-side
CMakeLists.txt
View file @
e5ca0f60
...
...
@@ -4,10 +4,14 @@
cmake_minimum_required
(
VERSION 3.2
)
# define project name and its language
project
(
PARTONS_
releas
e CXX
)
project
(
PARTONS_
exampl
e CXX
)
# define c++ standard and issue all the warning demanded by this standard
add_definitions
(
-std=c++11 -pedantic -Wno-vla-extension
)
if
(
CMAKE_CXX_COMPILER_ID MATCHES
"Clang"
)
add_definitions
(
-std=c++11 -pedantic -Wno-vla-extension
)
else
()
add_definitions
(
-std=c++11 -pedantic -Wno-vla-extension -fext-numeric-literals
)
endif
()
set
(
CMAKE_CXX_STANDARD 11
)
if
(
NOT DEFINED CMAKE_MACOSX_RPATH
)
...
...
@@ -24,20 +28,39 @@ set(CMAKE_INCLUDE_CURRENT_DIR ON)
# FIND LIBRARIES ===========================================================================
# find libraries:
gsl
find_package
(
GSL
)
# find libraries:
additional modules
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
"
${
CMAKE_SOURCE_DIR
}
/cmake/Modules/"
)
# find libraries: Qt
find_package
(
Qt5 COMPONENTS Core Sql
REQUIRED
)
find_package
(
Qt5 COMPONENTS Core Sql
XmlPatterns QUIET
)
# add some useful macros and variables
add_definitions
(
${
QT_DEFINITIONS
}
)
if
(
${
Qt5_FOUND
}
)
#
find
libraries: additional modules
set
(
CMAKE_MODULE_PATH
${
CMAKE_MODULE_PATH
}
"
${
CMAKE_SOURCE_DIR
}
/cmake/Modules/"
)
find
_package
(
Qt5Widgets
)
message
(
"-- Found Qt5:
"
${
Qt5Widgets_VERSION
}
)
# find libraries: SFML
find_package
(
SFML COMPONENTS system REQUIRED
)
set
(
QT_LIBRARY_CORE
"Qt5::Core"
)
set
(
QT_LIBRARY_SQL
"Qt5::Sql"
)
set
(
QT_LIBRARY_XML
"Qt5::XmlPatterns"
)
set
(
QT_VERSION
${
Qt5Widgets_VERSION
}
)
else
()
find_package
(
Qt4 COMPONENTS QtCore QtSql QtXmlPatterns
)
if
(
${
Qt4_FOUND
}
)
set
(
QT_LIBRARY_CORE
"Qt4::QtCore"
)
set
(
QT_LIBRARY_SQL
"Qt4::QtSql"
)
set
(
QT_LIBRARY_XML
"Qt4::QtXmlPatterns"
)
set
(
QT_VERSION
${
QT_VERSION_MAJOR
}
.
${
QT_VERSION_MINOR
}
.
${
QT_VERSION_PATCH
}
)
else
()
message
(
FATAL_ERROR
"Neither Qt5 nor Qt4 found in this system"
)
endif
()
endif
()
# find libraries: ElementaryUtils
find_package
(
ElementaryUtils REQUIRED
)
...
...
@@ -48,8 +71,23 @@ find_package(NumA++ REQUIRED)
# find libraries: PARTONS
find_package
(
PARTONS REQUIRED
)
# find libraries: SFML
find_package
(
SFML COMPONENTS system REQUIRED
)
# find libraries: CLN
find_package
(
CLN REQUIRED
)
# find libraries: GSL
find_package
(
GSL REQUIRED
)
# find libraries: Apfel++
find_package
(
Apfel++ REQUIRED
)
# find libraries: LHAPDF
find_package
(
LHAPDF REQUIRED
)
# directories containing headers
include_directories
(
$
(
GSL
_INCLUDE_DIR
S
)
${
QT
_INCLUDE_DIR
S
}
${
SFML_INCLUDE_DIR
}
${
ElementaryUtils_INCLUDE_DIR
}
${
NumA
++_INCLUDE_DIR
}
${
PARTONS
_INCLUDE_DIR
}
)
include_directories
(
$
{
QT_INCLUDE_DIRS
}
${
ElementaryUtils_INCLUDE_DIR
}
${
NumA++
_INCLUDE_DIR
}
${
PARTONS
_INCLUDE_DIR
}
${
SFML_INCLUDE_DIR
}
${
CLN_INCLUDE_DIR
}
$
(
GSL_INCLUDE_DIRS
)
${
Apfel
++_INCLUDE_DIR
}
${
LHAPDF
_INCLUDE_DIR
}
)
# FINALIZE ==================================================================================
...
...
@@ -78,19 +116,25 @@ target_link_libraries(
PARTONS_example
${
GSL_LIBRARIES
}
${
QT_LIBRARIES
}
${
SFML_LIBRARIES
}
${
ElementaryUtils_LIBRARIES
}
${
NumA++_LIBRARIES
}
${
PARTONS_LIBRARIES
}
Qt5::Core
Qt5::Sql
${
SFML_LIBRARIES
}
${
CLN_LIBRARIES
}
${
ElementaryUtils_LIBRARIES
}
${
NumA++_LIBRARIES
}
${
PARTONS_LIBRARIES
}
${
GSL_LIBRARIES
}
${
Apfel++_LIBRARIES
}
${
LHAPDF_LIBRARIES
}
${
QT_LIBRARY_CORE
}
${
QT_LIBRARY_SQL
}
${
QT_LIBRARY_XML
}
)
cmake/Modules/FindApfel++.cmake
0 → 100644
View file @
e5ca0f60
# APFEL++
find_program
(
Apfel++_CONFIG apfelxx-config REQUIRED
)
if
(
Apfel++_CONFIG
)
exec_program
(
${
Apfel++_CONFIG
}
ARGS --cppflags
OUTPUT_VARIABLE Apfel++_CXX_FLAGS
)
set
(
Apfel++_CXX_FLAGS
${
Apfel++_CXX_FLAGS
}
CACHE STRING INTERNAL
)
exec_program
(
${
Apfel++_CONFIG
}
ARGS --ldflags
OUTPUT_VARIABLE Apfel++_LIBRARIES
)
set
(
Apfel++_LIBRARIES
${
Apfel++_LIBRARIES
}
CACHE STRING INTERNAL
)
exec_program
(
${
Apfel++_CONFIG
}
ARGS --version
OUTPUT_VARIABLE Apfel++_VERSION
)
set
(
Apfel++_VERSION
${
Apfel++_VERSION
}
CACHE STRING INTERNAL
)
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
Apfel++ REQUIRED_VARS Apfel++_LIBRARIES VERSION_VAR Apfel++_VERSION
)
else
(
Apfel++_CONFIG
)
message
(
FATAL_ERROR
"Apfel++ not found"
)
endif
(
Apfel++_CONFIG
)
cmake/Modules/FindCLN.cmake
0 → 100644
View file @
e5ca0f60
# CLN_FOUND CLN has been successfully found
# CLN_INCLUDE_DIR the include directories
# CLN_LIBRARIES CLN library and its dependencies (if any)
if
(
CLN_INCLUDE_DIR AND CLN_LIBRARIES
)
set
(
CLN_FIND_QUIETLY TRUE
)
endif
()
function
(
_cl_get_version _out_major _out_minor _out_patch _cl_version_h
)
file
(
STRINGS
${
_cl_version_h
}
_cl_vinfo REGEX
"^#define[
\t
]+CL_VERSION_.*"
)
if
(
NOT _cl_vinfo
)
message
(
FATAL_ERROR
"include file
${
_cl_version_h
}
does not exist"
)
endif
()
string
(
REGEX REPLACE
"^.*CL_VERSION_MAJOR[
\t
]+([0-9]+).*"
"
\\
1"
${
_out_major
}
"
${
_cl_vinfo
}
"
)
string
(
REGEX REPLACE
"^.*CL_VERSION_MINOR[
\t
]+([0-9]+).*"
"
\\
1"
${
_out_minor
}
"
${
_cl_vinfo
}
"
)
string
(
REGEX REPLACE
"^.*CL_VERSION_PATCHLEVEL[
\t
]+([0-9]+).*"
"
\\
1"
${
_out_patch
}
"
${
_cl_vinfo
}
"
)
if
(
NOT
${
_out_major
}
MATCHES
"[0-9]+"
)
message
(
FATAL_ERROR
"failed to determine CL_VERSION_MAJOR, "
"expected a number, got
${${
_out_major
}}
"
)
endif
()
if
(
NOT
${
_out_minor
}
MATCHES
"[0-9]+"
)
message
(
FATAL_ERROR
"failed to determine CL_VERSION_MINOR, "
"expected a number, got
${${
_out_minor
}}
"
)
endif
()
if
(
NOT
${
_out_patch
}
MATCHES
"[0-9]+"
)
message
(
FATAL_ERROR
"failed to determine CL_VERSION_PATCHLEVEL, "
"expected a number, got
${${
_out_patch
}}
"
)
endif
()
#message(STATUS "found CLN [${_cl_version_h}], version ${${_out_major}}.${${_out_minor}}.${${_out_patch}}")
set
(
${
_out_major
}
${${
_out_major
}}
PARENT_SCOPE
)
set
(
${
_out_minor
}
${${
_out_minor
}}
PARENT_SCOPE
)
set
(
${
_out_patch
}
${${
_out_patch
}}
PARENT_SCOPE
)
endfunction
()
set
(
CLN_FOUND
)
set
(
CLN_INCLUDE_DIR
)
set
(
CLN_LIBRARIES
)
#include(FindPkgConfig)
#if (PKG_CONFIG_FOUND)
# pkg_check_modules(_cln cln)
#endif()
find_path
(
CLN_INCLUDE_DIR NAMES cln/cln.h
HINTS
${
_cln_INCLUDE_DIRS
}
/usr/local/cln/v1.3.4/include
$ENV{CLN_DIR}/include
)
find_library
(
CLN_LIBRARIES NAMES libcln cln
HINTS
${
_cln_LIBRARY_DIR
}
${
_cln_LIBRARY_DIRS
}
/usr/local/cln/v1.3.4/lib
$ENV{CLN_DIR}/lib
)
if
(
CLN_INCLUDE_DIR
)
_cl_get_version
(
CLN_VERSION_MAJOR
CLN_VERSION_MINOR
CLN_VERSION_PATCHLEVEL
${
CLN_INCLUDE_DIR
}
/cln/version.h
)
set
(
CLN_VERSION
${
CLN_VERSION_MAJOR
}
.
${
CLN_VERSION_MINOR
}
.
${
CLN_VERSION_PATCHLEVEL
}
)
# Check if the version reported by pkg-config is the same
# as the one read from the header. This prevents us from
# picking the wrong version of CLN (say, if several versions
# are installed)
if
(
_cln_FOUND AND NOT CLN_VERSION VERSION_EQUAL _cln_VERSION
)
if
(
NOT CLN_FIND_QUIETLY
)
message
(
ERROR
"pkg-config and version.h disagree, "
"
${
_cln_VERSION
}
vs
${
CLN_VERSION
}
, "
"please check your installation"
)
endif
()
set
(
CLN_LIBRARIES CLN-NOTFOUND
)
set
(
CLN_INCLUDE_DIR CLN-NOTFOUND
)
set
(
CLN_LIBRARY_DIRS
)
set
(
CLN_VERSION
)
endif
()
endif
()
set
(
CMAKE_REQUIRED_QUIET TRUE
)
# Check if the version embedded into the library is the same as the one in the headers.
if
(
CLN_INCLUDE_DIR AND CLN_LIBRARIES AND NOT CMAKE_CROSSCOMPILING
)
include
(
CheckCXXSourceRuns
)
set
(
_save_required_includes
${
CMAKE_REQUIRED_INCLUDES
}
)
set
(
_save_required_libraries
${
CMAKE_REQUIRED_LIBRARIES
}
)
set
(
CMAKE_REQUIRED_INCLUDES
${
CMAKE_REQUIRED_INCLUDES
}
${
CLN_INCLUDE_DIR
}
)
set
(
CMAKE_REQUIRED_LIBRARIES
${
CMAKE_REQUIRED_LIBRARIES
}
${
CLN_LIBRARIES
}
)
check_cxx_source_runs
(
"
#include <cln/version.h>
int main() {
return (CL_VERSION_MAJOR == cln::version_major) &&
(CL_VERSION_MINOR == cln::version_minor) &&
(CL_VERSION_PATCHLEVEL == cln::version_patchlevel) ? 0 : 1;
}
"
_cl_version_matches
)
set
(
CMAKE_REQUIRED_LIBRARIES
${
_save_required_libraries
}
)
set
(
CMAKE_REQUIRED_INCLUDES
${
_save_required_includes
}
)
if
(
NOT _cl_version_matches
)
if
(
NOT CLN_FIND_QUIETLY
)
message
(
ERROR
"header (version differs from the library one, "
"please check your installation."
)
endif
()
set
(
CLN_INCLUDE_DIR CLN-NOTFOUND
)
set
(
CLN_LIBRARIES CLN-NOTFOUND
)
set
(
CLN_LIBRARY_DIRS
)
set
(
CLN_VERSION
)
endif
()
endif
()
if
(
CLN_LIBRARIES AND CLN_INCLUDE_DIR
)
set
(
_cln_library_dirs
)
foreach
(
_l
${
CLN_LIBRARIES
}
)
get_filename_component
(
_d
"
${
_l
}
"
PATH
)
list
(
APPEND _cln_library_dirs
"
${
_d
}
"
)
endforeach
()
list
(
REMOVE_DUPLICATES _cln_library_dirs
)
set
(
CLN_LIBRARY_DIRS
${
_cln_library_dirs
}
)
endif
()
include
(
FindPackageHandleStandardArgs
)
FIND_PACKAGE_HANDLE_STANDARD_ARGS
(
CLN REQUIRED_VARS CLN_LIBRARIES CLN_INCLUDE_DIR
VERSION_VAR CLN_VERSION
)
cmake/Modules/FindElementaryUtils.cmake
View file @
e5ca0f60
...
...
@@ -36,7 +36,7 @@ else (ElementaryUtils_INCLUDE_DIR AND ElementaryUtils_LIBRARIES)
PATH_SUFFIXES lib/PARTONS lib64/PARTONS bin/PARTONS lib lib64 bin
)
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
ElementaryUtils DEFAULT_MSG
ElementaryUtils_INCLUDE_DIR
ElementaryUtils_LIBRARIES
)
find_package_handle_standard_args
(
ElementaryUtils DEFAULT_MSG ElementaryUtils_LIBRARIES
)
endif
(
ElementaryUtils_INCLUDE_DIR AND ElementaryUtils_LIBRARIES
)
cmake/Modules/FindLHAPDF.cmake
0 → 100644
View file @
e5ca0f60
# LHAPDF
find_program
(
LHAPDF_CONFIG lhapdf-config REQUIRED
)
if
(
LHAPDF_CONFIG
)
exec_program
(
${
LHAPDF_CONFIG
}
ARGS --cppflags
OUTPUT_VARIABLE LHAPDF_CXX_FLAGS
)
set
(
LHAPDF_CXX_FLAGS
${
LHAPDF_CXX_FLAGS
}
CACHE STRING INTERNAL
)
exec_program
(
${
LHAPDF_CONFIG
}
ARGS --ldflags
OUTPUT_VARIABLE LHAPDF_LIBRARIES
)
set
(
LHAPDF_LIBRARIES
${
LHAPDF_LIBRARIES
}
CACHE STRING INTERNAL
)
exec_program
(
${
LHAPDF_CONFIG
}
ARGS --version
OUTPUT_VARIABLE LHAPDF_VERSION
)
set
(
LHAPDF_VERSION
${
LHAPDF_VERSION
}
CACHE STRING INTERNAL
)
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
LHAPDF REQUIRED_VARS LHAPDF_LIBRARIES VERSION_VAR LHAPDF_VERSION
)
endif
(
LHAPDF_CONFIG
)
cmake/Modules/FindNumA++.cmake
View file @
e5ca0f60
...
...
@@ -40,7 +40,7 @@ else (NumA++_INCLUDE_DIR AND NumA++_LIBRARIES)
PATH_SUFFIXES lib/PARTONS lib64/PARTONS bin/PARTONS lib lib64 bin
)
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
NumA++ DEFAULT_MSG
NumA++_INCLUDE_DIR
NumA++_LIBRARIES
)
find_package_handle_standard_args
(
NumA++ DEFAULT_MSG NumA++_LIBRARIES
)
endif
(
NumA++_INCLUDE_DIR AND NumA++_LIBRARIES
)
cmake/Modules/FindSFML.cmake
View file @
e5ca0f60
...
...
@@ -365,5 +365,7 @@ endif()
# handle success
if
(
SFML_FOUND AND NOT SFML_FIND_QUIETLY
)
message
(
STATUS
"Found SFML
${
SFML_VERSION_MAJOR
}
.
${
SFML_VERSION_MINOR
}
.
${
SFML_VERSION_PATCH
}
in
${
SFML_INCLUDE_DIR
}
"
)
include
(
FindPackageHandleStandardArgs
)
find_package_handle_standard_args
(
SFML REQUIRED_VARS SFML_LIBRARIES VERSION_VAR SFML_VERSION_MINOR
)
endif
()
set
(
SFML_VERSION
"
${
SFML_VERSION_MAJOR
}
-
${
SFML_VERSION_MINOR
}
-
${
SFML_VERSION_PATCH
}
"
)
\ No newline at end of file
src/examples.cpp
View file @
e5ca0f60
...
...
@@ -26,7 +26,7 @@
#include <partons/modules/gpd/GPDGK16Numerical.h>
#include <partons/modules/gpd/GPDGK19.h>
#include <partons/modules/observable/DVCS/asymmetry/DVCSAllMinus.h>
#include <partons/modules/observable/DVMP/cross_section/DVMPCrossSectionUUMinus
Pi0
.h>
#include <partons/modules/observable/DVMP/cross_section/DVMPCrossSectionUU
U
Minus.h>
#include <partons/modules/process/DVCS/DVCSProcessGV08.h>
#include <partons/modules/process/DVMP/DVMPProcessGK06.h>
#include <partons/modules/running_alpha_strong/RunningAlphaStrongVinnikov.h>
...
...
@@ -534,7 +534,7 @@ void computeSingleKinematicsForDVMPObservable() {
// Create Observable
PARTONS
::
DVMPObservable
*
pObservable
=
PARTONS
::
Partons
::
getInstance
()
->
getModuleObjectFactory
()
->
newDVMPObservable
(
PARTONS
::
DVMPCrossSectionUUMinus
Pi0
::
classId
);
PARTONS
::
DVMPCrossSectionUU
U
Minus
::
classId
);
// Link modules (set physics assumptions of your computation)
pObservable
->
setProcessModule
(
pProcessModule
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment