Skip to content

Commit

Permalink
Merge pull request DescentDevelopers#494 from Jayman2000/encoding-imp…
Browse files Browse the repository at this point in the history
…rovements

Ensure UTF-8 is used in more places
  • Loading branch information
Lgt2x authored Jul 20, 2024
2 parents f78bd57 + 5a19942 commit 7cd7902
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ indent_style = space
indent_size = 2
tab_width = 8
end_of_line = lf
charset = utf-8
spelling_language = en-US

[*.md]
Expand Down
15 changes: 15 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,21 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

set_property(GLOBAL PROPERTY USE_FOLDERS ON)

if(MSVC)
add_compile_options(/source-charset:UTF-8 /execution-charset:UTF-8)
else()
add_compile_options(-finput-charset=UTF-8)
# Unfortunately, Clang doesn’t support -fexec-charset yet so this next part
# is GCC only. Luckily, Clang defaults to using UTF-8 for the execution
# character set [1], so we’re fine. Once Clang gets support for
# -fexec-charset, we should probably start using it.
#
# [1]: <https://discourse.llvm.org/t/rfc-enabling-fexec-charset-support-to-llvm-and-clang-reposting/71512>
if(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-fexec-charset=UTF-8)
endif()
endif()

if(FORCE_COLORED_OUTPUT)
if(CMAKE_VERSION VERSION_GREATER_EQUAL 3.24)
set(CMAKE_COLOR_DIAGNOSTICS ON)
Expand Down
9 changes: 8 additions & 1 deletion Descent3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -274,6 +274,13 @@ set(CPPS
if(WIN32)
set(PLATFORM_LIBS wsock32.lib winmm.lib)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /SAFESEH:NO /NODEFAULTLIB:LIBC")
set(MANIFEST ${CMAKE_CURRENT_BINARY_DIR}/Descent3.exe.manifest)
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/Descent3.exe.manifest.in
${MANIFEST}
@ONLY
NEWLINE_STYLE WIN32
)
endif()

if(UNIX AND NOT APPLE)
Expand All @@ -287,7 +294,7 @@ endif()

file(GLOB_RECURSE INCS "../lib/*.h")

add_executable(Descent3 WIN32 ${HEADERS} ${CPPS} ${INCS})
add_executable(Descent3 WIN32 ${HEADERS} ${CPPS} ${INCS} ${MANIFEST})
target_link_libraries(Descent3 PRIVATE
2dlib AudioEncode bitmap cfile czip d3music dd_video ddebug ddio libmve libacm
fix grtext manage mem misc model module movie stream_audio linux SDL2::SDL2
Expand Down
9 changes: 9 additions & 0 deletions Descent3/Descent3.exe.manifest.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity type="win32" name="DescentDevelopers.Descent3.engine" version="@PROJECT_VERSION_MAJOR@.@PROJECT_VERSION_MINOR@.@[email protected]" />
<application>
<windowsSettings>
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
</windowsSettings>
</application>
</assembly>

0 comments on commit 7cd7902

Please sign in to comment.