diff --git a/CMakeLists.txt b/CMakeLists.txt index 6bb9033ea0c..2ad12ec67ed 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -17,7 +17,7 @@ # ################################################################################ -cmake_minimum_required(VERSION 2.8.12) +cmake_minimum_required(VERSION 3.15) # In-source builds are not possible and so disabled. if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) @@ -84,6 +84,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${output_dir}) if (MSVC OR XCODE) set(output_dir ${output_dir}/$) set(boot_dir ${boot_dir}/$) +elseif (MINGW) + set(output_dir ${CMAKE_BINARY_DIR}) endif() if (MSVC AND DEFAULT_CONFIGURATION) @@ -98,7 +100,7 @@ if (XCODE) string(TOUPPER ${conf} conf2) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${conf2} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${conf}/bin) endforeach() -elseif (UNIX) +elseif (UNIX OR MINGW) set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${output_dir}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${output_dir}/bin) endif() @@ -147,8 +149,8 @@ endif() include(Configure) -if (FREEBSD) - # temporary +if (FREEBSD OR MINGW) + # Build-time temporary installation path set(CMAKE_INSTALL_PREFIX ${CMAKE_BINARY_DIR}) endif() @@ -159,21 +161,55 @@ set(FB_SERVICE_NAME "gds_db") set(FB_SERVICE_PORT 3050) if (WIN32) - set(FB_PREFIX "c:\\\\Program Files\\\\Firebird\\\\") + if (MSVC) + set(FB_PREFIX "c:\\\\Program Files\\\\Firebird\\\\") + else() + set(FB_PREFIX ${CMAKE_INSTALL_PREFIX}) + endif() set(FB_IPC_NAME "FIREBIRD") endif() +if (MINGW) + set(FB_BINDIR "${FB_PREFIX}/bin") + set(FB_SBINDIR "${FB_PREFIX}/bin") + set(FB_INCDIR "${FB_PREFIX}/include") + set(FB_LIBDIR "${FB_PREFIX}/lib") + set(FB_CONFDIR "${FB_PREFIX}/etc/firebird") + set(FB_GUARDDIR "${FB_PREFIX}/etc/firebird") + set(FB_LOGDIR "${FB_PREFIX}/etc/firebird") + set(FB_MSGDIR "${FB_PREFIX}/etc/firebird") + set(FB_SECDBDIR "${FB_PREFIX}/etc/firebird") + set(FB_DOCDIR "${FB_PREFIX}/share/firebird/doc") + set(FB_INTLDIR "${FB_PREFIX}/share/firebird/intl") + set(FB_MISCDIR "${FB_PREFIX}/share/firebird/misc") + set(FB_PLUGDIR "${FB_PREFIX}/share/firebird/plugins") + set(FB_SAMPLEDBDIR "${FB_PREFIX}/share/firebird/examples/empbuild") + set(FB_SAMPLEDIR "${FB_PREFIX}/share/firebird/examples") + set(FB_TZDATADIR "${FB_PREFIX}/share/firebird/tzdata") +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) +if (MINGW) + # Set the final installation path + set(FB_PREFIX ${FB_INSTALL_PREFIX}) + + set(FBCONFIG_SRC ${CMAKE_SOURCE_DIR}/builds/install/arch-specific/mingw/fb_config.in) + set(FBCONFIG ${CMAKE_BINARY_DIR}/fb_config) + configure_file(${FBCONFIG_SRC} ${FBCONFIG} @ONLY) +endif() + ################################################################################ # # compiler & linker settings # ################################################################################ -add_definitions(-DDEV_BUILD) +if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + add_definitions(-DDEV_BUILD) +endif() if (WIN32) set(OS_DIR win32) @@ -192,20 +228,71 @@ if (WIN32) endif() endif(MSVC) - set(LIB_Ws2_32 Ws2_32) + set(LIB_ws2_32 ws2_32) set(LIB_comctl32 comctl32) set(LIB_mpr mpr) set(LIB_version version) endif(WIN32) if (MINGW) - # clear unix-style prefixes + # Clear unix-style prefixes set(CMAKE_SHARED_LIBRARY_PREFIX) set(CMAKE_SHARED_MODULE_PREFIX) set(CMAKE_STATIC_LIBRARY_PREFIX) - add_definitions(-D_WIN32_WINNT=0x0600) + if ("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ggdb") + set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -DDEBUG") + else() + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O3") + set(CMAKE_RC_FLAGS "${CMAKE_RC_FLAGS} -DNDEBUG") + endif() + + add_definitions(-DWIN_NT -DMINGW -DMINGW_HAS_SECURE_API -DTTMATH_NOASM) + + set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-shift-count-overflow") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -msse4 -std=c++17") + + # Suppress myriad of warnings + set(cxx_flags "") + list(APPEND cxx_flags + -Wundef + -Wno-format + -Wno-deprecated-declarations + -Wno-ignored-attributes + -Wno-invalid-offsetof + -Wno-long-long + -Wno-non-virtual-dtor + -Wno-parentheses + -Wno-shift-count-overflow + -Wno-sign-compare + -Wno-switch + -Wno-unused-variable + -Wno-write-strings + ) + if (CLANG) + list(APPEND cxx_flags + -Wno-varargs + -Wno-constant-conversion + -Wno-inconsistent-missing-override + -Wno-tautological-constant-out-of-range-compare + -Wno-c++11-narrowing + ) + else() + list(APPEND cxx_flags + -Wno-class-memaccess + -Wno-overflow + -Wno-return-local-addr + -Wno-stringop-overflow + -Wno-stringop-overread + -Wno-narrowing + ) + endif() + string(REPLACE ";" " " cxx_flags "${cxx_flags}") + set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${cxx_flags}") + + set(LIB_iconv iconv) + set(LIB_re2 re2) endif() if (UNIX) @@ -214,8 +301,12 @@ if (UNIX) set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fPIC") set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC -msse4 -std=c++17") + set(FB_INTERNAL_TOMMATH ON) + set(FB_INTERNAL_EDITLINE ON) + + set(LIB_re2 re2) if (NOT CMAKE_CROSSCOMPILING) - set(LIB_readline readline) + set(LIB_editline editline) endif() if (NOT FREEBSD) set(LIB_dl dl) @@ -251,7 +342,7 @@ endif() # ################################################################################ -if (WIN32) +if (MSVC) # icu if (NOT ICU_EXTRACT) message(STATUS "Extracting pre-built ICU") @@ -324,29 +415,50 @@ if (NOT CMAKE_CROSSCOMPILING) create_boot_commands() create_master_commands() -endif() # if (NOT CMAKE_CROSSCOMPILING) +endif() # (NOT CMAKE_CROSSCOMPILING) crosscompile_prebuild_steps() -include_directories("extern/libtommath") -include_directories("extern/libtomcrypt/src/headers") +if (FB_INTERNAL_TOMMATH) + include_directories("extern/libtommath") + include_directories("extern/libtomcrypt/src/headers") + set(LIB_tommath libtommath) + set(LIB_tomcrypt libtomcrypt) +else() + set(LIB_tommath tommath) + set(LIB_tomcrypt tomcrypt) +endif() + +if (UNIX) + if (FB_INTERNAL_EDITLINE) + include_directories("extern/editline") + endif() +endif() + include_directories("extern/decNumber") -include_directories("extern/icu/include") -include_directories("extern/zlib") +include_directories("extern/libcds") +include_directories("extern/re2") + +if (MSVC OR ANDROID) + include_directories("extern/icu/include") + include_directories("extern/zlib") +endif() 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") + +if (FB_INTERNAL_TOMMATH) ######################################## # LIBRARY libtommath ######################################## file(GLOB libtommath_src "extern/libtommath/*.c" "extern/libtommath/*.h") -add_library (libtommath ${libtommath_src}) -project_group (libtommath Extern) +add_library (libtommath ${libtommath_src}) +project_group (libtommath Extern) ######################################## @@ -362,6 +474,8 @@ add_library (libtomcrypt ${libtomcrypt_src}) target_compile_definitions (libtomcrypt PRIVATE LTC_NO_ROLC LTC_SOURCE) project_group (libtomcrypt Extern) +endif() # (FB_INTERNAL_TOMMATH) + ######################################## # LIBRARY decNumber @@ -375,6 +489,30 @@ add_library (decNumber ${decNumber_src}) project_group (decNumber Extern) +if (FB_INTERNAL_EDITLINE) +######################################## +# LIBRARY editline +######################################## + +file(GLOB editline_src "extern/editline/src/*.c" "extern/editline/src/*.h") + +add_library (editline ${editline_src}) +project_group (editline Extern) + +endif() # (FB_INTERNAL_EDITLINE) + + +######################################## +# LIBRARY libcds +######################################## + +file(GLOB_RECURSE libcds_src "extern/libcds/src/*.cpp") + +add_library (libcds ${libcds_src}) +target_compile_definitions (libcds PUBLIC CDS_BUILD_STATIC_LIB) +project_group (libcds Extern) + + ######################################## # EXECUTABLE btyacc ######################################## @@ -383,11 +521,11 @@ file(GLOB btyacc_src "extern/btyacc/*.c" "extern/btyacc/*.h") if (NOT CMAKE_CROSSCOMPILING) -add_executable (btyacc ${btyacc_src}) -project_group (btyacc Extern) -set_output_directory (btyacc . CURRENT_DIR) +add_executable (btyacc ${btyacc_src}) +set_output_directory (btyacc src CURRENT_DIR) +project_group (btyacc Extern) -endif() # if (NOT CMAKE_CROSSCOMPILING) +endif() # (NOT CMAKE_CROSSCOMPILING) ######################################## # EXECUTABLE cloop @@ -395,13 +533,15 @@ endif() # if (NOT CMAKE_CROSSCOMPILING) file(GLOB cloop_src "extern/cloop/src/cloop/*.cpp" "extern/cloop/src/cloop/*.h") -add_executable (cloop ${cloop_src}) -project_group (cloop Extern) +add_executable (cloop ${cloop_src}) +set_output_directory (cloop src CURRENT_DIR) +project_group (cloop Extern) ######################################## # subdirectories ######################################## +add_subdirectory("extern/re2") add_subdirectory("examples") add_subdirectory("src") diff --git a/builds/cmake/BuildFunctions.cmake b/builds/cmake/BuildFunctions.cmake index 5469c953a20..9c751df5671 100644 --- a/builds/cmake/BuildFunctions.cmake +++ b/builds/cmake/BuildFunctions.cmake @@ -114,7 +114,6 @@ function(epp_process type files) 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 ${ARGN} -b ${dir}/ ${in} ${out} ) endif() @@ -263,8 +262,12 @@ function(create_command command type out) set(dir ${boot_dir}) endif() - set_win32(env "PATH=${dir}\;%PATH%") - set_unix (env "PATH=${dir}/bin:$PATH") + if (MSVC) + set_win32(env "PATH=${dir}\;%PATH%") + elseif (MINGW) + set_win32(env "PATH=${dir}/bin\;%PATH%") + endif() + set_unix(env "PATH=${dir}/bin:$PATH") set(env "${env}" FIREBIRD=${dir} ) @@ -316,7 +319,6 @@ function(create_boot_commands) boot_gbak boot_gfix build_msg - codes gpre_boot ) foreach(cmd ${cmd_list}) diff --git a/builds/cmake/Configure.cmake b/builds/cmake/Configure.cmake index 9faa0e50eb7..fcbb143c653 100644 --- a/builds/cmake/Configure.cmake +++ b/builds/cmake/Configure.cmake @@ -201,6 +201,7 @@ set(functions_list AO_compare_and_swap_full clock_gettime ctime_r + ctime_s dirname fallocate fchmod @@ -213,6 +214,7 @@ set(functions_list gmtime_r initgroups localtime_r + localtime_s mkstemp mmap nanosleep @@ -315,9 +317,11 @@ 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 (NOT WIN32) + 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) +endif() if (EXISTS "/proc/self/exe") set(HAVE__PROC_SELF_EXE 1) @@ -343,6 +347,31 @@ if (WIN32) set(SUPPORT_RAW_DEVICES 0) set(WIN_NT 1) set(CASE_SENSITIVITY "false") + if (MINGW) + set(MINGW 1) + + # We do not use pthread + set(HAVE_PTHREAD_H 0) + set(HAVE_SEMAPHORE_H 0) + + # Disable pthread features + set(HAVE_PTHREAD_CANCEL 0) + set(HAVE_PTHREAD_KEY_CREATE 0) + set(HAVE_PTHREAD_MUTEXATTR_SETPROTOCOL 0) + set(HAVE_SEM_INIT 0) + set(HAVE_SEM_TIMEDWAIT 0) + + # These were detected, but not needed + set(HAVE_CLOCK_GETTIME 0) + set(HAVE_GETPAGESIZE 0) + set(HAVE_GETTIMEOFDAY 0) + set(HAVE_NANOSLEEP 0) + set(HAVE__PROC_SELF_EXE 0) + + # Exist, but not detected + set(HAVE_CTIME_S 1) + set(HAVE_LOCALTIME_S 1) + endif() endif(WIN32) if (APPLE) diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 43f1ed30e0a..0b98444e3d6 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -15,13 +15,14 @@ if (NOT CMAKE_CROSSCOMPILING) add_custom_command( OUTPUT empbuild.fdb DEPENDS + engine isql ${CMAKE_CURRENT_SOURCE_DIR}/empbuild/empbld.sql COMMAND ${CMAKE_COMMAND} -E remove empbuild.fdb COMMAND ${ISQL_CMD} -q -i ${CMAKE_CURRENT_SOURCE_DIR}/empbuild/empbld.sql - COMMAND ${CMAKE_COMMAND} -E copy_if_different empbuild.fdb empbuild_.fdb + COMMAND ${CMAKE_COMMAND} -E copy_if_different empbuild.fdb empbuild.tmp COMMAND ${CMAKE_COMMAND} -E remove empbuild.fdb - COMMAND ${CMAKE_COMMAND} -E copy_if_different empbuild_.fdb empbuild.fdb + COMMAND ${CMAKE_COMMAND} -E copy_if_different empbuild.tmp empbuild.fdb ) add_custom_command( OUTPUT empbuild.cpp @@ -61,14 +62,13 @@ add_custom_command( gfix ${files} COMMAND ${CMAKE_COMMAND} -E remove employe2.fdb - COMMAND ${CMAKE_COMMAND} -E remove employe2_.fdb - COMMAND ${EMPBUILD_CMD} employe2_.fdb - COMMAND ${CMAKE_COMMAND} -E copy_if_different employe2_.fdb employe2.fdb + COMMAND ${EMPBUILD_CMD} employe2.fdb + COMMAND ${CMAKE_COMMAND} -E copy_if_different employe2.fdb empbuild/employee.fdb ) add_custom_target (employee_db ALL DEPENDS employe2.fdb SOURCES ${files}) project_group (employee_db "Examples/Custom build steps") -endif() # if (NOT CMAKE_CROSSCOMPILING) +endif() # (NOT CMAKE_CROSSCOMPILING) ######################################## @@ -77,7 +77,8 @@ endif() # if (NOT CMAKE_CROSSCOMPILING) file(GLOB udrcpp_example_src "udr/*") -add_library (udrcpp_example SHARED ${udrcpp_example_src}) +add_library (udrcpp_example SHARED ${udrcpp_example_src} ${VERSION_RC}) +set_target_properties (udrcpp_example PROPERTIES RC_FLAGS -DRC_TARGET_udrcpp_example) target_link_libraries (udrcpp_example yvalve) set_exported_symbols (udrcpp_example udr_plugin) set_output_directory (udrcpp_example plugins/udr) @@ -88,21 +89,73 @@ 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) -add_dependencies_cc (dbcrypt_example UpdateCloopInterfaces) -project_group (dbcrypt_example Examples) +set(dbcrypt_conf_src + ${CMAKE_CURRENT_SOURCE_DIR}/dbcrypt/fbSampleDbCrypt.conf +) + +add_library (dbcrypt_example SHARED dbcrypt/DbCrypt.cpp) +set_target_properties (dbcrypt_example PROPERTIES OUTPUT_NAME fbSampleDbCrypt) +set_output_directory (dbcrypt_example prebuilt/plugins CURRENT_DIR) +add_dependencies_cc (dbcrypt_example UpdateCloopInterfaces) +project_group (dbcrypt_example Examples) + +add_custom_command(TARGET dbcrypt_example POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${dbcrypt_conf_src} ${output_dir}/examples/prebuilt/plugins/fbSampleDbCrypt.conf +) ######################################## # 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) -add_dependencies_cc (cryptkeyholder_example UpdateCloopInterfaces) -project_group (cryptkeyholder_example Examples) +set(cryptkeyholder_conf_src + ${CMAKE_CURRENT_SOURCE_DIR}/dbcrypt/fbSampleKeyHolder.conf +) + +add_library (cryptkeyholder_example SHARED dbcrypt/CryptKeyHolder.cpp) +set_target_properties (cryptkeyholder_example PROPERTIES OUTPUT_NAME fbSampleKeyHolder) +set_output_directory (cryptkeyholder_example prebuilt/plugins CURRENT_DIR) +add_dependencies_cc (cryptkeyholder_example UpdateCloopInterfaces) +project_group (cryptkeyholder_example Examples) + +add_custom_command(TARGET cryptkeyholder_example POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${cryptkeyholder_conf_src} ${output_dir}/examples/prebuilt/plugins/fbSampleKeyHolder.conf +) + + +######################################## +# SHARED LIBRARY extauth +######################################## + +add_library (extauth SHARED extauth/ExtAuth.cpp extauth/TcWrapper.cpp) +set_target_properties (extauth PROPERTIES OUTPUT_NAME fbSampleExtAuth) +target_compile_definitions (extauth PRIVATE LTM_DESC) +target_link_libraries (extauth ${LIB_tomcrypt}) +set_output_directory (extauth prebuilt/plugins CURRENT_DIR) +project_group (extauth Examples) + + +######################################## +# EXECUTABLE extauthkeygen +######################################## + +add_executable (extauthkeygen extauth/keygen.cpp extauth/TcWrapper.cpp) +set_target_properties (extauthkeygen PROPERTIES OUTPUT_NAME fbSampleExtAuthKeygen) +target_compile_definitions (extauthkeygen PRIVATE LTM_DESC) +target_link_libraries (extauthkeygen ${LIB_tomcrypt}) +set_output_directory (extauthkeygen prebuilt/bin CURRENT_DIR) +project_group (extauthkeygen Examples) + + +######################################## +# EXECUTABLE dbcryptapp +######################################## + +add_executable (dbcryptapp dbcrypt/CryptApplication.cpp) +set_target_properties (dbcryptapp PROPERTIES OUTPUT_NAME fbSampleDbCryptApp) +target_link_libraries (dbcryptapp yvalve) +set_output_directory (dbcryptapp prebuilt/bin CURRENT_DIR) +project_group (dbcryptapp Examples) + ############################################################################### diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 13059dc5ebe..49e4a8c2d6e 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -39,8 +39,6 @@ set(epp_boot_files alice/alice_meta.epp gpre/std/gpre_meta.epp utilities/stats.epp - yvalve/array.epp - yvalve/blob.epp utilities/gstat/dba.epp ) set(epp_boot_gds_files @@ -59,8 +57,6 @@ set(epp_boot_gds_files ) set(epp_master_files auth/SecurityDatabase/LegacyManagement.epp - msgs/build_file.epp - misc/codes.epp ) if (NOT CMAKE_CROSSCOMPILING) @@ -74,7 +70,7 @@ epp_process(master epp_boot_internal_files ${BOOT_GPRE_CMD} -n -m -ids -ocxx -m epp_process(master epp_boot_ocxx_files ${BOOT_GPRE_CMD} -n -ids -ocxx) epp_process(master epp_boot_files ${BOOT_GPRE_CMD} -n -m) epp_process(master epp_boot_gds_files ${BOOT_GPRE_CMD} -n -ids -gds_cxx) -epp_process(master epp_master_files ${BOOT_GPRE_CMD} -n -m) +epp_process(master epp_master_files ${GPRE_CMD} -n -m) ################################################################################ @@ -87,65 +83,57 @@ epp_process(master epp_master_files ${BOOT_GPRE_CMD} -n -m) # BUILD STEP databases ######################################## -set(msgs_src - ${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/msg.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 -) -set(databases_src - ${CMAKE_CURRENT_SOURCE_DIR}/dbs/security.sql - ${msgs_src} -) add_custom_command( OUTPUT security.fdb DEPENDS + boot_engine boot_isql boot_gfix ${CMAKE_CURRENT_SOURCE_DIR}/dbs/security.sql VERBATIM # COMMAND ${CMAKE_COMMAND} -E remove security.fdb - COMMAND ${CMAKE_COMMAND} -E remove security_.fdb - COMMAND ${CMAKE_COMMAND} -E echo "create database 'security_.fdb';" > create_db_security.sql + COMMAND ${CMAKE_COMMAND} -E remove security.tmp + COMMAND ${CMAKE_COMMAND} -E echo "create database 'security.tmp';" > create_db_security.sql COMMAND ${BOOT_ISQL_CMD} -q -i create_db_security.sql - COMMAND ${BOOT_GFIX_CMD} -write async security_.fdb - COMMAND ${BOOT_ISQL_CMD} -q security_.fdb -i ${CMAKE_CURRENT_SOURCE_DIR}/dbs/security.sql - COMMAND ${CMAKE_COMMAND} -E copy_if_different security_.fdb security.fdb + COMMAND ${BOOT_GFIX_CMD} -write async security.tmp + COMMAND ${BOOT_ISQL_CMD} -q security.tmp -i ${CMAKE_CURRENT_SOURCE_DIR}/dbs/security.sql + COMMAND ${CMAKE_COMMAND} -E copy_if_different security.tmp security.fdb COMMAND ${BOOT_GFIX_CMD} -write sync security.fdb ) add_custom_command( OUTPUT metadata.fdb DEPENDS + boot_engine boot_isql boot_gfix VERBATIM # COMMAND ${CMAKE_COMMAND} -E remove metadata.fdb - COMMAND ${CMAKE_COMMAND} -E remove metadata_.fdb - COMMAND ${CMAKE_COMMAND} -E echo "create database 'metadata_.fdb';" > create_db_metadata.sql + COMMAND ${CMAKE_COMMAND} -E remove metadata.tmp + COMMAND ${CMAKE_COMMAND} -E echo "create database 'metadata.tmp';" > create_db_metadata.sql COMMAND ${BOOT_ISQL_CMD} -q -i create_db_metadata.sql - COMMAND ${BOOT_GFIX_CMD} -sql_dialect 1 metadata_.fdb - COMMAND ${BOOT_GFIX_CMD} -mode read_only metadata_.fdb - COMMAND ${CMAKE_COMMAND} -E copy_if_different metadata_.fdb metadata.fdb + COMMAND ${BOOT_GFIX_CMD} -sql_dialect 1 metadata.tmp + COMMAND ${BOOT_GFIX_CMD} -mode read_only metadata.tmp + COMMAND ${CMAKE_COMMAND} -E copy_if_different metadata.tmp metadata.fdb ) add_custom_target(databases DEPENDS - boot_engine metadata.fdb security.fdb SOURCES - ${databases_src} + ${CMAKE_CURRENT_SOURCE_DIR}/dbs/security.sql ) -add_dependencies_cc(databases msg_fdb) +add_dependencies_cc(databases messages) project_group(databases "Boot/Custom build steps") +if (MINGW) + add_custom_command(TARGET databases POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different metadata.fdb ${output_dir}/etc/firebird/metadata.fdb + COMMAND ${CMAKE_COMMAND} -E copy_if_different security.fdb ${output_dir}/etc/firebird/security.fdb + ) +endif() + ######################################## # BUILD STEP messages @@ -155,76 +143,21 @@ add_custom_command( OUTPUT firebird.msg DEPENDS build_msg - msg_fdb + ib_util # COMMAND ${CMAKE_COMMAND} -E remove firebird.msg - COMMAND ${BUILD_MSG_CMD} -D msg.fdb -P ${CMAKE_CURRENT_BINARY_DIR}/ -F firebird.msg -L all - COMMAND ${BUILD_MSG_CMD} -D msg.fdb -P ${CMAKE_CURRENT_BINARY_DIR}/ -F firebird.msg + COMMAND ${BUILD_MSG_CMD} -F firebird.msg -C ${CMAKE_CURRENT_SOURCE_DIR}/include/firebird/impl/iberror_c.h COMMAND ${CMAKE_COMMAND} -E copy_if_different firebird.msg ${output_dir}/firebird.msg ) -add_custom_command( - OUTPUT codes_headers.dummy - DEPENDS - codes - msg_fdb - COMMENT "" - # - COMMAND ${CMAKE_COMMAND} -E echo "" > codes_headers.dummy - COMMAND ${CMAKE_COMMAND} -E echo Building codes header... - COMMAND ${CODES_CMD} ${CMAKE_CURRENT_SOURCE_DIR}/include/gen ${CMAKE_SOURCE_DIR}/lang_helpers -) -add_custom_target(messages ALL DEPENDS firebird.msg codes_headers.dummy) +add_custom_target(messages DEPENDS firebird.msg) project_group(messages "Boot/Custom build steps") - -######################################## -# BUILD STEP msg_fdb -######################################## - -set(isql_exec_msg ${BOOT_ISQL_CMD} -q msg_.fdb -i ${CMAKE_CURRENT_SOURCE_DIR}/msgs) - -add_custom_command( - OUTPUT msg.fdb - VERBATIM - DEPENDS - boot_isql - boot_gfix - ${msgs_src} - # - COMMAND ${CMAKE_COMMAND} -E remove msg.fdb - COMMAND ${CMAKE_COMMAND} -E remove msg_.fdb - COMMAND ${CMAKE_COMMAND} -E echo "create database 'msg_.fdb';" > create_db_msg.sql - COMMAND ${BOOT_ISQL_CMD} -q -i create_db_msg.sql - COMMAND ${BOOT_GFIX_CMD} -write async msg_.fdb - 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 - # - COMMAND ${CMAKE_COMMAND} -E copy_if_different msg_.fdb msg.fdb -) -add_custom_target(msg_fdb - DEPENDS - boot_engine - msg.fdb -) -project_group(msg_fdb "Boot/Custom build steps") +if (MINGW) + add_custom_command(TARGET messages POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory ${output_dir}/etc/firebird + COMMAND ${CMAKE_COMMAND} -E copy_if_different firebird.msg ${output_dir}/etc/firebird/firebird.msg + ) +endif() ######################################## @@ -265,24 +198,24 @@ set_source_files_properties(dsql/parse.cpp include/gen/parse.h PROPERTIES GENERA ######################################## add_custom_command( - OUTPUT ${CMAKE_CURRENT_SOURCE_DIR}/include/firebird/IdlFbInterfaces.h + OUTPUT ${GENERATED_DIR}/include/firebird/IdlFbInterfaces.h DEPENDS cloop ${CMAKE_CURRENT_SOURCE_DIR}/include/firebird/FirebirdInterface.idl COMMAND cloop ${CMAKE_CURRENT_SOURCE_DIR}/include/firebird/FirebirdInterface.idl c++ - ${CMAKE_CURRENT_SOURCE_DIR}/include/firebird/IdlFbInterfaces.h + ${GENERATED_DIR}/include/firebird/IdlFbInterfaces.h IDL_FB_INTERFACES_H Firebird I COMMENT "Updating cloop interfaces..." ) add_custom_target(UpdateCloopInterfaces - DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/include/firebird/IdlFbInterfaces.h + DEPENDS ${GENERATED_DIR}/include/firebird/IdlFbInterfaces.h SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/include/firebird/FirebirdInterface.idl ) project_group(UpdateCloopInterfaces "Boot/Custom build steps") -endif() # if (NOT CMAKE_CROSSCOMPILING) +endif() # (NOT CMAKE_CROSSCOMPILING) ################################################################################ @@ -308,7 +241,7 @@ if (NOT CMAKE_CROSSCOMPILING) add_library (boot_alice ${alice_src} ${alice_generated_src_boot}) project_group (boot_alice Boot) -endif() # if (NOT CMAKE_CROSSCOMPILING) +endif() # (NOT CMAKE_CROSSCOMPILING) ######################################## @@ -337,7 +270,7 @@ if (NOT CMAKE_CROSSCOMPILING) add_library (boot_burp ${burp_src} ${burp_generated_src_boot}) project_group (boot_burp Boot) -endif() # if (NOT CMAKE_CROSSCOMPILING) +endif() # (NOT CMAKE_CROSSCOMPILING) ######################################## @@ -360,11 +293,8 @@ if (APPLE) endif() add_library (common ${common_src} ${common_os_src} ${common_include}) -target_link_libraries (common ${LIB_mpr} libtommath libtomcrypt decNumber) +target_link_libraries (common ${LIB_mpr} ${LIB_tomcrypt} ${LIB_tommath} ${LIB_re2} ${LIB_dl} decNumber) add_dependencies_cc (common UpdateCloopInterfaces) -if (UNIX) -target_link_libraries (common dl) -endif() ################################################################################ @@ -390,24 +320,18 @@ set(yvalve_src ${yvalve_src} 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 UpdateCloopInterfaces) if (NOT CMAKE_CROSSCOMPILING) -add_library (boot_yvalve SHARED $ ${yvalve_generated_src_boot} ${VERSION_RC}) +add_library (boot_yvalve SHARED $) target_link_libraries (boot_yvalve PRIVATE remote PRIVATE common - PUBLIC ${LIB_Ws2_32} - PUBLIC ${LIB_readline} + PUBLIC ${LIB_ws2_32} + PUBLIC ${LIB_editline} PUBLIC ${LIB_dl} PUBLIC ${LIB_iconv} PUBLIC ${LIB_CoreFoundation} @@ -417,19 +341,19 @@ set_output_directory (boot_yvalve . CURRENT_DIR) set_output_directory_unix (boot_yvalve lib CURRENT_DIR) project_group (boot_yvalve Boot) -endif() # if (NOT CMAKE_CROSSCOMPILING) +endif() # (NOT CMAKE_CROSSCOMPILING) ######################################## # SHARED LIBRARY yvalve ######################################## -add_library (yvalve SHARED $ ${yvalve_generated_src_master} ${VERSION_RC}) +add_library (yvalve SHARED $ ${VERSION_RC}) target_link_libraries (yvalve PRIVATE remote PRIVATE common - PUBLIC ${LIB_Ws2_32} - PUBLIC ${LIB_readline} + PUBLIC ${LIB_ws2_32} + PUBLIC ${LIB_editline} PUBLIC ${LIB_dl} PUBLIC ${LIB_iconv} PUBLIC ${LIB_CoreFoundation} @@ -438,6 +362,7 @@ add_dependencies_cc (yvalve databases) set_exported_symbols (yvalve firebird) set_output_directory_unix (yvalve lib) set_target_properties (yvalve PROPERTIES OUTPUT_NAME fbclient) +set_target_properties (yvalve PROPERTIES RC_FLAGS -DRC_TARGET_fbclient) ######################################## @@ -483,21 +408,29 @@ set(engine_generated_src add_epp_suffix(engine_generated_src boot) add_epp_suffix(engine_generated_src master) -file(GLOB_RECURSE engine_include "dsql/*.h" "jrd/*.h" include/gen/iberror.h) +file(GLOB_RECURSE engine_include "dsql/*.h" "jrd/*.h" include/iberror.h) add_library (engine_common ${engine_src} ${engine_include} ${parse_src}) +target_link_libraries (engine_common libcds) add_dependencies_cc (engine_common parse UpdateCloopInterfaces) if (NOT CMAKE_CROSSCOMPILING) -add_library (boot_engine SHARED ${engine_generated_src_boot} ${VERSION_RC}) +add_library (boot_engine SHARED ${engine_generated_src_boot}) target_link_libraries (boot_engine engine_common boot_alice boot_burp common boot_yvalve) set_output_directory (boot_engine plugins CURRENT_DIR) set_exported_symbols (boot_engine fbplugin) copy_and_rename_lib (boot_engine Engine14) project_group (boot_engine Boot) -endif() # if (NOT CMAKE_CROSSCOMPILING) +if (MINGW) + add_custom_command(TARGET boot_engine POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory ${output_dir}/share/firebird/plugins + COMMAND ${CMAKE_COMMAND} -E copy_if_different plugins/Engine14.dll ${output_dir}/share/firebird/plugins/engine14.dll + ) +endif() + +endif() # (NOT CMAKE_CROSSCOMPILING) ######################################## @@ -507,9 +440,17 @@ endif() # if (NOT CMAKE_CROSSCOMPILING) add_library (engine SHARED ${engine_generated_src_master} ${VERSION_RC}) target_link_libraries (engine engine_common alice burp common yvalve) set_target_properties (engine PROPERTIES OUTPUT_NAME Engine14) +set_target_properties (engine PROPERTIES RC_FLAGS -DRC_TARGET_engine14) set_output_directory (engine plugins) set_exported_symbols (engine fbplugin) +if (MINGW) + add_custom_command(TARGET engine POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${output_dir}/plugins/Engine14.dll ${output_dir}/share/firebird/plugins/engine14.dll + COMMAND ${CMAKE_COMMAND} -E remove ${output_dir}/plugins/Engine14.dll + ) +endif() + ############################################################################### # SHARED LIBRARY intl @@ -520,8 +461,15 @@ 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_target_properties (intl PROPERTIES RC_FLAGS -DRC_TARGET_fbintl) set_output_directory (intl intl) +if (MINGW) + add_custom_command(TARGET intl POST_BUILD + COMMAND ${CMAKE_COMMAND} -E make_directory ${output_dir}/share/firebird/intl + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${output_dir}/intl/fbintl.dll ${output_dir}/share/firebird/intl/fbintl.dll + ) +endif() ######################################## # SHARED LIBRARY ib_util @@ -529,11 +477,12 @@ set_output_directory (intl intl) add_library (ib_util SHARED extlib/ib_util.cpp ${VERSION_RC}) set_exported_symbols (ib_util ib_util) +set_target_properties (ib_util PROPERTIES RC_FLAGS -DRC_TARGET_ib_util) set_output_directory_unix (ib_util lib) ######################################## -# SHARED LIBRARY legacy_usermanager +# SHARED LIBRARY PLUGIN legacy_usermanager ######################################## set(legacy_usermanager_generated_src @@ -544,41 +493,92 @@ 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_target_properties (legacy_usermanager PROPERTIES RC_FLAGS -DRC_TARGET_legacy_usermanager) +add_dependencies_cc (legacy_usermanager engine) set_output_directory (legacy_usermanager plugins) set_exported_symbols (legacy_usermanager fbplugin) ######################################## -# SHARED LIBRARY udr_engine +# SHARED LIBRARY PLUGIN chacha ######################################## -set(udr_engine_src - plugins/udr_engine/UdrEngine.cpp +add_library (chacha SHARED plugins/crypt/chacha/ChaCha.cpp ${VERSION_RC}) +target_link_libraries (chacha common yvalve) +set_target_properties (chacha PROPERTIES OUTPUT_NAME ChaCha) +set_target_properties (chacha PROPERTIES RC_FLAGS -DRC_TARGET_chacha) +set_output_directory (chacha plugins) +set_exported_symbols (chacha fbplugin) + + +######################################## +# SHARED LIBRARY PLUGIN default_profiler +######################################## + +add_library (default_profiler SHARED plugins/profiler/Profiler.cpp ${VERSION_RC}) +target_link_libraries (default_profiler common yvalve) +set_target_properties (default_profiler PROPERTIES OUTPUT_NAME Default_Profiler) +set_target_properties (default_profiler PROPERTIES RC_FLAGS -DRC_TARGET_default_profiler) +set_output_directory (default_profiler plugins) +set_exported_symbols (default_profiler fbplugin) + + +######################################## +# SHARED LIBRARY PLUGIN udf_compat +######################################## + +set(udf_compat_sql_src + ${CMAKE_CURRENT_SOURCE_DIR}/extlib/UdfBackwardCompatibility.sql +) + +add_library (udf_compat SHARED extlib/UdfBackwardCompatibility.cpp ${VERSION_RC}) +target_link_libraries (udf_compat ib_util) +set_target_properties (udf_compat PROPERTIES RC_FLAGS -DRC_TARGET_udf_compat) +set_output_directory (udf_compat plugins/udr) +set_exported_symbols (udf_compat fbplugin) + +add_custom_command(TARGET udf_compat POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${udf_compat_sql_src} ${output_dir}/plugins/udr/udf_compat.sql ) -add_library (udr_engine SHARED ${udr_engine_src} ${VERSION_RC}) + +######################################## +# SHARED LIBRARY PLUGIN udr_engine +######################################## + +add_library (udr_engine SHARED plugins/udr_engine/UdrEngine.cpp ${VERSION_RC}) target_link_libraries (udr_engine common yvalve) +set_target_properties (udr_engine PROPERTIES RC_FLAGS -DRC_TARGET_udr_engine) set_output_directory (udr_engine plugins) set_exported_symbols (udr_engine fbplugin) ######################################## -# SHARED LIBRARY srp +# SHARED LIBRARY PLUGIN srp ######################################## add_library (srp SHARED auth/SecureRemotePassword/manage/SrpManagement.cpp ${VERSION_RC}) target_link_libraries (srp remote common yvalve) set_target_properties (srp PROPERTIES OUTPUT_NAME Srp) +set_target_properties (srp PROPERTIES RC_FLAGS -DRC_TARGET_srp) set_output_directory (srp plugins) set_exported_symbols (srp fbplugin) ######################################## -# SHARED LIBRARY legacy_auth +# SHARED LIBRARY PLUGIN legacy_auth ######################################## -add_library (legacy_auth SHARED auth/SecurityDatabase/LegacyServer.cpp ${VERSION_RC}) +set(legacy_auth_src + auth/SecurityDatabase/LegacyServer.cpp +) +add_src_win32(legacy_auth_src + auth/SecDbCache.cpp +) + +add_library (legacy_auth SHARED ${legacy_auth_src} ${VERSION_RC}) target_link_libraries (legacy_auth common yvalve) set_target_properties (legacy_auth PROPERTIES OUTPUT_NAME Legacy_Auth) +set_target_properties (legacy_auth PROPERTIES RC_FLAGS -DRC_TARGET_legacy_auth) set_output_directory (legacy_auth plugins) set_exported_symbols (legacy_auth fbplugin) @@ -601,11 +601,12 @@ set(gpre_boot_src if (NOT CMAKE_CROSSCOMPILING) add_executable (gpre_boot ${gpre_boot_src} ${VERSION_RC}) -target_link_libraries (gpre_boot gpre_common common ${LIB_iconv} ${LIB_Ws2_32} ${LIB_dl}) +target_link_libraries (gpre_boot gpre_common common ${LIB_iconv} ${LIB_ws2_32} ${LIB_dl}) +set_target_properties (gpre_boot PROPERTIES RC_FLAGS -DRC_TARGET_gpre_boot) set_output_directory (gpre_boot . CURRENT_DIR) project_group (gpre_boot Boot) -endif() # if (NOT CMAKE_CROSSCOMPILING) +endif() # (NOT CMAKE_CROSSCOMPILING) ######################################## @@ -620,12 +621,12 @@ add_epp_suffix(gpre_generated_src master) if (NOT CMAKE_CROSSCOMPILING) -add_executable (boot_gpre ${gpre_generated_src_boot} ${VERSION_RC}) +add_executable (boot_gpre ${gpre_generated_src_boot}) target_link_libraries (boot_gpre gpre_common common boot_yvalve) set_output_directory (boot_gpre . CURRENT_DIR) project_group (boot_gpre Boot) -endif() # if (NOT CMAKE_CROSSCOMPILING) +endif() # (NOT CMAKE_CROSSCOMPILING) ######################################## @@ -634,45 +635,18 @@ endif() # if (NOT CMAKE_CROSSCOMPILING) add_executable (gpre ${gpre_generated_src_master} ${VERSION_RC}) target_link_libraries (gpre gpre_common common yvalve) +set_target_properties (gpre PROPERTIES RC_FLAGS -DRC_TARGET_gpre) ######################################## # 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 boot_yvalve) +add_executable (build_msg msgs/build_file.cpp ${VERSION_RC}) +set_target_properties (build_msg PROPERTIES RC_FLAGS -DRC_TARGET_build_msg) set_output_directory (build_msg . CURRENT_DIR) project_group (build_msg Boot) -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 boot_yvalve) -set_output_directory (codes . CURRENT_DIR) -project_group (codes Boot) - -endif() # if (NOT CMAKE_CROSSCOMPILING) - ######################################## # EXECUTABLE gstat @@ -692,6 +666,7 @@ add_epp_suffix(gstat_generated_src master) add_executable (gstat ${gstat_src} ${gstat_generated_src_master} ${VERSION_RC}) target_link_libraries (gstat common yvalve) add_dependencies_cc (gstat engine) +set_target_properties (gstat PROPERTIES RC_FLAGS -DRC_TARGET_gstat) ######################################## @@ -700,6 +675,7 @@ add_dependencies_cc (gstat engine) add_executable (fb_lock_print lock/print.cpp ${VERSION_RC}) target_link_libraries (fb_lock_print common yvalve) +set_target_properties (fb_lock_print PROPERTIES RC_FLAGS -DRC_TARGET_fb_lock_print) ######################################## @@ -720,6 +696,8 @@ add_src_unix(fbguard_src add_executable (fbguard WIN32 ${fbguard_src}) target_link_libraries (fbguard common yvalve ${LIB_comctl32} ${LIB_version}) +set_target_properties (fbguard PROPERTIES LINK_FLAGS -mwindows) +set_target_properties (fbguard PROPERTIES RC_FLAGS -DRC_TARGET_fbguard) ######################################## @@ -733,6 +711,7 @@ set(fbtracemgr_src add_executable (fbtracemgr ${fbtracemgr_src} ${VERSION_RC}) target_link_libraries (fbtracemgr common yvalve) +set_target_properties (fbtracemgr PROPERTIES RC_FLAGS -DRC_TARGET_fbtracemgr) ######################################## @@ -741,12 +720,12 @@ target_link_libraries (fbtracemgr common yvalve) if (NOT CMAKE_CROSSCOMPILING) -add_executable (boot_gfix alice/main/aliceMain.cpp ${VERSION_RC}) +add_executable (boot_gfix alice/main/aliceMain.cpp) target_link_libraries (boot_gfix boot_alice common boot_yvalve) set_output_directory (boot_gfix . CURRENT_DIR) project_group (boot_gfix Boot) -endif() # if (NOT CMAKE_CROSSCOMPILING) +endif() # (NOT CMAKE_CROSSCOMPILING) ######################################## @@ -755,7 +734,7 @@ endif() # if (NOT CMAKE_CROSSCOMPILING) add_executable (gfix alice/main/aliceMain.cpp ${VERSION_RC}) target_link_libraries (gfix alice common yvalve) - +set_target_properties (gfix PROPERTIES RC_FLAGS -DRC_TARGET_gfix) ######################################## # EXECUTABLE boot_gbak @@ -765,12 +744,12 @@ file(GLOB gbak_include "burp/*.h") if (NOT CMAKE_CROSSCOMPILING) -add_executable (boot_gbak burp/main/burpMain.cpp ${gbak_include} ${VERSION_RC}) +add_executable (boot_gbak burp/main/burpMain.cpp ${gbak_include}) target_link_libraries (boot_gbak boot_burp common boot_yvalve) set_output_directory (boot_gbak . CURRENT_DIR) project_group (boot_gbak Boot) -endif() # if (NOT CMAKE_CROSSCOMPILING) +endif() # (NOT CMAKE_CROSSCOMPILING) ######################################## @@ -779,6 +758,7 @@ endif() # if (NOT CMAKE_CROSSCOMPILING) add_executable (gbak burp/main/burpMain.cpp ${gbak_include} ${VERSION_RC}) target_link_libraries (gbak burp common yvalve) +set_target_properties (gbak PROPERTIES RC_FLAGS -DRC_TARGET_gbak) ######################################## @@ -787,6 +767,7 @@ target_link_libraries (gbak burp common yvalve) add_executable (gsplit burp/split/spit.cpp burp/split/spit.h ${VERSION_RC}) target_link_libraries (gsplit burp common yvalve) +set_target_properties (gsplit PROPERTIES RC_FLAGS -DRC_TARGET_gsplit) ######################################## @@ -805,14 +786,14 @@ add_epp_suffix(isql_generated_src master) if (NOT CMAKE_CROSSCOMPILING) -add_executable (boot_isql ${isql_src} ${isql_generated_src_boot} ${VERSION_RC}) +add_executable (boot_isql ${isql_src} ${isql_generated_src_boot}) target_link_libraries (boot_isql common boot_yvalve) set_output_directory (boot_isql . CURRENT_DIR) project_group (boot_isql Boot) -endif() # if (NOT CMAKE_CROSSCOMPILING) +endif() # (NOT CMAKE_CROSSCOMPILING) -if (WIN32) +if (MSVC) add_custom_command( TARGET boot_isql POST_BUILD @@ -856,6 +837,8 @@ endif() add_executable (isql ${isql_src} ${isql_generated_src_master} ${VERSION_RC}) target_link_libraries (isql common yvalve) +set_target_properties (isql PROPERTIES LINK_FLAGS -mwindows) +set_target_properties (isql PROPERTIES RC_FLAGS -DRC_TARGET_isql) ################################################################################ @@ -875,7 +858,7 @@ add_subdirectory("utilities") ############################################################################### add_custom_target(copy_files - #ALL # uncomment this to copy files every build + ALL # databases COMMAND ${CMAKE_COMMAND} -E copy_if_different ${GENERATED_DIR}/security.fdb ${output_dir}/security6.fdb # configs, text files @@ -883,6 +866,7 @@ add_custom_target(copy_files COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/builds/install/misc/databases.conf ${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/replication.conf ${output_dir}/replication.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 @@ -894,7 +878,6 @@ add_custom_target(copy_files 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 @@ -904,7 +887,10 @@ add_custom_target(copy_files 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/include/gen/iberror.h ${output_dir}/include/iberror.h + 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/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 + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/src/include/firebird/FirebirdInterface.idl ${output_dir}/include/firebird/FirebirdInterface.idl ) add_dependencies_cc (copy_files databases) add_dependencies_unix_cc(copy_files makeHeader) @@ -958,30 +944,8 @@ if (WIN32) 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 + COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_SOURCE_DIR}/src/include/firebird/impl ${output_dir}/include/firebird/impl + COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_SOURCE_DIR}/src/include/ibase.h ${output_dir}/include/ibase.h ) endif() @@ -1016,7 +980,7 @@ if (UNIX) COMMAND makeHeader < ibase.h > ${output_dir}/include/ibase.h ) - endif() # if (NOT CMAKE_CROSSCOMPILING) + endif() # (NOT CMAKE_CROSSCOMPILING) endif() diff --git a/src/gpre/CMakeLists.txt b/src/gpre/CMakeLists.txt index 99a726c4151..068e08e6c93 100644 --- a/src/gpre/CMakeLists.txt +++ b/src/gpre/CMakeLists.txt @@ -19,13 +19,3 @@ add_src_win32(gpre_common_src add_library (gpre_common ${gpre_common_src}) add_dependencies_cc (gpre_common UpdateCloopInterfaces) - -############################################################################### -# 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/remote/CMakeLists.txt b/src/remote/CMakeLists.txt index 8c2fdc6e1be..9c1573c3714 100644 --- a/src/remote/CMakeLists.txt +++ b/src/remote/CMakeLists.txt @@ -14,17 +14,17 @@ set(remote_src ../auth/SecureRemotePassword/srp.cpp ../auth/SecureRemotePassword/srp.h ../auth/SecureRemotePassword/Message.h - ../auth/trusted/AuthSspi.cpp ) add_src_win32(remote_src + ../auth/trusted/AuthSspi.cpp 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}) -add_dependencies_cc (remote UpdateCloopInterfaces) +add_library (remote ${remote_src} ${remote_include}) +add_dependencies_cc (remote UpdateCloopInterfaces) ############################################################################### @@ -36,6 +36,7 @@ set(fbserver_src ../auth/SecureRemotePassword/server/SrpServer.h ) add_src_win32(fbserver_src + ../auth/SecDbCache.cpp server/os/win32/chop.cpp server/os/win32/cntl.cpp server/os/win32/property.cpp @@ -62,3 +63,5 @@ add_src_unix(fbserver_src add_executable (fbserver WIN32 ${fbserver_src}) target_link_libraries (fbserver remote common yvalve engine_common ${LIB_comctl32}) set_target_properties (fbserver PROPERTIES OUTPUT_NAME firebird) +set_target_properties (fbserver PROPERTIES LINK_FLAGS -mwindows) +set_target_properties (fbserver PROPERTIES RC_FLAGS -DRC_TARGET_firebird) diff --git a/src/utilities/CMakeLists.txt b/src/utilities/CMakeLists.txt index 2330750baee..a7ffa6e8829 100644 --- a/src/utilities/CMakeLists.txt +++ b/src/utilities/CMakeLists.txt @@ -6,6 +6,7 @@ include(SourceGroups) add_executable (fbsvcmgr fbsvcmgr/fbsvcmgr.cpp ${VERSION_RC}) target_link_libraries (fbsvcmgr common yvalve) +set_target_properties (fbsvcmgr PROPERTIES RC_FLAGS -DRC_TARGET_fbsvcmgr) ############################################################################### # EXECUTABLE nbackup @@ -20,6 +21,7 @@ file(GLOB nbackup_include "nbackup/*.h") add_executable (nbackup ${nbackup_src} ${nbackup_include} ${VERSION_RC}) target_link_libraries (nbackup common yvalve) +set_target_properties (nbackup PROPERTIES RC_FLAGS -DRC_TARGET_nbackup) ############################################################################### @@ -35,6 +37,7 @@ set(gsec_src add_executable (gsec ${gsec_src} ${VERSION_RC}) target_link_libraries (gsec common yvalve) +set_target_properties (gsec PROPERTIES RC_FLAGS -DRC_TARGET_gsec) ############################################################################### @@ -58,6 +61,7 @@ add_library (fbtrace SHARED ${fbtrace_src} ${fbtrace_os_src} ${fbtra target_link_libraries (fbtrace common yvalve) set_output_directory (fbtrace plugins) set_exported_symbols (fbtrace fbplugin) +set_target_properties (fbtrace PROPERTIES RC_FLAGS -DRC_TARGET_fbtrace) ############################################################################### @@ -74,6 +78,7 @@ if (WIN32) install/regis_proto.h ) add_executable (instreg ${instreg_src} ${VERSION_RC}) + set_target_properties (instreg PROPERTIES RC_FLAGS -DRC_TARGET_instreg) ########################################################################### # EXECUTABLE instsvc @@ -86,6 +91,7 @@ if (WIN32) ) add_executable (instsvc ${instsvc_src} ${VERSION_RC}) target_link_libraries (instsvc common yvalve) + set_target_properties (instsvc PROPERTIES RC_FLAGS -DRC_TARGET_instsvc) ########################################################################### # EXECUTABLE instclient @@ -98,4 +104,5 @@ if (WIN32) ) add_executable (instclient ${instclient_src} ${VERSION_RC}) target_link_libraries (instclient version) + set_target_properties (instclient PROPERTIES RC_FLAGS -DRC_TARGET_instclient) endif(WIN32)