From 426ee37aac5c9ec3be645fc020fe36b757f3599c Mon Sep 17 00:00:00 2001 From: casqade Date: Mon, 3 Apr 2023 00:25:44 +0300 Subject: [PATCH] upd: static build compile option for windows; add: executable version info --- CMakeLists.txt | 64 ++++++++++++++++++++++++++------------------------ README.md | 3 --- src/version.rc | 26 ++++++++++++++++++++ 3 files changed, 59 insertions(+), 34 deletions(-) create mode 100644 src/version.rc diff --git a/CMakeLists.txt b/CMakeLists.txt index 160e866..ff9cd58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,6 +1,7 @@ cmake_minimum_required(VERSION 3.7) -project(BiPlanes) +set(TARGET Biplanes) +project(${TARGET}) set (CMAKE_CXX_STANDARD 14) @@ -11,45 +12,46 @@ find_package(SDL2_image REQUIRED) find_package(SDL2_mixer REQUIRED) set (PROJECT_SOURCES - src/biplanes.cpp - src/matchmake.cpp - src/controls.cpp - src/menu.cpp - src/plane.cpp - src/bullet.cpp - src/cloud.cpp - src/zeppelin.cpp - src/sdl.cpp - src/render.cpp - src/utility.cpp - src/init_vars.cpp - ) - + src/biplanes.cpp + src/matchmake.cpp + src/controls.cpp + src/menu.cpp + src/plane.cpp + src/bullet.cpp + src/cloud.cpp + src/zeppelin.cpp + src/sdl.cpp + src/render.cpp + src/utility.cpp + src/init_vars.cpp +) + set (GAME_ICON src/icon.rc) -add_executable(${PROJECT_NAME} ${PROJECT_SOURCES} ${GAME_ICON}) +add_executable(${TARGET} ${PROJECT_SOURCES} ${GAME_ICON} src/version.rc) + +target_include_directories(${TARGET} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) +target_include_directories(${TARGET} PRIVATE ${SDL2_INCLUDE_DIR}) -target_include_directories(${PROJECT_NAME} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}) -target_include_directories(${PROJECT_NAME} PRIVATE ${SDL2_INCLUDE_DIR}) +target_compile_options(${TARGET} PRIVATE -w -O3 -s -Wno-narrowing) -target_compile_options(${PROJECT_NAME} PRIVATE -w -O3 -s -Wno-narrowing) +target_link_libraries(${TARGET} + SDL2::Main + SDL2::Image + SDL2::Mixer +) -target_link_libraries(BiPlanes - SDL2::Main - SDL2::Image - SDL2::Mixer) - if(WIN32) - set_target_properties( ${PROJECT_NAME} + set_target_properties( ${TARGET} PROPERTIES RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}/bin" - ) - target_link_libraries(${PROJECT_NAME} wsock32 ws2_32 -static-libgcc -static-libstdc++) - file(COPY assets DESTINATION ${CMAKE_BINARY_DIR}/bin) + ) + target_link_libraries(${TARGET} -static -static-libgcc -static-libstdc++ wsock32 ws2_32) + file(COPY assets DESTINATION ${CMAKE_BINARY_DIR}/bin) elseif(APPLE) - install(TARGETS BiPlanes DESTINATION bin) + install(TARGETS ${TARGET} DESTINATION bin) file(COPY assets DESTINATION bin) else() - install(TARGETS BiPlanes DESTINATION bin) - file(COPY assets DESTINATION bin) + install(TARGETS ${TARGET} DESTINATION bin) + file(COPY assets DESTINATION bin) endif() diff --git a/README.md b/README.md index 87cd896..bc1d76b 100644 --- a/README.md +++ b/README.md @@ -92,9 +92,6 @@ it's recommended to use newer zlib1.dll SDL2_mixer.dll -*If you want to launch game on different PC you also -need to provide **libwinpthread-1.dll** from **mingw32/bin*** - **6. Make sure that 'assets' folder is placed next to executable.** diff --git a/src/version.rc b/src/version.rc new file mode 100644 index 0000000..a08b333 --- /dev/null +++ b/src/version.rc @@ -0,0 +1,26 @@ +#define VER_FILEVERSION 1,0,5 +#define VER_FILEVERSION_STR "1.0.5" + + +VS_VERSION_INFO VERSIONINFO +FILEVERSION VER_FILEVERSION +PRODUCTVERSION VER_FILEVERSION +{ + BLOCK "StringFileInfo" + { + BLOCK "040904E4" + { + VALUE "CompanyName", "https://regular-dev.org" + VALUE "FileVersion", VER_FILEVERSION_STR + VALUE "FileDescription", "Biplanes Revival" + VALUE "LegalCopyright", "Copyright (C) 2023 https://regular-dev.org community" + VALUE "OriginalFilename", "Biplanes.exe" + VALUE "ProductName", "Biplanes Revival" + VALUE "ProductVersion", VER_FILEVERSION_STR + } + } + BLOCK "VarFileInfo" + { + VALUE "Translation", 0x0409, 1252 + } +}