0001 ##
0002 ## @brief Enduro standard library
0003 ## Enduro Execution platform
0004 ##
0005 ## @file CMakeLists.txt
0006 ##
0007 ## -----------------------------------------------------------------------------
0008 ## Enduro/X Middleware Platform for Distributed Transaction Processing
0009 ## Copyright (C) 2009-2016, ATR Baltic, Ltd. All Rights Reserved.
0010 ## Copyright (C) 2017-2023, Mavimax, Ltd. All Rights Reserved.
0011 ## This software is released under one of the following licenses:
0012 ## AGPL (with Java and Go exceptions) or Mavimax's license for commercial use.
0013 ## See LICENSE file for full text.
0014 ## -----------------------------------------------------------------------------
0015 ## AGPL license:
0016 ##
0017 ## This program is free software; you can redistribute it and/or modify it under
0018 ## the terms of the GNU Affero General Public License, version 3 as published
0019 ## by the Free Software Foundation;
0020 ##
0021 ## This program is distributed in the hope that it will be useful, but WITHOUT ANY
0022 ## WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
0023 ## PARTICULAR PURPOSE. See the GNU Affero General Public License, version 3
0024 ## for more details.
0025 ##
0026 ## You should have received a copy of the GNU Affero General Public License along
0027 ## with this program; if not, write to the Free Software Foundation, Inc.,
0028 ## 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
0029 ##
0030 ## -----------------------------------------------------------------------------
0031 ## A commercial use license is available from Mavimax, Ltd
0032 ## contact@mavimax.com
0033 ## -----------------------------------------------------------------------------
0034 ##
0035
0036 # Set minimum version
0037 cmake_minimum_required(VERSION 3.5)
0038
0039 # Make sure the compiler can find include files from our Hello library.
0040 include_directories (. ../include)
0041
0042 SET(NSTD_POLLER "invalid_poller.c")
0043
0044 if(DEFINED EX_USE_SYSVQ)
0045 SET(NSTD_POLLER "sys_svqpoll.c")
0046 SET(NSTD_POLLER_2 "sys_svq.c")
0047 SET(NSTD_POLLER_3 "sys_svqshm.c")
0048 SET(NSTD_POLLER_4 "sys_svqevent.c")
0049 SET(NSTD_POLLER_5 "sys_svqadmin.c")
0050 elseif (DEFINED EX_USE_EMQ)
0051 SET(NSTD_POLLER "sys_poll.c")
0052 SET(NSTD_POLLER_2 "sys_emqueue.c")
0053 elseif (DEFINED EX_USE_KQUEUE)
0054 SET(NSTD_POLLER "sys_kqueue.c")
0055 elseif(DEFINED EX_USE_POLL)
0056 SET(NSTD_POLLER "sys_poll.c")
0057 elseif(DEFINED EX_USE_FDPOLL)
0058 SET(NSTD_POLLER "sys_fdpoll.c")
0059 elseif(DEFINED EX_USE_EPOLL)
0060 SET(NSTD_POLLER "sys_epoll.c")
0061 elseif(DEFINED EX_USE_SVAPOLL)
0062 # AIX Poll - directly on systemv queues
0063 SET(NSTD_POLLER "sys_svapoll.c")
0064 SET(NSTD_POLLER_2 "sys_svq.c")
0065 SET(NSTD_POLLER_3 "sys_svqshm.c")
0066 endif()
0067
0068 message("CMake CMAKE_OS_NAME = ${CMAKE_OS_NAME}")
0069
0070 # Use emulated queues (if forced).
0071 IF(DEFINE_FORCEEMQ)
0072 SET(NSTD_SYS_3 "sys_emqueue.c")
0073 ENDIF()
0074
0075 # Select the OS specifics:
0076 if (CMAKE_OS_NAME STREQUAL "LINUX")
0077 SET(NSTD_SYS "sys_linux.c")
0078 SET(NSTD_SYS_2 "sys_posixq.c")
0079 elseif (CMAKE_OS_NAME STREQUAL "CYGWIN")
0080 SET(NSTD_SYS "sys_linux.c")
0081 SET(NSTD_SYS_2 "sys_posixq.c")
0082 elseif (CMAKE_OS_NAME STREQUAL "SUNOS")
0083 SET(NSTD_SYS "sys_solaris.c")
0084 SET(NSTD_SYS_2 "sys_posixq.c")
0085 elseif (CMAKE_OS_NAME STREQUAL "AIX")
0086 SET(NSTD_SYS "sys_aix.c")
0087 SET(NSTD_SYS_2 "sys_posixq.c")
0088 elseif (CMAKE_OS_NAME STREQUAL "FREEBSD")
0089 SET(NSTD_SYS "sys_freebsd.c")
0090 SET(NSTD_SYS_2 "sys_posixq.c")
0091 SET(NSTD_SYS_3 "fmemopen-funopen.c")
0092 elseif (CMAKE_OS_NAME STREQUAL "DARWIN")
0093 SET(NSTD_SYS "sys_darwin.c")
0094 SET(NSTD_SYS_2 "sys_emqueue.c")
0095 SET(NSTD_SYS_3 "fmemopen-funopen.c")
0096 endif ()
0097
0098 add_library (objnstd OBJECT ndebug.c nstdutil.c nstopwatch.c nclopt.c benchmark.c
0099 ini.c inicfg.c cconfig.c nerror.c nstd_tls.c ulog.c
0100 sys_genunix.c
0101 ${NSTD_POLLER}
0102 ${NSTD_POLLER_2}
0103 ${NSTD_POLLER_3}
0104 ${NSTD_POLLER_4}
0105 ${NSTD_POLLER_5}
0106 ${NSTD_SYS}
0107 sys_common.c ${NSTD_SYS_2} ${NSTD_SYS_3} tplog.c
0108 exregex.c platform.c msgsizemax.c exaes.c exsha1.c
0109 exbase64.c crypto.c expluginbase.c lmdb/eidl.c lmdb/edb.c
0110 edbutil.c crc32.c nstd_shmsv.c ${NSTD_SYS_4} ${NSTD_SYS_5}
0111 nstd_sem.c ${NSTD_SYS_6} emb.c sys_test.c
0112 linearhash.c fpalloc.c thpool.c strtokblk.c lcf.c ndebugfd.c
0113 lcf_api.c sys_fsync.c stdcfgstr.c cid.c singlegrp.c exsm.c
0114 rbtree.c)
0115
0116 # shared libraries need PIC
0117 set_property(TARGET objnstd PROPERTY POSITION_INDEPENDENT_CODE 1)
0118
0119 # shared and static libraries built from the same object files
0120 add_library(nstd SHARED $<TARGET_OBJECTS:objnstd>)
0121
0122 if(CMAKE_OS_NAME STREQUAL "AIX")
0123 # for tls support
0124 target_link_libraries(nstd pthread)
0125 endif()
0126
0127 install (TARGETS
0128 nstd
0129 DESTINATION "${INSTALL_LIB_DIR}"
0130 PERMISSIONS OWNER_READ GROUP_READ WORLD_READ OWNER_WRITE OWNER_EXECUTE GROUP_EXECUTE WORLD_EXECUTE
0131 COMPONENT libraries
0132 )
0133 # vim: set ts=4 sw=4 et smartindent: