Skip to content

Commit

Permalink
Maintenance / Minor changes (#1050)
Browse files Browse the repository at this point in the history
* Use `target_include_directories` wherever possible.

* Check that `FGFDMExec` constructor parameters are correctly handled.

* Rename MinGW32 to MinGW

* Fix the codecov job.
  • Loading branch information
bcoconni authored Mar 5, 2024
1 parent 37d4f25 commit b9bfc23
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 21 deletions.
17 changes: 9 additions & 8 deletions .github/workflows/cpp-python-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand All @@ -733,11 +733,12 @@ 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-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'
Expand Down Expand Up @@ -769,7 +770,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:
Expand Down
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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'")
Expand Down
3 changes: 1 addition & 2 deletions julia/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
8 changes: 3 additions & 5 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -65,14 +65,12 @@ add_library(libJSBSim ${HEADERS} ${SOURCES}
$<TARGET_OBJECTS:Simgear>
$<TARGET_OBJECTS:GeographicLib>
)
target_include_directories(
libJSBSim
PUBLIC $<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>
)
target_include_directories(libJSBSim PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}>)
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})
Expand Down
3 changes: 1 addition & 2 deletions src/simgear/xml/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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})

Expand Down
14 changes: 12 additions & 2 deletions tests/TestMiscellaneous.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
2 changes: 1 addition & 1 deletion utils/aeromatic++/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
SET(CMAKE_CXX_STANDARD 11)

SET(LIBAEROMATIC3 Aeromatic++)
Expand Down Expand Up @@ -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")
Expand Down

0 comments on commit b9bfc23

Please sign in to comment.