Merge pull request #59 from gsomlo/gls-cmake-fixes-v0
Additional libtrellis cmake fixes
diff --git a/examples/ecp5_evn/Makefile b/examples/ecp5_evn/Makefile
index cfcaf93..51f1a6f 100644
--- a/examples/ecp5_evn/Makefile
+++ b/examples/ecp5_evn/Makefile
@@ -1,4 +1,5 @@
PROJ=blinky
+TRELLIS=/usr/share/trellis
all: ${PROJ}.bit
@@ -14,7 +15,7 @@
${PROJ}.svf : ${PROJ}.bit
prog: ${PROJ}.svf
- openocd -f ../../misc/openocd/ecp5-evn.cfg -c "transport select jtag; init; svf $<; exit"
+ openocd -f ${TRELLIS}/misc/openocd/ecp5-evn.cfg -c "transport select jtag; init; svf $<; exit"
clean:
rm -f *.svf *.bit *.config *.json
diff --git a/examples/picorv32_versa5g/Makefile b/examples/picorv32_versa5g/Makefile
index f8cf004..d8ce55d 100644
--- a/examples/picorv32_versa5g/Makefile
+++ b/examples/picorv32_versa5g/Makefile
@@ -1,3 +1,5 @@
+TRELLIS=/usr/share/trellis
+
firmware.elf: sections.lds firmware.s
riscv32-unknown-elf-gcc -march=rv32i -Wl,-Bstatic,-T,sections.lds,--strip-debug -ffreestanding -nostdlib -o firmware.elf firmware.s
@@ -14,7 +16,7 @@
yosys -p "synth_ecp5 -nomux -json $@ -top top" io_wrapper.v attosoc.v picorv32.v
attosoc_out.config: attosoc.json
- nextpnr-ecp5 --json $< --basecfg ../../misc/basecfgs/empty_lfe5um5g-45f.config --textcfg $@ --um5g-45k
+ nextpnr-ecp5 --json $< --textcfg $@ --um5g-45k
attosoc.bit: attosoc_out.config
ecppack --svf-rowsize 100000 --svf attosoc.svf $< $@
@@ -22,7 +24,7 @@
attosoc.svf: attosoc.bit
prog: attosoc.svf
- openocd -f ../../misc/openocd/ecp5-versa5g.cfg -c "transport select jtag; init; svf $<; exit"
+ openocd -f ${TRELLIS}/misc/openocd/ecp5-versa5g.cfg -c "transport select jtag; init; svf $<; exit"
.PHONY: attosoc_sim clean prog
.PRECIOUS: attosoc.json attosoc_out.config attosoc.bit
diff --git a/examples/soc_ecp5_evn/Makefile b/examples/soc_ecp5_evn/Makefile
index 73d3e71..2e45d3b 100644
--- a/examples/soc_ecp5_evn/Makefile
+++ b/examples/soc_ecp5_evn/Makefile
@@ -1,3 +1,5 @@
+TRELLIS=/usr/share/trellis
+
firmware.elf: sections.lds start.s firmware.c
riscv32-unknown-elf-gcc -march=rv32i -Wl,-Bstatic,-T,sections.lds,--strip-debug -ffreestanding -nostdlib -o firmware.elf start.s firmware.c
@@ -25,7 +27,7 @@
%.svf: %.bit
prog: attosoc.svf
- openocd -f ../../misc/openocd/ecp5-evn.cfg -c "transport select jtag; init; svf $<; exit"
+ openocd -f ${TRELLIS}/misc/openocd/ecp5-evn.cfg -c "transport select jtag; init; svf $<; exit"
.PHONY: attosoc_sim clean prog
.PRECIOUS: attosoc.json attosoc_out.config attosoc.bit
diff --git a/examples/soc_versa5g/Makefile b/examples/soc_versa5g/Makefile
index e1b37da..d62934d 100644
--- a/examples/soc_versa5g/Makefile
+++ b/examples/soc_versa5g/Makefile
@@ -1,3 +1,5 @@
+TRELLIS=/usr/share/trellis
+
firmware.elf: sections.lds start.s firmware.c
riscv32-unknown-elf-gcc -march=rv32i -Wl,-Bstatic,-T,sections.lds,--strip-debug -ffreestanding -nostdlib -o firmware.elf start.s firmware.c
@@ -25,7 +27,7 @@
%.svf: %.bit
prog: attosoc.svf
- openocd -f ../../misc/openocd/ecp5-versa5g.cfg -c "transport select jtag; init; svf $<; exit"
+ openocd -f ${TRELLIS}/misc/openocd/ecp5-versa5g.cfg -c "transport select jtag; init; svf $<; exit"
.PHONY: attosoc_sim clean prog
.PRECIOUS: attosoc.json attosoc_out.config attosoc.bit
diff --git a/examples/versa5g/Makefile b/examples/versa5g/Makefile
index fdb75a2..811295c 100644
--- a/examples/versa5g/Makefile
+++ b/examples/versa5g/Makefile
@@ -1,5 +1,6 @@
PROJ=demo
CONSTR=versa.lpf
+TRELLIS=/usr/share/trellis
all: ${PROJ}.bit
@@ -18,7 +19,7 @@
${PROJ}.svf: ${PROJ}.bit
prog: ${PROJ}.svf
- openocd -f ../../misc/openocd/ecp5-versa5g.cfg -c "transport select jtag; init; svf $<; exit"
+ openocd -f ${TRELLIS}/misc/openocd/ecp5-versa5g.cfg -c "transport select jtag; init; svf $<; exit"
.PHONY: prog
.PRECIOUS: ${PROJ}.json ${PROJ}_out.config
diff --git a/libtrellis/CMakeLists.txt b/libtrellis/CMakeLists.txt
index 4f3edb9..4a3b9c0 100644
--- a/libtrellis/CMakeLists.txt
+++ b/libtrellis/CMakeLists.txt
@@ -108,16 +108,23 @@
find_package(Boost REQUIRED COMPONENTS program_options)
+get_property(LIB64 GLOBAL PROPERTY FIND_LIBRARY_USE_LIB64_PATHS)
+if ("${LIB64}" STREQUAL "TRUE")
+ set(LIBDIR "lib64")
+else()
+ set(LIBDIR "lib")
+endif()
+
function(setup_rpath name)
if(APPLE)
set_target_properties(${name} PROPERTIES
BUILD_WITH_INSTALL_RPATH ON
- INSTALL_RPATH "@loader_path/../lib"
+ INSTALL_RPATH "@loader_path/../${LIBDIR}/trellis"
INSTALL_NAME_DIR "@rpath")
elseif(UNIX)
set_target_properties(${name} PROPERTIES
BUILD_WITH_INSTALL_RPATH ON
- INSTALL_RPATH "\$ORIGIN/../lib")
+ INSTALL_RPATH "\$ORIGIN/../${LIBDIR}/trellis")
endif()
endfunction()
@@ -137,14 +144,14 @@
setup_rpath(ecppll)
if (BUILD_SHARED)
- install(TARGETS trellis ecppack ecppll ecpunpack LIBRARY DESTINATION lib RUNTIME DESTINATION bin)
+ install(TARGETS trellis ecppack ecppll ecpunpack LIBRARY DESTINATION ${LIBDIR}/trellis RUNTIME DESTINATION bin)
else()
install(TARGETS ecppack ecpunpack ecppll RUNTIME DESTINATION bin)
endif()
install(DIRECTORY ../database DESTINATION share/trellis PATTERN ".git" EXCLUDE)
install(DIRECTORY ../misc DESTINATION share/trellis)
install(DIRECTORY ../util/common DESTINATION share/trellis/util)
-install(DIRECTORY ../timing/util DESTINATION share/trellis/timing)
+install(DIRECTORY ../timing/util DESTINATION share/trellis/timing USE_SOURCE_PERMISSIONS)
if (BUILD_SHARED)
- install(TARGETS pytrellis DESTINATION share/trellis/libtrellis)
+ install(TARGETS pytrellis DESTINATION ${LIBDIR}/trellis)
endif()