Skip to content

Commit f7b3580

Browse files
jeandemangedrolnico
authored andcommitted
Add Windows CI (#176)
* try rework github workflows Signed-off-by: Damien Jeandemange <[email protected]> * try rework github workflows Signed-off-by: Damien Jeandemange <[email protected]> * clang tidy Signed-off-by: Damien Jeandemange <[email protected]> * clang tidy Signed-off-by: Damien Jeandemange <[email protected]> * clang tidy Signed-off-by: Damien Jeandemange <[email protected]> * clang tidy Signed-off-by: Damien Jeandemange <[email protected]> * clang tidy Signed-off-by: Damien Jeandemange <[email protected]> * clang tidy Signed-off-by: Damien Jeandemange <[email protected]> * artifacts Signed-off-by: Damien Jeandemange <[email protected]> * artifacts Signed-off-by: Damien Jeandemange <[email protected]> * artifacts Signed-off-by: Damien Jeandemange <[email protected]> * artifacts Signed-off-by: Damien Jeandemange <[email protected]> * wip Signed-off-by: Damien Jeandemange <[email protected]> * fix Signed-off-by: Damien Jeandemange <[email protected]> * wip windows ci Signed-off-by: Damien Jeandemange <[email protected]> * wip windows ci Signed-off-by: Damien Jeandemange <[email protected]> * wip windows ci Signed-off-by: Damien Jeandemange <[email protected]> * wip windows ci / cpp tests Signed-off-by: Damien Jeandemange <[email protected]> * test Signed-off-by: Damien Jeandemange <[email protected]> * test Signed-off-by: Damien Jeandemange <[email protected]> * test Signed-off-by: Damien Jeandemange <[email protected]> * wip Signed-off-by: Damien Jeandemange <[email protected]> * fix Signed-off-by: Damien Jeandemange <[email protected]> * fix Signed-off-by: Damien Jeandemange <[email protected]> * fix Signed-off-by: Damien Jeandemange <[email protected]> * use softprops/action-gh-release Signed-off-by: Damien Jeandemange <[email protected]> * use softprops/action-gh-release Signed-off-by: Damien Jeandemange <[email protected]> * update readme for cmake 3.14 Signed-off-by: Damien Jeandemange <[email protected]> --------- Signed-off-by: Damien Jeandemange <[email protected]> Co-authored-by: Nicolas Rol <[email protected]> (cherry picked from commit 3c3943a)
1 parent 68d8a46 commit f7b3580

File tree

8 files changed

+167
-15
lines changed

8 files changed

+167
-15
lines changed

Diff for: .github/workflows/dev-ci.yml

+49
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,55 @@ jobs:
239239
metrix-simulator/build/install/bin
240240
metrix-simulator/build/install/etc
241241
242+
cpp_windows:
243+
name: Build C++ Windows
244+
runs-on: windows-latest
245+
defaults:
246+
run:
247+
shell: cmd
248+
env:
249+
BOOST_ROOT: C:\thirdparties\boost-1.72.0
250+
BOOST_URL: https://sourceforge.net/projects/boost/files/boost-binaries/1.72.0/boost_1_72_0-msvc-14.2-64.exe/download
251+
steps:
252+
- name: Install Boost
253+
run: |
254+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
255+
choco install wget --no-progress
256+
wget -nv -O boost-installer.exe %BOOST_URL%
257+
boost-installer.exe /dir=%BOOST_ROOT% /sp- /verysilent /suppressmsgboxes /norestart
258+
259+
- name: Checkout sources
260+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 #v4.1.6
261+
262+
- name: Configure 3rd parties
263+
run: >
264+
cmake -S %GITHUB_WORKSPACE%\metrix-simulator\external -B %GITHUB_WORKSPACE%\metrix-simulator\build\external
265+
266+
- name: Build 3rd parties
267+
run: >
268+
cmake --build %GITHUB_WORKSPACE%\metrix-simulator\build\external --parallel 2 --config Release
269+
270+
- name: Configure CMake
271+
run: >
272+
cmake -Wno-dev -S %GITHUB_WORKSPACE%\metrix-simulator -B %GITHUB_WORKSPACE%\metrix-simulator\build
273+
-DCMAKE_BUILD_TYPE=Release
274+
-DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\metrix-simulator\build\install
275+
276+
- name: Build
277+
run: cmake --build %GITHUB_WORKSPACE%\metrix-simulator\build --target install --parallel 2 --config Release
278+
279+
- name: Tests
280+
run: cd %GITHUB_WORKSPACE%\metrix-simulator\build && ctest -j2 --output-on-failure -C Release
281+
282+
- name: Upload Metrix Simulator archive
283+
if: ${{ github.event_name == 'workflow_dispatch' && inputs.generate_artifacts }}
284+
uses: actions/upload-artifact@v3
285+
with:
286+
name: metrix-simulator-windows
287+
path: |
288+
metrix-simulator/build/install/bin
289+
metrix-simulator/build/install/etc
290+
242291
cpp_ubuntu_qa:
243292
name: Short QA C++ Ubuntu
244293
runs-on: ubuntu-latest

Diff for: .github/workflows/full-ci.yml

+40
Original file line numberDiff line numberDiff line change
@@ -201,6 +201,46 @@ jobs:
201201
- name: Tests
202202
run: cd $GITHUB_WORKSPACE/metrix-simulator/build && ctest -j2 --output-on-failure
203203

204+
cpp_windows:
205+
name: Build C++ Windows
206+
runs-on: windows-latest
207+
defaults:
208+
run:
209+
shell: cmd
210+
env:
211+
BOOST_ROOT: C:\thirdparties\boost-1.72.0
212+
BOOST_URL: https://sourceforge.net/projects/boost/files/boost-binaries/1.72.0/boost_1_72_0-msvc-14.2-64.exe/download
213+
steps:
214+
- name: Install Boost
215+
run: |
216+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
217+
choco install wget --no-progress
218+
wget -nv -O boost-installer.exe %BOOST_URL%
219+
boost-installer.exe /dir=%BOOST_ROOT% /sp- /verysilent /suppressmsgboxes /norestart
220+
221+
- name: Checkout sources
222+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 #v4.1.6
223+
224+
- name: Configure 3rd parties
225+
run: >
226+
cmake -S %GITHUB_WORKSPACE%\metrix-simulator\external -B %GITHUB_WORKSPACE%\metrix-simulator\build\external
227+
228+
- name: Build 3rd parties
229+
run: >
230+
cmake --build %GITHUB_WORKSPACE%\metrix-simulator\build\external --parallel 2 --config Release
231+
232+
- name: Configure CMake
233+
run: >
234+
cmake -Wno-dev -S %GITHUB_WORKSPACE%\metrix-simulator -B %GITHUB_WORKSPACE%\metrix-simulator\build
235+
-DCMAKE_BUILD_TYPE=Release
236+
-DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\metrix-simulator\build\install
237+
238+
- name: Build
239+
run: cmake --build %GITHUB_WORKSPACE%\metrix-simulator\build --target install --parallel 2 --config Release
240+
241+
- name: Tests
242+
run: cd %GITHUB_WORKSPACE%\metrix-simulator\build && ctest -j2 --output-on-failure -C Release
243+
204244
cpp_ubuntu_qa:
205245
name: Full QA C++ Ubuntu
206246
runs-on: ubuntu-latest

Diff for: .github/workflows/release-ci.yml

+57
Original file line numberDiff line numberDiff line change
@@ -215,3 +215,60 @@ jobs:
215215
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
216216
with:
217217
files: ${{ steps.metrix-install.outputs.archive_path }}.zip
218+
219+
cpp_windows:
220+
name: Package C++ Windows
221+
runs-on: windows-latest
222+
defaults:
223+
run:
224+
shell: cmd
225+
env:
226+
BOOST_ROOT: C:\thirdparties\boost-1.72.0
227+
BOOST_URL: https://sourceforge.net/projects/boost/files/boost-binaries/1.72.0/boost_1_72_0-msvc-14.2-64.exe/download
228+
steps:
229+
- name: Install Boost
230+
run: |
231+
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
232+
choco install wget --no-progress
233+
wget -nv -O boost-installer.exe %BOOST_URL%
234+
boost-installer.exe /dir=%BOOST_ROOT% /sp- /verysilent /suppressmsgboxes /norestart
235+
236+
- name: Checkout sources
237+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 #v4.1.6
238+
239+
- name: Configure 3rd parties
240+
run: >
241+
cmake -S %GITHUB_WORKSPACE%\metrix-simulator\external -B %GITHUB_WORKSPACE%\metrix-simulator\build\external
242+
243+
- name: Build 3rd parties
244+
run: >
245+
cmake --build %GITHUB_WORKSPACE%\metrix-simulator\build\external --parallel 2 --config Release
246+
247+
- name: Configure CMake
248+
run: >
249+
cmake -Wno-dev -S %GITHUB_WORKSPACE%\metrix-simulator -B %GITHUB_WORKSPACE%\metrix-simulator\build
250+
-DCMAKE_BUILD_TYPE=Release
251+
-DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\metrix-simulator\build\install
252+
253+
- name: Build
254+
run: cmake --build %GITHUB_WORKSPACE%\metrix-simulator\build --target install --parallel 2 --config Release
255+
256+
- name: Tests
257+
run: cd %GITHUB_WORKSPACE%\metrix-simulator\build && ctest -j2 --output-on-failure -C Release
258+
259+
- name: Prepare Metrix package
260+
id: metrix-install
261+
shell: powershell
262+
run: |
263+
$env:ARCHIVE_NAME = "metrix-simulator-windows"
264+
$env:ARCHIVE_PATH = "$env:GITHUB_WORKSPACE\$env:ARCHIVE_NAME"
265+
$env:ARCHIVE_PATH = $env:ARCHIVE_PATH -replace '\\','/'
266+
cd $env:GITHUB_WORKSPACE/metrix-simulator/build/install
267+
Compress-Archive -Path bin,etc -Destination $env:ARCHIVE_PATH
268+
echo "archive_name=$env:ARCHIVE_NAME" >> "$env:GITHUB_OUTPUT"
269+
echo "archive_path=$env:ARCHIVE_PATH" >> "$env:GITHUB_OUTPUT"
270+
271+
- name: Upload release package
272+
uses: softprops/action-gh-release@e7a8f85e1c67a31e6ed99a94b41bd0b71bbee6b8 # v2.0.9
273+
with:
274+
files: ${{ steps.metrix-install.outputs.archive_path }}.zip

Diff for: README.md

+10-10
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ all input options are described in --help option
183183

184184
To build metrix-simulator, you need:
185185
- A C++ compiler that supports C++11 ([clang](https://clang.llvm.org) 3.3 or higher, [g++](https://gcc.gnu.org) 5.0 or higher)
186-
- [CMake](https://cmake.org) (3.12 or higher)
186+
- [CMake](https://cmake.org) (3.14 or higher)
187187
- [Make](https://www.gnu.org/software/make/)
188188
- [Boost](https://www.boost.org) development packages (1.66 or higher)
189189

@@ -199,9 +199,9 @@ $> apt install -y g++ git libboost-all-dev libxml2-dev make wget
199199

200200
**Note:** Under Ubuntu 18.04, the default CMake package is too old (3.10), so you have to install it manually:
201201
```
202-
$> wget https://cmake.org/files/v3.12/cmake-3.12.0-Linux-x86_64.tar.gz
203-
$> tar xzf cmake-3.12.0-Linux-x86_64.tar.gz
204-
$> export PATH=$PWD/cmake-3.12.0-Linux-x86_64/bin:$PATH
202+
$> wget https://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.tar.gz
203+
$> tar xzf cmake-3.14.0-Linux-x86_64.tar.gz
204+
$> export PATH=$PWD/cmake-3.14.0-Linux-x86_64/bin:$PATH
205205
```
206206

207207
###### CentOS 8
@@ -211,9 +211,9 @@ $> yum install -y boost-devel gcc-c++ git libxml2-devel make wget
211211

212212
**Note:** Under CentOS 8, the default CMake package is too old (3.11.4), so you have to install it manually:
213213
```
214-
$> wget https://cmake.org/files/v3.12/cmake-3.12.0-Linux-x86_64.tar.gz
215-
$> tar xzf cmake-3.12.0-Linux-x86_64.tar.gz
216-
$> export PATH=$PWD/cmake-3.12.0-Linux-x86_64/bin:$PATH
214+
$> wget https://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.tar.gz
215+
$> tar xzf cmake-3.14.0-Linux-x86_64.tar.gz
216+
$> export PATH=$PWD/cmake-3.14.0-Linux-x86_64/bin:$PATH
217217
```
218218

219219
###### CentOS 7
@@ -230,9 +230,9 @@ $> export BOOST_LIBRARYDIR=/usr/lib64/boost166
230230

231231
**Note:** Under CentOS 7, the default CMake package is too old (2.8.12), so you have to install it manually:
232232
```
233-
$> wget https://cmake.org/files/v3.12/cmake-3.12.0-Linux-x86_64.tar.gz
234-
$> tar xzf cmake-3.12.0-Linux-x86_64.tar.gz
235-
$> export PATH=$PWD/cmake-3.12.0-Linux-x86_64/bin:$PATH
233+
$> wget https://cmake.org/files/v3.14/cmake-3.14.0-Linux-x86_64.tar.gz
234+
$> tar xzf cmake-3.14.0-Linux-x86_64.tar.gz
235+
$> export PATH=$PWD/cmake-3.14.0-Linux-x86_64/bin:$PATH
236236
```
237237
##### Build sources
238238

Diff for: metrix-simulator/CMakeLists.txt

+5-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
# SPDX-License-Identifier: MPL-2.0
99
#
1010

11-
cmake_minimum_required(VERSION 3.12 FATAL_ERROR)
11+
cmake_minimum_required(VERSION 3.14 FATAL_ERROR)
1212

1313
include(CMakePackageConfigHelpers)
1414

@@ -28,12 +28,14 @@ set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
2828
set(INSTALL_CMAKE_DIR cmake CACHE PATH "Installation directory for cmake files")
2929

3030
if(MSVC)
31-
add_compile_definitions(WIN32)
31+
add_definitions(-D_WIN32_WINNT=0x0A00)
32+
add_compile_definitions("_CRT_SECURE_NO_WARNINGS")
3233
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /STACK:5000000 ")
3334
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
3435
# In release, we prefer speed over size of the code
3536
set(CMAKE_CXX_FLAGS_RELEASE "/O2")
3637
set(CMAKE_C_FLAGS_RELEASE "/O2")
38+
set(Boost_USE_STATIC_RUNTIME ON)
3739
else()
3840
if(NOT CMAKE_BUILD_TYPE)
3941
set(CMAKE_BUILD_TYPE Release)
@@ -142,6 +144,7 @@ target_link_libraries(${target}
142144
SuiteSparse::SuiteSparse_BTF
143145
SuiteSparse::SuiteSparse_Config
144146
${Boost_LIBRARIES}
147+
$<$<BOOL:${MSVC}>:msvcrt.lib>
145148
)
146149

147150
if (USE_SIRIUS_SHARED)

Diff for: metrix-simulator/cmake/tnr.cmake

+1-2
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
#
1111

1212
function(check_file file expected_file)
13-
configure_file(${file} ${file} NEWLINE_STYLE LF) # required for windows ctest
14-
execute_process( COMMAND ${CMAKE_COMMAND} -E compare_files ${file} ${expected_file}
13+
execute_process( COMMAND ${CMAKE_COMMAND} -E compare_files --ignore-eol ${file} ${expected_file}
1514
RESULT_VARIABLE compare_result)
1615
if(compare_result)
1716
MESSAGE(FATAL_ERROR "File " ${file} " is different from expected file " ${expected_file})

Diff for: metrix-simulator/log/src/logger.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@
1717
#include <algorithm>
1818
#include <cstring>
1919

20+
#if defined(_MSC_VER)
21+
#define localtime_r(T,Tm) (localtime_s(Tm,T) ? NULL : Tm)
22+
#endif
23+
2024
using namespace boost::log;
2125

2226
namespace metrix

Diff for: metrix-simulator/tests/variantes_regroupees/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,6 @@ set(TEST_DIR ${MAIN_TEST_DIR}/${TEST_DIR_NAME})
1515
set(EXPECTED_TEST_DIR ${MAIN_TEST_DIR}_reference/${TEST_DIR_NAME})
1616

1717
if(METRIX_RUN_ALL_TESTS)
18-
metrix_test("variantes_regroupees_complexe" 11) # no check here because of random and equivalent solutions
18+
metrix_test_no_check("variantes_regroupees_complexe" 11) # no check here because of random and equivalent solutions
1919
endif()
2020
metrix_test("variantes_regroupees_simple" 8)

0 commit comments

Comments
 (0)