From 46a89b00ad6b0e4e90d8b5a4571ac7fd32eb6845 Mon Sep 17 00:00:00 2001 From: flaviojs Date: Thu, 21 Jul 2011 06:47:12 +0000 Subject: * CMake: Only install template files if they don't already exist. * CMake: Added plugin targets. * CMake: Added options BUILD_* to build the converters and individual plugins. (default=OFF) * CMake: Added option WITH_CPACK for package creation. (default=ON) git-svn-id: https://rathena.svn.sourceforge.net/svnroot/rathena/trunk@14918 54d463be-8e91-2dee-dedb-b68131a5f0ec --- src/plugins/CMakeLists.txt | 175 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 175 insertions(+) create mode 100644 src/plugins/CMakeLists.txt (limited to 'src/plugins') diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt new file mode 100644 index 000000000..220f70f6b --- /dev/null +++ b/src/plugins/CMakeLists.txt @@ -0,0 +1,175 @@ + +# +# setup +# +get_property( CAN_BUILD_SHARED_LIBS GLOBAL PROPERTY TARGET_SUPPORTS_SHARED_LIBS ) +if( NOT CAN_BUILD_SHARED_LIBS ) + return() +endif() + +# +# console +# +option( BUILD_PLUGIN_console "build console plugin" OFF ) +if( BUILD_PLUGIN_console ) +message( STATUS "Creating target console" ) +set( CONSOLE_SOURCES + "${CMAKE_CURRENT_SOURCE_DIR}/console.c" + "${CMAKE_CURRENT_SOURCE_DIR}/console.def" + ) +set( LIBRARIES ${GLOBAL_LIBRARIES} ) +set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) +set( DEFINITIONS ${GLOBAL_DEFINITIONS} ) +set( SOURCE_FILES ${CONSOLE_SOURCES} ) +source_group( console FILES ${CONSOLE_SOURCES} ) +include_directories( ${INCLUDE_DIRS} ) +add_library( console SHARED ${SOURCE_FILES} ) +target_link_libraries( console ${LIBRARIES} ) +set_target_properties( console PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) +set_target_properties( console PROPERTIES PREFIX "" ) +if( INSTALL_COMPONENT_RUNTIME ) + cpack_add_component( Runtime_console DESCRIPTION "console plugin" DISPLAY_NAME "console" GROUP Runtime ) + install( TARGETS console + DESTINATION "plugins" + COMPONENT Runtime_console ) +endif( INSTALL_COMPONENT_RUNTIME ) +set( TARGET_LIST ${TARGET_LIST} console CACHE INTERNAL "" ) +message( STATUS "Creating target console - done" ) +endif( BUILD_PLUGIN_console ) + + +# +# dbghelpplug +# +if( WIN32 ) + find_path( HAVE_DBGHELP_H dbghelp.h ) + mark_as_advanced( HAVE_DBGHELP_H ) + if( HAVE_DBGHELP_H ) + option( BUILD_PLUGIN_dbghelpplug "build dbghelpplug plugin" OFF ) + endif() +endif() +if( BUILD_PLUGIN_dbghelpplug ) +message( STATUS "Creating target dbghelpplug" ) +set( DBGHELPPLUG_SOURCES + "${CMAKE_CURRENT_SOURCE_DIR}/dbghelpplug.c" + "${CMAKE_CURRENT_SOURCE_DIR}/dbghelpplug.rc" + ) +set( LIBRARIES ${GLOBAL_LIBRARIES} ) +set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) +set( DEFINITIONS ${GLOBAL_DEFINITIONS} ) +set( SOURCE_FILES ${DBGHELPPLUG_SOURCES} ) +source_group( dbghelpplug FILES ${DBGHELPPLUG_SOURCES} ) +include_directories( ${INCLUDE_DIRS} ) +add_library( dbghelpplug SHARED ${SOURCE_FILES} ) +target_link_libraries( dbghelpplug ${LIBRARIES} ) +set_target_properties( dbghelpplug PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) +set_target_properties( dbghelpplug PROPERTIES PREFIX "" ) +if( INSTALL_COMPONENT_RUNTIME ) + cpack_add_component( Runtime_dbghelpplug DESCRIPTION "dbghelpplug plugin" DISPLAY_NAME "dbghelpplug" GROUP Runtime ) + install( TARGETS dbghelpplug + DESTINATION "plugins" + COMPONENT Runtime_dbghelpplug ) +endif( INSTALL_COMPONENT_RUNTIME ) +set( TARGET_LIST ${TARGET_LIST} dbghelpplug CACHE INTERNAL "" ) +message( STATUS "Creating target dbghelpplug - done" ) +endif( BUILD_PLUGIN_dbghelpplug ) + + +# +# pid +# +if( WIN32 OR HAVE_GETPID ) + option( BUILD_PLUGIN_pid "build pid plugin" OFF ) +endif() +if( BUILD_PLUGIN_pid ) +message( STATUS "Creating target pid" ) +set( PID_SOURCES + "${CMAKE_CURRENT_SOURCE_DIR}/pid.c" + "${CMAKE_CURRENT_SOURCE_DIR}/pid.def" + ) +set( LIBRARIES ${GLOBAL_LIBRARIES} ) +set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) +set( DEFINITIONS ${GLOBAL_DEFINITIONS} ) +set( SOURCE_FILES ${PID_SOURCES} ) +source_group( pid FILES ${PID_SOURCES} ) +include_directories( ${INCLUDE_DIRS} ) +add_library( pid SHARED ${SOURCE_FILES} ) +target_link_libraries( pid ${LIBRARIES} ) +set_target_properties( pid PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) +set_target_properties( pid PROPERTIES PREFIX "" ) +if( INSTALL_COMPONENT_RUNTIME ) + cpack_add_component( Runtime_pid DESCRIPTION "pid plugin" DISPLAY_NAME "pid" GROUP Runtime ) + install( TARGETS pid + DESTINATION "plugins" + COMPONENT Runtime_pid ) +endif( INSTALL_COMPONENT_RUNTIME ) +set( TARGET_LIST ${TARGET_LIST} pid CACHE INTERNAL "" ) +message( STATUS "Creating target pid - done" ) +endif( BUILD_PLUGIN_pid ) + + +# +# sample +# +option( BUILD_PLUGIN_sample "build sample plugin" OFF ) +if( BUILD_PLUGIN_sample ) +message( STATUS "Creating target sample" ) +set( SAMPLE_SOURCES + "${CMAKE_CURRENT_SOURCE_DIR}/sample.c" + "${CMAKE_CURRENT_SOURCE_DIR}/sample.def" + ) +set( LIBRARIES ${GLOBAL_LIBRARIES} ) +set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) +set( DEFINITIONS ${GLOBAL_DEFINITIONS} ) +set( SOURCE_FILES ${SAMPLE_SOURCES} ) +source_group( sample FILES ${SAMPLE_SOURCES} ) +include_directories( ${INCLUDE_DIRS} ) +add_library( sample SHARED ${SOURCE_FILES} ) +target_link_libraries( sample ${LIBRARIES} ) +set_target_properties( sample PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) +set_target_properties( sample PROPERTIES PREFIX "" ) +if( INSTALL_COMPONENT_RUNTIME ) + cpack_add_component( Runtime_sample DESCRIPTION "sample plugin" DISPLAY_NAME "sample" GROUP Runtime ) + install( TARGETS sample + DESTINATION "plugins" + COMPONENT Runtime_sample ) +endif( INSTALL_COMPONENT_RUNTIME ) +set( TARGET_LIST ${TARGET_LIST} sample CACHE INTERNAL "" ) +message( STATUS "Creating target sample - done" ) +endif( BUILD_PLUGIN_sample ) + + +# +# sig +# +option( BUILD_PLUGIN_sig "build sig plugin" OFF ) +if( BUILD_PLUGIN_sig ) +message( STATUS "Creating target sig" ) +set( SIG_SOURCES + "${COMMON_SOURCE_DIR}/malloc.c" + "${COMMON_SOURCE_DIR}/malloc.h" + "${COMMON_SOURCE_DIR}/showmsg.c" + "${COMMON_SOURCE_DIR}/showmsg.h" + "${COMMON_SOURCE_DIR}/strlib.c" + "${COMMON_SOURCE_DIR}/strlib.h" + "${CMAKE_CURRENT_SOURCE_DIR}/sig.c" + ) +set( LIBRARIES ${GLOBAL_LIBRARIES} ) +set( INCLUDE_DIRS ${GLOBAL_INCLUDE_DIRS} ) +set( DEFINITIONS "${GLOBAL_DEFINITIONS} ${COMMON_MINI_DEFINITIONS} -DNO_MEMMGR" ) +set( SOURCE_FILES ${SIG_SOURCES} ) +source_group( sig FILES ${SIG_SOURCES} ) +include_directories( ${INCLUDE_DIRS} ) +add_library( sig SHARED ${SOURCE_FILES} ) +target_link_libraries( sig ${LIBRARIES} ) +set_target_properties( sig PROPERTIES COMPILE_FLAGS "${DEFINITIONS}" ) +set_target_properties( sig PROPERTIES PREFIX "" ) +if( INSTALL_COMPONENT_RUNTIME ) + cpack_add_component( Runtime_sig DESCRIPTION "sig plugin" DISPLAY_NAME "sig" GROUP Runtime ) + install( TARGETS sig + DESTINATION "plugins" + COMPONENT Runtime_sig ) +endif( INSTALL_COMPONENT_RUNTIME ) +set( TARGET_LIST ${TARGET_LIST} sig CACHE INTERNAL "" ) +message( STATUS "Creating target sig - done" ) +endif( BUILD_PLUGIN_sig ) -- cgit v1.2.3-60-g2f50