Skip to content

Commit

Permalink
Manic Miner Machine (Apple II emulator fore MM)
Browse files Browse the repository at this point in the history
  • Loading branch information
StewBC committed Sep 10, 2024
1 parent 3b846d0 commit 87c1b24
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
34 changes: 26 additions & 8 deletions src/mmm/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# This file is abysmal. I can't stand working with these 3rd party libraries because, for me at
# least, nothing ever works as advertised. If you know what you are doing and you want to build
# this, what's here can be a guide to get you going. I built this on macOS (not this file) and
# WIN32. After I modified it for macOS the WIN32 broke so I modified it for WIN32 and now the
# APPLE is broken. Probably an easy fix if you knwo what you are doing which I cleary don't when
# it comes to SDL

cmake_minimum_required(VERSION 3.16)

# Set project name
Expand All @@ -7,10 +14,18 @@ project(mmm LANGUAGES C)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED True)

# Find SDL2, SDL2_image, and SDL2_mixer
find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_mixer REQUIRED)
# Find SDL2, SDL2_image, and SDL2_mixer using pkg-config for macOS
if (APPLE)
find_package(PkgConfig REQUIRED)
pkg_check_modules(SDL2 REQUIRED sdl2)
pkg_check_modules(SDL2_image REQUIRED sdl2_image)
pkg_check_modules(SDL2_mixer REQUIRED sdl2_mixer)
else()
# Find SDL2, SDL2_image, and SDL2_mixer for other platforms
find_package(SDL2 REQUIRED)
find_package(SDL2_image REQUIRED)
find_package(SDL2_mixer REQUIRED)
endif()

# Add the executable
add_executable(${PROJECT_NAME}
Expand All @@ -33,9 +48,10 @@ target_link_libraries(${PROJECT_NAME}
${SDL2_IMAGE_LIBRARIES}
)

# I need this on Windows. Why this is such a struggle eludes me
if (WIN32)
# Fallback for Windows if SDL2_IMAGE_LIBRARIES is not found
# Link libraries depending on platform
if (APPLE)
target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARIES} ${SDL2_image_LIBRARIES} ${SDL2_mixer_LIBRARIES})
elseif(WIN32)
target_link_libraries(${PROJECT_NAME}
"C:/Users/swessels/develop/github/external/vcpkg/installed/x64-windows/lib/SDL2.lib"
"C:/Users/swessels/develop/github/external/vcpkg/installed/x64-windows/lib/SDL2_image.lib"
Expand All @@ -53,5 +69,7 @@ if (WIN32)
$<TARGET_FILE_DIR:${PROJECT_NAME}>
)
endforeach()

else()
# Link libraries for non-Apple, non-Windows platforms (Linux, etc.)
target_link_libraries(${PROJECT_NAME} ${SDL2_LIBRARIES} ${SDL2_image_LIBRARIES} ${SDL2_mixer_LIBRARIES})
endif()
2 changes: 1 addition & 1 deletion src/mmm/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ The CMakeLists.txt file works for my installation. This is my note at the top w
# least, nothing ever works as advertised. If you know what you are doing and you want to build
# this, what's here can be a guide to get you going. I built this on macOS (not this file) and
# WIN32. After I modified it for macOS the WIN32 broke so I modified it for WIN32 and now the
# APPLE is broken. Probably an easy fix if you knwo what you are doing which I cleary don't when
# APPLE is broken. Probably an easy fix if you know what you are doing which I clearly don't when
# it comes to SDL
```

Expand Down

0 comments on commit 87c1b24

Please sign in to comment.