Skip to content

Commit

Permalink
Version done
Browse files Browse the repository at this point in the history
  • Loading branch information
wardru committed Sep 29, 2023
1 parent 98a16da commit cba39da
Show file tree
Hide file tree
Showing 11 changed files with 24 additions and 16 deletions.
9 changes: 9 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ if (CMAKE_SYSTEM_NAME MATCHES "Windows")
set(CMAKE_CROSSCOMPILING_EMULATOR "wine")
endif()

set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib)
add_library(${LIBRARY_NAME})

add_subdirectory(source)
#add_subdirectory(test)

Expand All @@ -35,6 +38,7 @@ target_include_directories(${LIBRARY_NAME} PUBLIC
${CMAKE_BINARY_DIR}
)


target_link_libraries(${LIBRARY_NAME}
$<$<OR:$<NOT:$<BOOL:${BUILD_SHARED_LIBS}>>,$<STREQUAL:${CMAKE_SYSTEM_NAME},Windows>>:PahoMqttCpp::paho-mqttpp3-static>
$<$<AND:$<BOOL:${BUILD_SHARED_LIBS}>,$<NOT:$<STREQUAL:${CMAKE_SYSTEM_NAME},Windows>>>:PahoMqttCpp::paho-mqttpp3>
Expand All @@ -43,3 +47,8 @@ target_link_libraries(${LIBRARY_NAME}
magic_enum::magic_enum
)


set_target_properties(${LIBRARY_NAME} PROPERTIES
VERSION ${PROJECT_VERSION}
SOVERSION ${PROJECT_VERSION_MAJOR}
)
4 changes: 3 additions & 1 deletion cmake/cppcheck.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ find_program(CPPCHECK_EXECUTABLE cppcheck)
if(CPPCHECK_EXECUTABLE)
# cppcheck igner never used functions
add_custom_target(check
${CPPCHECK_EXECUTABLE} --enable=all --suppress=missingIncludeSystem
${CPPCHECK_EXECUTABLE} --enable=all --suppress=missingIncludeSystem --suppress=unusedFunction
--template "{file}:{line}:{severity}:{id}:{message}"
-I ${CMAKE_SOURCE_DIR}/source
${CMAKE_SOURCE_DIR}/source
COMMENT "Running Cppcheck static analysis tool"
)
else()
message(WARNING "Cppcheck not found, can't run static analysis")
endif()
2 changes: 0 additions & 2 deletions source/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
add_library(${LIBRARY_NAME})

file(GLOB_RECURSE HEADERS ${CMAKE_SOURCE_DIR}/source/*.hxx)

configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pza/version.hxx.in
Expand Down
2 changes: 1 addition & 1 deletion source/pza/core/attribute.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ namespace pza
public:
friend class interface;

attribute(const std::string &name);
explicit attribute(const std::string &name);

template<typename T>
void add_field(const std::string &name, bool readonly)
Expand Down
5 changes: 5 additions & 0 deletions source/pza/core/core.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ void core::set_log_level(log_level level)
core::log_level core::get_log_level(void)
{
return static_cast<core::log_level>(spdlog::get_level());
}

std::string core::get_version(void)
{
return PZACXX_VERSION;
}
2 changes: 2 additions & 0 deletions source/pza/core/core.hxx
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#pragma once

#include <spdlog/spdlog.h>
#include <pza/version.hxx>

namespace pza
{
Expand All @@ -23,5 +24,6 @@ namespace pza

static void set_log_level(log_level level);
static log_level get_log_level(void);
static std::string get_version(void);
};
};
5 changes: 0 additions & 5 deletions source/pza/core/field.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,6 @@ namespace pza
return _json_type;
}

const std::type_info &get_type() const
{
return typeid(_type);
}

void _set_value(const _type &value)
{
_value = value;
Expand Down
2 changes: 1 addition & 1 deletion source/pza/devices/bps.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ bps_channel::bps_channel(device *device, const std::string &base_name)

}

bps::bps(const std::string group, const std::string name)
bps::bps(const std::string &group, const std::string &name)
: device(group, name)
{

Expand Down
2 changes: 1 addition & 1 deletion source/pza/devices/bps.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ namespace pza
public:
using ptr = std::shared_ptr<bps>;

bps(const std::string group, const std::string name);
explicit bps(const std::string &group, const std::string &name);

const std::string &get_family() override { return _family; };
size_t get_num_channels() { return channel.size(); }
Expand Down
2 changes: 1 addition & 1 deletion source/pza/utils/topic.hxx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace pza
class topic
{
public:
topic(const std::string &topic);
explicit topic(const std::string &topic);

bool is_valid() const { return _is_valid; }

Expand Down
5 changes: 1 addition & 4 deletions source/pza/version.hxx.in
Original file line number Diff line number Diff line change
@@ -1,6 +1,3 @@
#pragma once

#define PZACXX_VERSION_MAJOR @PZACXX_VERSION_MAJOR@
#define PZACXX_VERSION_MINOR @PZACXX_VERSION_MINOR@
#define PZACXX_VERSION_PATCH @PZACXX_VERSION_PATCH@
#define PZACXX_VERSION @PZACXX_VERSION
#define PZACXX_VERSION "@PROJECT_VERSION@"

0 comments on commit cba39da

Please sign in to comment.