Skip to content

Commit 87c1b24

Browse files
committed
Manic Miner Machine (Apple II emulator fore MM)
1 parent 3b846d0 commit 87c1b24

File tree

2 files changed

+27
-9
lines changed

2 files changed

+27
-9
lines changed

src/mmm/CMakeLists.txt

Lines changed: 26 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# This file is abysmal. I can't stand working with these 3rd party libraries because, for me at
2+
# least, nothing ever works as advertised. If you know what you are doing and you want to build
3+
# this, what's here can be a guide to get you going. I built this on macOS (not this file) and
4+
# WIN32. After I modified it for macOS the WIN32 broke so I modified it for WIN32 and now the
5+
# APPLE is broken. Probably an easy fix if you knwo what you are doing which I cleary don't when
6+
# it comes to SDL
7+
18
cmake_minimum_required(VERSION 3.16)
29

310
# Set project name
@@ -7,10 +14,18 @@ project(mmm LANGUAGES C)
714
set(CMAKE_CXX_STANDARD 11)
815
set(CMAKE_CXX_STANDARD_REQUIRED True)
916

10-
# Find SDL2, SDL2_image, and SDL2_mixer
11-
find_package(SDL2 REQUIRED)
12-
find_package(SDL2_image REQUIRED)
13-
find_package(SDL2_mixer REQUIRED)
17+
# Find SDL2, SDL2_image, and SDL2_mixer using pkg-config for macOS
18+
if (APPLE)
19+
find_package(PkgConfig REQUIRED)
20+
pkg_check_modules(SDL2 REQUIRED sdl2)
21+
pkg_check_modules(SDL2_image REQUIRED sdl2_image)
22+
pkg_check_modules(SDL2_mixer REQUIRED sdl2_mixer)
23+
else()
24+
# Find SDL2, SDL2_image, and SDL2_mixer for other platforms
25+
find_package(SDL2 REQUIRED)
26+
find_package(SDL2_image REQUIRED)
27+
find_package(SDL2_mixer REQUIRED)
28+
endif()
1429

1530
# Add the executable
1631
add_executable(${PROJECT_NAME}
@@ -33,9 +48,10 @@ target_link_libraries(${PROJECT_NAME}
3348
${SDL2_IMAGE_LIBRARIES}
3449
)
3550

36-
# I need this on Windows. Why this is such a struggle eludes me
37-
if (WIN32)
38-
# Fallback for Windows if SDL2_IMAGE_LIBRARIES is not found
51+
# Link libraries depending on platform
52+
if (APPLE)
53+
target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARIES} ${SDL2_image_LIBRARIES} ${SDL2_mixer_LIBRARIES})
54+
elseif(WIN32)
3955
target_link_libraries(${PROJECT_NAME}
4056
"C:/Users/swessels/develop/github/external/vcpkg/installed/x64-windows/lib/SDL2.lib"
4157
"C:/Users/swessels/develop/github/external/vcpkg/installed/x64-windows/lib/SDL2_image.lib"
@@ -53,5 +69,7 @@ if (WIN32)
5369
$<TARGET_FILE_DIR:${PROJECT_NAME}>
5470
)
5571
endforeach()
56-
72+
else()
73+
# Link libraries for non-Apple, non-Windows platforms (Linux, etc.)
74+
target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARIES} ${SDL2_image_LIBRARIES} ${SDL2_mixer_LIBRARIES})
5775
endif()

src/mmm/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ The CMakeLists.txt file works for my installation. This is my note at the top w
1919
# least, nothing ever works as advertised. If you know what you are doing and you want to build
2020
# this, what's here can be a guide to get you going. I built this on macOS (not this file) and
2121
# WIN32. After I modified it for macOS the WIN32 broke so I modified it for WIN32 and now the
22-
# APPLE is broken. Probably an easy fix if you knwo what you are doing which I cleary don't when
22+
# APPLE is broken. Probably an easy fix if you know what you are doing which I clearly don't when
2323
# it comes to SDL
2424
```
2525

0 commit comments

Comments
 (0)