Split DataStaticsFields into multiple compilation units

develop
lethosor 2016-03-18 23:11:11 -04:00
parent b8bbf5f545
commit af4a3428a6
4 changed files with 29 additions and 7 deletions

@ -165,6 +165,26 @@ modules/Once.cpp
modules/Filesystem.cpp
)
SET(STATIC_FIELDS_FILES)
FOREACH(GROUP other a b c d e f g h i j k l m n o p q r s t u v w x y z)
SET(STATIC_FIELDS_FILENAME ${dfhack_SOURCE_DIR}/library/DataStaticsFields/${GROUP}.cpp)
IF(${GROUP} STREQUAL "other")
SET(STATIC_FIELDS_INC_FILENAME "df/static.fields.inc")
ELSE()
SET(STATIC_FIELDS_INC_FILENAME "df/static.fields-${GROUP}.inc")
ENDIF()
FILE(WRITE ${STATIC_FIELDS_FILENAME}.tmp
"#define STATIC_FIELDS_GROUP\n"
"#include \"../DataStaticsFields.cpp\"\n"
"#include \"${STATIC_FIELDS_INC_FILENAME}\"\n"
)
EXECUTE_PROCESS(COMMAND ${CMAKE_COMMAND} -E copy_if_different
${STATIC_FIELDS_FILENAME}.tmp ${STATIC_FIELDS_FILENAME})
FILE(REMOVE ${STATIC_FIELDS_FILENAME}.tmp)
LIST(APPEND STATIC_FIELDS_FILES ${STATIC_FIELDS_FILENAME})
ENDFOREACH()
LIST(APPEND MAIN_SOURCES ${STATIC_FIELDS_FILES})
IF(WIN32)
SOURCE_GROUP("Modules\\Headers" FILES ${MODULE_HEADERS})
SOURCE_GROUP("Modules\\Sources" FILES ${MODULE_SOURCES})
@ -231,10 +251,10 @@ ADD_CUSTOM_TARGET(generate_headers DEPENDS ${dfapi_SOURCE_DIR}/include/df/codege
IF(UNIX)
# Don't produce debug info for generated stubs
SET_SOURCE_FILES_PROPERTIES(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp
SET_SOURCE_FILES_PROPERTIES(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp ${STATIC_FIELDS_FILES}
PROPERTIES COMPILE_FLAGS "-g0 -O1")
ELSE(WIN32)
SET_SOURCE_FILES_PROPERTIES(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp
SET_SOURCE_FILES_PROPERTIES(DataStatics.cpp DataStaticsCtor.cpp DataStaticsFields.cpp ${STATIC_FIELDS_FILES}
PROPERTIES COMPILE_FLAGS "/O1 /bigobj")
ENDIF()

@ -3,9 +3,11 @@
#include "MiscUtils.h"
#include "VersionInfo.h"
#ifndef STATIC_FIELDS_GROUP
#include "df/world.h"
#include "df/world_data.h"
#include "df/ui.h"
#endif
#include "DataIdentity.h"
#include "DataFuncs.h"
@ -18,6 +20,7 @@ namespace df {
#define NUMBER_IDENTITY_TRAITS(type) \
number_identity<type> identity_traits<type>::identity(#type);
#ifndef STATIC_FIELDS_GROUP
NUMBER_IDENTITY_TRAITS(char);
NUMBER_IDENTITY_TRAITS(int8_t);
NUMBER_IDENTITY_TRAITS(uint8_t);
@ -48,7 +51,7 @@ namespace df {
sizeof(std::fstream), fstream_allocator_fn, "fstream");
buffer_container_identity buffer_container_identity::base_instance;
#endif
#undef NUMBER_IDENTITY_TRAITS
}
@ -58,6 +61,3 @@ namespace df {
#define GFLD(mode, name) struct_field_info::mode, #name, (size_t)&df::global::name
#define METHOD(mode, name) struct_field_info::mode, #name, 0, wrap_function(&CUR_STRUCT::name)
#define FLD_END struct_field_info::END
// Field definitions
#include "df/static.fields.inc"

@ -0,0 +1,2 @@
*.cpp
*.tmp

@ -1 +1 @@
Subproject commit 90645ebd8e8433196d695a478e3d6c9a32add21d
Subproject commit 0063c03e400443ab6076e2a5388126e90e541762