]> git.lizzy.rs Git - dragonblocks_alpha.git/blobdiff - src/CMakeLists.txt
Use portable getline
[dragonblocks_alpha.git] / src / CMakeLists.txt
index bb6123108aca7e5ac4cc4c3a442ca900691090e0..896d84537a3078c66ca4163845d38253368952d6 100644 (file)
@@ -16,9 +16,26 @@ endif()
 # Dependencies
 
 find_package(OpenGL REQUIRED)
-find_package(GLEW REQUIRED)
-find_package(glfw3 3.3 REQUIRED)
-find_package(Freetype REQUIRED)
+
+if(NOT GLEW_LIBRARIES OR NOT GLEW_INCLUDE_DIRS)
+       find_package(GLEW REQUIRED)
+endif()
+
+if(NOT GLFW_LIBRARIES OR NOT GLFW_INCLUDE_DIRS)
+       find_package(glfw3 3.3 REQUIRED)
+       set(GLFW_LIBRARIES glfw)
+       set(GLFW_INCLUDE_DIRS)
+endif()
+
+if(NOT FREETYPE_LIBRARIES OR NOT FREETYPE_INCLUDE_DIRS)
+       find_package(Freetype REQUIRED)
+endif()
+
+if(NOT ZLIB_LIBRARIES OR NOT ZLIB_INCLUDE_DIRS)
+       find_package(ZLIB REQUIRED)
+       set(ZLIB_LIBRARIES ZLIB::ZLIB)
+       set(ZLIB_INCLUDE_DIRS)
+endif()
 
 # Options
 
@@ -29,17 +46,18 @@ endif()
 add_compile_definitions("USE_DRAGONNET")
 add_compile_definitions("RESSOURCE_PATH=\"${RESSOURCE_PATH}\"")
 
-add_compile_options(-Wall -Wextra -Werror -Wno-address-of-packed-member -fmax-errors=4)
+add_compile_options(-Wall -Wextra -Werror -Wno-address-of-packed-member -Wno-implicit-fallthrough -Wno-unused-parameter -Wno-maybe-uninitialized -fmax-errors=4)
 
 link_libraries(
        pthread
        m
-       z
+       ${ZLIB_LIBRARIES}
 )
 
 include_directories(SYSTEM ${DEPS_DIR})
 include_directories(BEFORE ${CMAKE_CURRENT_SOURCE_DIR})
 include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR})
+include_directories(${ZLIB_INCLUDE_DIRS})
 
 # System specific options
 
@@ -72,7 +90,10 @@ set(COMMON_SOURCES
        "${DEPS_DIR}/dragonstd/refcount.c"
        "${DEPS_DIR}/dragonstd/tree.c"
        "${DEPS_DIR}/dragonstd/bits/compare.c"
+       "${DEPS_DIR}/getline/getline.c"
        "${DEPS_DIR}/linenoise/linenoise.c"
+       "${DEPS_DIR}/linenoise/stringbuf.c"
+       "${DEPS_DIR}/linenoise/utf8.c"
        "${DEPS_DIR}/perlin/perlin.c"
        color.c
        config.c
@@ -126,11 +147,13 @@ add_executable(dragonblocks
 target_link_libraries(dragonblocks
        ${OPENGL_LIBRARIES}
        ${GLEW_LIBRARIES}
-       glfw
+       ${GLFW_LIBRARIES}
        ${FREETYPE_LIBRARIES}
 )
 
 target_include_directories(dragonblocks PUBLIC
+       ${GLEW_INCLUDE_DIRS}
+       ${GLFW_INCLUDE_DIRS}
        ${FREETYPE_INCLUDE_DIRS}
 )