[cmake] Use relative paths to build tools includes.
It is clearer to read as there is a mixture of build_tools and third
party packages..
@@ -12,8 +12,6 @@ if(CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR)
)
endif()
-include(build_tools/cmake/FindAndEnableCcache.cmake)
-
project(compiler_gym ASM C CXX)
set(CMAKE_C_STANDARD 11 CACHE STRING "C standard to be used.")
@@ -21,25 +19,27 @@ set(CMAKE_CXX_STANDARD 17 CACHE STRING "C++ standard to be used.")
set_property(GLOBAL PROPERTY USE_FOLDERS ON)
-list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/build_tools/cmake/)
+list(APPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/build_tools/cmake)
+# Project features.
set(COMPILER_GYM_BUILD_TESTS OFF CACHE BOOL "Enable Compiler Gym tests.")
set(COMPILER_GYM_BUILD_EXAMPLES OFF CACHE BOOL "Enable Comiler Gym examples.")
-include(cg_macros)
-include(cg_copts)
-include(cg_genrule)
-include(cg_cc_binary)
-include(cg_cc_library)
-include(cg_cc_test)
-include(cg_py_binary)
-include(cg_py_library)
-include(cg_py_test)
-include(cg_python)
-include(cg_add_all_subdirs)
-include(cg_filegroup)
-include(grpc)
-include(protobuf)
+include(build_tools/cmake/FindAndEnableCcache.cmake)
+include(build_tools/cmake/cg_macros.cmake)
+include(build_tools/cmake/cg_copts.cmake)
+include(build_tools/cmake/cg_genrule.cmake)
+include(build_tools/cmake/cg_cc_binary.cmake)
+include(build_tools/cmake/cg_cc_library.cmake)
+include(build_tools/cmake/cg_cc_test.cmake)
+include(build_tools/cmake/cg_py_binary.cmake)
+include(build_tools/cmake/cg_py_library.cmake)
+include(build_tools/cmake/cg_py_test.cmake)
+include(build_tools/cmake/cg_python.cmake)
+include(build_tools/cmake/cg_add_all_subdirs.cmake)
+include(build_tools/cmake/cg_filegroup.cmake)
+include(build_tools/cmake/grpc.cmake)
+include(build_tools/cmake/protobuf.cmake)
set(COMPILER_GYM_PYTHONPATH "$ENV{PYTHONPATH}"
CACHE STRING "PYTHONPATH environment variable during build step."
@@ -48,7 +48,7 @@ if(COMPILER_GYM_PYTHONPATH)
string(PREPEND COMPILER_GYM_PYTHONPATH ":")
endif()
string(PREPEND COMPILER_GYM_PYTHONPATH "${CMAKE_BINARY_DIR}")
-include(set_command_pythonpath)
+include(build_tools/cmake/set_command_pythonpath.cmake)
set(DEFAULT_CMAKE_BUILD_TYPE "Release")
if(NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
@@ -67,11 +67,14 @@ set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
find_package(Python3 REQUIRED COMPONENTS Interpreter)
include(external/external.cmake)
+
add_subdirectory(compiler_gym)
+
if(COMPILER_GYM_BUILD_TESTS)
enable_testing()
add_subdirectory(tests)
endif()
+
if(COMPILER_GYM_BUILD_EXAMPLES)
add_subdirectory(examples)
endif()
