diff --git a/front/sdl/main.c b/front/sdl/main.c index e028a05b..45fed736 100644 --- a/front/sdl/main.c +++ b/front/sdl/main.c @@ -895,8 +895,8 @@ int main(int argc, char *argv[]) { front_interface.disk.userdata = &icon_fade; } - #ifdef VXTU_STATIC_MODULES - printf("Modules are staticlly linked!\n"); + #ifndef VXTU_STATIC_MODULES + printf("Modules are dynamically linked!\n"); #endif printf("Loaded modules:\n"); diff --git a/modules/network/network.c b/modules/network/network.c index 5906ad94..bd310c51 100644 --- a/modules/network/network.c +++ b/modules/network/network.c @@ -21,10 +21,10 @@ // // 3. This notice may not be removed or altered from any source distribution. -#define _DEFAULT_SOURCE 1 - #include +#ifdef LIBPACAP + #include #include #include @@ -221,3 +221,10 @@ VXTU_MODULE_CREATE(network, { PIREPHERAL->io.in = ∈ PIREPHERAL->io.out = &out; }) + +#else + +struct network { int _; }; +VXTU_MODULE_CREATE(network, { return NULL; }) + +#endif diff --git a/modules/network/premake5.lua b/modules/network/premake5.lua index cd9bd501..3d9b07b9 100644 --- a/modules/network/premake5.lua +++ b/modules/network/premake5.lua @@ -1,16 +1,22 @@ --- Disable this module by default. -module_ignore() +newoption { + trigger = "pcap", + description = "Link with libpcap for network support" +} files "network.c" -filter "system:windows" - includedirs "../../tools/npcap/sdk/Include" - defines "_WINSOCK_DEPRECATED_NO_WARNINGS" - -module_link_callback(function() - filter "not system:windows" - links "pcap" +if _OPTIONS["pcap"] then + defines { "LIBPCAP", "_DEFAULT_SOURCE=1" } filter "system:windows" - links { "Ws2_32", "../../tools/npcap/sdk/Lib/x64/wpcap" } -end) + includedirs "../../tools/npcap/sdk/Include" + defines "_WINSOCK_DEPRECATED_NO_WARNINGS" + + module_link_callback(function() + filter "not system:windows" + links "pcap" + + filter "system:windows" + links { "Ws2_32", "../../tools/npcap/sdk/Lib/x64/wpcap" } + end) +end diff --git a/premake5.lua b/premake5.lua index 2ddbcb1f..8ca1e945 100644 --- a/premake5.lua +++ b/premake5.lua @@ -6,7 +6,7 @@ newoption { newoption { trigger = "test", - description = "Generate make files for libvxt tests" + description = "Generate makefiles for libvxt tests" } newoption { @@ -99,7 +99,6 @@ workspace "virtualxt" filter { "toolset:clang or gcc", "configurations:debug" } buildoptions "-Wno-error" - sanitize { "Address", "Fuzzer" } local modules = {} local modules_link_callback = {} @@ -133,22 +132,17 @@ workspace "virtualxt" end end - for _,name in ipairs(mod_list) do - module_link_callback = function(f) - if _OPTIONS["dynamic"] then - filter {} - f() - filter {} - else - table.insert(modules_link_callback, f) - end - end - - module_ignore = function() - module_ignore = nil - module_link_callback = function() end + module_link_callback = function(f) + if _OPTIONS["dynamic"] then + filter {} + f() + filter {} + else + table.insert(modules_link_callback, f) end - + end + + for _,name in ipairs(mod_list) do project(name) if _OPTIONS["dynamic"] then kind "SharedLib" @@ -174,13 +168,10 @@ workspace "virtualxt" filter {} dofile("modules/" .. name .. "/premake5.lua") - if module_ignore then - table.insert(modules, name) - end - - module_ignore = nil - module_link_callback = nil + table.insert(modules, name) end + + module_link_callback = nil end -- This is just a dummy project. @@ -421,7 +412,6 @@ if _OPTIONS["test"] then optimize "Off" symbols "On" - sanitize { "Address", "Fuzzer" } postbuildcommands "./test/test" cleancommands "{RMDIR} test"