diff --git a/python/CMakeLists.txt b/python/CMakeLists.txt index 5d55e10713..6a7e468688 100644 --- a/python/CMakeLists.txt +++ b/python/CMakeLists.txt @@ -11,7 +11,7 @@ set(JSBSIM_PYX ${CMAKE_CURRENT_BINARY_DIR}/_jsbsim.pyx) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jsbsim.pyx.in ${JSBSIM_PYX}) configure_file(${CMAKE_CURRENT_SOURCE_DIR}/jsbsim.pxd ${CMAKE_CURRENT_BINARY_DIR}/_jsbsim.pxd COPYONLY) set_source_files_properties(${JSBSIM_PYX} PROPERTIES CYTHON_IS_CXX TRUE - INCLUDE_DIRECTORIES ${PROJECT_SOURCE_DIR}/src) + INCLUDE_DIRECTORIES ${PROJECT_SOURCE_DIR}/src) # Autogenerate the Python module doc strings from Doxygen docs if(DOXYGEN_FOUND AND BUILD_DOCS) @@ -79,11 +79,12 @@ foreach(OBJECT ${libJSBSim_SOURCE_FILES}) if(${OBJECT} MATCHES "TARGET_OBJECTS:([^ >]+)") get_target_property(TARGET_SOURCE_FILES ${CMAKE_MATCH_1} SOURCES) get_target_property(TARGET_SOURCE_DIRECTORY ${CMAKE_MATCH_1} TARGET_DIRECTORY) - file(RELATIVE_PATH TARGET_PATH ${PROJECT_SOURCE_DIR} ${TARGET_SOURCE_DIRECTORY}) + file(RELATIVE_PATH TARGET_RELATIVE_PATH ${PROJECT_SOURCE_DIR} ${TARGET_SOURCE_DIRECTORY}) + set(TARGET_PATH ${CMAKE_CURRENT_BINARY_DIR}/${TARGET_RELATIVE_PATH}) file(MAKE_DIRECTORY ${TARGET_PATH}) foreach(_FILE ${TARGET_SOURCE_FILES}) configure_file(${TARGET_SOURCE_DIRECTORY}/${_FILE} ${TARGET_PATH}/${_FILE} COPYONLY) - list(APPEND SOURCE_FILES ${TARGET_PATH}/${_FILE}) + list(APPEND SOURCE_FILES ${TARGET_RELATIVE_PATH}/${_FILE}) endforeach() else() configure_file(${libJSBSim_DIRECTORY}/${OBJECT} ${libJSBSim_PATH}/${OBJECT} COPYONLY) @@ -109,24 +110,26 @@ target_include_directories(_jsbsim PRIVATE ${PROJECT_SOURCE_DIR}/src) target_link_libraries(_jsbsim PRIVATE libJSBSim) set_target_properties(_jsbsim PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${JSBSIM_TEST_PACKAGE_DIR}) -# Output directories for MSVC -set_target_properties(_jsbsim PROPERTIES LIBRARY_OUTPUT_DIRECTORY_DEBUG ${JSBSIM_TEST_PACKAGE_DIR}) -set_target_properties(_jsbsim PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELEASE ${JSBSIM_TEST_PACKAGE_DIR}) -set_target_properties(_jsbsim PROPERTIES LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${JSBSIM_TEST_PACKAGE_DIR}) -set_target_properties(_jsbsim PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${JSBSIM_TEST_PACKAGE_DIR}) +if(WIN32) + # Output directories for MSVC + set_target_properties(_jsbsim PROPERTIES LIBRARY_OUTPUT_DIRECTORY_DEBUG ${JSBSIM_TEST_PACKAGE_DIR}) + set_target_properties(_jsbsim PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELEASE ${JSBSIM_TEST_PACKAGE_DIR}) + set_target_properties(_jsbsim PROPERTIES LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${JSBSIM_TEST_PACKAGE_DIR}) + set_target_properties(_jsbsim PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${JSBSIM_TEST_PACKAGE_DIR}) + + # Windows needs the DLL to be copied locally for unit tests to run. + if(BUILD_SHARED_LIBS) + add_custom_command(OUTPUT ${JSBSIM_TEST_PACKAGE_DIR}/JSBSim.dll + COMMAND ${CMAKE_COMMAND} -E copy_if_different + $ + ${JSBSIM_TEST_PACKAGE_DIR}) + add_custom_target(CopyJSBSimDLL ALL DEPENDS ${JSBSIM_TEST_PACKAGE_DIR}/JSBSim.dll) + add_dependencies(CopyJSBSimDLL libJSBSim) + endif(BUILD_SHARED_LIBS) +endif(WIN32) add_subdirectory(fpectl) -# Windows needs the DLL to be copied locally for unit tests to run. -if(WIN32 AND BUILD_SHARED_LIBS) - add_custom_command(OUTPUT ${JSBSIM_TEST_PACKAGE_DIR}/JSBSim.dll - COMMAND ${CMAKE_COMMAND} -E copy_if_different - $ - ${JSBSIM_TEST_PACKAGE_DIR}) - add_custom_target(CopyJSBSimDLL ALL DEPENDS ${JSBSIM_TEST_PACKAGE_DIR}/JSBSim.dll) - add_dependencies(CopyJSBSimDLL libJSBSim) -endif(WIN32 AND BUILD_SHARED_LIBS) - # Install the JSBSim Python module if (INSTALL_JSBSIM_PYTHON_MODULE) execute_process(COMMAND ${Python3_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/findInstallDir.py OUTPUT_VARIABLE PYTHON_INSTALL_DIR) diff --git a/src/input_output/FGOutputType.cpp b/src/input_output/FGOutputType.cpp index 40e3aa997e..652137a793 100644 --- a/src/input_output/FGOutputType.cpp +++ b/src/input_output/FGOutputType.cpp @@ -184,9 +184,9 @@ bool FGOutputType::InitModel(void) //%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% -bool FGOutputType::Run(void) +bool FGOutputType::Run(bool Holding) { - if (FGModel::Run(false)) return true; + if (FGModel::Run(Holding)) return true; if (!enabled) return true; RunPreFunctions(); diff --git a/src/input_output/FGOutputType.h b/src/input_output/FGOutputType.h index 850150ebbb..a1a042527a 100644 --- a/src/input_output/FGOutputType.h +++ b/src/input_output/FGOutputType.h @@ -142,12 +142,14 @@ class FGOutputType : public FGModel bool InitModel(void) override; /** Executes the output directives (implement the FGModel interface). - This method checks that the current time step matches the output - rate and calls the registered "pre" functions, the output - generation and finally the "post" functions. + This method checks that the current time step matches the output rate and + calls the registered "pre" functions, the output generation and finally + the "post" functions. + @param Holding if true, the executive has been directed to hold the sim + from advancing time. @result false if no error. */ - bool Run(void); + bool Run(bool Holding) override; /** Generate the output. This is a pure method so it must be implemented by the classes that inherits from FGOutputType. The Print name may not be diff --git a/src/math/FGTemplateFunc.h b/src/math/FGTemplateFunc.h index 766d364d09..a98c0e8352 100644 --- a/src/math/FGTemplateFunc.h +++ b/src/math/FGTemplateFunc.h @@ -65,8 +65,11 @@ class FGTemplateFunc : public FGFunction } private: - /** FGTemplateFunc must not be bound to the property manager. The bind method - is therefore made private and overloaded as a no-op */ + /* Direct calls to FGFunction::GetValue are meaningless from the public interface. + The method is therefore made private. */ + using FGFunction::GetValue; + /* FGTemplateFunc must not be bound to the property manager. The bind method + is therefore made private and overloaded as a no-op */ void bind(Element*, const std::string&) override {} FGPropertyValue_ptr var; }; diff --git a/src/models/FGOutput.cpp b/src/models/FGOutput.cpp index f98abb5a68..c310aa5be5 100644 --- a/src/models/FGOutput.cpp +++ b/src/models/FGOutput.cpp @@ -99,7 +99,7 @@ bool FGOutput::Run(bool Holding) if (!enabled) return true; for (auto output: OutputTypes) - output->Run(); + output->Run(Holding); return false; } diff --git a/src/simgear/props/props.cxx b/src/simgear/props/props.cxx index 04b872a5cf..254ea3f8ad 100644 --- a/src/simgear/props/props.cxx +++ b/src/simgear/props/props.cxx @@ -540,7 +540,7 @@ find_node (SGPropertyNode * current, using namespace boost; typedef split_iterator::type> PathSplitIterator; - + PathSplitIterator itr = make_split_iterator(path, first_finder("/", is_equal())); if (*path.begin() == '/') @@ -878,7 +878,7 @@ SGPropertyNode::SGPropertyNode (const SGPropertyNode &node) } switch (_type) { case props::BOOL: - set_bool(node.get_bool()); + set_bool(node.get_bool()); break; case props::INT: set_int(node.get_int()); @@ -1305,7 +1305,7 @@ SGPropertyNode::getType () const } -bool +bool SGPropertyNode::getBoolValue () const { // Shortcut for common case @@ -1338,7 +1338,7 @@ SGPropertyNode::getBoolValue () const } } -int +int SGPropertyNode::getIntValue () const { // Shortcut for common case @@ -1371,7 +1371,7 @@ SGPropertyNode::getIntValue () const } } -long +long SGPropertyNode::getLongValue () const { // Shortcut for common case @@ -1404,7 +1404,7 @@ SGPropertyNode::getLongValue () const } } -float +float SGPropertyNode::getFloatValue () const { // Shortcut for common case @@ -1437,7 +1437,7 @@ SGPropertyNode::getFloatValue () const } } -double +double SGPropertyNode::getDoubleValue () const { // Shortcut for common case @@ -1570,7 +1570,7 @@ SGPropertyNode::setIntValue (int value) case props::STRING: case props::UNSPECIFIED: { char buf[128]; - sprintf(buf, "%d", value); + snprintf(buf, 128, "%d", value); result = set_string(buf); break; } @@ -1621,7 +1621,7 @@ SGPropertyNode::setLongValue (long value) case props::STRING: case props::UNSPECIFIED: { char buf[128]; - sprintf(buf, "%ld", value); + snprintf(buf, 128, "%ld", value); result = set_string(buf); break; } @@ -1672,7 +1672,7 @@ SGPropertyNode::setFloatValue (float value) case props::STRING: case props::UNSPECIFIED: { char buf[128]; - sprintf(buf, "%f", value); + snprintf(buf, 128, "%f", value); result = set_string(buf); break; } @@ -1723,7 +1723,7 @@ SGPropertyNode::setDoubleValue (double value) case props::STRING: case props::UNSPECIFIED: { char buf[128]; - sprintf(buf, "%f", value); + snprintf(buf, 128, "%f", value); result = set_string(buf); break; } @@ -2558,7 +2558,7 @@ template<> std::ostream& SGRawBase::printOn(std::ostream& stream) const { const SGVec4d vec - = static_cast*>(this)->getValue(); + = static_cast*>(this)->getValue(); for (int i = 0; i < 4; ++i) { stream << vec[i]; if (i < 3) diff --git a/utils/aeromatic++/Systems/Controls.h b/utils/aeromatic++/Systems/Controls.h index a2945d3e12..fd5d16bb69 100644 --- a/utils/aeromatic++/Systems/Controls.h +++ b/utils/aeromatic++/Systems/Controls.h @@ -72,7 +72,7 @@ class YawDamper : public System void set(const float cg_loc[3]) override { _control->set(cg_loc); } - std::string system(); + std::string system() override; std::string lift() override { return _control->lift(); @@ -111,7 +111,7 @@ class FlyByWire : public System void set(const float cg_loc[3]) override { _control->set(cg_loc); } - std::string system(); + std::string system() override; std::string lift() override { return _control->lift(); @@ -146,7 +146,7 @@ class Controls : public System void set(const float cg_loc[3]) override { _control[_ctype]->set(cg_loc); } - std::string comment(); + std::string comment() override; std::string fdm() override { return _control[_ctype]->fdm(); } @@ -205,4 +205,3 @@ class Controls : public System } /* namespace Aeromatic */ #endif /* __CONTROLS_H */ - diff --git a/utils/aeromatic++/Systems/Propulsion.h b/utils/aeromatic++/Systems/Propulsion.h index ae6ae9eb4e..f9371a97cb 100644 --- a/utils/aeromatic++/Systems/Propulsion.h +++ b/utils/aeromatic++/Systems/Propulsion.h @@ -212,8 +212,8 @@ class Propulsion : public Engine return _propulsion[_ptype]->_thruster->thruster(); } - void param_reset(); - Param* param_next(); + void param_reset() override; + Param* param_next() override; char _engine_name[PARAM_MAX_STRING+1] = ""; public: @@ -242,4 +242,3 @@ class Propulsion : public Engine } // namespace Aeromatic #endif /* __ENGINE_H */ -