diff --git a/library/CMakeLists.txt b/library/CMakeLists.txt index 9442a4cc7..d66f0af51 100644 --- a/library/CMakeLists.txt +++ b/library/CMakeLists.txt @@ -54,6 +54,11 @@ include/dfhack/modules/WindowIO.h include/dfhack/modules/World.h ) +SET(PROJECT_C_HDRS +include/dfhack-c/DFTypes_C.h +include/dfhack-c/DFContext_C.h +) + SET(PROJECT_SRCS DFMemInfo.cpp DFMemInfoManager.cpp @@ -61,8 +66,6 @@ DFContextManager.cpp DFContext.cpp DFProcessEnumerator.cpp ContextShared.cpp -DFContext_C.cpp -DFTypes_C.cpp depends/md5/md5.cpp depends/md5/md5wrapper.cpp @@ -83,6 +86,11 @@ modules/Position.cpp modules/Translation.cpp modules/Vegetation.cpp modules/World.cpp +) + +SET(PROJECT_C_SRCS +DFContext_C.cpp +DFTypes_C.cpp modules/Buildings_C.cpp modules/Constructions_C.cpp @@ -126,6 +134,11 @@ ELSE(UNIX) LIST(APPEND PROJECT_SRCS ${PROJECT_SRCS_WINDOWS}) ENDIF(UNIX) +IF(BUILD_DFHACK_C_BINDIGS) + LIST(APPEND PROJECT_HDRS ${PROJECT_C_HDRS}) + LIST(APPEND PROJECT_SRCS ${PROJECT_C_SRCS}) +ENDIF(BUILD_DFHACK_C_BINDIGS) + SET_SOURCE_FILES_PROPERTIES( ${PROJECT_HDRS} PROPERTIES HEADER_FILE_ONLY TRUE ) LIST(APPEND PROJECT_SRCS ${PROJECT_HDRS}) diff --git a/tools/playground/CMakeLists.txt b/tools/playground/CMakeLists.txt index a799c7765..a28597475 100644 --- a/tools/playground/CMakeLists.txt +++ b/tools/playground/CMakeLists.txt @@ -12,10 +12,6 @@ ENDIF(UNIX) ADD_EXECUTABLE(dfmoodump moodump.cpp) TARGET_LINK_LIBRARIES(dfmoodump dfhack) -# for trying out some 'stuff' -ADD_EXECUTABLE(dftest test.cpp) -TARGET_LINK_LIBRARIES(dftest dfhack) - # bauxite - turn all mechanisms into bauxite mechanisms # Author: Alex Legg #ADD_EXECUTABLE(dfbauxite dfbauxite.cpp) @@ -60,9 +56,19 @@ TARGET_LINK_LIBRARIES(dfcatsplosion dfhack) #ADD_EXECUTABLE(dfrenamer renamer.cpp) #TARGET_LINK_LIBRARIES(dfrenamer dfhack) +# this needs the C bindings +IF(BUILD_DFHACK_C_BINDIGS) + # for trying out some 'stuff' + ADD_EXECUTABLE(dftest test.cpp) + TARGET_LINK_LIBRARIES(dftest dfhack) + install(TARGETS + dftest + RUNTIME DESTINATION bin + ) +ENDIF(BUILD_DFHACK_C_BINDIGS) + install(TARGETS dfmoodump -dftest dfdigger dfdigger2 dfcatsplosion