Skip to content

Commit

Permalink
Build src/gnu as its own library
Browse files Browse the repository at this point in the history
Format
  • Loading branch information
alkino committed Jun 19, 2023
1 parent f21fd8d commit 4fc6ad8
Show file tree
Hide file tree
Showing 36 changed files with 67 additions and 92 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -567,6 +567,7 @@ endif()
# =============================================================================
# Add project directories AFTER CMake modules
# =============================================================================
add_subdirectory(src/gnu)
add_subdirectory(src/nrniv)

# Collect the environment variables that are needed to execute NEURON from the build directory. This
Expand Down
19 changes: 0 additions & 19 deletions cmake/NeuronFileLists.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -444,24 +444,6 @@ set(SCOPMATH_FILES_LIST

set(NRNMPI_FILES_LIST nrnmpi.cpp bbsmpipack.cpp mpispike.cpp)

set(NRNGNU_FILES_LIST
ACG.cpp
Binomial.cpp
DiscUnif.cpp
Erlang.cpp
Geom.cpp
HypGeom.cpp
LogNorm.cpp
MLCG.cpp
NegExp.cpp
Normal.cpp
Poisson.cpp
RNG.cpp
Random.cpp
RndInt.cpp
Uniform.cpp
Weibull.cpp)

# nrnpython sources (only if ${NRN_ENABLE_PYTHON_DYNAMIC} is OFF}
set(NRNPYTHON_FILES_LIST
nrnpython.cpp
Expand Down Expand Up @@ -570,7 +552,6 @@ nrn_create_file_list(NRN_SPARSE13_SRC_FILES ${PROJECT_SOURCE_DIR}/src/sparse13
nrn_create_file_list(NRN_SCOPMATH_SRC_FILES ${PROJECT_SOURCE_DIR}/src/scopmath
${SCOPMATH_FILES_LIST})
nrn_create_file_list(NRN_NRNMPI_SRC_FILES ${PROJECT_SOURCE_DIR}/src/nrnmpi ${NRNMPI_FILES_LIST})
nrn_create_file_list(NRN_NRNGNU_SRC_FILES ${PROJECT_SOURCE_DIR}/src/gnu ${NRNGNU_FILES_LIST})
nrn_create_file_list(NRN_NRNPYTHON_SRC_FILES ${PROJECT_SOURCE_DIR}/src/nrnpython
${NRNPYTHON_FILES_LIST})
nrn_create_file_list(NRN_MODFILE_BASE_NAMES src/nrnoc ${MODFILE_BASE_NAMES})
Expand Down
3 changes: 1 addition & 2 deletions src/gnu/ACG.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <../../nrnconf.h>
// This may look like C code, but it is really -*- C++ -*-
/*
Copyright (C) 1989 Free Software Foundation
Expand All @@ -20,7 +19,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifdef __GNUG__
#pragma implementation
#endif
#include <ACG.h>
#include "ACG.h"
#include <assert.h>

//
Expand Down
2 changes: 1 addition & 1 deletion src/gnu/ACG.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#ifndef _ACG_h
#define _ACG_h 1

#include <RNG.h>
#include "RNG.h"
#include <math.h>
#ifdef __GNUG__
//#pragma interface
Expand Down
5 changes: 2 additions & 3 deletions src/gnu/Binomial.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <../../nrnconf.h>
/*
Copyright (C) 1988 Free Software Foundation
written by Dirk Grunwald (grunwald@cs.uiuc.edu)
Expand All @@ -18,8 +17,8 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#ifdef __GNUG__
#pragma implementation
#endif
#include <Random.h>
#include <Binomial.h>
#include "Random.h"
#include "Binomial.h"

double Binomial::operator()()
{
Expand Down
2 changes: 1 addition & 1 deletion src/gnu/Binomial.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#endif
#define _Binomial_h 1

#include <Random.h>
#include "Random.h"

class Binomial: public Random {
protected:
Expand Down
19 changes: 19 additions & 0 deletions src/gnu/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
add_library(
nrngnu STATIC
ACG.cpp
Binomial.cpp
DiscUnif.cpp
Erlang.cpp
Geom.cpp
HypGeom.cpp
LogNorm.cpp
MLCG.cpp
NegExp.cpp
Normal.cpp
Poisson.cpp
Random.cpp
RndInt.cpp
RNG.cpp
Uniform.cpp
Weibull.cpp)
set_property(TARGET nrngnu PROPERTY POSITION_INDEPENDENT_CODE ON)
5 changes: 2 additions & 3 deletions src/gnu/DiscUnif.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <../../nrnconf.h>
/*
Copyright (C) 1988 Free Software Foundation
written by Dirk Grunwald (grunwald@cs.uiuc.edu)
Expand All @@ -18,8 +17,8 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#ifdef __GNUG__
#pragma implementation
#endif
#include <Random.h>
#include <DiscUnif.h>
#include "Random.h"
#include "DiscUnif.h"

double DiscreteUniform::operator()()
{
Expand Down
2 changes: 1 addition & 1 deletion src/gnu/DiscUnif.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#endif
#define _DiscreteUniform_h 1

#include <Random.h>
#include "Random.h"

//
// The interval [lo..hi)
Expand Down
5 changes: 2 additions & 3 deletions src/gnu/Erlang.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <../../nrnconf.h>
/*
Copyright (C) 1988 Free Software Foundation
written by Dirk Grunwald (grunwald@cs.uiuc.edu)
Expand All @@ -18,8 +17,8 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#ifdef __GNUG__
#pragma implementation
#endif
#include <Random.h>
#include <Erlang.h>
#include "Random.h"
#include "Erlang.h"

double Erlang::operator()()
{
Expand Down
2 changes: 1 addition & 1 deletion src/gnu/Erlang.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#endif
#define _Erlang_h 1

#include <Random.h>
#include "Random.h"

class Erlang: public Random {
protected:
Expand Down
5 changes: 2 additions & 3 deletions src/gnu/Geom.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <../../nrnconf.h>
/*
Copyright (C) 1988 Free Software Foundation
written by Dirk Grunwald (grunwald@cs.uiuc.edu)
Expand All @@ -18,8 +17,8 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#ifdef __GNUG__
#pragma implementation
#endif
#include <Random.h>
#include <Geom.h>
#include "Random.h"
#include "Geom.h"

double Geometric::operator()()
{
Expand Down
2 changes: 1 addition & 1 deletion src/gnu/Geom.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#endif
#define _Geometric_h

#include <Random.h>
#include "Random.h"

class Geometric: public Random {
protected:
Expand Down
5 changes: 2 additions & 3 deletions src/gnu/HypGeom.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <../../nrnconf.h>

/*
Copyright (C) 1988 Free Software Foundation
Expand All @@ -19,8 +18,8 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#ifdef __GNUG__
#pragma implementation
#endif
#include <Random.h>
#include <HypGeom.h>
#include "Random.h"
#include "HypGeom.h"

double HyperGeometric::operator()()
{
Expand Down
2 changes: 1 addition & 1 deletion src/gnu/HypGeom.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#endif
#define _HyperGeometric_h

#include <Random.h>
#include "Random.h"

class HyperGeometric: public Random {
protected:
Expand Down
7 changes: 3 additions & 4 deletions src/gnu/LogNorm.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <../../nrnconf.h>
/*
Copyright (C) 1988 Free Software Foundation
written by Dirk Grunwald (grunwald@cs.uiuc.edu)
Expand All @@ -18,10 +17,10 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#ifdef __GNUG__
#pragma implementation
#endif
#include <Random.h>
#include <Normal.h>
#include "Random.h"
#include "Normal.h"

#include <LogNorm.h>
#include "LogNorm.h"

#ifndef M_E
#define M_E 2.71828182845904523536
Expand Down
2 changes: 1 addition & 1 deletion src/gnu/LogNorm.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#endif
#define _LogNormal_h

#include <Normal.h>
#include "Normal.h"

class LogNormal: public Normal {
protected:
Expand Down
3 changes: 1 addition & 2 deletions src/gnu/MLCG.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <../../nrnconf.h>
// This may look like C code, but it is really -*- C++ -*-
/*
Copyright (C) 1989 Free Software Foundation
Expand All @@ -18,7 +17,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#ifdef __GNUG__
#pragma implementation
#endif
#include <MLCG.h>
#include "MLCG.h"
//
// SEED_TABLE_SIZE must be a power of 2
//
Expand Down
2 changes: 1 addition & 1 deletion src/gnu/MLCG.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
//#pragma interface
#endif

#include <RNG.h>
#include "RNG.h"
#include <math.h>

//
Expand Down
5 changes: 2 additions & 3 deletions src/gnu/NegExp.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <../../nrnconf.h>
/*
Copyright (C) 1988 Free Software Foundation
written by Dirk Grunwald (grunwald@cs.uiuc.edu)
Expand All @@ -18,8 +17,8 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#ifdef __GNUG__
#pragma implementation
#endif
#include <Random.h>
#include <NegExp.h>
#include "Random.h"
#include "NegExp.h"

double NegativeExpntl::operator()()
{
Expand Down
2 changes: 1 addition & 1 deletion src/gnu/NegExp.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
//
//

#include <Random.h>
#include "Random.h"

class NegativeExpntl: public Random {
protected:
Expand Down
5 changes: 2 additions & 3 deletions src/gnu/Normal.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <../../nrnconf.h>
/*
Copyright (C) 1988 Free Software Foundation
written by Dirk Grunwald (grunwald@cs.uiuc.edu)
Expand All @@ -18,8 +17,8 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#ifdef __GNUG__
#pragma implementation
#endif
#include <Random.h>
#include <Normal.h>
#include "Random.h"
#include "Normal.h"
//
// See Simulation, Modelling & Analysis by Law & Kelton, pp259
//
Expand Down
2 changes: 1 addition & 1 deletion src/gnu/Normal.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#endif
#define _Normal_h

#include <Random.h>
#include "Random.h"

class Normal: public Random {
char haveCachedNormal;
Expand Down
6 changes: 2 additions & 4 deletions src/gnu/Poisson.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#include <../../nrnconf.h>

/*
Copyright (C) 1988 Free Software Foundation
written by Dirk Grunwald (grunwald@cs.uiuc.edu)
Expand All @@ -19,8 +17,8 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#ifdef __GNUG__
#pragma implementation
#endif
#include <Random.h>
#include <Poisson.h>
#include "Random.h"
#include "Poisson.h"

double Poisson::operator()()
{
Expand Down
2 changes: 1 addition & 1 deletion src/gnu/Poisson.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#endif
#define _Poisson_h

#include <Random.h>
#include "Random.h"

class Poisson: public Random {
protected:
Expand Down
3 changes: 1 addition & 2 deletions src/gnu/RNG.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include <../../nrnconf.h>
// This may look like C code, but it is really -*- C++ -*-
/*
Copyright (C) 1989 Free Software Foundation
Expand All @@ -19,7 +18,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
#pragma implementation
#endif
#include <assert.h>
#include <RNG.h>
#include "RNG.h"

// These two static fields get initialized by RNG::RNG().
PrivateRNGSingleType RNG::singleMantissa;
Expand Down
15 changes: 3 additions & 12 deletions src/gnu/RNG.h
Original file line number Diff line number Diff line change
Expand Up @@ -26,18 +26,9 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
* int32_t and uint32_t have been defined by the configure procedure. Just
* use these in place of the ones that libg++ used to provide.
*/
#if defined(HAVE_INTTYPES_H)
#include <inttypes.h>
#elif defined(HAVE_SYS_TYPES_H)
#include <sys/types.h>
#elif defined(HAVE__G_CONFIG_H)
#include <_G_config.h>
typedef _G_int32_t int32_t;
typedef _G_uint32_t uint32_t;
#endif

#include <assert.h>
#include <math.h>
#include <cstdint>
#include <cassert>
#include <cmath>

union PrivateRNGSingleType { // used to access floats as unsigneds
float s;
Expand Down
3 changes: 1 addition & 2 deletions src/gnu/Random.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <../../nrnconf.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include <Random.h>
#include "Random.h"
2 changes: 1 addition & 1 deletion src/gnu/Random.h
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.

#include <math.h>

#include <RNG.h>
#include "RNG.h"

class Random {
protected:
Expand Down
3 changes: 1 addition & 2 deletions src/gnu/RndInt.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#include <../../nrnconf.h>
#ifdef __GNUG__
#pragma implementation
#endif
#include <RndInt.h>
#include "RndInt.h"

0 comments on commit 4fc6ad8

Please sign in to comment.