8
0
mirror of https://github.com/FirebirdSQL/firebird.git synced 2025-01-22 23:23:02 +01:00

Improve Qt+MSVC build. Fix some messages. Crosscompiling improvements (add some defines).

This commit is contained in:
egorpugin 2015-01-27 14:37:59 +00:00
parent 69cdd58f19
commit 0c20b47e2c
5 changed files with 67 additions and 38 deletions

View File

@ -2,18 +2,18 @@
# firebird (trunk) # firebird (trunk)
# #
############################################################################### ################################################################################
# #
# cmake settings # cmake settings
# #
############################################################################### ################################################################################
cmake_minimum_required(VERSION 2.8.8) cmake_minimum_required(VERSION 2.8.8)
# In-source builds are not possible and so disabled. # In-source builds are not possible and so disabled.
if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR}) if (${CMAKE_SOURCE_DIR} STREQUAL ${CMAKE_BINARY_DIR})
message(FATAL_ERROR message(FATAL_ERROR
"CMake generation for firebird is not possible within the source directory!" "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 Remove the CMakeCache.txt file and try again from another folder, e.g.:"
"\n " "\n "
"\n rm CMakeCache.txt" "\n rm CMakeCache.txt"
@ -35,15 +35,36 @@ endif()
set_property(GLOBAL PROPERTY USE_FOLDERS ON) set_property(GLOBAL PROPERTY USE_FOLDERS ON)
set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake Targets") set_property(GLOBAL PROPERTY PREDEFINED_TARGETS_FOLDER "CMake Targets")
############################################################################### ################################################################################
# #
# project settings # project settings
# #
############################################################################### ################################################################################
project("firebird" C CXX) project("firebird" C CXX)
####################################### ########################################
# build type settings
########################################
# Define build mode
if (NOT DEFINED CMAKE_BUILD_TYPE OR "${CMAKE_BUILD_TYPE}" STREQUAL "")
set(CMAKE_BUILD_TYPE Release CACHE STRING "Choose the type of build.")
endif()
# Qt with MSVC does not have multiconfiguration option by default,
# so we create it.
set(DEFAULT_CONFIGURATION)
# Set build types if none was specified
if (NOT DEFINED CMAKE_CONFIGURATION_TYPES)
set(CMAKE_CONFIGURATION_TYPES Debug Release MinSizeRel RelWithDebInfo)
set(DEFAULT_CONFIGURATION ${CMAKE_BUILD_TYPE})
endif()
########################################
# Output directory settings
########################################
set(output_dir ${CMAKE_BINARY_DIR}/${PROJECT_NAME}) set(output_dir ${CMAKE_BINARY_DIR}/${PROJECT_NAME})
@ -54,6 +75,13 @@ if (MSVC OR XCODE)
set(output_dir ${output_dir}/$<CONFIG>) set(output_dir ${output_dir}/$<CONFIG>)
endif() endif()
if (MSVC AND DEFAULT_CONFIGURATION)
foreach(conf ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${conf} conf2)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY_${conf2} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${DEFAULT_CONFIGURATION})
endforeach()
endif()
if (XCODE) if (XCODE)
foreach(conf ${CMAKE_CONFIGURATION_TYPES}) foreach(conf ${CMAKE_CONFIGURATION_TYPES})
string(TOUPPER ${conf} conf2) string(TOUPPER ${conf} conf2)
@ -64,11 +92,11 @@ elseif (UNIX)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${output_dir}/bin) set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${output_dir}/bin)
endif() endif()
############################################################################### ################################################################################
# #
# configure # configure
# #
############################################################################### ################################################################################
include(Configure) include(Configure)
@ -93,11 +121,11 @@ set(AUTOCONFIG_SRC ${CMAKE_SOURCE_DIR}/src/include/gen/autoconfig.h.in)
set(AUTOCONFIG ${CMAKE_BINARY_DIR}/src/include/gen/autoconfig.h) set(AUTOCONFIG ${CMAKE_BINARY_DIR}/src/include/gen/autoconfig.h)
configure_file(${AUTOCONFIG_SRC} ${AUTOCONFIG} @ONLY) configure_file(${AUTOCONFIG_SRC} ${AUTOCONFIG} @ONLY)
############################################################################### ################################################################################
# #
# compiler & linker # compiler & linker
# #
############################################################################### ################################################################################
add_definitions(-DDEV_BUILD) add_definitions(-DDEV_BUILD)
@ -175,11 +203,11 @@ elseif (UNIX)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pthread")
endif() endif()
############################################################################### ################################################################################
# #
# pre build # pre build
# #
############################################################################### ################################################################################
if (WIN32) if (WIN32)
# icu # icu
@ -228,12 +256,11 @@ if (UNIX)
endforeach() endforeach()
endif() endif()
################################################################################
###############################################################################
# #
# build # build
# #
############################################################################### ################################################################################
include(BuildFunctions) include(BuildFunctions)
@ -272,10 +299,12 @@ file(GLOB libtommath_src "extern/libtommath/*.c" "extern/libtommath/*.h")
add_library (libtommath ${libtommath_src}) add_library (libtommath ${libtommath_src})
project_group (libtommath Extern) project_group (libtommath Extern)
########################################
# subdirectories
######################################## ########################################
add_subdirectory("examples") add_subdirectory("examples")
add_subdirectory("src") add_subdirectory("src")
############################################################################### ################################################################################

View File

@ -27,7 +27,7 @@ function(set_output_directory target dir)
set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${conf2} ${out}/${conf}/${dir}) set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY_${conf2} ${out}/${conf}/${dir})
endforeach() endforeach()
else() # single configuration else() # single configuration
execute_process(COMMAND ${CMAKE_COMMAND} -E make_directory ${out}/${dir}) add_custom_command(TARGET ${target} PRE_BUILD COMMAND ${CMAKE_COMMAND} -E make_directory ${out}/${dir})
set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${out}/${dir}) set_target_properties(${target} PROPERTIES LIBRARY_OUTPUT_DIRECTORY ${out}/${dir})
set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${out}/${dir}) set_target_properties(${target} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${out}/${dir})
endif() endif()

View File

@ -40,8 +40,8 @@ endfunction(check_functions)
function(check_type_alignment type var) function(check_type_alignment type var)
if (NOT DEFINED ${var}) if (NOT DEFINED ${var})
check_c_source_runs("main(){struct s{char a;${type} b;};exit((int)&((struct s*)0)->b);}" ${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(STATUS "Performing Test ${var} - It's still OK.")
message("-- Performing Test ${var} - Success") message(STATUS "Performing Test ${var} - Success")
set(${var} ${${var}_EXITCODE} CACHE STRING "${type} alignment" FORCE) set(${var} ${${var}_EXITCODE} CACHE STRING "${type} alignment" FORCE)
endif() endif()
endfunction(check_type_alignment) endfunction(check_type_alignment)

View File

@ -92,18 +92,22 @@ epp_process(master epp_master_files boot_gpre -n -m)
# BUILD STEP databases # BUILD STEP databases
######################################## ########################################
set(databases_src set(msgs_src
${CMAKE_CURRENT_SOURCE_DIR}/dbs/security.sql
${CMAKE_CURRENT_SOURCE_DIR}/msgs/facilities2.sql ${CMAKE_CURRENT_SOURCE_DIR}/msgs/facilities2.sql
${CMAKE_CURRENT_SOURCE_DIR}/msgs/history2.sql ${CMAKE_CURRENT_SOURCE_DIR}/msgs/history2.sql
${CMAKE_CURRENT_SOURCE_DIR}/msgs/locales.sql ${CMAKE_CURRENT_SOURCE_DIR}/msgs/locales.sql
${CMAKE_CURRENT_SOURCE_DIR}/msgs/messages2.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/sqlstates.sql
${CMAKE_CURRENT_SOURCE_DIR}/msgs/symbols2.sql ${CMAKE_CURRENT_SOURCE_DIR}/msgs/symbols2.sql
${CMAKE_CURRENT_SOURCE_DIR}/msgs/system_errors2.sql ${CMAKE_CURRENT_SOURCE_DIR}/msgs/system_errors2.sql
${CMAKE_CURRENT_SOURCE_DIR}/msgs/transmsgs.de_DE2.sql ${CMAKE_CURRENT_SOURCE_DIR}/msgs/transmsgs.de_DE2.sql
${CMAKE_CURRENT_SOURCE_DIR}/msgs/transmsgs.fr_FR2.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( add_custom_command(
OUTPUT security.fdb OUTPUT security.fdb
DEPENDS DEPENDS
@ -112,8 +116,8 @@ add_custom_command(
VERBATIM VERBATIM
# #
COMMAND ${CMAKE_COMMAND} -E remove security3.fdb COMMAND ${CMAKE_COMMAND} -E remove security3.fdb
COMMAND ${CMAKE_COMMAND} -E echo "create database 'security3.fdb';" > create_db.sql COMMAND ${CMAKE_COMMAND} -E echo "create database 'security3.fdb';" > create_db_security3.sql
COMMAND boot_isql -q -i create_db.sql COMMAND boot_isql -q -i create_db_security3.sql
COMMAND boot_isql -q security3.fdb -i ${CMAKE_CURRENT_SOURCE_DIR}/dbs/security.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 COMMAND ${CMAKE_COMMAND} -E copy_if_different security3.fdb security.fdb
) )
@ -132,21 +136,11 @@ add_custom_command(
VERBATIM VERBATIM
DEPENDS DEPENDS
boot_isql boot_isql
metadata.fdb ${msgs_src}
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 remove msg.fdb
COMMAND ${CMAKE_COMMAND} -E echo "create database 'msg.fdb';" > create_db.sql COMMAND ${CMAKE_COMMAND} -E echo "create database 'msg.fdb';" > create_db_msg.sql
COMMAND boot_isql -q -i create_db.sql COMMAND boot_isql -q -i create_db_msg.sql
COMMAND ${isql_exec_msg}/msg.sql COMMAND ${isql_exec_msg}/msg.sql
# #
COMMAND echo loading facilities COMMAND echo loading facilities
@ -774,7 +768,7 @@ if (WIN32)
COMMAND ${CMAKE_COMMAND} -E copy ${CMAKE_SOURCE_DIR}/extern/icu/icudt52l_empty.dat ${output_dir}/icudt52l_empty.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) string(FIND "${CMAKE_EXE_LINKER_FLAGS}" "/machine:x64" arch)
if (NOT ${arch} EQUAL -1) if (NOT ${arch} EQUAL -1)
set(arch "x64") set(arch "x64")
else() else()

View File

@ -45,6 +45,9 @@
/* Define this if OS is AIX */ /* Define this if OS is AIX */
#cmakedefine AIX 1 #cmakedefine AIX 1
/* Define this if OS is ANDROID */
#cmakedefine ANDROID 1
/* Define this if OS is DARWIN */ /* Define this if OS is DARWIN */
#cmakedefine DARWIN 1 #cmakedefine DARWIN 1
@ -54,6 +57,9 @@
/* Define this if OS is HP-UX */ /* Define this if OS is HP-UX */
#cmakedefine HPUX 1 #cmakedefine HPUX 1
/* Define this if OS is iOS */
#cmakedefine IOS 1
/* Define this if OS is Linux */ /* Define this if OS is Linux */
#cmakedefine LINUX 1 #cmakedefine LINUX 1