0AD : Per Salix non si può avere?

Italian forum
User avatar
Zievatron
Posts: 272
Joined: 31. Jan 2012, 15:13

Re: 0AD : Per Salix non si può avere?

Post by Zievatron »

No. Boost c'è.
User avatar
laplume
Donor
Posts: 348
Joined: 4. Sep 2010, 07:40
Location: (VI) Italy

Re: 0AD : Per Salix non si può avere?

Post by laplume »

Prova a vedere sulle istruzioni per la compilazione dal sito di 0ad, c'è una lista di dipendenze da soddisfare, magari ti manca qualcosa di quella lista.

Ciao
Antonio
User avatar
Chaosphere
Posts: 39
Joined: 14. Jul 2012, 13:21

Re: 0AD : Per Salix non si può avere?

Post by Chaosphere »

Zievatron wrote:
Chaosphere wrote:Secondo me, la via più veloce ....
O.K. Ho seguito il tuo suggerimento e dato i comandi che hai scritto (3 va già bene ed avevo già disinstallato qualsiaisi traccia della 0.0.11).
Ora sta lavorando.

Mi potresti anche spiegare un po' cosa ho fatto con quei comandi? :?

EDIT.: Andiamo male. Ho già visto comparire qualche messaggio di errore.
Ora si è fermato e queste sono le ultime righe:

Code: Select all

/usr/lib64/gcc/x86_64-slackware-linux/4.7.1/../../../../x86_64-slackware-linux/bin/ld: impossibile trovare -lboost_filesystem-mt
/usr/lib64/gcc/x86_64-slackware-linux/4.7.1/../../../../x86_64-slackware-linux/bin/ld: impossibile trovare -lboost_system-mt
collect2: error: ld returned 1 exit status
make[1]: *** [../../../binaries/system/test] Errore 1
make: *** [test] Errore 2
ObjectSettings.cpp
MiscState.cpp
Brushes.cpp
Linking AtlasUI
/usr/lib64/gcc/x86_64-slackware-linux/4.7.1/../../../../x86_64-slackware-linux/bin/ld: impossibile trovare -lboost_filesystem-mt
/usr/lib64/gcc/x86_64-slackware-linux/4.7.1/../../../../x86_64-slackware-linux/bin/ld: impossibile trovare -lboost_system-mt
/usr/lib64/gcc/x86_64-slackware-linux/4.7.1/../../../../x86_64-slackware-linux/bin/ld: impossibile trovare -lboost_signals-mt
collect2: error: ld returned 1 exit status
make[1]: *** [../../../binaries/system/libAtlasUI.so] Errore 1
make: *** [AtlasUI] Errore 2
Cosa c'è che non va e come rimedio?
i comandi che hai dato semplicemente scaricano le sorgenti più recenti, le scompattano e le compilano.

Code: Select all

svn co http://svn.wildfiregames.com/public/ps/trunk/ 0ad
questo scarica le sorgenti.

Code: Select all

cd 0ad/build/workspaces
./update-workspaces.sh -j3
cd gcc
make -j3
questi invece compilano le sorgenti per la tua macchina.

Per il problema, quoto sopra, sembrerebbe essere una dipendenza. Controlla di avere le librerie boost installate. Usa pure la GUI per slapt. :)
Image
Image
User avatar
Zievatron
Posts: 272
Joined: 31. Jan 2012, 15:13

Re: 0AD : Per Salix non si può avere?

Post by Zievatron »

Ho già detto che boost c'è. In GSlapt risulta installato.
Cosa sono quelle cose che dice di non poter trovare?

Code: Select all

/usr/lib64/gcc/x86_64-slackware-linux/4.7.1/../../../../x86_64-slackware-linux/bin/ld: impossibile trovare -lboost_filesystem-mt
/usr/lib64/gcc/x86_64-slackware-linux/4.7.1/../../../../x86_64-slackware-linux/bin/ld: impossibile trovare -lboost_system-mt
/usr/lib64/gcc/x86_64-slackware-linux/4.7.1/../../../../x86_64-slackware-linux/bin/ld: impossibile trovare -lboost_signals-mt
Sembrano avere a che fare con boost, ma boost risulta installato. Per l'esattezza, è boost 1.49.
User avatar
Chaosphere
Posts: 39
Joined: 14. Jul 2012, 13:21

Re: 0AD : Per Salix non si può avere?

Post by Chaosphere »

Ok, sto provando a installarlo anche sul mio computer. Leggendo su altri forum, sembrerebbe che il supporto per mt non c'è più per boost da una versione. Quindi potrebbe essere necessario creare dei symlink oppure modificare dei file di configurazione del gioco. Comunque provo e ti saprò dire meglio.

Risolto :D

Semplicemente devi editare un file, quindi fai così:

Code: Select all

nano /home/(tuahome)/0ad/build/premake/extern_libs4.lua
poi premi F6 e cerca "mt", rimuovi il suffisso "-mt" delle voci che trovi. A questo punto dai

Code: Select all

exit
cd 0ad/build/workspaces
./update-workspaces.sh -j3
cd gcc
make -j3
come prima, e tutto dovrebbe funzionare :D Per aprire il gioco vai nella cartella 0ad/binaries/system/ e clicca su pyrogenesis. Tutto dovrebbe essere funzionante. Se riscontri ancora problemi chiedi pure. :)
Image
Image
User avatar
Zievatron
Posts: 272
Joined: 31. Jan 2012, 15:13

Re: 0AD : Per Salix non si può avere?

Post by Zievatron »

Eseguito. Ma la compilazione si conclude ugualmente con una serie di messaggi di errore e di "riferimento non definito".

Code: Select all

==== Building ActorEditor (release) ====
Creating obj/ActorEditor_Release
ActorEditor.cpp
Linking ActorEditor
../../../binaries/system/libsimulation2.a(ICmpAIManager.o): nella funzione "path<std::basic_string<wchar_t> >":
/usr/local/include/boost/filesystem/path.hpp:139: riferimento non definito a "boost::filesystem::path::codecvt()"
../../../binaries/system/libsimulation2.a(ICmpAIManager.o): nella funzione "GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)":
/home/unknow/0ad/build/workspaces/gcc/../../../source/simulation2/components/ICmpAIManager.cpp:54: riferimento non definito a "boost::filesystem::path::begin() const"
../../../binaries/system/libsimulation2.a(ICmpAIManager.o): nella funzione "boost::filesystem::path::iterator::increment()":
/usr/local/include/boost/filesystem/path.hpp:590: riferimento non definito a "boost::filesystem::path::m_path_iterator_increment(boost::filesystem::path::iterator&)"
/usr/local/include/boost/filesystem/path.hpp:590: riferimento non definito a "boost::filesystem::path::m_path_iterator_increment(boost::filesystem::path::iterator&)"
../../../binaries/system/libsimulation2.a(ICmpAIManager.o): nella funzione "dispatch<std::basic_string<char> >":
/usr/local/include/boost/filesystem/path_traits.hpp:180: riferimento non definito a "boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::string&, std::codecvt<wchar_t, char, __mbstate_t> const&)"
../../../binaries/system/libengine.a(Filesystem.o): nella funzione "boost::filesystem::path::wstring() const":
/usr/local/include/boost/filesystem/path.hpp:386: riferimento non definito a "boost::filesystem::path::codecvt()"
/usr/local/include/boost/filesystem/path.hpp:392: riferimento non definito a "boost::filesystem::path_traits::convert(char const*, char const*, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, __mbstate_t> const&)"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "path<std::basic_string<wchar_t> >":
/usr/local/include/boost/filesystem/path.hpp:139: riferimento non definito a "boost::filesystem::path::codecvt()"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)":
/home/unknow/0ad/build/workspaces/gcc/../../../source/graphics/TextureManager.cpp:421: riferimento non definito a "boost::filesystem::path::begin() const"
/home/unknow/0ad/build/workspaces/gcc/../../../source/graphics/TextureManager.cpp:421: riferimento non definito a "boost::filesystem::path::end() const"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "boost::filesystem::path::iterator::increment()":
/usr/local/include/boost/filesystem/path.hpp:590: riferimento non definito a "boost::filesystem::path::m_path_iterator_increment(boost::filesystem::path::iterator&)"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "boost::filesystem::path::leaf() const":
/usr/local/include/boost/filesystem/path.hpp:483: riferimento non definito a "boost::filesystem::path::filename() const"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "path<std::basic_string<wchar_t> >":
/usr/local/include/boost/filesystem/path_traits.hpp:180: riferimento non definito a "boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::string&, std::codecvt<wchar_t, char, __mbstate_t> const&)"
collect2: error: ld returned 1 exit status
make[1]: *** [../../../binaries/system/pyrogenesis] Errore 1
make: *** [pyrogenesis] Errore 2
make: *** Attesa dei processi non terminati....
../../../binaries/system/libsimulation2.a(ICmpAIManager.o): nella funzione "path<std::basic_string<wchar_t> >":
/usr/local/include/boost/filesystem/path.hpp:139: riferimento non definito a "boost::filesystem::path::codecvt()"
../../../binaries/system/libsimulation2.a(ICmpAIManager.o): nella funzione "GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)":
/home/unknow/0ad/build/workspaces/gcc/../../../source/simulation2/components/ICmpAIManager.cpp:54: riferimento non definito a "boost::filesystem::path::begin() const"
../../../binaries/system/libsimulation2.a(ICmpAIManager.o): nella funzione "boost::filesystem::path::iterator::increment()":
/usr/local/include/boost/filesystem/path.hpp:590: riferimento non definito a "boost::filesystem::path::m_path_iterator_increment(boost::filesystem::path::iterator&)"
/usr/local/include/boost/filesystem/path.hpp:590: riferimento non definito a "boost::filesystem::path::m_path_iterator_increment(boost::filesystem::path::iterator&)"
../../../binaries/system/libsimulation2.a(ICmpAIManager.o): nella funzione "dispatch<std::basic_string<char> >":
/usr/local/include/boost/filesystem/path_traits.hpp:180: riferimento non definito a "boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::string&, std::codecvt<wchar_t, char, __mbstate_t> const&)"
../../../binaries/system/libengine.a(Filesystem.o): nella funzione "boost::filesystem::path::wstring() const":
/usr/local/include/boost/filesystem/path.hpp:386: riferimento non definito a "boost::filesystem::path::codecvt()"
/usr/local/include/boost/filesystem/path.hpp:392: riferimento non definito a "boost::filesystem::path_traits::convert(char const*, char const*, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, __mbstate_t> const&)"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "path<std::basic_string<wchar_t> >":
/usr/local/include/boost/filesystem/path.hpp:139: riferimento non definito a "boost::filesystem::path::codecvt()"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)":
/home/unknow/0ad/build/workspaces/gcc/../../../source/graphics/TextureManager.cpp:421: riferimento non definito a "boost::filesystem::path::begin() const"
/home/unknow/0ad/build/workspaces/gcc/../../../source/graphics/TextureManager.cpp:421: riferimento non definito a "boost::filesystem::path::end() const"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "boost::filesystem::path::iterator::increment()":
/usr/local/include/boost/filesystem/path.hpp:590: riferimento non definito a "boost::filesystem::path::m_path_iterator_increment(boost::filesystem::path::iterator&)"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "boost::filesystem::path::leaf() const":
/usr/local/include/boost/filesystem/path.hpp:483: riferimento non definito a "boost::filesystem::path::filename() const"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "path<std::basic_string<wchar_t> >":
/usr/local/include/boost/filesystem/path_traits.hpp:180: riferimento non definito a "boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::string&, std::codecvt<wchar_t, char, __mbstate_t> const&)"
collect2: error: ld returned 1 exit status
make[1]: *** [../../../binaries/system/test] Errore 1
make: *** [test] Errore 2
root[gcc]# 
EDIT:
Ho guardato ugualmente nella cartella 0ad/binaries/system/
E' piena di eseguibili DOS/Windows!!! :o
Cosa centrano con Linux? :?
Comunque, se provo a clickare su pyrogenesis.exe mi compare la finestra del gestore di archivi.
Last edited by Zievatron on 17. Feb 2013, 12:22, edited 1 time in total.
User avatar
Chaosphere
Posts: 39
Joined: 14. Jul 2012, 13:21

Re: 0AD : Per Salix non si può avere?

Post by Chaosphere »

Zievatron wrote:Eseguito. Ma la compilazione si conclude ugualmente con una serie di messaggi di errore e di "riferimento non definito".

Code: Select all

==== Building ActorEditor (release) ====
Creating obj/ActorEditor_Release
ActorEditor.cpp
Linking ActorEditor
../../../binaries/system/libsimulation2.a(ICmpAIManager.o): nella funzione "path<std::basic_string<wchar_t> >":
/usr/local/include/boost/filesystem/path.hpp:139: riferimento non definito a "boost::filesystem::path::codecvt()"
../../../binaries/system/libsimulation2.a(ICmpAIManager.o): nella funzione "GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)":
/home/unknow/0ad/build/workspaces/gcc/../../../source/simulation2/components/ICmpAIManager.cpp:54: riferimento non definito a "boost::filesystem::path::begin() const"
../../../binaries/system/libsimulation2.a(ICmpAIManager.o): nella funzione "boost::filesystem::path::iterator::increment()":
/usr/local/include/boost/filesystem/path.hpp:590: riferimento non definito a "boost::filesystem::path::m_path_iterator_increment(boost::filesystem::path::iterator&)"
/usr/local/include/boost/filesystem/path.hpp:590: riferimento non definito a "boost::filesystem::path::m_path_iterator_increment(boost::filesystem::path::iterator&)"
../../../binaries/system/libsimulation2.a(ICmpAIManager.o): nella funzione "dispatch<std::basic_string<char> >":
/usr/local/include/boost/filesystem/path_traits.hpp:180: riferimento non definito a "boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::string&, std::codecvt<wchar_t, char, __mbstate_t> const&)"
../../../binaries/system/libengine.a(Filesystem.o): nella funzione "boost::filesystem::path::wstring() const":
/usr/local/include/boost/filesystem/path.hpp:386: riferimento non definito a "boost::filesystem::path::codecvt()"
/usr/local/include/boost/filesystem/path.hpp:392: riferimento non definito a "boost::filesystem::path_traits::convert(char const*, char const*, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, __mbstate_t> const&)"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "path<std::basic_string<wchar_t> >":
/usr/local/include/boost/filesystem/path.hpp:139: riferimento non definito a "boost::filesystem::path::codecvt()"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)":
/home/unknow/0ad/build/workspaces/gcc/../../../source/graphics/TextureManager.cpp:421: riferimento non definito a "boost::filesystem::path::begin() const"
/home/unknow/0ad/build/workspaces/gcc/../../../source/graphics/TextureManager.cpp:421: riferimento non definito a "boost::filesystem::path::end() const"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "boost::filesystem::path::iterator::increment()":
/usr/local/include/boost/filesystem/path.hpp:590: riferimento non definito a "boost::filesystem::path::m_path_iterator_increment(boost::filesystem::path::iterator&)"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "boost::filesystem::path::leaf() const":
/usr/local/include/boost/filesystem/path.hpp:483: riferimento non definito a "boost::filesystem::path::filename() const"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "path<std::basic_string<wchar_t> >":
/usr/local/include/boost/filesystem/path_traits.hpp:180: riferimento non definito a "boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::string&, std::codecvt<wchar_t, char, __mbstate_t> const&)"
collect2: error: ld returned 1 exit status
make[1]: *** [../../../binaries/system/pyrogenesis] Errore 1
make: *** [pyrogenesis] Errore 2
make: *** Attesa dei processi non terminati....
../../../binaries/system/libsimulation2.a(ICmpAIManager.o): nella funzione "path<std::basic_string<wchar_t> >":
/usr/local/include/boost/filesystem/path.hpp:139: riferimento non definito a "boost::filesystem::path::codecvt()"
../../../binaries/system/libsimulation2.a(ICmpAIManager.o): nella funzione "GetAIsHelper::Callback(Path const&, FileInfo const&, unsigned long)":
/home/unknow/0ad/build/workspaces/gcc/../../../source/simulation2/components/ICmpAIManager.cpp:54: riferimento non definito a "boost::filesystem::path::begin() const"
../../../binaries/system/libsimulation2.a(ICmpAIManager.o): nella funzione "boost::filesystem::path::iterator::increment()":
/usr/local/include/boost/filesystem/path.hpp:590: riferimento non definito a "boost::filesystem::path::m_path_iterator_increment(boost::filesystem::path::iterator&)"
/usr/local/include/boost/filesystem/path.hpp:590: riferimento non definito a "boost::filesystem::path::m_path_iterator_increment(boost::filesystem::path::iterator&)"
../../../binaries/system/libsimulation2.a(ICmpAIManager.o): nella funzione "dispatch<std::basic_string<char> >":
/usr/local/include/boost/filesystem/path_traits.hpp:180: riferimento non definito a "boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::string&, std::codecvt<wchar_t, char, __mbstate_t> const&)"
../../../binaries/system/libengine.a(Filesystem.o): nella funzione "boost::filesystem::path::wstring() const":
/usr/local/include/boost/filesystem/path.hpp:386: riferimento non definito a "boost::filesystem::path::codecvt()"
/usr/local/include/boost/filesystem/path.hpp:392: riferimento non definito a "boost::filesystem::path_traits::convert(char const*, char const*, std::basic_string<wchar_t, std::char_traits<wchar_t>, std::allocator<wchar_t> >&, std::codecvt<wchar_t, char, __mbstate_t> const&)"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "path<std::basic_string<wchar_t> >":
/usr/local/include/boost/filesystem/path.hpp:139: riferimento non definito a "boost::filesystem::path::codecvt()"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "CTextureManagerImpl::GetConverterSettings(boost::shared_ptr<CTexture> const&)":
/home/unknow/0ad/build/workspaces/gcc/../../../source/graphics/TextureManager.cpp:421: riferimento non definito a "boost::filesystem::path::begin() const"
/home/unknow/0ad/build/workspaces/gcc/../../../source/graphics/TextureManager.cpp:421: riferimento non definito a "boost::filesystem::path::end() const"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "boost::filesystem::path::iterator::increment()":
/usr/local/include/boost/filesystem/path.hpp:590: riferimento non definito a "boost::filesystem::path::m_path_iterator_increment(boost::filesystem::path::iterator&)"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "boost::filesystem::path::leaf() const":
/usr/local/include/boost/filesystem/path.hpp:483: riferimento non definito a "boost::filesystem::path::filename() const"
../../../binaries/system/libgraphics.a(TextureManager.o): nella funzione "path<std::basic_string<wchar_t> >":
/usr/local/include/boost/filesystem/path_traits.hpp:180: riferimento non definito a "boost::filesystem::path_traits::convert(wchar_t const*, wchar_t const*, std::string&, std::codecvt<wchar_t, char, __mbstate_t> const&)"
collect2: error: ld returned 1 exit status
make[1]: *** [../../../binaries/system/test] Errore 1
make: *** [test] Errore 2
root[gcc]# 
Mmm, questo non so cosa potrebbe essere... Puoi per favore postare il file extern_libs4.lua che hai modificato?
Image
Image
User avatar
Zievatron
Posts: 272
Joined: 31. Jan 2012, 15:13

Re: 0AD : Per Salix non si può avere?

Post by Zievatron »

Eccolo.

Code: Select all

-- this file provides project_add_extern_libs, which takes care of the
-- dirty details of adding the libraries' include and lib paths.
--
-- TYPICAL TASK: add new library. Instructions:
-- 1) add a new extern_lib_defs entry
-- 2) add library name to extern_libs tables in premake.lua for all 'projects' that want to use it


-- directory in which OS-specific library subdirectories reside.
if os.is("macosx") then
	libraries_dir = rootdir.."/libraries/osx/"
elseif os.is("windows") then
	libraries_dir = rootdir.."/libraries/win32/"
else
	-- No Unix-specific libs yet (use source directory instead!)
end
-- directory for shared, bundled libraries
libraries_source_dir = rootdir.."/libraries/source/"

local function add_default_lib_paths(extern_lib)
	libdirs { libraries_dir .. extern_lib .. "/lib" }
end

local function add_source_lib_paths(extern_lib)
	libdirs { libraries_source_dir .. extern_lib .. "/lib" }
end

local function add_default_include_paths(extern_lib)
	includedirs { libraries_dir .. extern_lib .. "/include" }
end

local function add_source_include_paths(extern_lib)
	includedirs { libraries_source_dir .. extern_lib .. "/include" }
end


-- For unixes: add buildflags and linkflags using pkg-config or another similar command.
-- By default, pkg-config is used. Other commands can be passed as "alternative_cmd".
-- Running such commands at build/linktime does not work on all environments.
-- For those environments where it does not work, we already run it now.
-- Any better ideas?
local function pkgconfig_cflags(lib, alternative_cmd)
	local cmd_cflags = ""
	local result_cflags
	if not alternative_cmd then
		cmd_cflags = "pkg-config "..lib.." --cflags"
	else
		cmd_cflags = alternative_cmd
	end

	if _ACTION == "xcode3" or _ACTION == "xcode4" then
		result_cflags = string.gsub(os.capture(cmd_cflags), "\n", "")
		buildoptions { result_cflags }
	else
		buildoptions { "`"..cmd_cflags.."`" }
	end
end

local function pkgconfig_libs(lib, alternative_cmd)
	local cmd_libs = ""
	local result_libs
	if not alternative_cmd then
		cmd_libs = "pkg-config "..lib.." --libs"
	else
		cmd_libs = alternative_cmd
	end

	if _ACTION == "xcode3" or _ACTION == "xcode4" then
		-- The syntax of -Wl with the comma separated list doesn't work and -Wl apparently isn't needed in xcode.
		-- This is a hack, but it works...
		result_libs = string.gsub(os.capture(cmd_libs), "-Wl", "")
		result_libs = string.gsub(result_libs, ",", " ")
		result_libs = string.gsub(result_libs, "\n", "")
		linkoptions { result_libs }
	elseif _ACTION == "gmake" then	
		gnuexternals { "`"..cmd_libs.."`" }
	else
		linkoptions { "`"..cmd_libs.."`" }
	end
end

function os.capture(cmd)
	local f = io.popen(cmd, 'r')
	local s = f:read('*a')
	return s
end

local function add_delayload(name, suffix, def)

	if def["no_delayload"] then
		return
	end

	-- currently only supported by VC; nothing to do on other platforms.
	if not os.is("windows") then
		return
	end

	-- no extra debug version; use same library in all configs
	if suffix == "" then
		linkoptions { "/DELAYLOAD:"..name..".dll" }
	-- extra debug version available; use in debug config
	else
		local dbg_cmd = "/DELAYLOAD:" .. name .. suffix .. ".dll"
		local cmd     = "/DELAYLOAD:" .. name .. ".dll"

		configuration "Debug"
			linkoptions { dbg_cmd }
		configuration "Release"
			linkoptions { cmd }
		configuration { }
	end

end

local function add_default_links(def)

	-- careful: make sure to only use *_names when on the correct platform.
	local names = {}
	if os.is("windows") then
		if def.win_names then
			names = def.win_names
		end
	elseif _OPTIONS["android"] and def.android_names then
		names = def.android_names
	elseif os.is("linux") and def.linux_names then
		names = def.linux_names
	elseif os.is("macosx") and def.osx_names then
		names = def.osx_names
	elseif os.is("bsd") and def.bsd_names then
		names = def.bsd_names
	elseif def.unix_names then
		names = def.unix_names
	end

	local suffix = "d"
	-- library is overriding default suffix (typically "" to indicate there is none)
	if def["dbg_suffix"] then
		suffix = def["dbg_suffix"]
	end
	-- non-Windows doesn't have the distinction of debug vs. release libraries
	-- (to be more specific, they do, but the two are binary compatible;
	-- usually only one type - debug or release - is installed at a time).
	if not os.is("windows") then
		suffix = ""
	end

	-- OS X "Frameworks" need to be added in a special way to the link
	-- i.e. by linkoptions += "-framework ..."
	if os.is("macosx") and def.osx_frameworks then
		for i,name in pairs(def.osx_frameworks) do
			linkoptions { "-framework " .. name }
		end
	else
		for i,name in pairs(names) do
			configuration "Debug"
				links { name .. suffix }
			configuration "Release"
				links { name }
			configuration { }

			add_delayload(name, suffix, def)
		end
	end
end

-- Library definitions
-- In a perfect world, libraries would have a common installation template,
-- i.e. location of include directory, naming convention for .lib, etc.
-- this table provides a means of working around each library's differences.
--
-- The basic approach is defining two functions per library:
--
-- 1. compile_settings
-- This function should set all settings requred during the compile-phase like
-- includedirs, defines etc...
--
-- 2. link_settings
-- This function should set all settings required during the link-phase like
-- libdirs, linkflag etc...
--
-- The main reason for separating those settings is different linking behaviour
-- on osx and xcode. For more details, read the comment in project_add_extern_libs.
--
-- There are some helper functions for the most common tasks. You should use them
-- if they can be used in your situation to make the definitions more consistent and
-- use their default beviours as a guideline.
--
--
-- add_default_lib_paths(extern_lib)
--      Description: Add '<libraries root>/<libraryname>/lib'to the libpaths
--      Parameters:
--          * extern_lib: <libraryname> to be used in the libpath.
--
-- add_default_include_paths(extern_lib)
--      Description: Add '<libraries root>/<libraryname>/include' to the includepaths
--      Parameters:
--          * extern_lib: <libraryname> to be used in the libpath.
--
-- add_default_links
--		Description: Adds links to libraries and configures delayloading.
-- 		If the *_names parameter for a plattform is missing, no linking will be done
-- 		on that plattform.
--		The default assumptions are:
--		* debug import library and DLL are distinguished with a "d" suffix
-- 		* the library should be marked for delay-loading.
--		Parameters:
--      * win_names: table of import library / DLL names (no extension) when
--   	  running on Windows.
--      * unix_names: as above; shared object names when running on non-Windows.
--      * osx_names: as above; for OS X specifically (overrides unix_names if both are
--        specified)
--      * bsd_names: as above; for BSD specifically (overrides unix_names if both are
--        specified)
--      * linux_names: ditto for Linux (overrides unix_names if both given)
--      * dbg_suffix: changes the debug suffix from the above default.
--        can be "" to indicate the library doesn't have a debug build;
--        in that case, the same library (without suffix) is used in
--        all build configurations.
--      * no_delayload: indicate the library is not to be delay-loaded.
--        this is necessary for some libraries that do not support it,
--        e.g. Xerces (which is so stupid as to export variables).

extern_lib_defs = {
	boost = {
		compile_settings = function()
			if os.is("windows") or os.is("macosx") then
				add_default_include_paths("boost")
			end
			if os.getversion().description == "OpenBSD" then
				includedirs { "/usr/local/include" }
			end
		end,
		link_settings = function()
			if os.is("windows") or os.is("macosx") then
				add_default_lib_paths("boost")
			end
			add_default_links({
				-- The following are not strictly link dependencies on all systems, but
				-- are included for compatibility with different versions of Boost
				android_names = { "boost_filesystem-gcc", "boost_system-gcc" },
				unix_names = { "boost_filesystem", "boost_system" },
				bsd_names = { "boost_filesystem", "boost_system" },
			})
		end,
	},
	boost_signals = {
		link_settings = function()
			add_default_links({
				android_names = { "boost_signals-gcc" },
				unix_names = { "boost_signals" },
				bsd_names = { "boost_signals" },
			})
		end,
	},
	cryptopp = {
		compile_settings = function()
			if os.is("windows") then
				add_default_include_paths("cryptopp")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				add_default_lib_paths("cryptopp")
			end
			add_default_links({
				win_names  = { "cryptopp" },
				unix_names = { "cryptopp" },
			})
		end,
	},
	cxxtest = {
		compile_settings = function()
			add_source_include_paths("cxxtest")
		end,
		link_settings = function()
			add_source_lib_paths("cxxtest")
		end,
	},
	comsuppw = {
		link_settings = function()
			add_default_links({
				win_names = { "comsuppw" },
				dbg_suffix = "d",
				no_delayload = 1,
			})
		end,
	},
	enet = {
		compile_settings = function()
			if not _OPTIONS["with-system-enet"] then
				add_source_include_paths("enet")
			end
		end,
		link_settings = function()
			if not _OPTIONS["with-system-enet"] then
				add_source_lib_paths("enet")
			end
			add_default_links({
				win_names  = { "enet" },
				unix_names = { "enet" },
			})
		end,
	},
	fcollada = {
		compile_settings = function()
			add_source_include_paths("fcollada")
		end,
		link_settings = function()
			add_source_lib_paths("fcollada")
			if os.is("windows") then
				configuration "Debug"
					links { "FColladaD" }
				configuration "Release"
					links { "FCollada" }
			 	configuration { }
			else
				configuration "Debug"
					links { "FColladaSD" }
				configuration "Release"
					links { "FColladaSR" }
				configuration { }
			end
		end,
	},
	ffmpeg = {
		compile_settings = function()
			if os.is("windows") then
				add_default_include_paths("ffmpeg")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				add_default_lib_paths("ffmpeg")
			end
			add_default_links({
				win_names = { "avcodec-51", "avformat-51", "avutil-49", "swscale-0" },
				unix_names = { "avcodec", "avformat", "avutil" },
				dbg_suffix = "",
			})
		end,
	},
	libcurl = {
		compile_settings = function()
			if os.is("windows") then
				add_default_include_paths("libcurl")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				add_default_lib_paths("libcurl")
			end
			add_default_links({
				win_names  = { "libcurl" },
				unix_names = { "curl" },
			})
		end,
	},
	libjpg = {
		compile_settings = function()
			if os.is("windows") or os.is("macosx") then
				add_default_include_paths("libjpg")
			end
		end,
		link_settings = function()
			if os.is("windows") or os.is("macosx") then
				add_default_lib_paths("libjpg")
			end
			add_default_links({
				win_names  = { "jpeg-6b" },
				unix_names = { "jpeg" },
			})
		end,
	},
	libpng = {
		compile_settings = function()
			if os.is("windows") or os.is("macosx") then
				add_default_include_paths("libpng")
			end
			if os.getversion().description == "OpenBSD" then
				includedirs { "/usr/local/include/libpng" }
			end
		end,
		link_settings = function()
			if os.is("windows") or os.is("macosx") then
				add_default_lib_paths("libpng")
			end
			add_default_links({
				win_names  = { "libpng15" },
				unix_names = { "png" },
				-- Otherwise ld will sometimes pull in ancient 1.2 from the SDK, which breaks the build :/
				-- TODO: Figure out why that happens
				osx_names = { "png15" },
			})
		end,
	},
	libxml2 = {
		compile_settings = function()
			if os.is("windows") then
				add_default_include_paths("libxml2")
			elseif os.is("macosx") then
				-- Support XML2_CONFIG for overriding for the default PATH-based xml2-config
				xml2_config_path = os.getenv("XML2_CONFIG")
				if not xml2_config_path then
					xml2_config_path = "xml2-config"
				end

				-- use xml2-config instead of pkg-config on OS X
				pkgconfig_cflags(nil, xml2_config_path.." --cflags")
				-- libxml2 needs _REENTRANT or __MT__ for thread support;
				-- OS X doesn't get either set by default, so do it manually
				defines { "_REENTRANT" }
			else
				pkgconfig_cflags("libxml-2.0")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				add_default_lib_paths("libxml2")
				configuration "Debug"
					links { "libxml2" }
				configuration "Release"
					links { "libxml2" }
				configuration { }
			elseif os.is("macosx") then
				xml2_config_path = os.getenv("XML2_CONFIG")
				if not xml2_config_path then
					xml2_config_path = "xml2-config"
				end
				pkgconfig_libs(nil, xml2_config_path.." --libs")
			else
				pkgconfig_libs("libxml-2.0")
			end
		end,
	},
	nvtt = {
		compile_settings = function()
			if not _OPTIONS["with-system-nvtt"] then
				add_source_include_paths("nvtt")
			end
			defines { "NVTT_SHARED=1" }
		end,
		link_settings = function()
			if not _OPTIONS["with-system-nvtt"] then
				add_source_lib_paths("nvtt")
			end
			add_default_links({
				win_names  = { "nvtt" },
				unix_names = { "nvcore", "nvmath", "nvimage", "nvtt" },
				osx_names = { "nvcore", "nvmath", "nvimage", "nvtt", "squish" },
				dbg_suffix = "", -- for performance we always use the release-mode version
			})
		end,
	},
	openal = {
		compile_settings = function()
			if os.is("windows") then
				add_default_include_paths("openal")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				add_default_lib_paths("openal")
			end
			add_default_links({
				win_names  = { "openal32" },
				unix_names = { "openal" },
				osx_frameworks = { "OpenAL" },
				dbg_suffix = "",
				no_delayload = 1, -- delayload seems to cause errors on startup
			})
		end,
	},
	opengl = {
		compile_settings = function()
			if os.is("windows") then
				add_default_include_paths("opengl")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				add_default_lib_paths("opengl")
			end
			if _OPTIONS["gles"] then
				add_default_links({
					unix_names = { "GLESv2" },
					dbg_suffix = "",
				})
			else
				add_default_links({
					win_names  = { "opengl32", "gdi32" },
					unix_names = { "GL" },
					osx_frameworks = { "OpenGL" },
					dbg_suffix = "",
					no_delayload = 1, -- delayload seems to cause errors on startup
				})
			end
		end,
	},
	sdl = {
		compile_settings = function()
			if os.is("windows") then
				includedirs { libraries_dir .. "sdl/include/SDL" }
			elseif not _OPTIONS["android"] then
				-- Support SDL_CONFIG for overriding for the default PATH-based sdl-config
				sdl_config_path = os.getenv("SDL_CONFIG")
				if not sdl_config_path then
					sdl_config_path = "sdl-config"
				end

				-- "pkg-config sdl --libs" appears to include both static and dynamic libs
				-- when on MacPorts, which is bad, so use sdl-config instead
				pkgconfig_cflags(nil, sdl_config_path.." --cflags")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				add_default_lib_paths("sdl")
			elseif not _OPTIONS["android"] then
				sdl_config_path = os.getenv("SDL_CONFIG")
				if not sdl_config_path then
					sdl_config_path = "sdl-config"
				end
				pkgconfig_libs(nil, sdl_config_path.." --libs")
			end
		end,
	},
	spidermonkey = {
		compile_settings = function()
			if _OPTIONS["with-system-mozjs185"] then
				if not _OPTIONS["android"] then
					pkgconfig_cflags("mozjs185")
				end
				defines { "WITH_SYSTEM_MOZJS185" }
			else
				if os.is("windows") then
					include_dir = "include-win32"
				elseif os.is("macosx") then
					include_dir = "include"
				else
					include_dir = "include-unix"
				end
				configuration "Debug"
					includedirs { libraries_source_dir.."spidermonkey/"..include_dir }
				configuration "Release"
					includedirs { libraries_source_dir.."spidermonkey/"..include_dir }
				configuration { }
			end
		end,
		link_settings = function()
			if _OPTIONS["with-system-mozjs185"] then
				if _OPTIONS["android"] then
					links { "mozjs185-1.0" }
				else
					pkgconfig_libs("mozjs185")
				end
			else
				configuration "Debug"
					links { "mozjs185-ps-debug" }
				configuration "Release"
					links { "mozjs185-ps-release" }
				configuration { }
				add_source_lib_paths("spidermonkey")
			end
		end,
	},
	valgrind = {
		compile_settings = function()
			add_source_include_paths("valgrind")
		end,
		link_settings = function()
			add_source_lib_paths("valgrind")
		end,
	},
	vorbis = {
		compile_settings = function()
			if os.is("windows") or os.is("macosx") then
				add_default_include_paths("vorbis")
			end
		end,
		link_settings = function()
			if os.is("windows") or os.is("macosx") then
				add_default_lib_paths("vorbis")
			end
			-- TODO: We need to force linking with these as currently
			-- they need to be loaded explicitly on execution
			if os.getversion().description == "OpenBSD" then
				add_default_links({
					unix_names = { "ogg",
						"vorbis" },
				})
			end
			add_default_links({
				win_names  = { "vorbisfile" },
				unix_names = { "vorbisfile" },
				osx_names = { "vorbis", "vorbisenc", "vorbisfile", "ogg" },
				dbg_suffix = "_d",
			})
		end,
	},
	wxwidgets = {
		compile_settings = function()
			if os.is("windows") then
				includedirs { libraries_dir.."wxwidgets/include/msvc" }
				add_default_include_paths("wxwidgets")
			else

				-- Support WX_CONFIG for overriding for the default PATH-based wx-config
				wx_config_path = os.getenv("WX_CONFIG")
				if not wx_config_path then
					wx_config_path = "wx-config"
				end

				pkgconfig_cflags(nil, wx_config_path.." --unicode=yes --cxxflags")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				libdirs { libraries_dir.."wxwidgets/lib/vc_lib" }
				configuration "Debug"
					links { "wxmsw28ud_gl" }
				configuration "Release"
					links { "wxmsw28u_gl" }
				configuration { }
			else
				wx_config_path = os.getenv("WX_CONFIG")
				if not wx_config_path then
					wx_config_path = "wx-config"
				end
				pkgconfig_libs(nil, wx_config_path.." --unicode=yes --libs std,gl")
			end
		end,
	},
	x11 = {
		link_settings = function()
			add_default_links({
				win_names  = { },
				unix_names = { "X11" },
			})
		end,
	},
	xcursor = {
		link_settings = function()
			add_default_links({
				unix_names = { "Xcursor" },
			})
		end,
	},
	zlib = {
		compile_settings = function()
			if os.is("windows") then
				add_default_include_paths("zlib")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				add_default_lib_paths("zlib")
			end
			add_default_links({
				win_names  = { "zlib1" },
				unix_names = { "z" },
			})
		end,
	},
}


-- add a set of external libraries to the project; takes care of
-- include / lib path and linking against the import library.
-- extern_libs: table of library names [string]
-- target_type: String defining the projects kind [string]
function project_add_extern_libs(extern_libs, target_type)

	for i,extern_lib in pairs(extern_libs) do
		local def = extern_lib_defs[extern_lib]
		assert(def, "external library " .. extern_lib .. " not defined")

		if def.compile_settings then
			def.compile_settings()
		end

		-- Linking to external libraries will only be done in the main executable and not in the
		-- static libraries. Premake would silently skip linking into static libraries for some
		-- actions anyway (e.g. vs2010).
		-- On osx using xcode, if this linking would be defined in the static libraries, it would fail to
		-- link if only dylibs are available. If both *.a and *.dylib are available, it would link statically.
		-- I couldn't find any problems with that approach.
		if target_type ~= "StaticLib" and def.link_settings then
			def.link_settings()
		end
	end
end
E per il resto? (Avevo editato il precedente messaggio mentre postavi il tuo).
User avatar
Chaosphere
Posts: 39
Joined: 14. Jul 2012, 13:21

Re: 0AD : Per Salix non si può avere?

Post by Chaosphere »

Zievatron wrote:Eccolo.

Code: Select all

-- this file provides project_add_extern_libs, which takes care of the
-- dirty details of adding the libraries' include and lib paths.
--
-- TYPICAL TASK: add new library. Instructions:
-- 1) add a new extern_lib_defs entry
-- 2) add library name to extern_libs tables in premake.lua for all 'projects' that want to use it


-- directory in which OS-specific library subdirectories reside.
if os.is("macosx") then
	libraries_dir = rootdir.."/libraries/osx/"
elseif os.is("windows") then
	libraries_dir = rootdir.."/libraries/win32/"
else
	-- No Unix-specific libs yet (use source directory instead!)
end
-- directory for shared, bundled libraries
libraries_source_dir = rootdir.."/libraries/source/"

local function add_default_lib_paths(extern_lib)
	libdirs { libraries_dir .. extern_lib .. "/lib" }
end

local function add_source_lib_paths(extern_lib)
	libdirs { libraries_source_dir .. extern_lib .. "/lib" }
end

local function add_default_include_paths(extern_lib)
	includedirs { libraries_dir .. extern_lib .. "/include" }
end

local function add_source_include_paths(extern_lib)
	includedirs { libraries_source_dir .. extern_lib .. "/include" }
end


-- For unixes: add buildflags and linkflags using pkg-config or another similar command.
-- By default, pkg-config is used. Other commands can be passed as "alternative_cmd".
-- Running such commands at build/linktime does not work on all environments.
-- For those environments where it does not work, we already run it now.
-- Any better ideas?
local function pkgconfig_cflags(lib, alternative_cmd)
	local cmd_cflags = ""
	local result_cflags
	if not alternative_cmd then
		cmd_cflags = "pkg-config "..lib.." --cflags"
	else
		cmd_cflags = alternative_cmd
	end

	if _ACTION == "xcode3" or _ACTION == "xcode4" then
		result_cflags = string.gsub(os.capture(cmd_cflags), "\n", "")
		buildoptions { result_cflags }
	else
		buildoptions { "`"..cmd_cflags.."`" }
	end
end

local function pkgconfig_libs(lib, alternative_cmd)
	local cmd_libs = ""
	local result_libs
	if not alternative_cmd then
		cmd_libs = "pkg-config "..lib.." --libs"
	else
		cmd_libs = alternative_cmd
	end

	if _ACTION == "xcode3" or _ACTION == "xcode4" then
		-- The syntax of -Wl with the comma separated list doesn't work and -Wl apparently isn't needed in xcode.
		-- This is a hack, but it works...
		result_libs = string.gsub(os.capture(cmd_libs), "-Wl", "")
		result_libs = string.gsub(result_libs, ",", " ")
		result_libs = string.gsub(result_libs, "\n", "")
		linkoptions { result_libs }
	elseif _ACTION == "gmake" then	
		gnuexternals { "`"..cmd_libs.."`" }
	else
		linkoptions { "`"..cmd_libs.."`" }
	end
end

function os.capture(cmd)
	local f = io.popen(cmd, 'r')
	local s = f:read('*a')
	return s
end

local function add_delayload(name, suffix, def)

	if def["no_delayload"] then
		return
	end

	-- currently only supported by VC; nothing to do on other platforms.
	if not os.is("windows") then
		return
	end

	-- no extra debug version; use same library in all configs
	if suffix == "" then
		linkoptions { "/DELAYLOAD:"..name..".dll" }
	-- extra debug version available; use in debug config
	else
		local dbg_cmd = "/DELAYLOAD:" .. name .. suffix .. ".dll"
		local cmd     = "/DELAYLOAD:" .. name .. ".dll"

		configuration "Debug"
			linkoptions { dbg_cmd }
		configuration "Release"
			linkoptions { cmd }
		configuration { }
	end

end

local function add_default_links(def)

	-- careful: make sure to only use *_names when on the correct platform.
	local names = {}
	if os.is("windows") then
		if def.win_names then
			names = def.win_names
		end
	elseif _OPTIONS["android"] and def.android_names then
		names = def.android_names
	elseif os.is("linux") and def.linux_names then
		names = def.linux_names
	elseif os.is("macosx") and def.osx_names then
		names = def.osx_names
	elseif os.is("bsd") and def.bsd_names then
		names = def.bsd_names
	elseif def.unix_names then
		names = def.unix_names
	end

	local suffix = "d"
	-- library is overriding default suffix (typically "" to indicate there is none)
	if def["dbg_suffix"] then
		suffix = def["dbg_suffix"]
	end
	-- non-Windows doesn't have the distinction of debug vs. release libraries
	-- (to be more specific, they do, but the two are binary compatible;
	-- usually only one type - debug or release - is installed at a time).
	if not os.is("windows") then
		suffix = ""
	end

	-- OS X "Frameworks" need to be added in a special way to the link
	-- i.e. by linkoptions += "-framework ..."
	if os.is("macosx") and def.osx_frameworks then
		for i,name in pairs(def.osx_frameworks) do
			linkoptions { "-framework " .. name }
		end
	else
		for i,name in pairs(names) do
			configuration "Debug"
				links { name .. suffix }
			configuration "Release"
				links { name }
			configuration { }

			add_delayload(name, suffix, def)
		end
	end
end

-- Library definitions
-- In a perfect world, libraries would have a common installation template,
-- i.e. location of include directory, naming convention for .lib, etc.
-- this table provides a means of working around each library's differences.
--
-- The basic approach is defining two functions per library:
--
-- 1. compile_settings
-- This function should set all settings requred during the compile-phase like
-- includedirs, defines etc...
--
-- 2. link_settings
-- This function should set all settings required during the link-phase like
-- libdirs, linkflag etc...
--
-- The main reason for separating those settings is different linking behaviour
-- on osx and xcode. For more details, read the comment in project_add_extern_libs.
--
-- There are some helper functions for the most common tasks. You should use them
-- if they can be used in your situation to make the definitions more consistent and
-- use their default beviours as a guideline.
--
--
-- add_default_lib_paths(extern_lib)
--      Description: Add '<libraries root>/<libraryname>/lib'to the libpaths
--      Parameters:
--          * extern_lib: <libraryname> to be used in the libpath.
--
-- add_default_include_paths(extern_lib)
--      Description: Add '<libraries root>/<libraryname>/include' to the includepaths
--      Parameters:
--          * extern_lib: <libraryname> to be used in the libpath.
--
-- add_default_links
--		Description: Adds links to libraries and configures delayloading.
-- 		If the *_names parameter for a plattform is missing, no linking will be done
-- 		on that plattform.
--		The default assumptions are:
--		* debug import library and DLL are distinguished with a "d" suffix
-- 		* the library should be marked for delay-loading.
--		Parameters:
--      * win_names: table of import library / DLL names (no extension) when
--   	  running on Windows.
--      * unix_names: as above; shared object names when running on non-Windows.
--      * osx_names: as above; for OS X specifically (overrides unix_names if both are
--        specified)
--      * bsd_names: as above; for BSD specifically (overrides unix_names if both are
--        specified)
--      * linux_names: ditto for Linux (overrides unix_names if both given)
--      * dbg_suffix: changes the debug suffix from the above default.
--        can be "" to indicate the library doesn't have a debug build;
--        in that case, the same library (without suffix) is used in
--        all build configurations.
--      * no_delayload: indicate the library is not to be delay-loaded.
--        this is necessary for some libraries that do not support it,
--        e.g. Xerces (which is so stupid as to export variables).

extern_lib_defs = {
	boost = {
		compile_settings = function()
			if os.is("windows") or os.is("macosx") then
				add_default_include_paths("boost")
			end
			if os.getversion().description == "OpenBSD" then
				includedirs { "/usr/local/include" }
			end
		end,
		link_settings = function()
			if os.is("windows") or os.is("macosx") then
				add_default_lib_paths("boost")
			end
			add_default_links({
				-- The following are not strictly link dependencies on all systems, but
				-- are included for compatibility with different versions of Boost
				android_names = { "boost_filesystem-gcc", "boost_system-gcc" },
				unix_names = { "boost_filesystem", "boost_system" },
				bsd_names = { "boost_filesystem", "boost_system" },
			})
		end,
	},
	boost_signals = {
		link_settings = function()
			add_default_links({
				android_names = { "boost_signals-gcc" },
				unix_names = { "boost_signals" },
				bsd_names = { "boost_signals" },
			})
		end,
	},
	cryptopp = {
		compile_settings = function()
			if os.is("windows") then
				add_default_include_paths("cryptopp")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				add_default_lib_paths("cryptopp")
			end
			add_default_links({
				win_names  = { "cryptopp" },
				unix_names = { "cryptopp" },
			})
		end,
	},
	cxxtest = {
		compile_settings = function()
			add_source_include_paths("cxxtest")
		end,
		link_settings = function()
			add_source_lib_paths("cxxtest")
		end,
	},
	comsuppw = {
		link_settings = function()
			add_default_links({
				win_names = { "comsuppw" },
				dbg_suffix = "d",
				no_delayload = 1,
			})
		end,
	},
	enet = {
		compile_settings = function()
			if not _OPTIONS["with-system-enet"] then
				add_source_include_paths("enet")
			end
		end,
		link_settings = function()
			if not _OPTIONS["with-system-enet"] then
				add_source_lib_paths("enet")
			end
			add_default_links({
				win_names  = { "enet" },
				unix_names = { "enet" },
			})
		end,
	},
	fcollada = {
		compile_settings = function()
			add_source_include_paths("fcollada")
		end,
		link_settings = function()
			add_source_lib_paths("fcollada")
			if os.is("windows") then
				configuration "Debug"
					links { "FColladaD" }
				configuration "Release"
					links { "FCollada" }
			 	configuration { }
			else
				configuration "Debug"
					links { "FColladaSD" }
				configuration "Release"
					links { "FColladaSR" }
				configuration { }
			end
		end,
	},
	ffmpeg = {
		compile_settings = function()
			if os.is("windows") then
				add_default_include_paths("ffmpeg")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				add_default_lib_paths("ffmpeg")
			end
			add_default_links({
				win_names = { "avcodec-51", "avformat-51", "avutil-49", "swscale-0" },
				unix_names = { "avcodec", "avformat", "avutil" },
				dbg_suffix = "",
			})
		end,
	},
	libcurl = {
		compile_settings = function()
			if os.is("windows") then
				add_default_include_paths("libcurl")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				add_default_lib_paths("libcurl")
			end
			add_default_links({
				win_names  = { "libcurl" },
				unix_names = { "curl" },
			})
		end,
	},
	libjpg = {
		compile_settings = function()
			if os.is("windows") or os.is("macosx") then
				add_default_include_paths("libjpg")
			end
		end,
		link_settings = function()
			if os.is("windows") or os.is("macosx") then
				add_default_lib_paths("libjpg")
			end
			add_default_links({
				win_names  = { "jpeg-6b" },
				unix_names = { "jpeg" },
			})
		end,
	},
	libpng = {
		compile_settings = function()
			if os.is("windows") or os.is("macosx") then
				add_default_include_paths("libpng")
			end
			if os.getversion().description == "OpenBSD" then
				includedirs { "/usr/local/include/libpng" }
			end
		end,
		link_settings = function()
			if os.is("windows") or os.is("macosx") then
				add_default_lib_paths("libpng")
			end
			add_default_links({
				win_names  = { "libpng15" },
				unix_names = { "png" },
				-- Otherwise ld will sometimes pull in ancient 1.2 from the SDK, which breaks the build :/
				-- TODO: Figure out why that happens
				osx_names = { "png15" },
			})
		end,
	},
	libxml2 = {
		compile_settings = function()
			if os.is("windows") then
				add_default_include_paths("libxml2")
			elseif os.is("macosx") then
				-- Support XML2_CONFIG for overriding for the default PATH-based xml2-config
				xml2_config_path = os.getenv("XML2_CONFIG")
				if not xml2_config_path then
					xml2_config_path = "xml2-config"
				end

				-- use xml2-config instead of pkg-config on OS X
				pkgconfig_cflags(nil, xml2_config_path.." --cflags")
				-- libxml2 needs _REENTRANT or __MT__ for thread support;
				-- OS X doesn't get either set by default, so do it manually
				defines { "_REENTRANT" }
			else
				pkgconfig_cflags("libxml-2.0")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				add_default_lib_paths("libxml2")
				configuration "Debug"
					links { "libxml2" }
				configuration "Release"
					links { "libxml2" }
				configuration { }
			elseif os.is("macosx") then
				xml2_config_path = os.getenv("XML2_CONFIG")
				if not xml2_config_path then
					xml2_config_path = "xml2-config"
				end
				pkgconfig_libs(nil, xml2_config_path.." --libs")
			else
				pkgconfig_libs("libxml-2.0")
			end
		end,
	},
	nvtt = {
		compile_settings = function()
			if not _OPTIONS["with-system-nvtt"] then
				add_source_include_paths("nvtt")
			end
			defines { "NVTT_SHARED=1" }
		end,
		link_settings = function()
			if not _OPTIONS["with-system-nvtt"] then
				add_source_lib_paths("nvtt")
			end
			add_default_links({
				win_names  = { "nvtt" },
				unix_names = { "nvcore", "nvmath", "nvimage", "nvtt" },
				osx_names = { "nvcore", "nvmath", "nvimage", "nvtt", "squish" },
				dbg_suffix = "", -- for performance we always use the release-mode version
			})
		end,
	},
	openal = {
		compile_settings = function()
			if os.is("windows") then
				add_default_include_paths("openal")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				add_default_lib_paths("openal")
			end
			add_default_links({
				win_names  = { "openal32" },
				unix_names = { "openal" },
				osx_frameworks = { "OpenAL" },
				dbg_suffix = "",
				no_delayload = 1, -- delayload seems to cause errors on startup
			})
		end,
	},
	opengl = {
		compile_settings = function()
			if os.is("windows") then
				add_default_include_paths("opengl")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				add_default_lib_paths("opengl")
			end
			if _OPTIONS["gles"] then
				add_default_links({
					unix_names = { "GLESv2" },
					dbg_suffix = "",
				})
			else
				add_default_links({
					win_names  = { "opengl32", "gdi32" },
					unix_names = { "GL" },
					osx_frameworks = { "OpenGL" },
					dbg_suffix = "",
					no_delayload = 1, -- delayload seems to cause errors on startup
				})
			end
		end,
	},
	sdl = {
		compile_settings = function()
			if os.is("windows") then
				includedirs { libraries_dir .. "sdl/include/SDL" }
			elseif not _OPTIONS["android"] then
				-- Support SDL_CONFIG for overriding for the default PATH-based sdl-config
				sdl_config_path = os.getenv("SDL_CONFIG")
				if not sdl_config_path then
					sdl_config_path = "sdl-config"
				end

				-- "pkg-config sdl --libs" appears to include both static and dynamic libs
				-- when on MacPorts, which is bad, so use sdl-config instead
				pkgconfig_cflags(nil, sdl_config_path.." --cflags")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				add_default_lib_paths("sdl")
			elseif not _OPTIONS["android"] then
				sdl_config_path = os.getenv("SDL_CONFIG")
				if not sdl_config_path then
					sdl_config_path = "sdl-config"
				end
				pkgconfig_libs(nil, sdl_config_path.." --libs")
			end
		end,
	},
	spidermonkey = {
		compile_settings = function()
			if _OPTIONS["with-system-mozjs185"] then
				if not _OPTIONS["android"] then
					pkgconfig_cflags("mozjs185")
				end
				defines { "WITH_SYSTEM_MOZJS185" }
			else
				if os.is("windows") then
					include_dir = "include-win32"
				elseif os.is("macosx") then
					include_dir = "include"
				else
					include_dir = "include-unix"
				end
				configuration "Debug"
					includedirs { libraries_source_dir.."spidermonkey/"..include_dir }
				configuration "Release"
					includedirs { libraries_source_dir.."spidermonkey/"..include_dir }
				configuration { }
			end
		end,
		link_settings = function()
			if _OPTIONS["with-system-mozjs185"] then
				if _OPTIONS["android"] then
					links { "mozjs185-1.0" }
				else
					pkgconfig_libs("mozjs185")
				end
			else
				configuration "Debug"
					links { "mozjs185-ps-debug" }
				configuration "Release"
					links { "mozjs185-ps-release" }
				configuration { }
				add_source_lib_paths("spidermonkey")
			end
		end,
	},
	valgrind = {
		compile_settings = function()
			add_source_include_paths("valgrind")
		end,
		link_settings = function()
			add_source_lib_paths("valgrind")
		end,
	},
	vorbis = {
		compile_settings = function()
			if os.is("windows") or os.is("macosx") then
				add_default_include_paths("vorbis")
			end
		end,
		link_settings = function()
			if os.is("windows") or os.is("macosx") then
				add_default_lib_paths("vorbis")
			end
			-- TODO: We need to force linking with these as currently
			-- they need to be loaded explicitly on execution
			if os.getversion().description == "OpenBSD" then
				add_default_links({
					unix_names = { "ogg",
						"vorbis" },
				})
			end
			add_default_links({
				win_names  = { "vorbisfile" },
				unix_names = { "vorbisfile" },
				osx_names = { "vorbis", "vorbisenc", "vorbisfile", "ogg" },
				dbg_suffix = "_d",
			})
		end,
	},
	wxwidgets = {
		compile_settings = function()
			if os.is("windows") then
				includedirs { libraries_dir.."wxwidgets/include/msvc" }
				add_default_include_paths("wxwidgets")
			else

				-- Support WX_CONFIG for overriding for the default PATH-based wx-config
				wx_config_path = os.getenv("WX_CONFIG")
				if not wx_config_path then
					wx_config_path = "wx-config"
				end

				pkgconfig_cflags(nil, wx_config_path.." --unicode=yes --cxxflags")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				libdirs { libraries_dir.."wxwidgets/lib/vc_lib" }
				configuration "Debug"
					links { "wxmsw28ud_gl" }
				configuration "Release"
					links { "wxmsw28u_gl" }
				configuration { }
			else
				wx_config_path = os.getenv("WX_CONFIG")
				if not wx_config_path then
					wx_config_path = "wx-config"
				end
				pkgconfig_libs(nil, wx_config_path.." --unicode=yes --libs std,gl")
			end
		end,
	},
	x11 = {
		link_settings = function()
			add_default_links({
				win_names  = { },
				unix_names = { "X11" },
			})
		end,
	},
	xcursor = {
		link_settings = function()
			add_default_links({
				unix_names = { "Xcursor" },
			})
		end,
	},
	zlib = {
		compile_settings = function()
			if os.is("windows") then
				add_default_include_paths("zlib")
			end
		end,
		link_settings = function()
			if os.is("windows") then
				add_default_lib_paths("zlib")
			end
			add_default_links({
				win_names  = { "zlib1" },
				unix_names = { "z" },
			})
		end,
	},
}


-- add a set of external libraries to the project; takes care of
-- include / lib path and linking against the import library.
-- extern_libs: table of library names [string]
-- target_type: String defining the projects kind [string]
function project_add_extern_libs(extern_libs, target_type)

	for i,extern_lib in pairs(extern_libs) do
		local def = extern_lib_defs[extern_lib]
		assert(def, "external library " .. extern_lib .. " not defined")

		if def.compile_settings then
			def.compile_settings()
		end

		-- Linking to external libraries will only be done in the main executable and not in the
		-- static libraries. Premake would silently skip linking into static libraries for some
		-- actions anyway (e.g. vs2010).
		-- On osx using xcode, if this linking would be defined in the static libraries, it would fail to
		-- link if only dylibs are available. If both *.a and *.dylib are available, it would link statically.
		-- I couldn't find any problems with that approach.
		if target_type ~= "StaticLib" and def.link_settings then
			def.link_settings()
		end
	end
end
E per il resto? (Avevo editato il precedente messaggio mentre postavi il tuo).
Scusa non avevo visto. non è il file con exe alla fine che devi eseguire, ma quell' altro. Non so cosa ci facciano nel gioco tante librerie di winodws e anche file exe, probabilmente è possibile installare 0ad su windows usando i file scaricati.

Comunque, mi dispiace ma non so aiutarti con quest' ultimo problema. :( Non riesco a capire che problema ci sia. Prova a reinstallare boost. Altro non so cosa dire. Mi dispiace.
Image
Image
User avatar
Zievatron
Posts: 272
Joined: 31. Jan 2012, 15:13

Re: 0AD : Per Salix non si può avere?

Post by Zievatron »

Chaosphere wrote:... non è il file con exe alla fine che devi eseguire, ma quell' altro...
Quell'altro quale? Quello ccon estensione .pdb? Viene definito "Documento AportisDoc". Mi chede con quale applicazione voglio aprirlo! Ma non ho idea di quale possa aprirlo. :roll:
Poi c'è un _dgb.exe.config che si apre con geany e si vede chiaramente che è roba per windows.
Non vedo nessun altro file che si chiami Pyrogenesis.

Ho provato a disinstallare e poi reinstallare boost.
Il risultato della compilazione resta identico.
Ma non è che è sbagliato il pacchetto scaricato di 0ad?
Cioè, non è che il pacchetto scaricato è buono per windows e non per Linux? :?
Post Reply