Buildsystem: Clean up build-process on all platforms

- Windows: Use CMAKE_INSTALL_PREFIX as a 'final install' directory (thanks to paradox for the preload-handling)
  (New target INSTALL, -not- included as part of ALL_BUILD (must be specifically run for installation to start)
- All: Build libmpq library (used for tools)
- All: Build extractiontools with hardlinked mpq-library (no need to install it anymore)
- All: Move jemalloc from being harddefined to using a CMake string (fixes issue 3378) (thanks to tru.bazoozoo for the idea, alternative added)

--HG--
branch : trunk
This commit is contained in:
click
2010-08-11 20:55:14 +02:00
parent f482bb1cd5
commit 780ed1b01c
9 changed files with 83 additions and 39 deletions
+42 -29
View File
@@ -101,9 +101,18 @@ endif()
# #
if( PREFIX ) if( PREFIX )
set(CMAKE_INSTALL_PREFIX ${PREFIX}) set(CMAKE_INSTALL_PREFIX "${PREFIX}")
endif() endif()
IF(WIN32)
IF(NOT CYGWIN)
IF(NOT CMAKE_INSTALL_PREFIX)
SET(CMAKE_INSTALL_PREFIX
"${CMAKE_BINARY_DIR}/bin")
ENDIF(NOT CMAKE_INSTALL_PREFIX)
ENDIF(NOT CYGWIN)
ENDIF(WIN32)
# #
# Handle debugmode compiles (this will require further work for proper WIN32-setups) # Handle debugmode compiles (this will require further work for proper WIN32-setups)
# #
@@ -117,24 +126,28 @@ endif()
# #
if( MSVC ) if( MSVC )
# Set up MSVC to dump binaries in the <builddir>/bin/<buildtype>/ folder # Set up MSVC to dump files in the <builddir>/bin/<buildtype>/ folder for testing builds before install
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# executable binaries (.exe-files)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# dynamic linked libraries (.dll)
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
# statically linked libraries - commented out as it's not needed - shown here as an example only
#set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
endif() endif()
# #
# Set default configuration-directory (used on NIX-based platforms only) # Set default configuration-directory (used on NIX-based platforms only)
# #
if( NOT CONF_DIR ) if( NOT CONF_DIR )
set(CONF_DIR ${CMAKE_INSTALL_PREFIX}/etc) set(CONF_DIR ${CMAKE_INSTALL_PREFIX}/etc)
endif() endif()
set(LIBSDIR ${CMAKE_INSTALL_PREFIX}/lib) set(LIBSDIR ${CMAKE_INSTALL_PREFIX}/lib)
##### #####
##### Build-preparation ##### Build-preparation
##### #####
@@ -169,12 +182,12 @@ message("")
# Output information about installation-directories and locations # Output information about installation-directories and locations
# #
message("* Install core to : ${CMAKE_INSTALL_PREFIX}")
if( UNIX ) if( UNIX )
message("* Install core to : ${CMAKE_INSTALL_PREFIX}")
message("* Install libraries to : ${LIBSDIR}") message("* Install libraries to : ${LIBSDIR}")
message("* Install configs to : ${CONF_DIR}") message("* Install configs to : ${CONF_DIR}")
message("")
endif() endif()
message("")
# #
# Show infomation about the options selected during configuration # Show infomation about the options selected during configuration
@@ -186,11 +199,24 @@ else()
message("* Build servers : No") message("* Build servers : No")
endif() endif()
if( GAMEPCH )
message("* Build game w/PCH : Yes (default)")
else()
message("* Build game w/PCH : No")
endif()
if( SCRIPTS ) if( SCRIPTS )
message("* Build with scripts : Yes (default)") message("* Build with scripts : Yes (default)")
add_definitions(-DSCRIPTS) add_definitions(-DSCRIPTS)
else() else()
message("* Build with scripts : No") message("* Build with scripts : No")
set(SCRIPTPCH 0)
endif()
if( SCRIPTPCH )
message("* Build scripts w/PCH : Yes (default)")
else()
message("* Build scripts w/PCH : No")
endif() endif()
if( TOOLS ) if( TOOLS )
@@ -209,18 +235,6 @@ else()
message("* Build in debug-mode : No (default)") message("* Build in debug-mode : No (default)")
endif() endif()
if( GAMEPCH )
message("* Build game w/PCH : Yes (default)")
else()
message("* Build game w/PCH : No")
endif()
if( SCRIPTPCH )
message("* Build scripts w/PCH : Yes (default)")
else()
message("* Build scripts w/PCH : No")
endif()
if( WARNINGS ) if( WARNINGS )
message("* Show all warnings : Yes") message("* Show all warnings : Yes")
if( UNIX ) if( UNIX )
@@ -294,15 +308,14 @@ set(CMAKE_INSTALL_RPATH_USE_LINK_PATH 1)
# #
if( UNIX ) if( UNIX )
configure_file( configure_file(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in" "${CMAKE_CURRENT_SOURCE_DIR}/cmake/cmake_uninstall.cmake.in"
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
IMMEDIATE @ONLY IMMEDIATE @ONLY
) )
add_custom_target(uninstall
add_custom_target(uninstall "${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake" )
)
endif() endif()
# #
+6
View File
@@ -0,0 +1,6 @@
IF(WIN32)
IF(NOT CYGWIN)
SET(CMAKE_INSTALL_PREFIX
"" CACHE PATH "Default install path")
ENDIF(NOT CYGWIN)
ENDIF(WIN32)
+2 -4
View File
@@ -10,6 +10,7 @@
if(CMAKE_SYSTEM_NAME MATCHES "Linux") if(CMAKE_SYSTEM_NAME MATCHES "Linux")
add_subdirectory(jemalloc) add_subdirectory(jemalloc)
set(JEMALLOC_LIB "jemalloc")
endif() endif()
if(CMAKE_SYSTEM_NAME MATCHES "Windows") if(CMAKE_SYSTEM_NAME MATCHES "Windows")
@@ -21,7 +22,4 @@ endif()
add_subdirectory(g3dlite) add_subdirectory(g3dlite)
add_subdirectory(sockets) add_subdirectory(sockets)
add_subdirectory(gsoap) add_subdirectory(gsoap)
add_subdirectory(libmpq)
# temporary disable libmpq building (through CMake at least) for now
# - needs a proper CMakeLists.txt
#add_subdirectory(libmpq)
+2
View File
@@ -335,3 +335,5 @@ add_library(ace SHARED ${ace_STAT_SRCS})
if(PCH) if(PCH)
add_native_precompiled_header(ace ${CMAKE_SOURCE_DIR}/externals/ace/PrecompiledHeaders/WinAcePCH) add_native_precompiled_header(ace ${CMAKE_SOURCE_DIR}/externals/ace/PrecompiledHeaders/WinAcePCH)
endif() endif()
install(TARGETS ace DESTINATION "${CMAKE_INSTALL_PREFIX}")
+3
View File
@@ -98,4 +98,7 @@ endif()
if( UNIX ) if( UNIX )
install(TARGETS authserver DESTINATION bin) install(TARGETS authserver DESTINATION bin)
install(FILES authserver.conf.dist DESTINATION etc) install(FILES authserver.conf.dist DESTINATION etc)
elseif( WIN32 )
install(TARGETS authserver DESTINATION "${CMAKE_INSTALL_PREFIX}")
install(FILES authserver.conf.dist DESTINATION "${CMAKE_INSTALL_PREFIX}")
endif() endif()
+5 -2
View File
@@ -180,7 +180,7 @@ else()
collision collision
g3dlib g3dlib
gsoap gsoap
jemalloc ${JEMALLOC_LIB}
${SCRIPT_LIB} ${SCRIPT_LIB}
${READLINE_LIBRARY} ${READLINE_LIBRARY}
${TERMCAP_LIBRARY} ${TERMCAP_LIBRARY}
@@ -201,5 +201,8 @@ endif()
if( UNIX ) if( UNIX )
install(TARGETS worldserver DESTINATION bin) install(TARGETS worldserver DESTINATION bin)
install(FILES worldserver.conf.dist DESTINATION etc) install(FILES worldserver.conf.dist DESTINATION etc)
elseif( WIN32 )
install(TARGETS worldserver DESTINATION "${CMAKE_INSTALL_PREFIX}")
install(FILES worldserver.conf.dist DESTINATION "${CMAKE_INSTALL_PREFIX}")
endif() endif()
+9 -2
View File
@@ -13,6 +13,7 @@ file(GLOB_RECURSE sources *.cpp *.h)
include_directories ( include_directories (
${CMAKE_SOURCE_DIR}/src/server/shared ${CMAKE_SOURCE_DIR}/src/server/shared
${CMAKE_SOURCE_DIR}/externals/libmpq
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_SOURCE_DIR}/loadlib ${CMAKE_CURRENT_SOURCE_DIR}/loadlib
) )
@@ -23,16 +24,22 @@ add_executable(mapextractor
if(WIN32) if(WIN32)
target_link_libraries(mapextractor target_link_libraries(mapextractor
mpq
bzip2 bzip2
zlib
mpq
) )
else() else()
target_link_libraries(mapextractor target_link_libraries(mapextractor
mpq
${BZIP2_LIBRARIES} ${BZIP2_LIBRARIES}
${ZLIB_LIBRARIES}
mpq
) )
endif() endif()
add_dependencies(mapextractor mpq)
if( UNIX ) if( UNIX )
install(TARGETS mapextractor DESTINATION bin) install(TARGETS mapextractor DESTINATION bin)
elseif( WIN32 )
install(TARGETS mapextractor DESTINATION "${CMAKE_INSTALL_PREFIX}")
endif() endif()
+4
View File
@@ -23,6 +23,8 @@ add_definitions(-DNO_CORE_FUNCS)
add_executable(vmap3assembler VMapAssembler.cpp) add_executable(vmap3assembler VMapAssembler.cpp)
add_dependencies(vmap3assembler mpq)
if(WIN32) if(WIN32)
target_link_libraries(vmap3assembler target_link_libraries(vmap3assembler
collision collision
@@ -39,4 +41,6 @@ endif()
if( UNIX ) if( UNIX )
install(TARGETS vmap3assembler DESTINATION bin) install(TARGETS vmap3assembler DESTINATION bin)
elseif( WIN32 )
install(TARGETS vmap3assembler DESTINATION "${CMAKE_INSTALL_PREFIX}")
endif() endif()
+10 -2
View File
@@ -20,22 +20,30 @@ add_definitions("-Wall")
add_definitions("-ggdb") add_definitions("-ggdb")
add_definitions("-O3") add_definitions("-O3")
include_directories(
${CMAKE_SOURCE_DIR}/externals/libmpq
)
add_executable(vmap3extractor ${sources}) add_executable(vmap3extractor ${sources})
if(WIN32) if(WIN32)
target_link_libraries(vmap3extractor target_link_libraries(vmap3extractor
mpq
bzip2 bzip2
zlib zlib
mpq
) )
else() else()
target_link_libraries(vmap3extractor target_link_libraries(vmap3extractor
mpq
${BZIP2_LIBRARIES} ${BZIP2_LIBRARIES}
${ZLIB_LIBRARIES} ${ZLIB_LIBRARIES}
mpq
) )
endif() endif()
add_dependencies(vmap3extractor mpq)
if( UNIX ) if( UNIX )
install(TARGETS vmap3extractor DESTINATION bin) install(TARGETS vmap3extractor DESTINATION bin)
elseif( WIN32 )
install(TARGETS vmap3extractor DESTINATION "${CMAKE_INSTALL_PREFIX}")
endif() endif()