diff --git a/BUILD.md b/BUILD.md index 061226a..ced9679 100644 --- a/BUILD.md +++ b/BUILD.md @@ -38,10 +38,12 @@ Now, generate the build files with cmake via the vcpkg preset: cmake -Bbuild . --preset vcpkg -Then, finally, build in release mode: +Then, finally, build in release mode\*: cmake --build build --config Release The compiled binaries should then be placed in `./build/bin/` and should be ready for redistribution without any further work. -If any of the compilation steps fail, or the binaries fail to execute, please create an issue so that this can be corrected. \ No newline at end of file +If any of the compilation steps fail, or the binaries fail to execute, please create an issue so that this can be corrected. + +\* Release mode is necessary as debug mode copies DLLs that are not linked to the output binary \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index a70be89..b14b783 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -4,7 +4,7 @@ project(openblocks VERSION 0.1.0) set(OpenGL_GL_PREFERENCE "GLVND") if (MSVC) - add_compile_options(/W4 /WX) + add_compile_options(/W4) else() add_compile_options(-Wall -Wextra -pedantic -Wno-unused-parameter) endif() diff --git a/autogen/src/main.cpp b/autogen/src/main.cpp index 1bd3e11..fe1b2b8 100644 --- a/autogen/src/main.cpp +++ b/autogen/src/main.cpp @@ -27,7 +27,7 @@ int processHeader(fs::path srcRoot, fs::path srcPath, fs::path outPath) { std::string srcPathStr = string_of(srcPath); std::string outPathStr = string_of(outPath); - const char* cargs[] = { "-x", "c++", "-I", srcRootStr.c_str(), "-D__AUTOGEN__", 0 }; + const char* cargs[] = { "-xc++", "-std=c++17", "-I", srcRootStr.c_str(), "-D__AUTOGEN__", 0 }; // THANK YOU SO MUCH THIS STACKOVERFLOW ANSWER IS SO HELPFUL // https://stackoverflow.com/a/59206378/16255372 CXIndex index = clang_createIndex(0, 0); diff --git a/cmake/FindClang.cmake b/cmake/FindClang.cmake new file mode 100644 index 0000000..b0516fe --- /dev/null +++ b/cmake/FindClang.cmake @@ -0,0 +1,42 @@ +# Modified from QGIS' FindQScintilla.cmake by Thomas Moenicke, Larry Schaffer + +add_library(Clang::Clang UNKNOWN IMPORTED) + +FIND_PATH(CLANG_INCLUDE_DIR + NAMES clang-c/Index.h + PATHS + $ENV{LIB_DIR}/include + /usr/local/include + /usr/include + ${VCPKG_INSTALLED_DIR}/x64-windows/include + "C:/Program Files/LLVM/include" + PATH_SUFFIXES ${CLANG_PATH_SUFFIXES} +) + +set(CLANG_LIBRARY_NAMES + libclang + clang +) + +find_library(CLANG_LIBRARY +NAMES ${CLANG_LIBRARY_NAMES} +PATHS + $ENV{LIB_DIR}/lib + /usr/local/lib + /usr/lib + ${VCPKG_INSTALLED_DIR}/x64-windows/lib + "C:/Program Files/LLVM/lib" +) + +get_filename_component(CLANG_LIB_DIR ${CLANG_LIBRARY} DIRECTORY) +list(TRANSFORM CLANG_LIBRARY_NAMES APPEND ".dll" OUTPUT_VARIABLE CLANG_DLL_NAMES) + +find_file(CLANG_DLLS +NAMES ${CLANG_DLL_NAMES} +PATHS + $ENV{LIB_DIR}/bin + /usr/local/bin + /usr/bin + ${VCPKG_INSTALLED_DIR}/x64-windows/bin + "C:/Program Files/LLVM/bin" +) \ No newline at end of file diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index 02f5d8c..45aa188 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -29,7 +29,7 @@ foreach (SRC ${AUTOGEN_SOURCES}) OUTPUT "${OUT_PATH}" DEPENDS autogen DEPENDS "${SRC_PATH}" - COMMAND "${CMAKE_BINARY_DIR}/autogen/autogen" "${CMAKE_CURRENT_SOURCE_DIR}/src" "${SRC_PATH}" "${OUT_PATH}" + COMMAND "$" "${CMAKE_CURRENT_SOURCE_DIR}/src" "${SRC_PATH}" "${OUT_PATH}" ) list(APPEND AUTOGEN_OUTS "${OUT_PATH}") diff --git a/core/src/datatypes/color3.cpp b/core/src/datatypes/color3.cpp index b8e142b..f7e4ef4 100644 --- a/core/src/datatypes/color3.cpp +++ b/core/src/datatypes/color3.cpp @@ -4,6 +4,7 @@ #include #include #include +#include Color3::Color3(float r, float g, float b) : r(std::clamp(r, 0.f, 1.f)), g(std::clamp(g, 0.f, 1.f)), b(std::clamp(b, 0.f, 1.f)) {}; Color3::Color3(const glm::vec3& vec) : r(std::clamp(vec.x, 0.f, 1.f)), g(std::clamp(vec.y, 0.f, 1.f)), b(std::clamp(vec.z, 0.f, 1.f)) {}; diff --git a/core/src/datatypes/vector.h b/core/src/datatypes/vector.h index e134efe..332fe22 100644 --- a/core/src/datatypes/vector.h +++ b/core/src/datatypes/vector.h @@ -5,8 +5,9 @@ #include "error/data.h" #include #include +#include -namespace reactphysics3d { class Vector3; }; +// namespace reactphysics3d { class Vector3; }; class DEF_DATA Vector3 { AUTOGEN_PREAMBLE_DATA diff --git a/editor/mainwindow.cpp b/editor/mainwindow.cpp index cd1d1b1..bd65f1b 100644 --- a/editor/mainwindow.cpp +++ b/editor/mainwindow.cpp @@ -73,7 +73,7 @@ MainWindow::MainWindow(QWidget *parent) if (isDarkMode()) QIcon::setFallbackThemeName("editor-dark"); else - QIcon::setFallbackThemeName("editor"); + QIcon::setThemeName("editor"); // qApp->setStyle(QStyleFactory::create("fusion")); defaultMessageHandler = qInstallMessageHandler(logQtMessage);