0001 ##
0002 ## @brief PostgreSQL PQ TMSRV driver tests / branch transactions - server
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
0035 cmake_minimum_required(VERSION 3.5)
0036
0037 find_package(PostgreSQL REQUIRED)
0038
0039 # Make sure the compiler can find include files from UBF library
0040 include_directories (${ENDUROX_SOURCE_DIR}/libubf
0041 ${ENDUROX_SOURCE_DIR}/include
0042 ${ENDUROX_SOURCE_DIR}/libnstd
0043 ${ENDUROX_SOURCE_DIR}/ubftest
0044 ${PostgreSQL_INCLUDE_DIRS})
0045 # Add debug options
0046 # By default if RELEASE_BUILD is not defined, then we run in debug!
0047 IF ($ENV{RELEASE_BUILD})
0048 # do nothing
0049 ELSE ($ENV{RELEASE_BUILD})
0050 ADD_DEFINITIONS("-D NDRX_DEBUG")
0051 ENDIF ($ENV{RELEASE_BUILD})
0052
0053
0054 # Build ecpg binary only if running in ecpg mode...
0055 # else use pq mode...
0056 IF(NOT DEFINED DISABLE_ECPG)
0057
0058 set( PGSQL_CMD "ecpg" )
0059 set( PGSQL_ARG "atmisv67.pgc" )
0060
0061 add_custom_command( OUTPUT atmisv67.c
0062 COMMAND ${PGSQL_CMD} ${PGSQL_ARG}
0063 DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${PGSQL_ARG}
0064 WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} )
0065
0066 ENDIF()
0067
0068 # Make sure the linker can find the UBF library once it is built.
0069 link_directories (${ENDUROX_BINARY_DIR}/libubf
0070 # freebsd ecpg path...
0071 /usr/local/lib
0072 # IBM AIX
0073 /opt/freeware/lib)
0074
0075 ############################# Test - executables ###############################
0076 IF(NOT DEFINED DISABLE_ECPG)
0077 add_executable (atmi.sv67 atmisv67.c ../../libatmisrv/rawmain_integra.c)
0078 ELSE()
0079 add_executable (atmi.sv67 atmisv67_2.c ../../libatmisrv/rawmain_integra.c)
0080 ENDIF()
0081
0082 add_executable (atmiclt67 atmiclt67.c cltqtest67.c)
0083 ################################################################################
0084 ############################# Test - executables ###############################
0085
0086 IF(NOT DEFINED DISABLE_ECPG)
0087
0088 # Link the executable to the ATMI library & others...
0089 target_link_libraries (atmi.sv67 atmisrvinteg atmi ubf nstd m pthread ${RT_LIB}
0090 ecpg ${PostgreSQL_LIBRARIES})
0091 target_link_libraries (atmiclt67 atmiclt atmi ubf nstd m pthread ${RT_LIB}
0092 ecpg ${PostgreSQL_LIBRARIES})
0093 ELSE()
0094
0095 # Link the executable to the ATMI library & others...
0096 target_link_libraries (atmi.sv67 atmisrvinteg atmi ubf nstd m pthread ${RT_LIB}
0097 ${PostgreSQL_LIBRARIES})
0098 target_link_libraries (atmiclt67 atmiclt atmi ubf nstd m pthread ${RT_LIB}
0099 ${PostgreSQL_LIBRARIES})
0100
0101 ENDIF()
0102
0103 set_target_properties(atmi.sv67 PROPERTIES LINK_FLAGS "$ENV{MYLDFLAGS}")
0104 set_target_properties(atmiclt67 PROPERTIES LINK_FLAGS "$ENV{MYLDFLAGS}")
0105 ################################################################################
0106
0107 # vim: set ts=4 sw=4 et smartindent: