windows build

This commit is contained in:
Alexander Zhirov 2023-05-05 15:46:47 +03:00
parent f0e7533e65
commit ee8ec490e4
2 changed files with 57 additions and 32 deletions

View File

@ -17,34 +17,17 @@
## Сборка ## Сборка
Для сборки необходимо скачать [статическую библиотеку Allegro](https://github.com/liballeg/allegro5/releases) и [статические зависимости](https://github.com/liballeg/allegro_winpkg/releases).
Также для сборки требуется установленный компилятор `g++` и система сборки `cmake`.
Рабочая компиляция проекта производилась в [MSYS2](https://www.msys2.org/).
```sh ```sh
mkdir build mkdir build
cd build cd build
cmake -B . -S ../game cmake -G "Unix Makefiles" -B . -S ../game -D PATH_ALLEGRO_STATIC="C:\<path-to-allegro-static-libs>" -D PATH_DEPS_STATIC="C:\<path-to-deps-static-libs>"
make make
``` ```
Основные данные, необходимые для запуска игры, находятся в каталоге [data](data/). Основные данные, необходимые для запуска игры, находятся в каталоге [data](data/).
### Для Windows
#### Ключи для сборки
`-lallegro_dialog-static -lallegro_image-static -lallegro_primitives-static -lallegro-static -ljpeg -lpng16 -lwebp -lwinmm -lopengl32 -lcomdlg32 -lgdi32 -lole32 -lshlwapi -lz -mwindows`
#### Статическая сборка
`-static`
#### Дополнительные библиотеки для сборки
- `jpeg`
- `png16`
- `webp`
- `winmm`
- `opengl32`
- `comdlg32`
- `gdi32`
- `ole32`
- `shlwapi`
- `z`

View File

@ -1,6 +1,30 @@
cmake_minimum_required(VERSION 3.0) cmake_minimum_required(VERSION 3.25)
project(tictactoe) project(tictactoe)
set(STDCPP_LIB stdc++ -static)
set(PATH_ALLEGRO_STATIC "" CACHE PATH "Path to allegro static libs")
set(PATH_DEPS_STATIC "" CACHE PATH "Path to dependencies static libs")
add_library(allegro STATIC IMPORTED)
set_property(TARGET allegro PROPERTY IMPORTED_LOCATION "${PATH_ALLEGRO_STATIC}/liballegro-static.a")
add_library(allegro_primitives STATIC IMPORTED)
set_property(TARGET allegro_primitives PROPERTY IMPORTED_LOCATION "${PATH_ALLEGRO_STATIC}/liballegro_primitives-static.a")
add_library(allegro_dialog STATIC IMPORTED)
set_property(TARGET allegro_dialog PROPERTY IMPORTED_LOCATION "${PATH_ALLEGRO_STATIC}/liballegro_dialog-static.a")
add_library(allegro_image STATIC IMPORTED)
set_property(TARGET allegro_image PROPERTY IMPORTED_LOCATION "${PATH_ALLEGRO_STATIC}/liballegro_image-static.a")
add_library(allegro_font STATIC IMPORTED)
add_library(jpeg STATIC IMPORTED)
set_property(TARGET jpeg PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libjpeg.a")
add_library(png16 STATIC IMPORTED)
set_property(TARGET png16 PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libpng16.a")
add_library(webp STATIC IMPORTED)
set_property(TARGET webp PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libwebp.a")
add_library(zlib STATIC IMPORTED)
set_property(TARGET zlib PROPERTY IMPORTED_LOCATION "${PATH_DEPS_STATIC}/libzlib.a")
set(SRC_GAME set(SRC_GAME
ai.cpp ai.cpp
main.cpp main.cpp
@ -8,15 +32,33 @@ set(SRC_GAME
parse_args.cpp parse_args.cpp
version.cpp) version.cpp)
find_library(ALLEGRO_LIB NAMES allegro) set(ALLEGRO_LIB allegro)
find_library(ALLEGRO_PRIMITIVES_LIB NAMES allegro_primitives) set(ALLEGRO_PRIMITIVES_LIB allegro_primitives)
find_library(ALLEGRO_DIALOG_LIB NAMES allegro_dialog) set(ALLEGRO_DIALOG_LIB allegro_dialog)
find_library(ALLEGRO_IMAGE_LIB allegro_image) set(ALLEGRO_IMAGE_LIB allegro_image)
add_executable(${PROJECT_NAME} ${SRC_GAME}) find_library(WINMM_LIB winmm)
find_library(OPENGL32_LIB opengl32)
find_library(SHLWAPI_LIB shlwapi)
set(PNG16_LIB png16)
set(JPEG_LIB jpeg)
set(WEBP_LIB webp)
set(Z_LIB zlib)
add_executable(${PROJECT_NAME} WIN32 ${SRC_GAME})
target_link_libraries(${PROJECT_NAME} target_link_libraries(${PROJECT_NAME}
${ALLEGRO_LIB}
${ALLEGRO_PRIMITIVES_LIB} ${ALLEGRO_PRIMITIVES_LIB}
${ALLEGRO_DIALOG_LIB} ${ALLEGRO_DIALOG_LIB}
${ALLEGRO_IMAGE_LIB}) ${ALLEGRO_IMAGE_LIB}
${ALLEGRO_LIB}
${JPEG_LIB}
${WEBP_LIB}
${PNG16_LIB}
${WINMM_LIB}
${OPENGL32_LIB}
${SHLWAPI_LIB}
${STDCPP_LIB}
${Z_LIB})