Skip to content

Commit

Permalink
[CI] Add sirius lib to PATH (#1725)
Browse files Browse the repository at this point in the history
**Description**

On windows, running antares requires to have sirius DLL in the search
path for libraries.
In particular, unit tests linked with sirius need that. 

The current implemented solution is a somewhat dirty workaround:
for each executable linked (possibly transitively) with sirius, we have
a special CMake macro which needs to be used to copy sirius DLL to the
same directory as the executable.

This requires developers to modify the build just to solve an
installation issue, and this for **each** executable that are linked
with sirius.

**Solution**
Instead, the PR proposes to add sirius installation directory to the
PATH variable.
Executing unit tests will now rely on normal windows DLL search
mechanism, and the developer only has to use the standard
`target_link_libraries` in CMake files.

---------

Signed-off-by: Sylvain Leclerc <sylvain.leclerc@rte-france.com>
Co-authored-by: Florian OMNES <26088210+flomnes@users.noreply.github.com>
sylvlecl and flomnes authored Dec 27, 2023
1 parent 32e02fd commit 7590941
Showing 4 changed files with 1 addition and 9 deletions.
Original file line number Diff line number Diff line change
@@ -27,6 +27,7 @@ runs:
wget https://github.com/AntaresSimulatorTeam/antares-deps/releases/download/v${{inputs.antares-deps-version}}/rte-antares-deps-${{inputs.os}}-${{inputs.buildtype}}.zip
unzip rte-antares-deps-${{inputs.os}}-${{inputs.buildtype}}.zip
rm -rf rte-antares-deps-${{inputs.os}}-${{inputs.buildtype}}.zip
echo "${GITHUB_WORKSPACE}/rte-antares-deps-Release/bin" >> $GITHUB_PATH
- name: Download & extract OR-Tools
shell: bash
2 changes: 0 additions & 2 deletions src/tests/end-to-end/binding_constraints/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -28,5 +28,3 @@ target_include_directories(tests-binding_constraints
add_test(NAME end-to-end-binding_constraints COMMAND tests-binding_constraints)
set_property(TEST end-to-end-binding_constraints PROPERTY LABELS end-to-end)
set_target_properties(tests-binding_constraints PROPERTIES FOLDER Unit-tests/end_to_end)

copy_dependency(sirius_solver tests-binding_constraints)
3 changes: 0 additions & 3 deletions src/tests/end-to-end/simple_study/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -33,9 +33,6 @@ add_test(NAME end-to-end-simple-study COMMAND tests-simple-study)
set_property(TEST end-to-end-simple-study PROPERTY LABELS end-to-end)
set_target_properties(tests-simple-study PROPERTIES FOLDER Unit-tests/end_to_end)


copy_dependency(sirius_solver tests-simple-study)

# Storing tests-simple-study under the folder Unit-tests in the IDE

#----------------------------------------------------------
Original file line number Diff line number Diff line change
@@ -8,10 +8,6 @@ target_link_libraries(test-unfeasible-problem-analyzer
infeasible_problem_analysis
)

# TODO: this is necessary so that windows can find the DLL without running "cmake --install"
# Is there a better way to achieve this ?
copy_dependency(sirius_solver test-unfeasible-problem-analyzer)

add_test(NAME test-unfeasible-problem-analyzer COMMAND test-unfeasible-problem-analyzer)

# Storing the executable under the folder Unit-tests in Visual Studio

0 comments on commit 7590941

Please sign in to comment.