Switched to cmake
This commit is contained in:
43
ecs-serial/CMakeLists.txt
Normal file
43
ecs-serial/CMakeLists.txt
Normal file
@@ -0,0 +1,43 @@
|
||||
cmake_minimum_required(VERSION 3.5 FATAL_ERROR)
|
||||
|
||||
project(ecs-serial
|
||||
LANGUAGES CXX
|
||||
)
|
||||
|
||||
include(../cmake/CPM.cmake)
|
||||
|
||||
CPMAddPackage(
|
||||
NAME PackageProject.cmake
|
||||
GITHUB_REPOSITORY TheLartians/PackageProject.cmake
|
||||
VERSION 1.3
|
||||
)
|
||||
|
||||
CPMAddPackage(
|
||||
NAME io
|
||||
GIT_REPOSITORY https://git.mtgames.nl/Dreaded_X/io
|
||||
GIT_TAG master
|
||||
)
|
||||
|
||||
file(GLOB_RECURSE headers CONFIGURE_DEPENDS "${CMAKE_CURRENT_SOURCE_DIR}/include/*.h")
|
||||
file(GLOB_RECURSE sources CONFIGURE_DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/src/*.cpp)
|
||||
|
||||
add_library(${PROJECT_NAME} ${headers} ${sources})
|
||||
|
||||
# being a cross-platform target, we enforce standards conformance on MSVC
|
||||
target_compile_options(${PROJECT_NAME} PUBLIC "$<$<BOOL:${MSVC}>:/permissive->")
|
||||
|
||||
# Link dependencies (if required)
|
||||
target_link_libraries(${PROJECT_NAME} PUBLIC ecs io)
|
||||
|
||||
set_target_properties(${PROJECT_NAME} PROPERTIES
|
||||
CXX_STANDARD 20
|
||||
OUTPUT_NAME "${PROJECT_NAME}"
|
||||
)
|
||||
|
||||
string(TOLOWER ${PROJECT_NAME}/version.h VERSION_HEADER_LOCATION)
|
||||
|
||||
target_include_directories(${PROJECT_NAME}
|
||||
PUBLIC
|
||||
$<BUILD_INTERFACE:${PROJECT_SOURCE_DIR}/include>
|
||||
$<INSTALL_INTERFACE:include/${PROJECT_NAME}-${PROJECT_VERSION}>
|
||||
)
|
||||
@@ -1,6 +1,7 @@
|
||||
#include "ecs-serial.h"
|
||||
|
||||
#include "ecs.h"
|
||||
#include <bits/stdint-uintn.h>
|
||||
#include <ostream>
|
||||
|
||||
#include <stdexcept>
|
||||
@@ -25,6 +26,7 @@ namespace ecs::serial {
|
||||
for (auto [id, component] : components) {
|
||||
auto functions = internal::functions.find(id);
|
||||
if (functions == internal::functions.end()) {
|
||||
std::cerr << "ID: " << id << '\n';
|
||||
throw std::runtime_error("No known serializer for id");
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user