From 874d6c8d349936683fe37d903fddb101092704d6 Mon Sep 17 00:00:00 2001 From: Mysvac Date: Wed, 16 Jul 2025 22:00:13 +0800 Subject: [PATCH 1/2] fix compiler error --- CMakeLists.txt | 1 + engine/3rdparty/JoltPhysics/Build/CMakeLists.txt | 2 +- .../JoltPhysics/Jolt/Core/JobSystemThreadPool.h | 1 + engine/3rdparty/JoltPhysics/Jolt/Jolt.cmake | 12 ++++++------ engine/3rdparty/tinyobjloader/CMakeLists.txt | 2 +- engine/source/editor/CMakeLists.txt | 2 +- .../framework/component/lua/lua_component.cpp | 1 + .../function/render/debugdraw/debug_draw_font.cpp | 4 ++-- 8 files changed, 14 insertions(+), 11 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 97474124f..7af089921 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,6 +4,7 @@ project(Piccolo VERSION 0.1.0) set(CMAKE_CXX_STANDARD 17) set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_EXPORT_COMPILE_COMMANDS ON) set(BUILD_SHARED_LIBS OFF) include(CMakeDependentOption) diff --git a/engine/3rdparty/JoltPhysics/Build/CMakeLists.txt b/engine/3rdparty/JoltPhysics/Build/CMakeLists.txt index 610900507..d5540e8ba 100644 --- a/engine/3rdparty/JoltPhysics/Build/CMakeLists.txt +++ b/engine/3rdparty/JoltPhysics/Build/CMakeLists.txt @@ -42,7 +42,7 @@ if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows" OR "${CMAKE_SYSTEM_NAME}" STREQUAL endif() # Set general compiler flags - set(CMAKE_CXX_FLAGS "/std:c++17 /Zc:__cplusplus /GR- /Gm- /Wall /WX /EHsc /MP /nologo /diagnostics:classic /FC /fp:except- /Zc:inline /Zi /DWIN32 /D_WINDOWS /DUNICODE /D_UNICODE") + set(CMAKE_CXX_FLAGS "/std:c++17 /Zc:__cplusplus /GR- /Gm- /Wall /WX /Wv:18 /EHsc /MP /nologo /diagnostics:classic /FC /fp:except- /Zc:inline /Zi /DWIN32 /D_WINDOWS /DUNICODE /D_UNICODE") # Set compiler flags for various configurations set(CMAKE_CXX_FLAGS_DEBUG "/GS /Od /Ob0 /RTC1") set(CMAKE_CXX_FLAGS_RELEASE "/GS- /GL /Gy /O2 /Oi /Ot") diff --git a/engine/3rdparty/JoltPhysics/Jolt/Core/JobSystemThreadPool.h b/engine/3rdparty/JoltPhysics/Jolt/Core/JobSystemThreadPool.h index 2c7b68f07..14f45b39f 100644 --- a/engine/3rdparty/JoltPhysics/Jolt/Core/JobSystemThreadPool.h +++ b/engine/3rdparty/JoltPhysics/Jolt/Core/JobSystemThreadPool.h @@ -7,6 +7,7 @@ #include JPH_SUPPRESS_WARNINGS_STD_BEGIN +#include #include #include #include diff --git a/engine/3rdparty/JoltPhysics/Jolt/Jolt.cmake b/engine/3rdparty/JoltPhysics/Jolt/Jolt.cmake index 4683483c8..d6e1a27ab 100644 --- a/engine/3rdparty/JoltPhysics/Jolt/Jolt.cmake +++ b/engine/3rdparty/JoltPhysics/Jolt/Jolt.cmake @@ -385,12 +385,12 @@ if ("${CMAKE_SYSTEM_NAME}" STREQUAL "Windows") set(JOLT_PHYSICS_SRC_FILES ${JOLT_PHYSICS_SRC_FILES} ${JOLT_PHYSICS_ROOT}/Jolt.natvis) endif() -if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") - # Enable Precompiled Headers for Jolt - set_source_files_properties(${JOLT_PHYSICS_SRC_FILES} PROPERTIES COMPILE_FLAGS "/YuJolt/Jolt.h") - set(JOLT_PHYSICS_SRC_FILES ${JOLT_PHYSICS_SRC_FILES} ${JOLT_PHYSICS_ROOT}/pch.cpp) - set_source_files_properties(${JOLT_PHYSICS_ROOT}/pch.cpp PROPERTIES COMPILE_FLAGS "/YcJolt/Jolt.h") -endif() +# if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "MSVC") +# # Enable Precompiled Headers for Jolt - DISABLED to fix build issues +# # set_source_files_properties(${JOLT_PHYSICS_SRC_FILES} PROPERTIES COMPILE_FLAGS "/YuJolt/Jolt.h") +# # set(JOLT_PHYSICS_SRC_FILES ${JOLT_PHYSICS_SRC_FILES} ${JOLT_PHYSICS_ROOT}/pch.cpp) +# # set_source_files_properties(${JOLT_PHYSICS_ROOT}/pch.cpp PROPERTIES COMPILE_FLAGS "/YcJolt/Jolt.h") +# endif() # Group source files source_group(TREE ${JOLT_PHYSICS_ROOT} FILES ${JOLT_PHYSICS_SRC_FILES}) diff --git a/engine/3rdparty/tinyobjloader/CMakeLists.txt b/engine/3rdparty/tinyobjloader/CMakeLists.txt index f64b42ce4..1b3651d35 100644 --- a/engine/3rdparty/tinyobjloader/CMakeLists.txt +++ b/engine/3rdparty/tinyobjloader/CMakeLists.txt @@ -2,7 +2,7 @@ #This configures the Cmake system with multiple properties, depending #on the platform and configuration it is set to build in. project(tinyobjloader) -cmake_minimum_required(VERSION 3.2) +cmake_minimum_required(VERSION 3.20) set(TINYOBJLOADER_SOVERSION 2) set(TINYOBJLOADER_VERSION 2.0.0-rc.9) diff --git a/engine/source/editor/CMakeLists.txt b/engine/source/editor/CMakeLists.txt index 460cbf5b0..37183bf56 100644 --- a/engine/source/editor/CMakeLists.txt +++ b/engine/source/editor/CMakeLists.txt @@ -41,7 +41,7 @@ if(ENABLE_PHYSICS_DEBUG_RENDERER) ) endif() -add_custom_command(TARGET ${TARGET_NAME} ${POST_BUILD_COMMANDS}) +add_custom_command(TARGET ${TARGET_NAME} POST_BUILD ${POST_BUILD_COMMANDS}) #precompile #set global vari used by precompile diff --git a/engine/source/runtime/function/framework/component/lua/lua_component.cpp b/engine/source/runtime/function/framework/component/lua/lua_component.cpp index f6681b520..43ff8091c 100644 --- a/engine/source/runtime/function/framework/component/lua/lua_component.cpp +++ b/engine/source/runtime/function/framework/component/lua/lua_component.cpp @@ -79,6 +79,7 @@ namespace Piccolo else { LOG_ERROR("Can't find target field."); + throw std::runtime_error("Can't find target field."); } } diff --git a/engine/source/runtime/function/render/debugdraw/debug_draw_font.cpp b/engine/source/runtime/function/render/debugdraw/debug_draw_font.cpp index 4863d31a3..866287209 100644 --- a/engine/source/runtime/function/render/debugdraw/debug_draw_font.cpp +++ b/engine/source/runtime/function/render/debugdraw/debug_draw_font.cpp @@ -16,7 +16,7 @@ namespace Piccolo FILE* fontFile = fopen(fontFilePath, "rb"); if (fontFile == NULL) { - std::runtime_error("debug draw cannot open font.ttf"); + throw std::runtime_error("debug draw cannot open font.ttf"); } fseek(fontFile, 0, SEEK_END); uint64_t size = ftell(fontFile); @@ -29,7 +29,7 @@ namespace Piccolo if (!stbtt_InitFont(&fontInfo, fontBuffer, 0)) { - std::runtime_error("debug draw stb init font failed\n"); + throw std::runtime_error("debug draw stb init font failed\n"); } unsigned char* bitmap = (unsigned char*)calloc(m_bitmap_w * m_bitmap_h, sizeof(unsigned char)); From b6a78a570bcb0a655b678ac5ca45fa48adf5bfc6 Mon Sep 17 00:00:00 2001 From: Mysvac Date: Thu, 14 Aug 2025 07:34:21 +0800 Subject: [PATCH 2/2] Add preset --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7af089921..fe17c6861 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.19 FATAL_ERROR) +cmake_minimum_required(VERSION 3.20 FATAL_ERROR) project(Piccolo VERSION 0.1.0)