做完了很多东西
This commit is contained in:
+39
-4
@@ -2,6 +2,7 @@ cmake_minimum_required(VERSION 3.21)
|
||||
project("Industrial Genesis" VERSION "0.0.1")
|
||||
|
||||
find_package(Gettext REQUIRED)
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
file(GLOB PO_FILES "${CMAKE_SOURCE_DIR}/po/*.po")
|
||||
|
||||
@@ -12,10 +13,14 @@ endif()
|
||||
|
||||
foreach(po_file IN LISTS PO_FILES)
|
||||
get_filename_component(lang ${po_file} NAME_WE)
|
||||
set(mo_file "${CMAKE_CURRENT_BINARY_DIR}/locale/${lang}/LC_MESSAGES/${PROJECT_NAME}.mo")
|
||||
# 编译产物放在 mo/ 而不是 locale/:locale/ 是 POST_BUILD 的拷贝目标,
|
||||
# 两者同目录会变成"把目录拷到自己身上"。
|
||||
set(mo_file "${CMAKE_CURRENT_BINARY_DIR}/mo/${lang}/LC_MESSAGES/${PROJECT_NAME}.mo")
|
||||
|
||||
add_custom_command(
|
||||
OUTPUT ${mo_file}
|
||||
COMMAND ${CMAKE_COMMAND} -E make_directory
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/mo/${lang}/LC_MESSAGES"
|
||||
COMMAND ${GETTEXT_MSGFMT_EXECUTABLE} -o ${mo_file} ${po_file}
|
||||
DEPENDS ${po_file}
|
||||
COMMENT "Compiling translation for ${lang}"
|
||||
@@ -28,7 +33,32 @@ endforeach()
|
||||
add_subdirectory(lib/raylib-6.0)
|
||||
add_subdirectory(lib/json-c-json-c-0.19-20260627)
|
||||
|
||||
add_executable(Industrial_Genesis src/main.c src/json.c src/ui.c src/texture.c src/timer.c src/tools.c)
|
||||
add_executable(Industrial_Genesis
|
||||
src/main.c
|
||||
src/json.c
|
||||
src/ui.c
|
||||
src/texture.c
|
||||
src/timer.c
|
||||
src/tools.c
|
||||
# 时间与天文
|
||||
src/astro.c
|
||||
src/weather.c
|
||||
src/hydro.c
|
||||
# 世界生成
|
||||
src/terrain.c
|
||||
src/chunk.c
|
||||
src/compound.c
|
||||
src/noise.c
|
||||
src/random.c
|
||||
src/climate.c
|
||||
src/river.c
|
||||
# 世界状态与地图视图
|
||||
src/world.c
|
||||
src/map.c
|
||||
src/landing.c
|
||||
# 局部游戏层(1 格 = 1 米)
|
||||
src/game.c
|
||||
)
|
||||
target_compile_definitions(Industrial_Genesis PRIVATE _RELEASE_)
|
||||
target_include_directories(Industrial_Genesis PRIVATE lib/raylib-6.0/src/)
|
||||
target_include_directories(Industrial_Genesis PRIVATE lib/json-c-json-c-0.19-20260627/)
|
||||
@@ -36,9 +66,14 @@ target_include_directories(Industrial_Genesis PRIVATE lib/libuv-1.52.1/)
|
||||
target_link_libraries(Industrial_Genesis PRIVATE raylib)
|
||||
target_link_libraries(Industrial_Genesis PRIVATE json-c)
|
||||
target_link_libraries(Industrial_Genesis PRIVATE uv)
|
||||
target_link_libraries(Industrial_Genesis PRIVATE Threads::Threads)
|
||||
|
||||
add_custom_target(translations ALL DEPENDS ${MO_FILES})
|
||||
|
||||
# 没有这行时,`cmake --build build --target Industrial_Genesis` 不会碰
|
||||
# translations,运行时用的还是上一次的旧 .mo。
|
||||
add_dependencies(Industrial_Genesis translations)
|
||||
|
||||
add_custom_command(TARGET Industrial_Genesis POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/assets"
|
||||
@@ -48,7 +83,7 @@ add_custom_command(TARGET Industrial_Genesis POST_BUILD
|
||||
|
||||
add_custom_command(TARGET Industrial_Genesis POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||
"${CMAKE_CURRENT_SOURCE_DIR}/locale"
|
||||
"${CMAKE_CURRENT_BINARY_DIR}/mo"
|
||||
"$<TARGET_FILE_DIR:Industrial_Genesis>/locale"
|
||||
COMMENT "Copying locale files to runtime directory"
|
||||
)
|
||||
@@ -62,7 +97,7 @@ add_custom_command(TARGET Industrial_Genesis POST_BUILD
|
||||
|
||||
install(TARGETS Industrial_Genesis RUNTIME DESTINATION ${CMAKE_INSTALL_PREFIX}/)
|
||||
install(DIRECTORY assets DESTINATION .)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/locale DESTINATION .)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/mo/ DESTINATION locale)
|
||||
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/config DESTINATION .)
|
||||
|
||||
install(CODE "
|
||||
|
||||
Reference in New Issue
Block a user