diff --git a/3rdparty/emilib/hash_map.hpp b/3rdparty/emilib/hash_map.hpp index f53f0d8..57cd3e3 100644 --- a/3rdparty/emilib/hash_map.hpp +++ b/3rdparty/emilib/hash_map.hpp @@ -14,9 +14,10 @@ namespace emilib { // (Crydsch) fixes for standalone usage -#define DCHECK_NE_F(x,y) assert((x) != (y)) #define DCHECK_F(x) assert(x) +#define DCHECK_NE_F(x,y) assert((x) != (y)) #define DCHECK_EQ_F(x,y) assert((x) == (y)) +#define DCHECK_LT_F(val1, val2) assert((val1) < (val2)) /// like std::equal_to but no need to #include template diff --git a/CMakeLists.txt b/CMakeLists.txt index 271a9bd..1527da2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,9 @@ project("spacegame" set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -ggdb") set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -O0 -ggdb") +# Enable LTO support in linker to handle LTO-built dependencies +set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -flto") + # Enable compiler warnings set(SPACEGAME_COMPILER_WARNINGS -Wall -Wextra -pedantic diff --git a/cmake/clang_toolchain.cmake b/cmake/clang_toolchain.cmake index 7658a4e..561082d 100644 --- a/cmake/clang_toolchain.cmake +++ b/cmake/clang_toolchain.cmake @@ -15,9 +15,10 @@ set(CMAKE_STRIP /usr/bin/llvm-strip ) # Note: We can static link with libc++, but not entirely since we depend on dynamic # libraries such as x11,glx,etc... # Note: Despite its name '-static-libstdc++' the option causes libc++ to be linked statically +# When linking libc++ statically, we also need to link libc++abi set(CMAKE_CXX_FLAGS_INIT "-stdlib=libc++" ) -set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld -static-libstdc++") -set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=lld -static-libstdc++") -set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld -static-libstdc++") +set(CMAKE_EXE_LINKER_FLAGS_INIT "-fuse-ld=lld -static-libstdc++ -lc++abi") +set(CMAKE_MODULE_LINKER_FLAGS_INIT "-fuse-ld=lld -static-libstdc++ -lc++abi") +set(CMAKE_SHARED_LINKER_FLAGS_INIT "-fuse-ld=lld -static-libstdc++ -lc++abi") set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE TRUE) set(CMAKE_INTERPROCEDURAL_OPTIMIZATION_MINSIZEREL TRUE) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index a3ca4ec..afa15f7 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -33,6 +33,8 @@ set_target_properties(spacegame PROPERTIES target_compile_definitions(spacegame PRIVATE $<$:_DEBUG> + $<$:BX_CONFIG_DEBUG=1> + $<$>:BX_CONFIG_DEBUG=0> ) # -m64 - Build for a 64-bit machine @@ -55,13 +57,13 @@ target_include_directories(spacegame PRIVATE target_link_libraries(spacegame PRIVATE glfw - bgfx::bx - bgfx::bimg ${BGFX} + bgfx::bimg + bgfx::bx Threads::Threads + c++ ) - ################## release ################### # Strip binary for release builds diff --git a/src/space_math.h b/src/space_math.h index 9064191..31dba79 100644 --- a/src/space_math.h +++ b/src/space_math.h @@ -8,6 +8,7 @@ #include #include #include +#include // Dummy defines for broken intellisense // #define size_t (unsigned long int) @@ -80,7 +81,7 @@ typedef struct color { uint8_t r, g, b, a; - color() : r(0), g(0), b(0), a(1) {} + color() : r(0), g(0), b(0), a(1) {} // TODO should this be 255 ? color(uint8_t _r, uint8_t _g, uint8_t _b, uint8_t _a) : r(_r), g(_g), b(_b), a(_a) {} } Color;