From ba4cd30c38102e91464665f35833b841e49b9772 Mon Sep 17 00:00:00 2001 From: c4llv07e Date: Sat, 4 Mar 2023 21:54:23 +0300 Subject: [PATCH 1/2] worst build fix ever Signed-off-by: c4llv07e --- CMakeLists.txt | 16 ++++++++-------- openbyond-core/CMakeLists.txt | 19 ++++++++++--------- openbyond-core/grammar/parser.y | 10 +++++----- openbyond-core/include/string_utils.h | 4 ++-- openbyond-core/src/scripting/Preprocessor.cpp | 19 +++---------------- openbyond-core/src/string_utils.cpp | 4 ++-- openbyond-tools/CMakeLists.txt | 11 ++++------- 7 files changed, 34 insertions(+), 49 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index eab7700..747f405 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -2,10 +2,10 @@ ## OpenBYOND - Compile Script ########################################## -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.10) ## WHAT A CREATIVE NAME WOW -set(PROJECT_NAME openbyond) +project(openbyond) ## Versioning shit set(VERSION_MAJOR 0) @@ -41,9 +41,9 @@ endif() # # Every module has a CMakeLists.txt in it's root. -add_subdirectory (${CMAKE_SOURCE_DIR}/openbyond-core) -include_directories(${CMAKE_SOURCE_DIR}/openbyond-core/include) -add_subdirectory (${CMAKE_SOURCE_DIR}/openbyond-tools) -# ${CMAKE_SOURCE_DIR}/openbyond-server -# ${CMAKE_SOURCE_DIR}/openbyond-client -# ${CMAKE_SOURCE_DIR}/openbyond-ide +add_subdirectory(openbyond-core) +include_directories(openbyond-core/include) +add_subdirectory(openbyond-tools) +add_subdirectory(openbyond-server) +add_subdirectory(openbyond-client) +add_subdirectory(openbyond-ide) diff --git a/openbyond-core/CMakeLists.txt b/openbyond-core/CMakeLists.txt index 27c945a..2992f37 100644 --- a/openbyond-core/CMakeLists.txt +++ b/openbyond-core/CMakeLists.txt @@ -3,10 +3,10 @@ ################################### ## Project Setup -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.10) ## WHAT A CREATIVE NAME WOW -set(MODULE_NAME ${PROJECT_NAME}-core) +project(${CMAKE_PROJECT_NAME}-core) ## Versioning shit set(VERSION_MAJOR 0) @@ -15,8 +15,6 @@ set(VERSION_PATCH 1) set(TARGET_NAME "openbyond-core") -project(${MODULE_NAME}) - ## Configurations ## Configure the build system @@ -53,8 +51,11 @@ configure_file(config.h.in ${CMAKE_CURRENT_BINARY_DIR}/include/config.h) include_directories( ${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_CURRENT_BINARY_DIR}/grammar - ${CMAKE_CURRENT_SOURCE_DIR}/include - ${FLEX_INCLUDE_DIR}) + ${CMAKE_CURRENT_BINARY_DIR}/include + ${CMAKE_CURRENT_SOURCE_DIR}/include + ${FLEX_INCLUDE_DIR}) + +file(MAKE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/grammar) # Set the source files, headers, and link libraries ################## @@ -101,14 +102,14 @@ set(DMSCRIPT_INCLUDE SOURCE_GROUP("src\\script" FILES ${DMSCRIPT_INCLUDE}) SOURCE_GROUP("src\\script" FILES ${DMSCRIPT_SOURCE}) -set(OPENBYOND_CORE_INCLUDE_DIR CACHE STRING ${CMAKE_CURRENT_BINARY_DIR}/include) +set(OPENBYOND_CORE_INCLUDE_DIR "${CMAKE_CURRENT_BINARY_DIR}/include") set(OPENBYOND_CORE_INCLUDE CACHE STRING ${BASICS_INCLUDE} ${DMSCRIPT_INCLUDE} ) -set(${MODULE_NAME}_LINK_LIBS +set(${PROJECT_NAME}_LINK_LIBS #${FLEX_LIBRARIES} ) @@ -119,4 +120,4 @@ add_library(${TARGET_NAME} ${DMSCRIPT_INCLUDE} ${DMSCRIPT_SOURCE} ) set(OPENBYOND_CORE_LIBRARY CACHE STRING ${TARGET_NAME}) -target_link_libraries(${TARGET_NAME} ${${MODULE_NAME}_LINK_LIBS}) \ No newline at end of file +target_link_libraries(${TARGET_NAME} ${${PROJECT_NAME}_LINK_LIBS}) diff --git a/openbyond-core/grammar/parser.y b/openbyond-core/grammar/parser.y index 7f623d2..c8e1d95 100644 --- a/openbyond-core/grammar/parser.y +++ b/openbyond-core/grammar/parser.y @@ -28,8 +28,8 @@ THE SOFTWARE. %skeleton "lalr1.cc" %require "2.3" %defines -%define "parser_class_name" "Parser" -%define "namespace" "DM" +%define api.parser.class {Parser} +%define api.namespace {DM} %token AS %token DECREMENT @@ -108,7 +108,7 @@ class Atom; %parse-param {class Driver& driver} %debug -%error-verbose +%define parse.error verbose %% script @@ -283,7 +283,7 @@ procdefs const_expression : NUMBER - | STRING { $$ = new DMString($1); } + | STRING /* { $$ = new DMString($1); } */ | '(' const_expression ')' | const_expression '*' const_expression | const_expression '/' const_expression @@ -320,4 +320,4 @@ return void DM::Parser::error(const Parser::location_type& l, const std::string& m) { driver.error(l, m); -} \ No newline at end of file +} diff --git a/openbyond-core/include/string_utils.h b/openbyond-core/include/string_utils.h index 3c7d41b..bb791c4 100644 --- a/openbyond-core/include/string_utils.h +++ b/openbyond-core/include/string_utils.h @@ -23,7 +23,7 @@ THE SOFTWARE. */ #ifndef HAVE_STRING_UTILS_H #define HAVE_STRING_UTILS_H -#include "config.h" +#include #include #include std::string string_format(const std::string fmt_str, ...); @@ -46,4 +46,4 @@ std::string trim(const std::string& str, std::string reduce(const std::string& str, const std::string& fill = " ", const std::string& whitespace = " \t"); -#endif // HAVE_STRING_UTILS_H \ No newline at end of file +#endif // HAVE_STRING_UTILS_H diff --git a/openbyond-core/src/scripting/Preprocessor.cpp b/openbyond-core/src/scripting/Preprocessor.cpp index 3c1e39e..e1d230e 100644 --- a/openbyond-core/src/scripting/Preprocessor.cpp +++ b/openbyond-core/src/scripting/Preprocessor.cpp @@ -70,16 +70,7 @@ void Preprocessor::rewindStream(std::iostream &stream, int numchars) { std::string Preprocessor::ParseFile(std::string filename) { std::fstream fin(filename, std::fstream::in); - if (fin==NULL) - { - return ""; - } std::fstream fout(filename+".tmp", std::fstream::out); - if (fout==NULL) - { - fin.close(); - return ""; - } ParseStream(fin,fout,filename); @@ -270,9 +261,7 @@ void Preprocessor::consumeUntil(std::iostream &fin, std::iostream &fout, char en char c; while (fin >> std::noskipws >> c) { if(c==endmarker) return; - if(fout!=NULL) { - fout << c; - } + fout << c; } } void Preprocessor::consumeUntil(std::iostream &fin, std::iostream &fout, std::string endtoken) { @@ -286,9 +275,7 @@ void Preprocessor::consumeUntil(std::iostream &fin, std::iostream &fout, std::st token += c; lastchar=c; if(token==endtoken) return; - if(fout!=NULL) { - fout << c; - } + fout << c; } } @@ -306,4 +293,4 @@ void Preprocessor::consumePPToken(std::iostream &fin, std::iostream &fout) { consumePreprocessorToken(token,args); //fout << " (ignore:" << (this->IsIgnoring()?"y":"n") << "). */"; -} \ No newline at end of file +} diff --git a/openbyond-core/src/string_utils.cpp b/openbyond-core/src/string_utils.cpp index 5c7be94..80c1ada 100644 --- a/openbyond-core/src/string_utils.cpp +++ b/openbyond-core/src/string_utils.cpp @@ -21,7 +21,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -#include "config.h" +#include #include "string_utils.h" #include #include @@ -252,4 +252,4 @@ std::string reduce(const std::string& str, } return result; -} \ No newline at end of file +} diff --git a/openbyond-tools/CMakeLists.txt b/openbyond-tools/CMakeLists.txt index 99837e8..1cd2dbb 100644 --- a/openbyond-tools/CMakeLists.txt +++ b/openbyond-tools/CMakeLists.txt @@ -3,14 +3,10 @@ ################################### ## Project Setup -cmake_minimum_required(VERSION 2.8) +cmake_minimum_required(VERSION 3.10) ## WHAT A CREATIVE NAME WOW -set(MODULE_NAME ${PROJECT_NAME}-tools) - -set(${MODULE_NAME}_LINK_LIBS - ${OPENBYOND_CORE_LIBRARY} - ) +project(${CMAKE_PROJECT_NAME}-tools) ## Versioning shit set(VERSION_MAJOR 0) @@ -24,6 +20,7 @@ set(VERSION_PATCH 1) # Add the include folder to the include path include_directories( + ${CMAKE_CURRENT_BINARY_DIR}/../openbyond-core/include # I am very sorry ${OPENBYOND_CORE_INCLUDE_DIR} ${TCLAP_INCLUDE_DIR} ) @@ -45,4 +42,4 @@ add_executable(${TARGET_NAME} ${OPENBYOND_CORE_INCLUDE} ${PARSER_SOURCE} ) -target_link_libraries(${TARGET_NAME} openbyond-core) \ No newline at end of file +target_link_libraries(${TARGET_NAME} openbyond-core) From 25c0ef8c64a9b7d93de8cc13438128658681db25 Mon Sep 17 00:00:00 2001 From: c4llv07e Date: Sat, 4 Mar 2023 21:54:44 +0300 Subject: [PATCH 2/2] slightly better gitignore Signed-off-by: c4llv07e --- .gitignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 2af970f..aeb9ba8 100644 --- a/.gitignore +++ b/.gitignore @@ -3,7 +3,8 @@ /openbyond-core/grammar/parser.tab.h /openbyond-core/grammar/test.exe /openbyond-core/grammar/test.exe.stackdump -/build +/?build +/bin /openbyond-core/bin/Debug/*.pdb CMakeFiles/