diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000000..c47583bf61 --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,262 @@ +# +# firebird (trunk) +# + +############################################################################### +# +# cmake settings +# +############################################################################### + +cmake_minimum_required(VERSION 2.8.8) + +# In-source builds are not possible and so disabled. +if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) + message(FATAL_ERROR + "CMake generation for firebird is not possible within the source directory!" + "\n Remove the CMakeCache.txt file and try again from another folder, e.g.:" + "\n " + "\n rm CMakeCache.txt" + "\n mkdir build" + "\n cd build" + "\n cmake .." + ) +endif() + +set(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/builds/cmake) + +if (NATIVE_BUILD_DIR) + get_filename_component(NATIVE_BUILD_DIR ${NATIVE_BUILD_DIR} ABSOLUTE) +else() + set(NATIVE_BUILD_DIR ${CMAKE_BINARY_DIR}) +endif() + +# Use solution folders. +set_property(GLOBAL PROPERTY USE_FOLDERS ON) +set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake Targets") + +############################################################################### +# +# project settings +# +############################################################################### + +project("firebird" C CXX) + +####################################### + +set(output_dir ${CMAKE_BINARY_DIR}/${PROJECT_NAME}) + +set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${output_dir}) +set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${output_dir}) + +if (MSVC OR XCODE) + set(output_dir ${output_dir}/$) +endif() + +if (XCODE) + foreach(conf ${CMAKE_CONFIGURATION_TYPES}) + string(TOUPPER ${conf} conf2) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${conf2} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${conf}/bin) + endforeach() +elseif (UNIX) + set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${output_dir}/bin) + set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${output_dir}/bin) +endif() + +############################################################################### +# +# configure +# +############################################################################### + +include(Configure) + +if (FREEBSD) + # temporary + set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}) +endif() + +set(FB_PREFIX ${CMAKE_INSTALL_PREFIX}/${PROJECT_NAME}) +set(FB_IPC_NAME "FirebirdIPI") +set(FB_LOGFILENAME "firebird.log") +set(FB_PIPE_NAME "interbas") +set(FB_SERVICE_NAME "gds_db") +set(FB_SERVICE_PORT 3050) + +if (WIN32) + set(FB_PREFIX "c:\\\\Program Files\\\\Firebird\\\\") + set(FB_IPC_NAME "FIREBIRD") +endif() + +set(AUTOCONFIG_SRC ${CMAKE_SOURCE_DIR}/src/include/gen/autoconfig.h.in) +set(AUTOCONFIG ${CMAKE_BINARY_DIR}/src/include/gen/autoconfig.h) +configure_file(${AUTOCONFIG_SRC} ${AUTOCONFIG} @ONLY) + +############################################################################### +# +# compiler & linker +# +############################################################################### + +add_definitions(-DDEV_BUILD) + +if (WIN32) + set(OS_DIR win32) + set(VERSION_RC ${CMAKE_SOURCE_DIR}/src/jrd/version.rc) + + if (MSVC) + set(disable_msvc_warnings "/wd4996") + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} /MP ${disable_msvc_warnings}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /MP ${disable_msvc_warnings}") + endif(MSVC) + + set(LIB_Ws2_32 Ws2_32) + set(LIB_comctl32 comctl32) + set(LIB_mpr mpr) + set(LIB_version version) +endif(WIN32) + +if (MINGW) + add_definitions(-D_WIN32_WINNT=0x0600) +endif() + +if (UNIX) + set(OS_DIR posix) + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC") + + if (NOT CMAKE_CROSSCOMPILING) + set(LIB_readline readline) + endif() + if (NOT FREEBSD) + set(LIB_dl dl) + endif() +endif() + +if (CLANG OR IOS) + set(LIB_iconv iconv) +endif() + +if (FREEBSD) + include_directories(/usr/local/include) + link_directories(/usr/local/lib) +endif() + +if (APPLE) + set(OS_DIR darwin) + + include_directories(/opt/local/include) + if (NOT CMAKE_CROSSCOMPILING) + link_directories(/opt/local/lib) + endif() + + find_library(LIB_CoreFoundation CoreFoundation) +elseif (UNIX) + set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread") +endif() + +############################################################################### +# +# pre build +# +############################################################################### + +if (WIN32) + # icu + set(ICU_EXTRACT ${CMAKE_CURRENT_SOURCE_DIR}/extern/icu/icu.exe -y) + #message("Extracting pre-built ICU") + execute_process(COMMAND ${ICU_EXTRACT}) + + # zlib + set(ZLIB_EXTRACT ${CMAKE_CURRENT_SOURCE_DIR}/extern/zlib/zlib.exe -y) + #message("Extracting pre-built zlib") + execute_process(COMMAND ${ZLIB_EXTRACT}) +endif() + +if (UNIX) + file(GLOB vers_src "${CMAKE_SOURCE_DIR}/builds/posix/*.vers") + foreach(f ${vers_src}) + get_filename_component(name ${f} NAME) + set(name ${CMAKE_BINARY_DIR}/builds/posix/${name}) + + if (AIX) + file(WRITE ${name} "#!\n") + elseif (LINUX) + file(WRITE ${name} "{\nglobal:\n") + endif() + + file(STRINGS ${f} strings) + foreach(s ${strings}) + string(REGEX REPLACE "#.*$" "" s "${s}") + string(STRIP "${s}" s) + if (NOT "${s}" STREQUAL "") + if (AIX) + file(APPEND ${name} "\t${s}\n") + elseif (APPLE) + file(APPEND ${name} "\t_${s}\n") + elseif (HPUX) + file(APPEND ${name} "+e ${s}\n") + else() + file(APPEND ${name} "\t${s};\n") + endif() + endif() + endforeach() + + if (LINUX) + file(APPEND ${name} "local:\n\t*;\n};\n") + endif() + endforeach() +endif() + + +############################################################################### +# +# build +# +############################################################################### + +include(BuildFunctions) + +crosscompile_prebuild_steps() + +include_directories("extern/libtommath") +include_directories("extern/icu/include") +include_directories("extern/zlib") + +include_directories("src/include") +include_directories("src/include/gen") +include_directories("${CMAKE_CURRENT_BINARY_DIR}/src/include") +include_directories("${CMAKE_CURRENT_BINARY_DIR}/src/include/gen") + +######################################## +# EXECUTABLE btyacc +######################################## + +file(GLOB btyacc_src "extern/btyacc/*.c" "extern/btyacc/*.h") + +if (NOT CMAKE_CROSSCOMPILING) + +add_executable (btyacc ${btyacc_src}) +project_group (btyacc Extern) + +endif() # if (NOT CMAKE_CROSSCOMPILING) + + +######################################## +# LIBRARY btyacc +######################################## + +file(GLOB libtommath_src "extern/libtommath/*.c" "extern/libtommath/*.h") + +add_library (libtommath ${libtommath_src}) +project_group (libtommath Extern) + +######################################## + +add_subdirectory("examples") +add_subdirectory("src") + +############################################################################### + diff --git a/builds/cmake/BuildFunctions.cmake b/builds/cmake/BuildFunctions.cmake new file mode 100644 index 0000000000..d149ee13c5 --- /dev/null +++ b/builds/cmake/BuildFunctions.cmake @@ -0,0 +1,255 @@ +############################################################################### +# +# macros and functions +# +############################################################################### + +####################################### +# FUNCTION set_output_directory +####################################### +function(set_output_directory target dir) + set(out ${output_dir}) + if (MSVC OR XCODE) # multiconfiguration builds + set(out ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}) + endif() + if ("${ARGV2}" STREQUAL "FORCE") + if (MSVC OR XCODE) + set(out ${dir}) + set(dir) + else() + set(out .) + endif() + endif() + if (MSVC OR XCODE) + foreach(conf ${CMAKE_CONFIGURATION_TYPES}) + string(TOUPPER ${conf} conf2) + set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY_${conf2} ${out}/${conf}/${dir}) + set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${conf2} ${out}/${conf}/${dir}) + endforeach() + else() # single configuration + execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${out}/${dir}) + set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${out}/${dir}) + set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${out}/${dir}) + endif() +endfunction(set_output_directory) + +####################################### +# FUNCTION set_output_directory_unix +####################################### +function(set_output_directory_unix target dir) + if (UNIX) + set_output_directory(${target} ${dir} ${ARGN}) + endif() +endfunction(set_output_directory_unix) + +####################################### +# FUNCTION set_exported_symbols +####################################### +if (WIN32) + function(set_exported_symbols target filename) + set(def_file ${filename}.def) + if ("${filename}" STREQUAL "empty") + set(def_file) + elseif("${filename}" STREQUAL "fbplugin") + set(def_file "plugin.def") + endif() + if (NOT "${def_file}" STREQUAL "") + if (MSVC) + set_target_properties(${target} PROPERTIES LINK_FLAGS "/DEF:\"${CMAKE_SOURCE_DIR}/builds/win32/defs/${def_file}\"") + endif() + if (MINGW) + #set_target_properties(${target} PROPERTIES LINK_FLAGS "-Wl,${CMAKE_SOURCE_DIR}/builds/win32/defs/${def_file}") + endif() + endif() + endfunction(set_exported_symbols) +endif() + +if (UNIX) + function(set_exported_symbols target filename) + set(def_file ${filename}.vers) + if ("${filename}" STREQUAL "ib_udf") + set(def_file) + endif() + if (NOT "${def_file}" STREQUAL "") + set(wl_option "--version-script") + if (APPLE) + set(wl_option "-exported_symbols_list") + endif() + set_target_properties(${target} PROPERTIES LINK_FLAGS -Wl,${wl_option},${CMAKE_BINARY_DIR}/builds/posix/${def_file}) + endif() + endfunction(set_exported_symbols) +endif(UNIX) + + +####################################### +# FUNCTION epp_process +####################################### +function(epp_process type files) + set(epp_suffix ".${type}.cpp") + + foreach(F ${${files}}) + set(in ${CMAKE_CURRENT_SOURCE_DIR}/${F}) + set(out ${CMAKE_CURRENT_BINARY_DIR}/${F}${epp_suffix}) + + get_filename_component(dir ${out} PATH) + + if ("${type}" STREQUAL "boot") + add_custom_command( + OUTPUT ${out} + DEPENDS gpre_boot ${in} + COMMENT "Calling GPRE boot for ${F}" + COMMAND ${CMAKE_COMMAND} -E make_directory ${dir} + COMMAND ${ARGN} ${in} ${out} + ) + elseif ("${type}" STREQUAL "master") + get_filename_component(file ${out} NAME) + set(dir ${dir}/${file}.d) + add_custom_command( + OUTPUT ${out} + DEPENDS ${in} databases + COMMENT "Calling GPRE master for ${F}" + COMMAND ${CMAKE_COMMAND} -E make_directory ${dir} + COMMAND ${CMAKE_COMMAND} -E copy_if_different metadata.fdb ${dir}/yachts.lnk + COMMAND ${CMAKE_COMMAND} -E copy_if_different security.fdb ${dir}/security.fdb + COMMAND ${CMAKE_COMMAND} -E copy_if_different msg.fdb ${dir}/msg.fdb + COMMAND ${CMAKE_COMMAND} -E copy_if_different help.fdb ${dir}/help.fdb + COMMAND ${ARGN} -b ${dir}/ ${in} ${out} + ) + endif() + endforeach() +endfunction(epp_process) + +####################################### +# FUNCTION add_epp_suffix +####################################### +function(add_epp_suffix files suffix) + foreach(F ${${files}}) + list(APPEND ${files}_${suffix} ${CMAKE_CURRENT_SOURCE_DIR}/${F}) + list(APPEND ${files}_${suffix} ${GENERATED_DIR}/${F}.${suffix}.cpp) + endforeach() + set_source_files_properties(${${files}_${suffix}} PROPERTIES GENERATED TRUE) + set(${files}_${suffix} ${${files}_${suffix}} PARENT_SCOPE) +endfunction(add_epp_suffix) + +####################################### +# FUNCTION set_win32 +####################################### +function(set_win32 var) + if (WIN32) + set(${var} ${ARGN} PARENT_SCOPE) + endif() +endfunction(set_win32) + +####################################### +# FUNCTION set_unix +####################################### +function(set_unix var) + if (UNIX) + set(${var} ${ARGN} PARENT_SCOPE) + endif() +endfunction(set_unix) + +####################################### +# FUNCTION set_apple +####################################### +function(set_apple var) + if (APPLE) + set(${var} ${ARGN} PARENT_SCOPE) + endif() +endfunction(set_apple) + +####################################### +# FUNCTION add_src_win32 +####################################### +function(add_src_win32 var) + if (WIN32) + set(${var} ${${var}} ${ARGN} PARENT_SCOPE) + endif() +endfunction(add_src_win32) + +####################################### +# FUNCTION add_src_unix +####################################### +function(add_src_unix var) + if (UNIX) + set(${var} ${${var}} ${ARGN} PARENT_SCOPE) + endif() +endfunction(add_src_unix) + +####################################### +# FUNCTION add_src_unix_not_apple +####################################### +function(add_src_unix_not_apple var) + if (UNIX AND NOT APPLE) + set(${var} ${${var}} ${ARGN} PARENT_SCOPE) + endif() +endfunction(add_src_unix_not_apple) + +####################################### +# FUNCTION add_src_apple +####################################### +function(add_src_apple var) + if (APPLE) + set(${var} ${${var}} ${ARGN} PARENT_SCOPE) + endif() +endfunction(add_src_apple) + +####################################### +# FUNCTION copy_and_rename_lib +####################################### +function(copy_and_rename_lib target name) + set(name2 $/${CMAKE_SHARED_LIBRARY_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX}) + add_custom_command( + TARGET ${target} + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different $ ${name2} + ) +endfunction(copy_and_rename_lib) + +####################################### +# FUNCTION project_group +####################################### +function(project_group target name) + set_target_properties(${target} PROPERTIES FOLDER ${name}) +endfunction(project_group) + +####################################### +# FUNCTION set_generated_directory +####################################### +function(set_generated_directory) + if (NOT CMAKE_CROSSCOMPILING) + set(GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE) + else() + string(REPLACE "${CMAKE_BINARY_DIR}" "${NATIVE_BUILD_DIR}" GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR}) + set(GENERATED_DIR ${GENERATED_DIR} PARENT_SCOPE) + endif() +endfunction(set_generated_directory) + +####################################### +# FUNCTION add_dependencies_cc (cross compile) +####################################### +function(add_dependencies_cc target) + if (NOT CMAKE_CROSSCOMPILING) + add_dependencies(${target} ${ARGN}) + endif() +endfunction(add_dependencies_cc) + +####################################### +# FUNCTION add_dependencies_unix_cc (cross compile) +####################################### +function(add_dependencies_unix_cc target) + if (UNIX) + add_dependencies_cc(${target} ${ARGN}) + endif() +endfunction(add_dependencies_unix_cc) + +####################################### +# FUNCTION crosscompile_prebuild_steps +####################################### +function(crosscompile_prebuild_steps) + if (CMAKE_CROSSCOMPILING) + execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NATIVE_BUILD_DIR}/src/include/gen/parse.h ${CMAKE_BINARY_DIR}/src/include/gen/parse.h) + endif() +endfunction(crosscompile_prebuild_steps) + +############################################################################### diff --git a/builds/cmake/Configure.cmake b/builds/cmake/Configure.cmake new file mode 100644 index 0000000000..d898877704 --- /dev/null +++ b/builds/cmake/Configure.cmake @@ -0,0 +1,330 @@ +############################################################################### +# +# configure +# +############################################################################### + +####################################### +# FUNCTION check_includes +####################################### +function(check_includes files) + foreach(F ${${files}}) + set(name ${F}) + string(REPLACE "." "_" name ${name}) + string(REPLACE "/" "_" name ${name}) + string(TOUPPER ${name} name) + check_include_files(${F} HAVE_${name}) + #message("/* Define to 1 if you have the <${F}> header file. */") + #message("#cmakedefine HAVE_${name} 1") + #message("") + endforeach() +endfunction(check_includes) + +####################################### +# FUNCTION check_functions +####################################### +function(check_functions functions) + foreach(F ${${functions}}) + set(name ${F}) + string(TOUPPER ${name} name) + check_function_exists(${F} HAVE_${name}) + #message("/* Define to 1 if you have the `${F}' function. */") + #message("#cmakedefine HAVE_${name} 1") + #message("") + endforeach() +endfunction(check_functions) + +####################################### +# FUNCTION check_type_alignment +####################################### +function(check_type_alignment type var) + if (NOT DEFINED ${var}) + check_c_source_runs("main(){struct s{char a;${type} b;};exit((int)&((struct s*)0)->b);}" ${var}) + #message("-- Performing Test ${var} - It's still OK.") + message("-- Performing Test ${var} - Success") + set(${var} ${${var}_EXITCODE} CACHE STRING "${type} alignment" FORCE) + endif() +endfunction(check_type_alignment) + +####################################### + +include(CheckCSourceCompiles) +include(CheckCSourceRuns) +include(CheckCXXSourceCompiles) +include(CheckCXXSourceRuns) +include(CheckFunctionExists) +include(CheckIncludeFiles) +include(CheckLibraryExists) +include(CheckPrototypeDefinition) +include(CheckStructHasMember) +include(CheckSymbolExists) +include(CheckTypeSize) +include(TestBigEndian) + +if (ANDROID) + set(LINUX 1) +endif() + +if (IOS) + set(CMAKE_SYSTEM_PROCESSOR “arm”) # armv7 ? + add_definitions(-D__arm__) +endif() + +if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang") + set(CLANG 1) +endif() + +set(ENABLE_BINRELOC 1) + +string(TOUPPER ${CMAKE_SYSTEM_NAME} CMAKE_SYSTEM_NAME_UPPER) +set(${CMAKE_SYSTEM_NAME_UPPER} 1) + +string(TOUPPER ${CMAKE_SYSTEM_PROCESSOR} CMAKE_SYSTEM_PROCESSOR_UPPER) +string(FIND ${CMAKE_SYSTEM_PROCESSOR} "arm" ARM) +if (NOT ${ARM} EQUAL -1) + set(ARM 1) +else() + set(ARM) +endif() +if (${CMAKE_SYSTEM_PROCESSOR_UPPER} STREQUAL "X86_64" OR + ${CMAKE_SYSTEM_PROCESSOR_UPPER} STREQUAL "AMD64") + set(AMD64 1) + set(I386 1) +endif() +set(${CMAKE_SYSTEM_PROCESSOR_UPPER} 1) + +set(SHRLIB_EXT ${CMAKE_SHARED_LIBRARY_SUFFIX}) +string(REPLACE "." "" SHRLIB_EXT ${SHRLIB_EXT}) + +set(CASE_SENSITIVITY "true") +set(SUPPORT_RAW_DEVICES 1) + +set(include_files_list + aio.h + assert.h + atomic.h + atomic_ops.h + crypt.h + ctype.h + dirent.h + dlfcn.h + editline.h + errno.h + fcntl.h + float.h + grp.h + iconv.h + io.h + inttypes.h + langinfo.h + libio.h + linux/falloc.h + limits.h + locale.h + math.h + memory.h + mntent.h + mnttab.h + ndir.h + netconfig.h + netinet/in.h + poll.h + pthread.h + pwd.h + rpc/rpc.h + rpc/xdr.h + semaphore.h + setjmp.h + signal.h + socket.h + stdarg.h + stdint.h + stdlib.h + string.h + strings.h + sys/dir.h + sys/file.h + sys/ioctl.h + sys/ipc.h + sys/mntent.h + sys/mnttab.h + sys/mount.h + sys/ndir.h + sys/param.h + sys/resource.h + sys/sem.h + sys/select.h + sys/siginfo.h + sys/signal.h + sys/socket.h + sys/sockio.h + sys/stat.h + sys/syscall.h + sys/time.h + sys/timeb.h + sys/types.h + sys/uio.h + sys/wait.h + termio.h + termios.h + unistd.h + varargs.h + vfork.h + winsock2.h + zlib.h +) +check_includes(include_files_list) + +#if test "$EDITLINE_FLG" = "Y"; then +# AC_HEADER_DIRENT +# AC_DEFINE(HAVE_EDITLINE_H, 1, [Define this if editline is in use]) +#fi + +set(functions_list + AO_compare_and_swap_full + clock_gettime + dirname + fallocate + fchmod + fsync + flock + fork + getpagesize + getcwd getwd + gettimeofday + gmtime_r + initgroups + localtime_r + mkstemp + mmap + nanosleep + poll + posix_fadvise + pread pwrite + pthread_cancel + pthread_keycreate pthread_key_create + pthread_mutexattr_setprotocol + pthread_mutexattr_setrobust_np + pthread_mutex_consistent_np + pthread_rwlockattr_setkind_np + qsort_r + setitimer + semtimedop + setpgid + setpgrp + setmntent getmntent + setrlimit getrlimit + sigaction + sigset + snprintf vsnprintf + strcasecmp stricmp + strncasecmp strnicmp + strdup + strerror_r + swab _swab + tcgetattr + time times + vfork +) +check_functions(functions_list) + +check_cxx_source_compiles("#include \nmain(){fdatasync(0);}" HAVE_FDATASYNC) + +check_library_exists(dl dladdr "${CMAKE_LIBRARY_PREFIX}" HAVE_DLADDR) +check_library_exists(m fegetenv "${CMAKE_LIBRARY_PREFIX}" HAVE_FEGETENV) +check_library_exists(m llrint "${CMAKE_LIBRARY_PREFIX}" HAVE_LLRINT) +check_library_exists(pthread sem_init "${CMAKE_LIBRARY_PREFIX}" HAVE_SEM_INIT) +check_library_exists(pthread sem_timedwait "${CMAKE_LIBRARY_PREFIX}" HAVE_SEM_TIMEDWAIT) + +check_type_size(caddr_t HAVE_CADDR_T) +check_c_source_compiles("#include \nmain(){union semun s;return 0;}" HAVE_SEMUN) +set(CMAKE_EXTRA_INCLUDE_FILES sys/socket.h sys/types.h) +check_type_size(socklen_t HAVE_SOCKLEN_T) +set(CMAKE_EXTRA_INCLUDE_FILES) + +check_type_size(long SIZEOF_LONG) +check_type_size(size_t SIZEOF_SIZE_T) +check_type_size("void *" SIZEOF_VOID_P) + +check_type_size(gid_t HAVE_GID_T) +check_type_size(off_t HAVE_OFF_T) +check_type_size(pid_t HAVE_PID_T) +check_type_size(size_t HAVE_SIZE_T) +check_type_size(uid_t HAVE_UID_T) + +if (${HAVE_OFF_T} AND ${HAVE_OFF_T} EQUAL 8) + set(_FILE_OFFSET_BITS 64) +endif() + +test_big_endian(WORDS_BIGENDIAN) +check_symbol_exists(INFINITY math.h HAVE_INFINITY) +check_symbol_exists(va_copy stdarg.h HAVE_VA_COPY) + +set(CMAKE_EXTRA_INCLUDE_FILES Windows.h) +check_type_size("char[MAX_PATH]" MAXPATHLEN) +set(CMAKE_EXTRA_INCLUDE_FILES) + +set(TIMEZONE_TYPE "struct timezone") +if (APPLE OR MINGW) + set(TIMEZONE_TYPE "void") +endif() +check_prototype_definition( + gettimeofday + "int gettimeofday(struct timeval *tv, ${TIMEZONE_TYPE} *tz)" + 0 + "sys/time.h" + GETTIMEOFDAY_RETURNS_TIMEZONE +) + +check_prototype_definition( + getmntent + "int getmntent(FILE *file, struct mnttab *mptr)" + 0 + mntent.h + GETMNTENT_TAKES_TWO_ARGUMENTS +) + +check_struct_has_member("struct dirent" d_type dirent.h HAVE_STRUCT_DIRENT_D_TYPE) + +check_c_source_compiles("#include \nmain(){getpgrp();}" GETPGRP_VOID) +check_c_source_compiles("#include \nmain(){setpgrp();}" SETPGRP_VOID) + +check_c_source_compiles("__thread int a = 42;main(){a = a + 1;}" HAVE___THREAD) +check_c_source_compiles("#include \n#include \nmain(){}" TIME_WITH_SYS_TIME) + +set(CMAKE_REQUIRED_LIBRARIES pthread) +check_c_source_compiles("#include \nmain(){sem_t s;sem_init(&s,0,0);}" WORKING_SEM_INIT) +set(CMAKE_REQUIRED_LIBRARIES) + +if (EXISTS "/proc/self/exe") + set(HAVE__PROC_SELF_EXE 1) +endif() + +####################################### + +if (NOT CMAKE_CROSSCOMPILING) + check_type_alignment(long FB_ALIGNMENT) + check_type_alignment(double FB_DOUBLE_ALIGN) +else() # CMAKE_CROSSCOMPILING + set(FB_ALIGNMENT 8) + set(FB_DOUBLE_ALIGN 8) + if (ANDROID) + set(HAVE__PROC_SELF_EXE 1) + endif() +endif() + +####################################### + +if (WIN32) + set(ENABLE_BINRELOC 0) + set(SUPPORT_RAW_DEVICES 0) + set(WIN_NT 1) + set(CASE_SENSITIVITY "false") +endif(WIN32) + +if (APPLE) + set(ENABLE_BINRELOC 0) + set(CASE_SENSITIVITY "false") +endif() + +############################################################################### diff --git a/builds/cmake/SourceGroups.cmake b/builds/cmake/SourceGroups.cmake new file mode 100644 index 0000000000..b238c6e6a6 --- /dev/null +++ b/builds/cmake/SourceGroups.cmake @@ -0,0 +1,54 @@ +#include(SourceGroups) + +set(SSRC ${CMAKE_SOURCE_DIR}/src) +set(BSRC ${CMAKE_BINARY_DIR}/src) + +set(EPP_TXT "GPRE files") +set(GEN_TXT "GPRE cpp") + +set(_CPP ".*\\.cpp") +set(CPP "${_CPP}$") +set(_EPP ".*\\.(e|epp)") +set(EPP "${_EPP}$") +set(GEN "${_EPP}\\.(boot|master)\\.cpp$") + +source_group("${EPP_TXT}" "${EPP}") +source_group("${GEN_TXT}" "${GEN}") +source_group("Resource files" ".*\\.(rc|ico)") + +source_group("ALICE files" "${SSRC}/alice/${CPP}") +source_group("ALICE files\\${EPP_TXT}" "${SSRC}/alice/${EPP}") +source_group("ALICE files\\${GEN_TXT}" "${BSRC}/alice/${GEN}") +#source_group("AUTH files" "${SSRC}/auth/.*\\.(cpp|h)") +source_group("AUTH files" "${SSRC}/auth/${CPP}") +source_group("BURP files" "${SSRC}/burp/${CPP}") +source_group("BURP files\\${EPP_TXT}" "${SSRC}/burp/${EPP}") +source_group("BURP files\\${GEN_TXT}" "${BSRC}/burp/${GEN}") +source_group("common" "${SSRC}/common/${CPP}") +source_group("classes" "${SSRC}/common/classes/${CPP}") +source_group("config" "${SSRC}/common/config/${CPP}") +source_group("DSQL" "(${SSRC}|${BSRC})/dsql/.*\\.(cpp|y|ske)") +source_group("DSQL\\${EPP_TXT}" "${SSRC}/dsql/${EPP}") +source_group("DSQL\\${GEN_TXT}" "${BSRC}/dsql/${GEN}") +source_group("EXTLIB files" "${SSRC}/extlib/${CPP}") +source_group("Languages" "${SSRC}/gpre/languages/${CPP}") +#source_group("FBRMCLIB files" FILES ${SSRC}/gpre/languages/fbrmclib.cpp) gpre_boot, fbrmclib +source_group("GPRE files\\${EPP_TXT}" "${SSRC}/gpre/std/${EPP}") +source_group("GPRE files\\${GEN_TXT}" "${BSRC}/gpre/std/${GEN}") +source_group("INTL files" "${SSRC}/intl/${CPP}") +source_group("GUARD files" "${SSRC}/iscguard/${CPP}") +source_group("ISQL files" "${SSRC}/isql/${CPP}") +source_group("ISQL files\\${EPP_TXT}" "${SSRC}/isql/${EPP}") +source_group("ISQL files\\${GEN_TXT}" "${BSRC}/isql/${GEN}") +source_group("JRD files" "${SSRC}/jrd/${CPP}") +source_group("JRD files\\Data Access" "${SSRC}/jrd/recsrc/${CPP}") +source_group("JRD files\\EXTDS" "${SSRC}/jrd/extds/${CPP}") +source_group("JRD files\\${EPP_TXT}" "${SSRC}/jrd/${EPP}") +source_group("JRD files\\${GEN_TXT}" "${BSRC}/jrd/${GEN}") +source_group("JRD files\\Trace" "${SSRC}/jrd/trace/${CPP}") +source_group("Lock" "${SSRC}/lock/${CPP}") +source_group("REMOTE files" "${SSRC}/remote/${CPP}") +source_group("QLI files" "${SSRC}/qli/${CPP}") +source_group("QLI files\\${EPP_TXT}" "${SSRC}/qli/${EPP}") +source_group("QLI files\\${GEN_TXT}" "${BSRC}/qli/${GEN}") +source_group("UTILITIES files" "${SSRC}/utilities/${CPP}") diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt new file mode 100644 index 0000000000..1272be8e0d --- /dev/null +++ b/examples/CMakeLists.txt @@ -0,0 +1,99 @@ +include(SourceGroups) + +############################################################################### +# +# examples +# +############################################################################### + +######################################## +# EXECUTABLE empbuild +######################################## + +if (NOT CMAKE_CROSSCOMPILING) + +add_custom_command( + OUTPUT empbuild.fdb + DEPENDS + isql + ${CMAKE_CURRENT_SOURCE_DIR}/empbuild/empbld.sql + COMMAND ${CMAKE_COMMAND} -E remove empbuild.fdb + COMMAND isql -q -i ${CMAKE_CURRENT_SOURCE_DIR}/empbuild/empbld.sql +) +add_custom_command( + OUTPUT empbuild.c + DEPENDS + gpre + messages + ${CMAKE_CURRENT_SOURCE_DIR}/empbuild/empbuild.e + empbuild.fdb + COMMENT "Calling GPRE for empbuild.e" + COMMAND gpre -r -m -n -z ${CMAKE_CURRENT_SOURCE_DIR}/empbuild/empbuild.e empbuild.c +) + +add_executable (empbuild empbuild.c ${CMAKE_CURRENT_SOURCE_DIR}/empbuild/empbuild.e) +target_link_libraries (empbuild yvalve) +set_output_directory (empbuild empbuild FORCE) +add_dependencies (empbuild gfix engine12) +project_group (empbuild Examples) + +file(GLOB files + "${CMAKE_CURRENT_SOURCE_DIR}/empbuild/*.sql" + "${CMAKE_CURRENT_SOURCE_DIR}/empbuild/*.inp" +) +foreach(F ${files}) + get_filename_component(name ${F} NAME) + add_custom_command(TARGET empbuild POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${F} ${name}) +endforeach() + +set_unix (CMD PATH=${output_dir}/bin) +set_apple(CMD DYLD_LIBRARY_PATH=${output_dir}/plugins:${output_dir}/lib ${CMD}) + +if (WIN32) + add_custom_command(OUTPUT employe2.fdb DEPENDS empbuild ${files} + COMMAND ${CMAKE_COMMAND} -E remove employe2.fdb + COMMAND set PATH=%PATH%\;${output_dir} + COMMAND ${CMD} $ employe2.fdb + ) +else() + add_custom_command(OUTPUT employe2.fdb DEPENDS empbuild ${files} + COMMAND ${CMAKE_COMMAND} -E remove employe2.fdb + COMMAND ${CMD} $ employe2.fdb + ) +endif() +add_custom_target (employee_db DEPENDS employe2.fdb SOURCES ${files}) +project_group (employee_db Examples) + +endif() # if (NOT CMAKE_CROSSCOMPILING) + +######################################## +# SHARED LIBRARY udrcpp_example +######################################## + +add_library (udrcpp_example SHARED udr/UdrCppExample.cpp) +target_link_libraries (udrcpp_example udr_engine) +set_output_directory (udrcpp_example plugins/udr) +project_group (udrcpp_example Examples) + + +######################################## +# SHARED LIBRARY dbcrypt_example +######################################## + +add_library (dbcrypt_example SHARED dbcrypt/DbCrypt.cpp) +set_target_properties (dbcrypt_example PROPERTIES OUTPUT_NAME DbCrypt_example) +set_output_directory (dbcrypt_example plugins) +project_group (dbcrypt_example Examples) + + +######################################## +# SHARED LIBRARY cryptkeyholder_example +######################################## + +add_library (cryptkeyholder_example SHARED dbcrypt/CryptKeyHolder.cpp) +set_target_properties (cryptkeyholder_example PROPERTIES OUTPUT_NAME CryptKeyHolder_example) +set_output_directory (cryptkeyholder_example plugins) +project_group (cryptkeyholder_example Examples) + +############################################################################### diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt new file mode 100644 index 0000000000..45703b72fe --- /dev/null +++ b/src/CMakeLists.txt @@ -0,0 +1,989 @@ +# +# firebird (trunk) +# +# This file has following organization: +# 1. preprocess +# 2. custom build steps (file generators) +# 3. libraries +# 4. shared libraries +# 5. executables +# 6. subdirectories +# 7. copy other files to output dir (docs, includes, ...) +# + +include(SourceGroups) + +set_generated_directory() + +################################################################################ +# +# PREPROCESS +# +################################################################################ + +######################################## +# PREPROCESS epp boot and master files +######################################## + +set(epp_boot_internal_files + burp/backup.epp + burp/restore.epp + burp/OdsDetection.epp + utilities/gstat/dba.epp +) +set(epp_boot_ocxx_files + isql/extract.epp + isql/isql.epp + isql/show.epp +) +set(epp_boot_files + alice/alice_meta.epp + gpre/std/gpre_meta.epp + utilities/stats.epp + yvalve/array.epp + yvalve/blob.epp +) +set(epp_boot_gds_files + dsql/metd.epp + dsql/DdlNodes.epp + dsql/PackageNodes.epp + jrd/dfw.epp + jrd/dpm.epp + jrd/dyn_util.epp + jrd/fun.epp + jrd/grant.epp + jrd/ini.epp + jrd/met.epp + jrd/pcmet.epp + jrd/scl.epp + jrd/Function.epp +) +set(epp_master_files + auth/SecurityDatabase/LegacyManagement.epp + msgs/build_file.epp + misc/codes.epp + qli/help.epp + qli/meta.epp + qli/proc.epp + qli/show.epp +) + +if (NOT CMAKE_CROSSCOMPILING) + +epp_process(boot epp_boot_internal_files gpre_boot -lang_internal -n -m) +epp_process(boot epp_boot_ocxx_files gpre_boot -lang_internal -n -ids -ocxx) +epp_process(boot epp_boot_files gpre_boot -n -m) +epp_process(boot epp_boot_gds_files gpre_boot -n -ids -gds_cxx) + +epp_process(master epp_boot_internal_files boot_gpre -n -m) +epp_process(master epp_boot_ocxx_files boot_gpre -n -ids -ocxx) +epp_process(master epp_boot_files boot_gpre -n -m) +epp_process(master epp_boot_gds_files boot_gpre -n -ids -gds_cxx) +epp_process(master epp_master_files boot_gpre -n -m) + + +################################################################################ +# +# CUSTOM BUILD STEPS +# +################################################################################ + +######################################## +# BUILD STEP databases +######################################## + +set(databases_src + ${CMAKE_CURRENT_SOURCE_DIR}/dbs/security.sql + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/facilities2.sql + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/history2.sql + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/locales.sql + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/messages2.sql + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/sqlstates.sql + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/symbols2.sql + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/system_errors2.sql + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/transmsgs.de_DE2.sql + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/transmsgs.fr_FR2.sql +) +add_custom_command( + OUTPUT security.fdb + DEPENDS + boot_isql + ${CMAKE_CURRENT_SOURCE_DIR}/dbs/security.sql + VERBATIM + # + COMMAND ${CMAKE_COMMAND} -E remove security3.fdb + COMMAND ${CMAKE_COMMAND} -E echo "create database 'security3.fdb';" > create_db.sql + COMMAND boot_isql -q -i create_db.sql + COMMAND boot_isql -q security3.fdb -i ${CMAKE_CURRENT_SOURCE_DIR}/dbs/security.sql + COMMAND ${CMAKE_COMMAND} -E copy_if_different security3.fdb security.fdb +) +add_custom_command( + OUTPUT metadata.fdb + DEPENDS + boot_gbak + ${CMAKE_SOURCE_DIR}/builds/misc/metadata.gbak + # + COMMAND ${CMAKE_COMMAND} -E remove metadata.fdb + COMMAND boot_gbak -r ${CMAKE_SOURCE_DIR}/builds/misc/metadata.gbak metadata.fdb +) +set(isql_exec_msg boot_isql -q msg.fdb -i ${CMAKE_CURRENT_SOURCE_DIR}/msgs) +add_custom_command( + OUTPUT msg.fdb + VERBATIM + DEPENDS + boot_isql + metadata.fdb + security.fdb + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/facilities2.sql + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/history2.sql + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/locales.sql + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/messages2.sql + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/sqlstates.sql + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/symbols2.sql + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/system_errors2.sql + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/transmsgs.de_DE2.sql + ${CMAKE_CURRENT_SOURCE_DIR}/msgs/transmsgs.fr_FR2.sql + # + COMMAND ${CMAKE_COMMAND} -E remove msg.fdb + COMMAND ${CMAKE_COMMAND} -E echo "create database 'msg.fdb';" > create_db.sql + COMMAND boot_isql -q -i create_db.sql + COMMAND ${isql_exec_msg}/msg.sql + # + COMMAND echo loading facilities + COMMAND ${isql_exec_msg}/facilities2.sql + COMMAND echo loading sql states + COMMAND ${isql_exec_msg}/sqlstates.sql + COMMAND echo loading locales + COMMAND ${isql_exec_msg}/locales.sql + COMMAND echo loading history + COMMAND ${isql_exec_msg}/history2.sql + COMMAND echo loading messages + COMMAND ${isql_exec_msg}/messages2.sql + COMMAND echo loading symbols + COMMAND ${isql_exec_msg}/symbols2.sql + COMMAND echo loading system errors + COMMAND ${isql_exec_msg}/system_errors2.sql + COMMAND echo loading French translation + COMMAND ${isql_exec_msg}/transmsgs.fr_FR2.sql + COMMAND echo loading German translation + COMMAND ${isql_exec_msg}/transmsgs.de_DE2.sql +) +add_custom_command( + OUTPUT help.fdb + DEPENDS + boot_gbak + metadata.fdb + ${CMAKE_SOURCE_DIR}/builds/misc/help.gbak + # + COMMAND ${CMAKE_COMMAND} -E remove help.fdb + COMMAND boot_gbak -r ${CMAKE_SOURCE_DIR}/builds/misc/help.gbak help.fdb +) +add_custom_target(databases + DEPENDS + boot_engine12 + msg.fdb + help.fdb + SOURCES + ${databases_src} +) +project_group(databases "Custom build steps") + + +######################################## +# BUILD STEP messages +######################################## + +add_custom_command( + OUTPUT firebird.msg + DEPENDS build_msg codes + # + COMMAND ${CMAKE_COMMAND} -E remove firebird.msg + COMMAND build_msg -D msg.fdb -P ./ -F firebird.msg -L all + COMMAND build_msg -D msg.fdb -P ./ -F firebird.msg +) +add_custom_target(messages DEPENDS firebird.msg) +project_group(messages "Custom build steps") +add_custom_command( + TARGET messages + POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different firebird.msg ${output_dir}/firebird.msg +) + + +######################################## +# BUILD_STEP parse +######################################## + +set(parse_src + ${CMAKE_CURRENT_SOURCE_DIR}/dsql/parse.y + ${CMAKE_CURRENT_SOURCE_DIR}/dsql/btyacc_fb.ske +) +add_custom_command( + OUTPUT y_tab.h y_tab.c + DEPENDS + btyacc + ${parse_src} + COMMAND sed -n "/%type .*/p" ${CMAKE_CURRENT_SOURCE_DIR}/dsql/parse.y > types.y + COMMAND sed "s/%type .*//" ${CMAKE_CURRENT_SOURCE_DIR}/dsql/parse.y > y.y + COMMAND btyacc -l -d -S ${CMAKE_CURRENT_SOURCE_DIR}/dsql/btyacc_fb.ske y.y + COMMAND ${CMAKE_COMMAND} -E copy_if_different y_tab.h include/gen/parse.h + COMMAND ${CMAKE_COMMAND} -E copy_if_different y_tab.c dsql/parse.cpp + COMMENT "Generating parse.cpp, parse.h" + VERBATIM +) +add_custom_target(parse + DEPENDS y_tab.h y_tab.c + SOURCES ${parse_src} +) +project_group(parse "Custom build steps") +set_source_files_properties(dsql/parse.cpp include/gen/parse.h PROPERTIES GENERATED TRUE) + +endif() # if (NOT CMAKE_CROSSCOMPILING) + + +################################################################################ +# +# LIBRARIES +# +################################################################################ + +############################################################################### +# LIBRARY boot_alice +############################################################################### + +file(GLOB alice_src "alice/*.cpp" "alice/*.h") + +set(alice_generated_src + alice/alice_meta.epp +) +add_epp_suffix(alice_generated_src boot) +add_epp_suffix(alice_generated_src master) + +if (NOT CMAKE_CROSSCOMPILING) + +add_library (boot_alice ${alice_src} ${alice_generated_src_boot}) +project_group (boot_alice Boot) + +endif() # if (NOT CMAKE_CROSSCOMPILING) + + +############################################################################### +# LIBRARY alice +############################################################################### + +add_library (alice ${alice_src} ${alice_generated_src_master}) + + +############################################################################### +# LIBRARY boot_burp +############################################################################### + +file(GLOB burp_src "burp/*.cpp" "burp/*.h") + +set(burp_generated_src + burp/backup.epp + burp/OdsDetection.epp + burp/restore.epp +) +add_epp_suffix(burp_generated_src boot) +add_epp_suffix(burp_generated_src master) + +if (NOT CMAKE_CROSSCOMPILING) + +add_library (boot_burp ${burp_src} ${burp_generated_src_boot}) +project_group (boot_burp Boot) + +endif() # if (NOT CMAKE_CROSSCOMPILING) + + +############################################################################### +# LIBRARY burp +############################################################################### + +add_library (burp ${burp_src} ${burp_generated_src_master}) + + +############################################################################### +# LIBRARY common +############################################################################### + +file(GLOB common_src "common/*.cpp" "common/classes/*.cpp" "common/config/*.cpp" "common/os/${OS_DIR}/*.cpp") +file(GLOB_RECURSE common_include "common/*.h") + +if (APPLE) + file(GLOB common_os_src "common/os/posix/*.cpp") + list(REMOVE_ITEM common_os_src ${CMAKE_CURRENT_BINARY_DIR}/common/os/posix/mod_loader.cpp) +endif() + +add_library(common ${common_src} ${common_os_src} ${common_include}) + + +################################################################################ +# +# SHARED LIBRARIES +# +################################################################################ + +######################################## +# SHARED LIBRARY boot_yvalve +######################################## + +file(GLOB yvalve_src "yvalve/*.cpp" "yvalve/config/os/${OS_DIR}/*.c*") +file(GLOB_RECURSE yvalve_include "yvalve/*.h") + +set(yvalve_src ${yvalve_src} + auth/SecureRemotePassword/client/SrpClient.cpp + auth/SecurityDatabase/LegacyClient.cpp + plugins/crypt/arc4/Arc4.cpp + remote/client/BlrFromMessage.cpp + remote/client/interface.cpp +) +add_src_win32(yvalve_src + jrd/os/win32/ibinitdll.cpp +) +set(yvalve_generated_src + yvalve/array.epp + yvalve/blob.epp +) +add_epp_suffix(yvalve_generated_src boot) +add_epp_suffix(yvalve_generated_src master) + +add_library (yvalve_common OBJECT ${yvalve_src} ${yvalve_include}) +add_dependencies_cc (yvalve_common parse) + +if (NOT CMAKE_CROSSCOMPILING) + +add_library (boot_yvalve SHARED $ ${yvalve_generated_src_boot} ${VERSION_RC}) +target_link_libraries (boot_yvalve remote common libtommath ${LIB_Ws2_32} ${LIB_mpr} ${LIB_readline} ${LIB_dl} ${LIB_iconv} ${LIB_CoreFoundation}) +set_exported_symbols (boot_yvalve firebird) +set_output_directory_unix (boot_yvalve lib) +project_group (boot_yvalve Boot) + +endif() # if (NOT CMAKE_CROSSCOMPILING) + + +######################################## +# SHARED LIBRARY yvalve +######################################## + +add_library (yvalve SHARED $ ${yvalve_generated_src_master} ${VERSION_RC}) +target_link_libraries (yvalve remote common libtommath ${LIB_Ws2_32} ${LIB_mpr} ${LIB_readline} ${LIB_dl} ${LIB_iconv} ${LIB_CoreFoundation}) +set_exported_symbols (yvalve firebird) +set_output_directory_unix (yvalve lib) +set_target_properties (yvalve PROPERTIES OUTPUT_NAME fbclient) + + +######################################## +# SHARED LIBRARY boot_engine12 +######################################## + +file(GLOB engine12_src + "dsql/*.cpp" + "jrd/*.cpp" + "jrd/extds/*.cpp" + "jrd/recsrc/*.cpp" + "jrd/trace/*.cpp" + "jrd/os/${OS_DIR}/*.cpp" +) +set(engine12_src ${engine12_src} + lock/lock.cpp + utilities/gsec/gsec.cpp + utilities/gstat/ppg.cpp + utilities/nbackup/nbackup.cpp + # parse + ${GENERATED_DIR}/dsql/parse.cpp +) +add_src_apple(engine12_src + jrd/os/posix/unix.cpp +) +set(engine12_generated_src + dsql/DdlNodes.epp + dsql/metd.epp + dsql/PackageNodes.epp + jrd/dfw.epp + jrd/dpm.epp + jrd/dyn_util.epp + jrd/fun.epp + jrd/Function.epp + jrd/grant.epp + jrd/ini.epp + jrd/met.epp + jrd/pcmet.epp + jrd/scl.epp + utilities/gstat/dba.epp +) +add_epp_suffix(engine12_generated_src boot) +add_epp_suffix(engine12_generated_src master) + +file(GLOB_RECURSE engine12_include "dsql/*.h" "jrd/*.h" include/gen/iberror.h) + +add_library (engine12_common ${engine12_src} ${engine12_include}) +add_dependencies_cc (engine12_common parse) + +if (NOT CMAKE_CROSSCOMPILING) + +add_library (boot_engine12 SHARED ${engine12_generated_src_boot} ${parse_src} ${VERSION_RC}) +target_link_libraries (boot_engine12 engine12_common boot_alice boot_burp common boot_yvalve) +set_output_directory (boot_engine12 plugins) +set_exported_symbols (boot_engine12 fbplugin) +copy_and_rename_lib (boot_engine12 Engine12) +project_group (boot_engine12 Boot) + +endif() # if (NOT CMAKE_CROSSCOMPILING) + + +######################################## +# SHARED LIBRARY engine12 +######################################## + +add_library (engine12 SHARED ${engine12_generated_src_master} ${parse_src} ${VERSION_RC}) +target_link_libraries (engine12 engine12_common alice burp common yvalve) +add_dependencies_cc (engine12 messages) # possible build during build_msg or codes run +set_target_properties (engine12 PROPERTIES OUTPUT_NAME Engine12) +set_output_directory (engine12 plugins) +set_exported_symbols (engine12 fbplugin) + + +############################################################################### +# SHARED LIBRARY intl +############################################################################### + +file(GLOB intl_src "intl/*.cpp" "intl/*.h") + +add_library (intl SHARED ${intl_src} ${VERSION_RC}) +target_link_libraries (intl common yvalve) +set_target_properties (intl PROPERTIES OUTPUT_NAME fbintl) +set_output_directory (intl intl) + + +######################################## +# SHARED LIBRARY ib_util +######################################## + +add_library (ib_util SHARED extlib/ib_util.cpp extlib/ib_util.h ${VERSION_RC}) +set_exported_symbols (ib_util ib_util) +set_output_directory_unix (ib_util lib) + + +######################################## +# SHARED LIBRARY ib_udf +######################################## + +add_library (ib_udf SHARED extlib/ib_udf.cpp extlib/ib_udf.h ${VERSION_RC}) +target_link_libraries (ib_udf ib_util) +set_target_properties (ib_udf PROPERTIES PREFIX "") +set_exported_symbols (ib_udf ib_udf) +set_output_directory (ib_udf UDF) + + +######################################## +# SHARED LIBRARY legacy_usermanager +######################################## + +set(legacy_usermanager_generated_src + auth/SecurityDatabase/LegacyManagement.epp +) +add_epp_suffix(legacy_usermanager_generated_src master) + +add_library (legacy_usermanager SHARED ${legacy_usermanager_generated_src_master} auth/SecurityDatabase/LegacyManagement.h ${VERSION_RC}) +target_link_libraries (legacy_usermanager common yvalve) +set_target_properties (legacy_usermanager PROPERTIES OUTPUT_NAME Legacy_UserManager) +set_output_directory (legacy_usermanager plugins) +set_exported_symbols (legacy_usermanager fbplugin) + + +######################################## +# SHARED LIBRARY udr_engine +######################################## + +set(udr_engine_src + plugins/udr_engine/UdrEngine.cpp +) +add_library (udr_engine SHARED ${udr_engine_src} ${VERSION_RC}) +target_link_libraries (udr_engine common yvalve) +set_output_directory (udr_engine plugins) +set_exported_symbols (udr_engine udr_engine) + + +######################################## +# SHARED LIBRARY fbudf +######################################## + +set(fbudf_src + extlib/fbudf/fbudf.cpp + extlib/fbudf/stdafx.cpp + + extlib/fbudf/fbudf.txt + extlib/fbudf/fbudf.sql + + jrd/ibase.h +) +file(GLOB fbudf_include "extlib/fbudf/*.h") + +add_library (fbudf SHARED ${fbudf_src} ${fbudf_include} ${VERSION_RC}) +target_link_libraries (fbudf common yvalve) +set_target_properties (fbudf PROPERTIES PREFIX "") +set_output_directory (fbudf UDF) + + +######################################## +# SHARED LIBRARY srp +######################################## + +add_library (srp SHARED auth/SecureRemotePassword/manage/SrpManagement.cpp ${VERSION_RC}) +target_link_libraries (srp common yvalve) +set_target_properties (srp PROPERTIES OUTPUT_NAME Srp) +set_output_directory (srp plugins) +set_exported_symbols (srp fbplugin) + + +######################################## +# SHARED LIBRARY legacy_auth +######################################## + +add_library (legacy_auth SHARED auth/SecurityDatabase/LegacyServer.cpp ${VERSION_RC}) +target_link_libraries (legacy_auth common yvalve) +set_target_properties (legacy_auth PROPERTIES OUTPUT_NAME Legacy_Auth) +set_output_directory (legacy_auth plugins) +set_exported_symbols (legacy_auth fbplugin) + + +################################################################################ +# +# EXECUTABLES +# +################################################################################ + +######################################## +# EXECUTABLE gpre_boot +######################################## + +set(gpre_boot_src + gpre/boot/gpre_meta_boot.cpp + yvalve/gds.cpp +) + +if (NOT CMAKE_CROSSCOMPILING) + +add_executable (gpre_boot ${gpre_boot_src} ${VERSION_RC}) +target_link_libraries (gpre_boot gpre_common common ${LIB_Ws2_32}) + +endif() # if (NOT CMAKE_CROSSCOMPILING) + + +######################################## +# EXECUTABLE boot_gpre +######################################## + +set(gpre_generated_src + gpre/std/gpre_meta.epp +) +add_epp_suffix(gpre_generated_src boot) +add_epp_suffix(gpre_generated_src master) + +if (NOT CMAKE_CROSSCOMPILING) + +add_executable (boot_gpre ${gpre_generated_src_boot} ${VERSION_RC}) +target_link_libraries (boot_gpre gpre_common common boot_yvalve) +project_group (boot_gpre Boot) + +endif() # if (NOT CMAKE_CROSSCOMPILING) + + +######################################## +# EXECUTABLE gpre +######################################## + +add_executable (gpre ${gpre_generated_src_master} ${VERSION_RC}) +target_link_libraries (gpre gpre_common common yvalve) + + +######################################## +# EXECUTABLE build_msg +######################################## + +set(build_msg_generated_src + msgs/build_file.epp +) +add_epp_suffix(build_msg_generated_src master) + +if (NOT CMAKE_CROSSCOMPILING) + +add_executable (build_msg ${build_msg_generated_src_master} ${VERSION_RC}) +target_link_libraries (build_msg common yvalve) + +endif() # if (NOT CMAKE_CROSSCOMPILING) + + +######################################## +# EXECUTABLE codes +######################################## + +set(codes_generated_src + misc/codes.epp +) +add_epp_suffix(codes_generated_src master) + +if (NOT CMAKE_CROSSCOMPILING) + +add_executable (codes ${codes_generated_src_master} ${VERSION_RC}) +target_link_libraries (codes yvalve) +add_custom_command( + TARGET codes + POST_BUILD + COMMAND codes ${CMAKE_CURRENT_SOURCE_DIR}/include/gen ${CMAKE_SOURCE_DIR}/lang_helpers +) + +endif() # if (NOT CMAKE_CROSSCOMPILING) + + +######################################## +# EXECUTABLE gstat +######################################## + +set(gstat_src + jrd/btn.cpp + jrd/ods.cpp + utilities/gstat/main/gstatMain.cpp + utilities/gstat/ppg.cpp +) +set(gstat_generated_src + utilities/gstat/dba.epp +) +add_epp_suffix(gstat_generated_src master) + +add_executable (gstat ${gstat_src} ${gstat_generated_src_master} ${VERSION_RC}) +target_link_libraries (gstat common yvalve) + + +######################################## +# EXECUTABLE fb_lock_print +######################################## + +add_executable (fb_lock_print lock/print.cpp ${VERSION_RC}) +target_link_libraries (fb_lock_print common yvalve) + + +######################################## +# EXECUTABLE fbguard +######################################## + +add_src_win32(fbguard_src + iscguard/cntl_guard.cpp + iscguard/iscguard.cpp + remote/server/os/win32/chop.cpp + + iscguard/iscguard.rc +) +add_src_unix(fbguard_src + utilities/guard/guard.cpp + utilities/guard/util.cpp +) + +add_executable (fbguard WIN32 ${fbguard_src}) +target_link_libraries (fbguard common yvalve ${LIB_comctl32} ${LIB_version}) + + +######################################## +# EXECUTABLE fbtracemgr +######################################## + +set(fbtracemgr_src + jrd/trace/TraceCmdLine.cpp + utilities/fbtracemgr/traceMgrMain.cpp +) + +add_executable (fbtracemgr ${fbtracemgr_src} ${VERSION_RC}) +target_link_libraries (fbtracemgr common yvalve) + + +############################################################################### +# EXECUTABLE gfix +############################################################################### + +add_executable (gfix alice/main/aliceMain.cpp ${VERSION_RC}) +target_link_libraries (gfix alice common yvalve) + + +############################################################################### +# EXECUTABLE boot_gbak +############################################################################### + +file(GLOB gbak_include "burp/*.h") + +if (NOT CMAKE_CROSSCOMPILING) + +add_executable (boot_gbak burp/main/burpMain.cpp ${gbak_include} ${VERSION_RC}) +target_link_libraries (boot_gbak boot_burp common boot_yvalve) +project_group (boot_gbak Boot) + +endif() # if (NOT CMAKE_CROSSCOMPILING) + + +############################################################################### +# EXECUTABLE gbak +############################################################################### + +add_executable (gbak burp/main/burpMain.cpp ${gbak_include} ${VERSION_RC}) +target_link_libraries (gbak burp yvalve common) + + +############################################################################### +# EXECUTABLE gsplit +############################################################################### + +add_executable (gsplit burp/split/spit.cpp burp/split/spit.h ${VERSION_RC}) +target_link_libraries (gsplit burp common yvalve) + + +############################################################################### +# EXECUTABLE boot_isql +############################################################################### + +file(GLOB isql_src "isql/*.cpp" "isql/*.h") + +set(isql_generated_src + isql/extract.epp + isql/isql.epp + isql/show.epp +) +add_epp_suffix(isql_generated_src boot) +add_epp_suffix(isql_generated_src master) + +if (NOT CMAKE_CROSSCOMPILING) + +add_executable (boot_isql ${isql_src} ${isql_generated_src_boot} ${VERSION_RC}) +target_link_libraries (boot_isql common boot_yvalve) +project_group (boot_isql Boot) + +endif() # if (NOT CMAKE_CROSSCOMPILING) + +if (WIN32) + add_custom_command( + TARGET boot_isql + POST_BUILD + # remove + COMMAND ${CMAKE_COMMAND} -E remove ${output_dir}/icudt52l.dat ${output_dir}/icudt52l_empty.dat + # + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/extern/icu/icudt52l.dat ${output_dir}/icudt52l.dat + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/extern/icu/icudt52l_empty.dat ${output_dir}/icudt52l_empty.dat + ) + + string(FIND ${CMAKE_EXE_LINKER_FLAGS} "/machine:x64" arch) + if (NOT ${arch} EQUAL -1) + set(arch "x64") + else() + set(arch "Win32") + endif() + add_custom_command( + TARGET boot_isql + POST_BUILD + # icu + # remove + COMMAND ${CMAKE_COMMAND} -E remove ${output_dir}/icudt52.dll ${output_dir}/icuin52.dll ${output_dir}/icuuc52.dll + # + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/extern/icu/${arch}/Release/bin/icudt52.dll ${output_dir}/icudt52.dll + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/extern/icu/${arch}/Release/bin/icuin52.dll ${output_dir}/icuin52.dll + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/extern/icu/${arch}/Release/bin/icuuc52.dll ${output_dir}/icuuc52.dll + # zlib + COMMAND ${CMAKE_COMMAND} -E remove ${output_dir}/zlib1.dll + COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/extern/zlib/${arch}/zlib1.dll ${output_dir}/zlib1.dll + ) +endif() + + +############################################################################### +# EXECUTABLE isql +############################################################################### + +add_executable (isql ${isql_src} ${isql_generated_src_master} ${VERSION_RC}) +target_link_libraries (isql common yvalve) + + +############################################################################### +# EXECUTABLE qli +############################################################################### + +file(GLOB qli_src "qli/*.cpp" "qli/*.h") +set(qli_generated_src + qli/help.epp + qli/meta.epp + qli/proc.epp + qli/show.epp +) +add_epp_suffix(qli_generated_src master) + +add_executable (qli ${qli_src} ${qli_generated_src_master} ${VERSION_RC}) +target_link_libraries (qli common yvalve) + + +################################################################################ +# +# subdirectories +# +################################################################################ + +add_subdirectory("gpre") +add_subdirectory("remote") +add_subdirectory("utilities") + +############################################################################### +# +# copy files to output dir +# +############################################################################### + +add_custom_target(copy_files + #ALL # uncomment this to copy files every build + # databases + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GENERATED_DIR}/security3.fdb ${output_dir}/security3.fdb + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GENERATED_DIR}/help.fdb ${output_dir}/help/help.fdb + # configs, text files + COMMAND sed "/@UDF_COMMENT@/d" < ${CMAKE_SOURCE_DIR}/builds/install/misc/firebird.conf.in > ${output_dir}/firebird.conf + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/builds/install/misc/databases.conf.in ${output_dir}/databases.conf + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/builds/install/misc/fbintl.conf ${output_dir}/intl/fbintl.conf + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/builds/install/misc/plugins.conf ${output_dir}/plugins.conf + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/builds/install/misc/IPLicense.txt ${output_dir}/IPLicense.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/builds/install/misc/IDPLicense.txt ${output_dir}/IDPLicense.txt + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/src/utilities/ntrace/fbtrace.conf ${output_dir}/fbtrace.conf + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/src/plugins/udr_engine/udr_engine.conf ${output_dir}/plugins/udr_engine.conf + # udf + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/src/extlib/ib_udf.sql ${output_dir}/UDF/ib_udf.sql + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/src/extlib/ib_udf2.sql ${output_dir}/UDF/ib_udf2.sql + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/src/extlib/fbudf/fbudf.sql ${output_dir}/UDF/fbudf.sql + # docs + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/ChangeLog ${output_dir}/doc/ChangeLog + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/doc/WhatsNew ${output_dir}/doc/WhatsNew + # examples + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples/api ${output_dir}/examples/api + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples/dbcrypt ${output_dir}/examples/dbcrypt + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/examples/empbuild/employe2.sql ${output_dir}/examples/empbuild/employe2.sql + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${NATIVE_BUILD_DIR}/examples/employe2.fdb ${output_dir}/examples/empbuild/employee.fdb + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples/include ${output_dir}/examples/include + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples/interfaces ${output_dir}/examples/interfaces + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples/package ${output_dir}/examples/package + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples/stat ${output_dir}/examples/stat + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples/udf ${output_dir}/examples/udf + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples/udr ${output_dir}/examples/udr + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples/stat ${output_dir}/examples/stat + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/examples/functions.c ${output_dir}/examples/functions.c + # headers + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/src/extlib/ib_util.h ${output_dir}/include/ib_util.h + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/src/include/gen/iberror.h ${output_dir}/include/iberror.h + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/src/yvalve/perf.h ${output_dir}/include/perf.h +) +add_dependencies_cc (copy_files databases employee_db) +add_dependencies_unix_cc(copy_files makeHeader) +project_group(copy_files "Custom build steps") + +# headers +file(GLOB files "${CMAKE_SOURCE_DIR}/src/include/firebird/*.h") +foreach(F ${files}) + get_filename_component(name ${F} NAME) + add_custom_command(TARGET copy_files POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${F} ${output_dir}/include/firebird/${name}) +endforeach() + +# docs +file(GLOB files "${CMAKE_SOURCE_DIR}/doc/README.*") +foreach(F ${files}) + get_filename_component(name ${F} NAME) + add_custom_command(TARGET copy_files POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${F} ${output_dir}/doc/${name}) +endforeach() + +file(GLOB files "${CMAKE_SOURCE_DIR}/doc/sql.extensions/README.*") +foreach(F ${files}) + get_filename_component(name ${F} NAME) + add_custom_command(TARGET copy_files POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${F} ${output_dir}/doc/sql.extensions/${name}) +endforeach() + +if (WIN32) + add_custom_command( + TARGET copy_files + POST_BUILD + # lib + COMMAND ${CMAKE_COMMAND} -E copy_if_different $/fbclient.lib ${output_dir}/lib/fbclient_ms.lib + COMMAND ${CMAKE_COMMAND} -E copy_if_different $/ib_util.lib ${output_dir}/lib/ib_util_ms.lib + # installers + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/builds/install/arch-specific/win32/install_classic.bat ${output_dir}/install_classic.bat + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/builds/install/arch-specific/win32/install_super.bat ${output_dir}/install_super.bat + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/builds/install/arch-specific/win32/uninstall.bat ${output_dir}/uninstall.bat + # examples + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples/build_unix ${output_dir}/examples/build_unix + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/examples/build_win32 ${output_dir}/examples/build_win32 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/examples/readme ${output_dir}/examples/readme.txt + # headers + COMMAND echo "#pragma message(\"Non-production version of ibase.h.\")" > ${output_dir}/include/ibase.tmp + COMMAND echo "#pragma message(\"Using raw, unprocessed concatenation of header files.\")" >> ${output_dir}/include/ibase.tmp + ) + set(files + ${CMAKE_SOURCE_DIR}/src/misc/ibase_header.txt + ${CMAKE_SOURCE_DIR}/src/include/types_pub.h + ${CMAKE_SOURCE_DIR}/src/common/dsc_pub.h + ${CMAKE_SOURCE_DIR}/src/dsql/sqlda_pub.h + ${CMAKE_SOURCE_DIR}/src/jrd/ibase.h + ${CMAKE_SOURCE_DIR}/src/jrd/inf_pub.h + ${CMAKE_SOURCE_DIR}/src/include/consts_pub.h + ${CMAKE_SOURCE_DIR}/src/jrd/blr.h + ${CMAKE_SOURCE_DIR}/src/include/gen/iberror.h + ) + foreach(F ${files}) + string(REPLACE "/" "\\" f ${F}) + add_custom_command(TARGET copy_files POST_BUILD + COMMAND type ${f} >> ${output_dir}/include/ibase.tmp) + endforeach() + add_custom_command( + TARGET copy_files + POST_BUILD + COMMAND sed -f ${CMAKE_SOURCE_DIR}/src/misc/headers.sed < ${output_dir}/include/ibase.tmp > ${output_dir}/include/ibase.h + COMMAND ${CMAKE_COMMAND} -E remove ${output_dir}/include/ibase.tmp + ) + file(GLOB files + "${CMAKE_SOURCE_DIR}/src/extlib/ib_udf*" + "${CMAKE_SOURCE_DIR}/src/extlib/fbudf/*" + ) + foreach(F ${files}) + get_filename_component(name ${F} NAME) + add_custom_command(TARGET copy_files POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${F} ${output_dir}/examples/udf/${name}) + endforeach() +endif() + + +if (UNIX) + add_custom_command(TARGET copy_files POST_BUILD + # examples + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/examples/readme ${output_dir}/examples/README + ) + + if (NOT CMAKE_CROSSCOMPILING) + + add_executable (makeHeader misc/makeHeader.cpp) + set_output_directory (makeHeader . FORCE) + set(files + ${CMAKE_SOURCE_DIR}/src/include/types_pub.h + ${CMAKE_SOURCE_DIR}/src/include/consts_pub.h + ${CMAKE_SOURCE_DIR}/src/dsql/sqlda_pub.h + ${CMAKE_SOURCE_DIR}/src/common/dsc_pub.h + ${CMAKE_SOURCE_DIR}/src/jrd/ibase.h + ${CMAKE_SOURCE_DIR}/src/jrd/inf_pub.h + ${CMAKE_SOURCE_DIR}/src/jrd/blr.h + ${CMAKE_SOURCE_DIR}/src/include/gen/iberror.h + ) + foreach(F ${files}) + get_filename_component(name ${F} NAME) + add_custom_command(TARGET copy_files POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${F} ${name}) + endforeach() + add_custom_command(TARGET copy_files POST_BUILD + # include + COMMAND makeHeader < ibase.h > ${output_dir}/include/ibase.h + ) + + endif() # if (NOT CMAKE_CROSSCOMPILING) +endif() + + +################################################################################ diff --git a/src/gpre/CMakeLists.txt b/src/gpre/CMakeLists.txt new file mode 100644 index 0000000000..39c2c2a58f --- /dev/null +++ b/src/gpre/CMakeLists.txt @@ -0,0 +1,30 @@ +include(SourceGroups) + +############################################################################### +# LIBRARY gpre_common +############################################################################### + +add_definitions( + -DGPRE_ADA + -DGPRE_COBOL + -DGPRE_FORTRAN + -DGPRE_PASCAL +) + +file(GLOB gpre_common_src "*.cpp" "languages/???.cpp" "*.h") +add_src_win32(gpre_common_src + languages/fbrmclib.cpp +) + +add_library (gpre_common ${gpre_common_src}) + + +############################################################################### +# SHARED LIBRARY fbrmclib +############################################################################### + +if (WIN32) + add_library (fbrmclib SHARED languages/fbrmclib.cpp ${VERSION_RC}) + target_link_libraries (fbrmclib common yvalve) + set_exported_symbols (fbrmclib fbrmclib) +endif(WIN32) diff --git a/src/include/gen/autoconfig.h.in b/src/include/gen/autoconfig.h.in new file mode 100644 index 0000000000..5b0f167143 --- /dev/null +++ b/src/include/gen/autoconfig.h.in @@ -0,0 +1,794 @@ +/****************************************************************************** + * + * autoconfig.h + * Autogenerated file. + * + ******************************************************************************/ + +/****************************************************************************** + * + * CPU + * + ******************************************************************************/ + +/* Define this if CPU is Alpha */ +#cmakedefine ALPHA 1 + +/* Define this if CPU is amd64 */ +#cmakedefine AMD64 1 + +/* Define this if CPU is arm */ +#cmakedefine ARM 1 + +/* Define this if CPU is arm64 */ +#cmakedefine ARM64 1 + +/* Define this if CPU is HPPA */ +#cmakedefine HPPA 1 + +/* Define this if CPU is i386 */ +#cmakedefine I386 1 + +/* Architecture is little-endian sh4 */ +#cmakedefine SH 1 + +/* Architecture is big-edian sh4 */ +#cmakedefine SHEB 1 + + +/****************************************************************************** + * + * OS + * + ******************************************************************************/ + +/* Define this if OS is AIX */ +#cmakedefine AIX 1 + +/* Define this if OS is DARWIN */ +#cmakedefine DARWIN 1 + +/* Define this if OS is FreeBSD */ +#cmakedefine FREEBSD 1 + +/* Define this if OS is HP-UX */ +#cmakedefine HPUX 1 + +/* Define this if OS is Linux */ +#cmakedefine LINUX 1 + +/* Define this if toolchain is MINGW */ +#cmakedefine MINGW 1 + +/* Define this if OS is NetBSD */ +#cmakedefine NETBSD 1 + +/* Define this if OS is Solaris Sparc */ +#cmakedefine SOLARIS 1 + +/* Define this if OS is Solarix x86 */ +#cmakedefine solx86 1 + +/* Define this if OS is Windows NT */ +#cmakedefine WIN_NT 1 + + +/****************************************************************************** + * + * names + * + ******************************************************************************/ + +/* Define this if paths are case sensitive */ +#define CASE_SENSITIVITY @CASE_SENSITIVITY@ + +/* Local IPC name */ +#define FB_IPC_NAME "@FB_IPC_NAME@" + +/* log file name within log dir */ +#define FB_LOGFILENAME "@FB_LOGFILENAME@" + +/* Wnet pipe name */ +#define FB_PIPE_NAME "@FB_PIPE_NAME@" + +/* Installation path prefix */ +#define FB_PREFIX "@FB_PREFIX@" + +/* Inet service name */ +#define FB_SERVICE_NAME "@FB_SERVICE_NAME@" + +/* Inet service port */ +#define FB_SERVICE_PORT @FB_SERVICE_PORT@ + + +/****************************************************************************** + * + * DIR + * + ******************************************************************************/ + +/* executables DIR (PREFIX/bin) */ +#define FB_BINDIR "@FB_BINDIR@" + +/* config files DIR (PREFIX) */ +#define FB_CONFDIR "@FB_CONFDIR@" + +/* documentation root DIR (PREFIX/doc) */ +#define FB_DOCDIR "@FB_DOCDIR@" + +/* guardian lock DIR (PREFIX) */ +#define FB_GUARDDIR "@FB_GUARDDIR@" + +/* QLI help DIR (PREFIX/help) */ +#define FB_HELPDIR "@FB_HELPDIR@" + +/* C/C++ header files DIR (PREFIX/include) */ +#define FB_INCDIR "@FB_INCDIR@" + +/* international DIR (PREFIX/intl) */ +#define FB_INTLDIR "@FB_INTLDIR@" + +/* object code libraries DIR (PREFIX/lib) */ +#define FB_LIBDIR "@FB_LIBDIR@" + +/* log files DIR (PREFIX) */ +#define FB_LOGDIR "@FB_LOGDIR@" + +/* misc DIR (PREFIX/misc) */ +#define FB_MISCDIR "@FB_MISCDIR@" + +/* message files DIR (PREFIX) */ +#define FB_MSGDIR "@FB_MSGDIR@" + +/* plugins DIR (PREFIX) */ +#define FB_PLUGDIR "@FB_PLUGDIR@" + +/* examples database DIR (PREFIX/examples/empbuild) */ +#define FB_SAMPLEDBDIR "@FB_SAMPLEDBDIR@" + +/* examples DIR (PREFIX/examples) */ +#define FB_SAMPLEDIR "@FB_SAMPLEDIR@" + +/* system admin executables DIR (PREFIX/bin) */ +#define FB_SBINDIR "@FB_SBINDIR@" + +/* security database DIR (PREFIX) */ +#define FB_SECDBDIR "@FB_SECDBDIR@" + +/* UDF DIR (PREFIX/UDF) */ +#define FB_UDFDIR "@FB_UDFDIR@" + + +/****************************************************************************** + * + * Headers + * + ******************************************************************************/ + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_AIO_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ASSERT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ATOMIC_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ATOMIC_OPS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_CRYPT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_CTYPE_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DIRENT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_DLFCN_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_EDITLINE_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ERRNO_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_FCNTL_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_FLOAT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_GRP_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ICONV_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_IO_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_INTTYPES_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LANGINFO_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LIBIO_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LINUX_FALLOC_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LIMITS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_LOCALE_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MATH_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MEMORY_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MNTENT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_MNTTAB_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NDIR_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETCONFIG_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_NETINET_IN_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_POLL_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_PTHREAD_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_PWD_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_RPC_RPC_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_RPC_XDR_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SEMAPHORE_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SETJMP_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SIGNAL_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDARG_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDINT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STDLIB_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRING_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_STRINGS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_DIR_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_FILE_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_IOCTL_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_IPC_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_MNTENT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_MNTTAB_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_MOUNT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_NDIR_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_PARAM_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_RESOURCE_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SEM_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SELECT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SIGINFO_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SIGNAL_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SOCKET_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SOCKIO_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_STAT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_SYSCALL_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TIME_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TIMEB_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_TYPES_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_UIO_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_SYS_WAIT_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_TERMIO_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_TERMIOS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_UNISTD_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_VARARGS_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_VFORK_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_WINSOCK2_H 1 + +/* Define to 1 if you have the header file. */ +#cmakedefine HAVE_ZLIB_H 1 + + +/****************************************************************************** + * + * Functions + * + ******************************************************************************/ + +/* Define to 1 if you have the `AO_compare_and_swap_full' function. */ +#cmakedefine HAVE_AO_COMPARE_AND_SWAP_FULL 1 + +/* Define to 1 if you have the `clock_gettime' function. */ +#cmakedefine HAVE_CLOCK_GETTIME 1 + +/* Define to 1 if you have the `dirname' function. */ +#cmakedefine HAVE_DIRNAME 1 + +/* Define to 1 if you have the `dladdr' function. */ +#cmakedefine HAVE_DLADDR 1 + +/* Define to 1 if you have the `fallocate' function. */ +#cmakedefine HAVE_FALLOCATE 1 + +/* Define to 1 if you have the `fchmod' function. */ +#cmakedefine HAVE_FCHMOD 1 + +/* Define to 1 if you have the `fdatasync' function. */ +#cmakedefine HAVE_FDATASYNC 1 + +/* Define to 1 if you have the `fsync' function. */ +#cmakedefine HAVE_FSYNC 1 + +/* Define to 1 if you have the `fegetenv' function. */ +#cmakedefine HAVE_FEGETENV 1 + +/* Define to 1 if you have the `flock' function. */ +#cmakedefine HAVE_FLOCK 1 + +/* Define to 1 if you have the `fork' function. */ +#cmakedefine HAVE_FORK 1 + +/* Define to 1 if you have the `getpagesize' function. */ +#cmakedefine HAVE_GETPAGESIZE 1 + +/* Define to 1 if you have the `getcwd' function. */ +#cmakedefine HAVE_GETCWD 1 + +/* Define to 1 if you have the `getwd' function. */ +#cmakedefine HAVE_GETWD 1 + +/* Define to 1 if you have the `gettimeofday' function. */ +#cmakedefine HAVE_GETTIMEOFDAY 1 + +/* Define to 1 if you have the `gmtime_r' function. */ +#cmakedefine HAVE_GMTIME_R 1 + +/* Define to 1 if you have the `initgroups' function. */ +#cmakedefine HAVE_INITGROUPS 1 + +/* Define to 1 if you have the `llrint' function. */ +#cmakedefine HAVE_LLRINT 1 + +/* Define to 1 if you have the `localtime_r' function. */ +#cmakedefine HAVE_LOCALTIME_R 1 + +/* Define to 1 if you have the `mkstemp' function. */ +#cmakedefine HAVE_MKSTEMP 1 + +/* Define to 1 if you have the `mmap' function. */ +#cmakedefine HAVE_MMAP 1 + +/* Define to 1 if you have the `nanosleep' function. */ +#cmakedefine HAVE_NANOSLEEP 1 + +/* Define to 1 if you have the `poll' function. */ +#cmakedefine HAVE_POLL 1 + +/* Define to 1 if you have the `posix_fadvise' function. */ +#cmakedefine HAVE_POSIX_FADVISE 1 + +/* Define to 1 if you have the `pread' function. */ +#cmakedefine HAVE_PREAD 1 + +/* Define to 1 if you have the `pwrite' function. */ +#cmakedefine HAVE_PWRITE 1 + +/* Define to 1 if you have the `pthread_cancel' function. */ +#cmakedefine HAVE_PTHREAD_CANCEL 1 + +/* Define to 1 if you have the `pthread_keycreate' function. */ +#cmakedefine HAVE_PTHREAD_KEYCREATE 1 + +/* Define to 1 if you have the `pthread_key_create' function. */ +#cmakedefine HAVE_PTHREAD_KEY_CREATE 1 + +/* Define to 1 if you have the `pthread_mutexattr_setprotocol' function. */ +#cmakedefine HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL 1 + +/* Define to 1 if you have the `pthread_mutexattr_setrobust_np' function. */ +#cmakedefine HAVE_PTHREAD_MUTEXATTR_SETROBUST_NP 1 + +/* Define to 1 if you have the `pthread_mutex_consistent_np' function. */ +#cmakedefine HAVE_PTHREAD_MUTEX_CONSISTENT_NP 1 + +/* Define to 1 if you have the `pthread_rwlockattr_setkind_np' function. */ +#cmakedefine HAVE_PTHREAD_RWLOCKATTR_SETKIND_NP 1 + +/* Define to 1 if you have the `qsort_r' function. */ +#cmakedefine HAVE_QSORT_R 1 + +/* Define to 1 if you have the `setitimer' function. */ +#cmakedefine HAVE_SETITIMER 1 + +/* Define to 1 if you have the `semtimedop' function. */ +#cmakedefine HAVE_SEMTIMEDOP 1 + +/* Define to 1 if you have the `sem_init' function. */ +#cmakedefine HAVE_SEM_INIT 1 + +/* Define to 1 if you have the `sem_timedwait' function. */ +#cmakedefine HAVE_SEM_TIMEDWAIT 1 + +/* Define to 1 if you have the `setpgid' function. */ +#cmakedefine HAVE_SETPGID 1 + +/* Define to 1 if you have the `setpgrp' function. */ +#cmakedefine HAVE_SETPGRP 1 + +/* Define to 1 if you have the `setmntent' function. */ +#cmakedefine HAVE_SETMNTENT 1 + +/* Define to 1 if you have the `getmntent' function. */ +#cmakedefine HAVE_GETMNTENT 1 + +/* Define to 1 if you have the `setrlimit' function. */ +#cmakedefine HAVE_SETRLIMIT 1 + +/* Define to 1 if you have the `getrlimit' function. */ +#cmakedefine HAVE_GETRLIMIT 1 + +/* Define to 1 if you have the `sigaction' function. */ +#cmakedefine HAVE_SIGACTION 1 + +/* Define to 1 if you have the `sigset' function. */ +#cmakedefine HAVE_SIGSET 1 + +/* Define to 1 if you have the `snprintf' function. */ +#cmakedefine HAVE_SNPRINTF 1 + +/* Define to 1 if you have the `vsnprintf' function. */ +#cmakedefine HAVE_VSNPRINTF 1 + +/* Define to 1 if you have the `strcasecmp' function. */ +#cmakedefine HAVE_STRCASECMP 1 + +/* Define to 1 if you have the `stricmp' function. */ +#cmakedefine HAVE_STRICMP 1 + +/* Define to 1 if you have the `strncasecmp' function. */ +#cmakedefine HAVE_STRNCASECMP 1 + +/* Define to 1 if you have the `strnicmp' function. */ +#cmakedefine HAVE_STRNICMP 1 + +/* Define to 1 if you have the `strdup' function. */ +#cmakedefine HAVE_STRDUP 1 + +/* Define to 1 if you have the `strerror_r' function. */ +#cmakedefine HAVE_STRERROR_R 1 + +/* Define to 1 if you have the `swab' function. */ +#cmakedefine HAVE_SWAB 1 + +/* Define to 1 if you have the `_swab' function. */ +#cmakedefine HAVE__SWAB 1 + +/* Define to 1 if you have the `tcgetattr' function. */ +#cmakedefine HAVE_TCGETATTR 1 + +/* Define to 1 if you have the `time' function. */ +#cmakedefine HAVE_TIME 1 + +/* Define to 1 if you have the `times' function. */ +#cmakedefine HAVE_TIMES 1 + +/* Define to 1 if you have the `vfork' function. */ +#cmakedefine HAVE_VFORK 1 + + +/****************************************************************************** + * + * Types + * + ******************************************************************************/ + +/* Define to 1 if the system has the type `caddr_t'. */ +#cmakedefine HAVE_CADDR_T 1 + +/* Define to 1 if the system has the type `semun'. */ +#cmakedefine HAVE_SEMUN 1 + +/* Define to 1 if the system has the type `socklen_t'. */ +#cmakedefine HAVE_SOCKLEN_T 1 + +/* The size of `long', as computed by sizeof. */ +#cmakedefine SIZEOF_LONG @SIZEOF_LONG@ + +/* The size of `size_t', as computed by sizeof. */ +#cmakedefine SIZEOF_SIZE_T @SIZEOF_SIZE_T@ + +/* The size of `void *', as computed by sizeof. */ +#cmakedefine SIZEOF_VOID_P @SIZEOF_VOID_P@ + + +/****************************************************************************** + * + * Other/Misc + * + ******************************************************************************/ + +/* Use binary relocation? */ +#cmakedefine ENABLE_BINRELOC /**/ + +/* Alignment of long */ +#cmakedefine FB_ALIGNMENT @FB_ALIGNMENT@ + +/* Alignment of double */ +#cmakedefine FB_DOUBLE_ALIGN @FB_DOUBLE_ALIGN@ + +/* Is the platform big endian? */ +#cmakedefine WORDS_BIGENDIAN 1 + +/* Define this if INFINITY is defined in math.h */ +#cmakedefine HAVE_INFINITY 1 + +/* Define this if va_copy() is defined in stdarg.h */ +#cmakedefine HAVE_VA_COPY 1 + +/* Number of bits in a file offset, on hosts where this is settable. */ +#cmakedefine _FILE_OFFSET_BITS @_FILE_OFFSET_BITS@ + +/* Define this if getmntent needs second argument */ +#cmakedefine GETMNTENT_TAKES_TWO_ARGUMENTS 1 + +/* Define this if struct dirent has d_type */ +#cmakedefine HAVE_STRUCT_DIRENT_D_TYPE 1 + +/* Define this if databases on raw devices should be supported */ +#cmakedefine SUPPORT_RAW_DEVICES 1 + +/* Define it if compiler supports ISO syntax for thread-local storage */ +#cmakedefine HAVE___THREAD 1 + +/* Define to 1 if you can safely include both and . */ +#cmakedefine TIME_WITH_SYS_TIME 1 + +/* Define to 1 if the `getpgrp' function requires zero arguments. */ +#cmakedefine GETPGRP_VOID 1 + +/* Define to 1 if the `setpgrp' function takes no argument. */ +#cmakedefine SETPGRP_VOID 1 + +/* Define this if sem_init() works on the platform */ +#cmakedefine WORKING_SEM_INIT 1 + +/* Define to 1 if you have the file `/proc/self/exe'. */ +#cmakedefine HAVE__PROC_SELF_EXE 1 + +/* Extension for shared libraries */ +#cmakedefine SHRLIB_EXT "@SHRLIB_EXT@" + +/* Maximum allowed pathname length */ +#cmakedefine MAXPATHLEN @MAXPATHLEN@ // should correspond to MAX_PATH define in windef.h + +/* Define this if gettimeofday accepts second (timezone) argument */ +#cmakedefine GETTIMEOFDAY_RETURNS_TIMEZONE 1 + +#ifdef GETTIMEOFDAY_RETURNS_TIMEZONE +#define GETTIMEOFDAY(x) gettimeofday((x), (struct timezone *)0) +#else +#define GETTIMEOFDAY(x) gettimeofday((x)) +#endif + +/* Define to `int' if doesn't define. */ +#cmakedefine HAVE_GID_T 1 +#ifndef HAVE_GID_T +#define gid_t int +#endif + +/* Define to `long int' if does not define. */ +#cmakedefine HAVE_OFF_T 1 +#ifndef HAVE_OFF_T +#define off_t long int +#endif + +/* Define to `int' if does not define. */ +#cmakedefine HAVE_PID_T 1 +#ifndef HAVE_PID_T +#define pid_t int +#endif + +/* Define to `unsigned int' if does not define. */ +#cmakedefine HAVE_SIZE_T 1 +#ifndef HAVE_SIZE_T +#define size_t unsigned int +#endif + +/* Define to `int' if doesn't define. */ +#cmakedefine HAVE_UID_T 1 +#ifndef HAVE_UID_T +#define uid_t int +#endif + +#if defined _MSC_VER +#if _MSC_VER < 1500 +#define vsnprintf _vsnprintf +#endif +#define isnan _isnan +#define snprintf _snprintf +#endif + +#ifndef HAVE_SOCKLEN_T +typedef int socklen_t; +#endif + +/****************************************************************************** + * + * WIN_NT special + * + ******************************************************************************/ + +#ifdef WIN_NT + +#ifdef _MSC_VER + +//#pragma warning(disable:4099) // class/struct mixups +#pragma warning(disable:4251) // needs to have dll-interface +#pragma warning(disable:4291) // no matching op. delete (there are) +//#pragma warning(disable:4355) // 'this' used in base member initializer list +#pragma warning(disable:4786) // debug identifiers are truncated +#pragma warning(disable:4800) // forcing value to bool 'true' or 'false' (performance warning) + +// New warnings at level W4 + +//#pragma warning(disable:4018) // signed/unsigned mismatch +//#pragma warning(disable:4100) // unreferenced formal parameter +#pragma warning(disable:4127) // conditional expression is constant +//#pragma warning(disable:4131) // uses old-style declarator +//#pragma warning(disable:4146) // unary minus operator applied to unsigned type, result still unsigned +//#pragma warning(disable:4189) // local variable is initialized but not referenced +#pragma warning(disable:4211) // nonstandard extension used : redefined extern to static +#pragma warning(disable:4214) // nonstandard extension used : bit field types other than int +#pragma warning(disable:4244) // conversion from '.......' to '......', possible loss of data +#pragma warning(disable:4245) // conversion from '.......' to '......', signed/unsigned mismatch +#pragma warning(disable:4290) // C++ exception specification ignored except to indicate a function is not __declspec(nothrow) +#pragma warning(disable:4291) // no matching operator delete found; memory will not be freed if initialization throws an exception +#pragma warning(disable:4309) // truncation of constant value +#pragma warning(disable:4310) // cast truncates constant value +#pragma warning(disable:4355) // '....' used in base member initializer list +//#pragma warning(disable:4505) // unreferenced local function has been removed +#pragma warning(disable:4510) // '': default constructor could not be generated +#pragma warning(disable:4511) // copy constructor could not be generated +#pragma warning(disable:4512) // assignment operator could not be generated +#pragma warning(disable:4514) // unreferenced inline function has been removed +#pragma warning(disable:4610) // class '' can never be instantiated - user defined constructor required +#pragma warning(disable:4663) // to explicitly specialize class template '.....' use the following syntax +#pragma warning(disable:4701) // local variable '......' may be used without having been initialized +//#pragma warning(disable:4702) // unreachable code +#pragma warning(disable:4706) // assignment within conditional expression +#pragma warning(disable:4709) // comma operator within array index expression +#pragma warning(disable:4710) // function '.....' not inlined +#pragma warning(disable:4711) // function '.....' selected for automatic inline expansion + +// Warning from Microsoft Visual Studio\VC98\include\fstream + +//#pragma warning(disable:4097) // typedef-name '......' used as synonym for class-name '.....' + +// New MSVC8 warnings +#pragma warning(disable:4996) // 'identificator' was declared deprecated +#endif + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers + +//#ifdef _MSC_VER // don't know if this is useful for MinGW +#define NOATOM +//#define NOGDI +//#define NOGDICAPMASKS +#define NOMETAFILE +#define NOMINMAX +//#define NOMSG +#define NOOPENFILE +#define NORASTEROPS +#define NOSCROLL +#define NOSOUND +#define NOSYSMETRICS +#define NOTEXTMETRIC +#define NOWH +#define NOCOMM +#define NOKANJI +#define NOCRYPT +#define NOMCX +//#define NOWINMESSAGES +//#define NOWINSTYLES +//#define NOMENUS +#define NOICONS +#define NOCLIPBOARD +//#define NOCOLOR +//#define NOSERVICE +//#define NOHELP +//#endif + +#endif diff --git a/src/remote/CMakeLists.txt b/src/remote/CMakeLists.txt new file mode 100644 index 0000000000..312eaaa3e8 --- /dev/null +++ b/src/remote/CMakeLists.txt @@ -0,0 +1,64 @@ +include(SourceGroups) + +############################################################################### +# LIBRARY remote +############################################################################### + +set(remote_src + merge.cpp + parser.cpp + protocol.cpp + remote.cpp + inet.cpp + + ../auth/SecureRemotePassword/srp.cpp + ../auth/SecureRemotePassword/srp.h + ../auth/SecureRemotePassword/Message.h + ../auth/trusted/AuthSspi.cpp +) +add_src_win32(remote_src + os/win32/wnet.cpp + os/win32/wnet_proto.h + os/win32/xnet.cpp + os/win32/xnet.h + os/win32/xnet_proto.h +) +file(GLOB remote_include "*.h") + +add_library(remote ${remote_src} ${remote_include}) + + +############################################################################### +# EXECUTABLE fbserver +############################################################################### + +set(fbserver_src + ../auth/SecureRemotePassword/server/SrpServer.cpp + ../auth/SecureRemotePassword/server/SrpServer.h +) +add_src_win32(fbserver_src + server/os/win32/chop.cpp + server/os/win32/cntl.cpp + server/os/win32/property.cpp + server/os/win32/window.cpp + server/os/win32/srvr_w32.cpp + server/os/win32/server.ico + server/os/win32/caution.ico + server/os/win32/window.rc + server/server.cpp +) +add_src_unix(fbserver_src + ../auth/SecureRemotePassword/srp.cpp + server/os/posix/inet_server.cpp + server/server.cpp + + inet.cpp + merge.cpp + parser.cpp + protocol.cpp + remote.cpp +) + +add_executable (fbserver WIN32 ${fbserver_src}) +target_link_libraries (fbserver common yvalve ${LIB_comctl32}) +set_target_properties (fbserver PROPERTIES OUTPUT_NAME firebird) diff --git a/src/utilities/CMakeLists.txt b/src/utilities/CMakeLists.txt new file mode 100644 index 0000000000..b9a2646f40 --- /dev/null +++ b/src/utilities/CMakeLists.txt @@ -0,0 +1,103 @@ +include(SourceGroups) + +############################################################################### +# EXECUTABLE fbsvcmgr +############################################################################### + +add_executable (fbsvcmgr fbsvcmgr/fbsvcmgr.cpp ${VERSION_RC}) +target_link_libraries (fbsvcmgr common yvalve) + +############################################################################### +# EXECUTABLE nbackup +############################################################################### + +set(nbackup_src + ../jrd/ods.cpp + nbackup/main/nbkMain.cpp + nbackup/nbackup.cpp +) +file(GLOB nbackup_include "nbackup/*.h") + +add_executable (nbackup ${nbackup_src} ${nbackup_include} ${VERSION_RC}) +target_link_libraries (nbackup common yvalve) + + +############################################################################### +# EXECUTABLE gsec +############################################################################### + +set(gsec_src + gsec/gsec.cpp + gsec/main/gsecMain.cpp + + gsec/gsec.h +) + +add_executable (gsec ${gsec_src} ${VERSION_RC}) +target_link_libraries (gsec common yvalve) + + +############################################################################### +# SHARED LIBRARY fbtrace +############################################################################### + +set(fbtrace_src + ntrace/PluginLogWriter.cpp + ntrace/TraceConfiguration.cpp + ntrace/traceplugin.cpp + ntrace/TracePluginImpl.cpp + ntrace/TraceUnicodeUtils.cpp + + ntrace/os/platform.h +) +add_src_win32(fbtrace_src ntrace/os/win32/platform.cpp) +add_src_unix (fbtrace_src ntrace/os/posix/platform.cpp) + +file(GLOB fbtrace_include "ntrace/*.h") + +add_library (fbtrace SHARED ${fbtrace_src} ${fbtrace_os_src} ${fbtrace_include} ${VERSION_RC}) +target_link_libraries (fbtrace common yvalve) +add_dependencies (fbtrace engine12 build_msg codes) # try to wait all generators stop +set_output_directory (fbtrace plugins) +set_exported_symbols (fbtrace fbplugin) + + +############################################################################### + +if (WIN32) + ########################################################################### + # EXECUTABLE instreg + ########################################################################### + set(instreg_src + install/install_reg.cpp + install/registry.cpp + + install/registry.h + install/regis_proto.h + ) + add_executable (instreg ${instreg_src} ${VERSION_RC}) + + ########################################################################### + # EXECUTABLE instsvc + ########################################################################### + set(instsvc_src + install/install_svc.cpp + install/services.cpp + + install/servi_proto.h + ) + add_executable (instsvc ${instsvc_src} ${VERSION_RC}) + target_link_libraries (instsvc common yvalve) + + ########################################################################### + # EXECUTABLE instclient + ########################################################################### + set(instclient_src + install/install.cpp + install/install_client.cpp + + install/install_proto.h + ) + add_executable (instclient ${instclient_src} ${VERSION_RC}) + target_link_libraries (instclient version) +endif(WIN32)