From 5a2b39641fec6127da1945c8c679103d8a853019 Mon Sep 17 00:00:00 2001 From: Tyler Wilding Date: Wed, 26 Aug 2020 20:02:44 -0400 Subject: [PATCH] CMake adjustments, leave edits that didn't change file paths --- CMakeSettings.json | 16 ++++++++++++++++ game/CMakeLists.txt | 24 ++++++++++++++++++++---- game/kernel/kprint.h | 2 ++ game/system/Deci2Server.h | 3 ++- game/system/SystemThread.h | 3 +-- game/system/Timer.h | 2 -- 6 files changed, 41 insertions(+), 9 deletions(-) create mode 100644 CMakeSettings.json diff --git a/CMakeSettings.json b/CMakeSettings.json new file mode 100644 index 0000000000..99b611bdd9 --- /dev/null +++ b/CMakeSettings.json @@ -0,0 +1,16 @@ +{ + // See https://go.microsoft.com/fwlink/?linkid=834763 for more information about this file. + "configurations": [ + { + "name": "x64-Debug", + "generator": "Ninja", + "configurationType": "Debug", + "inheritEnvironments": [ "msvc_x64_x64" ], + "buildRoot": "${projectDir}\\out\\build\\${name}", + "installRoot": "${projectDir}\\out\\install\\${name}", + "cmakeCommandArgs": "", + "buildCommandArgs": "", + "ctestCommandArgs": "" + } + ] +} \ No newline at end of file diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt index 05e0d99744..5e79e3eb31 100644 --- a/game/CMakeLists.txt +++ b/game/CMakeLists.txt @@ -1,9 +1,25 @@ # We define our own compilation flags here. set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_FLAGS "-O0 -ggdb -Wall \ --Wextra -Wcast-align -Wcast-qual -Wdisabled-optimization -Wformat=2 \ --Winit-self -Wmissing-include-dirs -Woverloaded-virtual \ --Wredundant-decls -Wshadow -Wsign-promo ") + +set(CMAKE_CXX_FLAGS "-O3 -ggdb") + +# Set default compile flags for GCC +if(CMAKE_COMPILER_IS_GNUCXX) + message(STATUS "GCC detected, adding compile flags") + set(CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} + -Wall-Winit-self + -Wextra + -Wcast-align + -Wcast-qual + -Wdisabled-optimization + -Wformat=2 + -Wmissing-include-dirs + -Woverloaded-virtual + -Wredundant-decls + -Wshadow + -Wsign-promo") +endif(CMAKE_COMPILER_IS_GNUCXX) enable_language(ASM_NASM) set(RUNTIME_SOURCE diff --git a/game/kernel/kprint.h b/game/kernel/kprint.h index d26fea7bc3..ae95925154 100644 --- a/game/kernel/kprint.h +++ b/game/kernel/kprint.h @@ -25,6 +25,8 @@ extern Ptr MessBufArea; extern Ptr OutputBufArea; extern Ptr PrintBufArea; +#define __attribute__(A) /* do nothing */ + /*! * Initialize global variables for kprint */ diff --git a/game/system/Deci2Server.h b/game/system/Deci2Server.h index b53547a10c..c9e0542795 100644 --- a/game/system/Deci2Server.h +++ b/game/system/Deci2Server.h @@ -7,7 +7,8 @@ #ifndef JAK1_DECI2SERVER_H #define JAK1_DECI2SERVER_H -#include +#include + #include #include #include diff --git a/game/system/SystemThread.h b/game/system/SystemThread.h index 0d0bafac0d..5f89929dc2 100644 --- a/game/system/SystemThread.h +++ b/game/system/SystemThread.h @@ -8,7 +8,6 @@ #include #include -#include #include #include #include @@ -40,7 +39,7 @@ private: friend void* bootstrap_thread_func(void* thd); std::string name = "invalid"; - pthread_t thread; + std::thread thread; SystemThreadManager* manager; std::function function; bool initialization_complete = false; diff --git a/game/system/Timer.h b/game/system/Timer.h index 21bfbce8ce..fd2b1667dd 100644 --- a/game/system/Timer.h +++ b/game/system/Timer.h @@ -12,7 +12,6 @@ public: } void start() { - clock_gettime(CLOCK_MONOTONIC, &_startTime); } double getMs() { @@ -21,7 +20,6 @@ public: int64_t getNs() { struct timespec now; - clock_gettime(CLOCK_MONOTONIC, &now); return (int64_t)(now.tv_nsec - _startTime.tv_nsec) + 1000000000 * (now.tv_sec - _startTime.tv_sec); }