diff --git a/.travis.yml b/.travis.yml index ad97a68..94faa1e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,7 +15,6 @@ addons: - libboost1.55-dev - libjsoncpp-dev - cmake - - docbook-to-man cache: apt: true @@ -23,7 +22,7 @@ cache: before_install: - sudo apt-add-repository --yes ppa:zoogie/sdl2-snapshots - sudo apt-get update -qq - - sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev + - sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev docbook-to-man install: - export CXX="g++-4.9" diff --git a/CMakeLists.txt b/CMakeLists.txt index f10007a..885ad34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,6 +10,21 @@ set(INSTALL_MAN_DIR "/usr/share/man/man6" CACHE STRING "Install the man page to set(INSTALL_APPLICATIONS_DIR "/usr/share/applications" CACHE STRING "Install the .desktop file to this directory") set(INSTALL_ICONS_DIR "/usr/share/icons/hicolor" CACHE STRING "Install the icon in a subfolder in this directory") +# This sets up the exe icon for windows under mingw. +# Taken from https://hansonry.wordpress.com/2010/12/15/windows-application-icon-using-mingw-and-cmake/ +set(RES_FILES "") +if(MINGW) + set(RES_FILES "${blockattack_SOURCE_DIR}/source/code/winicon.rc") + set(CMAKE_RC_COMPILER_INIT windres) + ENABLE_LANGUAGE(RC) + SET(CMAKE_RC_COMPILE_OBJECT + " -O coff -i -o ") +endif(MINGW) + +if (WIN32) +SET(GUI_TYPE WIN32) +endif() + if (!WIN32) #The path to the data dir must be compiled into the binary add_definitions(-DSHAREDIR=\"${INSTALL_DATA_DIR}\") @@ -35,12 +50,13 @@ file(GLOB SOURCES "source/code/*.cpp" "source/code/*/*.cpp") #I am still trying to get BlockGame to compile as a source file list(REMOVE_ITEM SOURCES "${blockattack_SOURCE_DIR}/source/code/BlockGame.cpp") + #Some messages to figure out what cmake does message("${SOURCES}") message("${CMAKE_EXE_LINKER_FLAGS}") #building/compiling/linking -add_executable(blockattack ${SOURCES}) +add_executable(blockattack ${GUI_TYPE} ${SOURCES} ${RES_FILES}) target_link_libraries( blockattack ${SDL2_LIBRARY}) target_link_libraries( blockattack physfs jsoncpp) target_link_libraries( blockattack ${SDL2MIXER_LIBRARIES} ${SDL2IMAGE_LIBRARIES} ${SDL2TTF_LIBRARIES}) diff --git a/README.md b/README.md index 56d89b6..ad79040 100644 --- a/README.md +++ b/README.md @@ -17,6 +17,7 @@ A Tetris Attack Clone under the GPL. The only supported build method is using the Makefile To build do: ``` +./packdata.sh cmake . make ``` @@ -25,6 +26,11 @@ The result should be in the "Game"-folder. To run cd ./Game/blockattack ``` +You can also choose to install it with +``` +sudo make install +``` + Windows build uses MXE (mxe.cc) with these installed: ``` sdl2 sdl2_image sdl2_mixer sdl2_ttf physfs jsoncpp libtool gettext freetype zlib boost @@ -35,4 +41,3 @@ Compiled with: ``` i686-w64-mingw32.static-cmake --debug-output . && make ``` -As of 2016-01-17 the Windows version crashes but it will work eventually