Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Got windows cross build to properly link.

  • Loading branch information...
commit 46907be41451927a48a145ad67a15ec5c31a04b8 1 parent 423512d
Caleb James DeLisle authored
View
11 CMakeLists.txt
@@ -31,9 +31,6 @@ if(WIN32)
# proceed with ifdef hell :(
add_definitions(-DWIN32)
- set(PLATFORM_LIBRARIES
- ws2_32
- )
# BufferAllocator.c:1:0: error: -fPIC ignored for target (all code is position independent)
set(WITH_PIE OFF CACHE INTERNAL "" FORCE)
@@ -150,14 +147,16 @@ else()
add_definitions(-g)
endif()
-if(NOT DEFINED APPLE AND NOT WIN32 AND NOT ILLUMOS)
- set(CMAKE_EXE_LINKER_FLAGS "${PIE} -Wl,-z,relro,-z,now,-z,noexecstack")
+if(WIN32)
+ set(CMAKE_EXE_LINKER_FLAGS "${PIE}")
elseif(ILLUMOS)
# TODO make this less ugly
set(CMAKE_EXE_LINKER_FLAGS "${PIE} -lsocket")
-else()
+else(APPLE)
# apple seems to set noexecstack by default and not support relro.
set(CMAKE_EXE_LINKER_FLAGS "${PIE}")
+else()
+ set(CMAKE_EXE_LINKER_FLAGS "${PIE} -Wl,-z,relro,-z,now,-z,noexecstack")
endif()
# logging
View
2  CMakeWindows.txt
@@ -18,7 +18,7 @@ SET(CMAKE_CXX_COMPILER i586-mingw32msvc-g++)
SET(CMAKE_RC_COMPILER i586-mingw32msvc-windres)
# here is the target environment located
-SET(CMAKE_FIND_ROOT_PATH /usr/i586-mingw32msvc)
+SET(CMAKE_FIND_ROOT_PATH /usr/i686-w64-mingw32)
# nacl needs this define for some of it's tests.
add_definitions("-D random=rand")
View
1  admin/angel/CMakeLists.txt
@@ -53,7 +53,6 @@ target_link_libraries(cjdns-core
cjdns-admin
cjdnet
${LIBEVENT2_LIBRARIES}
- ${PLATFORM_LIBRARIES}
cjdns-interface-waiter
cjdns-util-log-writer
cjdns-admin-logger
View
53 cmake/modules/FindClockGettime.cmake
@@ -0,0 +1,53 @@
+# You may redistribute this program and/or modify it under the terms of
+# the GNU General Public License as published by the Free Software Foundation,
+# either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This is for finding berkley socket functions
+# it specifically looks for socket()
+
+include(CheckFunctionExists)
+
+if(NOT CLOCK_GETTIME_FOUND AND NOT NO_CLOCK_GETTIME)
+ check_function_exists(clock_gettime HAVE_GETTING)
+ if(HAVE_GETTING)
+ set(CLOCK_GETTIME_FOUND TRUE)
+ set(CLOCK_GETTIME_LIBRARIES "")
+ else()
+ message("clock_gettime() not found, searching for library")
+ endif()
+
+ if(NOT CLOCK_GETTIME_FOUND)
+ find_library(CLOCK_GETTIME_LIBRARIES
+ NAMES
+ rt
+ PATHS
+ ${CLOCK_GETTIME_PREFIX}/lib/
+ /usr/local/lib64/
+ /usr/local/lib/
+ /usr/lib/i386-linux-gnu/
+ /usr/lib/x86_64-linux-gnu/
+ /usr/lib64/
+ /usr/lib/
+ )
+
+ if(CLOCK_GETTIME_LIBRARIES)
+ message("Yay clock_gettime() was found at [${CLOCK_GETTIME_LIBRARIES}]")
+ set(CLOCK_GETTIME_FOUND TRUE)
+ else()
+ message("Could not find clock_gettime()")
+ if(ClockGettimt_FIND_REQUIRED)
+ message(FATAL_ERROR "Try to setup CLOCK_GETTIME_PREFIX accordingly")
+ else()
+ message("Skipping because ClockGettime_FIND_REQUIRED is not set")
+ endif()
+ endif()
+ endif()
+endif()
View
31 cmake/modules/FindLibevent2.cmake
@@ -13,24 +13,16 @@
INCLUDE(CheckLibraryExists)
INCLUDE(CheckFunctionExists)
-# check additional dependencies if libevent is static linked.
-function(include_clock_gettime)
- # TODO: check libevent2/libevent.pc instead of guessing...
-
- # clock_gettime is used only if it is available on the platform
- # check whether it is in the default lib
- CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME)
-
- # may have been using librt for clock_gettime
- if(NOT HAVE_CLOCK_GETTIME)
- find_package(Librt)
+find_package(Socket REQUIRED)
+if(NOT WIN32)
+ # Libevent doesn't use gettime if it's in windows mode
+ find_package(ClockGettime REQUIRED)
+endif()
- if(LIBRT_FOUND)
- set_property(TARGET event2
- PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES ${LIBRT_LIBRARIES})
- endif()
- endif()
-endfunction()
+function(addDependencies)
+ set_property(TARGET event2
+ PROPERTY IMPORTED_LINK_INTERFACE_LIBRARIES ${SOCKET_LIBRARIES} ${CLOCK_GETTIME_LIBRARIES})
+endFunction()
if (NOT LIBEVENT2_FOUND AND "$ENV{STATIC}" STREQUAL "")
@@ -79,7 +71,7 @@ if (NOT LIBEVENT2_FOUND AND "$ENV{STATIC}" STREQUAL "")
if("${LIBEVENT2_INCLUDE_DIRS}" STREQUAL "${CMAKE_BINARY_DIR}/libevent2/include")
add_library(event2 STATIC IMPORTED)
set_property(TARGET event2 PROPERTY IMPORTED_LOCATION ${LIBEVENT2_LIBRARIES})
- includeLibrt()
+ addDependencies()
set(LIBEVENT2_LIBRARIES event2)
endif()
endif()
@@ -138,7 +130,8 @@ if (NOT LIBEVENT2_FOUND AND "$ENV{NO_STATIC}" STREQUAL "")
set_property(TARGET event2
PROPERTY IMPORTED_LOCATION ${CMAKE_BINARY_DIR}/libevent2/.libs/libevent.a)
- include_clock_gettime()
+ addDependencies()
+
set(LIBEVENT2_LIBRARIES event2)
set(LIBEVENT2_FOUND TRUE)
endif()
View
46 cmake/modules/FindLibrt.cmake
@@ -1,46 +0,0 @@
-# You may redistribute this program and/or modify it under the terms of
-# the GNU General Public License as published by the Free Software Foundation,
-# either version 3 of the License, or (at your option) any later version.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-if(NOT LIBRT_FOUND AND NOT NO_LIBRT)
-
- find_path(LIBRT_INCLUDE_DIR
- NAMES
- time.h
- PATHS
- ${LIBRT_PREFIX}/include/
- )
-
- find_library(LIBRT_LIBRARIES
- NAMES
- librt.so
- PATHS
- ${LIBRT_PREFIX}/lib/
- /usr/local/lib64/
- /usr/local/lib/
- /usr/lib/i386-linux-gnu/
- /usr/lib/x86_64-linux-gnu/
- /usr/lib64/
- /usr/lib/
- )
-
- if (LIBRT_INCLUDE_DIR AND LIBRT_LIBRARIES)
- set (LIBRT_FOUND TRUE)
- endif (LIBRT_INCLUDE_DIR AND LIBRT_LIBRARIES)
-
- if (LIBRT_FOUND)
- message(STATUS "Found librt: ${LIBRT_INCLUDE_DIR}, ${LIBRT_LIBRARIES}")
- else (LIBRT_FOUND)
- if (Librt_FIND_REQUIRED)
- message (FATAL_ERROR "Could not find librt, try to setup LIBRT_PREFIX accordingly")
- endif (Librt_FIND_REQUIRED)
- endif (LIBRT_FOUND)
-
-endif()
View
48 cmake/modules/FindSocket.cmake
@@ -0,0 +1,48 @@
+# You may redistribute this program and/or modify it under the terms of
+# the GNU General Public License as published by the Free Software Foundation,
+# either version 3 of the License, or (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# This is for finding berkley socket functions
+# it specifically looks for socket()
+
+include(CheckFunctionExists)
+
+if(NOT SOCKET_FOUND AND NOT NO_SOCKET)
+ check_function_exists(socket HAVE_SOCKET)
+ if(HAVE_SOCKET)
+ set(SOCKET_FOUND TRUE)
+ set(SOCKET_LIBRARIES "")
+ else()
+ message("socket() not found, searching for library")
+ endif()
+
+ # mingw32 uses ws2_32
+ # illumos uses socket
+ if(NOT SOCKET_FOUND)
+ find_library(SOCKET_LIBRARIES
+ NAMES
+ ws2_32
+ socket
+ PATHS
+ ${SOCKET_PREFIX}/
+ /lib/
+ )
+
+ if(SOCKET_LIBRARIES)
+ message("Yay socket() was found at [${SOCKET_LIBRARIES}]")
+ set(SOCKET_FOUND TRUE)
+ elseif(Socket_FIND_REQUIRED)
+ message(FATAL_ERROR "Could not find socket(), try to setup SOCKET_PREFIX accordingly")
+ else()
+ message("Could not find socket(), skipping because Socket_FIND_REQUIRED is not set")
+ endif()
+ endif()
+endif()
View
24 interface/TUNConfigurator_W32.c
@@ -15,9 +15,25 @@
#include "interface/TUNConfigurator.h"
#include "interface/TUNInterface.h"
-int TUNConfigurator_configure(struct TUNInterface* iface,
- uint8_t address[16],
- int prefixLen)
+void* TUNConfigurator_initTun(const char* interfaceName,
+ char assignedInterfaceName[TUNConfigurator_IFNAMSIZ],
+ struct Log* logger,
+ struct Except* eh)
+{
+ return NULL;
+}
+
+void TUNConfigurator_setIpAddress(const char* interfaceName,
+ const uint8_t address[16],
+ int prefixLen,
+ struct Log* logger,
+ struct Except* eh)
+{
+}
+
+void TUNConfigurator_setMTU(const char* interfaceName,
+ uint32_t mtu,
+ struct Log* logger,
+ struct Except* eh)
{
- return 0;
}
View
3  util/test/Process_test.c
@@ -16,6 +16,7 @@
#include "memory/MallocAllocator.h"
#include "util/Assert.h"
#include "util/Process.h"
+#include "util/Pipe.h"
#include <string.h>
#include <unistd.h>
@@ -43,7 +44,7 @@ int main(int argc, char** argv)
Assert_true(path[0] == '/');
int fds[2];
- Assert_true(!pipe(fds));
+ Assert_true(!Pipe_createUniPipe(fds));
char fdName[32];
snprintf(fdName, 32, "%d", fds[1]);
Please sign in to comment.
Something went wrong with that request. Please try again.