Skip to content

Commit

Permalink
Merge pull request EOSIO#4 from EOSIO/fix/no_sudo_make
Browse files Browse the repository at this point in the history
Changed exchange to showcase libs and changed ar and ranlib
  • Loading branch information
larryk85 authored Jun 27, 2018
2 parents 0a54875 + d414649 commit e7a4e95
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 19 deletions.
18 changes: 10 additions & 8 deletions InstallClang.txt
Original file line number Diff line number Diff line change
Expand Up @@ -60,17 +60,19 @@ install(FILES ${CLANG_BIN_DIR}/eosio.ld
install(FILES ${CLANG_BIN_DIR}/../lib/LLVMEosioApply${CMAKE_SHARED_LIBRARY_SUFFIX}
DESTINATION ${SDK_INSTALL_PREFIX}/bin)

install_symlink(llvm-ranlib eosio.ranlib)
install_symlink(llvm-ar eosio.ar)
install_symlink(llvm-ranlib eosio-ranlib)
install_symlink(llvm-ar eosio-ar)
install_symlink(llvm-objdump eosio.objdump)
install_symlink(llvm-readelf eosio.readelf)
install_symlink(eosio.cc eosio.cc)
install_symlink(eosio.cpp eosio.cpp)
install_symlink(eosio.ld eosio.ld)

install(CODE "execute_process(COMMAND ln -sf
${CLANG_BIN_DIR}/clang-7
${SDK_INSTALL_PREFIX}/bin/clang)")
install(CODE "execute_process(COMMAND ln -sf
${CLANG_BIN_DIR}/clang-7
${SDK_INSTALL_PREFIX}/bin/clang++)")
install(CODE "
execute_process(COMMAND ln -sf
${SDK_INSTALL_PREFIX}/bin/clang-7
${SDK_INSTALL_PREFIX}/bin/clang)")
install(CODE "
execute_process(COMMAND ln -sf
${SDK_INSTALL_PREFIX}/bin/clang-7
${SDK_INSTALL_PREFIX}/bin/clang++)")
7 changes: 7 additions & 0 deletions examples/exchange/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,12 @@ list(APPEND CMAKE_MODULE_PATH ${WASM_ROOT}/lib/cmake)
#include the toolchain cmake
include(EosioWasmToolchain)

add_library(exchange_lib
${CMAKE_SOURCE_DIR}/exchange_accounts.cpp
${CMAKE_SOURCE_DIR}/exchange_state.cpp
${CMAKE_SOURCE_DIR}/market_state.cpp)
target_include_directories( exchange_lib PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ )

add_executable(exchange exchange.cpp )
target_include_directories( exchange PUBLIC ${CMAKE_CURRENT_SOURCE_DIR}/../ )
target_link_libraries( exchange exchange_lib)
4 changes: 0 additions & 4 deletions examples/exchange/exchange.cpp
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
#include <math.h>
#include "exchange.hpp"

#include "exchange_state.cpp"
#include "exchange_accounts.cpp"
#include "market_state.cpp"

#include <eosiolib/dispatcher.hpp>

namespace eosio {
Expand Down
2 changes: 1 addition & 1 deletion examples/exchange/exchange_accounts.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
namespace eosio {

using boost::container::flat_map;

using namespace std;
/**
* Each user has their own account with the exchange contract that keeps track
* of how much a user has on deposit for each extended asset type. The assumption
Expand Down
2 changes: 2 additions & 0 deletions examples/exchange/exchange_state.hpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
#pragma once

#include <eosiolib/asset.hpp>
#include <eosiolib/multi_index.hpp>
#include <cmath>

namespace eosio {

Expand Down
8 changes: 2 additions & 6 deletions modules/EosioWasmToolchain.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,18 @@ set(CMAKE_C_FLAGS " -O3 ")
set(CMAKE_CXX_FLAGS " -O3 ")

set(WASM_LINKER "${WASM_INSTALL_ROOT}/bin/eosio.ld")
set(WASM_IMPORTS "${WASM_INSTALL_ROOT}/eosio.wasmsdk/eosio.imports")

set(CMAKE_C_LINK_EXECUTABLE "${WASM_LINKER} <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
set(CMAKE_CXX_LINK_EXECUTABLE "${WASM_LINKER} <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")

set(CMAKE_AR "${WASM_INSTALL_ROOT}/bin/eosio.ar" CACHE PATH "ar" FORCE)
set(CMAKE_RANLIB "${WASM_INSTALL_ROOT}/bin/eosio.ranlib" CACHE PATH "ranlib" FORCE)
set(CMAKE_AR "${WASM_INSTALL_ROOT}/bin/eosio-ar" CACHE PATH "ar" FORCE)
set(CMAKE_RANLIB "${WASM_INSTALL_ROOT}/bin/eosio-ranlib" CACHE PATH "ranlib" FORCE)

set(EosioLib_DIR ${WASM_INSTALL_ROOT}/lib/cmake)

find_package(EosioLib CONFIG REQUIRED)
# hack for CMake on Linux
set(CMAKE_SHARED_LIBRARY_LINK_C_FLAGS)
set(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS)
# hack for OSX
set(CMAKE_OSX_SYSROOT="${WASM_INSTALL_ROOT}/eosio.wasmsdk")
set(CMAKE_OSX_DEPLOYMENT_TARGET="")

#set(STANDARD_LIBS c++ c eosio)

0 comments on commit e7a4e95

Please sign in to comment.