Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ensure UTF-8 is used in more places #494

Merged
merged 3 commits into from
Jul 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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@.@PROJECT_VERSION_PATCH@.0" />
<application>
<windowsSettings>
<activeCodePage xmlns="http://schemas.microsoft.com/SMI/2019/WindowsSettings">UTF-8</activeCodePage>
</windowsSettings>
</application>
</assembly>