Spaces:
Running
Running
Przemysław Pawełczyk
commited on
server : fix building and simplify lib deps on Windows (#1772)
Browse files* make : fix server example building on MSYS2 environments (Windows)
It was not working since commit eff3570f78742dfd56024328ed93d4f442434280
when server was introduced.
* cmake : simplify server example lib deps on Windows
server uses httplib::Server, not httplib::SSLServer, so there is no need
to mention cryptographic libraries in target_link_libraries.
Winsock (ws2_32) suffices here.
Also use plain library names like we use in other places.
- Makefile +11 -1
- examples/server/CMakeLists.txt +2 -4
Makefile
CHANGED
|
@@ -99,6 +99,16 @@ ifeq ($(filter $(UNAME_S),Linux Darwin DragonFly FreeBSD NetBSD OpenBSD Haiku),$
|
|
| 99 |
CXXFLAGS += -pthread
|
| 100 |
endif
|
| 101 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
# Architecture specific
|
| 103 |
# TODO: probably these flags need to be tweaked on some architectures
|
| 104 |
# feel free to update the Makefile for your architecture and send a pull request or issue
|
|
@@ -360,7 +370,7 @@ quantize: examples/quantize/quantize.cpp $(WHISPER_OBJ) $(SRC_COMMON)
|
|
| 360 |
$(CXX) $(CXXFLAGS) examples/quantize/quantize.cpp $(SRC_COMMON) $(WHISPER_OBJ) -o quantize $(LDFLAGS)
|
| 361 |
|
| 362 |
server: examples/server/server.cpp $(SRC_COMMON) $(WHISPER_OBJ)
|
| 363 |
-
$(CXX) $(CXXFLAGS) examples/server/server.cpp $(SRC_COMMON) $(WHISPER_OBJ) -o server $(LDFLAGS)
|
| 364 |
|
| 365 |
stream: examples/stream/stream.cpp $(SRC_COMMON) $(SRC_COMMON_SDL) $(WHISPER_OBJ)
|
| 366 |
$(CXX) $(CXXFLAGS) examples/stream/stream.cpp $(SRC_COMMON) $(SRC_COMMON_SDL) $(WHISPER_OBJ) -o stream $(CC_SDL) $(LDFLAGS)
|
|
|
|
| 99 |
CXXFLAGS += -pthread
|
| 100 |
endif
|
| 101 |
|
| 102 |
+
# detect Windows
|
| 103 |
+
ifneq ($(findstring _NT,$(UNAME_S)),)
|
| 104 |
+
_WIN32 := 1
|
| 105 |
+
endif
|
| 106 |
+
|
| 107 |
+
# Windows Sockets 2 (Winsock) for network-capable apps
|
| 108 |
+
ifeq ($(_WIN32),1)
|
| 109 |
+
LWINSOCK2 := -lws2_32
|
| 110 |
+
endif
|
| 111 |
+
|
| 112 |
# Architecture specific
|
| 113 |
# TODO: probably these flags need to be tweaked on some architectures
|
| 114 |
# feel free to update the Makefile for your architecture and send a pull request or issue
|
|
|
|
| 370 |
$(CXX) $(CXXFLAGS) examples/quantize/quantize.cpp $(SRC_COMMON) $(WHISPER_OBJ) -o quantize $(LDFLAGS)
|
| 371 |
|
| 372 |
server: examples/server/server.cpp $(SRC_COMMON) $(WHISPER_OBJ)
|
| 373 |
+
$(CXX) $(CXXFLAGS) examples/server/server.cpp $(SRC_COMMON) $(WHISPER_OBJ) -o server $(LDFLAGS) $(LWINSOCK2)
|
| 374 |
|
| 375 |
stream: examples/stream/stream.cpp $(SRC_COMMON) $(SRC_COMMON_SDL) $(WHISPER_OBJ)
|
| 376 |
$(CXX) $(CXXFLAGS) examples/stream/stream.cpp $(SRC_COMMON) $(SRC_COMMON_SDL) $(WHISPER_OBJ) -o stream $(CC_SDL) $(LDFLAGS)
|
examples/server/CMakeLists.txt
CHANGED
|
@@ -5,8 +5,6 @@ include(DefaultTargetOptions)
|
|
| 5 |
|
| 6 |
target_link_libraries(${TARGET} PRIVATE common whisper ${CMAKE_THREAD_LIBS_INIT})
|
| 7 |
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
# Link the necessary libraries for SSL and Winsock
|
| 11 |
-
target_link_libraries(${TARGET} PRIVATE -lcrypt32 -lssl -lcrypto -lws2_32)
|
| 12 |
endif()
|
|
|
|
| 5 |
|
| 6 |
target_link_libraries(${TARGET} PRIVATE common whisper ${CMAKE_THREAD_LIBS_INIT})
|
| 7 |
|
| 8 |
+
if (WIN32)
|
| 9 |
+
target_link_libraries(${TARGET} PRIVATE ws2_32)
|
|
|
|
|
|
|
| 10 |
endif()
|