1. 修改版本控制。

main
baocm 8 months ago
parent 1a25135f79
commit 1a8edf682b

@ -5,6 +5,7 @@ project("system")
set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_EXTENSIONS OFF) set(CMAKE_CXX_EXTENSIONS OFF)
set(PROGRAM_VERSION "v1.0.0")
set(fastcdr_DIR "/opt/fastdds/v3.2.2/lib/cmake/fastcdr") set(fastcdr_DIR "/opt/fastdds/v3.2.2/lib/cmake/fastcdr")
set(fastdds_DIR "/opt/fastdds/v3.2.2/share/fastdds/cmake") set(fastdds_DIR "/opt/fastdds/v3.2.2/share/fastdds/cmake")
@ -33,11 +34,13 @@ add_library(System_lib lib/SystemTypeObjectSupport.cxx lib/SystemPubSubTypes.cxx
target_link_libraries(System_lib fastcdr fastdds) target_link_libraries(System_lib fastcdr fastdds)
# Demo Application. # Demo Application.
# set(PROGRAM_MODULE "Demo")
# add_executable(Demo # add_executable(Demo
# demo/main.cxx # demo/main.cxx
# demo/Publisher.cxx # demo/Publisher.cxx
# demo/Subscriber.cxx # demo/Subscriber.cxx
# ) # )
# target_compile_definitions(Demo PRIVATE PROGRAM_MODULE="${PROGRAM_MODULE}" PROGRAM_VERSION="${PROGRAM_VERSION}")
# target_include_directories(Demo PRIVATE demo) # target_include_directories(Demo PRIVATE demo)
# target_link_libraries(Demo fastcdr fastdds # target_link_libraries(Demo fastcdr fastdds
# System_lib # System_lib
@ -50,7 +53,7 @@ add_executable(Core
core/Publisher.cxx core/Publisher.cxx
core/Subscriber.cxx core/Subscriber.cxx
) )
target_compile_definitions(Core PRIVATE PROGRAM_MODULE_NAME="${PROGRAM_MODULE}") target_compile_definitions(Core PRIVATE PROGRAM_MODULE="${PROGRAM_MODULE}" PROGRAM_VERSION="${PROGRAM_VERSION}")
target_include_directories(Core PRIVATE core) target_include_directories(Core PRIVATE core)
target_link_libraries(Core fastcdr fastdds target_link_libraries(Core fastcdr fastdds
System_lib System_lib
@ -65,13 +68,14 @@ add_executable(GateCtrl
gatectrl/MsgHandler.cxx gatectrl/MsgHandler.cxx
common/CanMsgHandler.cxx common/CanMsgHandler.cxx
) )
target_compile_definitions(GateCtrl PRIVATE PROGRAM_MODULE_NAME="${PROGRAM_MODULE}") target_compile_definitions(GateCtrl PRIVATE PROGRAM_MODULE="${PROGRAM_MODULE}" PROGRAM_VERSION="${PROGRAM_VERSION}")
target_include_directories(GateCtrl PRIVATE gatectrl) target_include_directories(GateCtrl PRIVATE gatectrl)
target_link_libraries(GateCtrl fastcdr fastdds target_link_libraries(GateCtrl fastcdr fastdds
System_lib System_lib
) )
# IoCtrl Application. # IoCtrl Application.
# set(PROGRAM_MODULE "IoCtrl")
# add_executable(IoCtrl # add_executable(IoCtrl
# ioctrl/main.cxx # ioctrl/main.cxx
# ioctrl/Publisher.cxx # ioctrl/Publisher.cxx
@ -79,6 +83,7 @@ target_link_libraries(GateCtrl fastcdr fastdds
# ioctrl/MsgHandler.cxx # ioctrl/MsgHandler.cxx
# common/CanMsgHandler.cxx # common/CanMsgHandler.cxx
# ) # )
# target_compile_definitions(IoCtrl PRIVATE PROGRAM_MODULE="${PROGRAM_MODULE}" PROGRAM_VERSION="${PROGRAM_VERSION}")
# target_include_directories(IoCtrl PRIVATE ioctrl) # target_include_directories(IoCtrl PRIVATE ioctrl)
# target_link_libraries(IoCtrl fastcdr fastdds # target_link_libraries(IoCtrl fastcdr fastdds
# System_lib # System_lib
@ -92,7 +97,7 @@ add_executable(HttpServer
httpserver/Subscriber.cxx httpserver/Subscriber.cxx
httpserver/httpserver.cxx httpserver/httpserver.cxx
) )
target_compile_definitions(HttpServer PRIVATE PROGRAM_MODULE_NAME="${PROGRAM_MODULE}") target_compile_definitions(HttpServer PRIVATE PROGRAM_MODULE="${PROGRAM_MODULE}" PROGRAM_VERSION="${PROGRAM_VERSION}")
target_include_directories(HttpServer PRIVATE httpserver) target_include_directories(HttpServer PRIVATE httpserver)
target_link_libraries(HttpServer fastcdr fastdds target_link_libraries(HttpServer fastcdr fastdds
System_lib System_lib
@ -108,7 +113,7 @@ add_executable(Print
common/SerialMsgHandler.cxx common/SerialMsgHandler.cxx
lib/strcode.cpp lib/strcode.cpp
) )
target_compile_definitions(Print PRIVATE PROGRAM_MODULE_NAME="${PROGRAM_MODULE}") target_compile_definitions(Print PRIVATE PROGRAM_MODULE="${PROGRAM_MODULE}" PROGRAM_VERSION="${PROGRAM_VERSION}")
target_include_directories(Print PRIVATE print) target_include_directories(Print PRIVATE print)
target_link_libraries(Print fastcdr fastdds target_link_libraries(Print fastcdr fastdds
System_lib System_lib
@ -124,7 +129,7 @@ add_executable(Weigh
weigh/WeightStabilityDetector.cxx weigh/WeightStabilityDetector.cxx
common/SerialMsgHandler.cxx common/SerialMsgHandler.cxx
) )
target_compile_definitions(Weigh PRIVATE PROGRAM_MODULE_NAME="${PROGRAM_MODULE}") target_compile_definitions(Weigh PRIVATE PROGRAM_MODULE="${PROGRAM_MODULE}" PROGRAM_VERSION="${PROGRAM_VERSION}")
target_include_directories(Weigh PRIVATE weigh) target_include_directories(Weigh PRIVATE weigh)
target_link_libraries(Weigh fastcdr fastdds target_link_libraries(Weigh fastcdr fastdds
System_lib System_lib
@ -137,7 +142,7 @@ add_executable(MqttDds
mqttdds/Publisher.cxx mqttdds/Publisher.cxx
mqttdds/Subscriber.cxx mqttdds/Subscriber.cxx
) )
target_compile_definitions(MqttDds PRIVATE PROGRAM_MODULE_NAME="${PROGRAM_MODULE}") target_compile_definitions(MqttDds PRIVATE PROGRAM_MODULE="${PROGRAM_MODULE}" PROGRAM_VERSION="${PROGRAM_VERSION}")
target_include_directories(MqttDds PRIVATE mqttdds) target_include_directories(MqttDds PRIVATE mqttdds)
target_link_libraries(MqttDds fastcdr fastdds target_link_libraries(MqttDds fastcdr fastdds
System_lib PahoMqttCpp::paho-mqttpp3 System_lib PahoMqttCpp::paho-mqttpp3

@ -3,9 +3,9 @@
#include <iostream> #include <iostream>
// 使用CMake定义的模块名 // 使用CMake定义的模块名
#ifndef PROGRAM_MODULE_NAME #ifndef PROGRAM_MODULE
#define PROGRAM_MODULE_NAME "DefaultApp" #define PROGRAM_MODULE "DefaultApp"
#endif #endif
// 使用CMake设置的模块名 // 使用CMake设置的模块名
#define DEBUG(...) std::cout << "[" << PROGRAM_MODULE_NAME << "] " << __VA_ARGS__ << std::endl #define DEBUG(...) std::cout << "[" << PROGRAM_MODULE << "] " << __VA_ARGS__ << std::endl

@ -34,8 +34,6 @@
#include "msg.hpp" #include "msg.hpp"
#include "DEBUG.hpp" #include "DEBUG.hpp"
#define VERSION "v1.0"
using eprosima::fastdds::dds::Log; using eprosima::fastdds::dds::Log;
std::function<void(int)> stop_handler; std::function<void(int)> stop_handler;
@ -91,7 +89,7 @@ int main(int argc, char** argv)
} }
else if (strcmp(argv[i], "--version") == 0) else if (strcmp(argv[i], "--version") == 0)
{ {
std::cout << "Vesrion: " << VERSION << "\n"; std::cout << "Vesrion: " << PROGRAM_VERSION << "\n";
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
else if (strcmp(argv[i], "--help") == 0) else if (strcmp(argv[i], "--help") == 0)

@ -98,7 +98,7 @@ int main(int argc, char** argv)
} }
else if (strcmp(argv[i], "--version") == 0) else if (strcmp(argv[i], "--version") == 0)
{ {
std::cout << "Vesrion: " << VERSION << "\n"; std::cout << "Vesrion: " << PROGRAM_VERSION << "\n";
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
else if (strcmp(argv[i], "--help") == 0) else if (strcmp(argv[i], "--help") == 0)

@ -34,8 +34,6 @@
#include "msg.hpp" #include "msg.hpp"
#include "DEBUG.hpp" #include "DEBUG.hpp"
#define VERSION "v1.0"
using eprosima::fastdds::dds::Log; using eprosima::fastdds::dds::Log;
std::function<void(int)> stop_handler; std::function<void(int)> stop_handler;
@ -111,7 +109,7 @@ int main(int argc, char** argv)
} }
else if (strcmp(argv[i], "--version") == 0) else if (strcmp(argv[i], "--version") == 0)
{ {
std::cout << "Vesrion: " << VERSION << "\n"; std::cout << "Vesrion: " << PROGRAM_VERSION << "\n";
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
else if (strcmp(argv[i], "--help") == 0) else if (strcmp(argv[i], "--help") == 0)

@ -34,8 +34,6 @@
#include "httpserver.hpp" #include "httpserver.hpp"
#include "DEBUG.hpp" #include "DEBUG.hpp"
#define VERSION "v1.0.0"
using eprosima::fastdds::dds::Log; using eprosima::fastdds::dds::Log;
std::function<void(int)> stop_handler; std::function<void(int)> stop_handler;
@ -87,7 +85,7 @@ int main(int argc, char** argv)
} }
else if (strcmp(argv[i], "--version") == 0) else if (strcmp(argv[i], "--version") == 0)
{ {
std::cout << "Vesrion: " << VERSION << "\n"; std::cout << "Vesrion: " << PROGRAM_VERSION << "\n";
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
else if (strcmp(argv[i], "--help") == 0) else if (strcmp(argv[i], "--help") == 0)

@ -37,8 +37,6 @@
#include "msg.hpp" #include "msg.hpp"
#include "json.hpp" #include "json.hpp"
#define VERSION "v1.0"
using eprosima::fastdds::dds::Log; using eprosima::fastdds::dds::Log;
using json = nlohmann::json; using json = nlohmann::json;
@ -129,7 +127,7 @@ int main(int argc, char** argv)
} }
else if (strcmp(argv[i], "--version") == 0) else if (strcmp(argv[i], "--version") == 0)
{ {
std::cout << "Vesrion: " << VERSION << "\n"; std::cout << "Vesrion: " << PROGRAM_VERSION << "\n";
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
else if (strcmp(argv[i], "--help") == 0) else if (strcmp(argv[i], "--help") == 0)

@ -35,8 +35,6 @@
#include "msg.hpp" #include "msg.hpp"
#include "DEBUG.hpp" #include "DEBUG.hpp"
#define VERSION "v1.0"
using eprosima::fastdds::dds::Log; using eprosima::fastdds::dds::Log;
std::function<void(int)> stop_handler; std::function<void(int)> stop_handler;
@ -167,7 +165,7 @@ int main(int argc, char** argv)
} }
else if (strcmp(argv[i], "--version") == 0) else if (strcmp(argv[i], "--version") == 0)
{ {
std::cout << "Vesrion: " << VERSION << "\n"; std::cout << "Vesrion: " << PROGRAM_VERSION << "\n";
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
else if (strcmp(argv[i], "--help") == 0) else if (strcmp(argv[i], "--help") == 0)

@ -34,8 +34,6 @@
#include "msg.hpp" #include "msg.hpp"
#include "DEBUG.hpp" #include "DEBUG.hpp"
#define VERSION "v1.0"
using eprosima::fastdds::dds::Log; using eprosima::fastdds::dds::Log;
std::function<void(int)> stop_handler; std::function<void(int)> stop_handler;
@ -105,7 +103,7 @@ int main(int argc, char** argv)
} }
else if (strcmp(argv[i], "--version") == 0) else if (strcmp(argv[i], "--version") == 0)
{ {
std::cout << "Vesrion: " << VERSION << "\n"; std::cout << "Vesrion: " << PROGRAM_VERSION << "\n";
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
else if (strcmp(argv[i], "--help") == 0) else if (strcmp(argv[i], "--help") == 0)

@ -34,8 +34,6 @@
#include "msg.hpp" #include "msg.hpp"
#include "DEBUG.hpp" #include "DEBUG.hpp"
#define VERSION "v1.0"
using eprosima::fastdds::dds::Log; using eprosima::fastdds::dds::Log;
std::function<void(int)> stop_handler; std::function<void(int)> stop_handler;
@ -110,7 +108,7 @@ int main(int argc, char** argv)
} }
else if (strcmp(argv[i], "--version") == 0) else if (strcmp(argv[i], "--version") == 0)
{ {
std::cout << "Vesrion: " << VERSION << "\n"; std::cout << "Vesrion: " << PROGRAM_VERSION << "\n";
return EXIT_SUCCESS; return EXIT_SUCCESS;
} }
else if (strcmp(argv[i], "--help") == 0) else if (strcmp(argv[i], "--help") == 0)

Loading…
Cancel
Save