mirror of
https://github.com/JHUAPL/kami.git
synced 2026-01-08 14:33:53 -05:00
Reorganization of libkami
This commit is contained in:
@@ -2,7 +2,7 @@ find_package(Doxygen REQUIRED)
|
||||
find_package(Sphinx REQUIRED)
|
||||
|
||||
# Find all the public headers
|
||||
get_target_property(KAMI_PUBLIC_HEADER_DIR kami INTERFACE_INCLUDE_DIRECTORIES)
|
||||
get_target_property(KAMI_PUBLIC_HEADER_DIR libkami INTERFACE_INCLUDE_DIRECTORIES)
|
||||
file(GLOB_RECURSE KAMI_PUBLIC_HEADERS ${KAMI_PUBLIC_HEADER_DIR}/kami/*.h)
|
||||
|
||||
set(DOXYGEN_INPUT_DIR ${PROJECT_SOURCE_DIR}/include/kami)
|
||||
|
||||
@@ -19,7 +19,7 @@ create_executable( NAME ${EXAMPLE_NAME}
|
||||
PRIVATE_INCLUDE_PATHS
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
PUBLIC_LINKED_TARGETS
|
||||
kami
|
||||
kami::libkami
|
||||
fmt
|
||||
spdlog::spdlog
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ create_executable( NAME ${EXAMPLE_NAME}
|
||||
PRIVATE_INCLUDE_PATHS
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
PUBLIC_LINKED_TARGETS
|
||||
kami
|
||||
kami::libkami
|
||||
fmt
|
||||
spdlog::spdlog
|
||||
)
|
||||
|
||||
@@ -19,7 +19,7 @@ create_executable( NAME ${EXAMPLE_NAME}
|
||||
PRIVATE_INCLUDE_PATHS
|
||||
${CMAKE_SOURCE_DIR}/include
|
||||
PUBLIC_LINKED_TARGETS
|
||||
kami
|
||||
kami::libkami
|
||||
fmt
|
||||
spdlog::spdlog
|
||||
)
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace kami {
|
||||
/// runtime. The unique identifier is an unsigned integer that
|
||||
/// increments monotonically with each new Agent instantiated.
|
||||
/// AgentIDs are not guaranteed to be unique from session-to-session.
|
||||
class KAMI_EXPORT AgentID {
|
||||
class LIBKAMI_EXPORT AgentID {
|
||||
public:
|
||||
/// \brief Constructs a new unique identifier.
|
||||
AgentID();
|
||||
@@ -58,7 +58,7 @@ class KAMI_EXPORT AgentID {
|
||||
/// \details All agents should subclass the Agent class.
|
||||
/// At a minimum, subclasses must implement the `step()`
|
||||
/// function, to execute a single time step for each agent.
|
||||
class KAMI_EXPORT Agent {
|
||||
class LIBKAMI_EXPORT Agent {
|
||||
public:
|
||||
/// \brief Deconstructor
|
||||
virtual ~Agent() = default;
|
||||
@@ -89,7 +89,7 @@ class KAMI_EXPORT Agent {
|
||||
/// \details Staged agents use a two-phase or three-phase step to allow agents to take actions without
|
||||
/// updating the state of the model before all agents have been allowed to
|
||||
/// update.
|
||||
class KAMI_EXPORT StagedAgent : public Agent {
|
||||
class LIBKAMI_EXPORT StagedAgent : public Agent {
|
||||
public:
|
||||
///
|
||||
StagedAgent();
|
||||
@@ -116,7 +116,7 @@ class KAMI_EXPORT StagedAgent : public Agent {
|
||||
/// scheduler cycle. This is conceived as being a "day" and "night" action for
|
||||
/// each agent where the scheduler interprets a step as a day-long period. However,
|
||||
/// it may be appropriate for other model configurations, too.
|
||||
class KAMI_EXPORT TwoActionAgent : public Agent {
|
||||
class LIBKAMI_EXPORT TwoActionAgent : public Agent {
|
||||
public:
|
||||
///
|
||||
TwoActionAgent();
|
||||
|
||||
@@ -7,14 +7,14 @@
|
||||
// to build dll libraries that work on windows.
|
||||
// add the BAR_EXPORT definition to each
|
||||
// function/class you want to export to the dll.
|
||||
#include <kami/data/KAMIDATA_EXPORT.h>
|
||||
#include <kami/KAMI_EXPORT.h>
|
||||
|
||||
namespace foo {
|
||||
namespace kami {
|
||||
namespace data {
|
||||
|
||||
LIBKAMI_EXPORT void baz();
|
||||
|
||||
KAMIDATA_EXPORT void baz();
|
||||
|
||||
|
||||
} // namespace foo
|
||||
}
|
||||
} // namespace kami
|
||||
|
||||
#endif // KAMI_DATA_BAZ_HPP
|
||||
|
||||
@@ -12,10 +12,10 @@
|
||||
namespace kami {
|
||||
|
||||
/// \brief Provides an environment for the agents to participate in
|
||||
class KAMI_EXPORT Domain {
|
||||
class LIBKAMI_EXPORT Domain {
|
||||
};
|
||||
|
||||
class KAMI_EXPORT Coord {
|
||||
class LIBKAMI_EXPORT Coord {
|
||||
};
|
||||
|
||||
} // namespace kami
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
namespace kami {
|
||||
|
||||
/// \brief Neighborhood types for orthogonal grid domains
|
||||
enum KAMI_EXPORT GridNeighborhoodType {
|
||||
enum LIBKAMI_EXPORT GridNeighborhoodType {
|
||||
/// \brief Moore neighborhood.
|
||||
/// \details Moore neighborhood types include diagonally
|
||||
/// adjacent cells as neighbors.
|
||||
@@ -27,15 +27,15 @@ enum KAMI_EXPORT GridNeighborhoodType {
|
||||
};
|
||||
|
||||
/// \brief Distance types for orthogonal grid domains
|
||||
enum KAMI_EXPORT GridDistanceType { Linear,
|
||||
enum LIBKAMI_EXPORT GridDistanceType { Linear,
|
||||
Taxicab };
|
||||
|
||||
/// \brief An abstract domain based on a grid with integer steps
|
||||
class KAMI_EXPORT GridDomain : public Domain {
|
||||
class LIBKAMI_EXPORT GridDomain : public Domain {
|
||||
};
|
||||
|
||||
/// \brief An abstract for integer coordinates
|
||||
class KAMI_EXPORT GridCoord : public Coord {
|
||||
class LIBKAMI_EXPORT GridCoord : public Coord {
|
||||
};
|
||||
|
||||
} // namespace kami
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
namespace kami {
|
||||
|
||||
/// \brief Onem-dimensional coordinates.
|
||||
class KAMI_EXPORT GridCoord1D : public GridCoord {
|
||||
class LIBKAMI_EXPORT GridCoord1D : public GridCoord {
|
||||
public:
|
||||
/// \brief Constructor for one-dimensional coordinates.
|
||||
GridCoord1D(int);
|
||||
@@ -46,7 +46,7 @@ class KAMI_EXPORT GridCoord1D : public GridCoord {
|
||||
///
|
||||
/// \details The grid is linear and may wrap around in either
|
||||
/// dimension.
|
||||
class KAMI_EXPORT Grid1D : public GridDomain {
|
||||
class LIBKAMI_EXPORT Grid1D : public GridDomain {
|
||||
public:
|
||||
/// Constructor
|
||||
Grid1D(unsigned int, bool);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
namespace kami {
|
||||
|
||||
/// \brief Two-dimensional coordinates.
|
||||
class KAMI_EXPORT GridCoord2D : public GridCoord {
|
||||
class LIBKAMI_EXPORT GridCoord2D : public GridCoord {
|
||||
public:
|
||||
/// \brief Constructor for two-dimensional coordinates.
|
||||
GridCoord2D(int, int);
|
||||
@@ -49,7 +49,7 @@ class KAMI_EXPORT GridCoord2D : public GridCoord {
|
||||
///
|
||||
/// \details The grid is rectangular and may wrap around in either
|
||||
/// dimension.
|
||||
class KAMI_EXPORT Grid2D : public GridDomain {
|
||||
class LIBKAMI_EXPORT Grid2D : public GridDomain {
|
||||
public:
|
||||
/// Constructor
|
||||
Grid2D(unsigned int, unsigned int, bool, bool);
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
namespace kami {
|
||||
|
||||
/// \brief Three-dimensional coordinates.
|
||||
class KAMI_EXPORT GridCoord3D : public GridCoord {
|
||||
class LIBKAMI_EXPORT GridCoord3D : public GridCoord {
|
||||
public:
|
||||
/// \brief Constructor for three-dimensional coordinates.
|
||||
GridCoord3D(int, int, int);
|
||||
@@ -52,7 +52,7 @@ class KAMI_EXPORT GridCoord3D : public GridCoord {
|
||||
///
|
||||
/// \details The grid is rectangular and may wrap around in any
|
||||
/// dimension.
|
||||
class KAMI_EXPORT Grid3D : public GridDomain {
|
||||
class LIBKAMI_EXPORT Grid3D : public GridDomain {
|
||||
public:
|
||||
/// Constructor
|
||||
Grid3D(unsigned int, unsigned int, unsigned int, bool, bool, bool);
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
namespace kami {
|
||||
|
||||
/// An abstract for generic models
|
||||
class KAMI_EXPORT Model {
|
||||
class LIBKAMI_EXPORT Model {
|
||||
public:
|
||||
/// Destructor.
|
||||
virtual ~Model();
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace kami {
|
||||
|
||||
class KAMI_EXPORT MultiGrid1D : public Grid1D {
|
||||
class LIBKAMI_EXPORT MultiGrid1D : public Grid1D {
|
||||
public:
|
||||
MultiGrid1D(unsigned int, bool);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace kami {
|
||||
|
||||
class KAMI_EXPORT MultiGrid2D : public Grid2D {
|
||||
class LIBKAMI_EXPORT MultiGrid2D : public Grid2D {
|
||||
public:
|
||||
MultiGrid2D(unsigned int, unsigned int, bool, bool);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace kami {
|
||||
|
||||
class KAMI_EXPORT MultiGrid3D : public Grid3D {
|
||||
class LIBKAMI_EXPORT MultiGrid3D : public Grid3D {
|
||||
public:
|
||||
MultiGrid3D(unsigned int, unsigned int, unsigned int, bool, bool, bool);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace kami {
|
||||
/// That order should be different for each subsequent call to `step()`,
|
||||
/// but is not gauranteed not to repeat.
|
||||
/// \pre First create a Model for the scheduler to live in.
|
||||
class KAMI_EXPORT RandomScheduler : public Scheduler {
|
||||
class LIBKAMI_EXPORT RandomScheduler : public Scheduler {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \details The Model parameter is used by the scheduler to get
|
||||
@@ -60,7 +60,7 @@ class KAMI_EXPORT RandomScheduler : public Scheduler {
|
||||
int stepCounter;
|
||||
};
|
||||
|
||||
class KAMI_EXPORT TwoActionRandomScheduler : public RandomScheduler {
|
||||
class LIBKAMI_EXPORT TwoActionRandomScheduler : public RandomScheduler {
|
||||
public:
|
||||
/// \brief Execute a single time step.
|
||||
/// \details This method will randomize the list of TwoActionAgents in the
|
||||
|
||||
@@ -16,7 +16,7 @@ namespace kami {
|
||||
/// in the model. A scheduler will have a collection of agents assigned
|
||||
/// to it and will execute the step function for each agent based on the
|
||||
/// type of scheduling implemented.
|
||||
class KAMI_EXPORT Scheduler {
|
||||
class LIBKAMI_EXPORT Scheduler {
|
||||
public:
|
||||
/// \brief Return a new Kami scheduler
|
||||
///
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace kami {
|
||||
/// That order is preserved between calls to `step()` but may be modified by
|
||||
/// `addAgent()` or `deleteAgent()`.
|
||||
/// \pre First create a Model for the scheduler to live in.
|
||||
class KAMI_EXPORT SequentialScheduler : public Scheduler {
|
||||
class LIBKAMI_EXPORT SequentialScheduler : public Scheduler {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \details The Model parameter is used by the scheduler to get
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace kami {
|
||||
|
||||
class KAMI_EXPORT SoloGrid1D : public Grid1D {
|
||||
class LIBKAMI_EXPORT SoloGrid1D : public Grid1D {
|
||||
public:
|
||||
SoloGrid1D(unsigned int, bool);
|
||||
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
|
||||
namespace kami {
|
||||
|
||||
class KAMI_EXPORT SoloGrid2D : public Grid2D {
|
||||
class LIBKAMI_EXPORT SoloGrid2D : public Grid2D {
|
||||
public:
|
||||
SoloGrid2D(unsigned int, unsigned int, bool, bool);
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
|
||||
namespace kami {
|
||||
|
||||
class KAMI_EXPORT SoloGrid3D : public Grid3D {
|
||||
class LIBKAMI_EXPORT SoloGrid3D : public Grid3D {
|
||||
public:
|
||||
SoloGrid3D(unsigned int, unsigned int, unsigned int, bool, bool, bool);
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace kami {
|
||||
/// That order is preserved between calls to `step()` but may be modified by
|
||||
/// `addAgent()` or `deleteAgent()`.
|
||||
/// \pre First create a Model for the scheduler to live in.
|
||||
class KAMI_EXPORT StagedScheduler : public Scheduler {
|
||||
class LIBKAMI_EXPORT StagedScheduler : public Scheduler {
|
||||
public:
|
||||
/// \brief Constructor.
|
||||
/// \details The Model parameter is used by the scheduler to get
|
||||
|
||||
@@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.13)
|
||||
project(libkami VERSION ${KAMI_VERSION_STRING}
|
||||
LANGUAGES CXX)
|
||||
|
||||
create_library(NAME kami
|
||||
NAMESPACE kami
|
||||
create_library(NAME libkami
|
||||
NAMESPACE libkami
|
||||
SOURCES
|
||||
agent.cc
|
||||
grid1d.cc
|
||||
@@ -35,8 +35,9 @@ configure_file(
|
||||
"${CMAKE_SOURCE_DIR}/include/kami/config.h.in"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/generated_headers/kami/config.h")
|
||||
|
||||
set_target_properties(kami PROPERTIES VERSION ${KAMI_VERSION_STRING}
|
||||
SOVERSION ${KAMI_VERSION_MAJOR})
|
||||
set_target_properties(libkami PROPERTIES VERSION ${KAMI_VERSION_STRING}
|
||||
SOVERSION ${KAMI_VERSION_MAJOR}
|
||||
OUTPUT_NAME kami)
|
||||
|
||||
# Introduce variables:
|
||||
# * CMAKE_INSTALL_LIBDIR
|
||||
@@ -63,8 +64,4 @@ set_target_properties(kami PROPERTIES VERSION ${KAMI_VERSION_STRING}
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/kami"
|
||||
)
|
||||
|
||||
add_library(kami::kami ALIAS kami)
|
||||
|
||||
################################################################################
|
||||
|
||||
# }
|
||||
add_library(kami::libkami ALIAS libkami)
|
||||
@@ -5,8 +5,8 @@ cmake_minimum_required(VERSION 3.13)
|
||||
project(libkamidata VERSION ${KAMI_VERSION_STRING}
|
||||
LANGUAGES CXX)
|
||||
|
||||
create_library(NAME kamidata
|
||||
NAMESPACE kamidata
|
||||
create_library(NAME libkamidata
|
||||
NAMESPACE libkamidata
|
||||
SOURCES
|
||||
baz.cc
|
||||
PUBLIC_INCLUDE_PATHS
|
||||
@@ -14,12 +14,11 @@ create_library(NAME kamidata
|
||||
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/generated_headers>"
|
||||
PRIVATE_LINKED_TARGETS
|
||||
${COVERAGE_TARGET}
|
||||
EXPORT_FILE_PATH
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/generated_headers/kami/data/KAMIDATA_EXPORT.h"
|
||||
)
|
||||
|
||||
set_target_properties(kamidata PROPERTIES VERSION ${KAMI_VERSION_STRING}
|
||||
SOVERSION ${KAMI_VERSION_MAJOR})
|
||||
|
||||
set_target_properties(libkamidata PROPERTIES VERSION ${KAMI_VERSION_STRING}
|
||||
SOVERSION ${KAMI_VERSION_MAJOR}
|
||||
OUTPUT_NAME kamidata)
|
||||
|
||||
# Introduce variables:
|
||||
# * CMAKE_INSTALL_LIBDIR
|
||||
@@ -32,21 +31,8 @@ set_target_properties(kamidata PROPERTIES VERSION ${KAMI_VERSION_STRING}
|
||||
# * include/foo/bar/bar.h -> <prefix>/include/foo/bar/bar.h
|
||||
install(
|
||||
DIRECTORY "${CMAKE_SOURCE_DIR}/include/kami/data"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/kami/data"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/kami"
|
||||
FILES_MATCHING PATTERN "*"
|
||||
)
|
||||
|
||||
# Export headers:
|
||||
# The export header will be stored in:
|
||||
# <prefix>/include/${NAMESPACE}/LIBRARY_NAME/LIBRARY_NAME_export.h
|
||||
install(
|
||||
FILES
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/generated_headers/kami/data/KAMIDATA_EXPORT.h"
|
||||
DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/kami/data"
|
||||
)
|
||||
|
||||
add_library(kami::data ALIAS kamidata)
|
||||
|
||||
################################################################################
|
||||
|
||||
# }
|
||||
add_library(kami::libkamidata ALIAS libkamidata)
|
||||
@@ -11,7 +11,7 @@ create_test( NAME
|
||||
SOURCES
|
||||
unit-kami-agentid.cc
|
||||
PUBLIC_LINKED_TARGETS
|
||||
kami::kami
|
||||
kami::libkami
|
||||
fmt
|
||||
spdlog::spdlog
|
||||
${COVERAGE_LIBS}
|
||||
@@ -25,7 +25,7 @@ create_test( NAME
|
||||
SOURCES
|
||||
unit-kami-agent.cc
|
||||
PUBLIC_LINKED_TARGETS
|
||||
kami::kami
|
||||
kami::libkami
|
||||
fmt
|
||||
spdlog::spdlog
|
||||
${COVERAGE_LIBS}
|
||||
|
||||
Reference in New Issue
Block a user