Index: build/premake/extern_libs4.lua =================================================================== --- build/premake/extern_libs4.lua +++ build/premake/extern_libs4.lua @@ -308,32 +308,31 @@ compile_settings = function() if os.is("windows") then add_default_include_paths("gloox") - elseif os.is("macosx") then - -- Support GLOOX_CONFIG for overriding the default PATH-based gloox-config + elseif not _OPTIONS["android"] then + -- Support GLOOX_CONFIG for overriding the default (pkg-config --cflags gloox) + -- i.e. on OSX where it gets set in update-workspaces.sh gloox_config_path = os.getenv("GLOOX_CONFIG") - if not gloox_config_path then - gloox_config_path = "gloox-config" + if gloox_config_path then + pkgconfig_cflags(nil, gloox_config_path.." --cflags") + else + pkgconfig_cflags("gloox") end - pkgconfig_cflags(nil, gloox_config_path.." --cflags") end end, link_settings = function() if os.is("windows") then add_default_lib_paths("gloox") - end - if os.is("macosx") then - gloox_config_path = os.getenv("GLOOX_CONFIG") - if not gloox_config_path then - gloox_config_path = "gloox-config" - end - pkgconfig_libs(nil, gloox_config_path.." --libs") - else - -- TODO: consider using pkg-config on non-Windows (for compile_settings too) add_default_links({ win_names = { "gloox-1.0" }, - unix_names = { "gloox" }, no_delayload = 1, }) + else if not _OPTIONS["android"] then + gloox_config_path = os.getenv("GLOOX_CONFIG") + if gloox_config_path then + pkgconfig_libs(nil, gloox_config_path.." --libs") + else + pkgconfig_libs("gloox") + end end end, }, @@ -378,12 +377,8 @@ if os.is("windows") then add_default_include_paths("icu") elseif os.is("macosx") then - -- Support ICU_CONFIG for overriding the default PATH-based icu-config - icu_config_path = os.getenv("ICU_CONFIG") - if not icu_config_path then - icu_config_path = "icu-config" - end - pkgconfig_cflags(nil, icu_config_path.." --cppflags") + -- ICU_CONFIG gets set in update-workspaces.sh + pkgconfig_cflags(nil, os.getenv("ICU_CONFIG").." --cppflags") end end, link_settings = function() @@ -391,11 +386,8 @@ add_default_lib_paths("icu") end if os.is("macosx") then - icu_config_path = os.getenv("ICU_CONFIG") - if not icu_config_path then - icu_config_path = "gloox-config" - end - pkgconfig_libs(nil, icu_config_path.." --ldflags-searchpath --ldflags-libsonly --ldflags-system") + -- ICU_CONFIG gets set in update-workspaces.sh + pkgconfig_libs(nil, os.getenv("ICU_CONFIG").." --ldflags-searchpath --ldflags-libsonly --ldflags-system") else add_default_links({ win_names = { "icuuc", "icuin" }, @@ -464,20 +456,20 @@ 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 + elseif not _OPTIONS["android"] then + -- Support XML2_CONFIG for overriding the default (pkg-config --cflags libxml-2.0) + -- i.e. on OSX where it gets set in update-workspaces.sh xml2_config_path = os.getenv("XML2_CONFIG") - if not xml2_config_path then - xml2_config_path = "xml2-config" + if xml2_config_path then + pkgconfig_cflags(nil, xml2_config_path.." --cflags") + else + pkgconfig_cflags("libxml-2.0") end - - -- use xml2-config instead of pkg-config on OS X - pkgconfig_cflags(nil, xml2_config_path.." --cflags") + end + if os.is("macosx") then -- 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() @@ -488,14 +480,13 @@ configuration "Release" links { "libxml2" } configuration { } - elseif os.is("macosx") then + elseif not _OPTIONS["android"] then xml2_config_path = os.getenv("XML2_CONFIG") - if not xml2_config_path then - xml2_config_path = "xml2-config" + if xml2_config_path then + pkgconfig_libs(nil, xml2_config_path.." --libs") + else + pkgconfig_libs("libxml-2.0") end - pkgconfig_libs(nil, xml2_config_path.." --libs") - else - pkgconfig_libs("libxml-2.0") end end, }, @@ -721,11 +712,15 @@ end, }, x11 = { + compile_settings = function() + if not os.is("windows") and not os.is("macosx") then + pkgconfig_cflags("x11") + end + end, link_settings = function() - add_default_links({ - win_names = { }, - unix_names = { "X11" }, - }) + if not os.is("windows") and not os.is("macosx") then + pkgconfig_libs("x11") + end end, }, xcursor = { Index: build/premake/extern_libs5.lua =================================================================== --- build/premake/extern_libs5.lua +++ build/premake/extern_libs5.lua @@ -262,32 +262,31 @@ compile_settings = function() if os.istarget("windows") then add_default_include_paths("gloox") - elseif os.istarget("macosx") then - -- Support GLOOX_CONFIG for overriding the default PATH-based gloox-config + elseif not _OPTIONS["android"] then + -- Support GLOOX_CONFIG for overriding the default (pkg-config --cflags gloox) + -- i.e. on OSX where it gets set in update-workspaces.sh gloox_config_path = os.getenv("GLOOX_CONFIG") - if not gloox_config_path then - gloox_config_path = "gloox-config" - end - pkgconfig.add_includes(nil, gloox_config_path.." --cflags") + if gloox_config_path then + pkgconfig.add_includes(nil, gloox_config_path.." --cflags") + else + pkgconfig.add_includes("gloox") + end end end, link_settings = function() if os.istarget("windows") then add_default_lib_paths("gloox") - end - if os.istarget("macosx") then - gloox_config_path = os.getenv("GLOOX_CONFIG") - if not gloox_config_path then - gloox_config_path = "gloox-config" - end - pkgconfig.add_links(nil, gloox_config_path.." --libs") - else - -- TODO: consider using pkg-config on non-Windows (for compile_settings too) add_default_links({ win_names = { "gloox-1.0" }, - unix_names = { "gloox" }, no_delayload = 1, }) + elseif not _OPTIONS["android"] then + gloox_config_path = os.getenv("GLOOX_CONFIG") + if gloox_config_path then + pkgconfig.add_links(nil, gloox_config_path.." --libs") + else + pkgconfig.add_links("gloox") + end end end, }, @@ -332,12 +331,8 @@ if os.istarget("windows") then add_default_include_paths("icu") elseif os.istarget("macosx") then - -- Support ICU_CONFIG for overriding the default PATH-based icu-config - icu_config_path = os.getenv("ICU_CONFIG") - if not icu_config_path then - icu_config_path = "icu-config" - end - pkgconfig.add_includes(nil, icu_config_path.." --cppflags") + -- ICU_CONFIG gets set in update-workspaces.sh + pkgconfig.add_includes(nil, os.getenv("ICU_CONFIG").." --cppflags") end end, link_settings = function() @@ -345,11 +340,8 @@ add_default_lib_paths("icu") end if os.istarget("macosx") then - icu_config_path = os.getenv("ICU_CONFIG") - if not icu_config_path then - icu_config_path = "gloox-config" - end - pkgconfig.add_links(nil, icu_config_path.." --ldflags-searchpath --ldflags-libsonly --ldflags-system") + -- ICU_CONFIG gets set in update-workspaces.sh + pkgconfig.add_links(nil, os.getenv("ICU_CONFIG").." --ldflags-searchpath --ldflags-libsonly --ldflags-system") else add_default_links({ win_names = { "icuuc", "icuin" }, @@ -420,20 +412,20 @@ compile_settings = function() if os.istarget("windows") then add_default_include_paths("libxml2") - elseif os.istarget("macosx") then - -- Support XML2_CONFIG for overriding for the default PATH-based xml2-config + elseif not _OPTIONS["android"] then + -- Support XML2_CONFIG for overriding the default (pkg-config --cflags libxml-2.0) + -- i.e. on OSX where it gets set in update-workspaces.sh xml2_config_path = os.getenv("XML2_CONFIG") - if not xml2_config_path then - xml2_config_path = "xml2-config" + if xml2_config_path then + pkgconfig.add_includes(nil, xml2_config_path.." --cflags") + else + pkgconfig.add_includes("libxml-2.0") end - - -- use xml2-config instead of pkg-config on OS X - pkgconfig.add_includes(nil, xml2_config_path.." --cflags") + end + if os.istarget("macosx") then -- 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.add_includes("libxml-2.0") end end, link_settings = function() @@ -444,14 +436,13 @@ filter "Release" links { "libxml2" } filter { } - elseif os.istarget("macosx") then + elseif not _OPTIONS["android"] then xml2_config_path = os.getenv("XML2_CONFIG") - if not xml2_config_path then - xml2_config_path = "xml2-config" + if xml2_config_path then + pkgconfig.add_links(nil, xml2_config_path.." --libs") + else + pkgconfig.add_links("libxml-2.0") end - pkgconfig.add_links(nil, xml2_config_path.." --libs") - else - pkgconfig.add_links("libxml-2.0") end end, }, @@ -686,11 +677,15 @@ end, }, x11 = { + compile_settings = function() + if not os.istarget("windows") and not os.istarget("macosx") then + pkgconfig.add_includes("x11") + end + end, link_settings = function() - add_default_links({ - win_names = { }, - unix_names = { "X11" }, - }) + if not os.istarget("windows") and not os.istarget("macosx") then + pkgconfig.add_links("x11") + end end, }, xcursor = { Index: build/premake/premake4.lua =================================================================== --- build/premake/premake4.lua +++ build/premake/premake4.lua @@ -379,23 +379,6 @@ end end --- add X11 includes paths after all the others so they don't conflict with --- bundled libs -function project_add_x11_dirs() - if not os.is("windows") and not os.is("macosx") then - -- X11 includes may be installed in one of a gadzillion of five places - -- Famous last words: "You can't include too much! ;-)" - includedirs { - "/usr/X11R6/include/X11", - "/usr/X11R6/include", - "/usr/local/include/X11", - "/usr/local/include", - "/usr/include/X11" - } - libdirs { "/usr/X11R6/lib" } - end -end - -- create a project and set the attributes that are common to all projects. function project_create(project_name, target_type) @@ -528,7 +511,6 @@ project_create(project_name, target_type) project_add_contents(source_root, rel_source_dirs, {}, extra_params) project_add_extern_libs(extern_libs, target_type) - project_add_x11_dirs() if not extra_params["no_default_link"] then table.insert(static_lib_names, project_name) @@ -551,7 +533,6 @@ project_create(project_name, target_type) project_add_contents(source_root, rel_source_dirs, {}, extra_params) project_add_extern_libs(extern_libs, target_type) - project_add_x11_dirs() if not extra_params["no_default_link"] then table.insert(static_lib_names, project_name) @@ -949,7 +930,6 @@ } project_add_contents(source_root, {}, {}, extra_params) project_add_extern_libs(used_extern_libs, target_type) - project_add_x11_dirs() -- Platform Specifics if os.is("windows") then @@ -1043,7 +1023,6 @@ project_add_contents(source_root, rel_source_dirs, rel_include_dirs, extra_params) project_add_extern_libs(extern_libs, target_type) - project_add_x11_dirs() -- Platform Specifics if os.is("windows") then @@ -1169,7 +1148,6 @@ local target_type = get_main_project_target_type() project_create(project_name, target_type) - project_add_x11_dirs() local source_root = rootdir.."/source/tools/atlas/AtlasFrontends/" files { source_root..project_name..".cpp" } @@ -1214,7 +1192,6 @@ extra_params["pch_dir"] = source_root project_add_contents(source_root, rel_source_dirs, rel_include_dirs, extra_params) project_add_extern_libs(extern_libs, target_type) - project_add_x11_dirs() -- Platform Specifics if os.is("windows") then @@ -1404,7 +1381,6 @@ project_add_contents(source_root, {}, {}, extra_params) project_add_extern_libs(used_extern_libs, target_type) - project_add_x11_dirs() -- TODO: should fix the duplication between this OS-specific linking -- code, and the similar version in setup_main_exe Index: build/premake/premake5.lua =================================================================== --- build/premake/premake5.lua +++ build/premake/premake5.lua @@ -367,23 +367,6 @@ end end --- add X11 includes paths after all the others so they don't conflict with --- bundled libs -function project_add_x11_dirs() - if not os.istarget("windows") and not os.istarget("macosx") then - -- X11 includes may be installed in one of a gadzillion of five places - -- Famous last words: "You can't include too much! ;-)" - sysincludedirs { - "/usr/X11R6/include/X11", - "/usr/X11R6/include", - "/usr/local/include/X11", - "/usr/local/include", - "/usr/include/X11" - } - libdirs { "/usr/X11R6/lib" } - end -end - -- create a project and set the attributes that are common to all projects. function project_create(project_name, target_type) @@ -528,7 +511,6 @@ project_create(project_name, target_type) project_add_contents(source_root, rel_source_dirs, {}, extra_params) project_add_extern_libs(extern_libs, target_type) - project_add_x11_dirs() if not extra_params["no_default_link"] then table.insert(static_lib_names, project_name) @@ -551,7 +533,6 @@ project_create(project_name, target_type) project_add_contents(source_root, rel_source_dirs, {}, extra_params) project_add_extern_libs(extern_libs, target_type) - project_add_x11_dirs() if not extra_params["no_default_link"] then table.insert(static_lib_names, project_name) @@ -961,7 +942,6 @@ } project_add_contents(source_root, {}, {}, extra_params) project_add_extern_libs(used_extern_libs, target_type) - project_add_x11_dirs() dependson { "Collada" } @@ -1057,7 +1037,6 @@ project_add_contents(source_root, rel_source_dirs, rel_include_dirs, extra_params) project_add_extern_libs(extern_libs, target_type) - project_add_x11_dirs() -- Platform Specifics if os.istarget("windows") then @@ -1180,7 +1159,6 @@ local target_type = get_main_project_target_type() project_create(project_name, target_type) - project_add_x11_dirs() local source_root = rootdir.."/source/tools/atlas/AtlasFrontends/" files { source_root..project_name..".cpp" } @@ -1220,7 +1198,6 @@ extra_params["pch_dir"] = source_root project_add_contents(source_root, rel_source_dirs, rel_include_dirs, extra_params) project_add_extern_libs(extern_libs, target_type) - project_add_x11_dirs() -- Platform Specifics if os.istarget("windows") then @@ -1364,7 +1341,6 @@ project_add_contents(source_root, {}, {}, extra_params) project_add_extern_libs(used_extern_libs, target_type) - project_add_x11_dirs() dependson { "Collada" } Index: source/lib/sysdep/os/unix/x/x.cpp =================================================================== --- source/lib/sysdep/os/unix/x/x.cpp +++ source/lib/sysdep/os/unix/x/x.cpp @@ -41,10 +41,10 @@ #define Cursor X__Cursor -#include +#include #include -#include -#include +#include +#include #include "SDL.h" #include "SDL_syswm.h"