Skip to content

Commit

Permalink
All dependencies are now included as submodules. Fixes #101.
Browse files Browse the repository at this point in the history
  • Loading branch information
Unarelith committed May 22, 2020
1 parent b344805 commit 12aaad6
Show file tree
Hide file tree
Showing 9 changed files with 37 additions and 142 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
Expand Up @@ -13,3 +13,6 @@
path = external/sol2
url = https://github.com/ThePhD/sol2.git
ignore = dirty
[submodule "external/lua"]
path = external/lua
url = https://github.com/walterschell/Lua.git
66 changes: 5 additions & 61 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ set(CMAKE_EXPORT_COMPILE_COMMANDS ON)

list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")

if (WIN32)
set(WIN_LIBRARIES_PATH "C:/Libraries")
endif ()

if (APPLE)
add_definitions(-DGL_SILENCE_DEPRECATION=1)
endif ()
Expand Down Expand Up @@ -45,74 +41,17 @@ endif()

#------------------------------------------------------------------------------
# Packages
#------------------------------------------------------------------------------
# - Lua
#------------------------------------------------------------------------------
if (WIN32)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${WIN_LIBRARIES_PATH}/lua)
endif ()

find_package(Lua REQUIRED)

if(NOT LUA_FOUND)
message(FATAL_ERROR "Lua is needed to build the project. Please install it correctly.")
endif()

include_directories(${LUA_INCLUDE_DIR})
link_directories(${LUA_LIBRARY_DIRS})

#------------------------------------------------------------------------------
# - tinyxml2
#------------------------------------------------------------------------------
if (WIN32)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${WIN_LIBRARIES_PATH}/tinyxml2)
endif ()

find_package(TinyXml2 REQUIRED)

if(NOT TINYXML2_FOUND)
message(FATAL_ERROR "tinyxml2 is needed to build the project. Please install it correctly.")
endif()

include_directories(${TINYXML2_INCLUDE_DIRS})

#------------------------------------------------------------------------------
# - OpenGL
#------------------------------------------------------------------------------
set(OpenGL_GL_PREFERENCE "LEGACY")

if (WIN32)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${WIN_LIBRARIES_PATH}/glm)
endif ()

find_package(OpenGL REQUIRED)
find_package(GLM REQUIRED)

if(NOT OPENGL_FOUND)
message(FATAL_ERROR "OpenGL not found!")
endif(NOT OPENGL_FOUND)

if(NOT GLM_FOUND)
message(FATAL_ERROR "glm not found!")
endif(NOT GLM_FOUND)

include_directories(${GLM_INCLUDE_DIRS})

#------------------------------------------------------------------------------
# - GLEW
#------------------------------------------------------------------------------
if (WIN32)
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} ${WIN_LIBRARIES_PATH}/glew)

find_package(GLEW REQUIRED)

if(NOT GLEW_FOUND)
message(FATAL_ERROR "GLEW not found!")
endif(NOT GLEW_FOUND)

include_directories(${GLEW_INCLUDE_DIRS})
endif ()

#------------------------------------------------------------------------------
# Submodules
# from https://cliutils.gitlab.io/modern-cmake/chapters/projects/submodule.html
Expand Down Expand Up @@ -153,6 +92,11 @@ include_directories(external/gamekit/include)
#------------------------------------------------------------------------------
add_subdirectory(external/zlib ${CMAKE_CURRENT_BINARY_DIR}/external/zlib)

#------------------------------------------------------------------------------
# - lua
#------------------------------------------------------------------------------
add_subdirectory(external/lua)

#------------------------------------------------------------------------------
# - sol3 (sol2 v3.x)
#------------------------------------------------------------------------------
Expand Down
53 changes: 0 additions & 53 deletions cmake/FindGLM.cmake

This file was deleted.

16 changes: 0 additions & 16 deletions cmake/FindTinyXml2.cmake

This file was deleted.

2 changes: 1 addition & 1 deletion external/gamekit
1 change: 1 addition & 0 deletions external/lua
Submodule lua added at 722505
9 changes: 5 additions & 4 deletions source/client/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -51,15 +51,16 @@ target_link_libraries(${PROJECT_NAME}
${CMAKE_PROJECT_NAME}_server_lib
${CMAKE_PROJECT_NAME}_common
gamekit
${OPENGL_LIBRARIES}
${TINYXML2_LIBRARIES}
${GLEW_LIBRARIES}
${LUA_LIBRARIES}
tinyxml2
libglew_static
lua_static
sfml-system
sfml-window
sfml-network
sfml-graphics
sfml-audio
zlib
glm
${OPENGL_LIBRARIES}
${UNIX_LIBS})

15 changes: 13 additions & 2 deletions source/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,12 @@ endforeach(HEADER_FILE)
# Add library
#------------------------------------------------------------------------------
add_library(${PROJECT_NAME} STATIC ${SOURCE_FILES})
add_dependencies(${PROJECT_NAME} zlib EnTT gamekit)

add_dependencies(${PROJECT_NAME}
zlib
EnTT
gamekit
lua_static)

#------------------------------------------------------------------------------
# Compiler flags
Expand All @@ -35,5 +40,11 @@ target_compile_options(${PROJECT_NAME} PRIVATE -DSOL_CHECK_ARGUMENTS -DSOL_PRINT

# target_compile_options(${PROJECT_NAME} PRIVATE -pg)

target_link_libraries(${PROJECT_NAME} sfml-system sfml-network zlib)
target_link_libraries(${PROJECT_NAME}
sfml-system
sfml-network
tinyxml2
zlib
lua_static
glm)

14 changes: 9 additions & 5 deletions source/server/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -64,18 +64,22 @@ if (UNIX)
set (UNIX_LIBS -ldl)
endif ()

target_link_libraries(${PROJECT_NAME}_lib sfml-system sfml-network)
target_link_libraries(${PROJECT_NAME}_lib
sfml-system
sfml-network
glm)

target_link_libraries(${PROJECT_NAME}
${PROJECT_NAME}_lib
${CMAKE_PROJECT_NAME}_common
gamekit
${OPENGL_LIBRARIES}
${TINYXML2_LIBRARIES}
${GLEW_LIBRARIES}
${LUA_LIBRARIES}
tinyxml2
libglew_static
lua_static
sfml-system
sfml-network
zlib
glm
${OPENGL_LIBRARIES}
${UNIX_LIBS})

0 comments on commit 12aaad6

Please sign in to comment.