Skip to content

Commit 025355a

Browse files
committed
wip windows ci
Signed-off-by: Damien Jeandemange <[email protected]>
1 parent 31c2b2f commit 025355a

File tree

4 files changed

+71
-4
lines changed

4 files changed

+71
-4
lines changed

Diff for: .github/workflows/ci_windows.yml

+61
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CI-cpp-windows
2+
3+
on:
4+
workflow_dispatch: {}
5+
pull_request:
6+
types: [opened, ready_for_review, reopened]
7+
push:
8+
paths:
9+
- 'metrix-simulator/**'
10+
- '.github/workflows/ci_windows.yml'
11+
release:
12+
types: [published]
13+
14+
# Cancel previous workflows if they are the same workflow on same ref (branch/tags)
15+
# with the same event (push/pull_request) even they are in progress.
16+
# This setting will help reduce the number of duplicated workflows.
17+
concurrency:
18+
group: ${{ github.workflow }}-${{ github.ref }}-${{ github.event_name }}
19+
cancel-in-progress: true
20+
21+
defaults:
22+
run:
23+
shell: bash
24+
25+
jobs:
26+
windows:
27+
env:
28+
BOOST_ROOT: C:\thirdparties\boost-1.72.0
29+
BOOST_URL: https://sourceforge.net/projects/boost/files/boost-binaries/1.72.0/boost_1_72_0-msvc-14.2-64.exe/download
30+
name: Tests C++ Windows
31+
runs-on: windows-latest
32+
steps:
33+
34+
- name: Install Boost
35+
shell: cmd
36+
run: |
37+
wget -nv -O boost-installer.exe %BOOST_URL%
38+
boost-installer.exe /dir=%BOOST_ROOT% /sp- /verysilent /suppressmsgboxes /norestart
39+
40+
- name: Checkout sources
41+
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 #v4.1.6
42+
43+
- name: Configure 3rd parties
44+
run: >
45+
cmake -S %GITHUB_WORKSPACE%\metrix-simulator\external -B %GITHUB_WORKSPACE%\metrix-simulator\build-windows\external
46+
47+
- name: Build 3rd parties
48+
run: >
49+
cmake --build %GITHUB_WORKSPACE%\metrix-simulator\build-windows\external --parallel 2 --config Release
50+
51+
- name: Configure CMake
52+
run: >
53+
cmake -Wno-dev -S %GITHUB_WORKSPACE%\metrix-simulator -B %GITHUB_WORKSPACE%\metrix-simulator\build-windows
54+
-DCMAKE_BUILD_TYPE=Release
55+
-DCMAKE_INSTALL_PREFIX=%GITHUB_WORKSPACE%\metrix-simulator\build-windows\install
56+
57+
- name: Build
58+
run: cmake --build %GITHUB_WORKSPACE%\metrix-simulator\build-windows --target install --parallel 2 --config Release
59+
60+
# - name: Tests
61+
# run: cd %GITHUB_WORKSPACE%\metrix-simulator\build-windows && ctest -j8 --output-on-failure -C Release

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,7 +28,8 @@ 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
@@ -46,6 +47,7 @@ endif(MSVC)
4647

4748
set(Boost_USE_STATIC_LIBS ON)
4849
set(Boost_USE_MULTITHREADED ON)
50+
set(Boost_USE_STATIC_RUNTIME ON)
4951
find_package(Boost 1.66.0 REQUIRED COMPONENTS system program_options log filesystem)
5052

5153
option(USE_SIRIUS_SHARED "Use shared library for sirius solver" OFF)
@@ -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

0 commit comments

Comments
 (0)