@@ -23,43 +23,31 @@ endif()
23
23
# Auto detect platform if not manually set
24
24
25
25
if (NOT ESD_WND_PLATFORM)
26
+
26
27
if (WIN32 )
27
28
set (PLATFORM "Win32" )
28
29
elseif (UNIX AND NOT APPLE )
29
30
set (PLATFORM "X11" )
30
31
else ()
31
- message (FATAL "Could not auto detect platform, it may be unimplemented" )
32
+ message (FATAL_ERROR "Could not auto detect platform, it may be unimplemented" )
32
33
endif ()
33
34
34
- set (ESD_WND_PLATFORM PLATFORM CACHE STRING "Target Platform" FORCE)
35
- endif ()
36
-
37
- # Choose platform specific implementation
35
+ set (ESD_WND_PLATFORM ${PLATFORM} CACHE STRING "Target Platform" FORCE)
38
36
39
- if (ESD_WND_PLATFORM STREQUAL "Win32" )
40
-
41
- message ("Using Win32" )
42
- target_sources (eseed_window PRIVATE src/win32 /window.cpp)
43
- if (ESD_WND_ENABLE_VULKAN_SUPPORT)
44
- target_sources (eseed_window PRIVATE src/win32 /vulkanwindow.cpp)
45
- endif ()
37
+ endif ()
46
38
47
- elseif ( ESD_WND_PLATFORM STREQUAL "X11" )
39
+ string (TOLOWER ${ ESD_WND_PLATFORM} PLATFORM_DIR_NAME )
48
40
49
- message ("Using X11" )
50
- target_sources (eseed_window PRIVATE src/x11/window.cpp)
51
- find_package (X11 REQUIRED)
52
- target_link_libraries (eseed_window ${X11_LIBRARIES} )
53
- if (ESD_WND_ENABLE_VULKAN_SUPPORT)
54
- target_sources (eseed_window PRIVATE src/x11/vulkanwindow.cpp)
55
- endif ()
56
-
57
- else ()
41
+ # Choose platform specific implementation
58
42
59
- message (FATAL "Unkown platform, it may have been typed incorrectly or is unimplemented " )
43
+ message ("Using ${ESD_WND_PLATFORM} " )
60
44
45
+ if (NOT EXISTS "${CMAKE_CURRENT_SOURCE_DIR} /platforms/${PLATFORM_DIR_NAME} " )
46
+ message (FATAL_ERROR "Unkown platform, it may have been typed incorrectly or is unimplemented" )
61
47
endif ()
62
48
49
+ add_subdirectory ("platforms/${PLATFORM_DIR_NAME} " )
50
+
63
51
# Testing
64
52
65
53
if (ESD_WND_BUILD_EXAMPLES)
0 commit comments