Skip to content

Commit

Permalink
no external dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
markaren committed Oct 31, 2024
1 parent 2aea2f5 commit 23e2761
Show file tree
Hide file tree
Showing 12 changed files with 14,874 additions and 1,101 deletions.
26 changes: 4 additions & 22 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
- name: Install prerequisites
run: |
sudo apt-get update && sudo apt-get install -y --no-install-recommends \
gcc g++ cmake libzip-dev libpugixml-dev
gcc g++ cmake libpugixml-dev
- name: Configure and build
run: |
cmake . -B build -DFMI4CPP_BUILD_TESTS=ON -DFMI4CPP_BUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release
cmake . -B build -DFMI4CPP_BUILD_TESTS=ON -DFMI4CPP_USE_EXTERNAL_PUGIXML=ON -DFMI4CPP_BUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build
- name: Test
Expand All @@ -45,18 +45,9 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Restore artifacts, or run vcpkg, build (and cache artifacts as post step)
uses: lukka/run-vcpkg@v10
id: runvcpkg
with:
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgGitCommitId: '4cac260c4b7331538d31886f57739fea0bffa27e'
vcpkgJsonGlob: 'vcpkg.json'
appendedCacheKey: vcpkginstall

- name: Configure and build
run: |
cmake . -B build -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DFMI4CPP_BUILD_TESTS=ON -DFMI4CPP_BUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release
cmake . -B build -DFMI4CPP_BUILD_TESTS=ON -DFMI4CPP_BUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build
- name: Test
Expand All @@ -75,18 +66,9 @@ jobs:
steps:
- uses: actions/checkout@v3

- name: Restore artifacts, or run vcpkg, build (and cache artifacts as post step)
uses: lukka/run-vcpkg@v10
id: runvcpkg
with:
vcpkgDirectory: '${{ github.workspace }}/vcpkg'
vcpkgGitCommitId: '4cac260c4b7331538d31886f57739fea0bffa27e'
vcpkgJsonGlob: 'vcpkg.json'
appendedCacheKey: vcpkginstall

- name: Configure and build
run: |
cmake . -B build -A x64 -DCMAKE_TOOLCHAIN_FILE="${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake" -DFMI4CPP_BUILD_TESTS=ON -DFMI4CPP_BUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release
cmake . -B build -A x64 -DFMI4CPP_BUILD_TESTS=ON -DFMI4CPP_BUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release
cmake --build build --config Release
shell: bash

Expand Down
15 changes: 11 additions & 4 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
### BUILDING

For building FMI4cpp, you can use either `vcpkg` or `apt-get` for getting the required dependencies.
FMI4cpp does not need any additional dependencies. For unzipping in depends on system tools.
This should be available on Windows, on linux you might need to install `unzip``.

##### vcpkg
```bash
Linux:~/$ sudo apt-get install unzip
```

For XML handling, it ships with a version of pugiXML. If you want to use an external version then pass
`-DFMI4CPP_USE_EXTERNAL_PUGIXML=ON` to CMake.

Call CMake with `-DCMAKE_TOOLCHAIN_FILE=[path to vcpkg]/scripts/buildsystems/vcpkg.cmake`
#### External pgiXML (Optional)
To get an external pugiXML version you may use `vcpkg` or `apt-get`.

##### apt-get

```bash
Linux:~/$ sudo apt-get install libzip-dev libpugixml-dev
Linux:~/$ sudo apt-get install libpugixml-dev
```

### Running examples/tests
Expand Down
7 changes: 4 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ message("Current fmi4cpp version: ${projectVersion}\n")

option(FMI4CPP_BUILD_TESTS "Build tests" OFF)
option(FMI4CPP_BUILD_EXAMPLES "Build examples" OFF)
option(FMI4CPP_USE_EXTERNAL_PUGIXML "Use external pugiXML" OFF)
option(BUILD_SHARED_LIBS "Build shared libraries instead of static libraries" ON)

set(FMI4CPP_LOG_LEVEL "DEFAULT" CACHE STRING "FMI4cpp logging level")
Expand Down Expand Up @@ -54,8 +55,9 @@ set(FMI4CPP_EXPORT_TARGET "${PROJECT_NAME}-targets")
# Dependencies
# ==============================================================================

find_package(LIBZIP REQUIRED)
find_package(PugiXML REQUIRED)
if (FMI4CPP_USE_EXTERNAL_PUGIXML)
find_package(PugiXML REQUIRED)
endif ()

if (FMI4CPP_BUILD_TESTS)

Expand Down Expand Up @@ -124,7 +126,6 @@ install(FILES "${versionFile}" DESTINATION "${FMI4CPP_CMAKE_INSTALL_DIR}")

# Install custom find modules
install(FILES
${PROJECT_SOURCE_DIR}/cmake/FindLIBZIP.cmake
${PROJECT_SOURCE_DIR}/cmake/FindPugiXML.cmake
DESTINATION
${FMI4CPP_CMAKE_INSTALL_DIR}
Expand Down
110 changes: 0 additions & 110 deletions cmake/FindLIBZIP.cmake

This file was deleted.

Loading

0 comments on commit 23e2761

Please sign in to comment.