Skip to content

Commit

Permalink
new project files
Browse files Browse the repository at this point in the history
  • Loading branch information
karwler committed Jun 4, 2016
1 parent f8f9368 commit 85c14a4
Show file tree
Hide file tree
Showing 11 changed files with 225 additions and 549 deletions.
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ out
*.autosave
*.user
*.sdf
*.sln
*.vcxproj
*.filters
*.cmake
*.opendb
Makefile
198 changes: 198 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
cmake_minimum_required(VERSION 2.8.12)
cmake_policy(SET CMP0015 NEW)
#cmake_policy(SET CMP0043 NEW)

project (VertiRead CXX)
set(CMAKE_SUPPRESS_REGENERATION true)
set(CMAKE_CONFIGURATION_TYPES "Debug" "Release")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11")

# source files
set(SRC_FILES
"src/engine/audioSys.cpp"
"src/engine/audioSys.h"
"src/engine/engine.cpp"
"src/engine/engine.h"
"src/engine/filer.cpp"
"src/engine/filer.h"
"src/engine/inputSys.cpp"
"src/engine/inputSys.h"
"src/engine/main.cpp"
"src/engine/scene.cpp"
"src/engine/scene.h"
"src/engine/windowSys.cpp"
"src/engine/windowSys.h"
"src/engine/world.cpp"
"src/engine/world.h"
"src/prog/browser.cpp"
"src/prog/browser.h"
"src/prog/library.cpp"
"src/prog/library.h"
"src/prog/playlistEditor.cpp"
"src/prog/playlistEditor.h"
"src/prog/program.cpp"
"src/prog/program.h"
"src/utils/capturers.cpp"
"src/utils/capturers.h"
"src/utils/items.cpp"
"src/utils/items.h"
"src/utils/objects.cpp"
"src/utils/objects.h"
"src/utils/popups.cpp"
"src/utils/popups.h"
"src/utils/scrollAreas.cpp"
"src/utils/scrollAreas.h"
"src/utils/types.cpp"
"src/utils/types.h"
"src/utils/utils.cpp"
"src/utils/utils.h")

if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set(SRC_FILES "${SRC_FILES} rsc/resource.rc")
endif()

# include directories
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/include)
elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
include_directories(/usr/local/include /Library/Frameworks)
endif()
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/src)

# library/framework directories
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
if (${CMAKE_SIZEOF_VOID_P} MATCHES "8")
set(LIB_DIR ${CMAKE_SOURCE_DIR}/lib/win64)
set(DLL_FILES
"libFLAC-8.dll"
"libfreetype-6.dll"
"libjpeg-9.dll"
"libmikmod-2.dll"
"libmodplug-1.dll"
"libogg-0.dll"
"libpng16-16.dll"
"libtiff-5.dll"
"libvorbis-0.dll"
"libvorbisfile-3.dll"
"libwebp-4.dll"
"msvcp140.dll"
"SDL2.dll"
"SDL2_image.dll"
"SDL2_mixer.dll"
"SDL2_ttf.dll"
"smpeg2.dll"
"vcruntime140.dll"
"zlib1.dll")
else()
set(LIB_DIR ${CMAKE_SOURCE_DIR}/lib/win32)
set(DLL_FILES
"libFLAC-8.dll"
"libfreetype-6.dll"
"libjpeg-9.dll"
"libmodplug-1.dll"
"libogg-0.dll"
"libpng16-16.dll"
"libtiff-5.dll"
"libvorbis-0.dll"
"libvorbisfile-3.dll"
"libwebp-4.dll"
"msvcp140.dll"
"SDL2.dll"
"SDL2_image.dll"
"SDL2_mixer.dll"
"SDL2_ttf.dll"
"smpeg2.dll"
"vcruntime140.dll"
"zlib1.dll")
endif()
link_directories(${LIB_DIR})

elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
find_library(LIB_SDL2 SDL2)
find_library(LIB_SDL2_IMG SDL2_image)
find_library(LIB_SDL2_TTF SDL2_ttf)
find_library(LIB_SDL2_MIX SDL2_mixer)

link_directories(/usr/local/lib)

endif()

# set main target
add_executable(VertiRead ${SRC_FILES})

# linker flags
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
target_link_libraries(VertiRead SDL2.lib SDL2_mixer.lib SDL2_image.lib SDL2_ttf.lib)

elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
target_link_libraries(VertiRead ${LIB_SDL2} ${LIB_SDL2_IMG} ${LIB_SDL2_TTF} ${LIB_SDL2_MIX} boost_system boost_filesystem)

elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
target_link_libraries(VertiRead SDL2 SDL2_mixer SDL2_image SDL2_ttf boost_system boost_filesystem)

endif()

# target path
if (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/VertiRead.app/Contents/MacOS")
else()
set(EXECUTABLE_OUTPUT_PATH "${CMAKE_BINARY_DIR}/bin")
endif()

# target properties
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
set_target_properties(VertiRead PROPERTIES
OUTPUT_NAME VertiRead
RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${EXECUTABLE_OUTPUT_PATH}"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${EXECUTABLE_OUTPUT_PATH}"
LINK_FLAGS_DEBUG "/SUBSYSTEM:CONSOLE"
LINK_FLAGS_RELEASE "/SUBSYSTEM:WINDOWS")
else()
set_target_properties(VertiRead PROPERTIES
OUTPUT_NAME vertiread
RUNTIME_OUTPUT_DIRECTORY "${EXECUTABLE_OUTPUT_PATH}"
RUNTIME_OUTPUT_DIRECTORY_DEBUG "${EXECUTABLE_OUTPUT_PATH}"
RUNTIME_OUTPUT_DIRECTORY_RELEASE "${EXECUTABLE_OUTPUT_PATH}")
endif()

# post buils commands
if (${CMAKE_SYSTEM_NAME} MATCHES "Windows")
foreach(dll_file ${DLL_FILES})
add_custom_command(TARGET VertiRead POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${LIB_DIR}/${dll_file} ${EXECUTABLE_OUTPUT_PATH})
endforeach()
add_custom_command(TARGET VertiRead POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/data ${EXECUTABLE_OUTPUT_PATH}/data)

elseif (${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
add_custom_command(TARGET VertiRead POST_BUILD
COMMAND ${CMAKE_COMMAND} -E make_directory ${EXECUTABLE_OUTPUT_PATH}/../Resources
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/rsc/Info.plist ${EXECUTABLE_OUTPUT_PATH}/..
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/rsc/icon.icns ${EXECUTABLE_OUTPUT_PATH}/../Resources
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/data ${EXECUTABLE_OUTPUT_PATH}/../Resources/data)

elseif (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
add_custom_command(TARGET VertiRead POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/rsc/vertiread.desktop ${EXECUTABLE_OUTPUT_PATH}
COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/data ${EXECUTABLE_OUTPUT_PATH}/data)
endif()

# filter file for ms visual studio
if (MSVC)
foreach(source IN LISTS SRC_FILES)
get_filename_component(source_dir ${source} PATH)
string(REPLACE "/" ";" dirs "${source_dir}")
list(GET dirs 0 dir0)

if (${dir0} MATCHES "rsc")
set(filter_path "Source")
else()
list(REMOVE_AT dirs 0)
list(INSERT dirs 0 "Source")
string(REPLACE ";" "\\" filter_path "${dirs}")
endif()
source_group("${filter_path}" FILES ${source})
endforeach()
endif()

126 changes: 0 additions & 126 deletions Makefile

This file was deleted.

13 changes: 4 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,10 @@ It still has some bugs and unfinished/untested parts.
There's no settings menu yet, so in order to change the settings, you need to edit the .ini files directly.
Used libraries are boost_filesystem, SDL2, SDL2_image, SDL2_ttf and SDL2_mixer.

The Qt project file is configured for Linux, Windows and OS X.
Note: When setting the output directory in Qt, don’t name it ‘build’ cause it might mess up the executable’s location.
The makefile is made only for Linux.
The Qt project and CMakeLists files are configured for Linux, Windows and OS X.
Note: When setting the output directory in Qt, don’t name it ‘build’, cause it might mess up the executable’s location.

##Linux
For simple build just use the makefile.
It's currently configured for the g++ compiler.
If you want to use clang++ or set a specific architecture, just look in the top section of the makefile.
There’s also a pre-made launcher, which is copied to the build directory after compilation.
You just need to add the executable’s and icon’s path to it.

Expand All @@ -24,11 +20,10 @@ The default font is set to "Arial" so you need the mscorefonts as well:
sudo apt-get install ttf-mscorefonts-installer

##Windows
Project files were created with MS Visual Studio 2015.
All needed libraries are already included in the project, however they're only build for the MSVC 2015.
All needed libraries are already included in the project, however they're built only for the MSVC 14 (2015).

##OS X
The Qt project file is set to use the SDL2 frameworks and boost library.
The project is configured to use the SDL2 frameworks and boost library.
Both need to be installed manually.
The frameworks’ location is set to /Library/Frameworks.
Boost is assumed to be located in /usr/local/include (headers) and /usr/local/lib (objects).
Expand Down
Loading

0 comments on commit 85c14a4

Please sign in to comment.