0001 ##
0002 ## @brief Enduro Execution platform's ATMI server 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
0035 # Set minimum version
0036 cmake_minimum_required(VERSION 3.5)
0037
0038 # Add debug options
0039 # By default if RELEASE_BUILD is not defined, then we run in debug!
0040 IF (ENV{RELEASE_BUILD})
0041 # do nothing
0042 ELSE (ENV{RELEASE_BUILD})
0043 ADD_DEFINITIONS("-D NDRX_DEBUG")
0044 ENDIF (ENV{RELEASE_BUILD})
0045
0046 # Make sure the compiler can find include files from our UBF library.
0047 include_directories (. ${ENDUROX_SOURCE_DIR}/include ${ENDUROX_SOURCE_DIR}/libnstd)
0048
0049 # Create a library called "SRVNDRX" which includes the source files.
0050 # The extension is already found. Any number of sources could be listed here.
0051 add_library (atmisrv SHARED
0052 srvmain.c
0053 svqdispatch.c
0054 init.c
0055 serverapi.c
0056 tpreturn.c
0057 rawmain.c
0058 ndrxdapi.c
0059 dynadv.c
0060 pollextension.c
0061 standard.c
0062 oatmisrv.c
0063 )
0064
0065 add_library (atmisrvnomain SHARED
0066 svqdispatch.c
0067 init.c
0068 serverapi.c
0069 tpreturn.c
0070 srvmain.c
0071 ndrxdapi.c
0072 dynadv.c
0073 pollextension.c
0074 standard.c
0075 oatmisrv.c
0076 nomain.c
0077 )
0078 # Integration library
0079 add_library (objatmisrvinteg OBJECT
0080 svqdispatch.c
0081 init.c
0082 serverapi.c
0083 tpreturn.c
0084 srvmain.c
0085 ndrxdapi.c
0086 dynadv.c
0087 pollextension.c
0088 integra.c
0089 oatmisrv.c
0090 oatmisrv_integra.c
0091 )
0092
0093 add_library (atmisrvdum SHARED
0094 dum.c)
0095
0096 # shared libraries need PIC
0097 set_property(TARGET objatmisrvinteg PROPERTY POSITION_INDEPENDENT_CODE 1)
0098
0099 # shared and static libraries built from the same object files
0100 add_library(atmisrvinteg SHARED $<TARGET_OBJECTS:objatmisrvinteg>)
0101
0102 if(CMAKE_OS_NAME STREQUAL "CYGWIN")
0103 target_link_libraries(atmisrvdum nstd) # just for cywing build, anyway we need to use integration mode...
0104 target_link_libraries(atmisrv atmisrvdum atmi ubf nstd)
0105 target_link_libraries(atmisrvnomain atmisrvdum atmi ubf nstd)
0106 target_link_libraries(atmisrvinteg atmi ubf nstd)
0107 elseif(CMAKE_OS_NAME STREQUAL "DARWIN")
0108 target_link_libraries(atmisrvdum nstd) # just for cywing build, anyway we need to use integration mode...
0109 target_link_libraries(atmisrv atmisrvdum atmi ubf nstd)
0110 target_link_libraries(atmisrvnomain atmisrvdum atmi ubf nstd)
0111 target_link_libraries(atmisrvinteg atmi ubf nstd)
0112 elseif(CMAKE_OS_NAME STREQUAL "AIX")
0113 target_link_libraries(atmisrv atmi ubf nstd pthread)
0114 target_link_libraries(atmisrvnomain atmi ubf nstd pthread)
0115 target_link_libraries(atmisrvinteg atmi ubf nstd pthread)
0116 target_link_libraries(atmisrvdum atmi ubf nstd pthread)
0117 endif()
0118
0119 install (TARGETS
0120 atmisrv
0121 atmisrvdum
0122 atmisrvnomain
0123 atmisrvinteg
0124 DESTINATION "${INSTALL_LIB_DIR}"
0125 PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
0126 COMPONENT libraries
0127 )
0128
0129 #################################################################################
0130 # Have some package config, usable for golang for example...
0131 #################################################################################
0132
0133 # there is special mode for aix
0134 # seems that go linker does not recongnize .so files...
0135
0136 if(CMAKE_OS_NAME STREQUAL "AIX")
0137 SET(ATMISRV_INTEG_LIBS "-lndrxaix -lrt -ldl")
0138 else()
0139
0140 SET(ATMISRV_INTEG_LIBS "-latmisrvinteg -latmi -lubf -lnstd -lpthread -lm")
0141
0142 foreach(LIB ${RT_LIB})
0143 # skip lCrun for solaris
0144 if(NOT ${LIB} MATCHES "Crun")
0145 list(APPEND ATMISRV_INTEG_LIBS "-l${LIB}")
0146 endif()
0147 endforeach()
0148
0149 string(REPLACE ";" " " ATMISRV_INTEG_LIBS "${ATMISRV_INTEG_LIBS}")
0150
0151 endif()
0152
0153
0154 # Produce a pkg-config file
0155 configure_file("atmisrvinteg.pc.in" "atmisrvinteg.pc" @ONLY)
0156
0157 install(FILES "${CMAKE_CURRENT_BINARY_DIR}/atmisrvinteg.pc"
0158 DESTINATION "${INSTALL_LIB_DIR}/pkgconfig/")
0159 #################################################################################
0160
0161 # vim: set ts=4 sw=4 et smartindent: