Skip to content

Commit

Permalink
Merge pull request #583 from caiiiycuk/va_cmakeandroid
Browse files Browse the repository at this point in the history
Support android in CMakeLists.txt
  • Loading branch information
stalkerg committed May 19, 2022
2 parents 063a9eb + f81c03c commit beff3da
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 43 deletions.
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 @@ -30,8 +30,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 @@ -71,29 +71,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)

0 comments on commit beff3da

Please sign in to comment.