Skip to content

Commit 9272780

Browse files
committed
Merge branch 'feature/win-test' into 'develop'
Build and run tests on Windows CI runner See merge request iniparser/iniparser!166
2 parents f7a86f9 + b30cd12 commit 9272780

File tree

3 files changed

+26
-2
lines changed

3 files changed

+26
-2
lines changed

.gitlab-ci.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,10 +95,14 @@ win-build:
9595
- .shared_windows_runners
9696
stage: win
9797
script:
98+
- git clone https://github.com/tronkko/dirent.git
9899
- mkdir build
99100
- cd build
100-
- cmake -DBUILD_DOCS=OFF -DBUILD_EXAMPLES=ON ..
101+
- cmake -DCMAKE_INCLUDE_PATH="../dirent/include" -DBUILD_DOCS=OFF -DBUILD_TESTING=ON -DBUILD_EXAMPLES=ON ..
101102
- cmake --build .
103+
# due to the long provisioning time of the Windows runner, tests are
104+
# executed in the same stage as the build
105+
- ctest -C Debug --verbose
102106
artifacts:
103107
paths:
104108
- install/

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cmake_minimum_required(VERSION 3.12)
1+
cmake_minimum_required(VERSION 3.18)
22

33
project(iniparser VERSION 4.2.2)
44

test/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,21 @@ find_program(
99
PATH
1010
REQUIRED)
1111

12+
if(MSVC)
13+
message(STATUS "MSVC environment")
14+
find_file(
15+
MSVC_DIRENT
16+
"dirent.h"
17+
REQUIRED)
18+
message(STATUS "MSVC_DIRENT: ${MSVC_DIRENT}")
19+
get_filename_component(
20+
MSVC_DIRENT_INCLUDE_DIR
21+
${MSVC_DIRENT}
22+
DIRECTORY)
23+
message(STATUS "MSVC_DIRENT_INCLUDE_DIR: ${MSVC_DIRENT_INCLUDE_DIR}")
24+
include_directories(${MSVC_DIRENT_INCLUDE_DIR})
25+
endif()
26+
1227
set(FETCHCONTENT_QUIET OFF)
1328

1429
FetchContent_Declare(
@@ -45,6 +60,11 @@ function(create_test_runner)
4560

4661
add_executable(test_${TEST_RUNNER_NAME} test_${TEST_RUNNER_NAME}.c
4762
test_${TEST_RUNNER_NAME}_runner.c)
63+
# Prevent MSVC from creating Debug or Release subdirectories for test
64+
# executables
65+
set_target_properties(
66+
test_${TEST_RUNNER_NAME} PROPERTIES RUNTIME_OUTPUT_DIRECTORY
67+
${CMAKE_CURRENT_BINARY_DIR}/$<0:>)
4868
foreach(TARGET_TYPE ${TARGET_TYPES})
4969
# if BUILD_STATIC_LIBS=ON shared takes precedence
5070
target_link_libraries(

0 commit comments

Comments
 (0)