Compare commits

...

3 commits

7 changed files with 57 additions and 6 deletions

View file

@ -22,6 +22,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)
* QScintilla already built (see [docs/qscintilla.md](./docs/qscintilla.md)) *\*likely temporary\**
To start, clone the repository:

View file

@ -1,5 +1,12 @@
# Modified from QGIS' FindQScintilla.cmake by Thomas Moenicke, Larry Schaffer
add_library(QScintilla::QScintilla UNKNOWN IMPORTED)
### NECESSARY TO PREVENT staticMetaObject ERROR!!! See qscintilla.prf AKA qmake config
if(WIN32)
add_compile_definitions(QSCINTILLA_DLL)
endif()
FIND_PATH(QSCINTILLA_INCLUDE_DIR
NAMES Qsci/qsciglobal.h
PATHS
@ -7,6 +14,7 @@ FIND_PATH(QSCINTILLA_INCLUDE_DIR
$ENV{LIB_DIR}/include
/usr/local/include
/usr/include
${VCPKG_INSTALLED_DIR}/x64-windows/include
PATH_SUFFIXES ${QSCINTILLA_PATH_SUFFIXES}
)
@ -29,4 +37,20 @@ PATHS
/usr/local/lib
/usr/local/lib/qt${QT_VERSION_MAJOR}
/usr/lib
${VCPKG_INSTALLED_DIR}/x64-windows/lib
)
get_filename_component(QSCINTILLA_LIB_DIR ${QSCINTILLA_LIBRARY} DIRECTORY)
list(TRANSFORM QSCINTILLA_LIBRARY_NAMES APPEND ".dll" OUTPUT_VARIABLE QSCINTILLA_DLL_NAMES)
find_file(QSCINTILLA_DLLS
NAMES ${QSCINTILLA_DLL_NAMES}
PATHS
"${QT_LIBRARY_DIR}"
$ENV{LIB_DIR}/lib
/usr/local/lib
/usr/local/lib/qt${QT_VERSION_MAJOR}
/usr/lib
${QSCINTILLA_LIB_DIR}
${VCPKG_INSTALLED_DIR}/x64-windows/lib
)

View file

@ -14,6 +14,7 @@ include_directories(${Stb_INCLUDE_DIR})
# PkgConfig packages
find_package(PkgConfig REQUIRED)
pkg_check_modules(LUAJIT REQUIRED luajit)
link_directories(${LUAJIT_LIBRARY_DIRS})
# Run autogen
file(GLOB_RECURSE AUTOGEN_SOURCES RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}/src" "src/objects/*.h" "src/datatypes/*.h")
@ -41,8 +42,9 @@ file(GLOB_RECURSE SOURCES "src/*.cpp" "src/*.h")
list(APPEND SOURCES ${AUTOGEN_OUTS})
add_library(openblocks STATIC ${SOURCES})
set_target_properties(openblocks PROPERTIES OUTPUT_NAME "openblocks")
target_link_directories(openblocks PUBLIC ${LUAJIT_LIBRARY_DIRS})
target_link_libraries(openblocks ${GLEW_LIBRARIES} ${LUAJIT_LIBRARIES} OpenGL::GL ReactPhysics3D::ReactPhysics3D pugixml::pugixml)
target_include_directories(openblocks PUBLIC "src" "../include" ${LUAJIT_INCLUDE_DIR})
target_include_directories(openblocks PUBLIC "src" "../include" ${LUAJIT_INCLUDE_DIRS})
# Windows-specific dependencies
if(WIN32)

View file

@ -1,7 +1,7 @@
#pragma once
extern "C" {
#include <luajit-2.1/luajit.h>
#include <luajit-2.1/lauxlib.h>
#include <luajit-2.1/lualib.h>
#include <luajit-2.1/lua.h>
#include <luajit.h>
#include <lauxlib.h>
#include <lualib.h>
#include <lua.h>
}

15
docs/qscintilla.md Normal file
View file

@ -0,0 +1,15 @@
In order to build openblocks on Windows, qscintilla will need to already be installed.
To do this, first download the source archive from [`https://www.riverbankcomputing.com/static/Downloads/QScintilla/2.14.1/QScintilla_src-2.14.1.tar.gz`](https://www.riverbankcomputing.com/static/Downloads/QScintilla/2.14.1/QScintilla_src-2.14.1.tar.gz)
Next, launch the *x64 Native Tools Command Prompt for VS 2022*, and cd into the directory that you extracted the archive to
Now, run `qmake` from your Qt's bin directory to configure it
Once that's done, build and install the project using `nmake install`
The library should now automatically be installed into your Qt installed directory
---
To uninstall the library, run `nmake uninstall`

View file

@ -99,6 +99,13 @@ if (WIN32)
# No sense adding opengl-sw given that hardware acceleration is necessary, anyway
# Also don't want to clutter with plugins, add only needed ones
# Copy over QScintilla DLLs
# TODO: Use a better approach?
add_custom_command(
TARGET editor POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy ${QSCINTILLA_DLLS} $<TARGET_FILE_DIR:editor>
)
# Copy qt.conf to override default plugins location
add_custom_command(
TARGET editor POST_BUILD

View file

@ -6,7 +6,9 @@
{ "name": "pugixml", "version>=": "1.15" },
"sdl2",
"stb",
"reactphysics3d"
"reactphysics3d",
"pkgconf",
"luajit"
],
"overrides": [
{