From 6fe9deca2004480b09e09f1ad590ed23187c6b72 Mon Sep 17 00:00:00 2001 From: Bertrand Coconnier Date: Sat, 10 Feb 2024 19:55:20 +0100 Subject: [PATCH 1/4] Use `target_include_directories` wherever possible. --- CMakeLists.txt | 1 - julia/CMakeLists.txt | 3 +-- src/CMakeLists.txt | 8 +++----- src/simgear/xml/CMakeLists.txt | 3 +-- utils/aeromatic++/CMakeLists.txt | 2 +- 5 files changed, 6 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 410e0416ea..52e48220b6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -114,7 +114,6 @@ endif(BUILD_MATLAB_SFUNCTION) find_package(CxxTest) if (CXXTEST_FOUND) - include_directories(${PROJECT_SOURCE_DIR}/src) enable_testing() add_subdirectory(tests/unit_tests) list(APPEND LCOV_REMOVE_PATTERNS "'*/JSBSim.cpp'") diff --git a/julia/CMakeLists.txt b/julia/CMakeLists.txt index a5c5a5979f..653d6e5fea 100644 --- a/julia/CMakeLists.txt +++ b/julia/CMakeLists.txt @@ -2,9 +2,8 @@ set(CMAKE_CXX_STANDARD 14) find_package(JlCxx) # May modify CMAKE_CXX_STANDARD thus called after set(CMAKE_CXX_STANDARD ...) if(Julia_FOUND) - include_directories(${PROJECT_SOURCE_DIR}/src) - add_library(JSBSimJL SHARED jsbsimjl.cpp) + target_include_directories(JSBSimJL PRIVATE ${PROJECT_SOURCE_DIR}/src) target_link_libraries(JSBSimJL libJSBSim JlCxx::cxxwrap_julia) add_test(NAME TestJulia COMMAND ${Julia_EXECUTABLE} ${CMAKE_CURRENT_SOURCE_DIR}/test.jl) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 66d27b1a2b..c340080ec7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -65,14 +65,12 @@ add_library(libJSBSim ${HEADERS} ${SOURCES} $ $ ) -target_include_directories( - libJSBSim - PUBLIC $ -) +target_include_directories(libJSBSim PUBLIC + $) add_coverage(libJSBSim) if(EXPAT_FOUND) - include_directories(${EXPAT_INCLUDE_DIRS}) + target_include_directories(libJSBSim PRIVATE ${EXPAT_INCLUDE_DIRS}) if (PKG_CONFIG_FOUND) target_link_libraries(libJSBSim ${PC_EXPAT_LIBRARIES}) set(ALL_LINK_LIBRARIES ${PC_EXPAT_LIBRARIES}) diff --git a/src/simgear/xml/CMakeLists.txt b/src/simgear/xml/CMakeLists.txt index e63f9d9fd0..76e0151f5c 100644 --- a/src/simgear/xml/CMakeLists.txt +++ b/src/simgear/xml/CMakeLists.txt @@ -2,8 +2,6 @@ set(SOURCES easyxml.cxx) set(HEADERS easyxml.hxx) if(NOT EXPAT_FOUND) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) - list(APPEND SOURCES xmlparse.c xmltok.c xmlrole.c) @@ -26,6 +24,7 @@ if(NOT EXPAT_FOUND) endif() add_library(Xml OBJECT ${HEADERS} ${SOURCES}) +target_include_directories(Xml PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) set_target_properties(Xml PROPERTIES TARGET_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/utils/aeromatic++/CMakeLists.txt b/utils/aeromatic++/CMakeLists.txt index b47c8d9860..0d25f0055f 100644 --- a/utils/aeromatic++/CMakeLists.txt +++ b/utils/aeromatic++/CMakeLists.txt @@ -1,4 +1,3 @@ -INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR}) SET(CMAKE_CXX_STANDARD 11) SET(LIBAEROMATIC3 Aeromatic++) @@ -35,6 +34,7 @@ SET(AEROMATIC_OBJS ) ADD_LIBRARY( ${LIBAEROMATIC3} STATIC ${AEROMATIC_OBJS} ) +TARGET_INCLUDE_DIRECTORIES(${LIBAEROMATIC3} PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}) IF(WIN32) SET(EXTRA_LIBS "shlwapi.lib") From 5207ce85980efda7ce248278fc5a4f6e50c59cc4 Mon Sep 17 00:00:00 2001 From: Bertrand Coconnier Date: Sat, 2 Mar 2024 01:17:31 +0100 Subject: [PATCH 2/4] Check that `FGFDMExec` constructor parameters are correctly handled. --- tests/TestMiscellaneous.py | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/tests/TestMiscellaneous.py b/tests/TestMiscellaneous.py index 228215fab6..aa5dffe7fa 100644 --- a/tests/TestMiscellaneous.py +++ b/tests/TestMiscellaneous.py @@ -132,9 +132,19 @@ def test_inherit_with_extra_args(self): class FGFDMExecWithExtraArgs(jsbsim.FGFDMExec): def __init__(self, root_dir, pm_root, extra): self.extra = extra - super().__init__() - fdm = FGFDMExecWithExtraArgs(os.path.join(self.sandbox(), ""), None, True) + pm = jsbsim.FGPropertyManager() + root_node = pm.get_node("root", True) + self.assertFalse(pm.hasNode("/root/fdm/jsbsim")) + fdm = FGFDMExecWithExtraArgs( + self.sandbox(), jsbsim.FGPropertyManager(root_node), True + ) + self.assertEqual(fdm.get_root_dir(), self.sandbox()) + self.assertEqual( + fdm.get_property_manager().get_node().get_fully_qualified_name(), + "/root/fdm/jsbsim", + ) + self.assertTrue(pm.hasNode("/root/fdm/jsbsim")) self.assertTrue(fdm.extra) def test_invalid_pointer_wont_crash(self): From 110a3759a7700ca7bfdf113df9d65f1a3808a7b9 Mon Sep 17 00:00:00 2001 From: Bertrand Coconnier Date: Sun, 3 Mar 2024 16:13:59 +0100 Subject: [PATCH 3/4] Rename MinGW32 to MinGW --- .github/workflows/cpp-python-build.yml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/cpp-python-build.yml b/.github/workflows/cpp-python-build.yml index 79523da8de..0bcd4bcbc6 100644 --- a/.github/workflows/cpp-python-build.yml +++ b/.github/workflows/cpp-python-build.yml @@ -229,8 +229,8 @@ jobs: build/matlab/JSBSimSimulinkCompile.m build/matlab/RelWithDebInfo/JSBSim_SFunction.mex* - Windows-MinGW32: - name: C/C++ build (MinGW32) + Windows-MinGW: + name: C/C++ build (MinGW) needs: XML-validation runs-on: windows-2019 strategy: @@ -277,7 +277,7 @@ jobs: uses: actions/upload-artifact@v4 if: failure() with: - name: Windows_MinGW32.logs + name: Windows_MinGW.logs path: build/Testing/Temporary Windows-MSVC: @@ -737,7 +737,7 @@ jobs: files: all_targets.info Rolling-Release: - needs: [Test-Build-PyPackage-From-Source, Windows-MinGW32, Windows-installer] + needs: [Test-Build-PyPackage-From-Source, Windows-MinGW, Windows-installer] name: Deploy Rolling Release runs-on: ubuntu-latest if: github.event_name == 'push' && github.ref == 'refs/heads/master' @@ -769,7 +769,7 @@ jobs: Stable-Release: name: Deploy Stable Release if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') - needs: [Python-Wheels, Test-Build-PyPackage-From-Source, Windows-MinGW32, Windows-installer] + needs: [Python-Wheels, Test-Build-PyPackage-From-Source, Windows-MinGW, Windows-installer] runs-on: ubuntu-latest environment: release permissions: From ce8bd80f5405bacbf2ca26d730e5266720e15015 Mon Sep 17 00:00:00 2001 From: Bertrand Coconnier Date: Sun, 3 Mar 2024 16:40:22 +0100 Subject: [PATCH 4/4] Fix the codecov job. --- .github/workflows/cpp-python-build.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cpp-python-build.yml b/.github/workflows/cpp-python-build.yml index 0bcd4bcbc6..c83d4ee178 100644 --- a/.github/workflows/cpp-python-build.yml +++ b/.github/workflows/cpp-python-build.yml @@ -720,7 +720,7 @@ jobs: - name: Configure JSBSim run: | mkdir build && cd build - cmake -DENABLE_COVERAGE=ON -DBUILD_PYTHON_MODULE=OFF .. + cmake -DENABLE_COVERAGE=ON -DBUILD_PYTHON_MODULE=OFF -DBUILD_DOCS=OFF .. - name: Build JSBSim working-directory: build run: make -j2 @@ -733,8 +733,9 @@ jobs: - name: Upload to Codecov uses: codecov/codecov-action@v4 with: - directory: build/lcov/data/capture - files: all_targets.info + file: ./build/lcov/data/capture/all_targets.info + token: ${{ secrets.CODECOV_TOKEN }} + fail_ci_if_error: true Rolling-Release: needs: [Test-Build-PyPackage-From-Source, Windows-MinGW, Windows-installer]