-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathCMakeLists.txt
213 lines (178 loc) · 10.9 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
cmake_minimum_required( VERSION 3.6 )
include(CMakeScripts/ConfigEnv.cmake)
include(FindPkgConfig)
list( APPEND CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/CMakeScripts" )
# set a default build configuration
set(CMAKE_BUILD_TYPE_INIT "Release")
# Allow the version to be set in the project command
cmake_policy(SET CMP0048 NEW)
# Define project metadata
# Use even minor-version numbers (e.g., 1.6.x) for development versions
# Use odd minor-version numbers (e.g., 1.7.x) for "stable" releases
project(qwwad
VERSION 1.6
)
# Define user-configurable build options
option(VERBOSE "Show information about CMake build configuration.")
option(CMAKE_RUN_CLANG_TIDY "Run clang-tidy with the compiler." OFF)
option(BUILD_MANPAGES "Build the Linux manual pages from source." OFF)
# Clang-tidy handling snipped from Horishi Miura
# http://gitlab.kitware.com/cmake/cmake/-/issues/18926/
if(CMAKE_RUN_CLANG_TIDY)
message("Trying to configure clang-tidy")
if(CMAKE_SOURCE_DIR STREQUAL CMAKE_BINARY_DIR)
message(FATAL_ERROR "CMAKE_RUN_CLANG_TIDY requires an out-of-source build!")
endif()
find_program(CLANG_TIDY_COMMAND NAMES clang-tidy)
if(NOT CLANG_TIDY_COMMAND)
message(WARNING "CMake_RUN_CLANG_TIDY is ON but clang-tidy is not found!")
set(CMAKE_CXX_CLANG_TIDY "" CACHE STRING "" FORCE)
else()
set(CLANG_TIDY_CHECKS "-*,bugprone-*,misc-*,modernize-*,readability-*,-readability-magic-numbers,performance-*")
message("Configuring clang-tidy using ${CLANG_TIDY_COMMAND}")
set(CMAKE_CXX_CLANG_TIDY "${CLANG_TIDY_COMMAND};-checks=${CLANG_TIDY_CHECKS};-header-filter='${CMAKE_SOURCE_DIR}/src/*'")
endif()
# Create a preprocessor definition that depends on .clang-tidy content so
# the compile command will change when .clang-tidy changes. This ensures
# that a subsequent build re-runs clang-tidy on all sources even if they
# do not otherwise need to be recompiled. Nothing actually uses this
# definition. We add it to targets on which we run clang-tidy just to
# get the build dependency on the .clang-tidy file.
file(SHA1 ${CMAKE_CURRENT_SOURCE_DIR}/.clang-tidy clang_tidy_sha1)
set(CLANG_TIDY_DEFINITIONS "CLANG_TIDY_SHA1=${clang_tidy_sha1}")
unset(clang_tidy_sha1)
else()
message("Not using clang-tidy")
endif()
configure_file(.clang-tidy .clang-tidy COPYONLY)
message("-- Building ${PROJECT_NAME} version: ${qwwad_VERSION}")
set( QWWAD_URL "https://launchpad.net/qwwad" )
set( QWWAD_BUGREPORT "https://bugs.launchpad.net/qwwad" )
set(gtest_inc_path ${CMAKE_SOURCE_DIR}/src/googletest/googletest/include/)
# Only enable testing if the googletest submodule has been included
if(EXISTS ${gtest_inc_path})
add_custom_target( check COMMAND ${CMAKE_CTEST_COMMAND} -V -V)
enable_testing()
include_directories(${gtest_inc_path})
else()
message(WARNING "Cannot find Googletest folder")
endif()
# Enable C++11 builds
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
# Define minimum versions of dependencies here
set(ARMADILLO_REQUIRED_VERSION 4.000)
set(BOOST_REQUIRED_VERSION 1.42)
set(LIBXMLPP_REQUIRED_VERSION 2.30)
include_directories(src ${CMAKE_CURRENT_BINARY_DIR})
# Check that required libraries are available
find_package( Armadillo ${ARMADILLO_REQUIRED_VERSION} REQUIRED )
find_package( Boost ${BOOST_REQUIRED_VERSION}
COMPONENTS program_options
REQUIRED )
find_package( GSL REQUIRED )
find_package( LAPACK REQUIRED )
pkg_check_modules( LIBXMLPP REQUIRED "libxml++-2.6 >= ${LIBXMLPP_REQUIRED_VERSION}" )
include_directories(SYSTEM ${LIBXMLPP_INCLUDE_DIRS})
if(EXISTS ${gtest_inc_path})
include( CMakeScripts/make_check_macros.cmake )
endif()
# Create and install pkg-config file to help 3rd party programs discover the QWWAD
# library
if(VERBOSE)
message("Generating pkg-config file")
endif()
configure_file( ${CMAKE_SOURCE_DIR}/qwwad.pc.cmake ${CMAKE_BINARY_DIR}/qwwad.pc @ONLY )
install(FILES ${CMAKE_BINARY_DIR}/qwwad.pc DESTINATION share/pkgconfig)
# Create a shared header with platform-specific config data. This is only used during
# building, and isn't intended to be installed
if( VERBOSE )
message( "Generating config.h" )
endif()
configure_file( ${CMAKE_SOURCE_DIR}/config.h.cmake ${CMAKE_BINARY_DIR}/config.h )
include_directories( ${CMAKE_BINARY_DIR} )
add_definitions( -DHAVE_CONFIG_H )
if( VERBOSE )
message( "Adding folders to build:" )
endif()
# A function to simplify building and installing QWWAD programs
macro(add_qwwad_program program_name description)
list(APPEND qwwad_programs ${program_name})
list(APPEND qwwad_program_descriptions ${description})
endmacro(add_qwwad_program)
# Define a list of all QWWAD programs, and their descriptions here
add_qwwad_program(qwwad_charge_density "charge density in a heterostructure")
add_qwwad_program(qwwad_cs_single_spiral "atomic positions in single-spiral of zinc blende crystal")
add_qwwad_program(qwwad_cs_zinc_blende "atomic positions in a zinc blende crystal")
add_qwwad_program(qwwad_density_of_states "density of states in 1D, 2D and 3D systems")
# add_qwwad_program(qwwad_diffuse "solve diffusion equation for a nominal heterostructure")
add_qwwad_program(qwwad_ef_band_edge "band-edge potential for a heterostructure")
# add_qwwad_program(qwwad_ef_cylindrical_wire "eigenstates for a cylindrical quantum wire")
# add_qwwad_program(qwwad_ef_cylindrical_wire_wf "eigenstates for a cylindrical quantum wire (wave functions)")
add_qwwad_program(qwwad_ef_dispersion "dispersion relation for a set of energy subbands")
add_qwwad_program(qwwad_ef_donor_generic "eigenstates for a donor in a heterostructure (generic search)")
add_qwwad_program(qwwad_ef_donor_specific "eigenstates for a donor in a heterostructure (specific form-factor)")
# add_qwwad_program(qwwad_ef_exciton "eigenstates for an exciton in a heterostructure")
add_qwwad_program(qwwad_ef_generic "eigenstates in a generic heterostructure")
add_qwwad_program(qwwad_ef_infinite_well "eigenstates in an infinite quantum well")
add_qwwad_program(qwwad_ef_infinite_wire "eigenstates in an infinite quantum wire")
add_qwwad_program(qwwad_ef_parabolic_well "eigenstates in a parabolic well")
add_qwwad_program(qwwad_ef_plot "translate wavefunction data into plottable form")
add_qwwad_program(qwwad_ef_plot_3d "generate 3D wavefunction plotting script for MATLAB")
add_qwwad_program(qwwad_ef_poeschl_teller "eigenstates in a Poeschl-Teller well")
# add_qwwad_program(qwwad_ef_spherical_dot "eigenstates in a spherical quantum dot")
# add_qwwad_program(qwwad_ef_spherical_dot_wf "eigenstates in a spherical quantum dot (wavefunctions)")
add_qwwad_program(qwwad_ef_square_well "eigenstates in a finite square quantum well")
add_qwwad_program(qwwad_ef_superlattice "eigenstates of a Kronig-Penney superlattice")
add_qwwad_program(qwwad_ef_zeeman "Zeeman-splitting contribution to potential profile")
add_qwwad_program(qwwad_fermi_distribution "Fermi-Dirac distributions for a set of subbands")
add_qwwad_program(qwwad_material_property "look up property for a given material")
add_qwwad_program(qwwad_mesh "generate 1D mesh for numerical simulations")
add_qwwad_program(qwwad_poisson "space-charge potential from Poission equation")
add_qwwad_program(qwwad_population_init "initial estimate of subband populations")
# add_qwwad_program(qwwad_pp_charge_density "charge-density from pseudopotential calculations")
# add_qwwad_program(qwwad_pp_dispersion "dispersion relation from pseudopotential calculations")
# add_qwwad_program(qwwad_pp_form_factor "form-factor for pseudopotential calculations")
# add_qwwad_program(qwwad_pp_large_basis "large-basis pseudopotential calculation")
# add_qwwad_program(qwwad_pp_large_basis_so "large-basis pseudopotential calculation with spin-orbit splitting")
# add_qwwad_program(qwwad_pp_lattice_vector_table "sort reciprocal lattice vectors in acending magnitude")
# add_qwwad_program(qwwad_pp_superlattice "pseudopotential calculation of states in superlattice")
# add_qwwad_program(qwwad_reciprocal_fcc "reciprocal lattice vectors for FCC crystal")
# add_qwwad_program(qwwad_reciprocal_cube "reciprocal lattice vectors for simple cubic crystal")
# add_qwwad_program(qwwad_reciprocal_single_spiral "reciprocal lattice vectors for single spiral of FCC crystal")
add_qwwad_program(qwwad_specific_heat_capacity "specific heat capacity")
# add_qwwad_program(qwwad_spin_flip_raman "spin-flip Raman spectrum")
add_qwwad_program(qwwad_sr_acoustic_phonon "acoustic phonon scattering rate")
add_qwwad_program(qwwad_sr_alloy_disorder "alloy disorder scattering rate")
add_qwwad_program(qwwad_sr_carrier_carrier "carrier-carrier scattering rate")
add_qwwad_program(qwwad_sr_interface_roughness "interface roughness scattering rate")
add_qwwad_program(qwwad_sr_impurity "impurity scattering rate")
add_qwwad_program(qwwad_sr_lo_phonon "LO-phonon scattering rate")
# add_qwwad_program(qwwad_sr_radiative "radiative scattering rate")
add_qwwad_program(qwwad_superlattice_k "wave-vectors for superlattice pseudopotential model")
add_qwwad_program(qwwad_thermal_1d "temperature profile using a 1D numerical simulation")
add_qwwad_program(qwwad_thermal_rc "temperature profile using a 1D R-C model")
add_qwwad_program(qwwad_tx_double_barrier "transmission through a double barrier")
add_qwwad_program(qwwad_tx_double_barrier_iv "current-voltage relation for a double barrier")
add_qwwad_program(qwwad_tx_single_barrier "transmission through a single barrier")
add_qwwad_program(qwwad_uncertainty "uncertainty product for position and momentum")
add_qwwad_program(qwwad_critical_thickness "critical thickness for a strained film")
add_subdirectory( src )
add_subdirectory( doc )
add_subdirectory( examples )
# Configure tarball packaging
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Quantum wells, wires and dots")
set(CPACK_PACKAGE_VENDOR "Alexander Valavanis and Paul Harrison")
set(CPACK_GENERATOR "TGZ")
set(CPACK_SOURCE_GENERATOR "TGZ")
set(CPACK_PACKAGE_DESCRIPTION_FILE "${CMAKE_SOURCE_DIR}/README")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/COPYING")
set(CPACK_PACKAGE_VERSION "${qwwad_VERSION}")
set(CPACK_PACKAGE_VERSION_MAJOR "${qwwad_VERSION_MAJOR}")
set(CPACK_PACKAGE_VERSION_MINOR "${qwwad_VERSION_MINOR}")
set(CPACK_PACKAGE_VERSION_PATCH "${qwwad_VERSION_PATCH}")
set(CPACK_PACKAGE_NAME "${PROJECT_NAME}")
set(CPACK_SOURCE_PACKAGE_FILE_NAME "${CPACK_PACKAGE_NAME}-${CPACK_PACKAGE_VERSION}")
include(CPack)
message("CMAKE_INSTALL_PREFIX: ${CMAKE_INSTALL_PREFIX}")
message("CMAKE_INSTALL_LIBDIR: ${CMAKE_INSTALL_LIBDIR}")