Skip to content

Commit

Permalink
Fix indentation and divided the cmake into libraries and bins
Browse files Browse the repository at this point in the history
- Each library and binary got their own CMakeLists.txt
- Indentation was fixed everywhere
- Weird if statement flows replaced
  • Loading branch information
Jettford committed Jan 22, 2022
1 parent c25a800 commit 005a124
Show file tree
Hide file tree
Showing 13 changed files with 243 additions and 278 deletions.
331 changes: 86 additions & 245 deletions CMakeLists.txt

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions dAuthServer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
file(
GLOB SOURCES_AUTH
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
*.cpp
)

add_executable(AuthServer ${SOURCES_AUTH})
target_link_libraries(AuthServer ${SHARED_LIBS})
8 changes: 8 additions & 0 deletions dChatFilter/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
file(
GLOB SOURCES_DCHATFILTER
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
*.cpp
)

add_library(dChatFilter ${SOURCES_DCHATFILTER})
10 changes: 10 additions & 0 deletions dChatServer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
file(
GLOB SOURCES_CHAT
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
*.cpp
)

add_executable(ChatServer ${SOURCES_CHAT})
target_link_libraries(ChatServer dChatFilter)
target_link_libraries(ChatServer ${SHARED_LIBS})
10 changes: 10 additions & 0 deletions dCommon/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
file(
GLOB SOURCES_DCOMMON
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
*.cpp
)

add_library(dCommon ${SOURCES_DCOMMON})
target_link_libraries(dCommon ZLIB::ZLIB)
target_link_libraries(dCommon libbcrypt)
10 changes: 10 additions & 0 deletions dDatabase/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
file(
GLOB SOURCES_DDATABASE
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
*.cpp
Tables/*.cpp
)

add_library(dDatabase ${SOURCES_DDATABASE})
target_link_libraries(dDatabase sqlite3)
16 changes: 16 additions & 0 deletions dGame/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
file(
GLOB SOURCES_DGAME
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
*.cpp
dBehaviors/*.cpp
dComponents/*.cpp
dGameMessages/*.cpp
dInventory/*.cpp
dMission/*.cpp
dEntity/*.cpp
dUtilities/*.cpp
../dScripts/*.cpp
)

add_library(dGame ${SOURCES_DGAME})
15 changes: 15 additions & 0 deletions dMasterServer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
file(
GLOB SOURCES_MASTER
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
*.cpp
)

add_executable(MasterServer ${SOURCES_MASTER})
target_link_libraries(MasterServer ${SHARED_LIBS})

if(WIN32)
add_dependencies(MasterServer WorldServer)
add_dependencies(MasterServer AuthServer)
add_dependencies(MasterServer ChatServer)
endif()
9 changes: 9 additions & 0 deletions dNet/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
file(
GLOB SOURCES_DNET
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
*.cpp
)

add_library(dNet ${SOURCES_DNET})
target_link_libraries(dNet dCommon) # Needed because otherwise linker errors occur.
8 changes: 8 additions & 0 deletions dPhysics/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
file(
GLOB SOURCES_DPHYSICS
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
*.cpp
)

add_library(dPhysics ${SOURCES_DPHYSICS})
17 changes: 17 additions & 0 deletions dWorldServer/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
file(
GLOB SOURCES_WORLD
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
*.cpp
)

add_executable(WorldServer ${SOURCES_WORLD})

target_link_libraries(WorldServer dChatFilter)
target_link_libraries(WorldServer dGame)
target_link_libraries(WorldServer dZoneManager)
target_link_libraries(WorldServer dPhysics)
target_link_libraries(WorldServer detour)
target_link_libraries(WorldServer recast)
target_link_libraries(WorldServer tinyxml2)
target_link_libraries(WorldServer ${SHARED_LIBS})
9 changes: 9 additions & 0 deletions dZoneManager/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Source Code for dZoneManager
file(
GLOB SOURCES_DZM
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
*.cpp
)

add_library(dZoneManager ${SOURCES_DZM})
69 changes: 36 additions & 33 deletions thirdparty/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,54 +1,53 @@
# Source Code for raknet
file(
GLOB SOURCES_RAKNET
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/raknet/Source/*.cpp
GLOB SOURCES_RAKNET
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/raknet/Source/*.cpp
)

# Source Code for recast
file(
GLOB SOURCES_RECAST
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/recastnavigation/Recast/Source/*.cpp
GLOB SOURCES_RECAST
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/recastnavigation/Recast/Source/*.cpp
)

# Source Code for detour
file(
GLOB SOURCES_DETOUR
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/recastnavigation/Detour/Source/*.cpp
GLOB SOURCES_DETOUR
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/recastnavigation/Detour/Source/*.cpp
)

# Source Code for tinyxml2
file(
GLOB SOURCES_TINYXML2
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2/tinyxml2.cpp
GLOB SOURCES_TINYXML2
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/tinyxml2/tinyxml2.cpp
)

# Source Code for libbcrypt
file(
GLOB SOURCES_LIBBCRYPT
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/libbcrypt/*.c
${CMAKE_CURRENT_SOURCE_DIR}/libbcrypt/src/*.c
GLOB SOURCES_LIBBCRYPT
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/libbcrypt/*.c
${CMAKE_CURRENT_SOURCE_DIR}/libbcrypt/src/*.c
)

file(
GLOB SOURCES_SQLITE3
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/SQLite/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/SQLite/*.c
GLOB SOURCES_SQLITE3
LIST_DIRECTORIES false
RELATIVE "${CMAKE_CURRENT_SOURCE_DIR}"
${CMAKE_CURRENT_SOURCE_DIR}/SQLite/*.cpp
${CMAKE_CURRENT_SOURCE_DIR}/SQLite/*.c
)

# 3rdparty static libraries:
#add_library(zlib ${SOURCES_ZLIB})
add_library(raknet ${SOURCES_RAKNET})
add_library(tinyxml2 ${SOURCES_TINYXML2})
add_library(detour ${SOURCES_DETOUR})
Expand All @@ -57,10 +56,14 @@ add_library(libbcrypt ${SOURCES_LIBBCRYPT})
add_library(sqlite3 ${SOURCES_SQLITE3})

if(UNIX)
target_link_libraries(sqlite3 pthread dl m)
target_link_libraries(sqlite3 pthread dl m)

# -Wno-unused-result -Wno-unknown-pragmas -fpermissive
target_compile_options(sqlite3 PRIVATE "-Wno-return-local-addr" "-Wno-maybe-uninitialized")
target_compile_options(raknet PRIVATE "-Wno-write-strings" "-Wformat-overflow=0" "-Wformat=0")
target_compile_options(libbcrypt PRIVATE "-Wno-implicit-function-declaration" "-Wno-int-conversion")
endif(UNIX)
# -Wno-unused-result -Wno-unknown-pragmas -fpermissive
target_compile_options(sqlite3 PRIVATE "-Wno-return-local-addr" "-Wno-maybe-uninitialized")
target_compile_options(raknet PRIVATE "-Wno-write-strings" "-Wformat-overflow=0" "-Wformat=0")
target_compile_options(libbcrypt PRIVATE "-Wno-implicit-function-declaration" "-Wno-int-conversion")
endif()

if(WIN32)
target_link_libraries(raknet ws2_32)
endif()

0 comments on commit 005a124

Please sign in to comment.