Page 1 of 2

OSX, Cmake and Xcode

Posted: Wed Feb 23, 2011 3:28 am
by shenle
I'm trying to compile VS on OSX 10.5.7 with cmake and Xcode-3.1.4
Taking this route since I've seen talk lately that the autotools will be abandoned soon by this project, with builds on all Unix-like systems relying on cmake.

I think cmake is being stupid. It doesn't find things even if you point them to it. The error messages contradict each other. See my current stage:

Code: Select all

++ Using Internal Boost
++ OpenGL found : /System/Library/Frameworks/AGL.framework;/System/Library/Frameworks/OpenGL.framework
++ GLUT found : -framework GLUT;-framework Cocoa
++ Found OpenAL
++ SDL Found
Found Vorbis: /usr/local/lib/libvorbis.dylib;/usr/local/lib/libvorbisfile.dylib;/usr/local/lib/libogg.dylib
checking for module 'libavcodec'
  package 'libavcodec' not found
CMake Error at /Applications/CMake 2.8-4.app/Contents/share/cmake-2.8/Modules/FindPkgConfig.cmake:266 (message):
  A required package was not found
Call Stack (most recent call first):
  /Applications/CMake 2.8-4.app/Contents/share/cmake-2.8/Modules/FindPkgConfig.cmake:320 (_pkg_check_modules_internal)
  FindFFMPEG.cmake:25 (pkg_check_modules)
  CMakeLists.txt:826 (find_package)


checking for module 'libavformat'
  package 'libavformat' not found
CMake Error at /Applications/CMake 2.8-4.app/Contents/share/cmake-2.8/Modules/FindPkgConfig.cmake:266 (message):
  A required package was not found
Call Stack (most recent call first):
  /Applications/CMake 2.8-4.app/Contents/share/cmake-2.8/Modules/FindPkgConfig.cmake:320 (_pkg_check_modules_internal)
  FindFFMPEG.cmake:72 (pkg_check_modules)
  CMakeLists.txt:826 (find_package)


checking for module 'libavutil'
  package 'libavutil' not found
CMake Error at /Applications/CMake 2.8-4.app/Contents/share/cmake-2.8/Modules/FindPkgConfig.cmake:266 (message):
  A required package was not found
Call Stack (most recent call first):
  /Applications/CMake 2.8-4.app/Contents/share/cmake-2.8/Modules/FindPkgConfig.cmake:320 (_pkg_check_modules_internal)
  FindFFMPEG.cmake:120 (pkg_check_modules)
  CMakeLists.txt:826 (find_package)


checking for module 'libswscale'
  package 'libswscale' not found
Found FFmpeg: /usr/local/lib/libavcodec.a;/usr/local/lib/libavformat.a;/usr/local/lib/libavutil.a
-- FFMpeg's libswscale not found... depending on your ffmpeg version, VS might not build.
checking for module 'OGRE>=1.2.0'
  package 'OGRE>=1.2.0' not found
Ogre not found
-- Ogre Not Found: compiling without
checking for module 'cairo'
  package 'cairo' not found
CMake Error at /Applications/CMake 2.8-4.app/Contents/share/cmake-2.8/Modules/FindPkgConfig.cmake:266 (message):
  A required package was not found
Call Stack (most recent call first):
  /Applications/CMake 2.8-4.app/Contents/share/cmake-2.8/Modules/FindPkgConfig.cmake:320 (_pkg_check_modules_internal)
  FindGTK2.cmake:155 (pkg_check_modules)
  setup/CMakeLists.txt:15 (find_package)


Found GTK2: /sw/lib/libgtk-x11-2.0.dylib;/sw/lib/libgdk-x11-2.0.dylib;/sw/lib/libgdk_pixbuf-2.0.dylib;/sw/lib/libgmodule-2.0.dylib;/sw/lib/libgthread-2.0.dylib;/sw/lib/libgobject-2.0.dylib;/sw/lib/libpango-1.0.dylib;/sw/lib/libcairo.dylib;/sw/lib/libatk-1.0.dylib;/sw/lib/libgtkglext-x11-1.0.dylib
-- Compiling mesh_tool without OgreMesh support: Ogre not found
Default build type is Release, no cpu opts enabled. 
Configuring incomplete, errors occurred!
So first it complains of not finding libavcodec, libavformat and libavutil, then it lists the locations where it found them and still says they're missing. Same for cairo. And BTW libswscale.a is together with the others in /usr/local/lib

I'm out of ideas. I have a nice writeup on getting VS to compile from scratch on OSX, but I don't seem able to get past this last hurdle.

(FWIW I installed ffmpeg from source, and all of GTK2 packages via Fink)

Below attached my install notes so far

Re: OSX, Cmake and Xcode

Posted: Wed Feb 23, 2011 3:29 pm
by klauss
shenle wrote:So first it complains of not finding libavcodec, libavformat and libavutil, then it lists the locations where it found them and still says they're missing. Same for cairo. And BTW libswscale.a is together with the others in /usr/local/lib
IIRC, it tries to build a very simple test program to validate that everything actually works.
It must have failed there, I presume.
shenle wrote:I'm out of ideas. I have a nice writeup on getting VS to compile from scratch on OSX, but I don't seem able to get past this last hurdle.
I don't think anyone has built with ffmpeg on OSX ever, but ffmpeg is (at the moment) optional, since VS UTCS doesn't use the feature yet.

Why is cmake thinking it's required?

Re: OSX, Cmake and Xcode

Posted: Wed Feb 23, 2011 3:45 pm
by shenle
Well, since I have ffmpeg installed and since it will be eventually required, it would be nice to compile with it.

Apart from that, I don't know how to tell cmake it's not required. :)

(also, cmake doesn't seem able to find swscale on Linux either but that's not a problem)

Re: OSX, Cmake and Xcode

Posted: Wed Feb 23, 2011 5:26 pm
by CLoneWolf
At least under Linux, that's a common situation when the user has the binaries of the involved library, but not the headers; in fact, given that not everyone will ever need the headers, Debian and derivatives have the habit to ship header files in separate packages, with the naming convention of adding a -dev suffix to the header package (libVSRocks = binaries, libVSRocks-dev = headers).

Is there a chance that things work in a similar way under OS/X ? If so, you might be lacking the header files for those libraries.

Re: OSX, Cmake and Xcode

Posted: Wed Feb 23, 2011 5:53 pm
by shenle
Things do work the same way in OSX under Fink at least, but:
1. Under Fink I installed both the libxxx and libxxx-devel where applicable
2. I installed ffmpeg from source the old fashioned way (./configure, make, sudo make install); the libraries and headers are there. Cmake finds them and lists the paths to them, then complains about not finding them. It doesn't make sense.
3. At least with one component of GTK2 (Cairo) Cmake finds the headers but not the binaries; both are installed. It finds the binary when I manually point to it, but then still complains. It doesn't make sense.

Re: OSX, Cmake and Xcode

Posted: Wed Feb 23, 2011 7:38 pm
by CLoneWolf
I fear there's no easier alternative than directly watch the code doing the offending checks; I haven't yet recovered from that time, long ago, when I peeked inside a configure script... :roll:

Re: OSX, Cmake and Xcode

Posted: Thu Feb 24, 2011 2:23 am
by shenle
Okayyy...

So I tried to build an OSX binary with autotools... Beside not finding libpng and jpeg that Fink had installed (so I had to reinstall them from source) all went fine until the new autodocking code broke the compile:

Code: Select all

	g++ -DHAVE_CONFIG_H -I. -I../vegastrike   -DBOOST_PYTHON_NO_PY_SIGNATURES -DBOOST_PYTHON_STATIC_LIB -I../vegastrike/boost/1_45  -Wno-long-double   -DHAVE_SDL=1 -DSDL_WINDOWING=1  -I/Developer/SDKs/MacOSX10.3.0.sdk/System/Library/Frameworks/Carbon.framework/Libraries/CIncludes     -DHAVE_AL=1 -I/System/Library/Frameworks/OpenAL.framework/Headers -I/sw/include  -DHAVE_OGG  -DNV_CUBE_MAP=1 -DHAVE_FFMPEG -D__STDC_CONSTANT_MACROS  -I/usr/include/python2.5 -DHAVE_PYTHON=1    -I../vegastrike/src   -I/Developer/SDKs/MacOSX10.2.8sdk/System/Library/Frameworks/Carbon.framework/Libraries/CIncludes -DHAVE_PYTHON=1 -I  -pipe -DNV_CUBE_MAP  -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE -D_REENTRANT -MT src/cmd/ai/autodocking.o -MD -MP -MF $depbase.Tpo -c -o src/cmd/ai/autodocking.o ../vegastrike/src/cmd/ai/autodocking.cpp &&\
	mv -f $depbase.Tpo $depbase.Po
../vegastrike/src/cmd/ai/autodocking.cpp: In member function ‘void Orders::AutoDocking::UndockingState(Unit*, Unit*)’:
../vegastrike/src/cmd/ai/autodocking.cpp:244: error: no match for ‘operator!=’ in ‘it != std::deque<_Tp, _Alloc>::rend() [with _Tp = size_t, _Alloc = std::allocator<std::_Bit_type>]()’
make[1]: *** [src/cmd/ai/autodocking.o] Error 1
make: *** [all] Error 2

Re: OSX, Cmake and Xcode

Posted: Thu Feb 24, 2011 2:38 am
by shenle
Also I see the following during ./configure

Code: Select all

checking ffmpeg/avcodec.h usability... no
checking ffmpeg/avcodec.h presence... no
checking for ffmpeg/avcodec.h... no
checking ffmpeg/avformat.h usability... no
checking ffmpeg/avformat.h presence... no
checking for ffmpeg/avformat.h... no
checking ffmpeg/avio.h usability... no
checking ffmpeg/avio.h presence... no
checking for ffmpeg/avio.h... no
checking libavcodec/avcodec.h usability... no
checking libavcodec/avcodec.h presence... yes
configure: WARNING: libavcodec/avcodec.h: present but cannot be compiled
configure: WARNING: libavcodec/avcodec.h:     check for missing prerequisite headers?
configure: WARNING: libavcodec/avcodec.h: see the Autoconf documentation
configure: WARNING: libavcodec/avcodec.h:     section "Present But Cannot Be Compiled"
configure: WARNING: libavcodec/avcodec.h: proceeding with the preprocessor's result
configure: WARNING: libavcodec/avcodec.h: in the future, the compiler will take precedence
checking for libavcodec/avcodec.h... yes
checking libavformat/avformat.h usability... no
checking libavformat/avformat.h presence... yes
configure: WARNING: libavformat/avformat.h: present but cannot be compiled
configure: WARNING: libavformat/avformat.h:     check for missing prerequisite headers?
configure: WARNING: libavformat/avformat.h: see the Autoconf documentation
configure: WARNING: libavformat/avformat.h:     section "Present But Cannot Be Compiled"
configure: WARNING: libavformat/avformat.h: proceeding with the preprocessor's result
configure: WARNING: libavformat/avformat.h: in the future, the compiler will take precedence
checking for libavformat/avformat.h... yes
checking libavformat/avio.h usability... no
checking libavformat/avio.h presence... yes
configure: WARNING: libavformat/avio.h: present but cannot be compiled
configure: WARNING: libavformat/avio.h:     check for missing prerequisite headers?
configure: WARNING: libavformat/avio.h: see the Autoconf documentation
configure: WARNING: libavformat/avio.h:     section "Present But Cannot Be Compiled"
configure: WARNING: libavformat/avio.h: proceeding with the preprocessor's result
configure: WARNING: libavformat/avio.h: in the future, the compiler will take precedence
checking for libavformat/avio.h... yes
checking for libavcodec and libavformat... yes
checking for libswscale... yes
checking ffmpeg/swscale.h usability... no
checking ffmpeg/swscale.h presence... no
checking for ffmpeg/swscale.h... no
checking libswscale/swscale.h usability... no
checking libswscale/swscale.h presence... yes
configure: WARNING: libswscale/swscale.h: present but cannot be compiled
configure: WARNING: libswscale/swscale.h:     check for missing prerequisite headers?
configure: WARNING: libswscale/swscale.h: see the Autoconf documentation
configure: WARNING: libswscale/swscale.h:     section "Present But Cannot Be Compiled"
configure: WARNING: libswscale/swscale.h: proceeding with the preprocessor's result
configure: WARNING: libswscale/swscale.h: in the future, the compiler will take precedence
checking for libswscale/swscale.h... yes
I wonder if cmake is not the problem after all, and ffmpeg is just broken on OSX...
But I still don't know how to disable it, or GTK2 for that matter, in cmake.

Re: OSX, Cmake and Xcode

Posted: Thu Feb 24, 2011 3:17 am
by klauss
Here

It says required. It shouldn't ;)

Re: OSX, Cmake and Xcode

Posted: Fri Feb 25, 2011 12:46 am
by shenle
Next compile error:

Code: Select all

g++ -DHAVE_CONFIG_H -I. -I../vegastrike   -DBOOST_PYTHON_NO_PY_SIGNATURES -DBOOST_PYTHON_STATIC_LIB -I../vegastrike/boost/1_45  -Wno-long-double   -DHAVE_SDL=1 -DSDL_WINDOWING=1  -I/Developer/SDKs/MacOSX10.3.0.sdk/System/Library/Frameworks/Carbon.framework/Libraries/CIncludes     -DHAVE_AL=1 -I/System/Library/Frameworks/OpenAL.framework/Headers -I/sw/include  -DHAVE_OGG  -DNV_CUBE_MAP=1 -DHAVE_FFMPEG -D__STDC_CONSTANT_MACROS  -I/usr/include/python2.5 -DHAVE_PYTHON=1    -I../vegastrike/src   -I/Developer/SDKs/MacOSX10.2.8sdk/System/Library/Frameworks/Carbon.framework/Libraries/CIncludes -DHAVE_PYTHON=1 -I  -pipe -DNV_CUBE_MAP  -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE -D_REENTRANT -MT src/cmd/unit.o -MD -MP -MF $depbase.Tpo -c -o src/cmd/unit.o ../vegastrike/src/cmd/unit.cpp &&\
	mv -f $depbase.Tpo $depbase.Po
../vegastrike/src/cmd/unit_jump.h:49: error: prototype for ‘bool GameUnit<UnitType>::TransferUnitToSystem(unsigned int, StarSystem*&, bool)’ does not match any in class ‘GameUnit<UnitType>’
../vegastrike/src/cmd/unit.h:134: error: candidate is: bool GameUnit<UnitType>::TransferUnitToSystem(unsigned int, StarSystem*&, bool)
../vegastrike/src/cmd/unit_jump.h:49: error: template definition of non-template ‘bool GameUnit<UnitType>::TransferUnitToSystem(unsigned int, StarSystem*&, bool)’
make[1]: *** [src/cmd/unit.o] Error 1
make: *** [all] Error 2
Again the compiler is

Code: Select all

i686-apple-darwin9-g++-4.0.1 (GCC) 4.0.1 (Apple Inc. build 5493)

Re: OSX, Cmake and Xcode

Posted: Fri Feb 25, 2011 5:54 pm
by breese
shenle wrote:

Code: Select all

../vegastrike/src/cmd/unit_jump.h:49: error: prototype for ‘bool GameUnit<UnitType>::TransferUnitToSystem(unsigned int, StarSystem*&, bool)’ does not match any in class ‘GameUnit<UnitType>’
../vegastrike/src/cmd/unit.h:134: error: candidate is: bool GameUnit<UnitType>::TransferUnitToSystem(unsigned int, StarSystem*&, bool)
../vegastrike/src/cmd/unit_jump.h:49: error: template definition of non-template ‘bool GameUnit<UnitType>::TransferUnitToSystem(unsigned int, StarSystem*&, bool)’
make[1]: *** [src/cmd/unit.o] Error 1
make: *** [all] Error 2
Does it work if you change unit_jump.h:49 to the following (I have inserted "template " after the namespace delimiter)

Code: Select all

bool GameUnit< UnitType >::template TransferUnitToSystem( unsigned int kk, StarSystem* &savedStarSystem, bool dosightandsound )

Re: OSX, Cmake and Xcode

Posted: Fri Feb 25, 2011 6:03 pm
by shenle
I'll try it when I get back home; I'm away until Monday.

Re: OSX, Cmake and Xcode

Posted: Mon Feb 28, 2011 12:55 am
by shenle
Nope.

Code: Select all

	g++ -DHAVE_CONFIG_H -I. -I../vegastrike   -DBOOST_PYTHON_NO_PY_SIGNATURES -DBOOST_PYTHON_STATIC_LIB -I../vegastrike/boost/1_45  -Wno-long-double   -DHAVE_SDL=1 -DSDL_WINDOWING=1  -I/Developer/SDKs/MacOSX10.3.0.sdk/System/Library/Frameworks/Carbon.framework/Libraries/CIncludes     -DHAVE_AL=1 -I/System/Library/Frameworks/OpenAL.framework/Headers -I/sw/include  -DHAVE_OGG  -DNV_CUBE_MAP=1 -DHAVE_FFMPEG -D__STDC_CONSTANT_MACROS  -I/usr/include/python2.5 -DHAVE_PYTHON=1    -I../vegastrike/src   -I/Developer/SDKs/MacOSX10.2.8sdk/System/Library/Frameworks/Carbon.framework/Libraries/CIncludes -DHAVE_PYTHON=1 -I  -pipe -DNV_CUBE_MAP  -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE -D_REENTRANT -MT src/cmd/unit.o -MD -MP -MF $depbase.Tpo -c -o src/cmd/unit.o ../vegastrike/src/cmd/unit.cpp &&\
	mv -f $depbase.Tpo $depbase.Po
../vegastrike/src/cmd/unit_jump.h:49: error: prototype for ‘bool GameUnit<UnitType>::TransferUnitToSystem(unsigned int, StarSystem*&, bool)’ does not match any in class ‘GameUnit<UnitType>’
../vegastrike/src/cmd/unit.h:134: error: candidate is: bool GameUnit<UnitType>::TransferUnitToSystem(unsigned int, StarSystem*&, bool)
../vegastrike/src/cmd/unit_jump.h:49: error: template definition of non-template ‘bool GameUnit<UnitType>::TransferUnitToSystem(unsigned int, StarSystem*&, bool)’
make: *** [src/cmd/unit.o] Error 1
Same error, even though line 49 in unit_jump.h now is

Code: Select all

bool GameUnit< UnitType >::template TransferUnitToSystem( unsigned int kk, StarSystem* &savedStarSystem, bool dosightandsound )

Re: OSX, Cmake and Xcode

Posted: Mon Feb 28, 2011 11:27 am
by ace123
Just committed attempts to solve the starsystem and ffmpeg issues.

The problem was that the header used
bool TransferUnitToSystem(unsigned int, class StarSystem*&, bool)

and the .cpp used
bool GameUnit<UnitType>::TransferUnitToSystem(unsigned int, StarSystem*&, bool) {
}

See the problem?
StarSystem is a class, but because it was not forward-declared, the scope of the forward declaration was just that function, so the "class StarSystem" in the header was a different StarSystem from the StarSystem in the .cpp

The fix was to remove the "class" from the function declaration and add it to the top of the file.

I also fixed detecting ffmpeg in autotools, and it seemed to build okay for me (not using xcode though). I'm still having trouble with Cmake on mac, where it seems to find duplicate libraries.
Cmake is using pkgconfig, but still ignores the library path it specifies for some reason, so I get a bunch of "duplicate dylib" messages followed by undefined symbols from libjpeg. (jpeg_write_scanlines, jpeg_std_error, etc.)

With autotools, I managed to get the game to run, but it crashed about a minute after launching into space, in the ogg and audio code (I forgot to do --enable-debug, darnit)

Re: OSX, Cmake and Xcode

Posted: Mon Feb 28, 2011 12:45 pm
by shenle
Grrr... linker error

Code: Select all

'g++  -I/Developer/SDKs/MacOSX10.2.8sdk/System/Library/Frameworks/Carbon.framework/Libraries/CIncludes -DHAVE_PYTHON=1 -I  -pipe -DNV_CUBE_MAP  -I/usr/local/include/SDL -D_GNU_SOURCE=1 -D_THREAD_SAFE -D_REENTRANT   -o vegastrike  src/cmd/ai/aggressive.o src/cmd/ai/autodocking.o src/cmd/ai/comm_ai.o src/cmd/ai/communication_xml.o src/cmd/ai/communication.o src/cmd/ai/docking.o src/cmd/ai/event_xml.o src/cmd/ai/fire.o src/cmd/ai/fireall.o src/cmd/ai/flybywire.o src/cmd/ai/hard_coded_scripts.o src/cmd/ai/ikarus.o src/cmd/ai/missionscript.o src/cmd/ai/navigation.o src/cmd/ai/order_comm.o src/cmd/ai/order.o src/cmd/ai/script.o src/cmd/ai/tactics.o src/cmd/ai/turretai.o src/cmd/ai/warpto.o src/cmd/alphacurve.o src/cmd/asteroid_generic.o src/cmd/beam_generic.o src/cmd/bolt_generic.o src/cmd/building_generic.o src/cmd/collection.o src/cmd/collide_map.o src/cmd/collide.o src/cmd/container.o src/cmd/csv.o src/cmd/missile_generic.o src/cmd/mount.o src/cmd/nebula_generic.o src/cmd/planet_generic.o src/cmd/role_bitmask.o src/cmd/unit_collide.o src/cmd/unit_const_cache.o src/cmd/unit_csv.o src/cmd/unit_factory_generic.o src/cmd/unit_functions_generic.o src/cmd/unit_generic.o src/cmd/fg_util.o src/cmd/unit_util_generic.o src/cmd/unit_xml.o src/cmd/weapon_xml.o src/cmd/collide2/Ice/IceAABB.o src/cmd/collide2/Ice/IceContainer.o src/cmd/collide2/Ice/IceHPoint.o src/cmd/collide2/Ice/IceIndexedTriangle.o src/cmd/collide2/Ice/IceMatrix3x3.o src/cmd/collide2/Ice/IceMatrix4x4.o src/cmd/collide2/Ice/IceOBB.o src/cmd/collide2/Ice/IcePlane.o src/cmd/collide2/Ice/IcePoint.o src/cmd/collide2/Ice/IceRandom.o src/cmd/collide2/Ice/IceRay.o src/cmd/collide2/Ice/IceRevisitedRadix.o src/cmd/collide2/Ice/IceSegment.o src/cmd/collide2/Ice/IceTriangle.o src/cmd/collide2/Ice/IceUtils.o src/cmd/collide2/csgeom2/opbox.o src/cmd/collide2/csgeom2/opmatrix3.o src/cmd/collide2/csgeom2/opvector3.o src/cmd/collide2/OPC_AABBCollider.o src/cmd/collide2/OPC_AABBTree.o src/cmd/collide2/OPC_BaseModel.o src/cmd/collide2/OPC_BoxPruning.o src/cmd/collide2/OPC_Collider.o src/cmd/collide2/OPC_Common.o src/cmd/collide2/OPC_HybridModel.o src/cmd/collide2/OPC_LSSCollider.o src/cmd/collide2/OPC_MeshInterface.o src/cmd/collide2/OPC_Model.o src/cmd/collide2/OPC_OBBCollider.o src/cmd/collide2/OPC_OptimizedTree.o src/cmd/collide2/OPC_Picking.o src/cmd/collide2/OPC_PlanesCollider.o src/cmd/collide2/OPC_RayCollider.o src/cmd/collide2/OPC_SphereCollider.o src/cmd/collide2/OPC_SweepAndPrune.o src/cmd/collide2/OPC_TreeBuilders.o src/cmd/collide2/OPC_TreeCollider.o src/cmd/collide2/OPC_VolumeCollider.o src/cmd/collide2/CSopcodecollider.o src/networking/inet_file.o src/networking/inet.o src/python/init.o src/python/python_compile.o src/python/unit_exports.o src/python/unit_exports1.o src/python/unit_exports2.o src/python/unit_exports3.o src/python/unit_method_defs.o src/python/unit_wrapper.o src/python/universe_util_export.o src/configxml.o src/easydom.o src/endianness.o src/macosx_math.o src/faction_generic.o src/faction_util_generic.o src/galaxy_gen.o src/galaxy_xml.o src/galaxy.o src/hashtable.o src/lin_time.o src/load_mission.o src/pk3.o src/posh.o src/savegame.o src/star_system_generic.o src/star_system_xml.o src/stardate.o src/universe_generic.o src/universe_util_generic.o src/vs_globals.o src/vsfilesystem.o src/xml_serializer.o src/xml_support.o src/options.o src/cmd/script/director_generic.o src/cmd/script/mission_script.o src/cmd/script/mission.o src/cmd/script/msgcenter.o src/cmd/script/pythonmission.o src/cmd/script/script_call_olist.o src/cmd/script/script_call_omap.o src/cmd/script/script_call_order.o src/cmd/script/script_call_string.o src/cmd/script/script_call_unit_generic.o src/cmd/script/script_callbacks.o src/cmd/script/script_expression.o src/cmd/script/script_generic.o src/cmd/script/script_statement.o src/cmd/script/script_util.o src/cmd/script/script_variables.o src/gfx/cockpit_generic.o src/gfx/lerp.o src/gfx/matrix.o src/gfx/mesh_bxm.o src/gfx/mesh_poly.o src/gfx/mesh_xml.o src/gfx/mesh.o src/gfx/quaternion.o src/gfx/sphere_generic.o src/gfx/vec.o src/XMLDocument.o src/VSFileXMLSerializer.o src/gui/button.o src/gui/control.o src/gui/eventmanager.o src/gui/eventresponder.o src/gui/font.o src/gui/glut_support.o src/gui/groupcontrol.o src/gui/guidefs.o src/gui/guitexture.o src/gui/modaldialog.o src/gui/newbutton.o src/gui/painttext.o src/gui/picker.o src/gui/scroller.o src/gui/simplepicker.o src/gui/slider.o src/gui/staticdisplay.o src/gui/text_area.o src/gui/textinputdisplay.o src/gui/window.o src/gui/windowcontroller.o src/networking/accountsxml.o src/networking/client.o src/networking/fileutil.o src/networking/savenet_util.o src/networking/cubicsplines.o src/networking/mangle.o src/networking/netclient_clients.o src/networking/netclient_devices.o src/networking/netclient_login.o src/networking/netclient.o src/networking/netserver_acct.o src/networking/netserver_clients.o src/networking/netserver_devices.o src/networking/netserver_login.o src/networking/netserver_net.o src/networking/netserver.o src/networking/prediction.o src/networking/zonemgr.o src/networking/networkcomm.o src/networking/webcam_support.o src/cg_global.o src/command.o src/config_xml.o src/debug_vs.o src/faction_util.o src/force_feedback.o src/gamemenu.o src/gfxlib_struct.o src/in_joystick.o src/in_kb.o src/in_main.o src/in_mouse.o src/in_sdl.o src/main_loop.o src/physics.o src/rendertext.o src/ship_commands.o src/star_system_jump.o src/star_system.o src/universe_util.o src/universe.o src/gfx/ani_texture.o src/gfx/animation.o src/gfx/aux_logo.o src/gfx/aux_palette.o src/gfx/aux_texture.o src/gfx/background.o src/gfx/camera.o src/gfx/cockpit_xml.o src/gfx/cockpit.o src/gfx/coord_select.o src/gfx/env_map_gent.o src/gfx/gauge.o src/gfx/halo_system.o src/gfx/halo.o src/gfx/hud.o src/gfx/jpeg_memory.o src/gfx/loc_select.o src/gfx/masks.o src/gfx/mesh_bin.o src/gfx/mesh_fx.o src/gfx/mesh_gfx.o src/gfx/nav/criteria_xml.o src/gfx/nav/criteria.o src/gfx/nav/drawgalaxy.o src/gfx/nav/drawlist.o src/gfx/nav/drawsystem.o src/gfx/nav/navcomputer.o src/gfx/nav/navgetxmldata.o src/gfx/nav/navpath.o src/gfx/nav/navscreen.o src/gfx/nav/navscreenoccupied.o src/gfx/particle.o src/gfx/pipelined_texture.o src/gfx/quadsquare_cull.o src/gfx/quadsquare_render.o src/gfx/quadsquare_update.o src/gfx/quadsquare.o src/gfx/quadtree_xml.o src/gfx/quadtree.o src/gfx/radar/bubble_display.o src/gfx/radar/dual_display.o src/gfx/radar/plane_display.o src/gfx/radar/radar.o src/gfx/radar/sensor.o src/gfx/radar/sphere_display.o src/gfx/radar/track.o src/gfx/radar/viewarea.o src/gfx/ring.o src/gfx/screenshot.o src/gfx/sphere.o src/gfx/sprite.o src/gfx/star.o src/gfx/stream_texture.o src/gfx/tex_transform.o src/gfx/technique.o src/gfx/vdu.o src/gfx/vid_file.o src/ffmpeg_init.o src/gfx/vsbox.o src/gfx/vsimage.o src/gfx/warptrail.o src/audio/CodecRegistry.o src/audio/Stream.o src/audio/Sound.o src/audio/Source.o src/audio/SourceTemplate.o src/audio/SceneManager.o src/audio/Renderer.o src/audio/utils.o src/audio/RenderableSource.o src/audio/RenderableListener.o src/audio/Listener.o src/audio/Scene.o src/audio/SimpleSource.o src/audio/SimpleScene.o src/audio/SimpleSound.o src/audio/SoundBuffer.o src/audio/TemplateManager.o src/audio/codecs/Codec.o src/audio/codecs/FFStream.o src/audio/codecs/OggStream.o src/audio/codecs/OggData.o src/audio/codecs/OggCodec.o src/audio/codecs/FFCodec.o src/audio/renderers/OpenAL/OpenALRenderer.o src/audio/renderers/OpenAL/OpenALRenderableListener.o src/audio/renderers/OpenAL/OpenALRenderableSource.o src/audio/renderers/OpenAL/OpenALRenderableStreamingSource.o src/audio/renderers/OpenAL/OpenALSimpleSound.o src/audio/renderers/OpenAL/OpenALStreamingSound.o src/audio/renderers/OpenAL/OpenALHelpers.o src/audio/test.o src/aldrv/al_globals.o src/cmd/images.o src/aldrv/al_init.o src/aldrv/al_listen.o src/aldrv/al_sound.o src/cmd/ai/firekeyboard.o src/cmd/ai/flyjoystick.o src/cmd/ai/flykeyboard.o src/cmd/asteroid.o src/cmd/atmosphere.o src/cmd/base_init.o src/cmd/base_interface.o src/cmd/base_util.o src/cmd/base_write_python.o src/cmd/base_write_xml.o src/cmd/base_xml.o src/cmd/basecomputer.o src/cmd/beam.o src/cmd/bolt.o src/cmd/briefing.o src/cmd/building.o src/cmd/click_list.o src/cmd/cont_terrain.o src/cmd/faction_xml.o src/cmd/music.o src/cmd/nebula.o src/cmd/pilot.o src/cmd/planet.o src/cmd/script/c_alike/c_alike.tab.o src/cmd/script/c_alike/lex.yy.o src/cmd/script/director.o src/cmd/script/flightgroup.o src/cmd/script/script_call_briefing.o src/cmd/script/script_call_unit.o src/cmd/terrain.o src/cmd/unit_factory.o src/cmd/unit_functions.o src/cmd/unit_interface.o src/cmd/unit_util.o src/cmd/unit.o src/gldrv/gl_program.o src/gldrv/gl_clip.o src/gldrv/gl_fog.o src/gldrv/gl_globals.o src/gldrv/gl_init.o src/gldrv/gl_light_pick.o src/gldrv/gl_light_state.o src/gldrv/gl_light.o src/gldrv/gl_material.o src/gldrv/gl_matrix.o src/gldrv/gl_misc.o src/gldrv/gl_quad_list.o src/gldrv/gl_sphere_list.o src/gldrv/gl_state.o src/gldrv/sdds.o src/gldrv/gl_texture.o src/gldrv/gl_vertex_list.o src/gldrv/winsys.o src/main.o src/python/briefing_wrapper.o libnetlowlevel.a libboost_python.a -lz -lvorbisfile -lvorbis -logg   -F/Developer/SDKs/MacOSX10.3.0.sdk/System/Library/Frameworks  -framework OpenGL -framework GLUT -framework CoreAudio -lobjc -L  -L/usr/local/lib -lSDLmain -lSDL -Wl,-framework,Cocoa  -framework GLUT  -lexpat  -lpng  -ljpeg  -framework OpenAL  -lvorbisfile -lvorbis -logg  -lavcodec -lavformat -lavutil -lswscale -L/usr/lib -lpython2.5 -lpthread 

Undefined symbols:
  "_BZ2_bzDecompress", referenced from:
      _matroska_decode_buffer in libavformat.a(matroskadec.o)
  "_BZ2_bzDecompressInit", referenced from:
      _matroska_decode_buffer in libavformat.a(matroskadec.o)
  "_BZ2_bzDecompressEnd", referenced from:
      _matroska_decode_buffer in libavformat.a(matroskadec.o)
ld: symbol(s) not found
collect2: ld returned 1 exit status
make: *** [vegastrike] Error 1
ss-macpro31:buildmake s$ '
But I _do_ have bzip2 installed... including headers. Guess that's not good enough. Double grrr.

(edit) same error persists if I install the latest version of bzip2 outside of Fink from source.
Trying again to compile with ffmpeg disabled.

Re: OSX, Cmake and Xcode

Posted: Mon Feb 28, 2011 1:16 pm
by shenle
I did get it built (full command line for configure: --disable-ffmpeg --enable-macosx-bundle)

However it crashes while loading, before the main menu.

Attached stderr and stdout. It looks like it can't find some data files.

Also, the built vssetup doesn't launch.

Re: OSX, Cmake and Xcode

Posted: Mon Feb 28, 2011 9:27 pm
by strook
okay, be patient, i'm working on a solution with cmake ;)

you won't come to success with configure :)

Re: OSX, Cmake and Xcode

Posted: Mon Feb 28, 2011 10:38 pm
by strook
here is the solution:

the error was:
you can't use

Code: Select all

if(BLAH_INCLUDES AND BLAH_LIBS)
...
endif(BLAH_INCLUDES AND BLAH_LIBS)
this will always result to false.

you need to use :

Code: Select all

if(NOT BLAH_INCLUDES STREQUAL "")
  if(NOT BLAH_LIBS STREQUAL "")
....
  endif()
endif()

so happy coding with macos ;)

Re: OSX, Cmake and Xcode

Posted: Mon Feb 28, 2011 11:47 pm
by shenle
Actually I did get a binary built with autotools, but it crashes when it can't find some data files (which are there BTW).

But I'll see if I can make cmake work your way.

Re: OSX, Cmake and Xcode

Posted: Tue Mar 01, 2011 12:30 am
by shenle
So I modified findFFMPEG.cmake as you suggested and it still complains of ffmpeg not found.

Re: OSX, Cmake and Xcode

Posted: Tue Mar 01, 2011 11:03 am
by strook
well here is a hacked working findffmpeg.cmake.

it works on my iMac.

Code: Select all

# - Try to find FFmpeg
# Once done this will define
#
#  FFMPEG_FOUND - system has FFmpeg
#  FFMPEG_INCLUDE_DIRS - the FFmpeg include directory
#  FFMPEG_LIBRARIES - Link these to use FFmpeg
#  FFMPEG_DEFINITIONS - Compiler switches required for using FFmpeg
#
#  Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
#
#  Redistribution and use is allowed according to the terms of the New
#  BSD license.
#  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#


if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIRS)
  # in cache already
  set(FFMPEG_FOUND TRUE)
else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIRS)

  # use pkg-config to get the directories and then use these values
  # in the FIND_PATH() and FIND_LIBRARY() calls
  include(FindPkgConfig)

#find avcodec

  find_path(FFMPEG_INCLUDE_DIR
    NAMES
      avcodec.h
    PATHS
      /usr/include
      /usr/include/libavcodec
      /usr/local/include
      /opt/local/include
      /sw/include
    PATH_SUFFIXES
      ffmpeg
      libavcodec
  )

  find_library(AVCODEC_LIBRARY
    NAMES
      avcodec
    PATHS
      /usr/lib
      /usr/local/lib
      /opt/local/lib
      /sw/lib
  )

if(NOT AVCODEC_LIBRARY)
  pkg_check_modules(ffmpeg1 REQUIRED libavcodec)
  SET(_FFMPEGIncDir ${ffmpeg1_INCLUDE_DIRS})
  SET(_FFMPEGLinkDir ${ffmpeg1_LIBRARY_DIRS})
  SET(_FFMPEGLinkFlags ${ffmpeg1_LDFLAGS})
  SET(_FFMPEGCflags ${ffmpeg1_CFLAGS})
  
  SET(FFMPEG_LIBRARIES)
  SET(FFMPEG_DEFINITIONS ${_FFMPEGCflags} -D__STDC_CONSTANT_MACROS)

  find_path(FFMPEG_INCLUDE_DIR
    NAMES
      avcodec.h
    PATHS
      ${_FFMPEGIncDir}
    PATH_SUFFIXES
      ffmpeg
      libavcodec
  )

  find_library(AVCODEC_LIBRARY
    NAMES
      avcodec
    PATHS
      ${_FFMPEGLinkDir}
  )
endif(NOT AVCODEC_LIBRARY)

  set(FFMPEG_INCLUDE_DIRS
    ${FFMPEG_INCLUDE_DIRS}
    ${FFMPEG_INCLUDE_DIR}
  )

  if (AVCODEC_LIBRARY)
    set(FFMPEG_LIBRARIES
      ${FFMPEG_LIBRARIES}
      ${AVCODEC_LIBRARY}
    )
  endif (AVCODEC_LIBRARY)

#find avformat
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        find_path(AVFORMAT_INCLUDE_DIR
    NAMES
      avformat.h
      avio.h
    PATHS
      /usr/include
      /usr/local/include
      /opt/local/include
      /sw/include
    PATH_SUFFIXES
      ffmpeg
      libavformat
  )

  find_library(AVFORMAT_LIBRARY
    NAMES
      avformat
    PATHS
      /usr/lib
      /usr/local/lib
      /opt/local/lib
      /sw/lib
  )

  if (NOT AVFORMAT_LIBRARY)
  pkg_check_modules(avformat1 REQUIRED libavformat)
    SET(_AVFORMATIncDir ${avformat1_INCLUDE_DIRS})
    SET(_AVFORMATLinkDir ${avformat1_LIBRARY_DIRS})
    SET(_AVFORMATLinkFlags ${avformat1_LDFLAGS})
    SET(_AVFORMATCflags ${avformat1_CFLAGS})

    set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${_AVFORMATCflags})
  
  find_path(AVFORMAT_INCLUDE_DIR
    NAMES
      avformat.h
      avio.h
    PATHS
      ${_AVFORMATIncDir}
      ${_FFMPEGIncDir}
    PATH_SUFFIXES
      ffmpeg
      libavformat
  )

    find_library(AVFORMAT_LIBRARY
      NAMES
        libavformat.a
      PATHS
        ${_AVFORMATLinkDir}
        ${_FFMPEGLinkDir}
    )
  endif (NOT AVFORMAT_LIBRARY)


  set(FFMPEG_INCLUDE_DIRS
    ${FFMPEG_INCLUDE_DIRS}
    ${AVFORMAT_INCLUDE_DIR}
  )
  
  if (AVFORMAT_LIBRARY)
    set(FFMPEG_LIBRARIES
      ${FFMPEG_LIBRARIES}
      ${AVFORMAT_LIBRARY}
    )
  endif (AVFORMAT_LIBRARY)

#find avutil
  
  find_library(AVUTIL_LIBRARY
    NAMES
      avutil
    PATHS
      /usr/lib
      /usr/local/lib
      /opt/local/lib
      /sw/lib
  )

if(NOT AVUTIL_LIBRARY)
  pkg_check_modules(avutil1 REQUIRED libavutil)
  SET(_AVUTILIncDir ${avutil1_INCLUDE_DIRS})
  SET(_AVUTILLinkDir ${avutil1_LIBRARY_DIRS})
  SET(_AVUTILLinkFlags ${avutil1_LDFLAGS})
  SET(_AVUTILCflags ${avutil1_CFLAGS})

  set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${_AVUTILCflags})
  
  find_library(AVUTIL_LIBRARY
    NAMES
      avutil
    PATHS
      ${_AVUTILLinkDir}
      ${_FFMPEGLinkDir}
  )
endif(NOT AVUTIL_LIBRARY)

  if (AVUTIL_LIBRARY)
    set(FFMPEG_LIBRARIES
      ${FFMPEG_LIBRARIES}
      ${AVUTIL_LIBRARY}
    )
  endif (AVUTIL_LIBRARY)

#find swscale
  
    find_path(SWSCALE_INCLUDE_DIR
      NAMES
        swscale.h
      PATHS
        /usr/include
        /usr/local/include
        /opt/local/include
        /sw/include
      PATH_SUFFIXES
        ffmpeg
        libswscale
    )

  find_library(swscale1_LIBRARIES
    NAMES
      swscale1
    PATHS
      /usr/lib
      /usr/local/lib
      /opt/local/lib
      /sw/lib
  )


SET(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${swscale1_LIBRARIES})

if(NOT SWSCALE_INCLUDE_DIR)
  pkg_check_modules(swscale1 libswscale)
  SET(_SWSCALEIncDir ${swscale1_INCLUDE_DIRS})
  SET(_SWSCALELinkDir ${swscale1_LIBRARY_DIRS})
  SET(_SWSCALELinkFlags ${swscale1_LDFLAGS})
  SET(_SWSCALECflags ${swscale1_CFLAGS})
  
  set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${_SWSCALECflags})
  
  IF(swscale1_FOUND)
    SET(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${swscale1_LIBRARIES})

    find_path(SWSCALE_INCLUDE_DIR
      NAMES
        swscale.h
      PATHS
        ${_SWSCALEIncDir}
      PATH_SUFFIXES
        ffmpeg
        libswscale
    )

    
    set(FFMPEG_INCLUDE_DIRS
      ${FFMPEG_INCLUDE_DIRS}
      ${SWSCALE_INCLUDE_DIR}
    )
  
    SET(HAVE_SWSCALE_H 1)
  ENDIF(swscale1_FOUND)
endif(NOT SWSCALE_INCLUDE_DIR)

endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIRS)

  
  if (NOT FFMPEG_INCLUDE_DIRS STREQUAL "") 
    if(NOT FFMPEG_LIBRARIES STREQUAL "")
     set(FFMPEG_FOUND TRUE)
     set(HAVE_AVFORMAT_H 1)
     set(HAVE_AVCODEC_H 1)
     set(HAVE_AVIO_H 1)
    endif()
  endif ()

  if (FFMPEG_FOUND)
    if (NOT FFMPEG_FIND_QUIETLY)
      message(STATUS "Found FFmpeg: ${FFMPEG_LIBRARIES}")
    endif (NOT FFMPEG_FIND_QUIETLY)
  else (FFMPEG_FOUND)
    if (FFMPEG_FIND_REQUIRED)
      message(FATAL_ERROR "Could not find FFmpeg")
    endif (FFMPEG_FIND_REQUIRED)
  endif (FFMPEG_FOUND)

  # show the FFMPEG_INCLUDE_DIRS and FFMPEG_LIBRARIES variables only in the advanced view
  mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES)

#debug stuff
message("ffmpeg including: ${FFMPEG_INCLUDE_DIRS}")
message("ffmpeg links: ${FFMPEG_LIBRARIES}")

Re: OSX, Cmake and Xcode

Posted: Tue Mar 01, 2011 4:43 pm
by strook
here is a bugfix:



Code: Select all

# - Try to find FFmpeg
# Once done this will define
#
#  FFMPEG_FOUND - system has FFmpeg
#  FFMPEG_INCLUDE_DIRS - the FFmpeg include directory
#  FFMPEG_LIBRARIES - Link these to use FFmpeg
#  FFMPEG_DEFINITIONS - Compiler switches required for using FFmpeg
#
#  Copyright (c) 2006 Andreas Schneider <mail@cynapses.org>
#
#  Redistribution and use is allowed according to the terms of the New
#  BSD license.
#  For details see the accompanying COPYING-CMAKE-SCRIPTS file.
#


if (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIRS)
  # in cache already
  set(FFMPEG_FOUND TRUE)
else (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIRS)

  # use pkg-config to get the directories and then use these values
  # in the FIND_PATH() and FIND_LIBRARY() calls
  include(FindPkgConfig)

#find avcodec

  find_path(FFMPEG_INCLUDE_DIR
    NAMES
      avcodec.h
    PATHS
      /usr/include
      /usr/include/libavcodec
      /usr/local/include
      /opt/local/include
      /sw/include
    PATH_SUFFIXES
      ffmpeg
      libavcodec
  )

  find_library(AVCODEC_LIBRARY
    NAMES
      avcodec
    PATHS
      /usr/lib
      /usr/local/lib
      /opt/local/lib
      /sw/lib
  )

if(NOT AVCODEC_LIBRARY)
  pkg_check_modules(ffmpeg1 REQUIRED libavcodec)
  SET(_FFMPEGIncDir ${ffmpeg1_INCLUDE_DIRS})
  SET(_FFMPEGLinkDir ${ffmpeg1_LIBRARY_DIRS})
  SET(_FFMPEGLinkFlags ${ffmpeg1_LDFLAGS})
  SET(_FFMPEGCflags ${ffmpeg1_CFLAGS})
  
  SET(FFMPEG_LIBRARIES)
  SET(FFMPEG_DEFINITIONS ${_FFMPEGCflags} -D__STDC_CONSTANT_MACROS)

  find_path(FFMPEG_INCLUDE_DIR
    NAMES
      avcodec.h
    PATHS
      ${_FFMPEGIncDir}
    PATH_SUFFIXES
      ffmpeg
      libavcodec
  )

  find_library(AVCODEC_LIBRARY
    NAMES
      avcodec
    PATHS
      ${_FFMPEGLinkDir}
  )
endif(NOT AVCODEC_LIBRARY)

  set(FFMPEG_INCLUDE_DIRS
    ${FFMPEG_INCLUDE_DIRS}
    ${FFMPEG_INCLUDE_DIR}
  )

  if (AVCODEC_LIBRARY)
    set(FFMPEG_LIBRARIES
      ${FFMPEG_LIBRARIES}
      ${AVCODEC_LIBRARY}
    )
  endif (AVCODEC_LIBRARY)

#find avformat
                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                        find_path(AVFORMAT_INCLUDE_DIR
    NAMES
      avformat.h
      avio.h
    PATHS
      /usr/include
      /usr/local/include
      /opt/local/include
      /sw/include
    PATH_SUFFIXES
      ffmpeg
      libavformat
  )

  find_library(AVFORMAT_LIBRARY
    NAMES
      avformat
    PATHS
      /usr/lib
      /usr/local/lib
      /opt/local/lib
      /sw/lib
  )

  if (NOT AVFORMAT_LIBRARY)
  pkg_check_modules(avformat1 REQUIRED libavformat)
    SET(_AVFORMATIncDir ${avformat1_INCLUDE_DIRS})
    SET(_AVFORMATLinkDir ${avformat1_LIBRARY_DIRS})
    SET(_AVFORMATLinkFlags ${avformat1_LDFLAGS})
    SET(_AVFORMATCflags ${avformat1_CFLAGS})

    set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${_AVFORMATCflags})
  
  find_path(AVFORMAT_INCLUDE_DIR
    NAMES
      avformat.h
      avio.h
    PATHS
      ${_AVFORMATIncDir}
      ${_FFMPEGIncDir}
    PATH_SUFFIXES
      ffmpeg
      libavformat
  )

    find_library(AVFORMAT_LIBRARY
      NAMES
        libavformat.a
      PATHS
        ${_AVFORMATLinkDir}
        ${_FFMPEGLinkDir}
    )
  endif (NOT AVFORMAT_LIBRARY)


  set(FFMPEG_INCLUDE_DIRS
    ${FFMPEG_INCLUDE_DIRS}
    ${AVFORMAT_INCLUDE_DIR}
  )
  
  if (AVFORMAT_LIBRARY)
    set(FFMPEG_LIBRARIES
      ${FFMPEG_LIBRARIES}
      ${AVFORMAT_LIBRARY}
    )
  endif (AVFORMAT_LIBRARY)

#find avutil
  
  find_library(AVUTIL_LIBRARY
    NAMES
      avutil
    PATHS
      /usr/lib
      /usr/local/lib
      /opt/local/lib
      /sw/lib
  )

if(NOT AVUTIL_LIBRARY)
  pkg_check_modules(avutil1 REQUIRED libavutil)
  SET(_AVUTILIncDir ${avutil1_INCLUDE_DIRS})
  SET(_AVUTILLinkDir ${avutil1_LIBRARY_DIRS})
  SET(_AVUTILLinkFlags ${avutil1_LDFLAGS})
  SET(_AVUTILCflags ${avutil1_CFLAGS})

  set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${_AVUTILCflags})
  
  find_library(AVUTIL_LIBRARY
    NAMES
      avutil
    PATHS
      ${_AVUTILLinkDir}
      ${_FFMPEGLinkDir}
  )
endif(NOT AVUTIL_LIBRARY)

  if (AVUTIL_LIBRARY)
    set(FFMPEG_LIBRARIES
      ${FFMPEG_LIBRARIES}
      ${AVUTIL_LIBRARY}
    )
  endif (AVUTIL_LIBRARY)

#find swscale
  
    find_path(SWSCALE_INCLUDE_DIR
      NAMES
        swscale.h
      PATHS
        /usr/include
        /usr/local/include
        /opt/local/include
        /sw/include
      PATH_SUFFIXES
        ffmpeg
        libswscale
    )

  find_library(swscale1_LIBRARIES
    NAMES
      swscale
    PATHS
      /usr/lib
      /usr/local/lib
      /opt/local/lib
      /sw/lib
  )


if(NOT swscale1_LIBRARIES STREQUAL "")
  SET(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${swscale1_LIBRARIES})
  set(swscale1_FOUND TRUE)
endif()

if(SWSCALE_INCLUDE_DIR STREQUAL "")
  pkg_check_modules(swscale1 libswscale)
  SET(_SWSCALEIncDir ${swscale1_INCLUDE_DIRS})
  SET(_SWSCALELinkDir ${swscale1_LIBRARY_DIRS})
  SET(_SWSCALELinkFlags ${swscale1_LDFLAGS})
  SET(_SWSCALECflags ${swscale1_CFLAGS})
  
  set(FFMPEG_DEFINITIONS ${FFMPEG_DEFINITIONS} ${_SWSCALECflags})
  
  IF(swscale1_FOUND)
    SET(FFMPEG_LIBRARIES ${FFMPEG_LIBRARIES} ${swscale1_LIBRARIES})

    find_path(SWSCALE_INCLUDE_DIR
      NAMES
        swscale.h
      PATHS
        ${_SWSCALEIncDir}
      PATH_SUFFIXES
        ffmpeg
        libswscale
    )

    
    set(FFMPEG_INCLUDE_DIRS
      ${FFMPEG_INCLUDE_DIRS}
      ${SWSCALE_INCLUDE_DIR}
    )
  
    SET(HAVE_SWSCALE_H 1)
  ENDIF(swscale1_FOUND)

endif ()
endif (FFMPEG_LIBRARIES AND FFMPEG_INCLUDE_DIRS)
  
  if (NOT FFMPEG_INCLUDE_DIRS STREQUAL "") 
    if(NOT FFMPEG_LIBRARIES STREQUAL "")
     set(FFMPEG_FOUND TRUE)
     set(HAVE_AVFORMAT_H 1)
     set(HAVE_AVCODEC_H 1)
     set(HAVE_AVIO_H 1)
    endif()
  endif ()

  if (FFMPEG_FOUND)
    if (NOT FFMPEG_FIND_QUIETLY)
      message(STATUS "Found FFmpeg: ${FFMPEG_LIBRARIES}")
    endif (NOT FFMPEG_FIND_QUIETLY)
  else (FFMPEG_FOUND)
    if (FFMPEG_FIND_REQUIRED)
      message(FATAL_ERROR "Could not find FFmpeg")
    endif (FFMPEG_FIND_REQUIRED)
  endif (FFMPEG_FOUND)

  # show the FFMPEG_INCLUDE_DIRS and FFMPEG_LIBRARIES variables only in the advanced view
  mark_as_advanced(FFMPEG_INCLUDE_DIRS FFMPEG_LIBRARIES)

#debug stuff
message("ffmpeg including: ${FFMPEG_INCLUDE_DIRS}")
message("ffmpeg links: ${FFMPEG_LIBRARIES}")






Re: OSX, Cmake and Xcode

Posted: Wed Mar 02, 2011 2:44 am
by shenle
OK that works for ffmpeg.

It still can't gind GTKGL (includes and libs) and Cairo (libs only - it does find the includes). No amount of findgtk2.cmake tweaking has resulted in any progress. Can't figure out how to disable the GTK2-dependent portions of the build (setup) either.

Re: OSX, Cmake and Xcode

Posted: Wed Mar 02, 2011 3:31 am
by shenle
I was able to get over the GTK2 problem by deleting findgtk2.cmake altogether from the source tree. Then cmake proceeded and I could generate a project. Compiling in xcode resulted in errors, so no binary.

Here are the errors:

1.common.h, line 168: 'UINT64_C' was not declared in this scope (this error repeats 3 times)

Code: Select all

    if ((a+0x80000000u) & ~UINT64_C(0xFFFFFFFF)) return (a>>63) ^ 0x7FFFFFFF;
2. png.h, 795: forward declaration of 'struct png_struct_def'

Code: Select all

typedef struct png_struct_def png_struct;
3. vid_file.cpp, 73: 'img_convert' was not declared in this scope

Code: Select all

#ifdef DEPRECATED_IMG_CONVERT
            img_convert(
                (AVPicture*) pFrameRGB, PIX_FMT_RGB24,
                (AVPicture*) pNextFrameYUV, pCodecCtx->pix_fmt,
                pCodecCtx->width, pCodecCtx->height );
4. vsimage.cpp, 870: invalid use of undefined type 'struct png_struct_def'

Code: Select all

if ( setjmp( png_ptr->jmpbuf ) ) {
        png_destroy_write_struct( &png_ptr, &info_ptr );
        return BadFormat;
    }

Re: OSX, Cmake and Xcode

Posted: Wed Mar 02, 2011 4:38 am
by klauss
Paste the full log, the context is usually even more important than the error line.