From c467671ae8b6ec161c17e86f3383fd0625f755b8 Mon Sep 17 00:00:00 2001 From: Clyne Sullivan Date: Fri, 19 Aug 2022 19:48:10 -0400 Subject: remove sol2 (will re-add as submodule) --- .../examples/require_dll_example/CMakeLists.txt | 145 --------------------- .../include/my_object/my_object.hpp | 28 ---- .../include/my_object/my_object_api.hpp | 27 ---- .../require_dll_example/source/my_object.cpp | 27 ---- .../source/require_from_dll.cpp | 33 ----- 5 files changed, 260 deletions(-) delete mode 100644 lib/sol2/examples/require_dll_example/CMakeLists.txt delete mode 100644 lib/sol2/examples/require_dll_example/include/my_object/my_object.hpp delete mode 100644 lib/sol2/examples/require_dll_example/include/my_object/my_object_api.hpp delete mode 100644 lib/sol2/examples/require_dll_example/source/my_object.cpp delete mode 100644 lib/sol2/examples/require_dll_example/source/require_from_dll.cpp (limited to 'lib/sol2/examples/require_dll_example') diff --git a/lib/sol2/examples/require_dll_example/CMakeLists.txt b/lib/sol2/examples/require_dll_example/CMakeLists.txt deleted file mode 100644 index a2aea84..0000000 --- a/lib/sol2/examples/require_dll_example/CMakeLists.txt +++ /dev/null @@ -1,145 +0,0 @@ -# # # # sol3 -# The MIT License (MIT) -# -# Copyright (c) 2013-2019 Rapptz, ThePhD, and contributors -# -# Permission is hereby granted, free of charge, to any person obtaining a copy of -# this software and associated documentation files (the "Software"), to deal in -# the Software without restriction, including without limitation the rights to -# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of -# the Software, and to permit persons to whom the Software is furnished to do so, -# subject to the following conditions: -# -# The above copyright notice and this permission notice shall be included in all -# copies or substantial portions of the Software. -# -# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS -# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR -# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER -# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN -# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - -# # # sol3 Examples - require_from_dll - -# # Reusable function to call for single target -# # Also hides variables from directory/global scope -function(make_require_from_dll_example target_lib example_lib_name_suffix) - # define sources - set(my_object_sources source/my_object.cpp) - set(require_from_dll_sources source/require_from_dll.cpp) - - # define names - set(example_lib_name my_object) - set(example_name require_from_dll) - set(example_lib_name "${example_lib_name}${example_lib_name_suffix}") - set(example_name "${example_name}${example_lib_name_suffix}") - - # add library target my_object for the require_from_dll program - add_library(${example_lib_name} SHARED ${my_object_sources}) - set_target_properties(${example_lib_name} PROPERTIES - PREFIX "") - - target_include_directories(${example_lib_name} - PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include") - target_compile_definitions(${example_lib_name} - PUBLIC MY_OBJECT_DLL - PRIVATE MY_OBJECT_BUILD) - target_link_libraries(${example_lib_name} - PUBLIC ${target_lib} ${LUA_LIBRARIES} sol2::assert) - target_include_directories(${example_lib_name} - PUBLIC "${LUA_INCLUDE_DIRS}") - - if (MSVC) - target_compile_options(${example_lib_name} - PRIVATE /std:c++latest /EHsc "$<$:/MDd>" - "$<$:/MD>" - "$<$:/MD>" - "$<$:/MD>") - target_compile_definitions(${example_lib_name} - PRIVATE UNICODE _UNICODE - _CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_DEPRECATE) - else() - target_compile_options(${example_lib_name} - PRIVATE -std=c++1z - -Wno-unknown-warning -Wno-unknown-warning-option - -Wall -Wextra -Wpedantic -pedantic -pedantic-errors - -Wno-noexcept-type) - - if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - # For another day, when C++ is not so crap - # and we have time to audit the entire lib - # for all uses of `detail::swallow`... - #target_compile_options(${test_target_name} - # PRIVATE -Wcomma) - endif() - - - if (IS_X86) - target_compile_options(${example_lib_name} BEFORE PRIVATE -m32) - endif() - endif() - - if(CMAKE_DL_LIBS) - target_link_libraries(${example_lib_name} PUBLIC ${CMAKE_DL_LIBS}) - endif() - - # add executable target that represents require_from_dll program - add_executable(${example_name} ${require_from_dll_sources}) - target_link_libraries(${example_name} - PRIVATE my_object ${LUA_LIBRARIES} ${target_lib}) - target_include_directories(${example_name} - PRIVATE ${LUA_INCLUDE_DIRS}) - - if (MSVC) - target_compile_options(${example_name} - PRIVATE /std:c++latest /EHsc "$<$:/MDd>" - "$<$:/MD>" - "$<$:/MD>" - "$<$:/MD>") - target_compile_definitions(${example_name} - PRIVATE UNICODE _UNICODE - _CRT_SECURE_NO_WARNINGS _CRT_SECURE_NO_DEPRECATE) - else() - target_compile_options(${example_name} - PRIVATE -std=c++1z - -Wno-unknown-warning -Wno-unknown-warning-option - -Wall -Wextra -Wpedantic -pedantic -pedantic-errors - -Wno-noexcept-type) - - if (CMAKE_CXX_COMPILER_ID MATCHES "Clang") - # For another day, when C++ is not so crap - # and we have time to audit the entire lib - # for all uses of `detail::swallow`... - #target_compile_options(${test_target_name} - # PRIVATE -Wcomma) - endif() - endif() - - if(CMAKE_DL_LIBS) - target_link_libraries(${example_name} PRIVATE ${CMAKE_DL_LIBS}) - endif() - - if (SOL2_TESTS_DYNAMIC_LOADING_EXAMPLES) - get_target_property(example_working_dir ${example_name} RUNTIME_OUTPUT_DIRECTORY) - add_test(NAME ${example_name} COMMAND ${example_name} WORKING_DIRECTORY "${example_working_dir}") - endif() -endfunction() - -list(GET LUA_LIBRARIES 0 lua_lib_target) -get_target_property(lua_lib_type ${lua_lib_target} TYPE) -if (lua_lib_type MATCHES "STATIC") - # avoid multiply defined references due to linking in the same static library - # twice over, and get "multiple definition" errors during linking - return() -endif() - -if (SOL2_DYNAMIC_LOADING_EXAMPLES) - make_require_from_dll_example(sol2::sol2 "") -endif() -if (SOL2_DYNAMIC_LOADING_EXAMPLES_SINGLE) - make_require_from_dll_example(sol2::sol2_single ".single") -endif() -if (SOL2_DYNAMIC_LOADING_EXAMPLES_SINGLE_GENERATED) - make_require_from_dll_example(sol2::sol2_single_generated ".single.generated") -endif() diff --git a/lib/sol2/examples/require_dll_example/include/my_object/my_object.hpp b/lib/sol2/examples/require_dll_example/include/my_object/my_object.hpp deleted file mode 100644 index f8ec5e5..0000000 --- a/lib/sol2/examples/require_dll_example/include/my_object/my_object.hpp +++ /dev/null @@ -1,28 +0,0 @@ -#pragma once - -#include - -// forward declare as a C struct -// so a pointer to lua_State can be part of a signature -extern "C" { - struct lua_State; -} -// you can replace the above if you're fine with including -// earlier than absolutely necessary - -namespace my_object { - - struct test { - int value; - - test() = default; - test(int val) : value(val) {} - }; - -} // namespace my_object - -// this function needs to be exported from your -// dll. "extern 'C'" should do the trick, but -// we're including platform-specific stuff here to help -// see my_object_api.hpp for details -extern "C" MY_OBJECT_API int luaopen_my_object(lua_State* L); diff --git a/lib/sol2/examples/require_dll_example/include/my_object/my_object_api.hpp b/lib/sol2/examples/require_dll_example/include/my_object/my_object_api.hpp deleted file mode 100644 index 6af5f42..0000000 --- a/lib/sol2/examples/require_dll_example/include/my_object/my_object_api.hpp +++ /dev/null @@ -1,27 +0,0 @@ -#pragma once - -namespace my_object { - -#if defined _MSC_VER - #define MY_OBJECT_VC -#elif defined __GNUC__ - #define MY_OBJECT_GCC -#elif defined __clang__ - #define MY_OBJECT_CLANG -#endif - -#if defined MY_OBJECT_VC - #if defined MY_OBJECT_DLL - #if defined MY_OBJECT_BUILD - #define MY_OBJECT_API __declspec(dllexport) - #else - #define MY_OBJECT_API __declspec(dllexport) - #endif // MY_OBJECT_BUILD - Building the Library vs. Using the Library - #else - #define MY_OBJECT_API - #endif // Building a DLL vs. Static Library -#else // g++ / clang++ - #define MY_OBJECT_API __attribute__ ((visibility ("default"))) -#endif // MY_OBJECT_BUILD - -} // namespace my_object diff --git a/lib/sol2/examples/require_dll_example/source/my_object.cpp b/lib/sol2/examples/require_dll_example/source/my_object.cpp deleted file mode 100644 index d966c2b..0000000 --- a/lib/sol2/examples/require_dll_example/source/my_object.cpp +++ /dev/null @@ -1,27 +0,0 @@ -#include - -#define SOL_ALL_SAFETIES_ON 1 -#include - -namespace my_object { - - sol::table open_my_object(sol::this_state L) { - sol::state_view lua(L); - sol::table module = lua.create_table(); - module.new_usertype("test", - sol::constructors(), - "value", &test::value); - - return module; - } - -} // namespace my_object - -extern "C" int luaopen_my_object(lua_State* L) { - // pass the lua_State, - // the index to start grabbing arguments from, - // and the function itself - // optionally, you can pass extra arguments to the function if that's necessary, - // but that's advanced usage and is generally reserved for internals only - return sol::stack::call_lua(L, 1, my_object::open_my_object ); -} diff --git a/lib/sol2/examples/require_dll_example/source/require_from_dll.cpp b/lib/sol2/examples/require_dll_example/source/require_from_dll.cpp deleted file mode 100644 index 874d187..0000000 --- a/lib/sol2/examples/require_dll_example/source/require_from_dll.cpp +++ /dev/null @@ -1,33 +0,0 @@ -#define SOL_ALL_SAFETIES_ON 1 -#include - -#include -#include - -#include - -int main(int, char*[]) { - std::cout << "=== require from DLL ===" << std::endl; - - sol::state lua; - lua.open_libraries(sol::lib::package, sol::lib::base); - - const auto& code = R"( -mo = require("my_object") - -obj = mo.test.new(24) -print(obj.value))"; - auto script_result = lua.safe_script(code, &sol::script_pass_on_error); - if (script_result.valid()) { - std::cout << "The DLL was require'd from successfully!" << std::endl; - } - else { - sol::error err = script_result; - std::cout << "Something bad happened: " << err.what() << std::endl; - } - c_assert(script_result.valid()); - my_object::test& obj = lua["obj"]; - c_assert(obj.value == 24); - - return 0; -} \ No newline at end of file -- cgit v1.2.3