Move depends out of main library, make them (static) libraries.

develop
Petr Mrázek 2012-03-13 14:46:48 +01:00
parent b3f6bccdf6
commit eb4757043b
206 changed files with 172 additions and 106 deletions

@ -10,6 +10,22 @@ else(CMAKE_CONFIGURATION_TYPES)
endif (NOT CMAKE_BUILD_TYPE)
endif(CMAKE_CONFIGURATION_TYPES)
# set up folder structures for IDE solutions
if(NOT CMAKE_USING_VC_FREE_TOOLS)
SET_PROPERTY(GLOBAL PROPERTY USE_FOLDERS ON)
OPTION(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." ON)
else()
OPTION(CMAKE_USE_FOLDERS "Enable folder grouping of projects in IDEs." OFF)
endif()
MARK_AS_ADVANCED(CMAKE_USE_FOLDERS)
# macro for setting up IDE folders without nasty IF()s everywhere
MACRO(IDE_FOLDER target folder)
if(CMAKE_USE_FOLDERS)
SET_PROPERTY(TARGET ${target} PROPERTY FOLDER ${folder})
endif()
ENDMACRO()
## some generic CMake magic
cmake_minimum_required(VERSION 2.8 FATAL_ERROR)
project(dfhack)
@ -78,27 +94,25 @@ IF(UNIX)
SET(CMAKE_C_FLAGS "-fvisibility=hidden -m32 -march=i686 -mtune=generic")
ENDIF()
# use shared libraries for protobuf
ADD_DEFINITIONS(-DPROTOBUF_USE_DLLS)
#### expose depends ####
# find and make available libz
if(NOT UNIX)
SET(ZLIB_INCLUDE_DIRS ${dfhack_SOURCE_DIR}/library/depends/zlib/include/)
SET(ZLIB_LIBRARIES ${dfhack_SOURCE_DIR}/library/depends/zlib/lib/zlib.lib)
else()
find_package(ZLIB REQUIRED)
SET(ZLIB_ROOT depends/zlib/)
endif()
find_package(ZLIB REQUIRED)
include_directories(depends/protobuf)
include_directories(depends/lua/include)
include_directories(depends/md5)
include_directories(depends/tinyxml)
include_directories(depends/tthread)
include_directories(${ZLIB_INCLUDE_DIRS})
add_subdirectory(depends)
#add depends to include path
INCLUDE_DIRECTORIES ( library/depends )
INCLUDE_DIRECTORIES ( library/depends/protobuf/ )
# use shared libraries for protobuf
ADD_DEFINITIONS(-DPROTOBUF_USE_DLLS)
IF(!UNIX)
# build the static lua for dfusion, win32 only
INCLUDE_DIRECTORIES ( lua/include )
add_subdirectory (lua)
ENDIF()
# build the lib itself
IF(BUILD_LIBRARY)

@ -0,0 +1,6 @@
#list depends here.
add_subdirectory(lua)
add_subdirectory(md5)
add_subdirectory(protobuf)
add_subdirectory(tinyxml)
add_subdirectory(tthread)

@ -13,6 +13,35 @@ IF(UNIX)
SET(CMAKE_C_FLAGS "-m32")
ENDIF()
SET (HDR_LIBLUA
include/bit.h
include/lapi.h
include/lauxlib.h
include/lcode.h
include/ldebug.h
include/ldo.h
include/lfunc.h
include/lgc.h
include/llex.h
include/llimits.h
include/lmem.h
include/lobject.h
include/lopcodes.h
include/lparser.h
include/lstate.h
include/lstring.h
include/ltable.h
include/ltm.h
include/lua.h
include/luaconf.h
include/lualib.h
include/lundump.h
include/lvm.h
include/lzio.h
)
SET_SOURCE_FILES_PROPERTIES(${HDR_LIBLUA} PROPERTIES HEADER_FILE_ONLY TRUE)
include_directories(include)
# Build Libraries
SET (SRC_LIBLUA
src/lapi.c
@ -45,9 +74,11 @@ src/lundump.c
src/lvm.c
src/lzio.c
)
LIST(APPEND SRC_LIBLUA ${HDR_LIBLUA})
ADD_LIBRARY ( lua ${SRC_LIBLUA} )
ADD_LIBRARY ( lua STATIC EXCLUDE_FROM_ALL ${SRC_LIBLUA} )
TARGET_LINK_LIBRARIES ( lua ${LIBS})
IDE_FOLDER(lua "Depends")
#SET ( SRC_LUA src/lua.c )
#SET ( SRC_LUAC src/luac.c src/print.c )

@ -0,0 +1,3 @@
project(dfhack-md5)
ADD_LIBRARY(dfhack-md5 STATIC EXCLUDE_FROM_ALL md5.cpp md5wrapper.cpp)
IDE_FOLDER(dfhack-md5 "Depends")

@ -201,12 +201,15 @@ google/protobuf/compiler/zip_writer.cc
LIST(APPEND LIBPROTOBUF_FULL_SRCS ${LIBPROTOBUF_LITE_SRCS})
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR})
SET(PROTOBUF_INCLUDE_DIRS ${CMAKE_CURRENT_SOURCE_DIR})
INCLUDE_DIRECTORIES(${ZLIB_INCLUDE_DIRS})
# Protobuf shared libraries
ADD_LIBRARY(protobuf SHARED ${LIBPROTOBUF_FULL_SRCS} ${LIBPROTOBUF_FULL_HDRS})
IDE_FOLDER(protobuf "Depends")
ADD_LIBRARY(protobuf-lite SHARED ${LIBPROTOBUF_LITE_SRCS} ${LIBPROTOBUF_LITE_HDRS})
IDE_FOLDER(protobuf-lite "Depends")
SET_TARGET_PROPERTIES(protobuf PROPERTIES COMPILE_DEFINITIONS LIBPROTOBUF_EXPORTS)
SET_TARGET_PROPERTIES(protobuf-lite PROPERTIES COMPILE_DEFINITIONS LIBPROTOBUF_EXPORTS)
@ -215,12 +218,13 @@ TARGET_LINK_LIBRARIES(protobuf ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES})
TARGET_LINK_LIBRARIES(protobuf-lite ${CMAKE_THREAD_LIBS_INIT} ${ZLIB_LIBRARIES})
install(TARGETS protobuf-lite
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}/deplibs
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION}/deplibs)
LIBRARY DESTINATION ${DFHACK_LIBRARY_DESTINATION}
RUNTIME DESTINATION ${DFHACK_LIBRARY_DESTINATION})
# Protobuf compiler shared library
ADD_LIBRARY(protoc SHARED ${LIBPROTOC_SRCS} ${LIBPROTOC_HDRS})
IDE_FOLDER(protoc "Depends")
SET_TARGET_PROPERTIES(protoc PROPERTIES COMPILE_DEFINITIONS LIBPROTOC_EXPORTS)
TARGET_LINK_LIBRARIES(protoc protobuf)
@ -228,6 +232,7 @@ TARGET_LINK_LIBRARIES(protoc protobuf)
# Protobuf compiler executable
ADD_EXECUTABLE(protoc-bin google/protobuf/compiler/main.cc google/protobuf/compiler/command_line_interface.h google/protobuf/compiler/cpp/cpp_generator.h)
IDE_FOLDER(protoc-bin "Depends")
SET_TARGET_PROPERTIES(protoc-bin PROPERTIES OUTPUT_NAME protoc)
TARGET_LINK_LIBRARIES(protoc-bin protoc)

Some files were not shown because too many files have changed in this diff Show More