From ee0db87047f8bf9f385e459ed7354f53db77d22f Mon Sep 17 00:00:00 2001 From: Vladislav Gritsenko Date: Wed, 26 Jul 2017 19:38:38 +0300 Subject: [PATCH] project setup --- .editorconfig | 16 ++++++++++++ .gitignore | 32 +++++++++++++++++++++++ CMakeLists.txt | 68 ++++++++++++++++++++++++++++++++++++++++++++++++ Makefile | 2 ++ clean-rebuild.sh | 13 +++++++++ vs2017_cmake.bat | 2 ++ 6 files changed, 133 insertions(+) create mode 100644 .editorconfig create mode 100644 .gitignore create mode 100644 CMakeLists.txt create mode 100644 Makefile create mode 100644 clean-rebuild.sh create mode 100644 vs2017_cmake.bat diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..89f760d --- /dev/null +++ b/.editorconfig @@ -0,0 +1,16 @@ +# EditorConfig is awesome: http://EditorConfig.org + +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true + +# Set default charset +charset = utf-8 + +# 4 space indentation +indent_style = space +indent_size = 4 diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..47dc24b --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +# binaries +**/*.dll +**/*.exe + +# directories +bin-*/* +distrib/build_*/* + +# building stuff +build/* +build-mac/* +build-lin/* +build-win/* +*.dir/* +x64/* +x86/* +client.dir/* +server.dir/* +.vs/* + +!build-mac/.keep +!build-lin/.keep +!build-win/.keep +!build-mac/resources +!build-lin/resources +!build-win/Debug/resources + +# os stuff +.DS_Store +Thumbs.db + +*.swp diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..411698a --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,68 @@ +### +# CMake entry point +### +cmake_minimum_required (VERSION 2.8) +project (urgmp) + + +### +# Predefines to block make at the root +### +if( CMAKE_BINARY_DIR STREQUAL CMAKE_SOURCE_DIR ) + message( FATAL_ERROR "Please select another Build Directory ! (and give it a clever name, like bin_Visual2012_64bits/)" ) +endif() +if( CMAKE_SOURCE_DIR MATCHES " " ) + message( "Your Source Directory contains spaces. If you experience problems when compiling, this can be the cause." ) +endif() +if( CMAKE_BINARY_DIR MATCHES " " ) + message( "Your Build Directory contains spaces. If you experience problems when compiling, this can be the cause." ) +endif() + +set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11") + +set(SDL_SHARED_ENABLED_BY_DEFAULT OFF CACHE BOOL "Generate the DLL project if true.") + +### +# Compile vendor dependencies +### +add_subdirectory(vendor/reguider) + +### +# Includes for libs and remote sources +### +include_directories( + vendor/reguider/include + client/hooking/MinHook/include + server/ + shared/ +) + +### +# Includes for current source executable +### +file(GLOB_RECURSE SERVER_FILES "${PROJECT_SOURCE_DIR}/server/*.cpp") + +file(GLOB_RECURSE CLIENT_FILES + "${PROJECT_SOURCE_DIR}/client/*.cpp" + "${PROJECT_SOURCE_DIR}/client/*.c" + "${PROJECT_SOURCE_DIR}/client/*.h" + "${PROJECT_SOURCE_DIR}/client/*.hpp" +) + +if(MSVC) + GroupSources(client) + GroupSources(server) + GroupSources(shared) +endif() + +### +# Adding executables +### +add_executable(server ${SERVER_FILES}) +add_library(client SHARED ${CLIENT_FILES}) + +### +# Linking libraries +### +target_link_libraries(server librg) +target_link_libraries(client librg d3d11 dxgi) diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..0c28aa5 --- /dev/null +++ b/Makefile @@ -0,0 +1,2 @@ +all: + @echo "You should go inside build directory, and use 'cmake ..' from inside to genearate make files for your system" diff --git a/clean-rebuild.sh b/clean-rebuild.sh new file mode 100644 index 0000000..0a6245e --- /dev/null +++ b/clean-rebuild.sh @@ -0,0 +1,13 @@ +#!/bin/sh + +BUILD_DIR="build" +BASEDIR=$(dirname "$0"); +TARGET=$BASEDIR"/"$BUILD_DIR"/" + +rm -rf $TARGET; +mkdir -p $TARGET; +cd $TARGET; + +cmake .. +make all + diff --git a/vs2017_cmake.bat b/vs2017_cmake.bat new file mode 100644 index 0000000..9a1ce96 --- /dev/null +++ b/vs2017_cmake.bat @@ -0,0 +1,2 @@ +cd build +cmake .. -G"Visual Studio 15 2017 Win64" \ No newline at end of file