From c9e8000c5f7994d29ff75dfc5d39a174044633eb Mon Sep 17 00:00:00 2001 From: Veikko Sariola Date: Fri, 23 Oct 2020 00:04:54 +0300 Subject: [PATCH] Remove the cmake magic to create bridge.go from bridge.go.in. The bridge.go now just assumes that the library you want is built in the build/ directory. It's probably a lot better idea than using wherever the latest build was; this way the same build is always used for the library. --- .gitignore | 1 - BindConfig.txt | 20 -------------------- README.md | 4 ++++ bridge/{bridge.go.in => bridge.go} | 4 ++-- src/CMakeLists.txt | 6 ------ 5 files changed, 6 insertions(+), 29 deletions(-) delete mode 100644 BindConfig.txt rename bridge/{bridge.go.in => bridge.go} (96%) diff --git a/.gitignore b/.gitignore index ad13467..d2c7df4 100644 --- a/.gitignore +++ b/.gitignore @@ -22,7 +22,6 @@ old/ # project specific # this is autogenerated from bridge.go.in -bridge/bridge.go build/ build32/ build64/ diff --git a/BindConfig.txt b/BindConfig.txt deleted file mode 100644 index 894a3bd..0000000 --- a/BindConfig.txt +++ /dev/null @@ -1,20 +0,0 @@ -# Copyright 2012 Douglas Linder -# -# 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_minimum_required (VERSION 2.8) -SET(HERE "${CMAKE_ARGV3}") -SET(INCLUDE_PATH "${CMAKE_ARGV4}") -SET(LIBRARY_PATH "${CMAKE_ARGV5}") -message("${LIBRARY_PATH} ${INCLUDE_PATH}") -configure_file(${HERE}/bridge/bridge.go.in ${HERE}/bridge/bridge.go) \ No newline at end of file diff --git a/README.md b/README.md index 3087baf..89d68ae 100644 --- a/README.md +++ b/README.md @@ -40,6 +40,10 @@ binaries on 64-bit Windows, replace in above: cmake .. -DCMAKE_C_FLAGS="-m32" -DCMAKE_ASM_NASM_OBJECT_FORMAT="win32" -G"MinGW Makefiles" ``` +If you plan to build the Sointu library for using it from the Go side, you +*must* build in the build/ directory, as bridge.go assumes the library can be +found from build/src/. + > :warning: **If you are using MinGW**: Yasm 1.3.0 (currently still the latest stable release) and GNU linker do not play nicely along, trashing the BSS layout. See [here](https://tortall.lighthouseapp.com/projects/78676/tickets/274-bss-problem-with-windows-win64) diff --git a/bridge/bridge.go.in b/bridge/bridge.go similarity index 96% rename from bridge/bridge.go.in rename to bridge/bridge.go index c1d8cfe..3ffb595 100644 --- a/bridge/bridge.go.in +++ b/bridge/bridge.go @@ -3,8 +3,8 @@ package bridge import "fmt" import "unsafe" -// #cgo CFLAGS: -I${INCLUDE_PATH} -// #cgo LDFLAGS: ${LIBRARY_PATH} +// #cgo CFLAGS: -I"${SRCDIR}/../include" +// #cgo LDFLAGS: "${SRCDIR}/../build/src/libsointu.a" // #include import "C" diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index c1145db..94221c8 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -10,9 +10,3 @@ add_library(${LIB} ${SOURCES}) set_target_properties(${LIB} PROPERTIES LINKER_LANGUAGE C) target_link_libraries(${LIB}) target_compile_definitions(${LIB} PUBLIC SU_USE_INTROSPECTION) - -# Generate cgo wrapper -add_custom_command(TARGET ${LIB} - POST_BUILD - COMMAND ${CMAKE_COMMAND} -P ${PROJECT_SOURCE_DIR}/BindConfig.txt ${PROJECT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include $ -)