summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorJaakko Keränen <jaakko.keranen@iki.fi>2021-02-05 22:49:06 +0200
committerJaakko Keränen <jaakko.keranen@iki.fi>2021-02-05 22:49:06 +0200
commitb7deb632513795e495e9a3aa76a9400fef4de364 (patch)
treef57006f6fee9b79aea3182df5f0c3b28e9fc71eb /CMakeLists.txt
parent52f3c7e158ee9436ee82f602ee9a6212dd54b776 (diff)
Experimenting with an iOS build
iPlatformApple applies to both macOS and iOS. Added iPlatformAppleDesktop and iPlatformAppleMobile to make a distinction between the two. IssueID #96
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt30
1 files changed, 13 insertions, 17 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ce07c2de..1a0e0f8f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -35,21 +35,7 @@ option (ENABLE_DOWNLOAD_EDIT "Allow changing the Downloads directory" ON)
35 35
36include (BuildType.cmake) 36include (BuildType.cmake)
37include (res/Embed.cmake) 37include (res/Embed.cmake)
38if (NOT EXISTS ${CMAKE_SOURCE_DIR}/lib/the_Foundation/CMakeLists.txt) 38include (Depends.cmake)
39 set (INSTALL_THE_FOUNDATION YES)
40 find_package (the_Foundation REQUIRED)
41else ()
42 set (INSTALL_THE_FOUNDATION NO)
43 set (TFDN_STATIC_LIBRARY ON CACHE BOOL "")
44 set (TFDN_ENABLE_INSTALL OFF CACHE BOOL "")
45 set (TFDN_ENABLE_TESTS OFF CACHE BOOL "")
46 set (TFDN_ENABLE_WEBREQUEST OFF CACHE BOOL "")
47 add_subdirectory (lib/the_Foundation)
48 add_library (the_Foundation::the_Foundation ALIAS the_Foundation)
49endif ()
50find_package (PkgConfig REQUIRED)
51pkg_check_modules (SDL2 REQUIRED sdl2)
52pkg_check_modules (MPG123 IMPORTED_TARGET libmpg123)
53 39
54# Embedded resources are written to a generated source file. 40# Embedded resources are written to a generated source file.
55message (STATUS "Preparing embedded resources...") 41message (STATUS "Preparing embedded resources...")
@@ -183,7 +169,10 @@ set (SOURCES
183 ${CMAKE_CURRENT_BINARY_DIR}/embedded.h 169 ${CMAKE_CURRENT_BINARY_DIR}/embedded.h
184) 170)
185if (IOS) 171if (IOS)
172 add_definitions (-DiPlatformAppleMobile=1)
173 list (APPEND SOURCES src/ios.m src/ios.h)
186elseif (APPLE) 174elseif (APPLE)
175 add_definitions (-DiPlatformAppleDesktop=1)
187 list (APPEND SOURCES src/macos.m src/macos.h) 176 list (APPEND SOURCES src/macos.m src/macos.h)
188 list (APPEND RESOURCES "res/Lagrange.icns") 177 list (APPEND RESOURCES "res/Lagrange.icns")
189endif () 178endif ()
@@ -238,13 +227,20 @@ if (APPLE)
238 else () 227 else ()
239 target_link_libraries (app PUBLIC "-framework AppKit") 228 target_link_libraries (app PUBLIC "-framework AppKit")
240 endif () 229 endif ()
241 if (CMAKE_OSX_DEPLOYMENT_TARGET) 230 if (CMAKE_OSX_DEPLOYMENT_TARGET AND NOT IOS)
242 target_compile_options (app PUBLIC -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}) 231 target_compile_options (app PUBLIC -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET})
243 target_link_options (app PUBLIC -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET}) 232 target_link_options (app PUBLIC -mmacosx-version-min=${CMAKE_OSX_DEPLOYMENT_TARGET})
244 endif () 233 endif ()
234 if (XCODE_DEVELOPMENT_TEAM)
235 set_property (TARGET app PROPERTY
236 XCODE_ATTRIBUTE_DEVELOPMENT_TEAM ${XCODE_DEVELOPMENT_TEAM}
237 )
238 endif ()
239 if (SDL2_LIBRARY_DIRS)
240 set_property (TARGET app PROPERTY BUILD_RPATH ${SDL2_LIBRARY_DIRS})
241 endif ()
245 set_target_properties (app PROPERTIES 242 set_target_properties (app PROPERTIES
246 OUTPUT_NAME "Lagrange" 243 OUTPUT_NAME "Lagrange"
247 BUILD_RPATH ${SDL2_LIBRARY_DIRS}
248 MACOSX_BUNDLE YES 244 MACOSX_BUNDLE YES
249 MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_LIST_DIR}/res/MacOSXBundleInfo.plist.in" 245 MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_LIST_DIR}/res/MacOSXBundleInfo.plist.in"
250 MACOSX_BUNDLE_BUNDLE_NAME "Lagrange" 246 MACOSX_BUNDLE_BUNDLE_NAME "Lagrange"