Group CMake targets into folders

CMake uses the `FOLDER` property to group the generated Visual Studio
projects into solution folders.

Removed bond_ and documentation_ prefix from project names. The prefixes
were intended to group projects by name which is no longer necessary.
This commit is contained in:
Adam Sapek 2015-10-27 10:49:44 -07:00
Родитель ab71ef89a3
Коммит a4201850a6
21 изменённых файлов: 131 добавлений и 94 удалений

Просмотреть файл

@ -76,8 +76,8 @@ script:
- if [ "$BOND_LANG" == "cs" ]; then make --jobs 2 DESTDIR=$HOME install; fi - if [ "$BOND_LANG" == "cs" ]; then make --jobs 2 DESTDIR=$HOME install; fi
- if [ "$BOND_LANG" == "cs" ]; then export BOND_COMPILER_PATH=$HOME/usr/local/bin; fi - if [ "$BOND_LANG" == "cs" ]; then export BOND_COMPILER_PATH=$HOME/usr/local/bin; fi
- if [[ $BOND_LANG == cpp* ]]; then make --jobs 2 check; fi - if [[ $BOND_LANG == cpp* ]]; then make --jobs 2 check; fi
- if [ "$TRAVIS_OS_NAME" == "linux" ]; then export BOND_PYTHON_TARGETS="bond_python_unit_test python_extension" BOND_PYTHON_TESTS=bond_python_unit_test; fi - if [ "$TRAVIS_OS_NAME" == "linux" ]; then export BOND_PYTHON_TARGETS="python_unit_test python_extension" BOND_PYTHON_TESTS=python_unit_test; fi
- if [ "$TRAVIS_OS_NAME" == "osx" ]; then export BOND_PYTHON_TARGETS="bond_python_compatibility_test bond_python_unit_test python_extension bond_compatibility_test" BOND_PYTHON_TESTS=".*python.*"; fi - if [ "$TRAVIS_OS_NAME" == "osx" ]; then export BOND_PYTHON_TARGETS="python_compatibility_test python_unit_test python_extension compatibility_test" BOND_PYTHON_TESTS=".*python.*"; fi
- if [[ $BOND_LANG == py* ]]; then make $BOND_PYTHON_TARGETS; fi - if [[ $BOND_LANG == py* ]]; then make $BOND_PYTHON_TARGETS; fi
- if [[ $BOND_LANG == py* ]]; then ctest --tests-regex $BOND_PYTHON_TESTS --output-on-failure; fi - if [[ $BOND_LANG == py* ]]; then ctest --tests-regex $BOND_PYTHON_TESTS --output-on-failure; fi
- if [ "$BOND_GHC_VERSION" != "" ]; then make gbc-tests; fi - if [ "$BOND_GHC_VERSION" != "" ]; then make gbc-tests; fi

Просмотреть файл

@ -22,9 +22,9 @@ include (PythonTest)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -C ${CMAKE_CFG_INTDIR} --output-on-failure) add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} -C ${CMAKE_CFG_INTDIR} --output-on-failure)
add_subdirectory (compiler) add_subfolder (compiler "compiler")
add_subdirectory (cpp) add_subdirectory (cpp)
add_subdirectory (doc) add_subfolder (doc "doc")
add_python_subdirectory (python) add_python_subdirectory (python)
add_subdirectory (examples) add_subdirectory (examples)

Просмотреть файл

@ -177,7 +177,7 @@
if ($env:BOND_BUILD -eq "Python") { if ($env:BOND_BUILD -eq "Python") {
cmake --build . --target bond_python_unit_test -- /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll" cmake --build . --target python_unit_test -- /verbosity:minimal /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
} }
@ -201,7 +201,7 @@
if ($env:BOND_BUILD -eq "Python") { if ($env:BOND_BUILD -eq "Python") {
ctest -C Debug --tests-regex bond_python_unit_test --output-on-failure ctest -C Debug --tests-regex python_unit_test --output-on-failure
} }

Просмотреть файл

@ -1,9 +1,10 @@
include (CMakeParseArguments) include (CMakeParseArguments)
include (Folders)
# #
# add_bond_codegen (file.bond [file2.bond ...] # add_bond_codegen (file.bond [file2.bond ...]
# [ENUM_HEADER] # [ENUM_HEADER]
# [OUTPUT_DIR dir] # [OUTPUT_DIR dir]
# [IMPORT_DIR dir [dir2, ...]] # [IMPORT_DIR dir [dir2, ...]]
# [OPTIONS opt [opt2 ...]]) # [OPTIONS opt [opt2 ...]])
# [TARGET name] # [TARGET name]
@ -12,7 +13,7 @@ function (add_bond_codegen)
set (flagArgs ENUM_HEADER) set (flagArgs ENUM_HEADER)
set (oneValueArgs OUTPUT_DIR TARGET) set (oneValueArgs OUTPUT_DIR TARGET)
set (multiValueArgs IMPORT_DIR OPTIONS) set (multiValueArgs IMPORT_DIR OPTIONS)
cmake_parse_arguments (arg "${flagArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) cmake_parse_arguments (arg "${flagArgs}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
set (options) set (options)
set (outputDir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}) set (outputDir ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
if (arg_OUTPUT_DIR) if (arg_OUTPUT_DIR)
@ -23,7 +24,7 @@ function (add_bond_codegen)
list (APPEND options --import-dir="${BOND_INCLUDE}") list (APPEND options --import-dir="${BOND_INCLUDE}")
foreach (dir ${arg_IMPORT_DIR}) foreach (dir ${arg_IMPORT_DIR})
list(APPEND options --import-dir="${dir}") list(APPEND options --import-dir="${dir}")
endforeach() endforeach()
foreach (opt ${arg_OPTIONS}) foreach (opt ${arg_OPTIONS})
list (APPEND options "${opt}") list (APPEND options "${opt}")
endforeach() endforeach()
@ -34,7 +35,7 @@ function (add_bond_codegen)
set (outputs) set (outputs)
foreach (file ${inputs}) foreach (file ${inputs})
get_filename_component (name ${file} NAME_WE) get_filename_component (name ${file} NAME_WE)
list (APPEND outputs list (APPEND outputs
"${outputDir}/${name}_reflection.h" "${outputDir}/${name}_reflection.h"
"${outputDir}/${name}_types.h" "${outputDir}/${name}_types.h"
"${outputDir}/${name}_types.cpp" "${outputDir}/${name}_types.cpp"
@ -54,6 +55,7 @@ function (add_bond_codegen)
add_custom_target (${arg_TARGET} add_custom_target (${arg_TARGET}
DEPENDS ${outputs} DEPENDS ${outputs}
SOURCES ${inputs}) SOURCES ${inputs})
add_target_to_folder(${arg_TARGET})
endif() endif()
endfunction() endfunction()
@ -77,11 +79,12 @@ function (add_bond_executable target)
add_bond_codegen (${schemas}) add_bond_codegen (${schemas})
endif() endif()
add_executable (${ARGV} ${sources}) add_executable (${ARGV} ${sources})
add_target_to_folder(${target})
target_link_libraries (${target} PRIVATE target_link_libraries (${target} PRIVATE
bond bond
bond_apply) bond_apply)
target_include_directories (${target} PRIVATE target_include_directories (${target} PRIVATE
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
${CMAKE_CURRENT_SOURCE_DIR}) ${CMAKE_CURRENT_SOURCE_DIR})
endfunction() endfunction()
@ -95,7 +98,7 @@ function (add_bond_test test)
add_bond_executable (${ARGV}) add_bond_executable (${ARGV})
add_dependencies (check ${test}) add_dependencies (check ${test})
add_test ( add_test (
NAME ${test} NAME ${test}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND ${test}) COMMAND ${test})
endfunction() endfunction()
@ -122,19 +125,19 @@ function (add_bond_python_module target)
list (INSERT ARGV 1 EXCLUDE_FROM_ALL) list (INSERT ARGV 1 EXCLUDE_FROM_ALL)
python_add_module (${ARGV} ${sources}) python_add_module (${ARGV} ${sources})
add_dependencies (check ${target}) add_dependencies (check ${target})
target_link_libraries (${target} PRIVATE add_target_to_folder(${target})
target_link_libraries (${target} PRIVATE
bond bond
bond_apply bond_apply
${PYTHON_LIBRARIES} ${PYTHON_LIBRARIES}
${Boost_PYTHON_LIBRARY}) ${Boost_PYTHON_LIBRARY})
target_include_directories (${target} PRIVATE target_include_directories (${target} PRIVATE
${BOND_PYTHON_INCLUDE} ${BOND_PYTHON_INCLUDE}
${WINDOWSSDK_PREFERRED_DIR}/Include ${WINDOWSSDK_PREFERRED_DIR}/Include
${WINDOWSSDK_PREFERRED_DIR}/Include/shared ${WINDOWSSDK_PREFERRED_DIR}/Include/shared
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR} ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${PYTHON_INCLUDE_DIR}) ${PYTHON_INCLUDE_DIR})
target_compile_definitions (${target} PRIVATE target_compile_definitions (${target} PRIVATE
-DBOOST_PYTHON_STATIC_LIB) -DBOOST_PYTHON_STATIC_LIB)
endfunction() endfunction()

20
cmake/Folders.cmake Normal file
Просмотреть файл

@ -0,0 +1,20 @@
set_property (GLOBAL PROPERTY USE_FOLDERS On)
#
# Add the target to "current" folder
#
function (add_target_to_folder target)
set_property (GLOBAL APPEND PROPERTY bond_targets ${target})
endfunction()
#
# add_subfolder (subdirectory folder)
# similar to built-in add_subdirectory but groups targets in specified folder
#
macro (add_subfolder dir folder)
set_property (GLOBAL PROPERTY bond_targets)
add_subdirectory (${dir})
get_property (targets GLOBAL PROPERTY bond_targets)
set_target_properties (${targets} PROPERTIES FOLDER ${folder})
endmacro()

Просмотреть файл

@ -4,6 +4,7 @@ set (CMAKE_MODULE_PATH
${CMAKE_CURRENT_SOURCE_DIR}/../cmake) ${CMAKE_CURRENT_SOURCE_DIR}/../cmake)
include (CMakeParseArguments) include (CMakeParseArguments)
include (Folders)
# required Haskell components # required Haskell components
find_package (Cabal 1.18.0.0 REQUIRED) find_package (Cabal 1.18.0.0 REQUIRED)
@ -18,10 +19,10 @@ function (add_cabal_build target)
endif() endif()
add_custom_command ( add_custom_command (
DEPENDS ${arg_SOURCES} DEPENDS ${arg_SOURCES}
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
-N -N
-Dbuild_dir=${CMAKE_CURRENT_BINARY_DIR} -Dbuild_dir=${CMAKE_CURRENT_BINARY_DIR}
-Dtarget=${target} -Dtarget=${target}
-Dcabal_options=${options} -Dcabal_options=${options}
-P cabal_build.cmake -P cabal_build.cmake
@ -29,16 +30,17 @@ function (add_cabal_build target)
OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/build/${target}/${target}${CMAKE_EXECUTABLE_SUFFIX}) OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/build/${target}/${target}${CMAKE_EXECUTABLE_SUFFIX})
add_custom_target (${target} add_custom_target (${target}
SOURCES ${arg_SOURCES} SOURCES ${arg_SOURCES}
DEPENDS ${arg_DEPENDS} DEPENDS ${arg_DEPENDS}
${CMAKE_CURRENT_BINARY_DIR}/build/${target}/${target}${CMAKE_EXECUTABLE_SUFFIX}) ${CMAKE_CURRENT_BINARY_DIR}/build/${target}/${target}${CMAKE_EXECUTABLE_SUFFIX})
add_dependencies (${target} sandbox) add_target_to_folder(${target})
endfunction() add_dependencies (${target} sandbox)
endfunction()
function (add_cabal_test target) function (add_cabal_test target)
list (INSERT ${target} 0 EXCLUDE_FROM_ALL) list (INSERT ${target} 0 EXCLUDE_FROM_ALL)
add_cabal_build (${ARGV} ENABLE_TESTS) add_cabal_build (${ARGV} ENABLE_TESTS)
add_test ( add_test (
NAME ${target} NAME ${target}
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
COMMAND ${CMAKE_CURRENT_BINARY_DIR}/build/${target}/${target}) COMMAND ${CMAKE_CURRENT_BINARY_DIR}/build/${target}/${target})
endfunction() endfunction()
@ -82,8 +84,8 @@ set (output ${CMAKE_CURRENT_BINARY_DIR}/build/gbc/gbc${CMAKE_EXECUTABLE_SUFFIX})
set (GBC_EXECUTABLE ${output} PARENT_SCOPE) set (GBC_EXECUTABLE ${output} PARENT_SCOPE)
add_custom_command ( add_custom_command (
COMMAND ${CMAKE_COMMAND} COMMAND ${CMAKE_COMMAND}
${CMAKE_BINARY_DIR} ${CMAKE_BINARY_DIR}
-N -N
-P sandbox_init.cmake -P sandbox_init.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
@ -91,6 +93,7 @@ add_custom_command (
add_custom_target (sandbox add_custom_target (sandbox
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/cabal.sandbox.config) DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/cabal.sandbox.config)
add_target_to_folder(sandbox)
add_custom_command ( add_custom_command (
DEPENDS ${output} DEPENDS ${output}
@ -111,6 +114,6 @@ install (FILES ${output}
if(EXISTS "${completion_dir}" AND IS_DIRECTORY "${completion_dir}") if(EXISTS "${completion_dir}" AND IS_DIRECTORY "${completion_dir}")
install (FILES ${completion} install (FILES ${completion}
RENAME gbc RENAME gbc
DESTINATION ${completion_dir}) DESTINATION ${completion_dir})
endif() endif()

Просмотреть файл

@ -1,7 +1,8 @@
# warning C4310: cast truncates constant value # warning C4310: cast truncates constant value
cxx_add_compile_options(MSVC /wd4310) cxx_add_compile_options(MSVC /wd4310)
add_subdirectory (compat) add_subfolder (compat "tests/compat")
if (Boost_UNIT_TEST_FRAMEWORK_FOUND) if (Boost_UNIT_TEST_FRAMEWORK_FOUND)
add_subdirectory (core) add_subfolder (core "tests/unit_test/core")
endif() endif()

Просмотреть файл

@ -1,6 +1,6 @@
cxx_add_compile_options(Clang -Wno-unused-value) cxx_add_compile_options(Clang -Wno-unused-value)
add_bond_executable (bond_compatibility_test EXCLUDE_FROM_ALL add_bond_executable (compatibility_test EXCLUDE_FROM_ALL
${BOND_COMPAT_TEST_DIR}/schemas/compat.bond ${BOND_COMPAT_TEST_DIR}/schemas/compat.bond
${BOND_COMPAT_TEST_DIR}/schemas/compat2.bond ${BOND_COMPAT_TEST_DIR}/schemas/compat2.bond
${BOND_COMPAT_TEST_DIR}/schemas/compat_no_generics.bond ${BOND_COMPAT_TEST_DIR}/schemas/compat_no_generics.bond
@ -9,15 +9,15 @@ add_bond_executable (bond_compatibility_test EXCLUDE_FROM_ALL
compat.cpp compat.cpp
serialization.cpp) serialization.cpp)
add_dependencies (check bond_compatibility_test) add_dependencies (check compatibility_test)
target_compile_definitions (bond_compatibility_test PRIVATE target_compile_definitions (compatibility_test PRIVATE
-DBOND_COMPACT_BINARY_PROTOCOL -DBOND_COMPACT_BINARY_PROTOCOL
-DBOND_SIMPLE_BINARY_PROTOCOL -DBOND_SIMPLE_BINARY_PROTOCOL
-DBOND_FAST_BINARY_PROTOCOL -DBOND_FAST_BINARY_PROTOCOL
-DBOND_SIMPLE_JSON_PROTOCOL) -DBOND_SIMPLE_JSON_PROTOCOL)
target_use_cxx11 (bond_compatibility_test) target_use_cxx11 (compatibility_test)
# disable generation of debug symbols to speed up build # disable generation of debug symbols to speed up build
no_pdb() no_pdb()
@ -26,7 +26,7 @@ function (add_compat_test test)
add_test ( add_test (
NAME compatibility_${test} NAME compatibility_${test}
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMAND bond_compatibility_test ${test} -d ${BOND_COMPAT_TEST_DIR}/data/compat.${test}.dat expected.cpp.${test} deserialized.cpp.${test}) COMMAND compatibility_test ${test} -d ${BOND_COMPAT_TEST_DIR}/data/compat.${test}.dat expected.cpp.${test} deserialized.cpp.${test})
if (BOND_CSHARP_COMPAT_TEST) if (BOND_CSHARP_COMPAT_TEST)
add_test ( add_test (
@ -34,7 +34,7 @@ function (add_compat_test test)
COMMAND COMMAND
${CMAKE_COMMAND} ${CMAKE_COMMAND}
-DCSHARP_COMPAT=${BOND_CSHARP_COMPAT_TEST} -DCSHARP_COMPAT=${BOND_CSHARP_COMPAT_TEST}
-DBOND_COMPAT=$<TARGET_FILE:bond_compatibility_test> -DBOND_COMPAT=$<TARGET_FILE:compatibility_test>
-DCOMPAT_DATA=${BOND_COMPAT_TEST_DIR}/data -DCOMPAT_DATA=${BOND_COMPAT_TEST_DIR}/data
-DTEST=${test} -DTEST=${test}
-P ${CMAKE_CURRENT_SOURCE_DIR}/compat.cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/compat.cmake

Просмотреть файл

@ -1,13 +1,14 @@
function (add_unit_test_library name) function (add_unit_test_library name)
list (INSERT ARGV 1 EXCLUDE_FROM_ALL) list (INSERT ARGV 1 EXCLUDE_FROM_ALL)
add_library (${ARGV}) add_library (${ARGV})
add_dependencies (${name} add_target_to_folder (${name})
add_dependencies (${name}
bond bond
bond_unit_test_codegen1 unit_test_codegen1
bond_unit_test_codegen2 unit_test_codegen2
bond_unit_test_codegen3) unit_test_codegen3)
target_include_directories (${name} PUBLIC target_include_directories (${name} PUBLIC
${CMAKE_CURRENT_SOURCE_DIR} ${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}) ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR})
target_compile_definitions (${name} PUBLIC target_compile_definitions (${name} PUBLIC
# -DENABLE_TEST_CASE=0x20010000 # -DENABLE_TEST_CASE=0x20010000
@ -17,11 +18,11 @@ function (add_unit_test_library name)
-DBOND_SIMPLE_JSON_PROTOCOL -DBOND_SIMPLE_JSON_PROTOCOL
-DBOOST_ENABLE_ASSERT_HANDLER) -DBOOST_ENABLE_ASSERT_HANDLER)
target_use_cxx11 (${name}) target_use_cxx11 (${name})
target_link_libraries (${name} INTERFACE bond_unit_test_idl bond) target_link_libraries (${name} INTERFACE unit_test_idl bond)
target_link_libraries (bond_unit_test PRIVATE ${name}) target_link_libraries (unit_test PRIVATE ${name})
endfunction() endfunction()
add_bond_codegen (TARGET bond_unit_test_codegen2 add_bond_codegen (TARGET unit_test_codegen2
unit_test_core.bond unit_test_core.bond
apply_test.bond apply_test.bond
import_test1.bond import_test1.bond
@ -33,7 +34,7 @@ add_bond_codegen (TARGET bond_unit_test_codegen2
OPTIONS OPTIONS
--header=\\\"custom_protocols.h\\\") --header=\\\"custom_protocols.h\\\")
add_bond_codegen (TARGET bond_unit_test_codegen1 add_bond_codegen (TARGET unit_test_codegen1
unit_test.bond unit_test.bond
OPTIONS OPTIONS
--using=\"static_string=std::array<char, {0}>\" --using=\"static_string=std::array<char, {0}>\"
@ -42,7 +43,7 @@ add_bond_codegen (TARGET bond_unit_test_codegen1
--header=\\\"custom_protocols.h\\\" --header=\\\"custom_protocols.h\\\"
--header=\\\"container_extensibility.h\\\") --header=\\\"container_extensibility.h\\\")
add_bond_codegen (TARGET bond_unit_test_codegen3 add_bond_codegen (TARGET unit_test_codegen3
allocator_test.bond allocator_test.bond
OPTIONS OPTIONS
--using=\"Vector=std::vector<{0}, detail::TestAllocator<{0}> >\" --using=\"Vector=std::vector<{0}, detail::TestAllocator<{0}> >\"
@ -50,15 +51,16 @@ add_bond_codegen (TARGET bond_unit_test_codegen3
--header=\\\"allocators.h\\\" --header=\\\"allocators.h\\\"
--allocator=TestAllocator) --allocator=TestAllocator)
add_bond_test (bond_unit_test init.cpp) add_bond_test (unit_test init.cpp)
target_use_cxx11 (bond_unit_test) target_use_cxx11 (unit_test)
add_library (bond_unit_test_main EXCLUDE_FROM_ALL main.cpp) add_library (unit_test_main EXCLUDE_FROM_ALL main.cpp)
add_target_to_folder (unit_test_main)
target_link_libraries (bond_unit_test PRIVATE target_link_libraries (unit_test PRIVATE
${Boost_UNIT_TEST_FRAMEWORK_LIBRARY} ${Boost_UNIT_TEST_FRAMEWORK_LIBRARY}
bond_unit_test_main) unit_test_main)
# Full unit test is too big, .pdb files exceed compiler limit; # Full unit test is too big, .pdb files exceed compiler limit;
# Since debugging such large executable is not practical anyways, # Since debugging such large executable is not practical anyways,
@ -67,10 +69,10 @@ target_link_libraries (bond_unit_test PRIVATE
no_pdb() no_pdb()
# split across multiple libraries to parallelize build # split across multiple libraries to parallelize build
add_unit_test_library (bond_unit_test_idl add_unit_test_library (unit_test_idl
idl.cpp) idl.cpp)
add_unit_test_library (bond_unit_test_lib1 add_unit_test_library (unit_test_lib1
skip_id_tests.cpp skip_id_tests.cpp
skip_type_tests.cpp skip_type_tests.cpp
inheritance.cpp inheritance.cpp
@ -82,9 +84,9 @@ add_unit_test_library (bond_unit_test_lib1
required_fields_tests.cpp required_fields_tests.cpp
custom_protocols.cpp custom_protocols.cpp
cmdargs.cpp cmdargs.cpp
metadata_tests.cpp) metadata_tests.cpp)
add_unit_test_library (bond_unit_test_lib2 add_unit_test_library (unit_test_lib2
json_tests.cpp json_tests.cpp
pass_through.cpp pass_through.cpp
associative_container_extensibility.cpp associative_container_extensibility.cpp
@ -92,14 +94,14 @@ add_unit_test_library (bond_unit_test_lib2
apply_init.cpp apply_init.cpp
may_omit_fields.cpp) may_omit_fields.cpp)
add_unit_test_library (bond_unit_test_lib3 add_unit_test_library (unit_test_lib3
numeric_convertions.cpp) numeric_convertions.cpp)
add_unit_test_library (bond_unit_test_lib4 add_unit_test_library (unit_test_lib4
generics_test.cpp generics_test.cpp
merge_test.cpp) merge_test.cpp)
add_unit_test_library (bond_unit_test_lib5 add_unit_test_library (unit_test_lib5
list_tests.cpp list_tests.cpp
serialization_test.cpp serialization_test.cpp
allocator_test.cpp allocator_test.cpp
@ -107,7 +109,7 @@ add_unit_test_library (bond_unit_test_lib5
basic_type_lists.cpp basic_type_lists.cpp
nullable.cpp) nullable.cpp)
add_unit_test_library (bond_unit_test_lib6 add_unit_test_library (unit_test_lib6
marshal.cpp marshal.cpp
container_extensibility.cpp container_extensibility.cpp
basic_type_map.cpp basic_type_map.cpp

Просмотреть файл

@ -5,6 +5,7 @@ set (CMAKE_MODULE_PATH
include (CMakeParseArguments) include (CMakeParseArguments)
include (HaskellUtil) include (HaskellUtil)
include (Folders)
# build the compiler when doc directory is build by itself # build the compiler when doc directory is build by itself
if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR) if (CMAKE_SOURCE_DIR STREQUAL CMAKE_CURRENT_SOURCE_DIR)
@ -55,10 +56,11 @@ function (add_pandoc_markdown)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${file} ${PANDOC_EXECUTABLE}) DEPENDS ${file} ${PANDOC_EXECUTABLE})
endforeach() endforeach()
add_custom_target ("documentation_${name}" add_custom_target (${name}
DEPENDS ${outputs} DEPENDS ${outputs}
SOURCES ${sources}) SOURCES ${sources})
add_dependencies (documentation "documentation_${name}") add_target_to_folder (${name})
add_dependencies (documentation ${name})
endfunction() endfunction()
add_custom_command( add_custom_command(
@ -71,6 +73,8 @@ add_custom_command(
add_custom_target (documentation add_custom_target (documentation
DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/manual/gbc.html") DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/html/manual/gbc.html")
add_target_to_folder (documentation)
find_haskell_program (pandoc) find_haskell_program (pandoc)
if (Haskell_PANDOC_EXECUTABLE) if (Haskell_PANDOC_EXECUTABLE)
@ -126,9 +130,11 @@ if (Doxygen_EXECUTABLE)
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
DEPENDS ${doxygen_sources}) DEPENDS ${doxygen_sources})
add_custom_target (documentation_cpp_reference add_custom_target (cpp_reference
DEPENDS "${doxygen_output_dir}/cpp/index.html" DEPENDS "${doxygen_output_dir}/cpp/index.html"
SOURCES ${doxygen_sources}) SOURCES ${doxygen_sources})
add_dependencies (documentation documentation_cpp_reference) add_target_to_folder (cpp_reference)
add_dependencies (documentation cpp_reference)
endif() endif()

Просмотреть файл

@ -1 +1 @@
add_subdirectory (core) add_subfolder (core "examples/core")

Просмотреть файл

@ -4,16 +4,16 @@ add_dependencies (check bf)
install (TARGETS bf DESTINATION bin) install (TARGETS bf DESTINATION bin)
target_use_cxx11 (bf) target_use_cxx11 (bf)
add_test ( add_test (
NAME bf NAME bf
COMMAND COMMAND
${CMAKE_COMMAND} ${CMAKE_COMMAND}
-DBF=$<TARGET_FILE:bf> -DBF=$<TARGET_FILE:bf>
-DBOND_COMPAT=$<TARGET_FILE:bond_compatibility_test> -DBOND_COMPAT=$<TARGET_FILE:compatibility_test>
-DCOMPAT_DATA=${BOND_COMPAT_TEST_DIR}/data -DCOMPAT_DATA=${BOND_COMPAT_TEST_DIR}/data
-P ${CMAKE_CURRENT_SOURCE_DIR}/bf_test.cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/bf_test.cmake
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}) WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
add_test ( add_test (

Просмотреть файл

@ -6,10 +6,12 @@ add_library (static_library_lib EXCLUDE_FROM_ALL
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/static_library_types.cpp ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/static_library_types.cpp
${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/static_library_apply.cpp) ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/static_library_apply.cpp)
target_link_libraries (static_library_lib PUBLIC add_target_to_folder (static_library_lib)
target_link_libraries (static_library_lib PUBLIC
bond) bond)
add_bond_test (static_library add_bond_test (static_library
exe/static_library.cpp) exe/static_library.cpp)
target_link_libraries (static_library PRIVATE target_link_libraries (static_library PRIVATE

Просмотреть файл

@ -1,2 +1,2 @@
use_cxx11 () use_cxx11 ()
add_subdirectory (core) add_subfolder (core "examples/python/core")

Просмотреть файл

@ -1,2 +1,2 @@
add_subdirectory (core) add_subfolder (core "tests/python/unit_test/core")
add_subdirectory (compat) add_subfolder (compat "tests/python/compat")

Просмотреть файл

@ -1,11 +1,11 @@
add_bond_python_module (bond_python_compatibility_test add_bond_python_module (python_compatibility_test
${BOND_COMPAT_TEST_DIR}/schemas/compat.bond ${BOND_COMPAT_TEST_DIR}/schemas/compat.bond
${BOND_COMPAT_TEST_DIR}/schemas/compat2.bond ${BOND_COMPAT_TEST_DIR}/schemas/compat2.bond
${BOND_COMPAT_TEST_DIR}/schemas/compat_common.bond ${BOND_COMPAT_TEST_DIR}/schemas/compat_common.bond
compat.cpp compat.cpp
compat.py) compat.py)
target_compile_definitions (bond_python_compatibility_test PRIVATE target_compile_definitions (python_compatibility_test PRIVATE
-DBOND_COMPACT_BINARY_PROTOCOL) -DBOND_COMPACT_BINARY_PROTOCOL)
# disable generation of debug symbols to speed up build # disable generation of debug symbols to speed up build
@ -14,12 +14,12 @@ no_pdb()
function (add_python_compat_test test) function (add_python_compat_test test)
add_test ( add_test (
NAME python_compatibility_${test} NAME python_compatibility_${test}
COMMAND COMMAND
${CMAKE_COMMAND} ${CMAKE_COMMAND}
-DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE} -DPYTHON_EXECUTABLE=${PYTHON_EXECUTABLE}
-DPYTHON_COMPAT=$<TARGET_FILE_DIR:bond_python_compatibility_test> -DPYTHON_COMPAT=$<TARGET_FILE_DIR:python_compatibility_test>
-DBOND_COMPAT=$<TARGET_FILE:bond_compatibility_test> -DBOND_COMPAT=$<TARGET_FILE:compatibility_test>
-DCOMPAT_DATA=${BOND_COMPAT_TEST_DIR}/data -DCOMPAT_DATA=${BOND_COMPAT_TEST_DIR}/data
-DTEST=${test} -DTEST=${test}
-DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR} -DSOURCE_DIR=${CMAKE_CURRENT_SOURCE_DIR}
-P ${CMAKE_CURRENT_SOURCE_DIR}/compat.cmake -P ${CMAKE_CURRENT_SOURCE_DIR}/compat.cmake

Просмотреть файл

@ -1,7 +1,7 @@
#include "compat_reflection.h" #include "compat_reflection.h"
#include <bond/python/struct.h> #include <bond/python/struct.h>
BOOST_PYTHON_MODULE(bond_python_compatibility_test) BOOST_PYTHON_MODULE(python_compatibility_test)
{ {
using namespace unittest::compat; using namespace unittest::compat;

Просмотреть файл

@ -1,5 +1,5 @@
from __future__ import print_function from __future__ import print_function
import bond_python_compatibility_test as test import python_compatibility_test as test
import sys, getopt import sys, getopt
def schema(input_, output): def schema(input_, output):

Просмотреть файл

@ -1,15 +1,15 @@
add_bond_python_module (bond_python_unit_test add_bond_python_module (python_unit_test
unit_test.cpp unit_test.cpp
unit_test.bond unit_test.bond
unit_test.py) unit_test.py)
target_compile_definitions (bond_python_unit_test PRIVATE target_compile_definitions (python_unit_test PRIVATE
-DBOND_COMPACT_BINARY_PROTOCOL) -DBOND_COMPACT_BINARY_PROTOCOL)
# disable generation of debug symbols to speed up build # disable generation of debug symbols to speed up build
no_pdb() no_pdb()
add_python_test ( add_python_test (
NAME bond_python_unit_test NAME python_unit_test
MODULE bond_python_unit_test MODULE python_unit_test
SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/unit_test.py) SCRIPT ${CMAKE_CURRENT_SOURCE_DIR}/unit_test.py)

Просмотреть файл

@ -1,7 +1,7 @@
#include "unit_test_reflection.h" #include "unit_test_reflection.h"
#include <bond/python/struct.h> #include <bond/python/struct.h>
BOOST_PYTHON_MODULE(bond_python_unit_test) BOOST_PYTHON_MODULE(python_unit_test)
{ {
using namespace unittest; using namespace unittest;
using namespace bond::python; using namespace bond::python;

Просмотреть файл

@ -3,8 +3,8 @@ import random
import string import string
import functools import functools
import sys import sys
from bond_python_unit_test import Serialize, Deserialize, Marshal, Unmarshal, GetRuntimeSchema from python_unit_test import Serialize, Deserialize, Marshal, Unmarshal, GetRuntimeSchema
import bond_python_unit_test as test import python_unit_test as test
def atleast_python3(): def atleast_python3():
return sys.version_info[0] >= 3 return sys.version_info[0] >= 3