Compare commits

...

4 commits

3 changed files with 32 additions and 13 deletions

View file

@ -1,20 +1,27 @@
# Building on Linux
For pre-requisite packages, check [deps.txt](./deps.txt)
You will need to install Qt and LLVM/libclang beforehand. All other packages will automatically be obtained through CPM.
If your distribution does not provide ReactPhysics3D, you will have to build (and install) it yourself prior to this step
ccache is highly recommended.
Use the following to generate the build files:
cmake -Bbuild .
> [!NOTE]
> Add -DCMAKE_BUILD_TYPE=Release to produce a release build
Then build the project using:
cmake --build build
The compiled binaries should then be located 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.
# Building on Windows
The project will be built using VCPKG and MSVC
The process is very similar on Windows
## Pre-requisites
@ -22,6 +29,7 @@ The project will be built using VCPKG and MSVC
* Qt 6.8.3 or higher, with MSVC toolchain
* CMake
* Git (for cloning the repo, optional)
* LLVM/libclang 18.1.8+ (from https://github.com/llvm/llvm-project/releases/download/llvmorg-18.1.8/LLVM-18.1.8-win64.exe)
* QScintilla already built (see [docs/qscintilla.md](./docs/qscintilla.md)) *\*likely temporary\**
To start, clone the repository:
@ -34,18 +42,18 @@ Once in the directory, add Qt to the `CMAKE_PREFIX_PATH` variable (for instance,
set CMAKE_PREFIX_PATH=C:\Qt\6.8.3\msvc2022_64
Now, generate the build files with cmake via the vcpkg preset:
Now, generate the build files:
cmake -Bbuild . --preset vcpkg
cmake -Bbuild .
Then, finally, build in release mode\*:
Then, finally build:
cmake --build build --config Release
cmake --build build
The compiled binaries should then be placed in `./build/bin/` and should be ready for redistribution without any further work.
> [!NOTE]
> To build in release mode, add -DCMAKE_BUILD_TYPE=Release to the configure (first) command,
> and add --config Release to the build (second) command
If any of the compilation steps fail, or the binaries fail to execute, please create an issue so that this can be corrected.
The compiled binaries should then be located in `./build/bin/[Debug|Release]` and should be ready for redistribution without any further work.
\* Release mode is necessary as debug mode copies DLLs that are not linked to the output binary
DEVELOPER NOTE: AKA Not for you. If you get CUSTOM COMMAND BUILD errors just keep rerunning build
If any of the compilation steps fail, or the binaries fail to execute, please create an issue so that this can be corrected.

View file

@ -10,6 +10,7 @@ else()
endif()
set( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" )
set(USE_CCACHE ON)
add_subdirectory(autogen)

View file

@ -26,6 +26,7 @@ int processHeader(fs::path srcRoot, fs::path srcPath, fs::path outPath) {
std::string srcRootStr = string_of(srcRoot);
std::string srcPathStr = string_of(srcPath);
std::string outPathStr = string_of(outPath);
std::string logFileStr = outPathStr + ".log";
const char* cargs[] = { "-xc++", "-std=c++17", "-I", srcRootStr.c_str(), "-D__AUTOGEN__", 0 };
// THANK YOU SO MUCH THIS STACKOVERFLOW ANSWER IS SO HELPFUL
@ -42,17 +43,24 @@ int processHeader(fs::path srcRoot, fs::path srcPath, fs::path outPath) {
return 1;
}
// We write to a special log file instead of stdout/stderr to
// 1. avoid confusion
// 2. prevent MSBuild from reading the word "error" and detecting there's a problem with the program (there isn't)
FILE* logout = fopen(logFileStr.c_str(), "w");
// Print errors
int ndiags = clang_getNumDiagnostics(unit);
for (int i = 0; i < ndiags; i++) {
CXDiagnostic diag = clang_getDiagnostic(unit, i);
CXString str = clang_formatDiagnostic(diag, 0);
fprintf(stderr, "diag: %s\n", clang_getCString(str));
fprintf(logout, "diag: %s\n", clang_getCString(str));
clang_disposeString(str);
clang_disposeDiagnostic(diag);
}
fclose(logout);
CXCursor cursor = clang_getTranslationUnitCursor(unit);
object::AnalysisState objectAnlyState;
@ -104,5 +112,7 @@ int main(int argc, char** argv) {
fs::path srcPath = argv[2];
fs::path outPath = argv[3];
// fprintf(stderr, "Some error here\n");
// return 0;
return processHeader(srcRoot, srcPath, outPath);
}