Skip to content

Commit

Permalink
Merge pull request #225 from chfast/build
Browse files Browse the repository at this point in the history
Build changes
  • Loading branch information
chfast authored Aug 24, 2022
2 parents 902f37e + 0eac13d commit 0c08e96
Show file tree
Hide file tree
Showing 7 changed files with 18 additions and 37 deletions.
9 changes: 2 additions & 7 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -47,11 +47,6 @@ if(CABLE_COMPILER_GNULIKE)
$<$<COMPILE_LANGUAGE:CXX>:-Wno-old-style-cast>
)
endif()

option(ETHASH_NATIVE "Build for native CPU" OFF)
if(ETHASH_NATIVE)
add_compile_options(-march=native)
endif()
elseif(MSVC AND CMAKE_SIZEOF_VOID_P EQUAL 4)
# For Win32 builds allow allocating more than 2 GB of memory.
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /LARGEADDRESSAWARE")
Expand All @@ -65,11 +60,11 @@ option(ETHASH_BUILD_ETHASH "Build ethash::ethash library (if NO only ethash::kec

cmake_dependent_option(ETHASH_BUILD_GLOBAL_CONTEXT "Build ethash::global-context library" YES "ETHASH_BUILD_ETHASH" NO)

option(ETHASH_BUILD_TESTS "Build unit tests" YES)
option(ETHASH_TESTING "Build unit tests" NO)

add_subdirectory(lib)

if(ETHASH_BUILD_TESTS)
if(ETHASH_TESTING)
enable_testing()
add_subdirectory(test)
endif()
Expand Down
2 changes: 1 addition & 1 deletion appveyor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ install:

before_build:
- call "%ProgramFiles(x86)%\Microsoft Visual Studio\%VS%\Community\Common7\Tools\vsdevcmd" -arch=%ARCH%
- cmake -S . -B build -G Ninja -Wno-dev -DTOOLCHAIN=%TOOLCHAIN% -DCMAKE_INSTALL_PREFIX=./dist -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DHUNTER_CONFIGURATION_TYPES=%CONFIGURATION%
- cmake -S . -B build -G Ninja -Wno-dev -DTOOLCHAIN=%TOOLCHAIN% -DCMAKE_INSTALL_PREFIX=./dist -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DETHASH_TESTING=ON -DHUNTER_CONFIGURATION_TYPES=%CONFIGURATION%

build_script:
- cmake --build build --target install
Expand Down
27 changes: 9 additions & 18 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ commands:
# (ninja is using relative paths otherwise).
working_directory: ~/build
command: |
cmake ../project -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/tmp/local $CMAKE_OPTIONS
cmake ../project -DCMAKE_BUILD_TYPE=$BUILD_TYPE -DCMAKE_INSTALL_PREFIX=/tmp/local -DETHASH_TESTING=ON $CMAKE_OPTIONS
build:
steps:
Expand Down Expand Up @@ -217,7 +217,7 @@ jobs:
docker:
- image: ethereum/cpp-build-env:16-clang-11
environment:
- CMAKE_OPTIONS: -DETHASH_BUILD_TESTS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DHUNTER_ENABLED=OFF
- CMAKE_OPTIONS: -DETHASH_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DHUNTER_ENABLED=OFF
steps:
- checkout
- configure
Expand Down Expand Up @@ -270,7 +270,7 @@ jobs:

macos-xcode-tsan:
macos:
xcode: "13.3.0"
xcode: "13.4.1"
environment:
- CMAKE_OPTIONS: -DSANITIZE=thread
- TSAN_OPTIONS: allocator_may_return_null=1
Expand All @@ -279,28 +279,19 @@ jobs:

macos-xcode-old:
macos:
xcode: "11.4.1"
xcode: "12.5.1"
steps:
- macos-defaults

macos-release:
macos:
xcode: "13.3.0"
xcode: "13.4.1"
environment:
- CMAKE_OPTIONS: -DETHASH_BUILD_TESTS=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=~/project/dist
- CMAKE_OPTIONS: -DETHASH_TESTING=OFF -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DCMAKE_INSTALL_PREFIX=~/project/dist
steps:
- macos-defaults
- run:
name: "Install CMake"
command: |
which python3
ls -l /usr/local/lib
ls -l /usr/local/bin
pip3 install -q cmake
- checkout
- configure
- build
- run:
name: "Test"
name: "Test (setup.py)"
command: |
./setup.py test
- run:
Expand All @@ -327,7 +318,7 @@ jobs:
docker:
- image: ethereum/cpp-build-env:17-gcc-10
environment:
CMAKE_OPTIONS: -DHUNTER_RUN_UPLOAD=FALSE -DTOOLCHAIN=wasm32-wasi -DETHASH_BUILD_TESTS=NO -DETHASH_BUILD_GLOBAL_CONTEXT=NO
CMAKE_OPTIONS: -DHUNTER_RUN_UPLOAD=FALSE -DTOOLCHAIN=wasm32-wasi -DETHASH_TESTING=NO -DETHASH_BUILD_GLOBAL_CONTEXT=NO
steps:
- run:
name: "Install WASI SDK"
Expand Down
12 changes: 4 additions & 8 deletions cmake/cable/CableCompilerSettings.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ macro(cable_configure_compiler)
add_compile_options(-Wpedantic)
endif()

# Enable basing warnings set and treat them as errors.
add_compile_options(-Werror -Wall -Wextra -Wshadow)
# Enable base warnings.
add_compile_options(-Wall -Wextra -Wshadow)

if(NOT cable_NO_CONVERSION_WARNINGS)
# Enable conversion warnings if not explicitly disabled.
Expand Down Expand Up @@ -89,12 +89,8 @@ macro(cable_configure_compiler)

elseif(MSVC)

# Get rid of default warning level.
string(REPLACE " /W3" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
string(REPLACE " /W3" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")

# Enable basing warnings set and treat them as errors.
add_compile_options(/W4 /WX)
# Enable base warnings.
add_compile_options(/W4)

# Allow unknown pragmas, we don't want to wrap them with #ifdefs.
add_compile_options(/wd4068)
Expand Down
2 changes: 1 addition & 1 deletion lib/keccak/keccak.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ __attribute__((target("bmi,bmi2"))) static void keccakf1600_bmi(uint64_t state[2
keccakf1600_implementation(state);
}

__attribute__((constructor)) static void select_keccakf1600_implementation()
__attribute__((constructor)) static void select_keccakf1600_implementation(void)
{
// Init CPU information.
// This is needed on macOS because of the bug: https://bugs.llvm.org/show_bug.cgi?id=48459.
Expand Down
1 change: 0 additions & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ def run(self):
'-DCMAKE_INSTALL_LIBDIR=lib',
'-DCMAKE_POSITION_INDEPENDENT_CODE=TRUE',
'-DHUNTER_ENABLED=OFF',
'-DETHASH_BUILD_TESTS=OFF',
'-DETHASH_INSTALL_CMAKE_CONFIG=OFF'
]

Expand Down
2 changes: 1 addition & 1 deletion test/integration/compilation/ethash_header_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

int test(void);

int test()
int test(void)
{
int sum = 0;
sum += ETHASH_EPOCH_LENGTH;
Expand Down

0 comments on commit 0c08e96

Please sign in to comment.