Use C preprocessor to allow compilation in windows
authorunc0rr
Wed, 22 Oct 2008 15:40:49 +0000
changeset 1397 471c42a1c358
parent 1396 abb28dcb6d0d
child 1398 29eedf717d0f
Use C preprocessor to allow compilation in windows
netserver/CMakeLists.txt
netserver/hedgewars-server.hs
--- a/netserver/CMakeLists.txt	Wed Oct 22 15:31:35 2008 +0000
+++ b/netserver/CMakeLists.txt	Wed Oct 22 15:40:49 2008 +0000
@@ -14,6 +14,7 @@
 set(hwserv_main ${hedgewars_SOURCE_DIR}/netserver/hedgewars-server.hs)
 
 set(ghc_flags
+	-cpp
 	--make ${hwserv_main}
 	-i${hedgewars_SOURCE_DIR}/netserver
 	-o ${EXECUTABLE_OUTPUT_PATH}/hedgewars-server${CMAKE_EXECUTABLE_SUFFIX}
--- a/netserver/hedgewars-server.hs	Wed Oct 22 15:31:35 2008 +0000
+++ b/netserver/hedgewars-server.hs	Wed Oct 22 15:40:49 2008 +0000
@@ -12,7 +12,11 @@
 import Miscutils
 import HWProto
 import Opts
+
+#ifndef WIN32
 import System.Posix
+#endif
+
 
 acceptLoop :: Socket -> TChan ClientInfo -> IO ()
 acceptLoop servSock acceptChan = do
@@ -97,7 +101,9 @@
 
 
 main = withSocketsDo $ do
+#ifndef WIN32
 	installHandler sigPIPE Ignore Nothing;
+#endif
 	putStrLn $ "Listening on port " ++ show (listenPort globalOptions)
 	serverSocket <- listenOn $ PortNumber (listenPort globalOptions)
 	startServer serverSocket `finally` sClose serverSocket