Skip to content

Commit 32fdc81

Browse files
authored
Merge pull request #98 from c-jimenez/dev/compile_msvc
Add support for MSVC compiler with Visual Studio Community 2022
2 parents 83c4712 + 3577e6e commit 32fdc81

File tree

118 files changed

+284534
-372
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+284534
-372
lines changed

.clang-format

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,18 +8,37 @@ AllowShortBlocksOnASingleLine: Empty
88
AllowShortIfStatementsOnASingleLine: false
99
AllowShortLoopsOnASingleLine: false
1010
AllowShortFunctionsOnASingleLine: Inline
11+
AllowShortLambdasOnASingleLine: All
1112
AlignEscapedNewlines: Left
1213
AlignOperands: true
1314
AlignTrailingComments: true
14-
AllowShortBlocksOnASingleLine: false
1515
BreakConstructorInitializers: BeforeColon
1616
ReflowComments: false
1717
AllowShortCaseLabelsOnASingleLine: false
1818
BinPackParameters: false
1919
BinPackArguments: false
2020
PointerAlignment: Left
2121
IndentCaseLabels: true
22-
BreakBeforeBraces: Allman
2322
ConstructorInitializerAllOnOneLineOrOnePerLine: true
2423
SpaceInEmptyBlock: true
2524
AlwaysBreakTemplateDeclarations: Yes
25+
BreakBeforeBraces: Custom
26+
BraceWrapping:
27+
AfterCaseLabel: true
28+
AfterClass: true
29+
AfterControlStatement: Always
30+
AfterEnum: true
31+
AfterFunction: true
32+
AfterNamespace: true
33+
AfterObjCDeclaration: true
34+
AfterStruct: true
35+
AfterUnion: true
36+
AfterExternBlock: true
37+
BeforeCatch: true
38+
BeforeElse: true
39+
BeforeLambdaBody: true
40+
BeforeWhile: false
41+
IndentBraces: false
42+
SplitEmptyFunction: true
43+
SplitEmptyRecord: true
44+
SplitEmptyNamespace: true

.github/workflows/codeql-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ jobs:
6363
# uses a compiled language
6464

6565
- run: |
66-
make clang-native
66+
make clang
6767
6868
- name: Perform CodeQL Analysis
6969
uses: github/codeql-action/analyze@v2

.github/workflows/install-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@ jobs:
1616
- name: Install dependencies
1717
run: sudo apt-get install -y libev-dev libuv1-dev
1818
- name: make gcc install
19-
run: make BUILD_TYPE=Release INSTALL_PREFIX=/tmp/install-gcc tests-install-gcc-native
19+
run: make BUILD_TYPE=Release INSTALL_PREFIX=/tmp/install-gcc tests-install-gcc
2020
- name: make clang install
21-
run: make BUILD_TYPE=Release INSTALL_PREFIX=/tmp/install-clang tests-install-clang-native
21+
run: make BUILD_TYPE=Release INSTALL_PREFIX=/tmp/install-clang tests-install-clang

.github/workflows/unit-test-debug.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v2
1616
- name: make gcc Debug
17-
run: make gcc-native BUILD_TYPE=Debug
17+
run: make gcc BUILD_TYPE=Debug
1818
- name: unit tests gcc Debug
19-
run: make tests-gcc-native BUILD_TYPE=Debug
19+
run: make tests-gcc BUILD_TYPE=Debug
2020
- name: make clang Debug
21-
run: make clang-native BUILD_TYPE=Debug
21+
run: make clang BUILD_TYPE=Debug
2222
- name: unit tests clang
23-
run: make tests-clang-native BUILD_TYPE=Debug
23+
run: make tests-clang BUILD_TYPE=Debug

.github/workflows/unit-test-release.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,10 +14,10 @@ jobs:
1414
steps:
1515
- uses: actions/checkout@v2
1616
- name: make gcc Release
17-
run: make gcc-native BUILD_TYPE=Release
17+
run: make gcc BUILD_TYPE=Release
1818
- name: unit tests gcc Release
19-
run: make tests-gcc-native BUILD_TYPE=Release
19+
run: make tests-gcc BUILD_TYPE=Release
2020
- name: make clang Release
21-
run: make clang-native BUILD_TYPE=Release
21+
run: make clang BUILD_TYPE=Release
2222
- name: unit tests clang
23-
run: make tests-clang-native BUILD_TYPE=Release
23+
run: make tests-clang BUILD_TYPE=Release

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ build
22
build_*
33
bin/*
44
.vscode/settings.json
5+
.vs

3rdparty/CMakeLists.txt

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,21 @@ target_include_directories(rapidjson INTERFACE rapidjson/include)
1111
add_library(doctest INTERFACE)
1212
target_include_directories(doctest INTERFACE doctest/doctest)
1313

14+
# SQLite 3
15+
add_subdirectory(sqlite3)
16+
1417
# Use default flags for the libwebsockets library
15-
set(CMAKE_C_FLAGS_DEBUG "-O0 -g3 -ggdb3")
16-
set(CMAKE_CXX_FLAGS_DEBUG "-O0 -g3 -ggdb3")
17-
set(CMAKE_C_FLAGS_RELEASE "-O2 -DNDEBUG")
18-
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG")
18+
if (NOT MSVC)
19+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG_INIT} -O0 -g3 -ggdb3")
20+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_INIT} -O0 -g3 -ggdb3")
21+
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE_INIT} -O2 -DNDEBUG")
22+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE_INIT} -O2 -DNDEBUG")
23+
else()
24+
set(DISABLED_WARNING_LWS "/WX- /wd4191 /wd4996")
25+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG_INIT} ${DISABLED_WARNING_LWS}")
26+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_INIT} ${DISABLED_WARNING_LWS}")
27+
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE_INIT} ${DISABLED_WARNING_LWS}")
28+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE_INIT} ${DISABLED_WARNING_LWS}")
29+
endif()
1930

2031
add_subdirectory(libwebsockets)

3rdparty/libwebsockets/CMakeLists.txt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -849,8 +849,6 @@ endif()
849849
if (MSVC)
850850
# Turn off pointless microsoft security warnings.
851851
add_definitions(-D_CRT_SECURE_NO_DEPRECATE -D_CRT_NONSTDC_NO_DEPRECATE)
852-
# Fail the build if any warnings
853-
add_compile_options(/W3 /WX)
854852
# Unbreak MSVC broken preprocessor __VA_ARGS__ behaviour
855853
if (MSVC_VERSION GREATER 1925)
856854
add_compile_options(/Zc:preprocessor /wd5105)

3rdparty/sqlite3/CMakeLists.txt

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
#################################################################################
2+
# SQLite3 library #
3+
#################################################################################
4+
5+
# Use default flags for the SQLite3 library
6+
if (NOT MSVC)
7+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG_INIT} -O0 -g3 -ggdb3")
8+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_INIT} -O0 -g3 -ggdb3")
9+
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE_INIT} -O2 -DNDEBUG")
10+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE_INIT} -O2 -DNDEBUG")
11+
else()
12+
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG_INIT} /WX-")
13+
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG_INIT} /WX-")
14+
set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE_INIT} /WX-")
15+
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE_INIT} /WX-")
16+
endif()
17+
18+
# Static library
19+
add_library(sqlite3 sqlite3.c)
20+
target_include_directories(sqlite3 PUBLIC .)

0 commit comments

Comments
 (0)