diff options
author | Benjamin Barenblat <bbarenblat@gmail.com> | 2020-10-11 12:04:39 -0400 |
---|---|---|
committer | Benjamin Barenblat <bbarenblat@gmail.com> | 2020-10-11 12:04:39 -0400 |
commit | e662f34ef65a3ae94b4216097acc9f0a25611fac (patch) | |
tree | 37f840729de08066fb4fcac739188a00200781bc | |
parent | 4cd5b689a20b88258242e6c40314c16bd3e2194e (diff) |
Eliminate CMake; flatten directory structure
CMake is probably more trouble than it’s worth for this project.
Replace it with a hand-rolled Ninja file.
-rw-r--r-- | .gitignore | 8 | ||||
-rw-r--r-- | .mailmap | 3 | ||||
-rw-r--r-- | CMakeLists.txt | 53 | ||||
-rw-r--r-- | build.ninja | 42 | ||||
-rw-r--r-- | encoding.cc (renamed from src/encoding.cc) | 0 | ||||
-rw-r--r-- | encoding.h (renamed from src/encoding.h) | 0 | ||||
-rw-r--r-- | fuse.h (renamed from src/fuse.h) | 0 | ||||
-rw-r--r-- | operations.cc (renamed from src/operations.cc) | 0 | ||||
-rw-r--r-- | operations.h (renamed from src/operations.h) | 0 | ||||
-rw-r--r-- | posix_extras.cc (renamed from src/posix_extras.cc) | 0 | ||||
-rw-r--r-- | posix_extras.h (renamed from src/posix_extras.h) | 0 | ||||
-rw-r--r-- | scoville.cc (renamed from src/scoville.cc) | 0 | ||||
-rw-r--r-- | src/CMakeLists.txt | 55 |
13 files changed, 48 insertions, 113 deletions
@@ -3,10 +3,10 @@ \#* .\#* -# CMake -Debug/ -Release/ - +# Ninja +.ninja_* +*.o +scoville # Local Variables: # mode: conf @@ -1 +1,2 @@ -<benjamin@barenblat.name> <bbaren@mit.edu> +<bbarenblat@gmail.com> <benjamin@barenblat.name> +<bbarenblat@gmail.com> <bbaren@mit.edu> diff --git a/CMakeLists.txt b/CMakeLists.txt deleted file mode 100644 index 5862df7..0000000 --- a/CMakeLists.txt +++ /dev/null @@ -1,53 +0,0 @@ -# Copyright 2016 Benjamin Barenblat -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - -cmake_policy(VERSION 3.0.2) -cmake_minimum_required(VERSION 3.0) - -project( - scoville - VERSION 0.0.0 - LANGUAGES CXX -) - -set(CMAKE_CXX_COMPILER clang++) - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_FORTIFY_SOURCE=2") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -D_GLIBCXX_DEBUG -D_GLIBCXX_DEBUG_PEDANTIC") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++14") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftrapv") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-strict-aliasing") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fstack-protector-strong --param=ssp-buffer-size=4") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Weverything -Wno-c++98-compat") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-padded") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-weak-vtables") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wno-unused-macros") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIE") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-rtti") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fuse-cxa-atexit") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -pipe") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffunction-sections -fdata-sections") - -set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG") # Use -O2, not -O3 - -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--gc-sections") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-Bsymbolic-functions") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,now") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,-z,relro") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--hash-style=gnu") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--no-copy-dt-needed-entries") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--as-needed") - -add_subdirectory(src) diff --git a/build.ninja b/build.ninja new file mode 100644 index 0000000..0b5be18 --- /dev/null +++ b/build.ninja @@ -0,0 +1,42 @@ +# Copyright 2020 Benjamin Barenblat +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may not +# use this file except in compliance with the License. You may obtain a copy of +# the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +ninja_required_version = 1.3 + +cxx = clang++ +cflags = -O2 -DNDEBUG -D_FORTIFY_SOURCE -D_GLIBCXX_DEBUG $ + -D_GLIBCXX_DEBUG_PEDANTIC -std=c++14 -ftrapv -fno-strict-aliasing $ + -fstack-protector-strong --param=ssp-buffer-size=4 -Weverything $ + -Wno-c++98-compat -Wno-padded -Wno-weak-vtables -Wno-unused-macros -fPIE $ + -fno-rtti -fuse-cxa-atexit -pipe -ffunction-sections -fdata-sections $ + -D_FILE_OFFSET_BITS=64 -I/usr/include/fuse +ldflags = -Wl,--gc-sections -Wl,-Bsymbolic-functions -pie -Wl,-z,now -Wl,-z,relro -Wl,--hash-style=gnu -Wl,--no-copy-dt-needed-entries -Wl,--as-needed -pthread +libs = -lfuse -lglog -lgflags + +rule cxx + command = $cxx -MMD -MT $out -MF $out.d $cflags -c $in -o $out + description = CXX $out + depfile = $out.d + deps = gcc + +rule link + command = $cxx $ldflags -o $out $in $libs + description = LINK $out + +build encoding.o: cxx encoding.cc +build operations.o: cxx operations.cc +build posix_extras.o: cxx posix_extras.cc +build scoville.o: cxx scoville.cc + +build scoville: link encoding.o operations.o posix_extras.o scoville.o diff --git a/src/encoding.cc b/encoding.cc index 702b2c4..702b2c4 100644 --- a/src/encoding.cc +++ b/encoding.cc diff --git a/src/encoding.h b/encoding.h index d6e72ea..d6e72ea 100644 --- a/src/encoding.h +++ b/encoding.h diff --git a/src/operations.cc b/operations.cc index 99817a1..99817a1 100644 --- a/src/operations.cc +++ b/operations.cc diff --git a/src/operations.h b/operations.h index 33e0767..33e0767 100644 --- a/src/operations.h +++ b/operations.h diff --git a/src/posix_extras.cc b/posix_extras.cc index 3e916ad..3e916ad 100644 --- a/src/posix_extras.cc +++ b/posix_extras.cc diff --git a/src/posix_extras.h b/posix_extras.h index 9dec22d..9dec22d 100644 --- a/src/posix_extras.h +++ b/posix_extras.h diff --git a/src/scoville.cc b/scoville.cc index 2eff02e..2eff02e 100644 --- a/src/scoville.cc +++ b/scoville.cc diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt deleted file mode 100644 index 3f1fb15..0000000 --- a/src/CMakeLists.txt +++ /dev/null @@ -1,55 +0,0 @@ -# Copyright 2016 Benjamin Barenblat -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not -# use this file except in compliance with the License. You may obtain a copy of -# the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT -# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the -# License for the specific language governing permissions and limitations under -# the License. - -include(FindPkgConfig) - -pkg_check_modules(FUSE REQUIRED fuse) -pkg_check_modules(GFLAGS REQUIRED libgflags) -pkg_check_modules(GLOG REQUIRED libglog) - -link_directories( - ${FUSE_LIBRARY_DIRS} - ${GFLAGS_LIBRARY_DIRS} - ${GLOG_LIBRARY_DIRS} -) - -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${FUSE_CFLAGS_OTHER}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GFLAGS_CFLAGS_OTHER}") -set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${GLOG_CFLAGS_OTHER}") - -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${FUSE_LDFLAGS_OTHER}") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GFLAGS_LDFLAGS_OTHER}") -set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${GLOG_LDFLAGS_OTHER}") - -add_executable( - scoville - encoding.cc - operations.cc - posix_extras.cc - scoville.cc -) - -target_include_directories( - scoville - SYSTEM PRIVATE ${FUSE_INCLUDE_DIRS} - SYSTEM PRIVATE ${GFLAGS_INCLUDE_DIRS} - SYSTEM PRIVATE ${GLOG_INCLUDE_DIRS} -) - -target_link_libraries( - scoville - ${FUSE_LIBRARIES} - ${GFLAGS_LIBRARIES} - ${GLOG_LIBRARIES} -) |