CMakeLists.txt: Windows support?

This commit is contained in:
heinrich5991 2017-03-02 12:31:20 +01:00
parent a7e68fbf1b
commit 1157a9a835
5 changed files with 38 additions and 28 deletions

View file

@ -81,8 +81,8 @@ show_dependency_status("Freetype" ${FREETYPE_FOUND} "${FREETYPE_LIBRARY}")
if(MYSQL) if(MYSQL)
show_dependency_status("MySQL" ${MYSQL_FOUND} "") show_dependency_status("MySQL" ${MYSQL_FOUND} "")
endif() endif()
show_dependency_status("Ogg" ${OGG_FOUND} "${OGG_LIBRARY}") show_dependency_status("Ogg" ${OGG_FOUND} "${OGG_INCLUDEDIR}")
show_dependency_status("Opus" ${OPUS_FOUND} "${OPUS_LIBRARY}") show_dependency_status("Opus" ${OPUS_FOUND} "${OPUS_INCLUDEDIR}")
show_dependency_status("Opusfile" ${OPUSFILE_FOUND} "${OPUSFILE_LIBRARY}") show_dependency_status("Opusfile" ${OPUSFILE_FOUND} "${OPUSFILE_LIBRARY}")
show_dependency_status("PythonInterp" ${PYTHONINTERP_FOUND} "") show_dependency_status("PythonInterp" ${PYTHONINTERP_FOUND} "")
show_dependency_status("SDL2" ${SDL2_FOUND} "${SDL2_LIBRARY}") show_dependency_status("SDL2" ${SDL2_FOUND} "${SDL2_LIBRARY}")
@ -117,14 +117,23 @@ endif()
if(NOT(ZLIB_FOUND)) if(NOT(ZLIB_FOUND))
unset(ZLIB_LIBRARIES) set(ZLIB_LIBRARIES)
file(GLOB ZLIB_SRC "src/engine/external/zlib/*.c" "src/engine/external/zlib/*.h") 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}) add_library(zlib OBJECT ${ZLIB_SRC})
set(ZLIB $<TARGET_OBJECTS:zlib>) set(ZLIB $<TARGET_OBJECTS:zlib>)
else() else()
set(ZLIB) set(ZLIB)
endif() 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 # CODE GENERATION
######################################################################## ########################################################################
@ -188,7 +197,7 @@ endif()
set(DEPS ${DEP_MD5} ${DEP_WEBSOCKETS}) set(DEPS ${DEP_MD5} ${DEP_WEBSOCKETS})
# Libraries # Libraries
set(LIBS ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES}) set(LIBS ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES} ${PLATFORM_LIBS})
# Targets # Targets
add_library(engine-shared OBJECT ${ENGINE_SHARED} ${BASE} ${DEPS}) add_library(engine-shared OBJECT ${ENGINE_SHARED} ${BASE} ${DEPS})
@ -226,13 +235,9 @@ if(CLIENT)
${LIBS} ${LIBS}
${CURL_LIBRARIES} ${CURL_LIBRARIES}
${FREETYPE_LIBRARIES} ${FREETYPE_LIBRARIES}
${OGG_LIBRARIES}
${OPUSFILE_LIBRARIES} ${OPUSFILE_LIBRARIES}
${OPUS_LIBRARIES}
${SDL2_LIBRARIES} ${SDL2_LIBRARIES}
GL ${PLATFORM_CLIENT_LIBS}
GLU
X11
) )
# Target # Target

View file

@ -1,5 +1,22 @@
find_package(PkgConfig QUIET) 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) 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})

View file

@ -8,16 +8,10 @@ find_path(OGG_INCLUDEDIR ogg.h
HINTS ${PC_OGG_INCLUDEDIR} ${PC_OGG_INCLUDE_DIRS} HINTS ${PC_OGG_INCLUDEDIR} ${PC_OGG_INCLUDE_DIRS}
PATHS ${EXTRA_OGG_INCLUDEDIR} PATHS ${EXTRA_OGG_INCLUDEDIR}
) )
find_library(OGG_LIBRARY
NAMES ogg
HINTS ${PC_OGG_LIBDIR} ${PC_OGG_LIBRARY_DIRS}
PATHS ${EXTRA_OGG_LIBDIR}
)
include(FindPackageHandleStandardArgs) 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}) set(OGG_INCLUDE_DIRS ${OGG_INCLUDEDIR})

View file

@ -7,16 +7,10 @@ find_path(OPUS_INCLUDEDIR opus.h
HINTS ${PC_OPUS_INCLUDEDIR} ${PC_OPUS_INCLUDE_DIRS} HINTS ${PC_OPUS_INCLUDEDIR} ${PC_OPUS_INCLUDE_DIRS}
PATHS ${EXTRA_OPUS_INCLUDEDIR} PATHS ${EXTRA_OPUS_INCLUDEDIR}
) )
find_library(OPUS_LIBRARY
NAMES opus
HINTS ${PC_OPUS_LIBDIR} ${PC_OPUS_LIBRARY_DIRS}
PATHS ${EXTRA_OPUS_LIBDIR}
)
include(FindPackageHandleStandardArgs) 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}) set(OPUS_INCLUDE_DIRS ${OPUS_INCLUDEDIR})

View file

@ -1,7 +1,7 @@
find_package(PkgConfig QUIET) find_package(PkgConfig QUIET)
pkg_check_modules(PC_SDL2 sdl2) pkg_check_modules(PC_SDL2 sdl2)
set_extra_dirs(SDL2 opus) set_extra_dirs(SDL2 sdl)
find_path(SDL2_INCLUDEDIR SDL.h find_path(SDL2_INCLUDEDIR SDL.h
PATH_SUFFIXES SDL2 PATH_SUFFIXES SDL2