From 8157678eba97d7de5c53b424a9866d327392bbd9 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Mon, 31 May 2021 12:27:58 -0700 Subject: Fix standard incompetence found by MSVC - requires-expression still not working, because they aren't supported yet outside of a concept --- core/CMakeLists.txt | 19 +++++------ core/src/Model/Project.hpp | 2 +- core/src/Model/Template/TableTemplate.cpp | 17 ++++++++-- core/src/Model/Template/TableTemplate.hpp | 23 ++++++++------ core/src/Model/Template/Template.hpp | 4 +-- core/src/Model/Template/Template_Main.cpp | 2 ++ core/src/Model/Workflow/Values/BasicValues.cpp | 16 ++++++---- core/src/Model/Workflow/Workflow.hpp | 44 +++++++++++--------------- core/src/Model/Workflow/Workflow_Main.cpp | 16 +++++++--- core/src/UI/UI_DatabaseView.cpp | 10 +++--- core/src/Utils/Color.hpp | 9 +++--- core/src/Utils/Math.hpp | 11 +++++++ core/src/Utils/Time.cpp | 4 +-- core/src/Utils/Time.hpp | 4 +++ 14 files changed, 106 insertions(+), 75 deletions(-) create mode 100644 core/src/Utils/Math.hpp (limited to 'core') diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index a8fa7af..c4751a5 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -177,17 +177,9 @@ function(add_executable_variant TARGET_NAME) endif() endif() - # Platform specific dependencies for Utils/Dialog, not covered by conan - if(APPLE) - target_link_libraries(${TARGET_NAME} PUBLIC ${COCOA_LIBRARY}) - elseif(LINUX) - target_link_libraries(${TARGET_NAME} PUBLIC ${GTK3_LIBRARIES}) - target_include_directories(${TARGET_NAME} PRIVATE ${GTK3_INCLUDE_DIRS}) - endif() - if(WIN32) - # No console window when targeting windows function(handle_gnu_style_compiler) + # No console window when targeting windows # Supposedly the flag -mwindows would automatically make the executable use GUI subsystem # But, when subsystem is set to GUI, linker will only search WinMain and wWinMain but not the standard main (it seems like) # so creating GUI executable fails and the linker silently reverts to the default, CUI subsystem @@ -196,6 +188,7 @@ function(add_executable_variant TARGET_NAME) endfunction() function(handle_msvc_style_compiler) + # No console window when targeting windows target_link_options(${TARGET_NAME} PRIVATE /SUBSYSTEM:windows /ENTRY:mainCRTStartup) endfunction() @@ -203,15 +196,19 @@ function(add_executable_variant TARGET_NAME) # GCC (MinGW) handle_gnu_style_compiler() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "Clang") - if("x${CMAKE_CXX_SIMULATE_ID}" STREQUAL "xMSVC") + if(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "MSVC") # MSVC-style argument clang (clang-cl.exe) handle_msvc_style_compiler() - else() + elseif(CMAKE_CXX_COMPILER_FRONTEND_VARIANT STREQUAL "GNU") # GNU-style argument clang (clang.exe and clang++.exe) handle_gnu_style_compiler() endif() elseif(CMAKE_CXX_COMPILER_ID STREQUAL "MSVC") handle_msvc_style_compiler() + + # Use updated __cplusplus macro + # https://docs.microsoft.com/en-us/cpp/build/reference/zc-cplusplus + target_compile_options(${TARGET_NAME} PUBLIC /Zc:__cplusplus) endif() endif() diff --git a/core/src/Model/Project.hpp b/core/src/Model/Project.hpp index bce58c2..1eca09d 100644 --- a/core/src/Model/Project.hpp +++ b/core/src/Model/Project.hpp @@ -59,7 +59,7 @@ public: const tsl::array_map& GetTemplates() const; std::unique_ptr