0001 ##
0002 ## @brief Transaction Monitor server default tmsrv & library
0003 ##
0004 ## @file CMakeLists.txt
0005 ##
0006 ## -----------------------------------------------------------------------------
0007 ## Enduro/X Middleware Platform for Distributed Transaction Processing
0008 ## Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0009 ## Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0010 ## This software is released under one of the following licenses:
0011 ## AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0012 ## See LICENSE file for full text.
0013 ## -----------------------------------------------------------------------------
0014 ## AGPL license:
0015 ##
0016 ## This program is free software; you can redistribute it and/or modify it under
0017 ## the terms of the GNU Affero General Public License, version 3 as published
0018 ## by the Free Software Foundation;
0019 ##
0020 ## This program is distributed in the hope that it will be useful, but WITHOUT ANY
0021 ## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0022 ## PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0023 ## for more details.
0024 ##
0025 ## You should have received a copy of the GNU Affero General Public License along
0026 ## with this program; if not, write to the Free Software Foundation, Inc.,
0027 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0028 ##
0029 ## -----------------------------------------------------------------------------
0030 ## A commercial use license is available from Mavimax, Ltd
0031 ## contact@mavimax.com
0032 ## -----------------------------------------------------------------------------
0033 ##
0034 cmake_minimum_required(VERSION 3.5)
0035
0036 # Make sure the compiler can find include files from UBF library
0037 include_directories (${ENDUROX_SOURCE_DIR}/libubf
0038 ${ENDUROX_SOURCE_DIR}/include
0039 ${ENDUROX_SOURCE_DIR}/libnstd
0040 ${ENDUROX_SOURCE_DIR}/ubftest
0041 )
0042
0043
0044 # Add debug options
0045 # By default if RELEASE_BUILD is not defined, then we run in debug!
0046 IF (ENV{RELEASE_BUILD})
0047 # do nothing
0048 ELSE (ENV{RELEASE_BUILD})
0049 ADD_DEFINITIONS("-D NDRX_DEBUG")
0050 ENDIF (ENV{RELEASE_BUILD})
0051
0052 # Make sure the linker can find the UBF library once it is built.
0053 link_directories (${ENDUROX_BINARY_DIR}/libubf)
0054
0055 ############################# Libs #############################################
0056 add_library (objtms OBJECT
0057 tmsrv.c
0058 xasrvutil.c
0059 xastates.c
0060 log.c
0061 local.c
0062 background.c
0063 tmapi.c
0064 btid.c
0065 statedrv.c)
0066
0067 # shared libraries need PIC
0068 set_property(TARGET objtms PROPERTY POSITION_INDEPENDENT_CODE 1)
0069
0070 # shared and static libraries built from the same object files
0071 add_library(tms SHARED $<TARGET_OBJECTS:objtms>)
0072
0073 SET (TMSRV_ADD_DEP "")
0074
0075 if(CMAKE_OS_NAME STREQUAL "CYGWIN")
0076 target_link_libraries(tms atmisrvinteg atmi ubf nstd ${RT_LIB} pthread)
0077 elseif(CMAKE_OS_NAME STREQUAL "DARWIN")
0078 target_link_libraries(tms atmisrvinteg atmi ubf nstd ${RT_LIB} pthread)
0079 elseif(CMAKE_OS_NAME STREQUAL "AIX")
0080 #
0081 # linking lib against pthread for XL C on aix, otherwise we get error like:
0082 # ld: 0711-768 WARNING: Object CMakeFiles/ubf.dir/ferror.c.o, section 1, function .__tls_get_addr:
0083 # The branch at address 0x154 is not followed by a rec
0084 # Or
0085 # ld: 0711-768 WARNING: Object CMakeFiles/ubf.dir/ferror.c.o, section 1, function .__tls_get_addr:
0086 # The branch at address 0x154 is not followed by a rec
0087 target_link_libraries(tms bsd pthread)
0088 SET (TMSRV_ADD_DEP "bsd")
0089 endif()
0090
0091
0092 ############################# Executables ######################################
0093 add_executable (tmsrv
0094 tmsrvmain.c
0095 )
0096 target_link_libraries (tmsrv tms atmisrvinteg atmi ubf nstd ${RT_LIB} ${TMSRV_ADD_DEP} pthread)
0097 set_target_properties(tmsrv PROPERTIES LINK_FLAGS "$ENV{MYLDFLAGS}")
0098
0099
0100 add_executable (tmrecoversv
0101 tmrecoversv.c
0102 tmrecover.c
0103 )
0104 target_link_libraries (tmrecoversv atmisrvinteg atmi ubf nstd ${RT_LIB} pthread)
0105 set_target_properties(tmrecoversv PROPERTIES LINK_FLAGS "$ENV{MYLDFLAGS}")
0106
0107 add_executable (tmrecovercl
0108 tmrecovercl.c
0109 tmrecover.c
0110 )
0111 target_link_libraries (tmrecovercl atmiclt atmi ubf nstd ${RT_LIB} pthread)
0112 set_target_properties(tmrecovercl PROPERTIES LINK_FLAGS "$ENV{MYLDFLAGS}")
0113 ################################################################################
0114
0115 #
0116 # Run off the build server, use NULL server in default build
0117 #
0118 install (TARGETS
0119 tms
0120 DESTINATION "${INSTALL_LIB_DIR}"
0121 PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
0122 COMPONENT libraries)
0123
0124 # Install bin
0125 install (TARGETS
0126 tmsrv
0127 tmrecovercl
0128 tmrecoversv
0129 DESTINATION bin)
0130
0131 # vim: set ts=4 sw=4 et smartindent: