etlegacy-libs/CMakeLists.txt

153 lines
6.4 KiB
Text
Raw Normal View History

if(WIN32)
2012-11-03 18:04:41 +00:00
#-----------------------------------------------------------------
# Build bundled JPEG library
#-----------------------------------------------------------------
if(BUNDLED_JPEG) # static
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/jpeg/libjpeg.lib
COMMAND NMAKE /f makefile.vc setup-v10 && NMAKE /f makefile.vc
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/jpeg
)
add_custom_target(bundled_jpeg
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)
2012-11-03 18:04:41 +00:00
#-----------------------------------------------------------------
# Build bundled cURL library
#-----------------------------------------------------------------
if(BUNDLED_CURL) # DLL
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/curl/lib/release-dll/libcurl_imp.lib
COMMAND NMAKE /f Makefile vc-dll
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
)
add_custom_target(bundled_curl
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)
2012-11-17 21:59:27 +00:00
#-----------------------------------------------------------------
# Build bundled Lua 5.1 library
#-----------------------------------------------------------------
2013-01-02 12:16:14 +00:00
if(BUNDLED_LUA) # DLL
file(COPY ${CMAKE_SOURCE_DIR}/libs/lua-windows/lua51.dll DESTINATION ${CMAKE_BINARY_DIR})
set(LUA_BUNDLED_LIBRARIES "${CMAKE_SOURCE_DIR}/libs/lua-windows/lua51.lib" PARENT_SCOPE)
set(LUA_BUNDLED_INCLUDE_DIR "${CMAKE_SOURCE_DIR}/libs/lua/src" PARENT_SCOPE)
endif(BUNDLED_LUA)
2012-11-17 21:59:27 +00:00
2012-11-03 18:04:41 +00:00
#-----------------------------------------------------------------
# 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})
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)
2012-11-17 21:59:27 +00:00
elseif(UNIX)
2012-11-03 18:04:41 +00:00
if(CROSS_COMPILE32)
2012-11-17 21:59:27 +00:00
set(CROSS_COMPILE32_FLAGS CFLAGS=-m32 LDFLAGS=-m32)
2012-11-03 18:04:41 +00:00
else(CROSS_COMPILE32)
2012-11-17 21:59:27 +00:00
set(CROSS_COMPILE32_FLAGS "")
2012-11-03 18:04:41 +00:00
endif(CROSS_COMPILE32)
2012-11-03 18:04:41 +00:00
#-----------------------------------------------------------------
# Build bundled cURL library
#-----------------------------------------------------------------
if(BUNDLED_CURL)
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/curl/lib/.libs/libcurl.a
COMMAND make clean || true
COMMAND ${CROSS_COMPILE32_FLAGS} ./configure
--enable-shared=no --enable-static=yes
--without-libssh2 --enable-http --enable-ftp
--disable-gopher --enable-file --disable-ldap
--disable-dict --disable-telnet --disable-manual
--enable-libgcc --disable-ipv6 --disable-ares
--without-ssl --without-zlib --without-libidn
--without-librtmp && make
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/curl
)
add_custom_target(bundled_curl
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)
2012-11-03 18:04:41 +00:00
#-----------------------------------------------------------------
# Build bundled JPEG library
#-----------------------------------------------------------------
if(BUNDLED_JPEG)
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/jpeg/.libs/libjpeg.a
COMMAND make clean || true
COMMAND ${CROSS_COMPILE32_FLAGS} ./configure && make
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/jpeg
)
add_custom_target(bundled_jpeg
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)
2012-11-03 18:04:41 +00:00
#-----------------------------------------------------------------
# Build bundled SDL library
#-----------------------------------------------------------------
if(BUNDLED_SDL)
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/sdl/build/.libs/libSDL.a
COMMAND make clean || true
# disable svga and directfb modules for cross-compiling on 64bit Debian Squeezy
COMMAND ${CROSS_COMPILE32_FLAGS} ./configure --disable-video-svga --disable-video-directfb && make
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/sdl
)
add_custom_target(bundled_sdl
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)
2012-11-17 21:59:27 +00:00
#-----------------------------------------------------------------
# Build bundled Lua 5.1 library
#-----------------------------------------------------------------
# TODO: clean this up. The *32bit targets were added into the Lua Makefiles
if(BUNDLED_LUA)
if(CMAKE_SYSTEM MATCHES "OpenBSD*")
set(LUA_MAKE_TARGET "bsd")
elseif(CMAKE_SYSTEM MATCHES "Darwin")
if(NOT CROSS_COMPILE32)
set(LUA_MAKE_TARGET "macosx")
else()
set(LUA_MAKE_TARGET "macosx32bit")
endif()
2012-11-17 21:59:27 +00:00
else()
if(NOT CROSS_COMPILE32)
set(LUA_MAKE_TARGET "linux")
else()
set(LUA_MAKE_TARGET "linux32bit")
endif()
2012-11-17 21:59:27 +00:00
endif()
add_custom_command(OUTPUT ${CMAKE_SOURCE_DIR}/libs/lua/src/liblua.a
COMMAND make clean || true
COMMAND ${CROSS_COMPILE32_FLAGS} make ${LUA_MAKE_TARGET}
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}/libs/lua
)
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
DEPENDS ${CMAKE_SOURCE_DIR}/libs/lua/src/liblua.a
)
endif(BUNDLED_LUA)
endif()