diff --git a/CMakeLists.txt b/CMakeLists.txt index 75118d22e..b93771e34 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -81,8 +81,8 @@ show_dependency_status("Freetype" ${FREETYPE_FOUND} "${FREETYPE_LIBRARY}") if(MYSQL) show_dependency_status("MySQL" ${MYSQL_FOUND} "") endif() -show_dependency_status("Ogg" ${OGG_FOUND} "${OGG_LIBRARY}") -show_dependency_status("Opus" ${OPUS_FOUND} "${OPUS_LIBRARY}") +show_dependency_status("Ogg" ${OGG_FOUND} "${OGG_INCLUDEDIR}") +show_dependency_status("Opus" ${OPUS_FOUND} "${OPUS_INCLUDEDIR}") show_dependency_status("Opusfile" ${OPUSFILE_FOUND} "${OPUSFILE_LIBRARY}") show_dependency_status("PythonInterp" ${PYTHONINTERP_FOUND} "") show_dependency_status("SDL2" ${SDL2_FOUND} "${SDL2_LIBRARY}") @@ -117,14 +117,23 @@ endif() if(NOT(ZLIB_FOUND)) - unset(ZLIB_LIBRARIES) + set(ZLIB_LIBRARIES) file(GLOB ZLIB_SRC "src/engine/external/zlib/*.c" "src/engine/external/zlib/*.h") + include_directories(src/engine/external/zlib/) add_library(zlib OBJECT ${ZLIB_SRC}) set(ZLIB $) else() set(ZLIB) endif() +if(TARGET_OS STREQUAL "windows") + set(PLATFORM_CLIENT_LIBS opengl32 glu32 winmm) + set(PLATFORM_LIBS ws2_32) # Windows sockets +else() + set(PLATFORM_CLIENT_LIBS GL GLU X11) + set(PLATFORM_LIBS) +endif() + ######################################################################## # CODE GENERATION ######################################################################## @@ -188,7 +197,7 @@ endif() set(DEPS ${DEP_MD5} ${DEP_WEBSOCKETS}) # Libraries -set(LIBS ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES}) +set(LIBS ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES} ${PLATFORM_LIBS}) # Targets add_library(engine-shared OBJECT ${ENGINE_SHARED} ${BASE} ${DEPS}) @@ -226,13 +235,9 @@ if(CLIENT) ${LIBS} ${CURL_LIBRARIES} ${FREETYPE_LIBRARIES} - ${OGG_LIBRARIES} ${OPUSFILE_LIBRARIES} - ${OPUS_LIBRARIES} ${SDL2_LIBRARIES} - GL - GLU - X11 + ${PLATFORM_CLIENT_LIBS} ) # Target diff --git a/cmake/FindFreetype.cmake b/cmake/FindFreetype.cmake index 522ec2c23..b213488a3 100644 --- a/cmake/FindFreetype.cmake +++ b/cmake/FindFreetype.cmake @@ -1,5 +1,22 @@ find_package(PkgConfig QUIET) -pkg_check_modules(FREETYPE freetype2) +pkg_check_modules(PC_FREETYPE freetype2) +set_extra_dirs(FREETYPE freetype) + +find_path(FREETYPE_INCLUDEDIR ft2build.h + PATH_SUFFIXES freetype2 + HINTS ${PC_FREETYPE_INCLUDEDIR} ${PC_FREETYPE_INCLUDE_DIRS} + PATHS ${EXTRA_FREETYPE_INCLUDEDIR} +) +find_library(FREETYPE_LIBRARY + NAMES freetype + HINTS ${PC_FREETYPE_LIBDIR} ${PC_FREETYPE_LIBRARY_DIRS} + PATHS ${EXTRA_FREETYPE_LIBDIR} +) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Freetype DEFAULT_MSG FREETYPE_LIBRARIES) +find_package_handle_standard_args(Freetype DEFAULT_MSG FREETYPE_LIBRARY FREETYPE_INCLUDEDIR) + +mark_as_advanced(FREETYPE_LIBRARY FREETYPE_INCLUDEDIR) + +set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY}) +set(FREETYPE_INCLUDE_DIRS ${FREETYPE_INCLUDEDIR}) diff --git a/cmake/FindOgg.cmake b/cmake/FindOgg.cmake index adef3d04a..1ab1c5c4b 100644 --- a/cmake/FindOgg.cmake +++ b/cmake/FindOgg.cmake @@ -8,16 +8,10 @@ find_path(OGG_INCLUDEDIR ogg.h HINTS ${PC_OGG_INCLUDEDIR} ${PC_OGG_INCLUDE_DIRS} PATHS ${EXTRA_OGG_INCLUDEDIR} ) -find_library(OGG_LIBRARY - NAMES ogg - HINTS ${PC_OGG_LIBDIR} ${PC_OGG_LIBRARY_DIRS} - PATHS ${EXTRA_OGG_LIBDIR} -) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Ogg DEFAULT_MSG OGG_LIBRARY OGG_INCLUDEDIR) +find_package_handle_standard_args(Ogg DEFAULT_MSG OGG_INCLUDEDIR) -mark_as_advanced(OGG_LIBRARY OGG_INCLUDEDIR) +mark_as_advanced(OGG_INCLUDEDIR) -set(OGG_LIBRARIES ${OGG_LIBRARY}) set(OGG_INCLUDE_DIRS ${OGG_INCLUDEDIR}) diff --git a/cmake/FindOpus.cmake b/cmake/FindOpus.cmake index e33c31a25..d57aea509 100644 --- a/cmake/FindOpus.cmake +++ b/cmake/FindOpus.cmake @@ -7,16 +7,10 @@ find_path(OPUS_INCLUDEDIR opus.h HINTS ${PC_OPUS_INCLUDEDIR} ${PC_OPUS_INCLUDE_DIRS} PATHS ${EXTRA_OPUS_INCLUDEDIR} ) -find_library(OPUS_LIBRARY - NAMES opus - HINTS ${PC_OPUS_LIBDIR} ${PC_OPUS_LIBRARY_DIRS} - PATHS ${EXTRA_OPUS_LIBDIR} -) include(FindPackageHandleStandardArgs) -find_package_handle_standard_args(Opus DEFAULT_MSG OPUS_LIBRARY OPUS_INCLUDEDIR) +find_package_handle_standard_args(Opus DEFAULT_MSG OPUS_INCLUDEDIR) -mark_as_advanced(OPUS_LIBRARY OPUS_INCLUDEDIR) +mark_as_advanced(OPUS_INCLUDEDIR) -set(OPUS_LIBRARIES ${OPUS_LIBRARY}) set(OPUS_INCLUDE_DIRS ${OPUS_INCLUDEDIR}) diff --git a/cmake/FindSDL2.cmake b/cmake/FindSDL2.cmake index a0428e4b1..25bebb67a 100644 --- a/cmake/FindSDL2.cmake +++ b/cmake/FindSDL2.cmake @@ -1,7 +1,7 @@ find_package(PkgConfig QUIET) pkg_check_modules(PC_SDL2 sdl2) -set_extra_dirs(SDL2 opus) +set_extra_dirs(SDL2 sdl) find_path(SDL2_INCLUDEDIR SDL.h PATH_SUFFIXES SDL2