From e698a27d1c71738878ceae76d65ab011db7a990d Mon Sep 17 00:00:00 2001 From: Jack Andersen Date: Fri, 10 Mar 2017 07:58:43 -1000 Subject: [PATCH] Use HECL_MULTIPROCESSOR macro for enabling multithreaded work --- hecl/CMakeLists.txt | 1 + hecl/extern/athena | 2 +- hecl/lib/CMakeLists.txt | 4 ++++ hecl/lib/ClientProcess.cpp | 4 ++-- 4 files changed, 8 insertions(+), 3 deletions(-) diff --git a/hecl/CMakeLists.txt b/hecl/CMakeLists.txt index 7d8a69459..f4b1238f5 100644 --- a/hecl/CMakeLists.txt +++ b/hecl/CMakeLists.txt @@ -2,6 +2,7 @@ if(CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) cmake_minimum_required(VERSION 3.0) project(hecl) if(MSVC) + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /EHsc") # Shaddup MSVC add_definitions(-DUNICODE=1 -D_UNICODE=1 -D_CRT_SECURE_NO_WARNINGS=1 /wd4267 /wd4244) else() diff --git a/hecl/extern/athena b/hecl/extern/athena index 2a4fc3e3b..89968f1c3 160000 --- a/hecl/extern/athena +++ b/hecl/extern/athena @@ -1 +1 @@ -Subproject commit 2a4fc3e3b362de33a1cd3d997a5af94776788c85 +Subproject commit 89968f1c31f76d518b6cc86e2350097fddafe7c4 diff --git a/hecl/lib/CMakeLists.txt b/hecl/lib/CMakeLists.txt index ba83c0c6d..bd000edc2 100644 --- a/hecl/lib/CMakeLists.txt +++ b/hecl/lib/CMakeLists.txt @@ -20,6 +20,10 @@ atdna(atdna_Frontend.cpp ../include/hecl/Frontend.hpp) atdna(atdna_Runtime.cpp ../include/hecl/Runtime.hpp) atdna(atdna_CVar.cpp ../include/hecl/CVar.hpp) +if("${CMAKE_BUILD_TYPE}" STREQUAL "Release" OR "${CMAKE_BUILD_TYPE}" STREQUAL "RelWithDebInfo") + add_definitions(-DHECL_MULTIPROCESSOR) +endif() + add_library(hecl-common ${BLENDER_SOURCES} ${BACKEND_SOURCES} diff --git a/hecl/lib/ClientProcess.cpp b/hecl/lib/ClientProcess.cpp index c6c26ee87..82f684803 100644 --- a/hecl/lib/ClientProcess.cpp +++ b/hecl/lib/ClientProcess.cpp @@ -102,8 +102,8 @@ void ClientProcess::Worker::proc() ClientProcess::ClientProcess(int verbosityLevel) : m_verbosity(verbosityLevel) { -#if defined(NDEBUG) - int cpuCount = GetCPUCount(); +#ifdef HECL_MULTIPROCESSOR + const int cpuCount = GetCPUCount(); #else constexpr int cpuCount = 1; #endif