Add project files.
This commit is contained in:
commit
3087fcea8a
71 files changed
+8325
No files matched your search
@@ -0,0 +1,21 @@
|
||||
# Hand-written rather than add_lib_module(), same reasoning as
|
||||
# HotReloadDemo/PluginV1's CMakeLists.txt: this needs to be a plain,
|
||||
# always-rebuildable SHARED library gated on BUILD_TESTS rather than a
|
||||
# PRIMARY install target.
|
||||
|
||||
if(BUILD_TESTS)
|
||||
add_library(hotreload_tests_undefined_symbol_fixture SHARED src/Fixture.cpp)
|
||||
else()
|
||||
add_library(hotreload_tests_undefined_symbol_fixture SHARED EXCLUDE_FROM_ALL src/Fixture.cpp)
|
||||
endif()
|
||||
|
||||
set_target_properties(hotreload_tests_undefined_symbol_fixture PROPERTIES
|
||||
OUTPUT_NAME "hotreload_tests_undefined_symbol_fixture"
|
||||
WINDOWS_EXPORT_ALL_SYMBOLS ON)
|
||||
_set_output_dirs(hotreload_tests_undefined_symbol_fixture
|
||||
"${CMAKE_BINARY_DIR}/${RUNTIME_OUTPUT_SUBDIR}/tests"
|
||||
"${CMAKE_BINARY_DIR}/${LIBRARY_OUTPUT_SUBDIR}/tests")
|
||||
_apply_compile_options(hotreload_tests_undefined_symbol_fixture)
|
||||
|
||||
_register_module_target(TEST hotreload_tests_undefined_symbol_fixture)
|
||||
add_dependencies(all_tests hotreload_tests_undefined_symbol_fixture)
|
||||
@@ -0,0 +1,28 @@
|
||||
/* A genuine ODR violation, kept deliberately: a non-inline static
|
||||
* class member that is declared but never given an out-of-class
|
||||
* definition. This compiles cleanly and links cleanly into a shared
|
||||
* library -- a shared library is allowed to keep undefined symbols by
|
||||
* default -- and only fails once something actually calls
|
||||
* trigger_undefined_symbol() below, ODR-using counter for the first
|
||||
* time. See source/HotReload/README.md's "hot_reload_last_error()"
|
||||
* section for the full story; HotReloadTests/Main.cpp loads this
|
||||
* fixture specifically to confirm hot_reload_last_error() reports
|
||||
* something useful for exactly this case, rather than leaving it a
|
||||
* silent "load failed" black box.
|
||||
*/
|
||||
class HasUndefinedStaticMember
|
||||
{
|
||||
public:
|
||||
static int useIt()
|
||||
{
|
||||
return counter;
|
||||
}
|
||||
|
||||
private:
|
||||
static int counter; // declared, deliberately never defined anywhere
|
||||
};
|
||||
|
||||
extern "C" int trigger_undefined_symbol()
|
||||
{
|
||||
return HasUndefinedStaticMember::useIt();
|
||||
}
|
||||
Reference in new issue
Block a user