merge of transition to cmake, winbuild to follow

This commit is contained in:
ottona 2022-08-12 10:20:17 +02:00
commit 67cad1fe23
3 changed files with 60 additions and 40 deletions

56
CMakeLists.txt Normal file
View File

@ -0,0 +1,56 @@
# cmake for tes, ottona, 2022-03-09
cmake_minimum_required(VERSION 3.10)
set(FS_TARGET flasim)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/lib")
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/bin")
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_LIST_DIR}/bin")
set(LIBRARY_OUTPUT_DIRECTORY ${CMAKE_LIBRARY_OUTPUT_DIRECTORY})
set(FS_EXT_DIR "${CMAKE_CURRENT_LIST_DIR}/ext")
set(FS_SRC_DIR "${CMAKE_CURRENT_LIST_DIR}/src")
#caudio stuff
option(CAUDIO_STATIC on)
set(CAUDIO_TARGET cAudio)
set(CAUDIO_DIR ${FS_EXT_DIR}/cAudio)
set(CAUDIO_INC_DIR ${FS_EXT_DIR}/cAudio/cAudio/include)
add_subdirectory(${CAUDIO_DIR} EXCLUDE_FROM_ALL)
#irrlicht stuff
set(IRRLICHT_INC_DIR /usr/include/irrlicht)
set(IRRLICHT_TARGET Irrlicht)
project(${FS_TARGET})
add_executable(flasim
${FS_SRC_DIR}/Aircraft.cpp
${FS_SRC_DIR}/Aircraft.hpp
${FS_SRC_DIR}/Dispatcher.cpp
${FS_SRC_DIR}/Dispatcher.hpp
${FS_SRC_DIR}/FireUnit.cpp
${FS_SRC_DIR}/FireUnit.hpp
${FS_SRC_DIR}/FlaSimApp.cpp
${FS_SRC_DIR}/FlaSimApp.hpp
${FS_SRC_DIR}/Globals.cpp
${FS_SRC_DIR}/Globals.hpp
${FS_SRC_DIR}/main.cpp
${FS_SRC_DIR}/TurretCamAnimator.cpp
${FS_SRC_DIR}/TurretCamAnimator.hpp
)
target_include_directories(${FS_TARGET} PRIVATE ${IRRLICHT_INC_DIR} ${CAUDIO_INC_DIR} ${CMAKE_BINARY_DIR}/include) #last is needed for caudio
if(UNIX) # relocatable linking for unixoids
set_target_properties(flasim PROPERTIES LINK_FLAGS "-Wl,-rpath,$ORIGIN/")
endif()
target_link_libraries(${FS_TARGET} ${CAUDIO_TARGET} ${IRRLICHT_TARGET})

View File

@ -14,18 +14,13 @@ About the visual content shown in the game: I did some parts myself (cannon mode
## Building flasim ## Building flasim
Currently only Linux works, should have a windows buildability in a couple of days. Currently only *Linux* works, should have a Windows buildability *in a couple of days* (yea, sure).
The game is written in QtCreator and hence uses the qmake build system. You should have gcc, qmake, irrlicht and OpenAL installed and handy. The game uses the CMake build system. Make sure you have GCC, Irrlicht and OpenAL available on your system.
### Prerequirements
1. Fetch the submodules. 1. Fetch the submodules.
1. `cd` into `ext/cAudio` and issue `cmake -DCAUDIO_BUILD_EAX_PLUGIN=ON -DCAUDIO_BUILD_MP3DECODER_PLUGIN=OFF -DCAUDIO_ENABLE_OGG=OFF -DCAUDIO_BUILD_SAMPLES=OFF -DCAUDIO_DEPENDENCIES_DIR=Dependencies64 -DCAUDIO_STATIC=ON` 1. Very recent versions of CMake have issues with the dated config in *cAudio*. If it complains about *flasim* not being defined inside *cAudio* open `ext/cAudio/CMakeLists.txt` and head to line 29 and 30. Replace `${CMAKE_PROJECT_NAME}` by the word `cAudio`.
1. `make` cAudio 1. CMake & build *flasim*
### Build flasim
`cd` to the `prj` folder and run qmake to get a Makefile out of `flasim.pro`. Build the game using `make`. Done.
Questions? Reach me at otto@socialnerds.org Questions? Reach me at otto@socialnerds.org

View File

@ -1,31 +0,0 @@
QT -= core gui
CONFIG += debug_and_release
Release:TARGET = flasim
Debug:TARGET = flasimD
TEMPLATE = app
unix:INCLUDEPATH += /usr/include/irrlicht
INCLUDEPATH += ../ext/cAudio/cAudio/include ../ext/cAudio/include
unix:LIBS += -L../ext/cAudio/cAudio
unix:LIBS += -lIrrlicht -lopenal -lcAudio
DESTDIR = ../bin
HEADERS += \
../src/FlaSimApp.hpp \
../src/FireUnit.hpp \
../src/Globals.hpp \
../src/TurretCamAnimator.hpp \
../src/Aircraft.hpp \
../src/Dispatcher.hpp
SOURCES += \
../src/FlaSimApp.cpp \
../src/main.cpp \
../src/FireUnit.cpp \
../src/Globals.cpp \
../src/TurretCamAnimator.cpp \
../src/Aircraft.cpp \
../src/Dispatcher.cpp