From 4e10bdcd093e0cd035f402561a7152d5e605b6cb Mon Sep 17 00:00:00 2001 From: "Alexander.A.Utkin" Date: Fri, 23 Aug 2024 17:03:27 +0300 Subject: [PATCH] Windows build fix. Part --- .gitignore | 3 ++- pyreindexer/CMakeLists.txt | 12 ++++++++---- 2 files changed, 10 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index aafa825..8457632 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ __pycache__ -build/* +.idea/ +build*/ dist/* pyreindexer.egg-info/* qa_test/logs/ diff --git a/pyreindexer/CMakeLists.txt b/pyreindexer/CMakeLists.txt index a035b2a..5f817dd 100644 --- a/pyreindexer/CMakeLists.txt +++ b/pyreindexer/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.0) +cmake_minimum_required(VERSION 3.0..3.13) project(pyreindexer) @@ -23,9 +23,13 @@ set(LIBS_EXT ".so") set(LIBSRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/src) set(RESOURCES_DIR ${CMAKE_CURRENT_SOURCE_DIR}/lib/include) -set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror") -set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wextra -Werror -Wno-unused-parameter -fexceptions") -string (REPLACE "-O2" "-O3" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") +if(MSVC) + add_compile_options(/WX /EHsc -D_CRT_SECURE_NO_WARNINGS -DNOMINMAX) +else(MSVC) + set (CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -Werror") + set (CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -Wall -Wextra -Werror -Wno-unused-parameter -fexceptions") + string (REPLACE "-O2" "-O3" CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO}") +endif(MSVC) file(GLOB_RECURSE SRCS ${RESOURCES_DIR}/*.cc ${LIBSRC_DIR}/*.cc)