From ce5564d2dc80fac73e6350c6e96869199a71e225 Mon Sep 17 00:00:00 2001 From: Oleksiy Slyshyk Date: Sun, 21 Jan 2018 14:02:45 +0200 Subject: [PATCH] fix build on windows (mingw64) --- amalgamate/merge_all.py | 5 +++-- examples/CMakeLists.txt | 4 ++++ examples/example.cpp | 4 ++++ tests/CMakeLists.txt | 4 ++++ 4 files changed, 15 insertions(+), 2 deletions(-) diff --git a/amalgamate/merge_all.py b/amalgamate/merge_all.py index afa012430..0befa3fb5 100644 --- a/amalgamate/merge_all.py +++ b/amalgamate/merge_all.py @@ -1,6 +1,7 @@ """Merges all the header files.""" from glob import glob from os import path as pt +import os import re from collections import defaultdict import sys @@ -11,8 +12,8 @@ OUTPUT = 'crow_all.h' re_depends = re.compile('^#include "(.*)"', re.MULTILINE) -headers = [x.rsplit('/', 1)[-1] for x in glob(pt.join(header_path, '*.h*'))] -headers += ['crow/' + x.rsplit('/', 1)[-1] for x in glob(pt.join(header_path, 'crow/*.h*'))] +headers = [x.rsplit(os.sep, 1)[-1] for x in glob(pt.join(header_path, '*.h*'))] +headers += ['crow/' + x.rsplit(os.sep, 1)[-1] for x in glob(pt.join(header_path, 'crow/*.h*'))] print(headers) edges = defaultdict(list) for header in headers: diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index efb4accaf..ec5539d75 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -1,6 +1,10 @@ cmake_minimum_required(VERSION 2.8) project (crow_examples) +if(WIN32) + list(APPEND Boost_LIBRARIES Ws2_32 Mswsock) +endif() + if (MSVC) add_executable(example_vs example_vs.cpp) target_link_libraries(example_vs ${Boost_LIBRARIES}) diff --git a/examples/example.cpp b/examples/example.cpp index 1355b03ec..b58683cab 100644 --- a/examples/example.cpp +++ b/examples/example.cpp @@ -164,7 +164,11 @@ int main() }); // enables all log +#ifndef ERROR app.loglevel(crow::LogLevel::DEBUG); +#else + app.loglevel(crow::LogLevel::Debug); +#endif //crow::logger::setHandler(std::make_shared()); app.port(18080) diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt index 65ab23021..f69792419 100644 --- a/tests/CMakeLists.txt +++ b/tests/CMakeLists.txt @@ -6,6 +6,10 @@ set(TEST_SRCS unittest.cpp ) +if(WIN32) + list(APPEND Boost_LIBRARIES Ws2_32 Mswsock) +endif() + add_executable(unittest ${TEST_SRCS}) #target_link_libraries(unittest crow) target_link_libraries(unittest ${Boost_LIBRARIES})