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

Add cloop to CMake build.

This commit is contained in:
egorpugin 2015-04-07 10:08:58 +00:00
parent 5662729e6e
commit 0e02f91a72
5 changed files with 110 additions and 73 deletions

View File

@ -323,6 +323,15 @@ include_directories("src/include/gen")
include_directories("${CMAKE_CURRENT_BINARY_DIR}/src/include") include_directories("${CMAKE_CURRENT_BINARY_DIR}/src/include")
include_directories("${CMAKE_CURRENT_BINARY_DIR}/src/include/gen") include_directories("${CMAKE_CURRENT_BINARY_DIR}/src/include/gen")
########################################
# LIBRARY libtommath
########################################
file(GLOB libtommath_src "extern/libtommath/*.c" "extern/libtommath/*.h")
add_library (libtommath ${libtommath_src})
project_group (libtommath Extern)
######################################## ########################################
# EXECUTABLE btyacc # EXECUTABLE btyacc
######################################## ########################################
@ -337,15 +346,14 @@ set_output_directory (btyacc . CURRENT_DIR)
endif() # if (NOT CMAKE_CROSSCOMPILING) endif() # if (NOT CMAKE_CROSSCOMPILING)
######################################## ########################################
# LIBRARY btyacc # EXECUTABLE cloop
######################################## ########################################
file(GLOB libtommath_src "extern/libtommath/*.c" "extern/libtommath/*.h") file(GLOB cloop_src "extern/cloop/src/cloop/*.cpp" "extern/cloop/src/cloop/*.h")
add_library (libtommath ${libtommath_src}) add_executable (cloop ${cloop_src})
project_group (libtommath Extern) project_group (cloop Extern)
######################################## ########################################
# subdirectories # subdirectories

View File

@ -1,12 +1,12 @@
############################################################################### ################################################################################
# #
# macros and functions # macros and functions
# #
############################################################################### ################################################################################
####################################### ########################################
# FUNCTION set_output_directory # FUNCTION set_output_directory
####################################### ########################################
function(set_output_directory target dir) function(set_output_directory target dir)
set(out ${output_dir}) set(out ${output_dir})
if (MSVC OR XCODE) # multiconfiguration builds if (MSVC OR XCODE) # multiconfiguration builds
@ -31,18 +31,18 @@ function(set_output_directory target dir)
endif() endif()
endfunction(set_output_directory) endfunction(set_output_directory)
####################################### ########################################
# FUNCTION set_output_directory_unix # FUNCTION set_output_directory_unix
####################################### ########################################
function(set_output_directory_unix target dir) function(set_output_directory_unix target dir)
if (UNIX) if (UNIX)
set_output_directory(${target} ${dir} ${ARGN}) set_output_directory(${target} ${dir} ${ARGN})
endif() endif()
endfunction(set_output_directory_unix) endfunction(set_output_directory_unix)
####################################### ########################################
# FUNCTION set_exported_symbols # FUNCTION set_exported_symbols
####################################### ########################################
if (WIN32) if (WIN32)
function(set_exported_symbols target filename) function(set_exported_symbols target filename)
set(def_file ${filename}.def) set(def_file ${filename}.def)
@ -79,9 +79,9 @@ if (UNIX)
endif(UNIX) endif(UNIX)
####################################### ########################################
# FUNCTION epp_process # FUNCTION epp_process
####################################### ########################################
function(epp_process type files) function(epp_process type files)
set(epp_suffix ".${type}.cpp") set(epp_suffix ".${type}.cpp")
@ -122,9 +122,9 @@ function(epp_process type files)
endforeach() endforeach()
endfunction(epp_process) endfunction(epp_process)
####################################### ########################################
# FUNCTION add_epp_suffix # FUNCTION add_epp_suffix
####################################### ########################################
function(add_epp_suffix files suffix) function(add_epp_suffix files suffix)
foreach(F ${${files}}) foreach(F ${${files}})
list(APPEND ${files}_${suffix} ${CMAKE_CURRENT_SOURCE_DIR}/${F}) list(APPEND ${files}_${suffix} ${CMAKE_CURRENT_SOURCE_DIR}/${F})
@ -134,72 +134,72 @@ function(add_epp_suffix files suffix)
set(${files}_${suffix} ${${files}_${suffix}} PARENT_SCOPE) set(${files}_${suffix} ${${files}_${suffix}} PARENT_SCOPE)
endfunction(add_epp_suffix) endfunction(add_epp_suffix)
####################################### ########################################
# FUNCTION set_win32 # FUNCTION set_win32
####################################### ########################################
function(set_win32 var) function(set_win32 var)
if (WIN32) if (WIN32)
set(${var} "${ARGN}" PARENT_SCOPE) set(${var} "${ARGN}" PARENT_SCOPE)
endif() endif()
endfunction(set_win32) endfunction(set_win32)
####################################### ########################################
# FUNCTION set_unix # FUNCTION set_unix
####################################### ########################################
function(set_unix var) function(set_unix var)
if (UNIX) if (UNIX)
set(${var} "${ARGN}" PARENT_SCOPE) set(${var} "${ARGN}" PARENT_SCOPE)
endif() endif()
endfunction(set_unix) endfunction(set_unix)
####################################### ########################################
# FUNCTION set_apple # FUNCTION set_apple
####################################### ########################################
function(set_apple var) function(set_apple var)
if (APPLE) if (APPLE)
set(${var} "${ARGN}" PARENT_SCOPE) set(${var} "${ARGN}" PARENT_SCOPE)
endif() endif()
endfunction(set_apple) endfunction(set_apple)
####################################### ########################################
# FUNCTION add_src_win32 # FUNCTION add_src_win32
####################################### ########################################
function(add_src_win32 var) function(add_src_win32 var)
if (WIN32) if (WIN32)
set(${var} ${${var}} ${ARGN} PARENT_SCOPE) set(${var} ${${var}} ${ARGN} PARENT_SCOPE)
endif() endif()
endfunction(add_src_win32) endfunction(add_src_win32)
####################################### ########################################
# FUNCTION add_src_unix # FUNCTION add_src_unix
####################################### ########################################
function(add_src_unix var) function(add_src_unix var)
if (UNIX) if (UNIX)
set(${var} ${${var}} ${ARGN} PARENT_SCOPE) set(${var} ${${var}} ${ARGN} PARENT_SCOPE)
endif() endif()
endfunction(add_src_unix) endfunction(add_src_unix)
####################################### ########################################
# FUNCTION add_src_unix_not_apple # FUNCTION add_src_unix_not_apple
####################################### ########################################
function(add_src_unix_not_apple var) function(add_src_unix_not_apple var)
if (UNIX AND NOT APPLE) if (UNIX AND NOT APPLE)
set(${var} ${${var}} ${ARGN} PARENT_SCOPE) set(${var} ${${var}} ${ARGN} PARENT_SCOPE)
endif() endif()
endfunction(add_src_unix_not_apple) endfunction(add_src_unix_not_apple)
####################################### ########################################
# FUNCTION add_src_apple # FUNCTION add_src_apple
####################################### ########################################
function(add_src_apple var) function(add_src_apple var)
if (APPLE) if (APPLE)
set(${var} ${${var}} ${ARGN} PARENT_SCOPE) set(${var} ${${var}} ${ARGN} PARENT_SCOPE)
endif() endif()
endfunction(add_src_apple) endfunction(add_src_apple)
####################################### ########################################
# FUNCTION copy_and_rename_lib # FUNCTION copy_and_rename_lib
####################################### ########################################
function(copy_and_rename_lib target name) function(copy_and_rename_lib target name)
set(name2 $<TARGET_FILE_DIR:${target}>/${CMAKE_SHARED_LIBRARY_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX}) set(name2 $<TARGET_FILE_DIR:${target}>/${CMAKE_SHARED_LIBRARY_PREFIX}${name}${CMAKE_SHARED_LIBRARY_SUFFIX})
add_custom_command( add_custom_command(
@ -209,16 +209,16 @@ function(copy_and_rename_lib target name)
) )
endfunction(copy_and_rename_lib) endfunction(copy_and_rename_lib)
####################################### ########################################
# FUNCTION project_group # FUNCTION project_group
####################################### ########################################
function(project_group target name) function(project_group target name)
set_target_properties(${target} PROPERTIES FOLDER ${name}) set_target_properties(${target} PROPERTIES FOLDER ${name})
endfunction(project_group) endfunction(project_group)
####################################### ########################################
# FUNCTION set_generated_directory # FUNCTION set_generated_directory
####################################### ########################################
function(set_generated_directory) function(set_generated_directory)
if (NOT CMAKE_CROSSCOMPILING) if (NOT CMAKE_CROSSCOMPILING)
set(GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE) set(GENERATED_DIR ${CMAKE_CURRENT_BINARY_DIR} PARENT_SCOPE)
@ -228,36 +228,36 @@ function(set_generated_directory)
endif() endif()
endfunction(set_generated_directory) endfunction(set_generated_directory)
####################################### ########################################
# FUNCTION add_dependencies_cc (cross compile) # FUNCTION add_dependencies_cc (cross compile)
####################################### ########################################
function(add_dependencies_cc target) function(add_dependencies_cc target)
if (NOT CMAKE_CROSSCOMPILING) if (NOT CMAKE_CROSSCOMPILING)
add_dependencies(${target} ${ARGN}) add_dependencies(${target} ${ARGN})
endif() endif()
endfunction(add_dependencies_cc) endfunction(add_dependencies_cc)
####################################### ########################################
# FUNCTION add_dependencies_unix_cc (cross compile) # FUNCTION add_dependencies_unix_cc (cross compile)
####################################### ########################################
function(add_dependencies_unix_cc target) function(add_dependencies_unix_cc target)
if (UNIX) if (UNIX)
add_dependencies_cc(${target} ${ARGN}) add_dependencies_cc(${target} ${ARGN})
endif() endif()
endfunction(add_dependencies_unix_cc) endfunction(add_dependencies_unix_cc)
####################################### ########################################
# FUNCTION crosscompile_prebuild_steps # FUNCTION crosscompile_prebuild_steps
####################################### ########################################
function(crosscompile_prebuild_steps) function(crosscompile_prebuild_steps)
if (CMAKE_CROSSCOMPILING) 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) 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() endif()
endfunction(crosscompile_prebuild_steps) endfunction(crosscompile_prebuild_steps)
####################################### ########################################
# FUNCTION create_command # FUNCTION create_command
####################################### ########################################
function(create_command command type out) function(create_command command type out)
set(dir ${output_dir}) set(dir ${output_dir})
if ("${type}" STREQUAL "boot") if ("${type}" STREQUAL "boot")
@ -307,9 +307,9 @@ function(create_command command type out)
set(${out} ${CMD}_CMD PARENT_SCOPE) set(${out} ${CMD}_CMD PARENT_SCOPE)
endfunction(create_command) endfunction(create_command)
####################################### ########################################
# FUNCTION create_boot_commands # FUNCTION create_boot_commands
####################################### ########################################
function(create_boot_commands) function(create_boot_commands)
set(cmd_list set(cmd_list
boot_isql boot_isql
@ -326,9 +326,9 @@ function(create_boot_commands)
endforeach() endforeach()
endfunction(create_boot_commands) endfunction(create_boot_commands)
####################################### ########################################
# FUNCTION create_master_commands # FUNCTION create_master_commands
####################################### ########################################
function(create_master_commands) function(create_master_commands)
set(cmd_list set(cmd_list
isql isql
@ -341,4 +341,4 @@ function(create_master_commands)
endforeach() endforeach()
endfunction(create_master_commands) endfunction(create_master_commands)
############################################################################### ################################################################################

View File

@ -1,12 +1,12 @@
############################################################################### ################################################################################
# #
# configure # configure
# #
############################################################################### ################################################################################
####################################### ########################################
# FUNCTION check_includes # FUNCTION check_includes
####################################### ########################################
function(check_includes files) function(check_includes files)
foreach(F ${${files}}) foreach(F ${${files}})
set(name ${F}) set(name ${F})
@ -20,9 +20,9 @@ function(check_includes files)
endforeach() endforeach()
endfunction(check_includes) endfunction(check_includes)
####################################### ########################################
# FUNCTION check_functions # FUNCTION check_functions
####################################### ########################################
function(check_functions functions) function(check_functions functions)
foreach(F ${${functions}}) foreach(F ${${functions}})
set(name ${F}) set(name ${F})
@ -34,9 +34,9 @@ function(check_functions functions)
endforeach() endforeach()
endfunction(check_functions) endfunction(check_functions)
####################################### ########################################
# FUNCTION check_type_alignment # FUNCTION check_type_alignment
####################################### ########################################
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})
@ -46,10 +46,11 @@ function(check_type_alignment type var)
endif() endif()
endfunction(check_type_alignment) endfunction(check_type_alignment)
####################################### ########################################
# FUNCTION check_symbol # FUNCTION check_symbol
####################################### ########################################
function(check_symbol symbol var) function(check_symbol symbol var)
if (NOT ${var}_SYMBOL)
foreach(f ${ARGN}) foreach(f ${ARGN})
if (NOT ${var}) if (NOT ${var})
unset(${var} CACHE) unset(${var} CACHE)
@ -57,9 +58,11 @@ function(check_symbol symbol var)
check_symbol_exists(${symbol} ${f} ${var}) check_symbol_exists(${symbol} ${f} ${var})
endif() endif()
endforeach() endforeach()
endif()
set(${var}_SYMBOL 1 CACHE INTERNAL "Do not check this symbol again")
endfunction(check_symbol) endfunction(check_symbol)
####################################### ########################################
include(CheckCSourceCompiles) include(CheckCSourceCompiles)
include(CheckCSourceRuns) include(CheckCSourceRuns)
@ -315,7 +318,7 @@ if (EXISTS "/proc/self/exe")
set(HAVE__PROC_SELF_EXE 1) set(HAVE__PROC_SELF_EXE 1)
endif() endif()
####################################### ########################################
if (NOT CMAKE_CROSSCOMPILING) if (NOT CMAKE_CROSSCOMPILING)
check_type_alignment(long FB_ALIGNMENT) check_type_alignment(long FB_ALIGNMENT)
@ -328,7 +331,7 @@ else() # CMAKE_CROSSCOMPILING
endif() endif()
endif() endif()
####################################### ########################################
if (WIN32) if (WIN32)
set(ENABLE_BINRELOC 0) set(ENABLE_BINRELOC 0)
@ -342,4 +345,4 @@ if (APPLE)
set(CASE_SENSITIVITY "false") set(CASE_SENSITIVITY "false")
endif() endif()
############################################################################### ################################################################################

View File

@ -91,6 +91,7 @@ project_group (udrcpp_example Examples)
add_library (dbcrypt_example SHARED dbcrypt/DbCrypt.cpp) add_library (dbcrypt_example SHARED dbcrypt/DbCrypt.cpp)
set_target_properties (dbcrypt_example PROPERTIES OUTPUT_NAME DbCrypt_example) set_target_properties (dbcrypt_example PROPERTIES OUTPUT_NAME DbCrypt_example)
set_output_directory (dbcrypt_example plugins) set_output_directory (dbcrypt_example plugins)
add_dependencies_cc (dbcrypt_example UpdateCloopInterfaces)
project_group (dbcrypt_example Examples) project_group (dbcrypt_example Examples)
@ -101,6 +102,7 @@ project_group (dbcrypt_example Examples)
add_library (cryptkeyholder_example SHARED dbcrypt/CryptKeyHolder.cpp) add_library (cryptkeyholder_example SHARED dbcrypt/CryptKeyHolder.cpp)
set_target_properties (cryptkeyholder_example PROPERTIES OUTPUT_NAME CryptKeyHolder_example) set_target_properties (cryptkeyholder_example PROPERTIES OUTPUT_NAME CryptKeyHolder_example)
set_output_directory (cryptkeyholder_example plugins) set_output_directory (cryptkeyholder_example plugins)
add_dependencies_cc (cryptkeyholder_example UpdateCloopInterfaces)
project_group (cryptkeyholder_example Examples) project_group (cryptkeyholder_example Examples)
############################################################################### ###############################################################################

View File

@ -269,6 +269,29 @@ add_custom_target(parse
project_group(parse "Boot/Custom build steps") project_group(parse "Boot/Custom build steps")
set_source_files_properties(dsql/parse.cpp include/gen/parse.h PROPERTIES GENERATED TRUE) set_source_files_properties(dsql/parse.cpp include/gen/parse.h PROPERTIES GENERATED TRUE)
########################################
# BUILD_STEP UpdateCloopInterfaces
########################################
add_custom_command(
OUTPUT ${CMAKE_CURRENT_SOURCE_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
IDL_FB_INTERFACES_H Firebird I
COMMENT "Updating cloop interfaces..."
)
add_custom_target(UpdateCloopInterfaces
DEPENDS ${CMAKE_CURRENT_SOURCE_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() # if (NOT CMAKE_CROSSCOMPILING)
@ -348,6 +371,7 @@ endif()
add_library (common ${common_src} ${common_os_src} ${common_include}) add_library (common ${common_src} ${common_os_src} ${common_include})
target_link_libraries (common ${LIB_mpr}) target_link_libraries (common ${LIB_mpr})
add_dependencies_cc (common UpdateCloopInterfaces)
################################################################################ ################################################################################
@ -381,7 +405,7 @@ add_epp_suffix(yvalve_generated_src boot)
add_epp_suffix(yvalve_generated_src master) add_epp_suffix(yvalve_generated_src master)
add_library (yvalve_common OBJECT ${yvalve_src} ${yvalve_include}) add_library (yvalve_common OBJECT ${yvalve_src} ${yvalve_include})
add_dependencies_cc (yvalve_common parse) add_dependencies_cc (yvalve_common parse UpdateCloopInterfaces)
if (NOT CMAKE_CROSSCOMPILING) if (NOT CMAKE_CROSSCOMPILING)
@ -470,7 +494,7 @@ add_epp_suffix(engine12_generated_src master)
file(GLOB_RECURSE engine12_include "dsql/*.h" "jrd/*.h" include/gen/iberror.h) file(GLOB_RECURSE engine12_include "dsql/*.h" "jrd/*.h" include/gen/iberror.h)
add_library (engine12_common ${engine12_src} ${engine12_include} ${parse_src}) add_library (engine12_common ${engine12_src} ${engine12_include} ${parse_src})
add_dependencies_cc (engine12_common parse) add_dependencies_cc (engine12_common parse UpdateCloopInterfaces)
if (NOT CMAKE_CROSSCOMPILING) if (NOT CMAKE_CROSSCOMPILING)