make windows-compliant

- fix BS_thread_pool include error (pulls in windows.h, symbols were
redefined)
- remove all std::println uses :(, seems like mingw doesn't like those
- allow to disable backward from cmake
This commit is contained in:
2026-02-27 12:31:08 +01:00
parent 16df3b7d51
commit 85ed3a758a
11 changed files with 110 additions and 60 deletions

View File

@ -16,7 +16,6 @@ message("-- CMAKE_CXX_FLAGS_DEBUG: ${CMAKE_CXX_FLAGS_DEBUG}")
message("-- CMAKE_CXX_FLAGS_RELEASE: ${CMAKE_CXX_FLAGS_RELEASE}")
find_package(raylib REQUIRED)
find_package(Backward REQUIRED)
# Headers + Sources
include_directories(include)
@ -38,10 +37,16 @@ set(SOURCES
# Main target
add_executable(masssprings ${SOURCES})
target_include_directories(masssprings PUBLIC ${RAYLIB_CPP_INCLUDE_DIR})
target_link_libraries(masssprings PUBLIC raylib Backward::Backward)
if(NOT DEFINED DISABLE_BACKWARD)
find_package(Backward REQUIRED)
target_link_libraries(masssprings PUBLIC raylib Backward::Backward)
target_compile_definitions(masssprings PUBLIC BACKWARD)
else()
target_link_libraries(masssprings PUBLIC raylib)
endif()
# Tracy target
if(USE_TRACY)
if(NOT DEFINED DISABLE_TRACY)
include(FetchContent)
FetchContent_Declare(tracy
GIT_REPOSITORY https://github.com/wolfpld/tracy.git
@ -56,18 +61,25 @@ if(USE_TRACY)
add_executable(masssprings_tracy ${SOURCES})
target_include_directories(masssprings_tracy PUBLIC ${RAYLIB_CPP_INCLUDE_DIR})
target_compile_definitions(masssprings_tracy PRIVATE TRACY)
target_link_libraries(masssprings_tracy PUBLIC raylib Backward::Backward TracyClient)
if(NOT DEFINED DISABLE_BACKWARD)
target_link_libraries(masssprings_tracy PUBLIC raylib Backward::Backward TracyClient)
target_compile_definitions(masssprings_tracy PUBLIC BACKWARD)
else()
target_link_libraries(masssprings_tracy PUBLIC raylib TracyClient)
endif()
endif()
# LTO
include(CheckIPOSupported)
check_ipo_supported(RESULT supported OUTPUT error)
if(supported)
message(STATUS "IPO / LTO enabled")
set_property(TARGET masssprings PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
if(USE_TRACY)
set_property(TARGET masssprings_tracy PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
if (NOT WIN32)
include(CheckIPOSupported)
check_ipo_supported(RESULT supported OUTPUT error)
if(supported)
message(STATUS "IPO / LTO enabled")
set_property(TARGET masssprings PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
if(USE_TRACY)
set_property(TARGET masssprings_tracy PROPERTY INTERPROCEDURAL_OPTIMIZATION TRUE)
endif()
else()
message(STATUS "IPO / LTO not supported: <${error}>")
endif()
else()
message(STATUS "IPO / LTO not supported: <${error}>")
endif()