Skip to content

Commit db3d6e2

Browse files
Panquesito7github-actions[bot]realstealthninja
authored
feat: add Windows CI back (#1290)
Signed-off-by: realstealthninja <[email protected]> Co-authored-by: github-actions[bot] <[email protected]> Co-authored-by: realstealthninja <[email protected]>
1 parent 1302bf4 commit db3d6e2

16 files changed

+547
-81
lines changed

.github/workflows/awesome_workflow.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -57,14 +57,14 @@ jobs:
5757
needs: [MainSequence]
5858
strategy:
5959
matrix:
60-
os: [ubuntu-latest, macOS-latest]
60+
os: [windows-latest, ubuntu-latest, macOS-latest]
6161
steps:
6262
- uses: actions/checkout@v3
6363
with:
6464
submodules: true
6565
- run: |
6666
cmake -B ./build -S .
67-
cmake --build build
67+
cmake --build build --config Release
6868
- name: Label on PR fail
6969
uses: actions/github-script@v6
7070
if: ${{ failure() && matrix.os == 'ubuntu-latest' && github.event_name == 'pull_request' }}

CMakeLists.txt

+6-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
cmake_minimum_required(VERSION 3.22)
22
project(Algorithms_in_C
3-
LANGUAGES C
4-
VERSION 1.0.0
5-
DESCRIPTION "Set of algorithms implemented in C."
6-
)
3+
LANGUAGES C
4+
VERSION 1.0.0
5+
DESCRIPTION "Set of algorithms implemented in C."
6+
)
77

88
# Set compilation standards
99
set(CMAKE_C_STANDARD 11)
1010
set(CMAKE_C_STANDARD_REQUIRED YES)
11-
12-
if(MSVC)
11+
if (MSVC)
1312
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
1413
# add_compile_options(/Za)
15-
endif(MSVC)
14+
endif (MSVC)
1615

1716
# check for math library
1817
# addresses a bug when linking on OSX

DIRECTORY.md

+2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
* [Rot13](https://github.com/TheAlgorithms/C/blob/HEAD/cipher/rot13.c)
88

99
## Client Server
10+
* [Bool](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/bool.h)
1011
* [Client](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/client.c)
12+
* [Fork](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/fork.h)
1113
* [Remote Command Exec Udp Client](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/remote_command_exec_udp_client.c)
1214
* [Remote Command Exec Udp Server](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/remote_command_exec_udp_server.c)
1315
* [Server](https://github.com/TheAlgorithms/C/blob/HEAD/client_server/server.c)

client_server/CMakeLists.txt

+15-9
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ else()
66
CHECK_INCLUDE_FILE(arpa/inet.h ARPA_HEADERS)
77
endif()
88

9+
include(CheckSymbolExists)
910
if(ARPA_HEADERS OR WINSOCK_HEADER)
1011
# If necessary, use the RELATIVE flag, otherwise each source file may be listed
1112
# with full pathname. RELATIVE may makes it easier to extract an executable name
@@ -15,16 +16,21 @@ if(ARPA_HEADERS OR WINSOCK_HEADER)
1516
# AUX_SOURCE_DIRECTORY(${CMAKE_CURRENT_SOURCE_DIR} APP_SOURCES)
1617
foreach( testsourcefile ${APP_SOURCES} )
1718
# I used a simple string replace, to cut off .cpp.
18-
string( REPLACE ".c" "" testname ${testsourcefile} )
19-
add_executable( ${testname} ${testsourcefile} )
20-
21-
if(OpenMP_C_FOUND)
22-
target_link_libraries(${testname} PRIVATE OpenMP::OpenMP_C)
19+
string(REPLACE ".c" "" testname ${testsourcefile})
20+
21+
if(NOT WIN32)
22+
if(${testname} STREQUAL "fork" OR ${testname} STREQUAL "bool")
23+
continue()
24+
endif()
2325
endif()
24-
if(MATH_LIBRARY)
26+
add_executable(${testname} ${testsourcefile})
27+
28+
if (OpenMP_C_FOUND)
29+
target_link_libraries(${testname} PRIVATE OpenMP::OpenMP_C)
30+
endif ()
31+
if (MATH_LIBRARY)
2532
target_link_libraries(${testname} PRIVATE ${MATH_LIBRARY})
26-
endif()
27-
33+
endif ()
2834
# if(HAS_UNISTD)
2935
# target_compile_definitions(${testname} PRIVATE HAS_UNISTD)
3036
# endif()
@@ -34,7 +40,7 @@ if(ARPA_HEADERS OR WINSOCK_HEADER)
3440
# target_compile_definitions(${testname} PRIVATE WINSOCK_HEADER)
3541
# endif()
3642

37-
if(WINSOCK_HEADER)
43+
if (WINSOCK_HEADER)
3844
target_link_libraries(${testname} PRIVATE ws2_32) # link winsock library on windows
3945
endif()
4046

client_server/bool.h

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
/*
2+
* Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
3+
* Copyright (C) 2007 - INRIA
4+
*
5+
* Copyright (C) 2012 - 2016 - Scilab Enterprises
6+
*
7+
* This file is hereby licensed under the terms of the GNU GPL v2.0,
8+
* pursuant to article 5.3.4 of the CeCILL v.2.1.
9+
* This file was originally licensed under the terms of the CeCILL v2.1,
10+
* and continues to be available under such terms.
11+
* For more information, see the COPYING file which you should have received
12+
* along with this program.
13+
*
14+
*/
15+
#ifndef __BOOL_H__
16+
#define __BOOL_H__
17+
18+
/* define boolean type */
19+
#ifdef BOOL
20+
#undef BOOL
21+
#endif
22+
23+
#ifdef TRUE
24+
#undef TRUE
25+
#endif
26+
27+
#ifdef FALSE
28+
#undef FALSE
29+
#endif
30+
31+
32+
#ifndef _MSC_VER
33+
typedef enum
34+
{
35+
FALSE = 0,
36+
TRUE = 1
37+
} BOOL;
38+
39+
#else
40+
/* Please notice that BOOL is defined in <windef.h> */
41+
/* BUT windef.h includes all others windows include */
42+
/* it is better to redefine as */
43+
typedef int BOOL;
44+
#define FALSE 0
45+
#define TRUE 1
46+
47+
#endif
48+
/* converts BOOL to bool */
49+
#define BOOLtobool(w) ((w != FALSE) ? true : false)
50+
51+
/* converts bool to BOOL */
52+
#define booltoBOOL(w) ((w == true) ? TRUE : FALSE)
53+
54+
#endif /* __BOOL_H__ */
55+
/*--------------------------------------------------------------------------*/

0 commit comments

Comments
 (0)