Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Start using fmt for cleaner code #2859

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@
[submodule "external/eigen"]
path = external/eigen
url = https://gitlab.com/libeigen/eigen.git
[submodule "external/fmt"]
path = external/fmt
url = https://github.com/fmtlib/fmt.git
4 changes: 4 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -488,6 +488,10 @@ if(NOT NRN_ENABLE_MPI_DYNAMIC OR ${num_mpi} EQUAL 1)
set(NRN_INCLUDE_MPI_HEADERS ON)
endif()

# initialize fmt submodule
cpp_cc_git_submodule(fmt BUILD PACKAGE fmt REQUIRED)
set_property(TARGET fmt PROPERTY POSITION_INDEPENDENT_CODE ON)

# initialize CLI11 submodule
cpp_cc_git_submodule(CLI11 BUILD PACKAGE CLI11 REQUIRED)

Expand Down
1 change: 1 addition & 0 deletions external/fmt
Submodule fmt added at cf1f55
17 changes: 8 additions & 9 deletions src/ivoc/nrnsymdiritem.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@

class SymbolItem {
public:
SymbolItem(const char*, int whole_array = 0);
SymbolItem(std::string&&, int whole_array = 0);
SymbolItem(Symbol*, Objectdata*, int index = 0, int whole_array = 0);
SymbolItem(Object*);
~SymbolItem();
Symbol* symbol() const {
return symbol_;
}
Expand All @@ -23,14 +22,14 @@ class SymbolItem {
return index_;
}
int whole_vector();
int pysec_type_; /* PYSECOBJ (cell prefix) or PYSECNAME (Section) */
void* pysec_; /* Name2Section* or Section* */
int pysec_type_ = 0; /* PYSECOBJ (cell prefix) or PYSECNAME (Section) */
void* pysec_ = nullptr; /* Name2Section* or Section* */
private:
std::string name_;
Symbol* symbol_;
int index_;
Object* ob_;
int whole_array_;
std::string name_{};
Symbol* symbol_ = nullptr;
int index_ = 0;
Object* ob_ = nullptr;
int whole_array_ = 0;
};

void nrn_symdir_load_pysec(std::vector<SymbolItem*>& sl, void*);
1 change: 1 addition & 0 deletions src/nrniv/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -410,6 +410,7 @@ include_directories(${NRN_INCLUDE_DIRS})
add_library(nrniv_lib ${NRN_LIBRARY_TYPE} ${NRN_NRNIV_LIB_SRC_FILES})
target_link_libraries(nrniv_lib nrngnu)
target_link_libraries(nrniv_lib sparse13)
target_link_libraries(nrniv_lib fmt::fmt)
target_include_directories(nrniv_lib SYSTEM PUBLIC ${PROJECT_SOURCE_DIR}/${NRN_3RDPARTY_DIR}/eigen)
cpp_cc_configure_sanitizers(TARGET nrniv_lib)
# Source-directory .cpp needs to find generated .hpp.
Expand Down