Compare commits
4 commits
5ce335bbb1
...
25ac749385
Author | SHA1 | Date | |
---|---|---|---|
25ac749385 | |||
6ec7d5d47d | |||
a2b447fc2c | |||
3d71df8422 |
15 changed files with 71 additions and 115 deletions
|
@ -20,7 +20,7 @@ set( CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib )
|
|||
set(CMAKE_EXPORT_COMPILE_COMMANDS ON)
|
||||
|
||||
add_subdirectory(core)
|
||||
#add_subdirectory(client)
|
||||
#add_subdirectory(editor)
|
||||
add_subdirectory(client)
|
||||
add_subdirectory(editor)
|
||||
|
||||
install(FILES $<TARGET_RUNTIME_DLLS:editor> TYPE BIN)
|
|
@ -1,8 +1,5 @@
|
|||
find_package(SDL2 REQUIRED)
|
||||
include_directories(${SDL2_INCLUDE_DIRS})
|
||||
|
||||
find_package(glfw3 REQUIRED)
|
||||
include(${CMAKE_CURRENT_SOURCE_DIR}/deps.cmake)
|
||||
|
||||
add_executable(client "src/main.cpp")
|
||||
target_link_libraries(client PRIVATE ${SDL2_LIBRARIES} openblocks glfw)
|
||||
target_link_libraries(client PRIVATE openblocks glfw)
|
||||
add_dependencies(client openblocks)
|
12
client/deps.cmake
Normal file
12
client/deps.cmake
Normal file
|
@ -0,0 +1,12 @@
|
|||
# Declare/fetch packages
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
glfw3
|
||||
GIT_REPOSITORY https://github.com/glfw/glfw
|
||||
GIT_TAG 3.4
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(glfw3)
|
||||
|
||||
# Find/include packages
|
23
cmake/CPM.cmake
Normal file
23
cmake/CPM.cmake
Normal file
|
@ -0,0 +1,23 @@
|
|||
set(CPM_DOWNLOAD_VERSION 0.42.0)
|
||||
# Patch support is broken in CPM upstream atm, so we have to use a fork
|
||||
set(CPM_HASH_SUM "f7d92592a257d184fd8de6fb496a711ce393676ed68999b96043aab2e5e6f9e6")
|
||||
# set(CPM_HASH_SUM "2020b4fc42dba44817983e06342e682ecfc3d2f484a581f11cc5731fbe4dce8a")
|
||||
|
||||
if(CPM_SOURCE_CACHE)
|
||||
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
|
||||
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
else()
|
||||
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
|
||||
endif()
|
||||
|
||||
# Expand relative path. This is important if the provided path contains a tilde (~)
|
||||
get_filename_component(CPM_DOWNLOAD_LOCATION ${CPM_DOWNLOAD_LOCATION} ABSOLUTE)
|
||||
|
||||
file(DOWNLOAD
|
||||
https://raw.githubusercontent.com/BohdanBuinich/CPM.cmake/refs/heads/feat/fix_patch_command/cmake/CPM.cmake
|
||||
# https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
|
||||
${CPM_DOWNLOAD_LOCATION} EXPECTED_HASH SHA256=${CPM_HASH_SUM}
|
||||
)
|
||||
|
||||
include(${CPM_DOWNLOAD_LOCATION})
|
|
@ -34,8 +34,8 @@ list(APPEND SOURCES ${CMAKE_CURRENT_BINARY_DIR}/src/version.cpp)
|
|||
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 Freetype::Freetype)
|
||||
target_include_directories(openblocks PUBLIC "src" "../include" ${LUAJIT_INCLUDE_DIRS})
|
||||
target_link_libraries(openblocks libglew_static reactphysics3d pugixml::pugixml Freetype::Freetype glm::glm libluajit ${LuaJIT_LIBRARIES})
|
||||
target_include_directories(openblocks PUBLIC "src" "../include" ${ReactPhysics3D_SOURCE_DIR}/include ${LUAJIT_INCLUDE_DIRS} ${stb_SOURCE_DIR} ${glew_SOURCE_DIR}/include)
|
||||
add_dependencies(openblocks autogen_build autogen)
|
||||
|
||||
# Windows-specific dependencies
|
||||
|
|
|
@ -1,63 +1,24 @@
|
|||
# Declare/fetch packages
|
||||
|
||||
include(FetchContent)
|
||||
FetchContent_Declare(
|
||||
glew
|
||||
GIT_REPOSITORY https://github.com/Perlmint/glew-cmake
|
||||
GIT_TAG glew-cmake-2.2.0
|
||||
include(CPM)
|
||||
|
||||
CPMAddPackage("gh:Perlmint/glew-cmake#glew-cmake-2.2.0")
|
||||
CPMAddPackage("gh:g-truc/glm#1.0.1")
|
||||
CPMAddPackage(NAME reactphysics3d GITHUB_REPOSITORY "DanielChappuis/reactphysics3d" VERSION 0.10.2 PATCHES ${CMAKE_SOURCE_DIR}/patches/std_chrono.patch)
|
||||
# https://github.com/StereoKit/StereoKit/blob/0be056efebcee5e58ad1438f4cf6dfdb942f6cf9/CMakeLists.txt#L205
|
||||
set_property(TARGET reactphysics3d PROPERTY POSITION_INDEPENDENT_CODE ON)
|
||||
CPMAddPackage("gh:zeux/pugixml@1.15")
|
||||
|
||||
CPMAddPackage(
|
||||
NAME freetype
|
||||
GIT_REPOSITORY https://github.com/aseprite/freetype2.git
|
||||
GIT_TAG VER-2-10-0
|
||||
VERSION 2.10.0
|
||||
)
|
||||
|
||||
FetchContent_Declare(
|
||||
glm
|
||||
GIT_REPOSITORY https://github.com/g-truc/glm
|
||||
GIT_TAG 1.0.1
|
||||
)
|
||||
if (freetype_ADDED)
|
||||
add_library(Freetype::Freetype ALIAS freetype)
|
||||
endif()
|
||||
|
||||
FetchContent_Declare(
|
||||
ReactPhysics3D
|
||||
GIT_REPOSITORY https://github.com/DanielChappuis/reactphysics3d
|
||||
GIT_TAG v0.10.2
|
||||
)
|
||||
|
||||
FetchContent_Declare(
|
||||
pugixml
|
||||
GIT_REPOSITORY https://github.com/zeux/pugixml
|
||||
GIT_TAG v1.15
|
||||
)
|
||||
|
||||
FetchContent_Declare(
|
||||
freetype
|
||||
GIT_REPOSITORY https://gitlab.freedesktop.org/freetype/freetype
|
||||
GIT_TAG VER-2-13-3
|
||||
)
|
||||
|
||||
FetchContent_Declare(
|
||||
stb
|
||||
GIT_REPOSITORY https://github.com/natanaeljr/stb-cmake-package
|
||||
GIT_TAG 1a4828e0cf649fb873c7b5f45b5d22d411a44ae4 # v0.9.0
|
||||
)
|
||||
|
||||
FetchContent_Declare(
|
||||
luajit
|
||||
GIT_REPOSITORY https://github.com/zhaozg/luajit-cmake
|
||||
GIT_TAG 300c0b3f472be2be158f5b2e6385579ba5c6c0f9
|
||||
)
|
||||
|
||||
FetchContent_MakeAvailable(glew glm ReactPhysics3D pugixml freetype stb luajit)
|
||||
|
||||
# Find/include packages
|
||||
|
||||
find_package(OpenGL REQUIRED COMPONENTS OpenGL)
|
||||
# find_package(glew REQUIRED)
|
||||
include_directories(${GLEW_INCLUDE_DIRS})
|
||||
# find_package(glm CONFIG REQUIRED)
|
||||
# find_package(ReactPhysics3D REQUIRED)
|
||||
# find_package(pugixml 1.15 REQUIRED)
|
||||
# find_package(Freetype)
|
||||
# find_package(Stb REQUIRED)
|
||||
include_directories(${Stb_INCLUDE_DIR})
|
||||
|
||||
# PkgConfig packages
|
||||
# find_package(PkgConfig REQUIRED)
|
||||
# pkg_check_modules(LUAJIT REQUIRED luajit)
|
||||
link_directories(${LUAJIT_LIBRARY_DIRS})
|
||||
CPMAddPackage("gh:nothings/stb#8cfb1605c02aee9fb6eb5d8ea559017745bd9a16") # 2.14
|
||||
CPMAddPackage("gh:WohlSoft/LuaJIT#a5da8f4a31972b74254f00969111b8b7a07cf584") # v2.1
|
||||
set(LUAJIT_INCLUDE_DIRS ${LuaJIT_SOURCE_DIR}/src)
|
|
@ -6,6 +6,8 @@ extern "C" {
|
|||
#include <lua.h>
|
||||
}
|
||||
|
||||
LUALIB_API void *(luaL_testudata) (lua_State *L, int ud, const char *tname);
|
||||
|
||||
inline const char* x_luaL_udatatname (lua_State *L, int ud) {
|
||||
void *p = lua_touserdata(L, ud);
|
||||
if (p != NULL) {
|
||||
|
@ -16,4 +18,6 @@ inline const char* x_luaL_udatatname (lua_State *L, int ud) {
|
|||
return str;
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
}
|
||||
|
||||
#define LUA_OK 0
|
|
@ -13,6 +13,7 @@ WedgePart::WedgePart(PartConstructParams params): BasePart(&TYPE, params) {
|
|||
}
|
||||
|
||||
void WedgePart::updateCollider(rp::PhysicsCommon* common) {
|
||||
Logger::fatalError("Wedges are currently disabled! Please do not use them or your editor may crash\n");
|
||||
rp::ConvexMeshShape* shape = common->createConvexMeshShape(wedgePhysMesh, glmToRp(size * glm::vec3(0.5f)));
|
||||
|
||||
// Recreate the rigidbody if the shape changes
|
||||
|
@ -87,5 +88,5 @@ void WedgePart::createWedgeShape(rp::PhysicsCommon* common) {
|
|||
|
||||
// Create the convex mesh
|
||||
std::vector<rp3d::Message> messages;
|
||||
wedgePhysMesh = common->createConvexMesh(polygonVertexArray, messages);
|
||||
// wedgePhysMesh = common->createConvexMesh(polygonVertexArray, messages);
|
||||
}
|
|
@ -3,7 +3,7 @@
|
|||
#include "basepart.h"
|
||||
#include "objects/annotation.h"
|
||||
|
||||
class DEF_INST WedgePart : public BasePart {
|
||||
class DEF_INST_(hidden) WedgePart : public BasePart {
|
||||
AUTOGEN_PREAMBLE
|
||||
|
||||
protected:
|
||||
|
|
1
deps.txt
1
deps.txt
|
@ -2,7 +2,6 @@ opengl (Linux: glvnd, Windows: [built-in/none])
|
|||
glfw
|
||||
glew
|
||||
glm
|
||||
sdl2
|
||||
stb
|
||||
qt6
|
||||
reactphysics3d
|
||||
|
|
|
@ -81,7 +81,7 @@ if (WIN32)
|
|||
# TODO: Add other translations
|
||||
add_custom_command(
|
||||
TARGET editor POST_BUILD
|
||||
COMMAND ${WINDEPLOYQT_EXECUTABLE} $<TARGET_FILE:editor> ${QSCINTILLA_DLLS} --dir $<TARGET_FILE_DIR:editor> --translations en --no-compiler-runtime --no-opengl-sw --no-system-d3d-compiler --plugindir $<TARGET_FILE_DIR:editor>/qtplugins
|
||||
COMMAND ${WINDEPLOYQT_EXECUTABLE} $<TARGET_FILE:editor> ${QSCINTILLA_DLLS} --release --dir $<TARGET_FILE_DIR:editor> --translations en --no-compiler-runtime --no-opengl-sw --no-system-d3d-compiler --plugindir $<TARGET_FILE_DIR:editor>/qtplugins
|
||||
)
|
||||
# No sense adding opengl-sw given that hardware acceleration is necessary, anyway
|
||||
# Also don't want to clutter with plugins, add only needed ones
|
||||
|
|
|
@ -107,7 +107,7 @@ void ExplorerView::buildContextMenu() {
|
|||
contextMenu.addMenu(insertObjectMenu);
|
||||
|
||||
for (const auto& [_, type] : INSTANCE_MAP) {
|
||||
if (type->flags & INSTANCE_NOTCREATABLE || !type->constructor) continue;
|
||||
if (type->flags & (INSTANCE_NOTCREATABLE | INSTANCE_HIDDEN) || !type->constructor) continue;
|
||||
|
||||
QAction* instAction = new QAction(model.iconOf(type), QString::fromStdString(type->className));
|
||||
insertObjectMenu->addAction(instAction);
|
||||
|
|
0
vcpkg-overlays/reactphysics3d/std_chrono.patch → patches/std_chrono.patch
Executable file → Normal file
0
vcpkg-overlays/reactphysics3d/std_chrono.patch → patches/std_chrono.patch
Executable file → Normal file
|
@ -1,23 +0,0 @@
|
|||
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
|
||||
|
||||
vcpkg_from_github(
|
||||
OUT_SOURCE_PATH SOURCE_PATH
|
||||
REPO DanielChappuis/reactphysics3d
|
||||
REF "cd958bbc0c6e84a869388cba6613f10cc645b3cb"
|
||||
SHA512 9856c0e998473e0bfb97af9ced07952bbd4dfef79f7dc388b1ecf9b6c6406f7669333e441fe6cefdf40b32edc5a1b8e4cb35a8c15fccb64c28785aff5fd77113
|
||||
HEAD_REF master
|
||||
PATCHES "std_chrono.patch"
|
||||
)
|
||||
|
||||
vcpkg_cmake_configure(
|
||||
SOURCE_PATH "${SOURCE_PATH}"
|
||||
)
|
||||
|
||||
vcpkg_cmake_install()
|
||||
|
||||
vcpkg_cmake_config_fixup(PACKAGE_NAME "reactphysics3d" CONFIG_PATH "lib/cmake/ReactPhysics3D")
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_PACKAGES_DIR}/debug/include")
|
||||
|
||||
# file(INSTALL "${CMAKE_CURRENT_LIST_DIR}/usage" DESTINATION "${CURRENT_PACKAGES_DIR}/share/${PORT}")
|
||||
vcpkg_install_copyright(FILE_LIST "${SOURCE_PATH}/LICENSE")
|
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"name": "reactphysics3d",
|
||||
"version": "0.10.2",
|
||||
"homepage": "https://github.com/DanielChappuis/reactphysics3d",
|
||||
"description": "Open source C++ physics engine library in 3D",
|
||||
"license": "zlib",
|
||||
"dependencies": [
|
||||
{
|
||||
"name" : "vcpkg-cmake",
|
||||
"host" : true
|
||||
},
|
||||
{
|
||||
"name" : "vcpkg-cmake-config",
|
||||
"host" : true
|
||||
},
|
||||
"fmt"
|
||||
]
|
||||
}
|
Loading…
Add table
Reference in a new issue