SpartanJ / SOIL2

SOIL2 is a tiny C library used primarily for uploading textures into OpenGL.
MIT No Attribution
370 stars 75 forks source link

install issue macOS #44

Closed thewoz closed 3 years ago

thewoz commented 3 years ago

Hi I try to install SOIL2 on macOs

unfortunately when I try to make it I got:

../../src/test/test_SOIL2.cpp:12:11: fatal error: 'SDL.h' file not found

include

I have install SDL via home-brew

SpartanJ commented 3 years ago

You should install it as a framework or change the include to

include <SDL/SDL.h>

since homebrew install it in a subfolder.

thewoz commented 3 years ago

what do you mean whit "install as a framework"?

I try also to install SDL from https://www.libsdl.org via GitHub mirror https://github.com/SDL-mirror/SDL but the headers is in /usr/local/include SDL2

so the solution is to change all the #include in SOILD2 to #include <SDL/SDL.h>? I will do it but for the future is not more easy to change it directly in your repository since the installation of SDL see to be always in a subfolder?

SpartanJ commented 3 years ago

The official SDL2 library distribution is provided as a macOS framework, and the paths are different than the homebrew version. The framework can be downloaded from the official site: https://libsdl.org/release/SDL2-2.0.14.dmg. After installing the framework, to generate the project run: premake5 --use-frameworks [projecttype, ex: gmake] Otherwise, you can change the includes, yes. But, since I can't detect the SDL2 library path from your installation, and by default tries to use the "official" SDL2 path, it won't work with the homebrew paths. Anyway, this is only to run the demo, SOIL2 does not depend on SDL2. I could improve this by checking if the build runs from a framework or a custom installation, I'll do that for sure in the near future.

SpartanJ commented 3 years ago

Mmh: it actually already does that: https://github.com/SpartanJ/SOIL2/blob/8cf904d99680fdd768b2a999f8c1bfe09be5a796/src/test/test_SOIL2.cpp#L11 How you built the project?

thewoz commented 3 years ago

hi now I have the SDL lib installed from https://github.com/SDL-mirror/SDL and I have the SDL file in /usr/local/include/SDL2

for SOIL I have done:

premake4 gmake premake4.lua cd make/macosx make config=release

and I get

==== Building soil2-static-lib (release) ==== ==== Building soil2-shared-lib (release) ==== ==== Building soil2-test (release) ==== test_SOIL2.cpp ../../src/test/test_SOIL2.cpp:12:11: fatal error: 'SDL.h' file not found

include

             ^~~~~~~

1 error generated. make[1]: [../../obj/macosx/release/soil2-test/test_SOIL2.o] Error 1 make: [soil2-test] Error 2

thewoz commented 3 years ago

but since SDL is only need to run the demo it is not possible to split the process in two parts? the installation of SOIL2 and the demo? So that you don't have compile the demo and thus I can avoid to install SDL?

SpartanJ commented 3 years ago

Use: make config=release soil2-static-lib or make config=release soil2-shared-lib To build the test you'll have to change: #include <SDL.h> to #include <SDL2/SDL.h>

SpartanJ commented 3 years ago

I should delete the premake4 version, it's not updated, that's why it's failing.

thewoz commented 3 years ago

ok thanks.. my be it would be nice have a make install that copy the lib in /usr/local/lib and copy all the .h in a SOIL2 folder in /usr/local/include

SpartanJ commented 3 years ago

premake4 gmake project should work fine with your configuration with the latests changes.

thewoz commented 3 years ago

it works!! Thanks!!!

milton-keynes commented 1 year ago

Hello, Mr.SpartanJ. I have SDL2 and SOIL2 in /usr/local/include. Then I have done: premake5 gmake premake5.lua cd make/macosx make I got: clang: warning: argument unused during compilation: '-msse2' [-Wunused-command-line-argument] test_SOIL2.cpp clang: warning: argument unused during compilation: '-msse2' [-Wunused-command-line-argument] ../../src/test/test_SOIL2.cpp:15:11: fatal error: 'SDL2/SDL.h' file not found #include <SDL2/SDL.h> ^~~~~~~~~~~~ 1 error generated.

Thx, looking forward to your reply...

SpartanJ commented 1 year ago

You probably just need to change the include: #include <SDL2/SDL.h> to #include <SDL.h>

How did you install SDL2?

milton-keynes commented 1 year ago

I installed it as a framework, and I put SDL2.framework on /usr/local/include OK I have changed the #include <SDL2/SDL.h> to #include <SDL.h>, but this is my new error > make

==== Building soil2-static-lib (debug_x86_64) ==== ==== Building soil2-shared-lib (debug_x86_64) ==== ==== Building soil2-test (debug_x86_64) ==== test_SOIL2.cpp clang: warning: argument unused during compilation: '-msse2' [-Wunused-command-line-argument] ../../src/test/test_SOIL2.cpp:16:14: fatal error: 'SDL.h' file not found #include <SDL.h> ^~~~~~~ 1 error generated. make[1]: *** [../../obj/macosx/x86_64/debug/soil2-test/test_SOIL2.o] Error 1 make: *** [soil2-test] Error 2

This is how I changed on SOIL2/src/test/test_SOIL2.cpp

#define NO_SDL_GLEXT
#if ( ( defined( _MSCVER ) || defined( _MSC_VER ) ) || defined( __APPLE_CC__ ) || defined ( __APPLE__ ) ) && !defined( SOIL2_NO_FRAMEWORKS )
    #include <SDL.h>
    #include <SDL_opengl.h>
#else
//  #include <SDL2/SDL.h>
    #include <SDL.h>
    #include <SDL2/SDL_opengl.h>
#endif
SpartanJ commented 1 year ago

I installed it as a framework, and I put SDL2.framework on /usr/local/include That is not how it works. Download the libsdl dmg and follow the instructions in the ReadMe file. Then follow my instructions.