Commit bd49ef62d1a190a87927d2686852e11f9cc912ad

Authored by DarkGod
1 parent 989f03fe

Added BSD support

... ... @@ -28,6 +28,10 @@ project "TEngineRunner"
28 28 links { "dl", "SDL", "SDL_ttf", "SDL_image", "SDL_mixer", "GL", "GLU", "m", "pthread" }
29 29 defines { [[TENGINE_HOME_PATH='".t-engine"']], 'SELFEXE_LINUX' }
30 30
  31 + configuration "bsd"
  32 + links { "SDL", "SDL_ttf", "SDL_image", "SDL_mixer", "GL", "GLU", "m", "pthread" }
  33 + defines { [[TENGINE_HOME_PATH='".t-engine"']], 'SELFEXE_BSD' }
  34 +
31 35 configuration "windows"
32 36 links { "mingw32", "SDLmain", "SDL", "SDL_ttf", "SDL_image", "SDL_mixer", "OPENGL32", "GLU32", "wsock32" }
33 37 defines { [[TENGINE_HOME_PATH='"T-Engine"']], 'SELFEXE_WINDOWS' }
... ... @@ -56,6 +60,9 @@ project "te4runner"
56 60
57 61 configuration "linux"
58 62 defines { [[TENGINE_HOME_PATH='".t-engine"']], 'SELFEXE_LINUX' }
  63 + configuration "bsd"
  64 + defines { [[TENGINE_HOME_PATH='".t-engine"']], 'SELFEXE_BSD' }
  65 +
59 66 configuration "windows"
60 67 defines { [[TENGINE_HOME_PATH='"T-Engine"']], 'SELFEXE_WINDOWS' }
61 68 configuration "macosx"
... ... @@ -78,6 +85,8 @@ project "runner-physfs"
78 85
79 86 configuration "linux"
80 87 files { "../src/physfs/platform/unix.c", "../src/physfs/platform/posix.c", }
  88 + configuration "bsd"
  89 + files { "../src/physfs/platform/unix.c", "../src/physfs/platform/posix.c", }
81 90 configuration "windows"
82 91 files { "../src/physfs/platform/windows.c", }
83 92 configuration "macosx"
... ...
... ... @@ -107,6 +107,11 @@ project "TEngine"
107 107 defines { [[TENGINE_HOME_PATH='".t-engine"']], 'SELFEXE_LINUX' }
108 108 if steamlin64 then steamlin64() end
109 109
  110 + configuration "bsd"
  111 + libdirs {"/usr/local/lib/"}
  112 + links { "SDL2", "SDL2_ttf", "SDL2_image", "png", "openal", "vorbisfile", "GL", "GLU", "m", "pthread" }
  113 + defines { [[TENGINE_HOME_PATH='".t-engine"']], 'SELFEXE_BSD' }
  114 +
110 115 configuration {"Debug"}
111 116 postbuildcommands { "cp ../bin/Debug/t-engine ../", }
112 117 configuration {"Release"}
... ... @@ -130,6 +135,8 @@ project "physfs"
130 135
131 136 configuration "linux"
132 137 files { "../src/physfs/platform/unix.c", "../src/physfs/platform/posix.c", }
  138 + configuration "bsd"
  139 + files { "../src/physfs/platform/unix.c", "../src/physfs/platform/posix.c", }
133 140 configuration "windows"
134 141 files { "../src/physfs/platform/windows.c", }
135 142 configuration "macosx"
... ... @@ -295,6 +302,20 @@ elseif _OPTIONS.lua == "jit2" then
295 302 }
296 303 end
297 304
  305 + configuration "bsd"
  306 + if not _OPTIONS["no-cleanup-jit2"] then
  307 + local list = "../src/luajit2/src/lib_base.c ../src/luajit2/src/lib_math.c ../src/luajit2/src/lib_bit.c ../src/luajit2/src/lib_string.c ../src/luajit2/src/lib_table.c ../src/luajit2/src/lib_io.c ../src/luajit2/src/lib_os.c ../src/luajit2/src/lib_package.c ../src/luajit2/src/lib_debug.c ../src/luajit2/src/lib_jit.c ../src/luajit2/src/lib_ffi.c"
  308 + prebuildcommands{
  309 + "../src/luajit2/src/buildvm -m elfasm -o ../src/luajit2/src/lj_vm.s",
  310 + "../src/luajit2/src/buildvm -m bcdef -o ../src/luajit2/src/lj_bcdef.h "..list,
  311 + "../src/luajit2/src/buildvm -m ffdef -o ../src/luajit2/src/lj_ffdef.h "..list,
  312 + "../src/luajit2/src/buildvm -m libdef -o ../src/luajit2/src/lj_libdef.h "..list,
  313 + "../src/luajit2/src/buildvm -m recdef -o ../src/luajit2/src/lj_recdef.h "..list,
  314 + "../src/luajit2/src/buildvm -m vmdef -o ../src/luajit2/vmdef.lua "..list,
  315 + "../src/luajit2/src/buildvm -m folddef -o ../src/luajit2/src/lj_folddef.h ../src/luajit2/src/lj_opt_fold.c",
  316 + }
  317 + end
  318 +
298 319 configuration "macosx"
299 320 local list = "../src/luajit2/src/lib_base.c ../src/luajit2/src/lib_math.c ../src/luajit2/src/lib_bit.c ../src/luajit2/src/lib_string.c ../src/luajit2/src/lib_table.c ../src/luajit2/src/lib_io.c ../src/luajit2/src/lib_os.c ../src/luajit2/src/lib_package.c ../src/luajit2/src/lib_debug.c ../src/luajit2/src/lib_jit.c ../src/luajit2/src/lib_ffi.c"
300 321 prebuildcommands{
... ...
... ... @@ -28,6 +28,14 @@ if _OPTIONS.steam then
28 28 dofile("steamworks/build/steam-def.lua")
29 29 end
30 30
  31 +configuration "bsd"
  32 + libdirs {
  33 + "/usr/local/lib",
  34 + }
  35 + includedirs {
  36 + "/usr/local/include",
  37 + }
  38 +
31 39 configuration "windows"
32 40 libdirs {
33 41 "/c/code/SDL/lib",
... ...
... ... @@ -39,6 +39,29 @@ int get_number_cpus()
39 39 // return 1;
40 40 }
41 41
  42 +#elif defined(SELFEXE_BSD)
  43 +#include <limits.h>
  44 +#include <stdlib.h>
  45 +const char *get_self_executable(int argc, char **argv)
  46 +{
  47 + static char res[PATH_MAX];
  48 + // Like linux, but /proc is not always mounted
  49 + // return 0 if it's not
  50 + if (realpath("/proc/curproc/file", res)) return NULL;
  51 + return res;
  52 +}
  53 +
  54 +#import <sys/sysctl.h>
  55 +
  56 +int get_number_cpus()
  57 +{
  58 + int count;
  59 + size_t size=sizeof(count);
  60 +
  61 + if (sysctlbyname("hw.ncpu",&count,&size,NULL,0)) return 1;
  62 + return count;
  63 +}
  64 +
42 65 #elif defined(SELFEXE_WINDOWS)
43 66 #include <stdlib.h>
44 67 #include <windows.h>
... ...
... ... @@ -27,6 +27,12 @@
27 27 #include <vorbis/vorbisfile.h>
28 28 #include <SDL2/SDL.h>
29 29 #include <SDL2/SDL_thread.h>
  30 +#elif defined(__FreeBSD__)
  31 +#include <AL/al.h>
  32 +#include <AL/alc.h>
  33 +#include <vorbis/vorbisfile.h>
  34 +#include <SDL2/SDL.h>
  35 +#include <SDL2/SDL_thread.h>
30 36 #elif defined(WIN32)
31 37 #include <AL/al.h>
32 38 #include <AL/alc.h>
... ...
... ... @@ -3,6 +3,11 @@
3 3 #include <SDL2_ttf/SDL_ttf.h>
4 4 //#include <SDL2_mixer/SDL_mixer.h>
5 5 #include <SDL2_image/SDL_image.h>
  6 +#elif defined(__FreeBSD__)
  7 +#include <SDL2/SDL.h>
  8 +#include <SDL2/SDL_ttf.h>
  9 +//#include <SDL2/SDL_mixer.h>
  10 +#include <SDL2/SDL_image.h>
6 11 #else
7 12 #include <SDL.h>
8 13 #include <SDL_ttf.h>
... ...