From 6d022d03c1da62d017ea217467a4cf971664768d Mon Sep 17 00:00:00 2001 From: Manuel Moos Date: Fri, 27 Jan 2023 22:54:28 +0100 Subject: [PATCH 1/7] Add macOS prerequisite installation --- BUILDING | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/BUILDING b/BUILDING index 0fe4c36..d485c40 100644 --- a/BUILDING +++ b/BUILDING @@ -1,7 +1,10 @@ How to build cerritos 1. Install dependencies -cmake libsdl2 doxygen graphviz libsdl2-image-dev libsdl2-ttf-dev +Linux (package names may vary): +{your packager} libsdl2 doxygen graphviz libsdl2-image-dev libsdl2-ttf-dev +macOS: +brew install sdl2 doxygen graphviz sdl2_image sdl2_ttf 2. Create build directory mkdir build From 2e26f48da3fac0448388896141eb7d4016ea3d23 Mon Sep 17 00:00:00 2001 From: Manuel Moos Date: Fri, 27 Jan 2023 23:08:46 +0100 Subject: [PATCH 2/7] Separate SYSTEM includes so common header names like event.h and types.h in this source are found --- src/CMakeLists.txt | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 24421d4..0841418 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -70,10 +70,6 @@ install(FILES ) target_include_directories(cerritos PUBLIC - ${SDL2_LIBRARIES} - ${SDL2IMAGE_INCLUDE_DIRS} - ${SDL2TTF_INCLUDE_DIRS} - ${OPENAL_INCLUDE_DIRS} . backend core @@ -85,6 +81,13 @@ target_include_directories(cerritos PUBLIC widgets ) +target_include_directories(cerritos SYSTEM PUBLIC + ${SDL2_LIBRARIES} + ${SDL2IMAGE_INCLUDE_DIRS} + ${SDL2TTF_INCLUDE_DIRS} + ${OPENAL_INCLUDE_DIRS} +) + target_link_libraries(cerritos ${SDL2_LIBRARIES} ${SDL2IMAGE_LIBRARIES} From 3fad96957f6feda826d3885e100b5b334c697ecb Mon Sep 17 00:00:00 2001 From: Manuel Moos Date: Fri, 27 Jan 2023 23:15:48 +0100 Subject: [PATCH 3/7] Correct include for apple platforms Not sure whether binreloc is needed there, though. --- src/thirdparty/binreloc/binreloc.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/thirdparty/binreloc/binreloc.c b/src/thirdparty/binreloc/binreloc.c index 84c22c4..437718c 100644 --- a/src/thirdparty/binreloc/binreloc.c +++ b/src/thirdparty/binreloc/binreloc.c @@ -28,7 +28,11 @@ #include #include #include +#ifdef __APPLE__ +#include +#else #include +#endif #include "binreloc.h" From a9f4b6094b8a51d08c0654310aa1a33eac62f63b Mon Sep 17 00:00:00 2001 From: Manuel Moos Date: Fri, 27 Jan 2023 23:43:59 +0100 Subject: [PATCH 4/7] Add freealut to macOS and Linux prerequisites --- BUILDING | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/BUILDING b/BUILDING index d485c40..b219f01 100644 --- a/BUILDING +++ b/BUILDING @@ -2,9 +2,9 @@ How to build cerritos 1. Install dependencies Linux (package names may vary): -{your packager} libsdl2 doxygen graphviz libsdl2-image-dev libsdl2-ttf-dev +{your packager} libsdl2 doxygen graphviz libsdl2-image-dev libsdl2-ttf-dev freealut-dev macOS: -brew install sdl2 doxygen graphviz sdl2_image sdl2_ttf +brew install sdl2 doxygen graphviz sdl2_image sdl2_ttf freealut 2. Create build directory mkdir build From de8f1d058bbd35f7c7a67f3a1c34fe7263ad6a98 Mon Sep 17 00:00:00 2001 From: Manuel Moos Date: Sat, 28 Jan 2023 13:02:51 +0100 Subject: [PATCH 5/7] Only conditionally link stdc++ff Taken mostly from https://gitlab.kitware.com/cmake/cmake/-/issues/17834#note_435285 Constructed from cppreference notes: https://en.cppreference.com/w/cpp/filesystem#Notes We ony handle the GCC case, the problem will go away with time. --- src/CMakeLists.txt | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 0841418..971b9e5 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -94,8 +94,7 @@ target_link_libraries(cerritos ${SDL2TTF_LIBRARIES} ${OPENAL_LIBRARIES} alut - stdc++fs - stdc++ + $<$,$,9.1>>:stdc++fs> ) install(TARGETS cerritos From c47392c3f0385392d0b13a8372747707a3430ab5 Mon Sep 17 00:00:00 2001 From: Manuel Moos Date: Sat, 28 Jan 2023 23:10:51 +0100 Subject: [PATCH 6/7] Actually check for OpenAL, use detected library --- CMakeLists.txt | 1 + src/CMakeLists.txt | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 05a1254..c5bcfa6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,6 +13,7 @@ set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) include(sdl) INCLUDE(FindPkgConfig) +find_package(OpenAL REQUIRED) #find_package(SDL_ttf REQUIRED) #PKG_SEARCH_MODULE(SDL2 REQUIRED sdl2) PKG_SEARCH_MODULE(SDL2IMAGE REQUIRED SDL2_image) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 971b9e5..6afa679 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -85,14 +85,14 @@ target_include_directories(cerritos SYSTEM PUBLIC ${SDL2_LIBRARIES} ${SDL2IMAGE_INCLUDE_DIRS} ${SDL2TTF_INCLUDE_DIRS} - ${OPENAL_INCLUDE_DIRS} + ${OPENAL_INCLUDE_DIR} ) target_link_libraries(cerritos ${SDL2_LIBRARIES} ${SDL2IMAGE_LIBRARIES} ${SDL2TTF_LIBRARIES} - ${OPENAL_LIBRARIES} + ${OPENAL_LIBRARY} alut $<$,$,9.1>>:stdc++fs> ) From 37db31c5f092371dd58e56d3fcdb00ec9e06d0f9 Mon Sep 17 00:00:00 2001 From: Manuel Moos Date: Sat, 28 Jan 2023 23:20:05 +0100 Subject: [PATCH 7/7] Use correct SDL2 libraries Did not cause any error, the TTF and IMAGE includes are identical anyway --- src/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6afa679..ada4b95 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -82,7 +82,7 @@ target_include_directories(cerritos PUBLIC ) target_include_directories(cerritos SYSTEM PUBLIC - ${SDL2_LIBRARIES} + ${SDL2_INCLUDE_DIRS} ${SDL2IMAGE_INCLUDE_DIRS} ${SDL2TTF_INCLUDE_DIRS} ${OPENAL_INCLUDE_DIR}