[ Thread Index |
Date Index
| More lists.liballeg.org/allegro-developers Archives
]
On 2008-02-19, Peter Hull <peterhull90@xxxxxxxxxx> wrote:
> Right, I've taken that diff, changed the file list a bit and done a
> couple of other things that I suspect aren't right(!). New diff is
> pasted below.
> 1. I put in "set(WANT_X11 off)" whenever ALLEGRO_MACOSX is defined. In
> theory it should be possible to do an X11 build of Allegro on a Mac,
> just treat it as a Unix box and don't use any Cocoa code at all. I
> don't know how one would specify that in CMake terms.
> 2. UNIX vs ALLEGRO_UNIX. As you point out, CMake defines UNIX on OS X.
> We are using some of the files from src/unix but not all. Therefore I
> don't want all the files from ALLEGRO_SRC_UNIX_FILES, just the ones I
> listed in ALLEGRO_SRC_MACOSX_FILES. So I changed a UNIX to
> ALLEGRO_UNIX.
My intention was that build-system related variables and variables set only
to make #define VAR appear should be two separate things. So I created a new
variable NON_MACOSX_UNIX and tested for that.
> Now it will compile but not link the dynamic library - it fails with
> ld: common symbols not allowed with MH_DYLIB output format with the
> -multi_module option
> I've not investigated that error yet.
I didn't get that, but I got undefined references. I think it needs to link
against the standard frameworks. Now I can build and link the library, but
linking any executables gives an undefined reference error concerning `main'.
[ 50%] Building C object addons/font/CMakeFiles/ex.dir/ex.o
Linking C executable ex
Undefined symbols:
"_main", referenced from:
start in crt1.10.5.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
Peter
Index: cmake/FileList.cmake
===================================================================
--- cmake/FileList.cmake (revision 10011)
+++ cmake/FileList.cmake (working copy)
@@ -379,19 +379,15 @@
src/macosx/hidman.m
src/macosx/keybd.m
src/macosx/pcpu.m
- src/macosx/qtmidi.m
- src/macosx/quartz.m
- src/macosx/qzfull.m
src/macosx/qzmouse.m
- src/macosx/qzwindow.m
- src/macosx/soundman.m
src/macosx/system.m
+ src/macosx/osxgl.m
src/unix/ufile.c
- src/unix/usystem.c
src/unix/uthreads.c
src/unix/utime.c
src/unix/uxthread.c
src/misc/colconv.c
+ src/opengl/extensions.c
)
set(ALLEGRO_MODULE_VGA_FILES
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt (revision 10011)
+++ CMakeLists.txt (working copy)
@@ -133,14 +133,22 @@
set(CMAKE_INSTALL_PREFIX ${MINGDIR})
endif(MINGW)
-if(UNIX)
- set(ALLEGRO_UNIX 1)
-endif(UNIX)
-
if(COMPILER_MSVC)
set(ALLEGRO_MSVC 1)
endif(COMPILER_MSVC)
+if(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ set(MACOSX 1)
+ set(ALLEGRO_MACOSX 1)
+ set(WANT_X11 off)
+else(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+ # Note: UNIX includes MacOS X, but ALLEGRO_UNIX doesn't.
+ if(UNIX)
+ set(ALLEGRO_UNIX 1)
+ set(NON_MACOSX_UNIX 1)
+ endif(UNIX)
+endif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
+
# Begin tests.
include(TestBigEndian)
@@ -518,6 +526,24 @@
endif(WIN32)
#
+# MacOS X
+#
+
+if(MACOSX)
+ # XXX I don't know if this is the best way to do it.
+ find_library(COCOA_LIBRARY Cocoa)
+ find_library(CARBON_LIBRARY Carbon)
+ find_library(IOKIT_LIBRARY IOKit)
+ find_library(SYSTEM_LIBRARY System)
+ find_library(COREAUDIO_LIBRARY CoreAudio)
+ find_library(AUDIOUNIT_LIBRARY AudioUnit)
+ find_library(AUDIOTOOLBOX_LIBRARY AudioToolbox)
+ find_library(QUICKTIME_LIBRARY QuickTime)
+
+ include(FindOpenGL)
+endif(MACOSX)
+
+#
# Produce configuration files.
# All relevant variables must be set before here.
#
@@ -560,13 +586,13 @@
# e.g. -lm on Unix.
set(PLATFORM_LIBS)
-if(UNIX)
+if(NON_MACOSX_UNIX)
list(APPEND LIBRARY_SOURCES ${ALLEGRO_SRC_UNIX_FILES})
list(APPEND PLATFORM_LIBS m pthread)
if(NOT SUPPORT_MODULES)
list(APPEND PLATFORM_LIBS "${DRIVER_LIBS_STATIC}")
endif(NOT SUPPORT_MODULES)
-endif(UNIX)
+endif(NON_MACOSX_UNIX)
if(SUPPORT_LINUX_CONSOLE)
list(APPEND LIBRARY_SOURCES ${ALLEGRO_SRC_LINUX_FILES})
@@ -592,6 +618,24 @@
endif(SUPPORT_D3D)
endif(WIN32)
+if(MACOSX)
+ list(APPEND LIBRARY_SOURCES ${ALLEGRO_SRC_MACOSX_FILES})
+
+ # Link against standard libraries.
+ # XXX do we need all of these?
+ list(APPEND PLATFORM_LIBS
+ ${COCOA_LIBRARY}
+ ${CARBON_LIBRARY}
+ ${IOKIT_LIBRARY}
+ ${SYSTEM_LIBRARY}
+ ${COREAUDIO_LIBRARY}
+ ${AUDIOUNIT_LIBRARY}
+ ${AUDIOTOOLBOX_LIBRARY}
+ ${QUICKTIME_LIBRARY}
+ ${OPENGL_LIBRARIES}
+ )
+endif(MACOSX)
+
#-----------------------------------------------------------------------------#
if(STRICT_WARN)
Index: include/allegro5/platform/alplatf.h.cmake
===================================================================
--- include/allegro5/platform/alplatf.h.cmake (revision 10011)
+++ include/allegro5/platform/alplatf.h.cmake (working copy)
@@ -2,6 +2,8 @@
#cmakedefine ALLEGRO_MINGW32
#cmakedefine ALLEGRO_UNIX
#cmakedefine ALLEGRO_MSVC
+#cmakedefine ALLEGRO_MACOSX
+
#cmakedefine ALLEGRO_D3D
#cmakedefine ALLEGRO_NO_ASM