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.
This commit is contained in:
Veikko Sariola 2020-10-23 00:04:54 +03:00
parent 163af33c9b
commit c9e8000c5f
5 changed files with 6 additions and 29 deletions

1
.gitignore vendored
View File

@ -22,7 +22,6 @@ old/
# project specific
# this is autogenerated from bridge.go.in
bridge/bridge.go
build/
build32/
build64/

View File

@ -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)

View File

@ -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)

View File

@ -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 <sointu.h>
import "C"

View File

@ -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 $<TARGET_FILE:sointu>
)