game-test/CMakeLists.txt

67 lines
2.7 KiB
CMake
Raw Normal View History

2019-09-03 04:07:40 +00:00
cmake_minimum_required(VERSION 3.13)
project(blah)
set(CMAKE_BUILD_TYPE Debug)
2019-09-03 04:07:40 +00:00
include_directories("${PROJECT_SOURCE_DIR}/src/")
2019-09-23 02:20:56 +00:00
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_C_STANDARD 11)
2019-09-03 04:07:40 +00:00
#add_executable(test ${PROJECT_SOURCE_DIR}/src/test.cpp)
find_package(PkgConfig REQUIRED)
# OpenGL
find_package(OpenGL REQUIRED)
find_package(GLUT REQUIRED)
pkg_search_module(GLFW REQUIRED glfw3)
# I can't get glew to initial windows. Always fails
# with error 4 (Unknown) on Debian sid. - Kienan 2019.08.03
#find_package(GLEW REQUIRED)
2019-09-03 04:07:40 +00:00
# Glad
set(GLAD_API "gl=3.3,gles2=3.0" CACHE STRING " " FORCE)
2019-09-03 04:07:40 +00:00
add_subdirectory("${PROJECT_SOURCE_DIR}/3rdparty/glad")
# Nuklear
set(NUKLEAR_INCLUDE_DIR "${PROJECT_SOURCE_DIR}/3rdparty/nuklear")
# Imgui
add_definitions(-DIMGUI_IMPL_LOADER_GLAD)
set(imgui_dir "${PROJECT_SOURCE_DIR}/3rdparty/imgui")
add_library(imgui STATIC
${imgui_dir}/imgui.h
${imgui_dir}/imstb_rectpack.h ${imgui_dir}/imstb_textedit.h ${imgui_dir}/imstb_truetype.h ${imgui_dir}/imgui_internal.h
${imgui_dir}/imgui.cpp ${imgui_dir}/imgui_draw.cpp ${imgui_dir}/imgui_widgets.cpp)
target_compile_definitions(imgui PUBLIC -DIMGUI_IMPL_OPENGL_LOADER_GLAD)
target_include_directories(imgui PUBLIC ${imgui_dir})
# Imgui glfw-gl3
set(igo_dir "${PROJECT_SOURCE_DIR}/src/client/imgui")
add_library(imgui-glfw-gl3 STATIC
${igo_dir}/imgui_impl_glfw.h ${igo_dir}/imgui_impl_opengl3.h
${igo_dir}/imgui_impl_glfw.cpp ${igo_dir}/imgui_impl_opengl3.cpp
)
target_compile_definitions(imgui-glfw-gl3 PUBLIC -DIMGUI_IMPL_OPENGL_LOADER_GLAD)
target_include_directories(imgui-glfw-gl3 PUBLIC ${igo_dir})
target_link_libraries(imgui-glfw-gl3 PUBLIC
${GLFW_LIBRARIES} ${OPENGL_LIBRARIES} glad imgui
)
# Client (Nuklear, default)
2019-09-03 04:07:40 +00:00
#target_include_directories(client "${PROJECT_SOURCE_DIR}/src/client")
add_executable(client ${PROJECT_SOURCE_DIR}/src/client/client.cpp)
target_include_directories(client PUBLIC ${GLFW_INCLUDE_DIRS} ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIRS} ${NUKLEAR_INCLUDE_DIR} ${GLAD_INCLUDE_DIRS})
target_link_libraries(client ${GLFW_LIBRARIES} ${GLUT_LIBRARY}
${OPENGL_LIBRARIES} ${GLAD_LIBRARIES} ${CMAKE_DL_LIBS})
# Client (Imgui)
add_executable(client_imgui ${PROJECT_SOURCE_DIR}/src/client/client_imgui.cpp)
target_compile_definitions(client_imgui PUBLIC -DIMGUI_IMPL_OPENGL_LOADER_GLAD)
target_include_directories(client_imgui PUBLIC ${GLFW_INCLUDE_DIRS} ${GLUT_INCLUDE_DIR} ${OPENGL_INCLUDE_DIRS} ${GLAD_INCLUDE_DIRS} ${imgui_dir} ${igo_dir})
target_link_libraries(client_imgui ${GLFW_LIBRARIES} ${GLUT_LIBRARY}
${OPENGL_LIBRARIES} ${GLAD_LIBRARIES} ${CMAKE_DL_LIBS} imgui imgui-glfw-gl3)
2019-09-03 04:07:40 +00:00
# Server
#target_include_directories(server "${PROJECT_SOURCE_DIR}/src/server")
add_executable(server ${PROJECT_SOURCE_DIR}/src/server/server.cpp)