Skip to content

Commit

Permalink
Pitchforkize config (#4557)
Browse files Browse the repository at this point in the history
Partially fixes #4554

Description of changes:
- introduce ``include`` and ``src`` directory in ``src/config``
  • Loading branch information
kodiakhq[bot] authored Aug 24, 2022
2 parents 56d9048 + d579983 commit 1c07aa0
Show file tree
Hide file tree
Showing 243 changed files with 272 additions and 260 deletions.
4 changes: 2 additions & 2 deletions cmake/MyConfig.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ if(NOT MYCONFIG_FILE)
endif()

configure_file(${MYCONFIG_FILE}
${CMAKE_BINARY_DIR}/src/config/myconfig-final.hpp COPYONLY)
${CMAKE_BINARY_DIR}/src/config/include/config/myconfig-final.hpp COPYONLY)
add_custom_target(myconfig
DEPENDS ${CMAKE_BINARY_DIR}/src/config/myconfig-final.hpp)
DEPENDS ${CMAKE_BINARY_DIR}/src/config/include/config/myconfig-final.hpp)
message(STATUS "Config file: ${MYCONFIG_FILE}")
# Clear variable, otherwise cmake must be run by hand to detect myconfig.
# Also prevents find_file from skipping when variable is already set.
Expand Down
8 changes: 5 additions & 3 deletions cmake/version.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ if(GIT_EXECUTABLE)

endif(GIT_EXECUTABLE)

configure_file(${PROJECT_SOURCE_DIR}/src/config/version.hpp.in version.hpp.tmp)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different version.hpp.tmp
version.hpp)
configure_file(${PROJECT_SOURCE_DIR}/src/config/include/config/version.hpp.in
${CMAKE_BINARY_DIR}/include/config/version.hpp.tmp)
execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_BINARY_DIR}/include/config/version.hpp.tmp
${CMAKE_BINARY_DIR}/include/config/version.hpp)
34 changes: 21 additions & 13 deletions src/config/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,44 +17,50 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#

configure_file(${CMAKE_SOURCE_DIR}/cmake/cmake_config.cmakein cmake_config.hpp)
add_subdirectory(include/config)
add_subdirectory(src)

configure_file(${CMAKE_SOURCE_DIR}/cmake/cmake_config.cmakein
${CMAKE_CURRENT_BINARY_DIR}/include/config/cmake_config.hpp)

add_custom_command(
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/config-features.hpp
${CMAKE_CURRENT_BINARY_DIR}/config-features.cpp
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/include/config/config-features.hpp
${CMAKE_CURRENT_BINARY_DIR}/src/config-features.cpp
COMMAND
${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gen_featureconfig.py
${CMAKE_CURRENT_SOURCE_DIR}/features.def
${CMAKE_CURRENT_BINARY_DIR}/config-features.hpp
${CMAKE_CURRENT_BINARY_DIR}/config-features.cpp
${CMAKE_CURRENT_BINARY_DIR}/include/config/config-features.hpp
${CMAKE_CURRENT_BINARY_DIR}/src/config-features.cpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/features.def
${CMAKE_CURRENT_SOURCE_DIR}/gen_featureconfig.py)
add_custom_target(
generate_config_features
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/config-features.hpp
${CMAKE_CURRENT_BINARY_DIR}/config-features.cpp)
DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/include/config/config-features.hpp
${CMAKE_CURRENT_BINARY_DIR}/src/config-features.cpp)

add_custom_target(
check_myconfig
COMMAND
${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/check_myconfig.py
${CMAKE_CXX_COMPILER} ${CMAKE_CURRENT_SOURCE_DIR}/features.def
${CMAKE_CURRENT_BINARY_DIR}/myconfig-final.hpp cmake_config.hpp
${CMAKE_CURRENT_BINARY_DIR}/include/config/myconfig-final.hpp
${CMAKE_CURRENT_BINARY_DIR}/include/config/cmake_config.hpp
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/features.def myconfig)

execute_process(
COMMAND ${Python_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/gen_sampleconfig.py
${CMAKE_CURRENT_SOURCE_DIR}/features.def
OUTPUT_FILE ${CMAKE_BINARY_DIR}/myconfig-sample.hpp)

add_library(espresso_config SHARED config-features.cpp)
add_library(espresso_config SHARED src/config-features.cpp)
add_library(espresso::config ALIAS espresso_config)
add_dependencies(espresso_config myconfig check_myconfig
generate_config_features)
install(TARGETS espresso_config
LIBRARY DESTINATION ${ESPRESSO_INSTALL_PYTHON}/espressomd)
target_include_directories(espresso_config PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR})
target_include_directories(
espresso_config PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/include
${CMAKE_CURRENT_BINARY_DIR}/include)

find_package(Git)
# Parse repository info from git if available Run this at build time to avoid
Expand All @@ -66,6 +72,8 @@ add_custom_target(
-DPROJECT_VERSION=${PROJECT_VERSION} -DGIT_EXECUTABLE=${GIT_EXECUTABLE}
-DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} -P
${PROJECT_SOURCE_DIR}/cmake/version.cmake)
set_property(DIRECTORY APPEND PROPERTY ADDITIONAL_MAKE_CLEAN_FILES version.hpp
version.hpp.tmp)
set_property(
DIRECTORY APPEND
PROPERTY ADDITIONAL_MAKE_CLEAN_FILES include/config/version.hpp
include/config/version.hpp.tmp)
add_dependencies(espresso_config version)
10 changes: 5 additions & 5 deletions src/config/gen_featureconfig.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@
/* Handle definitions from CMake */
/*********************************/
#include "cmake_config.hpp"
#include "myconfig-final.hpp"
#include "config/cmake_config.hpp"
#include "config/myconfig-final.hpp"
""")
external_template = string.Template("""
// $feature is external
Expand All @@ -75,7 +75,7 @@

# Include definitions from CMake
hfile.write("""
#include "cmake_config.hpp"
#include "config/cmake_config.hpp"
""")

Expand Down Expand Up @@ -132,8 +132,8 @@

cfile.write(disclaimer)
cfile.write(f"""
#include "config-features.hpp"
#include "config.hpp"
#include "config/config-features.hpp"
#include "config/config.hpp"
/***********************/
/* Handle requirements */
Expand Down
1 change: 1 addition & 0 deletions src/config/include/config/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
#define MPICH_SKIP_MPICXX
#endif

#include "config-features.hpp"
#include "config/config-features.hpp"

/** P3M: Default for offset of first mesh point from the origin (left
* down corner of the simulation box).
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions src/config/src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

2 changes: 1 addition & 1 deletion src/core/EspressoSystemInterface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
#define ESPRESSOSYSTEMINTERFACE_H

#include "SystemInterface.hpp"
#include "config.hpp"
#include "config/config.hpp"
#include "cuda_interface.hpp"

#include <utils/Vector.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/core/EspressoSystemStandAlone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "config.hpp"
#include "config/config.hpp"

#include "EspressoSystemStandAlone.hpp"
#include "MpiCallbacks.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/core/Observable_stat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

#include "Observable_stat.hpp"

#include "config.hpp"
#include "config/config.hpp"

#include "bonded_interactions/bonded_interaction_data.hpp"
#include "communication.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/core/Particle.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef ESPRESSO_CORE_PARTICLE_HPP
#define ESPRESSO_CORE_PARTICLE_HPP

#include "config.hpp"
#include "config/config.hpp"

#include "BondList.hpp"

Expand Down
2 changes: 1 addition & 1 deletion src/core/SystemInterface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "SystemInterface.hpp"
#include "config.hpp"
#include "config/config.hpp"
2 changes: 1 addition & 1 deletion src/core/SystemInterface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef SYSTEMINTERFACE_H
#define SYSTEMINTERFACE_H

#include "config.hpp"
#include "config/config.hpp"

#include <utils/Vector.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/core/bonded_interactions/angle_common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Common code for functions calculating angle forces.
*/

#include "config.hpp"
#include "config/config.hpp"
#include "grid.hpp"

#include <utils/Vector.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/core/bonded_interactions/bonded_coulomb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* particle pairs.
*/

#include "config.hpp"
#include "config/config.hpp"

#include <utils/Vector.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/core/bonded_interactions/bonded_coulomb_sr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* interactions in combination with Thole damping.
*/

#include "config.hpp"
#include "config/config.hpp"

#include "Particle.hpp"

Expand Down
2 changes: 1 addition & 1 deletion src/core/bonded_interactions/bonded_tab.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Implementation in \ref bonded_tab.cpp.
*/

#include "config.hpp"
#include "config/config.hpp"

#include "TabulatedPotential.hpp"
#include "angle_common.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/core/bonded_interactions/dihedral.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
*/

#include "BoxGeometry.hpp"
#include "config.hpp"
#include "config/config.hpp"
#include "grid.hpp"

#include <utils/Vector.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/core/bonded_interactions/fene.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* Implementation in \ref fene.cpp.
*/

#include "config.hpp"
#include "config/config.hpp"
#include "errorhandling.hpp"

#include <utils/Vector.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/core/bonded_interactions/harmonic.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
* Routines to calculate the harmonic bond potential between particle pairs.
*/

#include "config.hpp"
#include "config/config.hpp"
#include "errorhandling.hpp"

#include <utils/Vector.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/core/cell_system/CellStructure.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
#include "bond_error.hpp"
#include "cell_system/Cell.hpp"
#include "cell_system/CellStructureType.hpp"
#include "config.hpp"
#include "config/config.hpp"
#include "ghosts.hpp"

#include <utils/math/sqr.hpp>
Expand Down
2 changes: 1 addition & 1 deletion src/core/cluster_analysis/Cluster.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "config.hpp"
#include "config/config.hpp"

#ifdef GSL
#include "gsl/gsl_fit.h"
Expand Down
2 changes: 1 addition & 1 deletion src/core/collision.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef CORE_COLLISION_HPP
#define CORE_COLLISION_HPP

#include "config.hpp"
#include "config/config.hpp"

#include "BondList.hpp"
#include "Particle.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/core/constraints/HomogeneousMagneticField.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

#include "Observable_stat.hpp"
#include "Particle.hpp"
#include "config.hpp"
#include "config/config.hpp"

#include <utils/Vector.hpp>

Expand Down
2 changes: 1 addition & 1 deletion src/core/constraints/ShapeBasedConstraint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
#include "BoxGeometry.hpp"
#include "Observable_stat.hpp"
#include "communication.hpp"
#include "config.hpp"
#include "config/config.hpp"
#include "dpd.hpp"
#include "energy_inline.hpp"
#include "errorhandling.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/core/cuda_common_cuda.cu
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#include "config.hpp"
#include "config/config.hpp"

#include "ParticleRange.hpp"
#include "cuda_init.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/core/cuda_init.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "config.hpp"
#include "config/config.hpp"

#ifdef CUDA

Expand Down
2 changes: 1 addition & 1 deletion src/core/cuda_init.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef CORE_CUDA_INIT_H
#define CORE_CUDA_INIT_H

#include "config.hpp"
#include "config/config.hpp"

#ifdef CUDA

Expand Down
2 changes: 1 addition & 1 deletion src/core/cuda_interface.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@

#include "EspressoSystemInterface.hpp"
#include "communication.hpp"
#include "config.hpp"
#include "config/config.hpp"
#include "grid.hpp"
#include "nonbonded_interactions/nonbonded_interaction_data.hpp"
#include "serialization/CUDA_particle_data.hpp"
Expand Down
2 changes: 1 addition & 1 deletion src/core/cuda_interface.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef CORE_CUDA_INTERFACE_HPP
#define CORE_CUDA_INTERFACE_HPP

#include "config.hpp"
#include "config/config.hpp"

#ifdef CUDA

Expand Down
2 changes: 1 addition & 1 deletion src/core/cuda_utils.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef CORE_CUDA_UTILS_HPP
#define CORE_CUDA_UTILS_HPP

#include "config.hpp"
#include "config/config.hpp"

#ifdef CUDA

Expand Down
2 changes: 1 addition & 1 deletion src/core/dpd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
/** \file
* Implementation of dpd.hpp.
*/
#include "config.hpp"
#include "config/config.hpp"

#ifdef DPD

Expand Down
2 changes: 1 addition & 1 deletion src/core/dpd.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
* Implementation in @ref dpd.cpp.
*/

#include "config.hpp"
#include "config/config.hpp"

#ifdef DPD

Expand Down
2 changes: 1 addition & 1 deletion src/core/electrostatics/actor.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef ESPRESSO_SRC_CORE_ELECTROSTATICS_ACTOR_HPP
#define ESPRESSO_SRC_CORE_ELECTROSTATICS_ACTOR_HPP

#include "config.hpp"
#include "config/config.hpp"

#ifdef ELECTROSTATICS

Expand Down
2 changes: 1 addition & 1 deletion src/core/electrostatics/coulomb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/

#include "config.hpp"
#include "config/config.hpp"

#ifdef ELECTROSTATICS

Expand Down
2 changes: 1 addition & 1 deletion src/core/electrostatics/coulomb.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#ifndef ESPRESSO_SRC_CORE_ELECTROSTATICS_COULOMB_HPP
#define ESPRESSO_SRC_CORE_ELECTROSTATICS_COULOMB_HPP

#include "config.hpp"
#include "config/config.hpp"

#ifdef ELECTROSTATICS

Expand Down
Loading

0 comments on commit 1c07aa0

Please sign in to comment.