2011-06-19 20:29:38 -06:00
|
|
|
#FIXME: inherit all macros and stuff from the dfhack SDK
|
|
|
|
IF(UNIX)
|
|
|
|
add_definitions(-DLINUX_BUILD)
|
|
|
|
SET(CMAKE_CXX_FLAGS_DEBUG "-g -Wall")
|
2011-07-30 08:47:49 -06:00
|
|
|
SET(CMAKE_CXX_FLAGS "-fvisibility=hidden -m32 -std=c++0x")
|
|
|
|
SET(CMAKE_C_FLAGS "-fvisibility=hidden -m32 -std=c++0x")
|
2011-06-19 20:29:38 -06:00
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
include_directories("${dfhack_SOURCE_DIR}/library/include")
|
2011-07-25 02:14:58 -06:00
|
|
|
include_directories("${dfhack_SOURCE_DIR}/library/depends/xgetopt")
|
2011-07-16 04:26:31 -06:00
|
|
|
MACRO(CAR var)
|
|
|
|
SET(${var} ${ARGV1})
|
|
|
|
ENDMACRO(CAR)
|
2011-06-19 20:29:38 -06:00
|
|
|
|
2011-07-16 04:26:31 -06:00
|
|
|
MACRO(CDR var junk)
|
|
|
|
SET(${var} ${ARGN})
|
|
|
|
ENDMACRO(CDR)
|
|
|
|
|
|
|
|
MACRO(LIST_CONTAINS var value)
|
|
|
|
SET(${var})
|
|
|
|
FOREACH (value2 ${ARGN})
|
|
|
|
IF (${value} STREQUAL ${value2})
|
|
|
|
SET(${var} TRUE)
|
|
|
|
ENDIF (${value} STREQUAL ${value2})
|
|
|
|
ENDFOREACH (value2)
|
|
|
|
ENDMACRO(LIST_CONTAINS)
|
|
|
|
|
|
|
|
MACRO(PARSE_ARGUMENTS prefix arg_names option_names)
|
|
|
|
SET(DEFAULT_ARGS)
|
|
|
|
FOREACH(arg_name ${arg_names})
|
|
|
|
SET(${prefix}_${arg_name})
|
|
|
|
ENDFOREACH(arg_name)
|
|
|
|
FOREACH(option ${option_names})
|
|
|
|
SET(${prefix}_${option} FALSE)
|
|
|
|
ENDFOREACH(option)
|
|
|
|
|
|
|
|
SET(current_arg_name DEFAULT_ARGS)
|
|
|
|
SET(current_arg_list)
|
|
|
|
FOREACH(arg ${ARGN})
|
|
|
|
LIST_CONTAINS(is_arg_name ${arg} ${arg_names})
|
|
|
|
IF (is_arg_name)
|
|
|
|
SET(${prefix}_${current_arg_name} ${current_arg_list})
|
|
|
|
SET(current_arg_name ${arg})
|
|
|
|
SET(current_arg_list)
|
|
|
|
ELSE (is_arg_name)
|
|
|
|
LIST_CONTAINS(is_option ${arg} ${option_names})
|
|
|
|
IF (is_option)
|
|
|
|
SET(${prefix}_${arg} TRUE)
|
|
|
|
ELSE (is_option)
|
|
|
|
SET(current_arg_list ${current_arg_list} ${arg})
|
|
|
|
ENDIF (is_option)
|
|
|
|
ENDIF (is_arg_name)
|
|
|
|
ENDFOREACH(arg)
|
|
|
|
SET(${prefix}_${current_arg_name} ${current_arg_list})
|
|
|
|
ENDMACRO(PARSE_ARGUMENTS)
|
|
|
|
|
|
|
|
MACRO(DFHACK_PLUGIN)
|
|
|
|
PARSE_ARGUMENTS(PLUGIN
|
|
|
|
"LINK_LIBRARIES;DEPENDS"
|
|
|
|
"SOME_OPT"
|
|
|
|
${ARGN}
|
|
|
|
)
|
|
|
|
CAR(PLUGIN_NAME ${PLUGIN_DEFAULT_ARGS})
|
|
|
|
CDR(PLUGIN_SOURCES ${PLUGIN_DEFAULT_ARGS})
|
|
|
|
|
|
|
|
ADD_LIBRARY(${PLUGIN_NAME} MODULE ${PLUGIN_SOURCES})
|
|
|
|
TARGET_LINK_LIBRARIES(${PLUGIN_NAME} dfhack ${PLUGIN_LINK_LIBRARIES})
|
|
|
|
IF(UNIX)
|
|
|
|
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.so PREFIX "")
|
|
|
|
ELSE()
|
|
|
|
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES SUFFIX .plug.dll)
|
|
|
|
ENDIF()
|
|
|
|
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELEASE ${DFHACK_PLUGIN_OUTPUT_DIR})
|
|
|
|
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_MINSIZEREL ${DFHACK_PLUGIN_OUTPUT_DIR})
|
|
|
|
SET_TARGET_PROPERTIES(${PLUGIN_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_RELWITHDEBINFO ${DFHACK_PLUGIN_OUTPUT_DIR})
|
|
|
|
install(TARGETS ${PLUGIN_NAME}
|
|
|
|
LIBRARY DESTINATION ${DFHACK_PLUGIN_DESTINATION}
|
|
|
|
RUNTIME DESTINATION ${DFHACK_PLUGIN_DESTINATION})
|
|
|
|
#MESSAGE("Depends: ${PLUGIN_DEPENDS}")
|
|
|
|
#IF (PLUGIN_AUTO_INSTALL)
|
|
|
|
# MESSAGE("Auto install")
|
|
|
|
#ENDIF (PLUGIN_AUTO_INSTALL)
|
|
|
|
#IF (PLUGIN_NO_MODULE)
|
|
|
|
# MESSAGE("No module")
|
|
|
|
#ENDIF (PLUGIN_NO_MODULE)
|
|
|
|
ENDMACRO(DFHACK_PLUGIN)
|
|
|
|
|
|
|
|
# add all subdirectories. can be used in those subdirectories, etc...
|
|
|
|
# needs a re-run of cmake to pick up the changes
|
|
|
|
#macro(RECURSE_DIRS)
|
|
|
|
# file(GLOB sub-dir RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *)
|
|
|
|
# foreach(dir ${sub-dir})
|
|
|
|
# if(IS_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/${dir})
|
|
|
|
# add_subdirectory (${dir})
|
|
|
|
# endif()
|
|
|
|
# endforeach()
|
|
|
|
#endmacro()
|
|
|
|
|
|
|
|
#RECURSE_DIRS()
|
2011-07-25 03:09:29 -06:00
|
|
|
|
|
|
|
# Dfusion plugin (Windows only right now)
|
2011-07-30 14:08:24 -06:00
|
|
|
OPTION(BUILD_DFUSION "Build DFusion." ON)
|
|
|
|
if(NOT UNIX AND BUILD_DFUSION)
|
2011-07-25 03:09:29 -06:00
|
|
|
add_subdirectory (Dfusion)
|
2011-07-30 14:08:24 -06:00
|
|
|
endif()
|
2011-07-16 10:10:08 -06:00
|
|
|
|
|
|
|
OPTION(BUILD_QTPLUG "Build the experimental Qt plugin." OFF)
|
|
|
|
if(BUILD_QTPLUG)
|
2011-07-16 07:34:29 -06:00
|
|
|
add_subdirectory (qtplug)
|
2011-07-16 10:10:08 -06:00
|
|
|
endif()
|
2011-06-19 20:29:38 -06:00
|
|
|
|
2011-07-21 03:29:26 -06:00
|
|
|
OPTION(BUILD_STONESENSE "Build stonesense (needs a checkout first)." OFF)
|
|
|
|
if(BUILD_STONESENSE)
|
|
|
|
add_subdirectory (stonesense)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
|
2011-07-11 16:07:59 -06:00
|
|
|
OPTION(BUILD_KITTENS "Build the kittens plugin." OFF)
|
|
|
|
if(BUILD_KITTENS)
|
|
|
|
DFHACK_PLUGIN(kittens kittens.cpp)
|
|
|
|
endif()
|
2011-07-14 00:52:06 -06:00
|
|
|
|
|
|
|
IF(UNIX)
|
2011-07-17 04:05:14 -06:00
|
|
|
OPTION(BUILD_VECTORS "Build the vectors search plugin." OFF)
|
|
|
|
if(BUILD_VECTORS)
|
|
|
|
DFHACK_PLUGIN(vectors vectors.cpp)
|
|
|
|
endif()
|
2011-07-14 00:52:06 -06:00
|
|
|
endif()
|
2011-07-16 10:10:08 -06:00
|
|
|
|
2011-07-21 03:29:26 -06:00
|
|
|
|
2011-07-16 10:10:08 -06:00
|
|
|
DFHACK_PLUGIN(reveal reveal.cpp)
|
2011-07-25 02:14:58 -06:00
|
|
|
DFHACK_PLUGIN(probe probe.cpp)
|
2011-08-01 18:21:25 -06:00
|
|
|
DFHACK_PLUGIN(plants plants.cpp)
|
2011-07-16 10:10:08 -06:00
|
|
|
DFHACK_PLUGIN(prospector prospector.cpp)
|
2011-07-21 14:37:02 -06:00
|
|
|
DFHACK_PLUGIN(rawdump rawdump.cpp)
|
2011-07-16 10:10:08 -06:00
|
|
|
DFHACK_PLUGIN(cleanmap cleanmap.cpp)
|
|
|
|
DFHACK_PLUGIN(weather weather.cpp)
|
|
|
|
DFHACK_PLUGIN(vdig vdig.cpp)
|
|
|
|
DFHACK_PLUGIN(colonies colonies.cpp)
|
2011-07-20 19:26:52 -06:00
|
|
|
DFHACK_PLUGIN(itemhacks itemhacks.cpp)
|
|
|
|
DFHACK_PLUGIN(notes notes.cpp)
|
2011-07-25 02:14:58 -06:00
|
|
|
DFHACK_PLUGIN(mode mode.cpp)
|
2011-07-26 03:01:16 -06:00
|
|
|
#DFHACK_PLUGIN(tiles tiles.cpp)
|
2011-07-27 18:35:45 -06:00
|
|
|
DFHACK_PLUGIN(liquids liquids.cpp)
|
2011-08-02 08:25:10 -06:00
|
|
|
DFHACK_PLUGIN(tubefill tubefill.cpp)
|