aboutsummaryrefslogtreecommitdiff
path: root/src/blocks/CMakeLists.txt
diff options
context:
space:
mode:
authorRiccardo Spagni <ric@spagni.net>2018-10-08 21:39:54 +0200
committerRiccardo Spagni <ric@spagni.net>2018-10-08 21:39:54 +0200
commitac5674524a485c069800912f79b1b44840e391fc (patch)
treeceaa102dbb8b7b485b6750c695c2d0208545583f /src/blocks/CMakeLists.txt
parentMerge pull request #4514 (diff)
downloadmonero-ac5674524a485c069800912f79b1b44840e391fc.tar.xz
Revert "Merge pull request #4472"
This reverts commit 79d46c4d551a9b1261801960095bf4d24967211a, reversing changes made to c9fc61dbb56cca442c775faa2554a7460879b637.
Diffstat (limited to 'src/blocks/CMakeLists.txt')
-rw-r--r--src/blocks/CMakeLists.txt35
1 files changed, 16 insertions, 19 deletions
diff --git a/src/blocks/CMakeLists.txt b/src/blocks/CMakeLists.txt
index bedda3b88..ebb5408cc 100644
--- a/src/blocks/CMakeLists.txt
+++ b/src/blocks/CMakeLists.txt
@@ -26,23 +26,20 @@
# STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
# THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
-set(GENERATED_SOURCES "")
+if(APPLE)
+ add_library(blocks STATIC blockexports.c)
+ set_target_properties(blocks PROPERTIES LINKER_LANGUAGE C)
+else()
+ if(LINUX_32)
+ add_custom_command(OUTPUT blocks.o MAIN_DEPENDENCY blocks.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} -m elf_i386 ${LD_RAW_FLAGS} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/blocks.o blocks.dat)
+ add_custom_command(OUTPUT testnet_blocks.o MAIN_DEPENDENCY testnet_blocks.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} -m elf_i386 ${LD_RAW_FLAGS} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/testnet_blocks.o testnet_blocks.dat)
+ add_custom_command(OUTPUT stagenet_blocks.o MAIN_DEPENDENCY stagenet_blocks.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} -m elf_i386 ${LD_RAW_FLAGS} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/stagenet_blocks.o stagenet_blocks.dat)
+ else()
+ add_custom_command(OUTPUT blocks.o MAIN_DEPENDENCY blocks.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} ${LD_RAW_FLAGS} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/blocks.o blocks.dat)
+ add_custom_command(OUTPUT testnet_blocks.o MAIN_DEPENDENCY testnet_blocks.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} ${LD_RAW_FLAGS} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/testnet_blocks.o testnet_blocks.dat)
+ add_custom_command(OUTPUT stagenet_blocks.o MAIN_DEPENDENCY stagenet_blocks.dat COMMAND cd ${CMAKE_CURRENT_SOURCE_DIR} && ${CMAKE_LINKER} ${LD_RAW_FLAGS} -r -b binary -o ${CMAKE_CURRENT_BINARY_DIR}/stagenet_blocks.o stagenet_blocks.dat)
+ endif()
+ add_library(blocks STATIC blocks.o testnet_blocks.o stagenet_blocks.o blockexports.c)
+ set_target_properties(blocks PROPERTIES LINKER_LANGUAGE C)
+endif()
-foreach(BLOB_NAME checkpoints testnet_blocks stagenet_blocks)
- set(OUTPUT_C_SOURCE "generated_${BLOB_NAME}.c")
- list(APPEND GENERATED_SOURCES ${OUTPUT_C_SOURCE})
- set(INPUT_DAT_FILE "${BLOB_NAME}.dat")
- add_custom_command(
- OUTPUT ${OUTPUT_C_SOURCE}
- MAIN_DEPENDENCY ${INPUT_DAT_FILE}
- COMMAND
- cd ${CMAKE_CURRENT_BINARY_DIR} &&
- echo "'#include\t<stddef.h>'" > ${OUTPUT_C_SOURCE} &&
- echo -n "'const\tunsigned\tchar\t${BLOB_NAME}[]={'" >> ${OUTPUT_C_SOURCE} &&
- od -v -An -w1 -tu1 ${CMAKE_CURRENT_SOURCE_DIR}/${INPUT_DAT_FILE} | sed -e "':a;N;$$!ba;s/\\n/,/g'" >> ${OUTPUT_C_SOURCE} &&
- echo "'};'" >> ${OUTPUT_C_SOURCE} &&
- echo "'const\tsize_t\t${BLOB_NAME}_len\t=\tsizeof(${BLOB_NAME});'" >> ${OUTPUT_C_SOURCE}
- )
-endforeach()
-
-add_library(blocks STATIC blocks.cpp ${GENERATED_SOURCES})