Skip to content

Commit

Permalink
refactoring.. renaming
Browse files Browse the repository at this point in the history
  • Loading branch information
mfreiholz committed Jan 4, 2018
1 parent 5ac93dd commit 5357ba5
Show file tree
Hide file tree
Showing 139 changed files with 566 additions and 753 deletions.
24 changes: 12 additions & 12 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,14 @@ cmake_policy(SET CMP0020 NEW)
include(cmake/compiler.cmake)
include(cmake/thirdparty.cmake)
include(cmake/thirdparty-external.cmake)
include(cmake/project-macro.cmake)

# Generate global version header file.
set(VERSION_MAJOR "0" CACHE INTERNAL "Major software version" FORCE)
set(VERSION_MINOR "13" CACHE INTERNAL "Minor software version" FORCE)
set(VERSION_PATCH "0" CACHE INTERNAL "Patch software version" FORCE)
set(VERSION_EXTRA "" CACHE INTERNAL "Additional software version information, e.g.: release, beta, alpha, dev" FORCE)
FILE(WRITE projects/project-defines.h
FILE(WRITE $ENV{OCS_BUILD_DIR_PATH}/project-defines.h
"// Generated project version header.
\#ifndef VERSION_H_IN
\#define VERSION_H_IN
Expand All @@ -26,29 +27,28 @@ FILE(WRITE projects/project-defines.h
\#endif
"
)
include_directories(projects)
include_directories($ENV{OCS_BUILD_DIR_PATH})

# project independend libs (+stl)
# Libraries with STL dependency.
add_subdirectory(projects/libbase)
add_subdirectory(projects/libcorprotocol)
add_subdirectory(projects/libdaemon)
add_subdirectory(projects/libmediaprotocol)

# project independend libs (+qt)
# Libraries with Qt dependency.
add_subdirectory(projects/libqtcorprotocol)
add_subdirectory(projects/libqtasync)

# project specific libs (+stl)
add_subdirectory(projects/libbase)
add_subdirectory(projects/libmediaprotocol)

# project specific libs (+qt)
add_subdirectory(projects/libqtteamspeak3)

# programs
# Library for all apps.
add_subdirectory(projects/libapp)

# Server binaries.
if(IncludeServerPrograms)
add_subdirectory(projects/videolib)
add_subdirectory(projects/videoserver)
endif(IncludeServerPrograms)

# Client binaries.
if(IncludeClientPrograms)
add_subdirectory(projects/videoclient)
add_subdirectory(projects/ts3plugin)
Expand Down
9 changes: 6 additions & 3 deletions cmake/compiler.cmake
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Architecture
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(ARCH "x86-64")
Expand All @@ -9,17 +8,21 @@ else(CMAKE_SIZEOF_VOID_P EQUAL 8)
endif(CMAKE_SIZEOF_VOID_P EQUAL 8)

# Windows
add_definitions(-DNOMINMAX) # Required for bug in QDateTime header (min())
if(WIN32)
add_definitions(-DNOMINMAX) # Required for bug in QDateTime header (min())
endif(WIN32)

# Linux
if(CMAKE_COMPILER_IS_GNUCC)
# GCC 4.8.4 C++11
#set(CMAKE_CXX_FLAGS "-std=c++11")

# GCC 4.8.4 C++14
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++1y")

# GCC 5.2.X C++14
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14")

# Strict flags
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -pedantic -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
endif(CMAKE_COMPILER_IS_GNUCC)
79 changes: 79 additions & 0 deletions cmake/project-macro.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
MACRO(CREATE_PROJECT_STATIC_LIBRARY name_)
cmake_minimum_required(VERSION 3.8)
project(${name_})

### Sources

file(GLOB_RECURSE headers ${PROJECT_NAME}/*.h)
file(GLOB_RECURSE sources_cpp ${PROJECT_NAME}/*.cpp)
file(GLOB_RECURSE sources_c ${PROJECT_NAME}/*.c)

set(sources "")
list(APPEND sources ${sources_cpp} ${sources_c})

source_group(
TREE ${CMAKE_CURRENT_SOURCE_DIR}
FILES ${headers} ${sources}
)

### Binaries

add_library(
${PROJECT_NAME}
STATIC
${headers}
${sources}
)

target_include_directories(
${PROJECT_NAME}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
)
ENDMACRO()

#######################################################################

MACRO(CREATE_PROJECT_STATIC_QT_LIBRARY name_)
cmake_minimum_required(VERSION 3.8)
project(${name_})

### Qt

cmake_policy(SET CMP0020 NEW)

set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)

### Sources

file(GLOB_RECURSE headers ${PROJECT_NAME}/*.h)
file(GLOB_RECURSE sources_cpp ${PROJECT_NAME}/*.cpp)
file(GLOB_RECURSE sources_c ${PROJECT_NAME}/*.c)
file(GLOB_RECURSE qtforms ${PROJECT_NAME}/*.ui)
file(GLOB_RECURSE qtres ${PROJECT_NAME}/*.qrc)

set(sources "")
list(APPEND sources ${sources_cpp} ${sources_c})

source_group(
TREE ${CMAKE_CURRENT_SOURCE_DIR}
FILES ${headers} ${sources}
)

### Binaries

add_library(
${PROJECT_NAME}
STATIC
${headers}
${sources}
${qtforms}
${qtres}
)

target_include_directories(
${PROJECT_NAME}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
)
ENDMACRO()
14 changes: 14 additions & 0 deletions projects/libapp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
CREATE_PROJECT_STATIC_QT_LIBRARY(libapp)

find_package(Qt5Core REQUIRED)
find_package(Qt5Gui REQUIRED)
find_package(Qt5Network REQUIRED)
find_package(Qt5Test REQUIRED)

target_link_libraries(
${PROJECT_NAME}
PUBLIC Qt5::Core
PUBLIC Qt5::Gui
PUBLIC Qt5::Network
PUBLIC libbase
)
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
31 changes: 1 addition & 30 deletions projects/libbase/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,30 +1 @@
cmake_minimum_required(VERSION 3.8)
project(libbase)

if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
endif()

### Sources

file(GLOB_RECURSE headers ${PROJECT_NAME}/*.h)
file(GLOB_RECURSE sources ${PROJECT_NAME}/*.cpp)

source_group(
TREE ${CMAKE_CURRENT_SOURCE_DIR}
FILES ${headers} ${sources}
)

### Binaries

add_library(
${PROJECT_NAME}
STATIC
${headers}
${sources}
)

target_include_directories(
${PROJECT_NAME}
PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}
)
CREATE_PROJECT_STATIC_LIBRARY(libbase)
2 changes: 1 addition & 1 deletion projects/libbase/libbase/defines.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <stdint.h>

// Defines from build system
#include "project-defines.h"
//#include "project-defines.h"

// Namespaces
#define OCS_NAMESPACE_BEGIN namespace ocs {
Expand Down
27 changes: 3 additions & 24 deletions projects/libcorprotocol/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,29 +1,8 @@
cmake_minimum_required(VERSION 2.8)
project(libcorprotocol)

if(CMAKE_COMPILER_IS_GNUCXX)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Wextra -pedantic")
endif()

set(headers
protocol.h
parser.h
)

set(sources
parser.c
)

add_library(
${PROJECT_NAME}
STATIC
${headers}
${sources}
)
CREATE_PROJECT_STATIC_LIBRARY(libcorprotocol)

if(WIN32)
target_link_libraries(
${PROJECT_NAME}
Ws2_32.dll
PRIVATE Ws2_32.dll
)
endif()
endif(WIN32)
File renamed without changes.
File renamed without changes.
File renamed without changes.
24 changes: 1 addition & 23 deletions projects/libdaemon/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1 @@
cmake_minimum_required(VERSION 2.8)
project(libdaemon)

set(headers
api.h
)

set(sources
main.c
)

if(WIN32)
list(APPEND sources impl_windows.c)
else(WIN32)
list(APPEND sources impl_linux.c)
endif(WIN32)

add_library(
${PROJECT_NAME}
STATIC
${headers}
${sources}
)
CREATE_PROJECT_STATIC_LIBRARY(libdaemon)
29 changes: 0 additions & 29 deletions projects/libdaemon/api.h

This file was deleted.

26 changes: 0 additions & 26 deletions projects/libdaemon/impl_linux.c

This file was deleted.

Loading

0 comments on commit 5357ba5

Please sign in to comment.