Skip to content

Commit

Permalink
Reoganize; Rename tests tartet to check_lua; Add check_json;
Browse files Browse the repository at this point in the history
  • Loading branch information
brezerk committed Apr 13, 2015
1 parent 6024c65 commit 00876e0
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 24 deletions.
37 changes: 17 additions & 20 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# TODO:
#
# Move binary after compilation
# Support for special builds (json checking, tests, other stuff)

cmake_minimum_required(VERSION 2.8)
# Main project build script
cmake_minimum_required(VERSION 2.8.12)

PROJECT(CataclysmDDA)

Expand Down Expand Up @@ -38,6 +34,7 @@ MESSAGE(STATUS "${PROJECT} build environment -- \n")

MESSAGE(STATUS "Build realm is : ${CMAKE_SYSTEM_NAME} ${CMAKE_HOST_SYSTEM_PROCESSOR}\n")

#OS Check Placeholders. Will be used for BINDIST
IF (${CMAKE_SYSTEM_NAME} MATCHES Linux)
SET(_OS_LINUX_ 1)
ENDIF (${CMAKE_SYSTEM_NAME} MATCHES Linux)
Expand All @@ -58,6 +55,7 @@ IF( ${CMAKE_SYSTEM_NAME} MATCHES Windows )
#MESSAGE(STATUS "Disable internationalization on Windows as it is not supported")
ENDIF( ${CMAKE_SYSTEM_NAME} MATCHES Windows )

#Sysem specific actions
IF (${CMAKE_SYSTEM_NAME} MATCHES Linux OR ${CMAKE_SYSTEM_NAME} MATCHES FreeBSD)
IF( NOT DATA_PREFIX )
SET( DATA_PREFIX ${CMAKE_INSTALL_PREFIX}/share/cataclysm-dda )
Expand All @@ -84,14 +82,16 @@ ENDIF (${CMAKE_SYSTEM_NAME} MATCHES Linux OR ${CMAKE_SYSTEM_NAME} MATCHES FreeBS

MESSAGE(STATUS "${PROJECT} build options --\n")

IF ( LUA )
# Preset variables
IF ( NOT LUA_BINARY )
SET (LUA_BINARY "lua")
ENDIF ( LUA )
ENDIF ( NOT LUA_BINARY )

IF( NOT LANGUAGES )
SET ( LANGUAGES cs de el es_AR es_ES fi fr it_IT ja ko pl pt_BR pt pt_PT ru sr vi zh_CN zh_TW)
ENDIF( NOT LANGUAGES )

# Set build types and display info
IF( RELEASE )
MESSAGE(STATUS "CMAKE_INSTALL_PREFIX : ${CMAKE_INSTALL_PREFIX}")
MESSAGE(STATUS "BIN_PREFIX : ${BIN_PREFIX}")
Expand Down Expand Up @@ -122,9 +122,9 @@ ENDIF ( LUA )
MESSAGE(STATUS "ZLEVELS : ${ZLEVELS}")
MESSAGE(STATUS "USE_HOME_DIR : ${USE_HOME_DIR}\n")

MESSAGE(STATUS "LANGUAGES : ${LANGUAGES}\n")
MESSAGE(STATUS "LANGUAGES : ${LANGUAGES}\n")

MESSAGE(STATUS "See INSTALL file for details and more info --\n")
MESSAGE(STATUS "See INSTALL file for details and more info --\n")


# Force out-of-source build
Expand All @@ -134,6 +134,7 @@ IF( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )
)
ENDIF( ${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR} )

# Check for build types and libraries
IF(TILES)
# Find SDL, SDL_ttf & SDL_image for graphical install
MESSAGE(STATUS "Searching for SDL2 library --\n")
Expand Down Expand Up @@ -193,7 +194,9 @@ IF(SOUND)
ADD_DEFINITIONS(-DSDL_SOUND)
ENDIF(SOUND)

# Ok. Now create build and install recipes
IF(LOCALIZE)
add_subdirectory(lang)
ADD_DEFINITIONS(-DLOCALIZE)
ENDIF(LOCALIZE)

Expand All @@ -205,18 +208,12 @@ IF(USE_HOME_DIR)
ADD_DEFINITIONS(-DUSE_HOME_DIR)
ENDIF(USE_HOME_DIR)

add_subdirectory(src)
add_subdirectory(data)
IF(LUA)
add_subdirectory(lua)
add_subdirectory(src/lua)
ENDIF(LUA)

add_subdirectory(src)
add_subdirectory(data)
add_subdirectory(src/chkjson)
IF(TILES)
IF(RELEASE)
install(DIRECTORY ${CMAKE_SOURCE_DIR}/gfx DESTINATION ${DATA_PREFIX})
ENDIF(RELEASE)
ENDIF(TILES)
IF(LOCALIZE)
add_subdirectory(lang)
ENDIF(LOCALIZE)

10 changes: 10 additions & 0 deletions data/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Cataclysm data files
cmake_minimum_required(VERSION 2.8.12)

SET(CATACLYSM_DATA_DIRS
${CMAKE_SOURCE_DIR}/data/font
${CMAKE_SOURCE_DIR}/data/json
Expand All @@ -17,6 +20,13 @@ IF(SOUND)
)
ENDIF(SOUND)

IF(TILES)
SET(CATACLYSM_DATA_DIRS
${CATACLYSM_DATA_DIRS}
${CMAKE_SOURCE_DIR}/gfx
)
ENDIF(TILES)

SET(CATACLYSM_DATA_FILES
${CMAKE_SOURCE_DIR}/data/changelog.txt
${CMAKE_SOURCE_DIR}/data/cataicon.ico
Expand Down
11 changes: 7 additions & 4 deletions lua/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,24 @@
set(CATACLYSM_DDA_LUA_SOURCES
# LUA files + test
cmake_minimum_required(VERSION 2.8.12)

SET(CATACLYSM_DDA_LUA_SOURCES
${CMAKE_SOURCE_DIR}/lua/class_definitions.lua
${CMAKE_SOURCE_DIR}/lua/autoexec.lua
)

# test chain
add_custom_target (
tests
check_lua
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

add_custom_command (
TARGET tests
TARGET check_lua
PRE_BUILD
COMMAND ${LUA_BINARY} lua/json_verifier.lua
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)


IF(RELEASE)
install(FILES ${CATACLYSM_DDA_LUA_SOURCES} DESTINATION ${DATA_PREFIX}/lua)
ENDIF(RELEASE)
3 changes: 3 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Cataclysm DDA client
cmake_minimum_required(VERSION 2.8.12)

set(CATACLYSM_DDA_SOURCES
${CMAKE_SOURCE_DIR}/src/veh_interact.cpp
${CMAKE_SOURCE_DIR}/src/mondeath.cpp
Expand Down
15 changes: 15 additions & 0 deletions src/chkjson/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# JSON check utility
cmake_minimum_required(VERSION 2.8.12)

SET (CHKJSON_SOURCES
${CMAKE_SOURCE_DIR}/src/json.cpp
Expand All @@ -8,6 +10,19 @@ SET (CHKJSON_HEADERS
${CMAKE_SOURCE_DIR}/src/json.h
)

# test chain
add_custom_target (
check_json
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

add_custom_command (
TARGET check_json
PRE_BUILD
COMMAND chkjson
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
)

INCLUDE_DIRECTORIES( ${CMAKE_SOURCE_DIR}/src ${CMAKE_SOURCE_DIR}/src/chkjson )

# Add the actual executable
Expand Down
3 changes: 3 additions & 0 deletions src/lua/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# CataclysmDDA Lua bindings
cmake_minimum_required(VERSION 2.8.12)

MESSAGE(STATUS "Searching for Lua library --\n")
FIND_PACKAGE(Lua)
IF(NOT LUA_FOUND)
Expand Down

0 comments on commit 00876e0

Please sign in to comment.