diff --git a/.ci/azure-pipelines.yml b/.ci/azure-pipelines.yml index 0a5f473..0e5907b 100644 --- a/.ci/azure-pipelines.yml +++ b/.ci/azure-pipelines.yml @@ -50,14 +50,14 @@ jobs: - task: CMake@1 inputs: workingDirectory: HELICS/build - cmakeArgs: -GNinja -DCMAKE_BUILD_TYPE=Release -DBUILD_HELICS_TESTS=OFF -DBUILD_HELICS_EXAMPLES=OFF .. + cmakeArgs: -GNinja -DCMAKE_BUILD_TYPE=Release -DHELICS_BUILD_CXX_SHARED_LIB=ON .. displayName: 'Linux/macOS - Configure HELICS' condition: ne( variables['Agent.OS'], 'Windows_NT' ) # Windows - task: CMake@1 inputs: workingDirectory: HELICS/build - cmakeArgs: -Ax64 -DCMAKE_BUILD_TYPE=Release -DBUILD_HELICS_TESTS=OFF -DBUILD_HELICS_EXAMPLES=OFF .. + cmakeArgs: -Ax64 -DCMAKE_BUILD_TYPE=Release -DHELICS_BUILD_CXX_SHARED_LIB=ON .. displayName: 'Windows - Configure HELICS' condition: eq( variables['Agent.OS'], 'Windows_NT' ) diff --git a/CMakeLists.txt b/CMakeLists.txt index 22848c2..09a5ab1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ cmake_minimum_required(VERSION 3.4) cmake_policy(VERSION 3.4) -project (HELICS-EXAMPLES VERSION 2.1.0) +project (HELICS-EXAMPLES VERSION 2.3.0) # ----------------------------------------------------------------------------- # include some common macros diff --git a/cpp/comboFederate1/CMakeLists.txt b/cpp/comboFederate1/CMakeLists.txt index 392bc0a..ae9e8f5 100644 --- a/cpp/comboFederate1/CMakeLists.txt +++ b/cpp/comboFederate1/CMakeLists.txt @@ -18,7 +18,7 @@ endif() find_package(HELICS 2 REQUIRED) add_executable(comboFed-cpp comboFed.cpp) -target_link_libraries(comboFed-cpp HELICS::helics_apps) +target_link_libraries(comboFed-cpp HELICS::helics-apps-shared) set_property(TARGET comboFed-cpp PROPERTY CXX_STANDARD 14) set_target_properties(comboFed-cpp PROPERTIES FOLDER cpp/federates) diff --git a/cpp/filterFederate1/CMakeLists.txt b/cpp/filterFederate1/CMakeLists.txt index 2bec1f6..0219c7e 100644 --- a/cpp/filterFederate1/CMakeLists.txt +++ b/cpp/filterFederate1/CMakeLists.txt @@ -15,6 +15,6 @@ endif() find_package(HELICS 2 REQUIRED) add_executable(filterFed-cpp filterFed.cpp) -target_link_libraries(filterFed-cpp HELICS::helics_apps) +target_link_libraries(filterFed-cpp HELICS::helics-apps-shared) set_target_properties(filterFed-cpp PROPERTIES FOLDER cpp/federates) diff --git a/cpp/filterFederate1/filterFed.cpp b/cpp/filterFederate1/filterFed.cpp index 5f53050..2fdeb0e 100644 --- a/cpp/filterFederate1/filterFed.cpp +++ b/cpp/filterFederate1/filterFed.cpp @@ -7,6 +7,7 @@ SPDX-License-Identifier: BSD-3-Clause #include "helics/application_api.hpp" #include "helics/core/helicsCLI11.hpp" +#include "helics/core/Core.hpp" #include #include @@ -17,13 +18,13 @@ int main (int argc, char *argv[]) std::string targetEndpoint = "endpoint"; std::string delay = "1.0"; std::string filtType = "delay"; - helics::filter_types ftype; + helics::filter_types ftype = helics::filter_types::delay; double dropprob = 0.33; app.add_option ("--target,-t", targetFederate, "name of the federate to target"); app.add_option ("--endpoint,-e", targetEndpoint, "name of the endpoint to filter"); app.add_option ("--delay", delay, "the time to delay the message"); - app.add_option ("--filtertype", filtType, "the type of filter to implement") + app.add_option ("--filtertype", filtType, "the type of filter to implement",true) ->check(CLI::IsMember({ "delay", "random_drop", @@ -52,11 +53,11 @@ int main (int argc, char *argv[]) std::string target = targetFederate + "/" + targetEndpoint; - auto core = helics::CoreFactory::create(argc, argv); + auto core = helics::CoreApp(argc, argv); std::cout << " registering filter '"<< "' for " << target <<'\n'; //create a source filter object with type, the fed pointer and a target endpoint - auto filt = helics::make_filter(ftype, core.get()); + auto filt = helics::make_filter(ftype, core); filt->addSourceTarget(target); // get a few specific parameters related to the particular filter @@ -82,9 +83,9 @@ int main (int argc, char *argv[]) } // setup and run - core->setCoreReadyToInit(); + core.setReadyToInit(); - core->waitForDisconnect(); + core.waitForDisconnect(); return 0; } diff --git a/cpp/ipcTest/CMakeLists.txt b/cpp/ipcTest/CMakeLists.txt index af0ca7f..adec1cb 100644 --- a/cpp/ipcTest/CMakeLists.txt +++ b/cpp/ipcTest/CMakeLists.txt @@ -19,9 +19,9 @@ find_package(HELICS 2 REQUIRED) find_package(Threads REQUIRED) add_executable(ipcTest1-cpp ipcTest1.cpp common.hpp) -target_link_libraries(ipcTest1-cpp HELICS::helics-static Threads::Threads) +target_link_libraries(ipcTest1-cpp HELICS::helics-shared Threads::Threads) add_executable(ipcTest2-cpp ipcTest2.cpp common.hpp) -target_link_libraries(ipcTest2-cpp HELICS::helics-static Threads::Threads) +target_link_libraries(ipcTest2-cpp HELICS::helics-shared Threads::Threads) set_target_properties(ipcTest1-cpp ipcTest2-cpp PROPERTIES FOLDER cpp/ipc) diff --git a/cpp/ipcTest/ipcTest1.cpp b/cpp/ipcTest/ipcTest1.cpp index 25438c1..4e39974 100644 --- a/cpp/ipcTest/ipcTest1.cpp +++ b/cpp/ipcTest/ipcTest1.cpp @@ -12,7 +12,7 @@ SPDX-License-Identifier: BSD-3-Clause #include #include -#include +#include #include "common.hpp" @@ -33,7 +33,7 @@ int main (int, char **) std::cout << "trying to create broker..." << std::endl; auto init_string = std::string ("-f2 --name=stevebroker"); - auto broker = helics::BrokerFactory::create (helics::core_type::INTERPROCESS, init_string); + helics::BrokerApp broker(helics::core_type::INTERPROCESS, init_string); std::cout << "created broker \"" << broker->getIdentifier () << "\"\n" << "broker is connected: " << std::boolalpha << broker->isConnected () << std::endl; @@ -77,11 +77,7 @@ int main (int, char **) } fed.finalize (); - do // sleep until the broker finishes - { - std::this_thread::sleep_for (std::chrono::milliseconds (500)); - - } while (broker->isConnected ()); + broker.waitForDisconnect(); return 0; } diff --git a/cpp/messageFederate1/CMakeLists.txt b/cpp/messageFederate1/CMakeLists.txt index 7ba1db0..83cd2ae 100644 --- a/cpp/messageFederate1/CMakeLists.txt +++ b/cpp/messageFederate1/CMakeLists.txt @@ -18,9 +18,9 @@ endif() find_package(HELICS 2 REQUIRED) add_executable(messageFed-cpp messageFed.cpp) -target_link_libraries(messageFed-cpp HELICS::helics_apps) +target_link_libraries(messageFed-cpp HELICS::helics-apps-shared) add_executable(messageFedObj-cpp messageFedObj.cpp) -target_link_libraries(messageFedObj-cpp HELICS::helics_apps) +target_link_libraries(messageFedObj-cpp HELICS::helics-apps-shared) set_target_properties(messageFed-cpp messageFedObj-cpp PROPERTIES FOLDER cpp/federates) diff --git a/cpp/valueFederate1/CMakeLists.txt b/cpp/valueFederate1/CMakeLists.txt index 1d7ebac..08b1465 100644 --- a/cpp/valueFederate1/CMakeLists.txt +++ b/cpp/valueFederate1/CMakeLists.txt @@ -18,6 +18,6 @@ endif() find_package(HELICS 2 REQUIRED) add_executable(valueFed-cpp valueFed.cpp) -target_link_libraries(valueFed-cpp HELICS::helics_apps) +target_link_libraries(valueFed-cpp HELICS::helics-apps-shared) set_target_properties(valueFed-cpp PROPERTIES FOLDER cpp/federates)