mirror of
https://github.com/etlegacy/etlegacy-libs.git
synced 2025-02-24 04:01:12 +00:00
Allow per-lib selection of bundled libs.
This commit is contained in:
parent
d4ecbb96a8
commit
80aaff0b11
1 changed files with 103 additions and 97 deletions
|
@ -2,48 +2,55 @@ if(WIN32)
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
# Build bundled JPEG library
|
# Build bundled JPEG library
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
|
if(BUNDLED_JPEG) # static
|
||||||
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/jpeg/libjpeg.lib
|
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/jpeg/libjpeg.lib
|
||||||
COMMAND NMAKE /f makefile.vc setup-v10 && NMAKE /f makefile.vc
|
COMMAND NMAKE /f makefile.vc setup-v10 && NMAKE /f makefile.vc
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/jpeg
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/jpeg
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(bundled_jpeg
|
add_custom_target(bundled_jpeg
|
||||||
DEPENDS ${CMAKE_SOURCE_DIR}/libs/jpeg/libjpeg.lib
|
DEPENDS ${CMAKE_SOURCE_DIR}/libs/jpeg/libjpeg.lib
|
||||||
)
|
)
|
||||||
|
set(JPEG_BUNDLED_LIBRARIES "${CMAKE_SOURCE_DIR}/libs/jpeg/libjpeg.lib" PARENT_SCOPE)
|
||||||
|
set(JPEG_BUNDLED_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/libs/jpeg" PARENT_SCOPE)
|
||||||
|
endif(BUNDLED_JPEG)
|
||||||
|
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
# Build bundled cURL library
|
# Build bundled cURL library
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
|
if(BUNDLED_CURL) # DLL
|
||||||
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/curl/lib/release-dll/libcurl_imp.lib
|
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/curl/lib/release-dll/libcurl_imp.lib
|
||||||
COMMAND NMAKE /f Makefile vc-dll
|
COMMAND NMAKE /f Makefile vc-dll
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/libs/curl/lib/release-dll/libcurl.dll ${CMAKE_BINARY_DIR}
|
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/libs/curl/lib/release-dll/libcurl.dll ${CMAKE_BINARY_DIR}
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/curl
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/curl
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(bundled_curl
|
add_custom_target(bundled_curl
|
||||||
DEPENDS ${CMAKE_SOURCE_DIR}/libs/curl/lib/release-dll/libcurl_imp.lib
|
DEPENDS ${CMAKE_SOURCE_DIR}/libs/curl/lib/release-dll/libcurl_imp.lib
|
||||||
)
|
)
|
||||||
|
set(CURL_BUNDLED_LIBRARY "${CMAKE_SOURCE_DIR}/libs/curl/lib/release-dll/libcurl_imp.lib" PARENT_SCOPE)
|
||||||
|
set(CURL_BUNDLED_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/libs/curl/include" PARENT_SCOPE)
|
||||||
|
endif(BUNDLED_CURL)
|
||||||
|
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
# Build bundled Lua 5.1 library
|
# Build bundled Lua 5.1 library
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
|
if(BUNDLED_LUA)
|
||||||
# TODO: add lua for Windows
|
# TODO: add lua for Windows
|
||||||
|
message(FATAL_ERROR "Building bundled Lua on Windows is not yet possible.")
|
||||||
|
endif(BUNDLED_LUA)
|
||||||
|
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
# Copy bundled SDL library to the etl.exe location
|
# Copy bundled SDL library to the etl.exe location
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
|
if(BUNDLED_SDL) # DLL
|
||||||
file(COPY ${CMAKE_SOURCE_DIR}/libs/sdl-windows/lib/x86/SDL.dll DESTINATION ${CMAKE_BINARY_DIR})
|
file(COPY ${CMAKE_SOURCE_DIR}/libs/sdl-windows/lib/x86/SDL.dll DESTINATION ${CMAKE_BINARY_DIR})
|
||||||
|
set(SDL32_BUNDLED_LIBRARIES
|
||||||
|
"${CMAKE_SOURCE_DIR}/libs/sdl-windows/lib/x86/SDL.lib"
|
||||||
|
"${CMAKE_SOURCE_DIR}/libs/sdl-windows/lib/x86/SDLmain.lib" PARENT_SCOPE)
|
||||||
|
set(SDL32_BUNDLED_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/libs/sdl/include" PARENT_SCOPE)
|
||||||
|
endif(BUNDLED_SDL)
|
||||||
|
|
||||||
|
|
||||||
# return compiled libs to the parent CMakeLists.txt
|
|
||||||
set(BUNDLED_LIBRARIES "${CMAKE_SOURCE_DIR}/libs/curl/lib/release-dll/libcurl_imp.lib" # DLL
|
|
||||||
"${CMAKE_SOURCE_DIR}/libs/jpeg/libjpeg.lib" # static
|
|
||||||
"${CMAKE_SOURCE_DIR}/libs/sdl-windows/lib/x86/SDL.lib" # DLL
|
|
||||||
"${CMAKE_SOURCE_DIR}/libs/sdl-windows/lib/x86/SDLmain.lib" # DLL
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
|
||||||
elseif(UNIX)
|
elseif(UNIX)
|
||||||
|
|
||||||
if(CROSS_COMPILE32)
|
if(CROSS_COMPILE32)
|
||||||
set(CROSS_COMPILE32_FLAGS CFLAGS=-m32 LDFLAGS=-m32)
|
set(CROSS_COMPILE32_FLAGS CFLAGS=-m32 LDFLAGS=-m32)
|
||||||
else(CROSS_COMPILE32)
|
else(CROSS_COMPILE32)
|
||||||
|
@ -53,6 +60,7 @@ elseif(UNIX)
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
# Build bundled cURL library
|
# Build bundled cURL library
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
|
if(BUNDLED_CURL)
|
||||||
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/curl/lib/.libs/libcurl.a
|
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/curl/lib/.libs/libcurl.a
|
||||||
COMMAND ${CROSS_COMPILE32_FLAGS} ./configure
|
COMMAND ${CROSS_COMPILE32_FLAGS} ./configure
|
||||||
--enable-shared=no --enable-static=yes
|
--enable-shared=no --enable-static=yes
|
||||||
|
@ -64,40 +72,52 @@ elseif(UNIX)
|
||||||
--without-librtmp && make
|
--without-librtmp && make
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/curl
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/curl
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(bundled_curl
|
add_custom_target(bundled_curl
|
||||||
DEPENDS ${CMAKE_SOURCE_DIR}/libs/curl/lib/.libs/libcurl.a
|
DEPENDS ${CMAKE_SOURCE_DIR}/libs/curl/lib/.libs/libcurl.a
|
||||||
)
|
)
|
||||||
|
set(CURL_BUNDLED_LIBRARY "${CMAKE_SOURCE_DIR}/libs/curl/lib/.libs/libcurl.a" PARENT_SCOPE)
|
||||||
|
set(CURL_BUNDLED_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/libs/curl/include" PARENT_SCOPE)
|
||||||
|
endif(BUNDLED_CURL)
|
||||||
|
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
# Build bundled JPEG library
|
# Build bundled JPEG library
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
|
if(BUNDLED_JPEG)
|
||||||
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/jpeg/.libs/libjpeg.a
|
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/jpeg/.libs/libjpeg.a
|
||||||
COMMAND ${CROSS_COMPILE32_FLAGS} ./configure && make
|
COMMAND ${CROSS_COMPILE32_FLAGS} ./configure && make
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/jpeg
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/jpeg
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(bundled_jpeg
|
add_custom_target(bundled_jpeg
|
||||||
DEPENDS ${CMAKE_SOURCE_DIR}/libs/jpeg/.libs/libjpeg.a
|
DEPENDS ${CMAKE_SOURCE_DIR}/libs/jpeg/.libs/libjpeg.a
|
||||||
)
|
)
|
||||||
|
set(JPEG_BUNDLED_LIBRARIES "${CMAKE_SOURCE_DIR}/libs/jpeg/.libs/libjpeg.a" PARENT_SCOPE)
|
||||||
|
set(JPEG_BUNDLED_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/libs/jpeg" PARENT_SCOPE)
|
||||||
|
endif(BUNDLED_JPEG)
|
||||||
|
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
# Build bundled SDL library
|
# Build bundled SDL library
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
|
if(BUNDLED_SDL)
|
||||||
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/sdl/build/.libs/libSDL.a
|
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/sdl/build/.libs/libSDL.a
|
||||||
# disable svga and directfb modules for cross-compiling on 64bit Debian Squeezy
|
# disable svga and directfb modules for cross-compiling on 64bit Debian Squeezy
|
||||||
COMMAND ${CROSS_COMPILE32_FLAGS} ./configure --disable-video-svga --disable-video-directfb && make
|
COMMAND ${CROSS_COMPILE32_FLAGS} ./configure --disable-video-svga --disable-video-directfb && make
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/sdl
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/sdl
|
||||||
)
|
)
|
||||||
|
|
||||||
add_custom_target(bundled_sdl
|
add_custom_target(bundled_sdl
|
||||||
DEPENDS ${CMAKE_SOURCE_DIR}/libs/sdl/build/.libs/libSDL.a
|
DEPENDS ${CMAKE_SOURCE_DIR}/libs/sdl/build/.libs/libSDL.a
|
||||||
)
|
)
|
||||||
|
if(CMAKE_SYSTEM MATCHES "Darwin")
|
||||||
|
set(SDL32_BUNDLED_LIBRARIES ${SDL32_BUNDLED_LIBRARIES} "${CMAKE_SOURCE_DIR}/libs/sdl/build/.libs/libSDLmain.a")
|
||||||
|
endif(CMAKE_SYSTEM MATCHES "Darwin")
|
||||||
|
set(SDL32_BUNDLED_LIBRARIES ${SDL32_BUNDLED_LIBRARIES} "${CMAKE_SOURCE_DIR}/libs/sdl/build/.libs/libSDL.a" PARENT_SCOPE)
|
||||||
|
set(SDL32_BUNDLED_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/libs/sdl/include" PARENT_SCOPE)
|
||||||
|
endif(BUNDLED_SDL)
|
||||||
|
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
# Build bundled Lua 5.1 library
|
# Build bundled Lua 5.1 library
|
||||||
#-----------------------------------------------------------------
|
#-----------------------------------------------------------------
|
||||||
# TODO: clean this up. The *32bit targets were added into the Lua Makefiles
|
# TODO: clean this up. The *32bit targets were added into the Lua Makefiles
|
||||||
|
if(BUNDLED_LUA)
|
||||||
if(CMAKE_SYSTEM MATCHES "OpenBSD*")
|
if(CMAKE_SYSTEM MATCHES "OpenBSD*")
|
||||||
set(LUA_MAKE_TARGET "bsd")
|
set(LUA_MAKE_TARGET "bsd")
|
||||||
elseif(CMAKE_SYSTEM MATCHES "Darwin")
|
elseif(CMAKE_SYSTEM MATCHES "Darwin")
|
||||||
|
@ -117,25 +137,11 @@ elseif(UNIX)
|
||||||
COMMAND ${CROSS_COMPILE32_FLAGS} make ${LUA_MAKE_TARGET}
|
COMMAND ${CROSS_COMPILE32_FLAGS} make ${LUA_MAKE_TARGET}
|
||||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/lua
|
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/lua
|
||||||
)
|
)
|
||||||
set(LUA_LIBRARY "${CMAKE_SOURCE_DIR}/libs/lua/src/liblua.a" PARENT_SCOPE)
|
set(LUA_BUNDLED_LIBRARIES "${CMAKE_SOURCE_DIR}/libs/lua/src/liblua.a" PARENT_SCOPE)
|
||||||
|
set(LUA_BUNDLED_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/libs/lua/src" PARENT_SCOPE)
|
||||||
|
|
||||||
add_custom_target(bundled_lua
|
add_custom_target(bundled_lua
|
||||||
DEPENDS ${CMAKE_SOURCE_DIR}/libs/lua/src/liblua.a
|
DEPENDS ${CMAKE_SOURCE_DIR}/libs/lua/src/liblua.a
|
||||||
)
|
)
|
||||||
|
endif(BUNDLED_LUA)
|
||||||
# return compiled libs to the parent CMakeLists.txt
|
|
||||||
set(BUNDLED_LIBRARIES "${CMAKE_SOURCE_DIR}/libs/curl/lib/.libs/libcurl.a"
|
|
||||||
"${CMAKE_SOURCE_DIR}/libs/jpeg/.libs/libjpeg.a"
|
|
||||||
"${CMAKE_SOURCE_DIR}/libs/sdl/build/.libs/libSDL.a"
|
|
||||||
# Mac OS X: "${CMAKE_SOURCE_DIR}/libs/sdl/build/.libs/libSDLmain.a"
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
# return include dirs to the parent CMakeLists.txt
|
|
||||||
set(BUNDLED_INCLUDE_DIRS "${CMAKE_SOURCE_DIR}/libs/curl/include"
|
|
||||||
"${CMAKE_SOURCE_DIR}/libs/jpeg"
|
|
||||||
"${CMAKE_SOURCE_DIR}/libs/sdl/include"
|
|
||||||
"${CMAKE_SOURCE_DIR}/libs/lua/src"
|
|
||||||
PARENT_SCOPE
|
|
||||||
)
|
|
||||||
|
|
Loading…
Reference in a new issue