Fixed compile issues

This commit is contained in:
Dreaded_X 2021-11-30 04:55:29 +01:00
parent 8040ba5b95
commit 89f97ea878
10 changed files with 40 additions and 9 deletions

View File

@ -24,6 +24,7 @@ if (lua_ADDED)
FILE(GLOB lua_sources ${lua_SOURCE_DIR}/*.c)
add_library(lua STATIC ${lua_sources})
set_source_files_properties(${lua_sources} PROPERTIES LANGUAGE CXX)
target_include_directories(lua
PUBLIC
@ -42,6 +43,7 @@ if (sol2_ADDED)
add_library(sol2 INTERFACE IMPORTED)
target_include_directories(sol2 INTERFACE ${sol2_SOURCE_DIR}/single/include)
target_link_libraries(sol2 INTERFACE lua)
target_compile_definitions(sol2 INTERFACE SOL_USING_CXX_LUA=1)
endif()
file(GLOB_RECURSE headers CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
@ -53,7 +55,7 @@ add_library(${PROJECT_NAME} ${headers} ${sources})
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<BOOL:${MSVC}>:/permissive->")
# Link dependencies (if required)
target_link_libraries(${PROJECT_NAME} PUBLIC ecs ecs-serial lua sol2)
target_link_libraries(${PROJECT_NAME} PUBLIC ecs ecs-serial sol2)
set_target_properties(${PROJECT_NAME} PROPERTIES
CXX_STANDARD 20

View File

@ -1,5 +1,6 @@
#pragma once
#include <limits>
#include "sol/sol.hpp"
#include "ecs.h"

View File

@ -205,7 +205,8 @@ namespace ecs::lua {
wrapper->table = lua.create_table();
for (auto [key, type] : map) {
wrapper->table[key] = table[key];
auto temp = table[key];
wrapper->table[key] = temp;
}
return std::make_pair(id, wrapper);

View File

@ -1,6 +1,6 @@
#pragma once
#include <functional>
#include <ostream>
#pragma once
#include "ecs.h"
#include "io/write.h"

View File

@ -1,7 +1,6 @@
#include "ecs-serial.h"
#include "ecs.h"
#include <bits/stdint-uintn.h>
#include <ostream>
#include <stdexcept>

View File

@ -27,8 +27,33 @@ if (stduuid_ADDED)
find_library(CFLIB CoreFoundation)
target_link_libraries(stduuid INTERFACE ${CFLIB})
else()
find_library(LIBUUID_LIBRARIES uuid)
target_link_libraries(stduuid INTERFACE ${LIBUUID_LIBRARIES})
FIND_PATH(LIBUUID_INCLUDE_DIRS uuid/uuid.h)
FIND_LIBRARY(LIBUUID_LIBRARIES uuid)
IF (LIBUUID_LIBRARIES AND LIBUUID_INCLUDE_DIRS)
SET(LIBUUID_FOUND 1)
IF (NOT LibUuid_FIND_QUIETLY)
MESSAGE(STATUS "Found libuuid: ${LIBUUID_LIBRARIES}")
ENDIF ( NOT LibUuid_FIND_QUIETLY )
ELSE (LIBUUID_LIBRARIES AND LIBUUID_INCLUDE_DIRS)
IF (LibUuid_FIND_REQUIRED)
MESSAGE(SEND_ERROR "Could NOT find libuuid")
ELSE (LibUuid_FIND_REQUIRED)
IF (NOT LIBUUID_FIND_QUIETLY)
MESSAGE(STATUS "Could NOT find libuuid")
ENDIF (NOT LIBUUID_FIND_QUIETLY)
ENDIF (LibUuid_FIND_REQUIRED)
ENDIF (LIBUUID_LIBRARIES AND LIBUUID_INCLUDE_DIRS)
MARK_AS_ADVANCED(LIBUUID_LIBRARIES LIBUUID_INCLUDE_DIRS)
message("${LIBUUID_LIBRARIES}")
message("${LIBUUID_INCLUDE_DIRS}")
if (LIBUUID_FOUND)
target_include_directories(stduuid INTERFACE ${LIBUUID_INCLUDE_DIRS})
target_link_libraries(stduuid INTERFACE ${LIBUUID_LIBRARIES})
endif()
endif()
endif()

View File

@ -7,6 +7,7 @@
#include <vector>
#include <iostream>
#define UUID_SYSTEM_GENERATOR
#include "uuid.h"
namespace ecs {

View File

@ -72,7 +72,7 @@ def main(argv):
output = argv[2]
index = clang.cindex.Index.create()
tu = index.parse(filename, ['-x', 'c++', '-std=c++2a', f'-Iecs/include', f'-Ibuild/_deps/stduuid-src/include', '-I/lib/gcc/x86_64-pc-linux-gnu/10.1.0/include'])
tu = index.parse(filename, ['-x', 'c++', '-std=c++20', f'-Iecs/include', f'-Ibuild/_deps/stduuid-src/include', '-I/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include'])
components = build_components(tu.cursor, filename)

View File

@ -1,4 +1,5 @@
#pragma once
#include <string>
#include "ecs.h"
struct Position : ecs::Component {

View File

@ -2,8 +2,6 @@
#include "ecs-lua.h"
#include "ecs-serial.h"
#include <bits/stdint-intn.h>
#include <bits/stdint-uintn.h>
#include <cstddef>
#include <iostream>
#include <fstream>
@ -145,6 +143,9 @@ int main(int argc, const char** argv) {
// Load entities from disk as a test
std::ifstream file("entities", std::ios::in);
if (!file.is_open()) {
std::cerr << "Failed to open: 'entities'!\n";
}
ecs::serial::deserialize_ids(file);