Skip to content

Commit ecede00

Browse files
committed
Fix Windows SDK compilation errors with compiler settings
- Add Windows-specific compiler definitions (WIN32_LEAN_AND_MEAN, NOMINMAX, etc.) - Set Windows version macros (_WIN32_WINNT, WINVER) for Windows 10 compatibility - Add MSVC-specific compiler options (/permissive-, /Zc:__cplusplus, /utf-8) - Use C++14 on Windows to avoid potential SDK conflicts with C++17 features Addresses winnt.h syntax errors and Windows SDK header conflicts.
1 parent c198871 commit ecede00

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

CMakeLists.txt

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,12 @@ project(Fujisan VERSION 1.0.0)
88
set(CMAKE_CXX_STANDARD 17)
99
set(CMAKE_CXX_STANDARD_REQUIRED ON)
1010

11+
# Use C++14 on Windows to avoid potential SDK conflicts
12+
if(WIN32 AND MSVC)
13+
set(CMAKE_CXX_STANDARD 14)
14+
message(STATUS "Using C++14 on Windows for SDK compatibility")
15+
endif()
16+
1117
# Include ExternalProject for building libatari800
1218
include(ExternalProject)
1319

@@ -285,6 +291,25 @@ if(APPLE)
285291
"-framework UniformTypeIdentifiers"
286292
)
287293
elseif(WIN32)
294+
# Windows-specific compiler settings to fix SDK compatibility
295+
target_compile_definitions(${PROJECT_NAME} PRIVATE
296+
WIN32_LEAN_AND_MEAN
297+
NOMINMAX
298+
_WIN32_WINNT=0x0A00 # Windows 10
299+
WINVER=0x0A00 # Windows 10
300+
UNICODE
301+
_UNICODE
302+
)
303+
304+
# MSVC-specific compiler options
305+
if(MSVC)
306+
target_compile_options(${PROJECT_NAME} PRIVATE
307+
/permissive- # Disable non-conforming code
308+
/Zc:__cplusplus # Enable __cplusplus macro
309+
/utf-8 # Specify UTF-8 encoding
310+
)
311+
endif()
312+
288313
# Add Windows application icon
289314
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/Fujisan.ico")
290315
# Create Windows resource file for icon

0 commit comments

Comments
 (0)