Closed atsb closed 2 years ago
I'll have to try to wrangle up a VM for testing this.
Although it's not causing the error in question, SDL 1.x should be the dependency here. Is it asking you to explicitly install the SDL2 library/headers?
In the meantime, does changing line 31 of source_files/epi/epi_macosx.h to this help?:
Ahh yes, it is SDL 1.2 not SDL2. Sorry, I've spent a lot of time lately with SDL2 source ports.
So you were right about that one addition. I'm working on a few others to get it building. I'll report back once that is done.
EDIT:
So you were right with that fix you mentioned. Below are a few others.
Since your CMake file does not define a MACOSX preprocessor macro, the resulting Makefile does not define MACOSX, and so anything in an ifdef/else with MACOSX will not be triggered. I would suggest to go the least painful route and use 'APPLE' as this will be triggered when running on all Apple systems.
epi.h
#ifdef __APPLE__
#include "epi_macosx.h"
#endif
deh_edge/i_defs.h
// MacOS X
#elif defined (__APPLE__)
edge/i_defs_gl.h
#ifdef __APPLE__
#include <GL/glew.h>
#include <OpenGL/gl.h>
#include <OpenGL/glext.h>
#endif
edge/unx_system.cc
Remove the MACOSX ifndef. This is no longer true and MacOS needs this function.
//
// I_MessageBox
//
void I_MessageBox(const char *message, const char *title)
{
#ifdef USE_FLTK
Fl::scheme(NULL);
fl_message_font(FL_HELVETICA /*_BOLD*/, 18);
fl_message("%s", message);
#else // USE_FLTK
fprintf(stderr, "\n%s\n", message);
#endif // USE_FLTK
}
Finally (I also renamed all MACOSX macros to APPLE), I also had to manually configure the link.txt file to correctly point to all the right things (CMake should do this when it is properly configured for a MacOS system).
link.txt:
/Library/Developer/CommandLineTools/usr/bin/c++ -O2 -ffast-math -fno-strict-aliasing -DINLINE_G=inline -Wall -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk -Wl,-search_paths_first -Wl,-headerpad_max_install_names CMakeFiles/edge135.dir/source_files/edge/i_main.cc.o CMakeFiles/edge135.dir/source_files/edge/i_ctrl.cc.o CMakeFiles/edge135.dir/source_files/edge/i_video.cc.o CMakeFiles/edge135.dir/source_files/edge/i_sound.cc.o CMakeFiles/edge135.dir/source_files/edge/i_net.cc.o CMakeFiles/edge135.dir/source_files/edge/am_map.cc.o CMakeFiles/edge135.dir/source_files/edge/con_con.cc.o CMakeFiles/edge135.dir/source_files/edge/con_main.cc.o CMakeFiles/edge135.dir/source_files/edge/con_link.cc.o CMakeFiles/edge135.dir/source_files/edge/con_var.cc.o CMakeFiles/edge135.dir/source_files/edge/e_input.cc.o CMakeFiles/edge135.dir/source_files/edge/e_main.cc.o CMakeFiles/edge135.dir/source_files/edge/e_player.cc.o CMakeFiles/edge135.dir/source_files/edge/f_finale.cc.o CMakeFiles/edge135.dir/source_files/edge/f_interm.cc.o CMakeFiles/edge135.dir/source_files/edge/g_game.cc.o CMakeFiles/edge135.dir/source_files/edge/hu_draw.cc.o CMakeFiles/edge135.dir/source_files/edge/hu_font.cc.o CMakeFiles/edge135.dir/source_files/edge/hu_stuff.cc.o CMakeFiles/edge135.dir/source_files/edge/hu_style.cc.o CMakeFiles/edge135.dir/source_files/edge/l_glbsp.cc.o CMakeFiles/edge135.dir/source_files/edge/l_deh.cc.o CMakeFiles/edge135.dir/source_files/edge/m_argv.cc.o CMakeFiles/edge135.dir/source_files/edge/m_bbox.cc.o CMakeFiles/edge135.dir/source_files/edge/m_cheat.cc.o CMakeFiles/edge135.dir/source_files/edge/m_math.cc.o CMakeFiles/edge135.dir/source_files/edge/m_menu.cc.o CMakeFiles/edge135.dir/source_files/edge/m_misc.cc.o CMakeFiles/edge135.dir/source_files/edge/m_option.cc.o CMakeFiles/edge135.dir/source_files/edge/m_netgame.cc.o CMakeFiles/edge135.dir/source_files/edge/m_random.cc.o CMakeFiles/edge135.dir/source_files/edge/n_bcast.cc.o CMakeFiles/edge135.dir/source_files/edge/n_reliable.cc.o CMakeFiles/edge135.dir/source_files/edge/n_network.cc.o CMakeFiles/edge135.dir/source_files/edge/p_action.cc.o CMakeFiles/edge135.dir/source_files/edge/p_blockmap.cc.o CMakeFiles/edge135.dir/source_files/edge/p_bot.cc.o CMakeFiles/edge135.dir/source_files/edge/p_enemy.cc.o CMakeFiles/edge135.dir/source_files/edge/p_inter.cc.o CMakeFiles/edge135.dir/source_files/edge/p_lights.cc.o CMakeFiles/edge135.dir/source_files/edge/p_map.cc.o CMakeFiles/edge135.dir/source_files/edge/p_maputl.cc.o CMakeFiles/edge135.dir/source_files/edge/p_mobj.cc.o CMakeFiles/edge135.dir/source_files/edge/p_plane.cc.o CMakeFiles/edge135.dir/source_files/edge/p_setup.cc.o CMakeFiles/edge135.dir/source_files/edge/p_sight.cc.o CMakeFiles/edge135.dir/source_files/edge/p_spec.cc.o CMakeFiles/edge135.dir/source_files/edge/p_switch.cc.o CMakeFiles/edge135.dir/source_files/edge/p_tick.cc.o CMakeFiles/edge135.dir/source_files/edge/p_user.cc.o CMakeFiles/edge135.dir/source_files/edge/p_forces.cc.o CMakeFiles/edge135.dir/source_files/edge/p_telept.cc.o CMakeFiles/edge135.dir/source_files/edge/p_weapon.cc.o CMakeFiles/edge135.dir/source_files/edge/rad_act.cc.o CMakeFiles/edge135.dir/source_files/edge/rad_pars.cc.o CMakeFiles/edge135.dir/source_files/edge/rad_trig.cc.o CMakeFiles/edge135.dir/source_files/edge/r_draw.cc.o CMakeFiles/edge135.dir/source_files/edge/r_shader.cc.o CMakeFiles/edge135.dir/source_files/edge/r_render.cc.o CMakeFiles/edge135.dir/source_files/edge/r_effects.cc.o CMakeFiles/edge135.dir/source_files/edge/r_main.cc.o CMakeFiles/edge135.dir/source_files/edge/r_occlude.cc.o CMakeFiles/edge135.dir/source_files/edge/m_logo.cc.o CMakeFiles/edge135.dir/source_files/edge/r_things.cc.o CMakeFiles/edge135.dir/source_files/edge/r_units.cc.o CMakeFiles/edge135.dir/source_files/edge/r_wipe.cc.o CMakeFiles/edge135.dir/source_files/edge/r_misc.cc.o CMakeFiles/edge135.dir/source_files/edge/r_sky.cc.o CMakeFiles/edge135.dir/source_files/edge/r_colormap.cc.o CMakeFiles/edge135.dir/source_files/edge/r_modes.cc.o CMakeFiles/edge135.dir/source_files/edge/r_md2.cc.o CMakeFiles/edge135.dir/source_files/edge/r_image.cc.o CMakeFiles/edge135.dir/source_files/edge/r_doomtex.cc.o CMakeFiles/edge135.dir/source_files/edge/r_texgl.cc.o CMakeFiles/edge135.dir/source_files/edge/s_blit.cc.o CMakeFiles/edge135.dir/source_files/edge/s_cache.cc.o CMakeFiles/edge135.dir/source_files/edge/s_sound.cc.o CMakeFiles/edge135.dir/source_files/edge/s_mp3.cc.o CMakeFiles/edge135.dir/source_files/edge/s_music.cc.o CMakeFiles/edge135.dir/source_files/edge/s_ogg.cc.o CMakeFiles/edge135.dir/source_files/edge/s_tsf.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_chunk.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_glob.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_level.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_load.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_main.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_misc.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_mobj.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_play.cc.o CMakeFiles/edge135.dir/source_files/edge/sv_save.cc.o CMakeFiles/edge135.dir/source_files/edge/w_flat.cc.o CMakeFiles/edge135.dir/source_files/edge/w_model.cc.o CMakeFiles/edge135.dir/source_files/edge/w_sprite.cc.o CMakeFiles/edge135.dir/source_files/edge/w_texture.cc.o CMakeFiles/edge135.dir/source_files/edge/w_wad.cc.o CMakeFiles/edge135.dir/source_files/edge/z_zone.cc.o CMakeFiles/edge135.dir/source_files/edge/vm_coal.cc.o CMakeFiles/edge135.dir/source_files/edge/vm_hud.cc.o CMakeFiles/edge135.dir/source_files/edge/vm_player.cc.o CMakeFiles/edge135.dir/source_files/edge/unx_music.cc.o CMakeFiles/edge135.dir/source_files/edge/unx_net.cc.o CMakeFiles/edge135.dir/source_files/edge/unx_system.cc.o -o edge135 source_files/coal/libedge_coal.a source_files/ddf/libedge_ddf.a source_files/deh_edge/libedge_deh.a source_files/epi/libedge_epi.a source_files/glbsp/libedge_glbsp.a -framework OpenGL /usr/local/lib/libGLEW.dylib /usr/local/Cellar/sdl/1.2.15_3/lib/libSDLmain.a /usr/local/Cellar/sdl/1.2.15_3/lib/libSDL.dylib -framework Foundation -framework Cocoa source_files/libpng/libpng16.a source_files/libjpeg/libjpeg.a source_files/zlib/libz.a
After all this, it links without issues and it is playable. Phew.. as always, I'll be more than happy to test any CMake additions for Mac systems that you may do.
Wow, well I'm happy to see that got up and running relatively quickly! I'll leave this open while I fold in the changes you've suggested. Thanks for the help.
https://github.com/dashodanger/EDGE-classic/commit/67281217497d6c2353eb03c4b959c2d9d4b5598c should have the changes you've mentioned above...were those enough for link.txt to be fixed when starting fresh, or were there further adjustments needed?
I had an issue with OpenGL and SDL linking. I used the below in the unix target_link_libraries part:
${OPENGL_LIBRARIES}
${GLEW_LIBRARIES}
${SDL_LIBRARIES}
Then it linked without issues. Compilation went through without a hitch.
I wonder if that's related to me trying to make non-Window builds link with the bundled glew folder instead...would you be able to attach your CMakeLists.txt?
Would you mind giving this one a spin? If it doesn't work, I may need to add a find_package(GLEW) for Apple targets
Perfect! Works fine with your latest master.
Sweet, thanks for testing. I just pushed the same CMakeLists as https://github.com/dashodanger/EDGE-classic/commit/17a48ac15de58b5d1f576404dcfc9df4aa4b75da and will close this issue then. Let me know if any other Apple issues crop up.
Clang Target:
SDL2/GLEW etc.. are all correctly resolved and identified via CMake.