Skip to content
This repository has been archived by the owner on Aug 23, 2020. It is now read-only.

Commit

Permalink
Merge pull request EOSIO#781 from EOSIO/compiler_defines
Browse files Browse the repository at this point in the history
added macros
  • Loading branch information
larryk85 authored Jan 10, 2020
2 parents b953d48 + cd2a3f5 commit bf61c9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion modules/ToolsExternalProject.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ include(GNUInstallDirs)
set(LLVM_BINDIR ${CMAKE_BINARY_DIR}/eosio_llvm)
ExternalProject_Add(
EosioTools
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=Release -DVERSION_FULL=${VERSION_FULL} -DLLVM_SRCDIR=${CMAKE_SOURCE_DIR}/eosio_llvm -DLLVM_BINDIR=${LLVM_BINDIR} -DLLVM_DIR=${LLVM_BINDIR}/lib/cmake/llvm -DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR}
CMAKE_ARGS -DCMAKE_INSTALL_PREFIX=${CMAKE_INSTALL_PREFIX} -DCMAKE_BUILD_TYPE=Release -DVERSION_FULL=${VERSION_FULL} -DLLVM_SRCDIR=${CMAKE_SOURCE_DIR}/eosio_llvm -DLLVM_BINDIR=${LLVM_BINDIR} -DLLVM_DIR=${LLVM_BINDIR}/lib/cmake/llvm -DCMAKE_INSTALL_BINDIR=${CMAKE_INSTALL_BINDIR} -DVERSION_MAJOR=${VERSION_MAJOR} -DVERSION_MINOR=${VERSION_MINOR} -DVERSION_PATCH=${VERSION_PATCH}

SOURCE_DIR "${CMAKE_SOURCE_DIR}/tools"
BINARY_DIR "${CMAKE_BINARY_DIR}/tools"
Expand Down
6 changes: 6 additions & 0 deletions tools/include/compiler_options.hpp.in
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,11 @@ struct Options {
static void GetCompDefaults(std::vector<std::string>& copts) {
const char* eosio_apply_suff = "${CMAKE_SHARED_LIBRARY_SUFFIX}";
std::string apply_lib;
// add the define for whether this is compiling with CDT and version macros
copts.emplace_back("-D__eosio_cdt__");
copts.emplace_back(std::string("-D__eosio_cdt_major__=")+"${VERSION_MAJOR}");
copts.emplace_back(std::string("-D__eosio_cdt_minor__=")+"${VERSION_MINOR}");
copts.emplace_back(std::string("-D__eosio_cdt_patchlevel__=")+"${VERSION_PATCH}");
if (!fnative_opt) {
copts.emplace_back("--target=wasm32");
copts.emplace_back("-ffreestanding");
Expand All @@ -380,6 +385,7 @@ static void GetCompDefaults(std::vector<std::string>& copts) {
if (!fasm_opt) {
copts.emplace_back("-fno-builtin");
copts.emplace_back("-mstackrealign");
copts.emplace_back("-D__eosio_cdt_native__");
copts.emplace_back("-DEOSIO_NATIVE");
copts.emplace_back("-DLLP64");
}
Expand Down

0 comments on commit bf61c9c

Please sign in to comment.