@@ -12,7 +12,6 @@ add_rules("mode.debug", "mode.releasedbg")
1212
1313-- include subprojects
1414includes (" lib/commonlib-shared" )
15- includes (" xmake-rules.lua" )
1615
1716-- define targets
1817target (" commonlibob64" , function ()
@@ -48,3 +47,59 @@ target("commonlibob64", function ()
4847 { public = true }
4948 )
5049end )
50+
51+ rule (" commonlibob64.plugin" , function ()
52+ add_deps (" commonlib.plugin" )
53+
54+ on_load (function (target )
55+ target :data_set (" commonlib.plugin.config" , target :extraconf (" rules" , " commonlibob64.plugin" ))
56+ end )
57+
58+ on_config (function (target )
59+ target :add (" deps" , " commonlibob64" )
60+
61+ target :add (" configfiles" , path.join (os.scriptdir (), " res/commonlibob64-plugin.cpp.in" ))
62+ target :add (" files" , path.join (target :configdir (), " commonlibob64-plugin.cpp" ))
63+
64+ local conf = target :extraconf (" rules" , " commonlibob64.plugin" )
65+ if conf .options then
66+ if conf .options .sig_scanning then
67+ conf .options .address_library = false
68+ else
69+ conf .options .sig_scanning = false
70+ if conf .options .address_library == nil then
71+ conf .options .address_library = true
72+ end
73+ end
74+ if conf .options .no_struct_use then
75+ conf .options .layout_dependent = false
76+ else
77+ conf .options .no_struct_use = false
78+ if conf .options .layout_dependent == nil then
79+ conf .options .layout_dependent = true
80+ end
81+ end
82+ else
83+ conf .options = {
84+ sig_scanning = false ,
85+ address_library = true ,
86+ no_struct_use = false ,
87+ layout_dependent = true
88+ }
89+ end
90+
91+ target :set (" configvar" , " COMMONLIBOB64_OPTION_SIG_SCANNING" , tostring (conf .options .sig_scanning ))
92+ target :set (" configvar" , " COMMONLIBOB64_OPTION_ADDRESS_LIBRARY" , tostring (conf .options .address_library ))
93+ target :set (" configvar" , " COMMONLIBOB64_OPTION_NO_STRUCT_USE" , tostring (conf .options .no_struct_use ))
94+ target :set (" configvar" , " COMMONLIBOB64_OPTION_LAYOUT_DEPENDENT" , tostring (conf .options .layout_dependent ))
95+
96+ if os.getenv (" XSE_TES4_MODS_PATH" ) then
97+ target :set (" installdir" , path.join (os.getenv (" XSE_TES4_MODS_PATH" ), target :name ()))
98+ elseif os.getenv (" XSE_TES4_GAME_PATH" ) then
99+ target :set (" installdir" , os.getenv (" XSE_TES4_GAME_PATH" ))
100+ end
101+
102+ target :add (" installfiles" , target :targetfile (), { prefixdir = " OblivionRemastered/Binaries/Win64/OBSE/Plugins" })
103+ target :add (" installfiles" , target :symbolfile (), { prefixdir = " OblivionRemastered/Binaries/Win64/OBSE/Plugins" })
104+ end )
105+ end )
0 commit comments