Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function config_file_excludes( srcFolder, platforms )
- local curConf = configuration().current
- for plat, fold in pairs( platforms ) do
- configuration{ "not " .. plat, fold .. "/" .. plat .. "**" }
- flags { "ExcludeFromBuild" }
- end
- for _, fold in ipairs(os.matchdirs(srcFolder .. "/*")) do
- config_file_excludes( fold )
- end
- configuration( ).current = curConf
- end
- function config_current_project( )
- local curConf = configuration().current
- local dirs = os.matchdirs( "*" )
- if path_list_contains_top( dirs, "inc" ) then
- files{ "inc/**.h", "inc/**.hpp" }
- includedirs{ "inc" }
- config_ext_includes( "inc" )
- end
- if path_list_contains_top( dirs, "inc_private" ) then
- files{ "inc_private/**.h", "inc_private/**.hpp" }
- includedirs{ "inc_private" }
- config_ext_includes( "inc_private" )
- end
- if path_list_contains_top( dirs, "src" ) then
- files{ "src/**.cpp", "src/**.c" }
- config_file_excludes( "src" )
- end
- configuration( ).current = curConf
- end
- ...
- local allProjs = {}
- for sln in premake.global.eachSolution() do -- Iterate over every solution
- solution( sln.name ) -- Activate it
- for _, prj in ipairs( sln.projects ) do -- Now iterate over every project within that solution
- if prj.solution == sln then -- Skip external projects ( possible to import the same project into multiple solutions )
- allProjs[#allProjs + 1] = prj
- project( prj.name )
- filter "kind:SharedLib or *App"
- targetdir( "bin/" .. prj.name ) -- All application variants should be output to the bin folder followed by the project name
- debugdir( "bin/" .. prj.name )
- end
- end
- for _, cfg in ipairs(sln.configurations) do -- Now lets cover all configurations{}
- for _, plat in ipairs(sln.platforms) do -- Combined with platforms{}
- for _, prj in ipairs(sln.projects) do -- We need to iterate at project level as well to activate the project
- if prj.solution == sln then -- Skip external projects
- local lib_path = path.join( "lib" , cfg .. plat )
- project( prj.name ) -- Activate project so that location() gives us the correct info
- flags { "StaticRuntime" }
- configuration { cfg, plat } -- Activate the config / platform combo
- libdirs { lib_path } -- And set the library search folder
- objdir( "obj/" .. prj.name .. "/" .. cfg .. plat ) -- Also create a folder inside that project for object files
- configuration { "StaticLib", cfg, plat }
- targetdir( lib_path ) -- Set the library output path
- end
- end
- end
- end
- end
- make_soltuion_from_common( "ALL" ) -- Create a solution file that imports all projects
- location "sln"
- for _, prj in ipairs( allProjs ) do
- importproject( prj )
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement