|
@@ -3,6 +3,19 @@
|
|
|
cmake_minimum_required(VERSION 3.12)
|
|
|
project(sdl_test LANGUAGES C)
|
|
|
|
|
|
+include(CheckLanguage)
|
|
|
+
|
|
|
+if(APPLE)
|
|
|
+ # multiple values for CMAKE_OSX_ARCHITECTURES not supported with Swift
|
|
|
+ list(LENGTH CMAKE_OSX_ARCHITECTURES count_osx_archs)
|
|
|
+ if(count_osx_archs LESS_EQUAL 1)
|
|
|
+ check_language(Swift)
|
|
|
+ if(CMAKE_Swift_COMPILER)
|
|
|
+ enable_language(Swift)
|
|
|
+ endif()
|
|
|
+ endif()
|
|
|
+endif()
|
|
|
+
|
|
|
message(STATUS "CMAKE_SYSTEM_NAME= ${CMAKE_SYSTEM_NAME}")
|
|
|
message(STATUS "CMAKE_SYSTEM_PROCESSOR= ${CMAKE_SYSTEM_PROCESSOR}")
|
|
|
|
|
@@ -74,6 +87,12 @@ if(TEST_SHARED)
|
|
|
add_executable(sdltest-shared sdltest.c)
|
|
|
target_link_libraries(sdltest-shared PRIVATE SDL3::SDL3_test SDL3::SDL3-shared)
|
|
|
endif()
|
|
|
+
|
|
|
+ if(CMAKE_Swift_COMPILER)
|
|
|
+ add_executable(swift-shared main.swift)
|
|
|
+ target_include_directories(swift-shared PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/swift")
|
|
|
+ target_link_libraries(swift-shared PRIVATE SDL3::SDL3-shared)
|
|
|
+ endif()
|
|
|
endif()
|
|
|
|
|
|
if(TEST_STATIC)
|
|
@@ -92,6 +111,12 @@ if(TEST_STATIC)
|
|
|
add_executable(sdltest-static sdltest.c)
|
|
|
target_link_libraries(sdltest-static PRIVATE SDL3::SDL3_test SDL3::SDL3-static)
|
|
|
endif()
|
|
|
+
|
|
|
+ if(CMAKE_Swift_COMPILER)
|
|
|
+ add_executable(swift-static main.swift)
|
|
|
+ target_include_directories(swift-static PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/swift")
|
|
|
+ target_link_libraries(swift-static PRIVATE SDL3::SDL3-static)
|
|
|
+ endif()
|
|
|
endif()
|
|
|
|
|
|
find_package(SDL3 REQUIRED CONFIG COMPONENTS SDL3)
|