Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support android in CMakeLists.txt #583

Merged
merged 1 commit into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 6 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ ADD_SUBDIRECTORY("src")
ADD_SUBDIRECTORY("lib/xgraph")
ADD_SUBDIRECTORY("lib/xsound")
ADD_SUBDIRECTORY("lib/xtool")
ADD_SUBDIRECTORY("lib/utils")
ADD_SUBDIRECTORY("server")
ADD_SUBDIRECTORY("surmap")

if(NOT ANDROID)
ADD_SUBDIRECTORY("lib/utils")
ADD_SUBDIRECTORY("server")
ADD_SUBDIRECTORY("surmap")
endif()
10 changes: 6 additions & 4 deletions lib/xgraph/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,10 @@ SET(xgraph_SRCS
xside.cpp
)

ADD_LIBRARY(xgraph STATIC ${xgraph_SRCS})
if (ANDROID)
ADD_LIBRARY(xgraph OBJECT ${xgraph_SRCS})
else()
ADD_LIBRARY(xgraph STATIC ${xgraph_SRCS})
TARGET_LINK_LIBRARIES(xgraph ${SDL2_LIBRARY})
endif()

TARGET_LINK_LIBRARIES(xgraph
${SDL2_LIBRARY}
)
20 changes: 12 additions & 8 deletions lib/xsound/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@ SET(xsound_SRCS
ogg_stream.cpp
)

ADD_LIBRARY(xsound STATIC ${xsound_SRCS})

TARGET_LINK_LIBRARIES(xsound
${CLUNK_LIBRARY}
${FFMPEG_LIBRARIES}
${OGG_LIBRARY}
${VORBIS_LIBRARY}
${VORBISFILE_LIBRARY}
)
if (ANDROID)
ADD_LIBRARY(xsound OBJECT ${xsound_SRCS})
else()
ADD_LIBRARY(xsound STATIC ${xsound_SRCS})
TARGET_LINK_LIBRARIES(xsound
${CLUNK_LIBRARY}
${FFMPEG_LIBRARIES}
${OGG_LIBRARY}
${VORBIS_LIBRARY}
${VORBISFILE_LIBRARY}
)
endif()
11 changes: 7 additions & 4 deletions lib/xtool/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ ENDIF(DXSTREAM_DEBUG)

INCLUDE_DIRECTORIES(BEFORE .)

ADD_LIBRARY(xtool STATIC ${xtool_SRCS})
if (ANDROID)
ADD_LIBRARY(xtool OBJECT ${xtool_SRCS})
else()
ADD_LIBRARY(xtool STATIC ${xtool_SRCS})
TARGET_LINK_LIBRARIES(xtool ${WIN_DBG})
endif()

TARGET_COMPILE_DEFINITIONS (xtool PUBLIC "-DGIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\"" "-DGIT_BRANCH=\"${GIT_BRANCH}\"" "-DGITHUB_COMMIT_HASH=\"$ENV{GITHUB_SHA}\"" "-DGITHUB_BRANCH=\"$ENV{GITHUB_REF_NAME}\"")

TARGET_LINK_LIBRARIES(xtool ${WIN_DBG})
TARGET_COMPILE_DEFINITIONS (xtool PUBLIC "-DGIT_COMMIT_HASH=\"${GIT_COMMIT_HASH}\"" "-DGIT_BRANCH=\"${GIT_BRANCH}\"" "-DGITHUB_COMMIT_HASH=\"$ENV{GITHUB_SHA}\"" "-DGITHUB_BRANCH=\"$ENV{GITHUB_REF_NAME}\"")
56 changes: 32 additions & 24 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -72,29 +72,37 @@ SET(vangers_SRCS
${WINDOWS_RES}
actint/layout.h)

ADD_EXECUTABLE(vangers ${vangers_SRCS})

IF(WIN32)
SET(WIN_LIB
wsock32
#-mwindows
#-Wl,-subsystem,windows
if (ANDROID)
ADD_LIBRARY(vangers STATIC ${vangers_SRCS}
$<TARGET_OBJECTS:xtool>
$<TARGET_OBJECTS:xgraph>
$<TARGET_OBJECTS:xsound>
)
ENDIF(WIN32)
else()
ADD_EXECUTABLE(vangers ${vangers_SRCS})

TARGET_LINK_LIBRARIES(vangers
${SDL2_LIBRARY}
${OGG_LIBRARY}
${VORBIS_LIBRARY}
${VORBISFILE_LIBRARY}
${CLUNK_LIBRARY}
${SDL2_NET_LIBRARY}
${FFMPEG_LIBRARIES}
${ZLIB_LIBRARIES}
${OPENGL_LIBRARIES}
${WIN_LIB}
${STEAM_LIBS}
xtool
xgraph
xsound
)
IF(WIN32)
SET(WIN_LIB
wsock32
#-mwindows
#-Wl,-subsystem,windows
)
ENDIF(WIN32)

TARGET_LINK_LIBRARIES(vangers
${SDL2_LIBRARY}
${OGG_LIBRARY}
${VORBIS_LIBRARY}
${VORBISFILE_LIBRARY}
${CLUNK_LIBRARY}
${SDL2_NET_LIBRARY}
${FFMPEG_LIBRARIES}
${ZLIB_LIBRARIES}
${OPENGL_LIBRARIES}
${WIN_LIB}
${STEAM_LIBS}
xtool
xgraph
xsound
)
endif(ANDROID)