Created
March 16, 2012 17:26
-
-
Save edy555/2051274 to your computer and use it in GitHub Desktop.
patch to openlase for MacOSX with cmake
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/Modules/CMakeASM_YASMInformation.cmake b/Modules/CMakeASM_YASMInformation.cmake | |
index 50b2848..3d7b330 100644 | |
--- a/Modules/CMakeASM_YASMInformation.cmake | |
+++ b/Modules/CMakeASM_YASMInformation.cmake | |
@@ -1,7 +1,13 @@ | |
set(ASM_DIALECT "_YASM") | |
set(CMAKE_ASM${ASM_DIALECT}_SOURCE_FILE_EXTENSIONS asm) | |
-if(UNIX) | |
+if(APPLE) | |
+ if(BITS EQUAL 64) | |
+ set(CMAKE_ASM_YASM_COMPILER_ARG1 "-f macho64 -DARCH_X86_64 -DPREFIX") | |
+ else() | |
+ set(CMAKE_ASM_YASM_COMPILER_ARG1 "-f macho32 -DPREFIX") | |
+ endif() | |
+elseif(UNIX) | |
if(BITS EQUAL 64) | |
set(CMAKE_ASM_YASM_COMPILER_ARG1 "-f elf64 -DARCH_X86_64") | |
else() | |
diff --git a/examples/27c3_slides/CMakeLists.txt b/examples/27c3_slides/CMakeLists.txt | |
index 5140fd0..248ef12 100644 | |
--- a/examples/27c3_slides/CMakeLists.txt | |
+++ b/examples/27c3_slides/CMakeLists.txt | |
@@ -30,6 +30,10 @@ if(CURSES_FOUND AND FFMPEG_FOUND) | |
target_link_libraries(slides openlase ${FFMPEG_LIBRARIES} ${CURSES_LIBRARIES}) | |
+ if(APPLE) | |
+ target_link_libraries(slides "-framework CoreFoundation" "-framework VideoDecodeAcceleration" "-framework QuartzCore" bz2 z) | |
+ endif(APPLE) | |
+ | |
function(svg2ild NAME) | |
add_custom_command(OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${NAME}.ild | |
DEPENDS ${CMAKE_SOURCE_DIR}/tools/svg2ild.py | |
diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt | |
index 0fe680d..092fce1 100644 | |
--- a/examples/CMakeLists.txt | |
+++ b/examples/CMakeLists.txt | |
@@ -25,8 +25,10 @@ target_link_libraries(circlescope ${JACK_LIBRARIES} m) | |
add_executable(simple simple.c) | |
target_link_libraries(simple openlase) | |
+if(NOT APPLE) | |
add_executable(pong pong.c) | |
target_link_libraries(pong openlase) | |
+endif() | |
if(ALSA_FOUND) | |
add_executable(midiview midiview.c) | |
diff --git a/libol/CMakeLists.txt b/libol/CMakeLists.txt | |
index 7fe2fcd..f1db138 100644 | |
--- a/libol/CMakeLists.txt | |
+++ b/libol/CMakeLists.txt | |
@@ -15,6 +15,7 @@ | |
# along with this program; if not, write to the Free Software | |
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
# | |
+include (CheckFunctionExists) | |
check_include_files(malloc.h HAVE_MALLOC_H) | |
check_function_exists(memalign HAVE_MEMALIGN) | |
diff --git a/libol/trace.c b/libol/trace.c | |
index 8439830..829d8d6 100644 | |
--- a/libol/trace.c | |
+++ b/libol/trace.c | |
@@ -22,7 +22,9 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
#include <string.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
+#ifdef HAVE_MALLOC_H | |
#include <malloc.h> | |
+#endif | |
#include "trace.h" | |
#include "align.h" | |
diff --git a/tools/CMakeLists.txt b/tools/CMakeLists.txt | |
index 9a4b18b..5b64905 100644 | |
--- a/tools/CMakeLists.txt | |
+++ b/tools/CMakeLists.txt | |
@@ -24,7 +24,11 @@ target_link_libraries(playilda ${JACK_LIBRARIES}) | |
if(FFMPEG_FOUND) | |
add_executable(playvid playvid.c) | |
- target_link_libraries(playvid openlase ${FFMPEG_LIBRARIES}) | |
+ target_link_libraries(playvid openlase ${FFMPEG_LIBRARIES}) | |
+ | |
+ if(APPLE) | |
+ target_link_libraries(playvid "-framework CoreFoundation" "-framework VideoDecodeAcceleration" "-framework QuartzCore" bz2 z) | |
+ endif(APPLE) | |
else() | |
message(STATUS "Will NOT build playvid (FFmpeg missing)") | |
endif() | |
diff --git a/tools/playvid.c b/tools/playvid.c | |
index ba9af3c..51def04 100644 | |
--- a/tools/playvid.c | |
+++ b/tools/playvid.c | |
@@ -158,7 +158,6 @@ int av_vid_init(char *file) | |
return -1; | |
dump_format(pFormatCtx, 0, file, 0); | |
- | |
videoStream=-1; | |
for (i=0; i<pFormatCtx->nb_streams; i++) { | |
if (pFormatCtx->streams[i]->codec->codec_type==CODEC_TYPE_VIDEO) { | |
diff --git a/tools/simulator.c b/tools/simulator.c | |
index 924887b..4664b0e 100644 | |
--- a/tools/simulator.c | |
+++ b/tools/simulator.c | |
@@ -25,9 +25,15 @@ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA | |
#include <math.h> | |
#include <jack/jack.h> | |
+#ifdef __APPLE__ | |
+#include <GLUT/glut.h> | |
+#include <OpenGL/gl.h> | |
+#include <OpenGL/glu.h> | |
+#else | |
#include <GL/glut.h> | |
#include <GL/gl.h> | |
#include <GL/glu.h> | |
+#endif | |
int window; | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Cool, I'm glad you got it working on OSX! We had an early version running on OSX quite a while ago, but I hadn't tested building on OSX ever since then. Can I merge your patch to my repo? :)